getCompiled()->isFresh($_smarty_tpl, array (
'version' => '5.3.1',
'unifunc' => 'content_673c25a1b76281_69333552',
'has_nocache_code' => false,
'file_dependency' =>
array (
'd4557d0993be53a3ccc437607e1df0f3e0360246' =>
array (
0 => 'admin/coupon.tpl',
1 => 1712762115,
2 => 'file',
),
),
'includes' =>
array (
'file:admin/header.tpl' => 1,
'file:datatable.tpl' => 1,
'file:admin/footer.tpl' => 1,
),
))) {
function content_673c25a1b76281_69333552 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = '/private/var/www/wwwroot/crc.loc/resources/views/tabler/admin';
$_smarty_tpl->renderSubTemplate('file:admin/header.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
?>
getValue('user')->is_dark_mode) {?>
src="//getValue('config')['jsdelivr_url'];?>
/npm/flatpickr">
>
src="//getValue('config')['jsdelivr_url'];?>
/npm/flatpickr/dist/l10n/zh.js">
>
getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('details')['field'], 'value', false, 'key');
$foreach0DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('key')->value => $_smarty_tpl->getVariable('value')->value) {
$foreach0DoElse = false;
?>
| getValue('value');?>
|
getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
renderSubTemplate('file:datatable.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
?>
>
flatpickr("#expire_time", {
enableTime: true,
dateFormat: "U",
time_24hr: true,
minDate: "today",
locale: "zh"
});
tableConfig.ajax = {
url: '/admin/coupon/ajax',
type: 'POST',
dataSrc: 'coupons'
};
tableConfig.order = [
[1, 'desc']
];
tableConfig.columnDefs = [
{
targets: [0],
orderable: false
}
];
let table = new DataTable('#data-table', tableConfig);
function loadTable() {
table;
}
function createCoupon() {
$.ajax({
url: '/admin/coupon',
type: 'POST',
dataType: "json",
data: {
getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('details')['create_dialog'], 'detail');
$foreach3DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('detail')->value) {
$foreach3DoElse = false;
?>
getValue('detail')['id'];?>
: $('#getValue('detail')['id'];?>
').val(),
getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
expire_time: $('#expire_time').val(),
},
success: function (data) {
if (data.ret === 1) {
$('#success-noreload-message').text(data.msg);
$('#success-noreload-dialog').modal('show');
reloadTableAjax();
} else {
$('#fail-message').text(data.msg);
$('#fail-dialog').modal('show');
}
}
})
}
function deleteCoupon(coupon_id) {
$('#notice-message').text('确定删除此优惠码?');
$('#notice-dialog').modal('show');
$('#notice-confirm').off('click').on('click', function () {
$.ajax({
url: "/admin/coupon/" + coupon_id,
type: 'DELETE',
dataType: "json",
success: function (data) {
if (data.ret === 1) {
$('#success-noreload-message').text(data.msg);
$('#success-noreload-dialog').modal('show');
reloadTableAjax();
} else {
$('#fail-message').text(data.msg);
$('#fail-dialog').modal('show');
}
}
})
});
}
function disableCoupon(coupon_id) {
$('#notice-message').text('确定禁用此优惠码?');
$('#notice-dialog').modal('show');
$('#notice-confirm').off('click').on('click', function () {
$.ajax({
url: "/admin/coupon/" + coupon_id + "/disable",
type: 'POST',
dataType: "json",
success: function (data) {
if (data.ret === 1) {
$('#success-noreload-dialog').text(data.msg);
$('#success-noreload-message').modal('show');
reloadTableAjax();
} else {
$('#fail-message').text(data.msg);
$('#fail-dialog').modal('show');
}
}
})
});
}
function reloadTableAjax() {
table.ajax.reload(null, false);
}
loadTable();
>
renderSubTemplate('file:admin/footer.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
}
}