Voucher Template Full Custom
This commit is contained in:
parent
b9537d4a4b
commit
d59f696fde
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||
* by https://t.me/ibnux
|
||||
@ -49,9 +50,9 @@ switch ($action) {
|
||||
}
|
||||
$p = ORM::for_table('tbl_plans')->findOne($plan['plan_id']);
|
||||
$c = ORM::for_table('tbl_customers')->findOne($plan['customer_id']);
|
||||
if($plan['routers'] == 'radius'){
|
||||
Radius::customerAddPlan($c, $p, $plan['expiration'].' '.$plan['time']);
|
||||
}else{
|
||||
if ($plan['routers'] == 'radius') {
|
||||
Radius::customerAddPlan($c, $p, $plan['expiration'] . ' ' . $plan['time']);
|
||||
} else {
|
||||
if ($plan['type'] == 'Hotspot') {
|
||||
Mikrotik::addHotspotUser($client, $p, $c);
|
||||
} else if ($plan['type'] == 'PPPOE') {
|
||||
@ -261,10 +262,16 @@ switch ($action) {
|
||||
$planid = _post('planid');
|
||||
$pagebreak = _post('pagebreak');
|
||||
$limit = _post('limit');
|
||||
|
||||
if ($pagebreak < 1) $pagebreak = 6;
|
||||
$vpl = _post('vpl');
|
||||
if(empty($vpl)){
|
||||
$vpl = 3;
|
||||
}
|
||||
if ($pagebreak < 1) $pagebreak = 12;
|
||||
|
||||
if ($limit < 1) $limit = $pagebreak * 2;
|
||||
if(empty($from_id)){
|
||||
$from_id = 0;
|
||||
}
|
||||
|
||||
if ($from_id > 0 && $planid > 0) {
|
||||
$v = ORM::for_table('tbl_plans')
|
||||
@ -315,9 +322,12 @@ switch ($action) {
|
||||
->where('tbl_voucher.status', '0')
|
||||
->count();
|
||||
}
|
||||
$template = file_get_contents("pages/Voucher.html");
|
||||
$template = str_replace('[[company_name]]', $config['CompanyName'], $template);
|
||||
|
||||
$ui->assign('_title', $_L['Voucher_Hotspot']);
|
||||
$ui->assign('from_id', $from_id);
|
||||
$ui->assign('vpl', $vpl);
|
||||
$ui->assign('pagebreak', $pagebreak);
|
||||
|
||||
$plans = ORM::for_table('tbl_plans')->find_many();
|
||||
@ -325,7 +335,17 @@ switch ($action) {
|
||||
$ui->assign('limit', $limit);
|
||||
$ui->assign('planid', $planid);
|
||||
|
||||
$ui->assign('v', $v);
|
||||
$voucher = [];
|
||||
foreach ($v as $vs) {
|
||||
$temp = $template;
|
||||
$temp = str_replace('[[qrcode]]', '<img src="qrcode/?data=' . $vs['code'] . '">', $temp);
|
||||
$temp = str_replace('[[price]]', Lang::moneyFormat($vs['price']), $temp);
|
||||
$temp = str_replace('[[voucher_code]]', $vs['code'], $temp);
|
||||
$temp = str_replace('[[plan]]', $vs['name_plan'], $temp);
|
||||
$voucher[] = $temp;
|
||||
}
|
||||
|
||||
$ui->assign('voucher',$voucher);
|
||||
$ui->assign('vc', $vc);
|
||||
|
||||
//for counting pagebreak
|
||||
@ -354,7 +374,11 @@ switch ($action) {
|
||||
run_hook('create_voucher'); #HOOK
|
||||
for ($i = 0; $i < $numbervoucher; $i++) {
|
||||
$code = strtoupper(substr(md5(time() . rand(10000, 99999)), 0, $lengthcode));
|
||||
//TODO: IMPLEMENT Voucher Generator
|
||||
if ($config['voucher_format'] == 'low') {
|
||||
$code = strtolower($code);
|
||||
} else if ($config['voucher_format'] == 'rand') {
|
||||
$code = Lang::randomUpLowCase($code);
|
||||
}
|
||||
$d = ORM::for_table('tbl_voucher')->create();
|
||||
$d->type = $type;
|
||||
$d->routers = $server;
|
||||
|
@ -3,39 +3,53 @@
|
||||
<div class="col-sm-12">
|
||||
<div class="panel mb20 panel-primary panel-hovered">
|
||||
<div class="panel-heading">{$pageHeader}</div>
|
||||
<div id="myNicPanel" style="width: 100%;"></div>
|
||||
<div id="panel-edit" class="panel-body">{$htmls}</div>
|
||||
<div id="myNicPanel" style="width: 100%;"></div>
|
||||
<div id="panel-edit" class="panel-body">{$htmls}</div>
|
||||
{if $writeable}
|
||||
<div class="panel-footer">
|
||||
<a href="javascript:saveIt()" class="btn btn-primary btn-block">SAVE</a>
|
||||
<br>
|
||||
<p class="help-block">{$_L['Info_Page']}</p>
|
||||
<input type="text" class="form-control" onclick="this.select()" readonly value="{$app_url}/pages/{$PageFile}.html">
|
||||
<input type="text" class="form-control" onclick="this.select()" readonly
|
||||
value="{$app_url}/pages/{$PageFile}.html">
|
||||
</div>
|
||||
{else}
|
||||
<div class="panel-footer">
|
||||
{$_L['Failed_Save_Page']}
|
||||
</div>
|
||||
{/if}
|
||||
{if $PageFile=='Voucher'}
|
||||
<div class="panel-footer">
|
||||
<p class="help-block">
|
||||
<b>[[company_name]]</b> Your Company Name at Settings.<br>
|
||||
<b>[[price]]</b> Plan Price.<br>
|
||||
<b>[[voucher_code]]</b> Voucher Code.<br>
|
||||
<b>[[plan]]</b> Voucher Plan.<br>
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form id="formpages" class="hidden" method="post" role="form" action="{$_url}pages/{$PageFile}-post" >
|
||||
<form id="formpages" class="hidden" method="post" role="form" action="{$_url}pages/{$PageFile}-post">
|
||||
<textarea name="html" id="html"></textarea>
|
||||
</form>
|
||||
<script src="ui/ui/scripts/nicEdit.js"></script>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
var myNicEditor
|
||||
bkLib.onDomLoaded(function() {
|
||||
myNicEditor = new nicEditor();
|
||||
myNicEditor = new nicEditor({fullPanel : true});
|
||||
myNicEditor.setPanel('myNicPanel');
|
||||
myNicEditor.addInstance('panel-edit');
|
||||
});
|
||||
function saveIt(){
|
||||
|
||||
function saveIt() {
|
||||
//alert(document.getElementById('panel-edit').innerHTML);
|
||||
document.getElementById('html').value = nicEditors.findEditor('panel-edit').getContent()
|
||||
document.getElementById('formpages').submit();
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
{include file="sections/footer.tpl"}
|
||||
{include file="sections/footer.tpl"}
|
@ -63,11 +63,13 @@
|
||||
<form method="post" action="{$_url}prepaid/print-voucher/" class="no-print">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="1" class="btn btn-default btn-sm">
|
||||
<tr>
|
||||
<td>ID > <input type="text" name="from_id" style="width:40px" value="{$from_id}"> limit <input
|
||||
type="text" name="limit" style="width:40px" value="{$limit}"></td>
|
||||
<td>From ID > <input type="text" name="from_id" style="width:40px" value="{$from_id}"> limit
|
||||
<input type="text" name="limit" style="width:40px" value="{$limit}"></td>
|
||||
<td>Voucher PerLine <input type="text" style="width:40px" name="vpl" value="{$vpl}">
|
||||
vouchers</td>
|
||||
<td>PageBreak after <input type="text" style="width:40px" name="pagebreak" value="{$pagebreak}">
|
||||
vouchers</td>
|
||||
<td>Plans <select id="plan_id" name="planid" style="width:150px">
|
||||
<td>Plans <select id="plan_id" name="planid" style="width:50px">
|
||||
<option value="0">--all--</option>
|
||||
{foreach $plans as $plan}
|
||||
<option value="{$plan['id']}" {if $plan['id']==$planid}selected{/if}>{$plan['name_plan']}
|
||||
@ -78,65 +80,31 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
<center><button type="button" id="actprint"
|
||||
<center><button type="button" onclick="window.print()"
|
||||
class="btn btn-default btn-sm no-print">{$_L['Click_Here_to_Print']}</button><br>
|
||||
{$_L['Print_Info']}<br>
|
||||
show {$v|@count} vouchers from {$vc} vouchers<br>
|
||||
from ID {$v[0]['id']} limit {$limit} vouchers
|
||||
</center>
|
||||
</form>
|
||||
<div id="printable">
|
||||
<div id="printable" align="center">
|
||||
<hr>
|
||||
{foreach $v as $vs}
|
||||
{$n = 1}
|
||||
{foreach $voucher as $vs}
|
||||
{$jml = $jml + 1}
|
||||
<table width="100%" height="200" border="0" cellspacing="0" cellpadding="1" style="margin-bottom:5px">
|
||||
<tbody>
|
||||
{if $n == 1}
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" valign="middle"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td width="50%" valign="middle" style="padding-right:10px">
|
||||
<center><strong style="font-size:38px">{$_L['Voucher_Hotspot']}</strong><span
|
||||
class="no-print"> ID {$vs['id']}</span></center>
|
||||
<table width="100%" border="1" cellspacing="0" cellpadding="1"
|
||||
bordercolor="#757575">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td rowspan="5" width="1"><img src="qrcode/?data={$vs['code']}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="middle" align="center" style="font-size:25px">
|
||||
{$vs['code']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="middle" align="center" style="font-size:15px">
|
||||
{$vs['name_plan']}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top" style="padding-left:10px">
|
||||
{include file="$_path/../pages/Voucher.html"}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr>
|
||||
{/if}
|
||||
<td>{$vs}</td>
|
||||
{if $n == $vpl}
|
||||
</table>
|
||||
{$n = 1}
|
||||
{else}
|
||||
{$n = $n + 1}
|
||||
{/if}
|
||||
|
||||
|
||||
{if $jml == $pagebreak}
|
||||
{$jml = 0}
|
||||
<!-- pageBreak -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user