add on-login / on-up & on-logout / on-down edit script

This commit is contained in:
Ibnu Maksum 2024-06-21 15:52:36 +07:00
parent b0bc35e2be
commit f6ff09957e
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
12 changed files with 214 additions and 111 deletions

View File

@ -2,6 +2,12 @@
# CHANGELOG
## 2024.6.21
- Add filter result in voucher and internet plan
- Add input script on-login and on-logout
- Add local ip for pppoe
## 2024.6.19
- new system for device, it can support non mikrotik devices, as long someone create device file

View File

@ -113,7 +113,9 @@ CREATE TABLE `tbl_plans` (
`enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 disabled\r\n',
`prepaid` enum('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'yes' COMMENT 'is prepaid',
`plan_type` enum('Business','Personal') COLLATE utf8mb4_general_ci DEFAULT 'Personal' COMMENT 'For selecting account type',
`device` varchar(32) COLLATE utf8mb4_general_ci NOT NULL DEFAULT ''
`device` varchar(32) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`on_login` TEXT NULL DEFAULT NULL,
`on_logout` TEXT NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
DROP TABLE IF EXISTS `tbl_pool`;

View File

@ -329,6 +329,8 @@ switch ($action) {
$enabled = _post('enabled');
$prepaid = _post('prepaid');
$routers = _post('routers');
$on_login = _post('on_login');
$on_logout = _post('on_logout');
$expired_date = _post('expired_date');
$msg = '';
if (Validator::UnsignedNumber($validity) == false) {
@ -384,6 +386,8 @@ switch ($action) {
$d->plan_expired = $plan_expired;
$d->enabled = $enabled;
$d->prepaid = $prepaid;
$d->on_login = $on_login;
$d->on_logout = $on_logout;
$d->device = $device;
if ($prepaid == 'no') {
if ($expired_date > 28 && $expired_date < 1) {
@ -700,6 +704,8 @@ switch ($action) {
$enabled = _post('enabled');
$prepaid = _post('prepaid');
$expired_date = _post('expired_date');
$on_login = _post('on_login');
$on_logout = _post('on_logout');
$msg = '';
if (Validator::UnsignedNumber($validity) == false) {
@ -751,6 +757,8 @@ switch ($action) {
$d->enabled = $enabled;
$d->prepaid = $prepaid;
$d->device = $device;
$d->on_login = $on_login;
$d->on_logout = $on_logout;
if ($prepaid == 'no') {
if ($expired_date > 28 && $expired_date < 1) {
$expired_date = 20;

View File

@ -140,6 +140,8 @@ class MikrotikHotspot
->setArgument('name', $new_plan['name_plan'])
->setArgument('shared-users', $new_plan['shared_users'])
->setArgument('rate-limit', $rate)
->setArgument('on-login', $new_plan['on_login'])
->setArgument('on-logout', $new_plan['on_logout'])
);
}
}

View File

@ -104,6 +104,8 @@ class MikrotikPppoe
->setArgument('local-address', (!empty($pool['local_ip'])) ? $pool['local_ip']: $pool['pool_name'])
->setArgument('remote-address', $pool['pool_name'])
->setArgument('rate-limit', $rate)
->setArgument('on-up', $new_plan['on_login'])
->setArgument('on-down', $new_plan['on_logout'])
);
}
}

View File

@ -114,5 +114,11 @@
"New_Router": "New Router",
"IP_Address": "IP Address",
"Username": "Username",
"Description": "Description"
"Description": "Description",
"Edit_Service_Plan": "Edit Service Plan",
"Expired_Action": "Expired Action",
"Optional": "Optional",
"Expired_Internet_Plan": "Expired Internet Plan",
"When_Expired__customer_will_be_move_to_selected_internet_plan": "When Expired, customer will be move to selected internet plan",
"Data_Updated_Successfully": "Data Updated Successfully"
}

View File

@ -116,5 +116,9 @@
],
"2024.6.19" : [
"ALTER TABLE `tbl_plans` ADD `expired_date` TINYINT(1) NOT NULL DEFAULT '20' AFTER `plan_expired`;"
],
"2024.6.21" : [
"ALTER TABLE `tbl_plans` ADD `on_login` TEXT NULL DEFAULT NULL AFTER `device`;",
"ALTER TABLE `tbl_plans` ADD `on_logout` TEXT NULL DEFAULT NULL AFTER `on_login`;"
]
}

View File

@ -45,7 +45,7 @@
<label class="col-md-2 control-label">Radius
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="If you enable Radius, choose device to radius, except if you have custom device. *This option will be deleted and replaced by Device">?</a>
data-content="If you enable Radius, choose device to radius, except if you have custom device.">?</a>
</label>
<div class="col-md-6">
<label class="radio-inline">

View File

@ -1,30 +1,31 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Edit Service Plan')} || {$d['name_plan']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}services/edit-post">
<form class="form-horizontal" method="post" role="form" action="{$_url}services/edit-post">
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Edit Service Plan')} || {$d['name_plan']}</div>
<div class="panel-body">
<input type="hidden" name="id" value="{$d['id']}">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Status')}
<label class="col-md-3 control-label">{Lang::T('Status')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Customer cannot buy disabled Plan, but admin can recharge it, use it if you want only admin recharge it">?</a>
</label>
<div class="col-md-10">
<div class="col-md-9">
<input type="radio" name="enabled" value="1" {if $d['enabled'] == 1}checked{/if}> Enable
<input type="radio" name="enabled" value="0" {if $d['enabled'] == 0}checked{/if}> Disable
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Type')}
<label class="col-md-3 control-label">{Lang::T('Type')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Postpaid will have fix expired date">?</a>
</label>
<div class="col-md-10">
<div class="col-md-9">
<input type="radio" name="prepaid" onclick="prePaid()" value="yes"
{if $d['prepaid'] == 'yes'}checked{/if}>
Prepaid
@ -33,12 +34,12 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Type')}
<label class="col-md-3 control-label">{Lang::T('Plan Type')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Personal Plan will only show to personal Customer, Business plan will only show to Business Customer">?</a>
</label>
<div class="col-md-10">
<div class="col-md-9">
<input type="radio" name="plan_type" value="Personal"
{if $d['plan_type'] == 'Personal'}checked{/if}>
Personal
@ -48,23 +49,23 @@
</div>
{if $_c['radius_enable'] and $d['is_radius']}
<div class="form-group">
<label class="col-md-2 control-label">Radius
<label class="col-md-3 control-label">Radius
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="If you enable Radius, choose device to radius, except if you have custom device. *This option will be deleted and replaced by Device">?</a>
data-content="If you enable Radius, choose device to radius, except if you have custom device.">?</a>
</label>
<div class="col-md-10">
<div class="col-md-9">
<label class="label label-primary">RADIUS</label>
</div>
</div>
{/if}
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Device')}
<label class="col-md-3 control-label">{Lang::T('Device')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="This Device are the logic how PHPNuxBill Communicate with Mikrotik or other Devices">?</a>
</label>
<div class="col-md-6">
<div class="col-md-9">
<select class="form-control" id="device" name="device">
{foreach $devices as $dev}
<option value="{$dev}" {if $dev == $d['device']}selected{/if}>{$dev}</option>
@ -73,15 +74,15 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Name')}</label>
<div class="col-md-6">
<label class="col-md-3 control-label">{Lang::T('Plan Name')}</label>
<div class="col-md-9">
<input type="text" class="form-control" id="name" name="name" maxlength="40"
value="{$d['name_plan']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Type')}</label>
<div class="col-md-10">
<label class="col-md-3 control-label">{Lang::T('Plan Type')}</label>
<div class="col-md-9">
<input type="radio" id="Unlimited" name="typebp" value="Unlimited"
{if $d['typebp'] eq 'Unlimited'} checked {/if}> {Lang::T('Unlimited')}
<input type="radio" id="Limited" name="typebp" value="Limited"
@ -91,8 +92,8 @@
</div>
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;" {/if} id="Type">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Limit Type')}</label>
<div class="col-md-10">
<label class="col-md-3 control-label">{Lang::T('Limit Type')}</label>
<div class="col-md-9">
<input type="radio" id="Time_Limit" name="limit_type" value="Time_Limit"
{if $d['limit_type'] eq 'Time_Limit'} checked {/if}> {Lang::T('Time Limit')}
<input type="radio" id="Data_Limit" name="limit_type" value="Data_Limit"
@ -102,16 +103,16 @@
</div>
</div>
</div>
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;"
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;"
{elseif ($d['time_limit']) eq '0'}
style="display:none;" {/if} id="TimeLimit">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Time Limit')}</label>
<div class="col-md-4">
<label class="col-md-3 control-label">{Lang::T('Time Limit')}</label>
<div class="col-md-3">
<input type="text" class="form-control" id="time_limit" name="time_limit"
value="{$d['time_limit']}">
</div>
<div class="col-md-2">
<div class="col-md-6">
<select class="form-control" id="time_unit" name="time_unit">
<option value="Hrs" {if $d['time_unit'] eq 'Hrs'} selected {/if}>{Lang::T('Hrs')}
</option>
@ -121,16 +122,16 @@
</div>
</div>
</div>
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;"
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;"
{elseif ($d['data_limit']) eq '0'}
style="display:none;" {/if} id="DataLimit">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Data Limit')}</label>
<div class="col-md-4">
<label class="col-md-3 control-label">{Lang::T('Data Limit')}</label>
<div class="col-md-3">
<input type="text" class="form-control" id="data_limit" name="data_limit"
value="{$d['data_limit']}">
</div>
<div class="col-md-2">
<div class="col-md-6">
<select class="form-control" id="data_unit" name="data_unit">
<option value="MB" {if $d['data_unit'] eq 'MB'} selected {/if}>MBs</option>
<option value="GB" {if $d['data_unit'] eq 'GB'} selected {/if}>GBs</option>
@ -139,9 +140,9 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a
<label class="col-md-3 control-label"><a
href="{$_url}bandwidth/add">{Lang::T('Bandwidth Name')}</a></label>
<div class="col-md-6">
<div class="col-md-9">
<select id="id_bw" name="id_bw" class="form-control select2">
{foreach $b as $bs}
<option value="{$bs['id']}" {if $d['id_bw'] eq $bs['id']} selected {/if}>
@ -151,8 +152,8 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Price')}</label>
<div class="col-md-6">
<label class="col-md-3 control-label">{Lang::T('Plan Price')}</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon">{$_c['currency_code']}</span>
<input type="number" class="form-control" name="price" value="{$d['price']}" required>
@ -160,33 +161,33 @@
</div>
{if $_c['enable_tax'] == 'yes'}
{if $_c['tax_rate'] == 'custom'}
<p class="help-block col-md-4">{number_format($_c['custom_tax_rate'], 2)} % {Lang::T('Tax Rates
<p class="help-block col-md-3">{number_format($_c['custom_tax_rate'], 2)} % {Lang::T('Tax Rates
will be added')}</p>
{else}
<p class="help-block col-md-4">{number_format($_c['tax_rate'] * 100, 2)} % {Lang::T('Tax Rates
<p class="help-block col-md-3">{number_format($_c['tax_rate'] * 100, 2)} % {Lang::T('Tax Rates
will be added')}</p>
{/if}
{/if}
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Shared Users')}
<label class="col-md-3 control-label">{Lang::T('Shared Users')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="How many devices can online in one Customer account">?</a>
</label>
<div class="col-md-6">
<div class="col-md-9">
<input type="text" class="form-control" id="sharedusers" name="sharedusers"
value="{$d['shared_users']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
<div class="col-md-4">
<label class="col-md-3 control-label">{Lang::T('Plan Validity')}</label>
<div class="col-md-3">
<input type="text" class="form-control" id="validity" name="validity"
value="{$d['validity']}">
</div>
<div class="col-md-2">
<div class="col-md-6">
<select class="form-control" id="validity_unit" name="validity_unit">
{if $d['prepaid'] == yes}
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{Lang::T('Mins')}
@ -202,17 +203,17 @@
{Lang::T('Period')}</option>
{/if}
</select>
<p class="help-block">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}
</p>
</div>
<p class="help-block col-md-4">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}
</p>
</div>
<div class="form-group {if $d['prepaid'] == yes}hidden{/if}" id="expired_date">
<label class="col-md-2 control-label">{Lang::T('Expired Date')}
<label class="col-md-3 control-label">{Lang::T('Expired Date')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Expired will be this date every month, 0 will be when customer buy internet plan">?</a>
</label>
<div class="col-md-6">
<div class="col-md-9">
<input type="number" class="form-control" name="expired_date" maxlength="2"
value="{if $d['expired_date']}{$d['expired_date']}{else}20{/if}" min="1" max="28"
step="1">
@ -220,9 +221,9 @@
</div>
<span id="routerChoose" class="{if $d['is_radius']}hidden{/if}">
<div class="form-group">
<label class="col-md-2 control-label"><a
<label class="col-md-3 control-label"><a
href="{$_url}routers/add">{Lang::T('Router Name')}</a></label>
<div class="col-md-6">
<div class="col-md-9">
<input type="text" class="form-control" id="routers" name="routers"
value="{$d['routers']}" readonly>
</div>
@ -230,8 +231,8 @@
</span>
<legend>{Lang::T('Expired Action')} <sub>{Lang::T('Optional')}</sub></legend>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Expired Internet Plan')}</label>
<div class="col-md-6">
<label class="col-md-3 control-label">{Lang::T('Expired Internet Plan')}</label>
<div class="col-md-9">
<select id="plan_expired" name="plan_expired" class="form-control select2">
<option value='0'>Default - Remove Customer</option>
{foreach $exps as $exp}
@ -239,22 +240,36 @@
{$exp['name_plan']}</option>
{/foreach}
</select>
</div>
<p class="help-block col-md-4">
{Lang::T('When Expired, customer will be move to selected internet plan')}</p>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button class="btn btn-success" type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}services/hotspot">{Lang::T('Cancel')}</a>
<p class="help-block">
{Lang::T('When Expired, customer will be move to selected internet plan')}</p>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">on-login / on-up</div>
<div class="panel-body">
<textarea class="form-control" id="code" name="on_login" style="font-family: 'Courier New', Courier, monospace;" rows="15">{$d['on_login']}</textarea>
</div>
</div>
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">on-logout / on-down</div>
<div class="panel-body">
<textarea class="form-control" id="code2" name="on_logout" style="font-family: 'Courier New', Courier, monospace;" rows="15">{$d['on_logout']}</textarea>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-9">
<button class="btn btn-success" type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}services/hotspot">{Lang::T('Cancel')}</a>
</div>
</div>
</form>
<script>
var preOpt = `<option value="Mins">{Lang::T('Mins')}</option>
@ -300,4 +315,22 @@
</script>
{/literal}
{/if}
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js"></script>
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/mode/perl/perl.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css"></link>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/theme/abbott.min.css"></link>
<script>
CodeMirror.fromTextArea(document.getElementById('code'), {
lineNumbers: true,
mode: 'text/x-perl',
});
CodeMirror.fromTextArea(document.getElementById('code2'), {
lineNumbers: true,
mode: 'text/x-perl',
});
</script>
{include file="sections/footer.tpl"}

View File

@ -44,7 +44,7 @@
<label class="col-md-2 control-label">Radius
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="If you enable Radius, choose device to radius, except if you have custom device. *This option will be deleted and replaced by Device">?</a>
data-content="If you enable Radius, choose device to radius, except if you have custom device.">?</a>
</label>
<div class="col-md-6">
<input type="checkbox" name="radius" onclick="isRadius(this)" value="1"> Radius Plan

View File

@ -1,30 +1,30 @@
{include file="sections/header.tpl"}
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Edit Service Plan')} || {$d['name_plan']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}services/edit-pppoe-post">
<form class="form-horizontal" method="post" role="form" action="{$_url}services/edit-pppoe-post">
<div class="row">
<div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Edit Service Plan')} || {$d['name_plan']}</div>
<div class="panel-body">
<input type="hidden" name="id" value="{$d['id']}">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Status')}
<label class="col-md-3 control-label">{Lang::T('Status')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Customer cannot buy disabled Plan, but admin can recharge it, use it if you want only admin recharge it">?</a>
</label>
<div class="col-md-10">
<div class="col-md-9">
<input type="radio" name="enabled" value="1" {if $d['enabled'] == 1}checked{/if}> Enable
<input type="radio" name="enabled" value="0" {if $d['enabled'] == 0}checked{/if}> Disable
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Type')}
<label class="col-md-3 control-label">{Lang::T('Type')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Postpaid will have fix expired date">?</a>
</label>
<div class="col-md-10">
<div class="col-md-9">
<input type="radio" name="prepaid" onclick="prePaid()" value="yes"
{if $d['prepaid'] == 'yes'}checked{/if}>
Prepaid
@ -33,12 +33,12 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Type')}
<label class="col-md-3 control-label">{Lang::T('Plan Type')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Personal Plan will only show to personal Customer, Business plan will only show to Business Customer">?</a>
</label>
<div class="col-md-10">
<div class="col-md-9">
<input type="radio" name="plan_type" value="Personal"
{if $d['plan_type'] == 'Personal'}checked{/if}>
Personal
@ -48,23 +48,23 @@
</div>
{if $_c['radius_enable'] and $d['is_radius']}
<div class="form-group">
<label class="col-md-2 control-label">Radius
<label class="col-md-3 control-label">Radius
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="If you enable Radius, choose device to radius, except if you have custom device. *This option will be deleted and replaced by Device">?</a>
data-content="If you enable Radius, choose device to radius, except if you have custom device.">?</a>
</label>
<div class="col-md-10">
<div class="col-md-9">
<label class="label label-primary">RADIUS</label>
</div>
</div>
{/if}
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Device')}
<label class="col-md-3 control-label">{Lang::T('Device')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="This Device are the logic how PHPNuxBill Communicate with Mikrotik or other Devices">?</a>
</label>
<div class="col-md-6">
<div class="col-md-9">
<select class="form-control" id="device" name="device">
{foreach $devices as $dev}
<option value="{$dev}" {if $dev == $d['device']}selected{/if}>{$dev}</option>
@ -73,16 +73,16 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Name')}</label>
<div class="col-md-6">
<label class="col-md-3 control-label">{Lang::T('Plan Name')}</label>
<div class="col-md-9">
<input type="text" class="form-control" id="name_plan" maxlength="40" name="name_plan"
value="{$d['name_plan']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a
<label class="col-md-3 control-label"><a
href="{$_url}bandwidth/add">{Lang::T('Bandwidth Name')}</a></label>
<div class="col-md-6">
<div class="col-md-9">
<select id="id_bw" name="id_bw" class="form-control select2">
{foreach $b as $bs}
<option value="{$bs['id']}" {if $d['id_bw'] eq $bs['id']} selected {/if}>
@ -92,8 +92,8 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Price')}</label>
<div class="col-md-6">
<label class="col-md-3 control-label">{Lang::T('Plan Price')}</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon">{$_c['currency_code']}</span>
<input type="number" class="form-control" name="price" required value="{$d['price']}">
@ -111,12 +111,12 @@
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
<div class="col-md-4">
<label class="col-md-3 control-label">{Lang::T('Plan Validity')}</label>
<div class="col-md-3">
<input type="text" class="form-control" id="validity" name="validity"
value="{$d['validity']}">
</div>
<div class="col-md-2">
<div class="col-md-6">
<select class="form-control" id="validity_unit" name="validity_unit">
{if $d['prepaid'] == yes}
<option value="Mins" {if $d['validity_unit'] eq 'Mins'} selected {/if}>{Lang::T('Mins')}
@ -132,25 +132,25 @@
{Lang::T('Period')}</option>
{/if}
</select>
<p class="help-block">{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
</div>
<p class="help-block col-md-4">
{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}</p>
</div>
<div class="form-group {if $d['prepaid'] == yes}hidden{/if}" id="expired_date">
<label class="col-md-2 control-label">{Lang::T('Expired Date')}
<label class="col-md-3 control-label">{Lang::T('Expired Date')}
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="Expired will be this date every month">?</a>
</label>
<div class="col-md-6">
<div class="col-md-9">
<input type="number" class="form-control" name="expired_date" maxlength="2"
value="{if $d['expired_date']}{$d['expired_date']}{else}20{/if}" min="1" max="28"
step="1">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"><a href="{$_url}pool/add">{Lang::T('IP Pool')}</a></label>
<div class="col-md-6">
<label class="col-md-3 control-label"><a href="{$_url}pool/add">{Lang::T('IP Pool')}</a></label>
<div class="col-md-9">
<select id="pool_name" name="pool_name" required class="form-control select2">
{foreach $p as $ps}
<option value="{$ps['pool_name']}" {if $d['pool'] eq $ps['pool_name']} selected {/if}>
@ -160,16 +160,16 @@
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Router Name')}</label>
<div class="col-md-6">
<label class="col-md-3 control-label">{Lang::T('Router Name')}</label>
<div class="col-md-9">
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}"
readonly>
</div>
</div>
<legend>{Lang::T('Expired Action')} <sub>{Lang::T('Optional')}</sub></legend>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Expired Internet Plan')}</label>
<div class="col-md-6">
<label class="col-md-3 control-label">{Lang::T('Expired Internet Plan')}</label>
<div class="col-md-9">
<select id="plan_expired" name="plan_expired" class="form-control select2">
<option value='0'>Default - Remove Customer</option>
{foreach $exps as $exp}
@ -177,21 +177,37 @@
{$exp['name_plan']}</option>
{/foreach}
</select>
</div>
<p class="help-block col-md-4">
{Lang::T('When Expired, customer will be move to selected internet plan')}</p>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success" type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}services/pppoe">{Lang::T('Cancel')}</a>
<p class="help-block">
{Lang::T('When Expired, customer will be move to selected internet plan')}</p>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">on-login / on-up</div>
<div class="panel-body">
<textarea class="form-control" id="code" name="on_login"
style="font-family: 'Courier New', Courier, monospace;" rows="15">{$d['on_login']}</textarea>
</div>
</div>
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">on-logout / on-down</div>
<div class="panel-body">
<textarea class="form-control" id="code2" name="on_logout"
style="font-family: 'Courier New', Courier, monospace;" rows="15">{$d['on_logout']}</textarea>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success" type="submit">{Lang::T('Save Changes')}</button>
Or <a href="{$_url}services/pppoe">{Lang::T('Cancel')}</a>
</div>
</div>
</form>
<script>
@ -210,4 +226,28 @@
$("#expired_date").removeClass('hidden');
}
</script>
<script language="javascript" type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js"></script>
<script language="javascript" type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/mode/perl/perl.min.js"></script>
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css">
</link>
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/theme/abbott.min.css">
</link>
<script>
CodeMirror.fromTextArea(document.getElementById('code'), {
lineNumbers: true,
mode: 'text/x-perl',
});
CodeMirror.fromTextArea(document.getElementById('code2'), {
lineNumbers: true,
mode: 'text/x-perl',
});
</script>
{include file="sections/footer.tpl"}

View File

@ -1,3 +1,3 @@
{
"version": "2024.6.19"
"version": "2024.6.21"
}