Files
2021-01-14 18:04:26 +01:00

350 lines
20 KiB
HTML

{extends file="admin-layout.tpl"}
{block name="no-return-functions"}
{$admin_current_location = 'configuration'}
{/block}
{block name="page-title"}{intl l='Edit a profile'}{/block}
{block name="check-resource"}admin.configuration.profile{/block}
{block name="check-access"}update{/block}
{block name="main-content"}
{assign oder_tab {$smarty.get.tab|default:$smarty.post.tab|default:'data'}}
<div class="profiles edit-profiles">
<div id="wrapper" class="container">
<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/profiles'}">{intl l="Profiles"}</a></li>
<li>{intl l='Editing profile'}</li>
</ul>
{loop type="profile" name="profile" id=$profile_id backend_context="1" lang=$edit_language_id}
{hook name="profile-edit.top" profile_id=$profile_id}
<div class="row">
<div class="col-md-12 general-block-decorator clearfix">
<div class="row">
<div class="col-md-12 title">{intl l="Editing profile '%name'" name={$TITLE}}</div>
</div>
<ul class="nav nav-tabs clearfix">
<li {if $oder_tab == 'data'}class="active"{/if}><a href="#data" data-tab-name="cart" data-toggle="tab"><span class="glyphicon glyphicon-shopping-cart"></span> {intl l="Description"}</a></li>
<li {if $oder_tab == 'resources'}class="active"{/if}><a href="#resources" data-tab-name="bill" data-toggle="tab"><span class="glyphicon glyphicon-list-alt"></span> {intl l="Resource access rights"}</a></li>
<li {if $oder_tab == 'modules'}class="active"{/if}><a href="#modules" data-tab-name="bill" data-toggle="tab"><span class="glyphicon glyphicon-list-alt"></span> {intl l="Module access rights"}</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade {if $oder_tab == 'data'}active in{/if}" id="data">
<div class="form-container">
{form name="thelia.admin.profile.modification"}
<form method="POST" action="{url path="/admin/configuration/profiles/save"}" {form_enctype} >
{include
file = "includes/inner-form-toolbar.html"
hide_submit_buttons = false
page_url = {url path="/admin/configuration/profiles/update/$profile_id" tab=data}
close_url = {url path="/admin/configuration/profiles"}
}
{* Be sure to get the product ID, even if the form could not be validated *}
<input type="hidden" name="profile_id" value="{$ID}" />
{form_hidden_fields}
{form_field field='success_url'}
<input type="hidden" name="{$name}" value="{url path="/admin/configuration/profiles"}" />
{/form_field}
{form_field 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 field='title'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$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 field='chapo'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" title="{intl l='Chapo'}" placeholder="{intl l='Chapo'}" class="form-control" value="{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$CHAPO}{/if}{/if}">
</div>
{/form_field}
{form_field field='description'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">
{$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>
</div>
{/form_field}
{form_field field='postscriptum'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" title="{intl l='Postscriptum'}" placeholder="{intl l='Postscriptum'}" class="form-control" value="{if $error}{$value}{else}{if $IS_TRANSLATED == 1}{$POSTSCRIPTUM}{/if}{/if}">
</div>
{/form_field}
<div class="row">
<div class="col-md-12">
<div class="control-group">
<label>&nbsp;</label>
<div class="controls">
<p>{intl l='Profile created on %date_create. Last modification: %date_change' date_create={format_date date=$CREATE_DATE} date_change={format_date date=$UPDATE_DATE}}</p>
</div>
</div>
</div>
</div>
</form>
{/form}
</div>
</div>
<div class="tab-pane fade {if $oder_tab == 'resources'}active in{/if}" id="resources">
{form name="thelia.admin.profile.resource-access.modification"}
<form method="POST" action="{url path="/admin/configuration/profiles/saveResourceAccess?tab=resources"}" {form_enctype} >
{form_hidden_fields}
{* Be sure to get the product ID, even if the form could not be validated *}
<input type="hidden" name="profile_id" value="{$ID}" />
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<table class="table table-striped table-condensed table-left-aligned">
<caption>
{intl l="Manage resource rights"}
<button type="submit" class="btn btn-primary pull-right"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
</caption>
<thead>
<tr>
<th rowspan="2">{intl l="Resource"}</th>
<th rowspan="2">{intl l="Title"}</th>
<th colspan="5" class="text-center">{intl l="Rights"}</th>
</tr>
<tr>
<th>{intl l="View"}</th>
<th>{intl l="Create"}</th>
<th>{intl l="Update"}</th>
<th>{intl l="Delete"}</th>
<th>
<button type="button" class="btn btn-xs btn-default toggle-all" data-set="resource" title="{intl l="Toggle all rights"}">
<i class="glyphicon glyphicon-transfer"></i>
</button>
</th>
</tr>
</thead>
<tbody>
{form_tagged_fields tag='resources'}
{loop type="resource" name="resource-list" code=$attr_list.resource_code profile=$ID backend_context="1" order="code"}
<tr>
<td>{$CODE}</td>
<td>{$TITLE}</td>
<td>
<div class="make-switch switch-mini switch_set_resource switch_line_r{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" value="VIEW" type="checkbox" {if $VIEWABLE == 1}checked="checked"{/if}>
</div>
</td>
<td>
<div class="make-switch switch-mini switch_set_resource switch_line_r{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" value="CREATE" type="checkbox" {if $CREATABLE == 1}checked="checked"{/if}>
</div>
</td>
<td>
<div class="make-switch switch-mini switch_set_resource switch_line_r{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" value="UPDATE" type="checkbox" {if $UPDATABLE == 1}checked="checked"{/if}>
</div>
</td>
<td>
<div class="make-switch switch-mini switch_set_resource switch_line_r{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" value="DELETE" type="checkbox" {if $DELETABLE == 1}checked="checked"{/if}>
</div>
</td>
<td>
<button type="button" class="btn btn-xs btn-default toggle-line" data-id="r{$ID}" title="{intl l="Toggle line"}">
<i class="glyphicon glyphicon-transfer"></i>
</button>
</td>
</tr>
{/loop}
{/form_tagged_fields}
</tbody>
<tfoot>
<tr>
<td colspan="999">
<button type="submit" class="btn btn-primary pull-right"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
</td>
</tr>
</tfoot>
</table>
</form>
{/form}
</div>
<div class="tab-pane fade {if $oder_tab == 'modules'}active in{/if}" id="modules">
{form name="thelia.admin.profile.module-access.modification"}
<form method="POST" action="{url path="/admin/configuration/profiles/saveModuleAccess?tab=modules"}" {form_enctype} >
{form_hidden_fields}
{* Be sure to get the product ID, even if the form could not be validated *}
<input type="hidden" name="profile_id" value="{$ID}" />
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<table class="table table-striped table-condensed table-left-aligned">
<caption>
{intl l="Manage module rights"}
<button type="submit" class="btn btn-primary pull-right"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
</caption>
<thead>
<tr>
<th rowspan="2">{intl l="Module"}</th>
<th rowspan="2">{intl l="Title"}</th>
<th colspan="5" class="text-center">{intl l="Rights"}</th>
</tr>
<tr>
<th>{intl l="View"}</th>
<th>{intl l="Create"}</th>
<th>{intl l="Update"}</th>
<th>{intl l="Delete"}</th>
<th>
<button type="button" class="btn btn-xs btn-default toggle-all" data-set="module" title="{intl l="Toggle all rights"}">
<i class="glyphicon glyphicon-transfer"></i>
</button>
</th>
</tr>
</thead>
<tbody>
{form_tagged_fields tag='modules'}
{loop type="module" name="module-list" code=$attr_list.module_code profile=$ID backend_context="1" order="code"}
<tr>
<td>{$CODE}</td>
<td>{$TITLE}</td>
<td>
<div class="make-switch switch-mini switch_set_module switch_line_m{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" value="VIEW" type="checkbox" {if $VIEWABLE == 1}checked="checked"{/if}>
</div>
</td>
<td>
<div class="make-switch switch-mini switch_set_module switch_line_m{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" value="CREATE" type="checkbox" {if $CREATABLE == 1}checked="checked"{/if}>
</div>
</td>
<td>
<div class="make-switch switch-mini switch_set_module switch_line_m{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" value="UPDATE" type="checkbox" {if $UPDATABLE == 1}checked="checked"{/if}>
</div>
</td>
<td>
<div class="make-switch switch-mini switch_set_module switch_line_m{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input name="{$name}" value="DELETE" type="checkbox" {if $DELETABLE == 1}checked="checked"{/if}>
</div>
</td>
<td>
<button type="button" class="btn btn-xs btn-default toggle-line" data-id="m{$ID}" title="{intl l="Toggle line"}">
<i class="glyphicon glyphicon-transfer"></i>
</button>
</td>
</tr>
{/loop}
{/form_tagged_fields}
</tbody>
<tfoot>
<tr>
<td colspan="99">
<button type="submit" class="btn btn-primary pull-right"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
</td>
</tr>
</tfoot>
</table>
</form>
{/form}
</div>
</div>
</div>
</div>
{hook name="profile-edit.bottom" profile_id=$profile_id}
{/loop}
</div>
</div>
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(function() {
$('.toggle-all').click(function() {
var selector = ".switch_set_" + $(this).data('set');
$(selector).bootstrapSwitch('toggleState');
});
$('.toggle-line').click(function() {
var selector = ".switch_line_" + $(this).data('id');
$(selector).bootstrapSwitch('toggleState');
});
});
</script>
{/block}
{block name="javascript-last-call"}
{hook name="profile.edit-js" location="profile-edit-js" profile_id={$profile_id} }
{hook name="wysiwyg.js" location="wysiwyg-profile-edit-js" }
{/block}