Change the view of Attributes Customer

This commit is contained in:
Ibnu Maksum 2024-03-06 11:15:45 +07:00
parent e5c8aae758
commit 37a5ee8566
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
6 changed files with 132 additions and 124 deletions

View File

@ -2,6 +2,10 @@
# CHANGELOG # CHANGELOG
## 2024.3.6
- change attributes view
## 2024.3.4 ## 2024.3.4
- add [[username]] for reminder - add [[username]] for reminder

View File

@ -460,5 +460,6 @@
"Users_Announcement": "Users Announcement", "Users_Announcement": "Users Announcement",
"Customer_Announcement": "Customer Announcement", "Customer_Announcement": "Customer Announcement",
"1_Period___1_Month__Expires_the_20th_of_each_month": "1 Period = 1 Month, Expires the 20th of each month", "1_Period___1_Month__Expires_the_20th_of_each_month": "1 Period = 1 Month, Expires the 20th of each month",
"Period": "Period" "Period": "Period",
"Add": "Add"
} }

View File

@ -1,15 +1,14 @@
{include file="sections/header.tpl"} {include file="sections/header.tpl"}
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/add-post">
<div class="row"> <div class="row">
<div class="col-sm-12 col-md-12"> <div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30"> <div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Add New Contact')}</div> <div class="panel-heading">{Lang::T('Add New Contact')}</div>
<div class="panel-body"> <div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/add-post">
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Username')}</label> <label class="col-md-3 control-label">{Lang::T('Username')}</label>
<div class="col-md-6"> <div class="col-md-9">
<div class="input-group"> <div class="input-group">
{if $_c['country_code_phone']!= ''} {if $_c['country_code_phone']!= ''}
<span class="input-group-addon" id="basic-addon1">+</span> <span class="input-group-addon" id="basic-addon1">+</span>
@ -23,20 +22,20 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Full Name')}</label> <label class="col-md-3 control-label">{Lang::T('Full Name')}</label>
<div class="col-md-6"> <div class="col-md-9">
<input type="text" required class="form-control" id="fullname" name="fullname"> <input type="text" required class="form-control" id="fullname" name="fullname">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Email')}</label> <label class="col-md-3 control-label">{Lang::T('Email')}</label>
<div class="col-md-6"> <div class="col-md-9">
<input type="email" class="form-control" id="email" name="email"> <input type="email" class="form-control" id="email" name="email">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Phone Number')}</label> <label class="col-md-3 control-label">{Lang::T('Phone Number')}</label>
<div class="col-md-6"> <div class="col-md-9">
<div class="input-group"> <div class="input-group">
{if $_c['country_code_phone']!= ''} {if $_c['country_code_phone']!= ''}
<span class="input-group-addon" id="basic-addon1">+</span> <span class="input-group-addon" id="basic-addon1">+</span>
@ -50,15 +49,15 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Password')}</label> <label class="col-md-3 control-label">{Lang::T('Password')}</label>
<div class="col-md-6"> <div class="col-md-9">
<input type="password" class="form-control" autocomplete="off" required id="password" <input type="password" class="form-control" autocomplete="off" required id="password" value="{rand(000000,999999)}"
name="password" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'"> name="password" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('PPPOE Password')}</label> <label class="col-md-3 control-label">{Lang::T('PPPOE Password')}</label>
<div class="col-md-6"> <div class="col-md-9">
<input type="password" class="form-control" id="pppoe_password" name="pppoe_password" <input type="password" class="form-control" id="pppoe_password" name="pppoe_password"
value="{$d['pppoe_password']}" onmouseleave="this.type = 'password'" value="{$d['pppoe_password']}" onmouseleave="this.type = 'password'"
onmouseenter="this.type = 'text'"> onmouseenter="this.type = 'text'">
@ -68,14 +67,14 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Address')}</label> <label class="col-md-3 control-label">{Lang::T('Address')}</label>
<div class="col-md-6"> <div class="col-md-9">
<textarea name="address" id="address" class="form-control"></textarea> <textarea name="address" id="address" class="form-control"></textarea>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Service Type')}</label> <label class="col-md-3 control-label">{Lang::T('Service Type')}</label>
<div class="col-md-6"> <div class="col-md-9">
<select class="form-control" id="service_type" name="service_type"> <select class="form-control" id="service_type" name="service_type">
<option value="Hotspot" {if $d['service_type'] eq 'Hotspot' }selected{/if}>Hotspot <option value="Hotspot" {if $d['service_type'] eq 'Hotspot' }selected{/if}>Hotspot
</option> </option>
@ -84,30 +83,33 @@
</select> </select>
</div> </div>
</div> </div>
<!-- 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>
</div> </div>
</div> </div>
</div>
<div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Attributes')}</div>
<div class="panel-body">
<!-- Customers Attributes add start -->
<div id="custom-fields-container">
</div>
<!-- Customers Attributes add end --> <!-- Customers Attributes add end -->
</div>
<div class="form-group"> <div class="panel-footer">
<div class="col-lg-offset-2 col-lg-10"> <button class="btn btn-success btn-block" type="button"
id="add-custom-field">{Lang::T('Add')}</button>
</div>
</div>
</div>
</div>
<center>
<button class="btn btn-primary" type="submit"> <button class="btn btn-primary" type="submit">
{Lang::T('Save Changes')} {Lang::T('Save Changes')}
</button> </button>
Or <a href="{$_url}customers/list">{Lang::T('Cancel')}</a> <br><a href="{$_url}customers/list" class="btn btn-link">{Lang::T('Cancel')}</a>
</div> </center>
</div>
</form> </form>
</div>
</div>
</div>
</div>
</div>
{literal} {literal}
<script type="text/javascript"> <script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
@ -119,12 +121,10 @@
var newField = document.createElement('div'); var newField = document.createElement('div');
newField.className = 'form-group'; newField.className = 'form-group';
newField.innerHTML = ` newField.innerHTML = `
<label class="col-md-2 control-label">Name:</label> <div class="col-md-4">
<div class="col-md-3">
<input type="text" class="form-control" name="custom_field_name[]" placeholder="Name"> <input type="text" class="form-control" name="custom_field_name[]" placeholder="Name">
</div> </div>
<label class="col-md-2 control-label">Value:</label> <div class="col-md-6">
<div class="col-md-3">
<input type="text" class="form-control" name="custom_field_value[]" placeholder="Value"> <input type="text" class="form-control" name="custom_field_value[]" placeholder="Value">
</div> </div>
<div class="col-md-2"> <div class="col-md-2">

View File

@ -1,16 +1,15 @@
{include file="sections/header.tpl"} {include file="sections/header.tpl"}
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/edit-post">
<div class="row"> <div class="row">
<div class="col-sm-12 col-md-12"> <div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30"> <div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Edit Contact')}</div> <div class="panel-heading">{Lang::T('Edit Contact')}</div>
<div class="panel-body"> <div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/edit-post">
<input type="hidden" name="id" value="{$d['id']}"> <input type="hidden" name="id" value="{$d['id']}">
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Username')}</label> <label class="col-md-3 control-label">{Lang::T('Username')}</label>
<div class="col-md-6"> <div class="col-md-9">
<div class="input-group"> <div class="input-group">
{if $_c['country_code_phone']!= ''} {if $_c['country_code_phone']!= ''}
<span class="input-group-addon" id="basic-addon1">+</span> <span class="input-group-addon" id="basic-addon1">+</span>
@ -25,21 +24,21 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Full Name')}</label> <label class="col-md-3 control-label">{Lang::T('Full Name')}</label>
<div class="col-md-6"> <div class="col-md-9">
<input type="text" class="form-control" id="fullname" name="fullname" <input type="text" class="form-control" id="fullname" name="fullname"
value="{$d['fullname']}"> value="{$d['fullname']}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Email')}</label> <label class="col-md-3 control-label">{Lang::T('Email')}</label>
<div class="col-md-6"> <div class="col-md-9">
<input type="email" class="form-control" id="email" name="email" value="{$d['email']}"> <input type="email" class="form-control" id="email" name="email" value="{$d['email']}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Phone Number')}</label> <label class="col-md-3 control-label">{Lang::T('Phone Number')}</label>
<div class="col-md-6"> <div class="col-md-9">
<div class="input-group"> <div class="input-group">
{if $_c['country_code_phone']!= ''} {if $_c['country_code_phone']!= ''}
<span class="input-group-addon" id="basic-addon1">+</span> <span class="input-group-addon" id="basic-addon1">+</span>
@ -53,8 +52,8 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Password')}</label> <label class="col-md-3 control-label">{Lang::T('Password')}</label>
<div class="col-md-6"> <div class="col-md-9">
<input type="password" autocomplete="off" class="form-control" id="password" name="password" <input type="password" autocomplete="off" class="form-control" id="password" name="password"
onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'"
value="{$d['password']}"> value="{$d['password']}">
@ -62,8 +61,8 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('PPPOE Password')}</label> <label class="col-md-3 control-label">{Lang::T('PPPOE Password')}</label>
<div class="col-md-6"> <div class="col-md-9">
<input type="password" autocomplete="off" class="form-control" id="pppoe_password" <input type="password" autocomplete="off" class="form-control" id="pppoe_password"
name="pppoe_password" value="{$d['pppoe_password']}" name="pppoe_password" value="{$d['pppoe_password']}"
onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'"> onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
@ -73,14 +72,14 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Address')}</label> <label class="col-md-3 control-label">{Lang::T('Address')}</label>
<div class="col-md-6"> <div class="col-md-9">
<textarea name="address" id="address" class="form-control">{$d['address']}</textarea> <textarea name="address" id="address" class="form-control">{$d['address']}</textarea>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Service Type')}</label> <label class="col-md-3 control-label">{Lang::T('Service Type')}</label>
<div class="col-md-6"> <div class="col-md-9">
<select class="form-control" id="service_type" name="service_type"> <select class="form-control" id="service_type" name="service_type">
<option value="Hotspot" {if $d['service_type'] eq 'Hotspot' }selected{/if}>Hotspot <option value="Hotspot" {if $d['service_type'] eq 'Hotspot' }selected{/if}>Hotspot
</option> </option>
@ -89,43 +88,49 @@
</select> </select>
</div> </div>
</div> </div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Attributes')}</div>
<div class="panel-body">
<!--Customers Attributes edit start --> <!--Customers Attributes edit start -->
{if $customFields} {if $customFields}
{foreach $customFields as $customField} {foreach $customFields as $customField}
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label" <label class="col-md-4 control-label"
for="{$customField.field_name}">{$customField.field_name}</label> for="{$customField.field_name}">{$customField.field_name}</label>
<div class="col-md-6"> <div class="col-md-6">
<input class="form-control" type="text" name="custom_fields[{$customField.field_name}]" <input class="form-control" type="text" name="custom_fields[{$customField.field_name}]"
id="{$customField.field_name}" value="{$customField.field_value}"> id="{$customField.field_name}" value="{$customField.field_value}">
</div> </div>
<label class="col-md-2">
<input type="checkbox" name="delete_custom_fields[]" value="{$customField.field_name}"> Delete <input type="checkbox" name="delete_custom_fields[]" value="{$customField.field_name}"> Delete
</label>
</div> </div>
{/foreach} {/foreach}
{/if} {/if}
<!--Customers Attributes edit end --> <!--Customers Attributes edit end -->
<!-- Customers Attributes add start --> <!-- Customers Attributes add start -->
<div class="form-group"> <div id="custom-fields-container">
<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>
</div>
</div> </div>
<!-- Customers Attributes add end --> <!-- Customers Attributes add end -->
<div class="form-group"> </div>
<div class="col-lg-offset-2 col-lg-10"> <div class="panel-footer">
<button class="btn btn-success btn-block" type="button"
id="add-custom-field">{Lang::T('Add')}</button>
</div>
</div>
</div>
</div>
<center>
<button class="btn btn-primary" type="submit"> <button class="btn btn-primary" type="submit">
{Lang::T('Save Changes')} {Lang::T('Save Changes')}
</button> </button>
Or <a href="{$_url}customers/list">{Lang::T('Cancel')}</a> <br><a href="{$_url}customers/list" class="btn btn-link">{Lang::T('Cancel')}</a>
</div> </center>
</div>
</form> </form>
</div>
</div>
</div>
</div>
</div>
{literal} {literal}
<script type="text/javascript"> <script type="text/javascript">
@ -138,12 +143,10 @@
var newField = document.createElement('div'); var newField = document.createElement('div');
newField.className = 'form-group'; newField.className = 'form-group';
newField.innerHTML = ` newField.innerHTML = `
<label class="col-md-2 control-label">Name:</label> <div class="col-md-4">
<div class="col-md-3">
<input type="text" class="form-control" name="custom_field_name[]" placeholder="Name"> <input type="text" class="form-control" name="custom_field_name[]" placeholder="Name">
</div> </div>
<label class="col-md-2 control-label">Value:</label> <div class="col-md-6">
<div class="col-md-3">
<input type="text" class="form-control" name="custom_field_value[]" placeholder="Value"> <input type="text" class="form-control" name="custom_field_value[]" placeholder="Value">
</div> </div>
<div class="col-md-2"> <div class="col-md-2">

View File

@ -29,9 +29,9 @@
$(this).html( $(this).html(
`<span class="loading"></span>` `<span class="loading"></span>`
); );
setTimeout(() => { // setTimeout(() => {
$(this).prop("disabled", true); // $(this).prop("disabled", true);
}, 100); // }, 100);
}, false); }, false);
} else { } else {
if (el.attachEvent) { // IE before version 9 if (el.attachEvent) { // IE before version 9
@ -39,9 +39,9 @@
$(this).html( $(this).html(
`<span class="loading"></span>` `<span class="loading"></span>`
); );
setTimeout(() => { // setTimeout(() => {
$(this).prop("disabled", true); // $(this).prop("disabled", true);
}, 100); // }, 100);
}); });
} }
} }

View File

@ -1,3 +1,3 @@
{ {
"version": "2024.3.5" "version": "2024.3.6"
} }