change Customer menu

This commit is contained in:
Ibnu Maksum 2024-02-29 11:37:54 +07:00
parent fbd215e741
commit 28f4624e8d
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 43 additions and 50 deletions

View File

@ -12,6 +12,9 @@ $ui->assign('_system_menu', 'customers');
$action = $routes['1'];
$ui->assign('_admin', $admin);
if(empty($action)){
$action = 'list';
}
switch ($action) {
case 'list':

View File

@ -13,10 +13,10 @@
<div class="col-md-6">
<div class="input-group">
{if $_c['country_code_phone']!= ''}
<span class="input-group-addon" id="basic-addon1">+</span>
<span class="input-group-addon" id="basic-addon1">+</span>
{else}
<span class="input-group-addon" id="basic-addon1"><i
class="glyphicon glyphicon-phone-alt"></i></span>
<span class="input-group-addon" id="basic-addon1"><i
class="glyphicon glyphicon-phone-alt"></i></span>
{/if}
<input type="text" class="form-control" name="username" value="{$d['username']}"
required
@ -42,10 +42,10 @@
<div class="col-md-6">
<div class="input-group">
{if $_c['country_code_phone']!= ''}
<span class="input-group-addon" id="basic-addon1">+</span>
<span class="input-group-addon" id="basic-addon1">+</span>
{else}
<span class="input-group-addon" id="basic-addon1"><i
class="glyphicon glyphicon-phone-alt"></i></span>
<span class="input-group-addon" id="basic-addon1"><i
class="glyphicon glyphicon-phone-alt"></i></span>
{/if}
<input type="text" class="form-control" name="phonenumber" value="{$d['phonenumber']}"
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {Lang::T('Phone Number')}">
@ -91,25 +91,24 @@
</div>
<!--Customers Attributes edit start -->
{if $customFields}
{foreach $customFields as $customField}
<div class="form-group">
<label class="col-md-2 control-label"
for="{$customField.field_name}">{$customField.field_name}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="custom_fields[{$customField.field_name}]"
id="{$customField.field_name}" value="{$customField.field_value}">
</div>
<input type="checkbox" name="delete_custom_fields[]" value="{$customField.field_name}"> Delete
</div>
{/foreach}
{foreach $customFields as $customField}
<div class="form-group">
<label class="col-md-2 control-label"
for="{$customField.field_name}">{$customField.field_name}</label>
<div class="col-md-6">
<input class="form-control" type="text" name="custom_fields[{$customField.field_name}]"
id="{$customField.field_name}" value="{$customField.field_value}">
</div>
<input type="checkbox" name="delete_custom_fields[]" value="{$customField.field_name}"> Delete
</div>
{/foreach}
{/if}
<!--Customers Attributes edit end -->
<!--Customers Attributes add start -->
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Attributes')}</label>
<div id="custom-fields-container" class="col-md-6">
<button class="btn btn-success btn-sm" type="button"
id="add-custom-field">+</button>
<button class="btn btn-success btn-sm" type="button" id="add-custom-field">+</button>
</div>
</div>
<!--Customers Attributes add end -->
@ -129,16 +128,16 @@
</div>
{literal}
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function () {
var customFieldsContainer = document.getElementById('custom-fields-container');
var addCustomFieldButton = document.getElementById('add-custom-field');
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {
var customFieldsContainer = document.getElementById('custom-fields-container');
var addCustomFieldButton = document.getElementById('add-custom-field');
addCustomFieldButton.addEventListener('click', function () {
var fieldIndex = customFieldsContainer.children.length;
var newField = document.createElement('div');
newField.className = 'form-group';
newField.innerHTML = `
addCustomFieldButton.addEventListener('click', function() {
var fieldIndex = customFieldsContainer.children.length;
var newField = document.createElement('div');
newField.className = 'form-group';
newField.innerHTML = `
<label class="col-md-2 control-label">Name:</label>
<div class="col-md-3">
<input type="text" class="form-control" name="custom_field_name[]" placeholder="Name">
@ -151,17 +150,17 @@
<button type="button" class="remove-custom-field btn btn-danger btn-sm">-</button>
</div>
`;
customFieldsContainer.appendChild(newField);
});
customFieldsContainer.appendChild(newField);
});
customFieldsContainer.addEventListener('click', function (event) {
if (event.target.classList.contains('remove-custom-field')) {
var fieldContainer = event.target.parentNode.parentNode;
fieldContainer.parentNode.removeChild(fieldContainer);
}
customFieldsContainer.addEventListener('click', function(event) {
if (event.target.classList.contains('remove-custom-field')) {
var fieldContainer = event.target.parentNode.parentNode;
fieldContainer.parentNode.removeChild(fieldContainer);
}
});
});
});
</script>
</script>
{/literal}
{include file="sections/footer.tpl"}

View File

@ -130,20 +130,11 @@
</li>
{$_MENU_AFTER_DASHBOARD}
{if !in_array($_admin['user_type'],['Report'])}
<li class="{if $_system_menu eq 'customers'}active{/if} treeview">
<a href="#">
<i class="ion ion-android-contacts"></i> <span>{Lang::T('Customer')}</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
<li {if $_system_menu eq 'customers'}class="active" {/if}>
<a href="{$_url}customers">
<i class="fa fa-users"></i>
<span>{Lang::T('Customer')}</span>
</a>
<ul class="treeview-menu">
<li {if $_routes[1] eq 'add'}class="active" {/if}><a href="{$_url}customers/add"><i
class="fa fa-user-plus"></i> {Lang::T('Add New Contact')}</a></li>
<li {if $_routes[1] eq 'list'}class="active" {/if}><a href="{$_url}customers/list"><i
class="fa fa-users"></i> {Lang::T('List Contact')}</a></li>
{$_MENU_CUSTOMERS}
</ul>
</li>
{$_MENU_AFTER_CUSTOMERS}
<li class="{if $_system_menu eq 'prepaid'}active{/if} treeview">