Using Select2 for dropdown

This commit is contained in:
Ibnu Maksum 2023-08-16 09:05:59 +07:00
parent 3fe9111824
commit b315e3dba1
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
25 changed files with 61 additions and 47 deletions

View File

@ -364,3 +364,4 @@ $_L['Auto_Renewal_On'] = 'Auto Renewal On';
$_L['Enable_auto_renewal'] = 'Enable auto renewal?';
$_L['Auto_Renewal_Off'] = 'Auto Renewal Off';
$_L['Refill_Balance'] = 'Refill Balance';
$_L['Invoice_Footer'] = 'Invoice Footer';

View File

@ -9,23 +9,23 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Select_Account']}</label>
<div class="col-md-6">
<select id="personSelect" class="form-control" name="id_customer" style="width: 100%"
<select id="personSelect" class="form-control select2" name="id_customer" style="width: 100%"
data-placeholder="{$_L['Select_Customer']}...">
<option></option>
{foreach $c as $cs}
<option value="{$cs['id']}">{$cs['username']}</option>
<option value="{$cs['id']}">{$cs['username']} - {$cs['fullname']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
<label class="col-md-2 control-label"><a href="{$_url}services/balance">{Lang::T('Balance Plans')}</a></label>
<div class="col-md-6">
<select id="planSelect" class="form-control" name="id_plan" style="width: 100%"
<select id="planSelect" class="form-control select2" name="id_plan" style="width: 100%"
data-placeholder="{$_L['Select_Plans']}...">
<option></option>
{foreach $p as $pl}
<option value="{$pl['id']}">{$pl['name_plan']}</option>
<option value="{$pl['id']}">{$pl['name_plan']} - {Lang::moneyFormat($pl['price'])}</option>
{/foreach}
</select>
</div>

View File

@ -71,7 +71,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['BW_Name']}</label>
<div class="col-md-6">
<select id="id_bw" name="id_bw" class="form-control">
<select id="id_bw" name="id_bw" class="form-control select2">
<option value="">{$_L['Select_BW']}...</option>
{foreach $d as $ds}
<option value="{$ds['id']}">{$ds['name_bw']}</option>
@ -112,7 +112,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
<div class="col-md-6">
<select id="routers" name="routers" class="form-control">
<select id="routers" name="routers" class="form-control select2">
{foreach $r as $rs}
<option value="{$rs['name']}">{$rs['name']}</option>
{/foreach}

View File

@ -72,7 +72,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['BW_Name']}</label>
<div class="col-md-6">
<select id="id_bw" name="id_bw" class="form-control">
<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}>{$bs['name_bw']}</option>
{/foreach}

View File

@ -44,7 +44,7 @@
<td>{$ds['name_plan']}</td>
<td>{$ds['typebp']}</td>
<td>{$ds['name_bw']}</td>
<td>{$ds['price']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['time_limit']} {$ds['time_unit']}</td>
<td>{$ds['data_limit']} {$ds['data_unit']}</td>
<td>{$ds['validity']} {$ds['validity_unit']}</td>

View File

@ -5,8 +5,8 @@
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Add_Pool']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}pool/add-post" >
<form class="form-horizontal" method="post" role="form" action="{$_url}pool/add-post" >
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Pool_Name']}</label>
<div class="col-md-6">
@ -18,11 +18,11 @@
<div class="col-md-6">
<input type="text" class="form-control" id="ip_address" name="ip_address" placeholder="ex: 192.168.88.2-192.168.88.254">
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Routers']}</label>
<div class="col-md-6">
<select id="routers" name="routers" class="form-control">
<select id="routers" name="routers" class="form-control select2">
{foreach $r as $rs}
<option value="{$rs['name']}">{$rs['name']}</option>
{/foreach}
@ -36,7 +36,7 @@
</div>
</div>
</form>
</div>
</div>
</div>

View File

@ -5,9 +5,9 @@
<div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['Edit_Pool']}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}pool/edit-post" >
<input type="hidden" name="id" value="{$d['id']}">
<form class="form-horizontal" method="post" role="form" action="{$_url}pool/edit-post" >
<input type="hidden" name="id" value="{$d['id']}">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Pool_Name']}</label>
<div class="col-md-6">
@ -24,10 +24,9 @@
<label class="col-md-2 control-label">{$_L['Routers']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="routers" name="routers" value="{$d['routers']}" readonly>
</select>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success waves-effect waves-light" type="submit">{$_L['Save']}</button>
@ -35,7 +34,7 @@
</div>
</div>
</form>
</div>
</div>
</div>

View File

@ -26,7 +26,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['BW_Name']}</label>
<div class="col-md-6">
<select id="id_bw" name="id_bw" class="form-control">
<select id="id_bw" name="id_bw" class="form-control select2">
<option value="">{$_L['Select_BW']}...</option>
{foreach $d as $ds}
<option value="{$ds['id']}">{$ds['name_bw']}</option>
@ -60,7 +60,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
<div class="col-md-6">
<select id="routers" name="routers" class="form-control">
<select id="routers" name="routers" class="form-control select2">
<option value=''>{$_L['Select_Routers']}</option>
{foreach $r as $rs}
<option value="{$rs['name']}">{$rs['name']}</option>
@ -72,7 +72,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Pool']}</label>
<div class="col-md-6">
<select id="pool_name" name="pool_name" class="form-control">
<select id="pool_name" name="pool_name" class="form-control select2">
<option value=''>{$_L['Select_Pool']}</option>
</select>
</div>

View File

@ -27,7 +27,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['BW_Name']}</label>
<div class="col-md-6">
<select id="id_bw" name="id_bw" class="form-control">
<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}>{$bs['name_bw']}</option>
{/foreach}
@ -60,7 +60,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Pool']}</label>
<div class="col-md-6">
<select id="pool_name" name="pool_name" class="form-control">
<select id="pool_name" name="pool_name" class="form-control select2">
{foreach $p as $ps}
<option value="{$ps['pool_name']}" {if $d['pool_name'] eq $ps['pool_name']} selected {/if}>{$ps['pool_name']}</option>
{/foreach}

View File

@ -41,7 +41,7 @@
<tr {if $ds['enabled'] != 1}class="danger" title="disabled"{/if}>
<td>{$ds['name_plan']}</td>
<td>{$ds['name_bw']}</td>
<td>{$ds['price']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['validity']} {$ds['validity_unit']}</td>
<td>{$ds['pool']}</td>
<td>{$ds['routers']}</td>

View File

@ -17,7 +17,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
<div class="col-md-6">
<select id="id_plan" name="id_plan" class="form-control">
<select id="id_plan" name="id_plan" class="form-control select2">
{foreach $p as $ps}
<option value="{$ps['id']}" {if $d['plan_id'] eq $ps['id']} selected {/if}>{$ps['name_plan']}</option>
{/foreach}

View File

@ -38,7 +38,7 @@
<td>{$ds['username']}</td>
<td class="text-center">{$ds['plan_name']}</td>
<td class="text-center">{$ds['type']}</td>
<td class="text-right">{$_c['currency_code']} {number_format($ds['price'],2,$_c['dec_point'],$_c['thousands_sep'])}</td>
<td class="text-right">{Lang::moneyFormat($ds['price'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td class="text-center">{$ds['method']}</td>

View File

@ -38,7 +38,7 @@
<td>{$ds['username']}</td>
<td class="text-center">{$ds['plan_name']}</td>
<td class="text-center">{$ds['type']}</td>
<td class="text-right">{$_c['currency_code']} {number_format($ds['price'],2,$_c['dec_point'],$_c['thousands_sep'])}</td>
<td class="text-right">{Lang::moneyFormat($ds['price'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td class="text-center">{$ds['method']}</td>
@ -49,7 +49,7 @@
</div>
<div class="clearfix text-right total-sum mb10">
<h4 class="text-uppercase text-bold">{$_L['Total_Income']}:</h4>
<h3 class="sum">{$_c['currency_code']} {number_format($dr,2,$_c['dec_point'],$_c['thousands_sep'])}</h3>
<h3 class="sum">{Lang::moneyFormat($dr)}</h3>
</div>
</div>
<button type="button" id="actprint" class="btn btn-default btn-sm no-print">{$_L['Click_Here_to_Print']}</button>

View File

@ -86,7 +86,7 @@
<td rowspan="5" width="1"><img src="qrcode/?data={$vs['code']}"></td>
</tr>
<tr>
<td valign="middle" align="center" style="font-size:25px">{$_c['currency_code']} {number_format($vs['price'],2,$_c['dec_point'],$_c['thousands_sep'])}</td>
<td valign="middle" align="center" style="font-size:25px">{Lang::moneyFormat($vs['price'])}</td>
</tr>
<tr>
<td valign="middle" align="center" style="font-size:20px">{$_L['Code_Voucher']}</td>

View File

@ -9,7 +9,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Select_Account']}</label>
<div class="col-md-6">
<select id="personSelect" class="form-control" name="id_customer" style="width: 100%" data-placeholder="Select a customer...">
<select id="personSelect" class="form-control select2" name="id_customer" style="width: 100%" data-placeholder="Select a customer...">
<option></option>
{foreach $c as $cs}
{if $id eq $cs['id']}
@ -31,7 +31,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Routers']}</label>
<div class="col-md-6">
<select id="server" name="server" class="form-control">
<select id="server" name="server" class="form-control select2">
<option value=''>Select Routers</option>
</select>
</div>
@ -40,7 +40,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
<div class="col-md-6">
<select id="plan" name="plan" class="form-control">
<select id="plan" name="plan" class="form-control select2">
<option value=''>Select Plans</option>
</select>
</div>

View File

@ -9,7 +9,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Select_Account']}</label>
<div class="col-md-6">
<select id="personSelect" class="form-control" name="id_customer" style="width: 100%" data-placeholder="{$_L['Select_Customer']}...">
<select id="personSelect" class="form-control select2" name="id_customer" style="width: 100%" data-placeholder="{$_L['Select_Customer']}...">
<option></option>
{foreach $c as $cs}
<option value="{$cs['id']}">{$cs['username']}</option>
@ -27,7 +27,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Routers']}</label>
<div class="col-md-6">
<select id="server" name="server" class="form-control">
<select id="server" name="server" class="form-control select2">
<option value=''>{$_L['Select_Routers']}</option>
</select>
</div>
@ -36,7 +36,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
<div class="col-md-6">
<select id="plan" name="plan" class="form-control">
<select id="plan" name="plan" class="form-control select2">
<option value=''>{$_L['Select_Plans']}</option>
</select>
</div>

View File

@ -9,7 +9,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Select_Account']}</label>
<div class="col-md-6">
<select id="personSelect" class="form-control" name="id_customer" style="width: 100%"
<select id="personSelect" class="form-control select2" name="id_customer" style="width: 100%"
data-placeholder="{$_L['Select_Customer']}...">
<option></option>
{foreach $c as $cs}

View File

@ -41,8 +41,7 @@
<td>{$ds['username']}</td>
<td>{$ds['type']}</td>
<td>{$ds['plan_name']}</td>
<td class="text-right">{$_c['currency_code']}
{number_format($ds['price'],2,$_c['dec_point'],$_c['thousands_sep'])}</td>
<td class="text-right">{Lang::moneyFormat($ds['price'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td>{$ds['method']}</td>
@ -56,7 +55,7 @@
<div class="clearfix text-right total-sum mb10">
<h4 class="text-uppercase text-bold">{$_L['Total_Income']}:</h4>
<h3 class="sum">{$_c['currency_code']} {number_format($dr,2,$_c['dec_point'],$_c['thousands_sep'])}</h3>
<h3 class="sum">{Lang::moneyFormat($dr)}</h3>
</div>
<p class="text-center small text-info">{$_L['All_Transactions_at_Date']}:
{date($_c['date_format'], strtotime($mdate))} {$mtime}</p>

View File

@ -52,8 +52,7 @@
<td>{$ds['username']}</td>
<td>{$ds['type']}</td>
<td>{$ds['plan_name']}</td>
<td class="text-right">{$_c['currency_code']}
{number_format($ds['price'],0,$_c['dec_point'],$_c['thousands_sep'])}</td>
<td class="text-right">{Lang::moneyFormat($ds['price'])}</td>
<td>{date($_c['date_format'], strtotime($ds['recharged_on']))}</td>
<td>{date($_c['date_format'], strtotime($ds['expiration']))} {$ds['time']}</td>
<td>{$ds['method']}</td>
@ -65,7 +64,7 @@
</div>
<div class="clearfix text-right total-sum mb10">
<h4 class="text-uppercase text-bold">{$_L['Total_Income']}:</h4>
<h3 class="sum">{$_c['currency_code']} {number_format($dr,2,$_c['dec_point'],$_c['thousands_sep'])}</h3>
<h3 class="sum">{Lang::moneyFormat($dr)}</h3>
</div>
<p class="text-center small text-info">{$stype} [{date( $_c['date_format'], strtotime($fdate))} -
{date( $_c['date_format'], strtotime($tdate))}]</p>

2
ui/ui/scripts/select2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -14,10 +14,18 @@
<script src="ui/ui/scripts/plugins/select2.min.js"></script>
<script src="ui/ui/scripts/custom.js"></script>
<script src="ui/ui/scripts/select2.min.js"></script>
{if isset($xfooter)}
{$xfooter}
{/if}
{literal}
<script>
$(document).ready(function() {
$('.select2').select2({theme: "bootstrap"});
});
</script>
{/literal}
</body>

View File

@ -15,7 +15,8 @@
<link rel="stylesheet" href="ui/ui/styles/adminlte.min.css">
<link rel="stylesheet" href="ui/ui/styles/skin-blue.min.css">
<link rel="stylesheet" href="ui/ui/styles/select2.min.css" />
<link rel="stylesheet" href="ui/ui/styles/select2-bootstrap.min.css" />
<style>
::-moz-selection {
/* Code for Firefox */
@ -27,6 +28,9 @@
color: red;
background: yellow;
}
.select2-container .select2-selection--single .select2-selection__rendered {
margin-top: 0px !important;
}
</style>
{if isset($xheader)}

1
ui/ui/styles/select2-bootstrap.min.css vendored Executable file

File diff suppressed because one or more lines are too long

1
ui/ui/styles/select2.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Routers']}</label>
<div class="col-md-6">
<select id="server" name="server" class="form-control">
<select id="server" name="server" class="form-control select2">
<option value=''>{$_L['Select_Routers']}</option>
</select>
</div>
@ -26,7 +26,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Service_Plan']}</label>
<div class="col-md-6">
<select id="plan" name="plan" class="form-control">
<select id="plan" name="plan" class="form-control select2">
<option value=''>{$_L['Select_Plans']}</option>
</select>
</div>