Compare commits

...

11 Commits

Author SHA1 Message Date
37a5ee8566 Change the view of Attributes Customer 2024-03-06 11:15:45 +07:00
e5c8aae758 2024.3.5 2024-03-05 16:20:18 +07:00
99d393d0c0 Merge pull request #118 from gerandonk/Development
change due date for period plan to customer field attribute
2024-03-05 16:18:32 +07:00
e6280d597b change due date for period plan to customer field attribute
admin can change expired date for period plan as wish before recharger customer
2024-03-05 16:08:33 +07:00
18db9cd280 hide if balance off 2024-03-05 11:15:38 +07:00
6aab647f48 Company name in login 2024-03-05 11:15:26 +07:00
b8b4623078 notification variable fix 2024-03-04 14:26:36 +07:00
6a79cff233 checkUserType when edit is neq 2024-03-04 11:30:09 +07:00
4c02283fd0 add full name in telegram notification 2024-03-04 10:06:19 +07:00
403de91fba sendPackageNotification with customer variable 2024-03-04 10:02:23 +07:00
4ee3743cf3 Fix Password send to admin 2024-03-04 09:57:12 +07:00
15 changed files with 323 additions and 204 deletions

View File

@ -2,6 +2,17 @@
# CHANGELOG # CHANGELOG
## 2024.3.6
- change attributes view
## 2024.3.4
- add [[username]] for reminder
- fix agent show when editing
- fix password admin when sending notification
- add file exists for pages
## 2024.3.3 ## 2024.3.3
- Change loading button by @Focuslinkstech - Change loading button by @Focuslinkstech

View File

@ -60,29 +60,30 @@ class Message
global $config; global $config;
run_hook('send_whatsapp'); #HOOK run_hook('send_whatsapp'); #HOOK
if (!empty($config['wa_url'])) { if (!empty($config['wa_url'])) {
$waurl = str_replace('[number]', urlencode($phone), $config['wa_url']); $waurl = str_replace('[number]', urlencode(Lang::phoneFormat($phone)), $config['wa_url']);
$waurl = str_replace('[text]', urlencode($txt), $waurl); $waurl = str_replace('[text]', urlencode($txt), $waurl);
return Http::getData($waurl); return Http::getData($waurl);
} }
} }
public static function sendPackageNotification($phone, $name, $package, $price, $message, $via) public static function sendPackageNotification($customer, $package, $price, $message, $via)
{ {
global $u; global $u;
$msg = str_replace('[[name]]', $name, $message); $msg = str_replace('[[name]]', $customer['fullname'], $message);
$msg = str_replace('[[username]]', $customer['username'], $msg);
$msg = str_replace('[[package]]', $package, $msg); $msg = str_replace('[[package]]', $package, $msg);
$msg = str_replace('[[price]]', $price, $msg); $msg = str_replace('[[price]]', $price, $msg);
if($u){ if($u){
$msg = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($u['expiration'], $u['time']), $msg); $msg = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($u['expiration'], $u['time']), $msg);
} }
if ( if (
!empty($phone) && strlen($phone) > 5 !empty($customer['phonenumber']) && strlen($customer['phonenumber']) > 5
&& !empty($message) && in_array($via, ['sms', 'wa']) && !empty($message) && in_array($via, ['sms', 'wa'])
) { ) {
if ($via == 'sms') { if ($via == 'sms') {
Message::sendSMS($phone, $msg); Message::sendSMS($customer['phonenumber'], $msg);
} else if ($via == 'wa') { } else if ($via == 'wa') {
Message::sendWhatsapp($phone, $msg); Message::sendWhatsapp($customer['phonenumber'], $msg);
} }
} }
return "$via: $msg"; return "$via: $msg";

View File

@ -31,6 +31,14 @@ class Package
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one(); $c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->where('enabled', '1')->find_one(); $p = ORM::for_table('tbl_plans')->where('id', $plan_id)->where('enabled', '1')->find_one();
$f = ORM::for_table('tbl_customers_fields')->where('field_name', 'Expired Date')->where('customer_id', $c['id'])->find_one();
if (!$f) {
$f = ORM::for_table('tbl_customers_fields')->create();
$f->customer_id = $c['id'];
$f->field_name = 'Expired Date';
$f->field_value = 20;
$f->save();
}
if ($router_name == 'balance') { if ($router_name == 'balance') {
// insert table transactions // insert table transactions
@ -101,15 +109,15 @@ class Package
if ($p['validity_unit'] == 'Months') { if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month')); $date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month'));
} else if ($p['validity_unit'] == 'Period') { } else if ($p['validity_unit'] == 'Period') {
$date_tmp = date("Y-m-20", strtotime('+' . $p['validity'] . ' month')); $date_tmp = date("Y-m-{$f['field_value']}", strtotime('+' . $p['validity'] . ' month'));
$dt1 = new DateTime("$date_only"); $dt1 = new DateTime("$date_only");
$dt2 = new DateTime("$date_tmp"); $dt2 = new DateTime("$date_tmp");
$diff = $dt2->diff($dt1); $diff = $dt2->diff($dt1);
$sum = $diff->format("%a");// => 453 $sum = $diff->format("%a");// => 453
if ($sum >= 35) { if ($sum >= 35) {
$date_exp = date("Y-m-20", strtotime('+0 month')); $date_exp = date("Y-m-{$f['field_value']}", strtotime('+0 month'));
} else { } else {
$date_exp = date("Y-m-20", strtotime('+' . $p['validity'] . ' month')); $date_exp = date("Y-m-{$f['field_value']}", strtotime('+' . $p['validity'] . ' month'));
}; };
$time = date("23:59:00"); $time = date("23:59:00");
} else if ($p['validity_unit'] == 'Days') { } else if ($p['validity_unit'] == 'Days') {
@ -132,7 +140,7 @@ class Package
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months')); $date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time']; $time = $b['time'];
} else if ($p['validity_unit'] == 'Period') { } else if ($p['validity_unit'] == 'Period') {
$date_exp = date("Y-m-20", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months')); $date_exp = date("Y-m-{$f['field_value']}", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = date("23:59:00"); $time = date("23:59:00");
} else if ($p['validity_unit'] == 'Days') { } else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days')); $date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
@ -196,7 +204,22 @@ class Package
} }
$t->save(); $t->save();
Message::sendTelegram("#u$c[username] #recharge #Hotspot \n" . $p['name_plan'] . // insert to fields
$fl = ORM::for_table('tbl_customers_fields')->where('field_name', 'Invoice')->where('customer_id', $c['id'])->find_one();
if (!$fl) {
$fl = ORM::for_table('tbl_customers_fields')->create();
$fl->customer_id = $c['id'];
$fl->field_name = 'Invoice';
$fl->field_value = $p['price'];
$fl->save();
} else {
$fl->customer_id = $c['id'];
$fl->field_value = $p['price'];
$fl->save();
}
Message::sendTelegram("#u$c[username] $c[fullname] #recharge #Hotspot \n" . $p['name_plan'] .
"\nRouter: " . $router_name . "\nRouter: " . $router_name .
"\nGateway: " . $gateway . "\nGateway: " . $gateway .
"\nChannel: " . $channel . "\nChannel: " . $channel .
@ -230,13 +253,24 @@ class Package
$d->admin_id = '0'; $d->admin_id = '0';
} }
$d->save(); $d->save();
// Calculating Price
$sd = new DateTime("$date_only");
$ed = new DateTime("$date_exp");
$td = $ed->diff($sd);
$fd = $td->format("%a");
$gi = ($p['price']/30)*$fd;
// insert table transactions // insert table transactions
$t = ORM::for_table('tbl_transactions')->create(); $t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5); $t->invoice = "INV-" . Package::_raid(5);
$t->username = $c['username']; $t->username = $c['username'];
$t->plan_name = $p['name_plan']; $t->plan_name = $p['name_plan'];
$t->price = $p['price']; if ($gi > $p['price']) {
$t->price = $p['price'];
} else {
$t->price = $gi;
}
$t->recharged_on = $date_only; $t->recharged_on = $date_only;
$t->recharged_time = $time_only; $t->recharged_time = $time_only;
$t->expiration = $date_exp; $t->expiration = $date_exp;
@ -251,13 +285,31 @@ class Package
} }
$t->save(); $t->save();
Message::sendTelegram("#u$c[username] #buy #Hotspot \n" . $p['name_plan'] . // insert to fields
$fl = ORM::for_table('tbl_customers_fields')->where('field_name', 'Invoice')->where('customer_id', $c['id'])->find_one();
if (!$fl) {
$fl = ORM::for_table('tbl_customers_fields')->create();
$fl->customer_id = $c['id'];
$fl->field_name = 'Invoice';
if ($gi > $p['price']) {
$fl->field_value = $p['price'];
} else {
$fl->field_value = $gi;
}
$fl->save();
} else {
$fl->customer_id = $c['id'];
$fl->field_value = $p['price'];
$fl->save();
}
Message::sendTelegram("#u$c[username] $c[fullname] #buy #Hotspot \n" . $p['name_plan'] .
"\nRouter: " . $router_name . "\nRouter: " . $router_name .
"\nGateway: " . $gateway . "\nGateway: " . $gateway .
"\nChannel: " . $channel . "\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price'])); "\nPrice: " . Lang::moneyFormat($p['price']));
} }
} else { } else {
if ($b) { if ($b) {
@ -267,7 +319,7 @@ class Package
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months')); $date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time']; $time = $b['time'];
} else if ($p['validity_unit'] == 'Period') { } else if ($p['validity_unit'] == 'Period') {
$date_exp = date("Y-m-20", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months')); $date_exp = date("Y-m-{$f['field_value']}", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = date("23:59:00"); $time = date("23:59:00");
} else if ($p['validity_unit'] == 'Days') { } else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days')); $date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
@ -331,7 +383,22 @@ class Package
} }
$t->save(); $t->save();
Message::sendTelegram("#u$c[username] #recharge #PPPOE \n" . $p['name_plan'] . // insert to fields
$fl = ORM::for_table('tbl_customers_fields')->where('field_name', 'Invoice')->where('customer_id', $c['id'])->find_one();
$gp = $gi;
if (!$fl) {
$fl = ORM::for_table('tbl_customers_fields')->create();
$fl->customer_id = $c['id'];
$fl->field_name = 'Invoice';
$fl->field_value = $p['price'];
$fl->save();
} else {
$fl->customer_id = $c['id'];
$fl->field_value = $p['price'];
$fl->save();
}
Message::sendTelegram("#u$c[username] $c[fullname] #recharge #PPPOE \n" . $p['name_plan'] .
"\nRouter: " . $router_name . "\nRouter: " . $router_name .
"\nGateway: " . $gateway . "\nGateway: " . $gateway .
"\nChannel: " . $channel . "\nChannel: " . $channel .
@ -365,13 +432,24 @@ class Package
$d->admin_id = '0'; $d->admin_id = '0';
} }
$d->save(); $d->save();
// Calculating Price
$sd = new DateTime("$date_only");
$ed = new DateTime("$date_exp");
$td = $ed->diff($sd);
$fd = $td->format("%a");
$gi = ($p['price']/30)*$fd;
// insert table transactions // insert table transactions
$t = ORM::for_table('tbl_transactions')->create(); $t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . Package::_raid(5); $t->invoice = "INV-" . Package::_raid(5);
$t->username = $c['username']; $t->username = $c['username'];
$t->plan_name = $p['name_plan']; $t->plan_name = $p['name_plan'];
$t->price = $p['price']; if ($gi > $p['price']) {
$t->price = $p['price'];
} else {
$t->price = $gi;
}
$t->recharged_on = $date_only; $t->recharged_on = $date_only;
$t->recharged_time = $time_only; $t->recharged_time = $time_only;
$t->expiration = $date_exp; $t->expiration = $date_exp;
@ -386,13 +464,31 @@ class Package
$t->type = "PPPOE"; $t->type = "PPPOE";
$t->save(); $t->save();
Message::sendTelegram("#u$c[username] #buy #PPPOE \n" . $p['name_plan'] . // insert to fields
$fl = ORM::for_table('tbl_customers_fields')->where('field_name', 'Invoice')->where('customer_id', $c['id'])->find_one();
if (!$fl) {
$fl = ORM::for_table('tbl_customers_fields')->create();
$fl->customer_id = $c['id'];
$fl->field_name = 'Invoice';
if ($gi > $p['price']) {
$fl->field_value = $p['price'];
} else {
$fl->field_value = $gi;
}
$fl->save();
} else {
$fl->customer_id = $c['id'];
$fl->field_value = $p['price'];
$fl->save();
}
Message::sendTelegram("#u$c[username] $c[fullname] #buy #PPPOE \n" . $p['name_plan'] .
"\nRouter: " . $router_name . "\nRouter: " . $router_name .
"\nGateway: " . $gateway . "\nGateway: " . $gateway .
"\nChannel: " . $channel . "\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price'])); "\nPrice: " . Lang::moneyFormat($p['price']));
} }
} }
run_hook("recharge_user_finish"); run_hook("recharge_user_finish");
Message::sendInvoice($c, $t); Message::sendInvoice($c, $t);

View File

@ -496,11 +496,11 @@ switch ($action) {
$date_now = date("Y-m-d H:i:s"); $date_now = date("Y-m-d H:i:s");
run_hook('add_admin'); #HOOK run_hook('add_admin'); #HOOK
if ($msg == '') { if ($msg == '') {
$password = Password::_crypt($password); $passwordC = Password::_crypt($password);
$d = ORM::for_table('tbl_users')->create(); $d = ORM::for_table('tbl_users')->create();
$d->username = $username; $d->username = $username;
$d->fullname = $fullname; $d->fullname = $fullname;
$d->password = $password; $d->password = $passwordC;
$d->user_type = $user_type; $d->user_type = $user_type;
$d->phone = $phone; $d->phone = $phone;
$d->email = $email; $d->email = $email;

View File

@ -54,7 +54,7 @@ foreach ($d as $ds) {
} }
Mikrotik::removeHotspotActiveUser($client, $c['username']); Mikrotik::removeHotspotActiveUser($client, $c['username']);
} }
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n"; echo Message::sendPackageNotification($c, $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n";
//update database user dengan status off //update database user dengan status off
$u->status = 'off'; $u->status = 'off';
$u->save(); $u->save();
@ -109,7 +109,7 @@ foreach ($d as $ds) {
} }
Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removePpoeActive($client, $c['username']);
} }
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n"; echo Message::sendPackageNotification($c, $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n";
$u->status = 'off'; $u->status = 'off';
$u->save(); $u->save();

View File

@ -40,11 +40,11 @@ foreach ($d as $ds) {
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one(); $c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
$price = Lang::moneyFormat($p['price']); $price = Lang::moneyFormat($p['price']);
if ($ds['expiration'] == $day7) { if ($ds['expiration'] == $day7) {
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n"; echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day3) { } else if ($ds['expiration'] == $day3) {
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n"; echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day1) { } else if ($ds['expiration'] == $day1) {
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n"; echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n";
} }
} }
} }

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

@ -4,19 +4,19 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{$_title} - {Lang::T('Login')}</title> <title>{Lang::T('Login')} - {$_c['CompanyName']}</title>
<link rel="shortcut icon" href="ui/ui/images/logo.png" type="image/x-icon" /> <link rel="shortcut icon" href="ui/ui/images/logo.png" type="image/x-icon" />
<link rel="stylesheet" href="ui/ui/styles/bootstrap.min.css"> <link rel="stylesheet" href="ui/ui/styles/bootstrap.min.css">
<link rel="stylesheet" href="ui/ui/styles/modern-AdminLTE.min.css"> <link rel="stylesheet" href="ui/ui/styles/modern-AdminLTE.min.css">
</head> </head>
<body class="hold-transition login-page"> <body class="hold-transition login-page">
<div class="login-box"> <div class="login-box">
<div class="login-logo"> <div class="login-logo">
<b>Nux</b>Billing {$_c['CompanyName']}
</div> </div>
<div class="login-box-body"> <div class="login-box-body">
<p class="login-box-msg">{Lang::T('Enter Admin Area')}</p> <p class="login-box-msg">{Lang::T('Enter Admin Area')}</p>

View File

@ -127,34 +127,36 @@
</p> </p>
</div> </div>
</div> </div>
<div class="panel-body"> {if $_c['enable_balance'] == 'yes'}
<div class="form-group"> <div class="panel-body">
<label class="col-md-2 control-label">{Lang::T('Send Balance')}</label> <div class="form-group">
<div class="col-md-6"> <label class="col-md-2 control-label">{Lang::T('Send Balance')}</label>
<textarea class="form-control" id="balance_send" name="balance_send" <div class="col-md-6">
rows="3">{if $_json['balance_send']}{Lang::htmlspecialchars($_json['balance_send'])}{else}{Lang::htmlspecialchars($_default['balance_send'])}{/if}</textarea> <textarea class="form-control" id="balance_send" name="balance_send"
rows="3">{if $_json['balance_send']}{Lang::htmlspecialchars($_json['balance_send'])}{else}{Lang::htmlspecialchars($_default['balance_send'])}{/if}</textarea>
</div>
<p class="col-md-4 help-block">
<b>[[name]]</b> Receiver name.<br>
<b>[[balance]]</b> how much balance have been send.<br>
<b>[[current_balance]]</b> Current Balance.
</p>
</div> </div>
<p class="col-md-4 help-block">
<b>[[name]]</b> Receiver name.<br>
<b>[[balance]]</b> how much balance have been send.<br>
<b>[[current_balance]]</b> Current Balance.
</p>
</div> </div>
</div> <div class="panel-body">
<div class="panel-body"> <div class="form-group">
<div class="form-group"> <label class="col-md-2 control-label">{Lang::T('Received Balance')}</label>
<label class="col-md-2 control-label">{Lang::T('Received Balance')}</label> <div class="col-md-6">
<div class="col-md-6"> <textarea class="form-control" id="balance_received" name="balance_received"
<textarea class="form-control" id="balance_received" name="balance_received" rows="3">{if $_json['balance_received']}{Lang::htmlspecialchars($_json['balance_received'])}{else}{Lang::htmlspecialchars($_default['balance_received'])}{/if}</textarea>
rows="3">{if $_json['balance_received']}{Lang::htmlspecialchars($_json['balance_received'])}{else}{Lang::htmlspecialchars($_default['balance_received'])}{/if}</textarea> </div>
<p class="col-md-4 help-block">
<b>[[name]]</b> Sender name.<br>
<b>[[balance]]</b> how much balance have been received.<br>
<b>[[current_balance]]</b> Current Balance.
</p>
</div> </div>
<p class="col-md-4 help-block">
<b>[[name]]</b> Sender name.<br>
<b>[[balance]]</b> how much balance have been received.<br>
<b>[[current_balance]]</b> Current Balance.
</p>
</div> </div>
</div> {/if}
</div> </div>
<div class="panel-body"> <div class="panel-body">

View File

@ -1,21 +1,20 @@
{include file="sections/header.tpl"} {include file="sections/header.tpl"}
<div class="row"> <form class="form-horizontal" method="post" role="form" action="{$_url}customers/add-post">
<div class="col-sm-12 col-md-12"> <div class="row">
<div class="panel panel-primary panel-hovered panel-stacked mb30"> <div class="col-md-6">
<div class="panel-heading">{Lang::T('Add New Contact')}</div> <div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-body"> <div class="panel-heading">{Lang::T('Add New Contact')}</div>
<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>
{else} {else}
<span class="input-group-addon" id="basic-addon1"><i <span class="input-group-addon" id="basic-addon1"><i
class="glyphicon glyphicon-phone-alt"></i></span> class="glyphicon glyphicon-phone-alt"></i></span>
{/if} {/if}
<input type="text" class="form-control" name="username" required <input type="text" class="form-control" name="username" required
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {Lang::T('Phone Number')}"> placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {Lang::T('Phone Number')}">
@ -23,26 +22,26 @@
</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>
{else} {else}
<span class="input-group-addon" id="basic-addon1"><i <span class="input-group-addon" id="basic-addon1"><i
class="glyphicon glyphicon-phone-alt"></i></span> class="glyphicon glyphicon-phone-alt"></i></span>
{/if} {/if}
<input type="text" class="form-control" name="phonenumber" <input type="text" class="form-control" name="phonenumber"
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {Lang::T('Phone Number')}"> placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {Lang::T('Phone Number')}">
@ -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,64 +83,65 @@
</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 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>
<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"
<button class="btn btn-primary" type="submit"> id="add-custom-field">{Lang::T('Add')}</button>
{Lang::T('Save Changes')} </div>
</button>
Or <a href="{$_url}customers/list">{Lang::T('Cancel')}</a>
</div>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>
</div> <center>
</div> <button class="btn btn-primary" type="submit">
{Lang::T('Save Changes')}
</button>
<br><a href="{$_url}customers/list" class="btn btn-link">{Lang::T('Cancel')}</a>
</center>
</form>
{literal} {literal}
<script type="text/javascript"> <script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
var customFieldsContainer = document.getElementById('custom-fields-container'); var customFieldsContainer = document.getElementById('custom-fields-container');
var addCustomFieldButton = document.getElementById('add-custom-field'); var addCustomFieldButton = document.getElementById('add-custom-field');
addCustomFieldButton.addEventListener('click', function() { addCustomFieldButton.addEventListener('click', function() {
var fieldIndex = customFieldsContainer.children.length; var fieldIndex = customFieldsContainer.children.length;
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">
<button type="button" class="remove-custom-field btn btn-danger btn-sm">-</button> <button type="button" class="remove-custom-field btn btn-danger btn-sm">-</button>
</div> </div>
`; `;
customFieldsContainer.appendChild(newField); customFieldsContainer.appendChild(newField);
}); });
customFieldsContainer.addEventListener('click', function(event) { customFieldsContainer.addEventListener('click', function(event) {
if (event.target.classList.contains('remove-custom-field')) { if (event.target.classList.contains('remove-custom-field')) {
var fieldContainer = event.target.parentNode.parentNode; var fieldContainer = event.target.parentNode.parentNode;
fieldContainer.parentNode.removeChild(fieldContainer); fieldContainer.parentNode.removeChild(fieldContainer);
} }
});
}); });
}); </script>
</script>
{/literal} {/literal}

View File

@ -1,16 +1,15 @@
{include file="sections/header.tpl"} {include file="sections/header.tpl"}
<div class="row"> <form class="form-horizontal" method="post" role="form" action="{$_url}customers/edit-post">
<div class="col-sm-12 col-md-12"> <div class="row">
<div class="panel panel-primary panel-hovered panel-stacked mb30"> <div class="col-md-6">
<div class="panel-heading">{Lang::T('Edit Contact')}</div> <div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-body"> <div class="panel-heading">{Lang::T('Edit Contact')}</div>
<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-primary" type="submit"> <button class="btn btn-success btn-block" type="button"
{Lang::T('Save Changes')} id="add-custom-field">{Lang::T('Add')}</button>
</button> </div>
Or <a href="{$_url}customers/list">{Lang::T('Cancel')}</a>
</div>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>
</div> <center>
</div> <button class="btn btn-primary" type="submit">
{Lang::T('Save Changes')}
</button>
<br><a href="{$_url}customers/list" class="btn btn-link">{Lang::T('Cancel')}</a>
</center>
</form>
{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

@ -60,33 +60,33 @@
.loading { .loading {
pointer-events: none; pointer-events: none;
opacity: 0.7; opacity: 0.7;
} }
.loading::after { .loading::after {
content: ""; content: "";
display: inline-block; display: inline-block;
width: 16px; width: 16px;
height: 16px; height: 16px;
vertical-align: middle; vertical-align: middle;
margin-left: 10px; margin-left: 10px;
border: 2px solid #fff; border: 2px solid #fff;
border-top-color: transparent; border-top-color: transparent;
border-radius: 50%; border-radius: 50%;
animation: spin 0.8s infinite linear; animation: spin 0.8s infinite linear;
} }
@keyframes spin { @keyframes spin {
0% { 0% {
transform: rotate(0deg); transform: rotate(0deg);
} }
100% { 100% {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
</style> </style>
{if isset($xheader)} {if isset($xheader)}
{$xheader} {$xheader}
{/if} {/if}
@ -183,8 +183,10 @@
{/if} {/if}
<li {if $_routes[1] eq 'recharge'}class="active" {/if}><a <li {if $_routes[1] eq 'recharge'}class="active" {/if}><a
href="{$_url}prepaid/recharge">{Lang::T('Recharge Account')}</a></li> href="{$_url}prepaid/recharge">{Lang::T('Recharge Account')}</a></li>
<li {if $_routes[1] eq 'deposit'}class="active" {/if}><a {if $_c['enable_balance'] == 'yes'}
href="{$_url}prepaid/deposit">{Lang::T('Refill Balance')}</a></li> <li {if $_routes[1] eq 'deposit'}class="active" {/if}><a
href="{$_url}prepaid/deposit">{Lang::T('Refill Balance')}</a></li>
{/if}
{$_MENU_PREPAID} {$_MENU_PREPAID}
</ul> </ul>
</li> </li>
@ -205,8 +207,10 @@
href="{$_url}services/pppoe">{Lang::T('PPPOE Plans')}</a></li> href="{$_url}services/pppoe">{Lang::T('PPPOE Plans')}</a></li>
<li {if $_routes[1] eq 'list'}class="active" {/if}><a <li {if $_routes[1] eq 'list'}class="active" {/if}><a
href="{$_url}bandwidth/list">{Lang::T('Bandwidth Plans')}</a></li> href="{$_url}bandwidth/list">{Lang::T('Bandwidth Plans')}</a></li>
<li {if $_routes[1] eq 'balance'}class="active" {/if}><a {if $_c['enable_balance'] == 'yes'}
href="{$_url}services/balance">{Lang::T('Balance Plans')}</a></li> <li {if $_routes[1] eq 'balance'}class="active" {/if}><a
href="{$_url}services/balance">{Lang::T('Balance Plans')}</a></li>
{/if}
{$_MENU_SERVICES} {$_MENU_SERVICES}
</ul> </ul>
</li> </li>
@ -277,8 +281,9 @@
href="{$_url}pages/Voucher">{Lang::T('Voucher')} Template</a></li> href="{$_url}pages/Voucher">{Lang::T('Voucher')} Template</a></li>
<li {if $_routes[1] eq 'Announcement'}class="active" {/if}><a <li {if $_routes[1] eq 'Announcement'}class="active" {/if}><a
href="{$_url}pages/Announcement">{Lang::T('Announcement')}</a></li> href="{$_url}pages/Announcement">{Lang::T('Announcement')}</a></li>
<li {if $_routes[1] eq 'Announcement_Customer'}class="active" {/if}><a <li {if $_routes[1] eq 'Announcement_Customer'}class="active" {/if}><a
href="{$_url}pages/Announcement_Customer">{Lang::T('Customer Announcement')}</a></li> href="{$_url}pages/Announcement_Customer">{Lang::T('Customer Announcement')}</a>
</li>
<li {if $_routes[1] eq 'Registration_Info'}class="active" {/if}><a <li {if $_routes[1] eq 'Registration_Info'}class="active" {/if}><a
href="{$_url}pages/Registration_Info">{Lang::T('Registration Info')}</a></li> href="{$_url}pages/Registration_Info">{Lang::T('Registration Info')}</a></li>
<li {if $_routes[1] eq 'Privacy_Policy'}class="active" {/if}><a <li {if $_routes[1] eq 'Privacy_Policy'}class="active" {/if}><a

View File

@ -65,7 +65,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label">{Lang::T('User Type')}</label> <label class="col-md-3 control-label">{Lang::T('User Type')}</label>
<div class="col-md-9"> <div class="col-md-9">
<select name="user_type" id="user_type" class="form-control"> <select name="user_type" id="user_type" class="form-control" onchange="checkUserType(this)">
{if $_admin['user_type'] eq 'Agent'} {if $_admin['user_type'] eq 'Agent'}
<option value="Sales" {if $d['user_type'] eq 'Sales'}selected="selected" {/if}>Sales <option value="Sales" {if $d['user_type'] eq 'Sales'}selected="selected" {/if}>Sales
</option> </option>
@ -87,7 +87,7 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group {if $d['user_type'] eq 'Sales'}hidden{/if}" id="agentChooser"> <div class="form-group {if $d['user_type'] neq 'Sales'}hidden{/if}" id="agentChooser">
<label class="col-md-3 control-label">{Lang::T('Agent')}</label> <label class="col-md-3 control-label">{Lang::T('Agent')}</label>
<div class="col-md-9"> <div class="col-md-9">
<select name="root" id="root" class="form-control"> <select name="root" id="root" class="form-control">

View File

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