WIP : admin profiles
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
|
||||
{block name="page-title"}{intl l='Taxes rules'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.taxes-rules.view{/block}
|
||||
{block name="check-permissions"}admin.profile.view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="taxes-rules">
|
||||
<div>
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/taxes_rules'}">{intl l="Taxes rules"}</a></li>
|
||||
<li><a href="{url path='/admin/configuration/profiles'}">{intl l="Profiles"}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{module_include location='taxes_rules_top'}
|
||||
{module_include location='profiles_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -27,8 +27,8 @@
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l="Taxes"}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.taxes.create"}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new tax'}" href="#tax_create_dialog" data-toggle="modal">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.profile.create"}
|
||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new profile'}" href="#profile_create_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
@@ -42,19 +42,19 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{loop type="tax" name="taxes" backend_context="1"}
|
||||
{loop type="profile" name="profiles" backend_context="1"}
|
||||
|
||||
<tr>
|
||||
<td>{$TITLE}</td>
|
||||
<td>{$DESCRIPTION}</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.taxes.change"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Change this tax'}" href="{url path="/admin/configuration/taxes/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.profile.change"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Change this profile'}" href="{url path="/admin/configuration/profiles/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.taxes.change"}
|
||||
<a class="btn btn-default btn-xs js-delete-tax" title="{intl l='Delete this tax'}" href="#tax_delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.profile.change"}
|
||||
<a class="btn btn-default btn-xs js-delete-profile" title="{intl l='Delete this profile'}" href="#profile_delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
@@ -71,22 +71,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='taxes_rules_bottom'}
|
||||
{module_include location='profiles_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* -- Add tax confirmation dialog ----------------------------------- *}
|
||||
{form name="thelia.admin.tax.add"}
|
||||
{* -- Add profile confirmation dialog ----------------------------------- *}
|
||||
{form name="thelia.admin.profile.add"}
|
||||
|
||||
{if $form_error_message}
|
||||
{$taxCreateError = true}
|
||||
{$profileCreateError = true}
|
||||
{else}
|
||||
{$taxCreateError = false}
|
||||
{$profileCreateError = false}
|
||||
{/if}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "tax_create_dialog"}
|
||||
{capture "profile_create_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
@@ -94,10 +94,24 @@
|
||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='code'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l=$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Profile code'}" placeholder="{intl l='Profile code'}" class="form-control" value="{if $form_error}{$value}{/if}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l=$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{if $form_error}{$value}{else}{if $IS_TRANSLATED == 1}{$TITLE}{/if}{/if}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{if $form_error}{$value}{/if}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='chapo'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l=$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" title="{intl l='Short description'}" placeholder="{intl l='Short description'}" class="form-control" value="{if $form_error}{$value}{/if}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
@@ -108,122 +122,14 @@
|
||||
<span class="label-help-block">{intl l="The detailed description."}</span>
|
||||
</label>
|
||||
|
||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control wysiwyg">{if $form_error}{$value}{else}{if $IS_TRANSLATED == 1}{$DESCRIPTION}{/if}{/if}</textarea>
|
||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control wysiwyg">{if $form_error}{$value}{/if}</textarea>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='type'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{intl l=$label} :
|
||||
</label>
|
||||
|
||||
<div class="form-group">
|
||||
<select name="{$name}" class="js-change-tax-type" data-toggle="selectpicker">
|
||||
{$typeValueWithError = $value}
|
||||
{foreach from=$choices key=key item=choice}
|
||||
{if $key == 0}
|
||||
{$typeValue = $choice->value}
|
||||
{/if}
|
||||
<option value="{$choice->value}" {if $form_error && $choice->value == $value || !$form_error && $key == 0}selected="selected" {/if}>{$choice->label}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_tagged_fields form=$form tag='requirements'}
|
||||
<div class="form-group {if $error}has-error{/if} js-tax-requirements" data-tax-type="{$attr_list.tax_type}" {if !$form_error && $attr_list.tax_type != $typeValue || $form_error && $attr_list.tax_type != $typeValueWithError}style="display: none"{/if}>
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{intl l=$label}
|
||||
</label>
|
||||
{if $formType == 'choice'}
|
||||
<select name="{$name}" data-toggle="selectpicker" {if !$form_error && $attr_list.tax_type != $typeValue || $form_error && $attr_list.tax_type != $typeValueWithError}disabled="disabled"{/if}>
|
||||
{foreach $choices as $choice}
|
||||
<option value="{$choice->value}" {if !$form_error && $REQUIREMENTS.$label == $choice->value || $form_error && $value == $choice->value}selected="selected" {/if}>{$choice->label}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{/if}
|
||||
{if $formType == 'text'}
|
||||
<input type="text" {if !$form_error && $attr_list.tax_type != $typeValue || $form_error && $attr_list.tax_type != $typeValueWithError}disabled="disabled"{/if} id="{$label_attr.for}" name="{$name}" required="required" class="form-control" value="{if $form_error}{$value}{else}{$REQUIREMENTS.$label}{/if}">
|
||||
{/if}
|
||||
</div>
|
||||
{/form_tagged_fields}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "tax_create_dialog"
|
||||
dialog_title = {intl l="Create a new tax"}
|
||||
dialog_body = {$smarty.capture.tax_create_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path="/admin/configuration/taxes/add"}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{/form}
|
||||
|
||||
{* -- Delete tax confirmation dialog ----------------------------------- *}
|
||||
|
||||
{capture "tax_delete_dialog"}
|
||||
<input type="hidden" name="tax_id" id="tax_delete_id" value="" />
|
||||
|
||||
{module_include location='tax_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "tax_delete_dialog"
|
||||
dialog_title = {intl l="Delete tax"}
|
||||
dialog_message = {intl l="Do you really want to delete this tax ?"}
|
||||
|
||||
form_action = {url path='/admin/configuration/taxes/delete'}
|
||||
form_content = {$smarty.capture.tax_delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{* -- Add tax rule confirmation dialog ----------------------------------- *}
|
||||
{form name="thelia.admin.taxrule.add"}
|
||||
|
||||
{if $form_error_message}
|
||||
{$taxRuleCreateError = true}
|
||||
{else}
|
||||
{$taxRuleCreateError = false}
|
||||
{/if}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "tax_rule_create_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
{form_field form=$form field='postscriptum'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l=$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$TITLE}{/if}{/if}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='description'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{intl l=$label} :
|
||||
<span class="label-help-block">{intl l="The detailed description."}</span>
|
||||
</label>
|
||||
|
||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control wysiwyg">{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$DESCRIPTION}{/if}{/if}</textarea>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" title="{intl l='Postscriptum'}" placeholder="{intl l='Postscriptum'}" class="form-control" value="{if $form_error}{$value}{/if}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
@@ -232,40 +138,39 @@
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "tax_rule_create_dialog"
|
||||
dialog_title = {intl l="Create a new tax rule"}
|
||||
dialog_body = {$smarty.capture.tax_rule_create_dialog nofilter}
|
||||
dialog_id = "profile_create_dialog"
|
||||
dialog_title = {intl l="Create a new profile"}
|
||||
dialog_body = {$smarty.capture.profile_create_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path="/admin/configuration/taxes_rules/add"}
|
||||
form_action = {url path="/admin/configuration/profiles/add"}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
|
||||
{/form}
|
||||
|
||||
{* -- Delete tax rule confirmation dialog ----------------------------------- *}
|
||||
{* -- Delete profile confirmation dialog ----------------------------------- *}
|
||||
|
||||
{capture "tax_rule_delete_dialog"}
|
||||
<input type="hidden" name="tax_rule_id" id="tax_rule_delete_id" value="" />
|
||||
{capture "profile_delete_dialog"}
|
||||
<input type="hidden" name="profile_id" id="profile_delete_id" value="" />
|
||||
|
||||
{module_include location='tax_rule_delete_form'}
|
||||
{module_include location='profile_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "tax_rule_delete_dialog"
|
||||
dialog_title = {intl l="Delete tax rule"}
|
||||
dialog_message = {intl l="Do you really want to delete this tax rule ?"}
|
||||
dialog_id = "profile_delete_dialog"
|
||||
dialog_title = {intl l="Delete profile"}
|
||||
dialog_message = {intl l="Do you really want to delete this profile ?"}
|
||||
|
||||
form_action = {url path='/admin/configuration/taxes_rules/delete'}
|
||||
form_content = {$smarty.capture.tax_rule_delete_dialog nofilter}
|
||||
form_action = {url path='/admin/configuration/profiles/delete'}
|
||||
form_content = {$smarty.capture.profile_delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
@@ -281,28 +186,12 @@
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
|
||||
{if $taxRuleCreateError == true}
|
||||
$('#tax_rule_create_dialog').modal();
|
||||
{if $profileCreateError == true}
|
||||
$('#profile_create_dialog').modal();
|
||||
{/if}
|
||||
|
||||
{if $taxCreateError == true}
|
||||
$('#tax_create_dialog').modal();
|
||||
{/if}
|
||||
|
||||
$(".js-delete-tax-rule").click(function(e){
|
||||
$('#tax_rule_delete_id').val($(this).data('id'))
|
||||
});
|
||||
|
||||
$(".js-delete-tax").click(function(e){
|
||||
$('#tax_delete_id').val($(this).data('id'))
|
||||
});
|
||||
|
||||
$('.js-change-tax-type').change(function(e){
|
||||
$('.js-tax-requirements').children('select, input').attr('disabled', true);
|
||||
$('.js-tax-requirements').hide();
|
||||
$('.js-tax-requirements[data-tax-type="' + $(this).val() + '"]').children('select, input').attr('disabled', false);
|
||||
$('.js-tax-requirements[data-tax-type="' + $(this).val() + '"]').children('select').selectpicker("refresh");
|
||||
$('.js-tax-requirements[data-tax-type="' + $(this).val() + '"]').show();
|
||||
$(".js-delete-profile").click(function(e){
|
||||
$('#profile_delete_id').val($(this).data('id'))
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user