165 lines
5.9 KiB
PHP
Executable File
165 lines
5.9 KiB
PHP
Executable File
<?php
|
|
/* Smarty version 5.3.1, created on 2025-02-02 20:32:25
|
|
from 'file:admin/product/index.tpl' */
|
|
|
|
/* @var \Smarty\Template $_smarty_tpl */
|
|
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
|
'version' => '5.3.1',
|
|
'unifunc' => 'content_679f65d94489b7_81953068',
|
|
'has_nocache_code' => false,
|
|
'file_dependency' =>
|
|
array (
|
|
'29a15cb1edccd83458999dd2cc8643b310b5a718' =>
|
|
array (
|
|
0 => 'admin/product/index.tpl',
|
|
1 => 1731988017,
|
|
2 => 'file',
|
|
),
|
|
),
|
|
'includes' =>
|
|
array (
|
|
'file:admin/header.tpl' => 1,
|
|
'file:datatable.tpl' => 1,
|
|
'file:admin/footer.tpl' => 1,
|
|
),
|
|
))) {
|
|
function content_679f65d94489b7_81953068 (\Smarty\Template $_smarty_tpl) {
|
|
$_smarty_current_dir = '/www/wwwroot/fuuu.cloud/resources/views/tabler/admin/product';
|
|
$_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);
|
|
?>
|
|
|
|
<div class="page-wrapper">
|
|
<div class="container-xl">
|
|
<div class="page-header d-print-none text-white">
|
|
<div class="row align-items-center">
|
|
<div class="col">
|
|
<h2 class="page-title">
|
|
<span class="home-title">商品列表</span>
|
|
</h2>
|
|
<div class="page-pretitle my-3">
|
|
<span class="home-subtitle">在这里管理商店商品</span>
|
|
</div>
|
|
</div>
|
|
<div class="col-auto ms-auto d-print-none">
|
|
<div class="btn-list">
|
|
<a href="/admin/product/create" class="btn btn-primary">
|
|
<i class="icon ti ti-plus"></i>
|
|
添加
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="page-body">
|
|
<div class="container-xl">
|
|
<div class="row row-deck row-cards">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="table-responsive">
|
|
<table id="data-table" class="table card-table table-vcenter text-nowrap datatable">
|
|
<thead>
|
|
<tr>
|
|
<?php
|
|
$_from = $_smarty_tpl->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;
|
|
?>
|
|
<th><?php echo $_smarty_tpl->getValue('value');?>
|
|
</th>
|
|
<?php
|
|
}
|
|
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php $_smarty_tpl->renderSubTemplate('file:datatable.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
|
|
?>
|
|
|
|
<?php echo '<script'; ?>
|
|
>
|
|
tableConfig.ajax = {
|
|
url: '/admin/product/ajax',
|
|
type: 'POST',
|
|
dataSrc: 'products'
|
|
};
|
|
tableConfig.order = [
|
|
[2, 'asc']
|
|
];
|
|
tableConfig.columnDefs = [
|
|
{
|
|
targets: [0],
|
|
orderable: false
|
|
}
|
|
];
|
|
|
|
let table = new DataTable('#data-table', tableConfig);
|
|
|
|
function loadTable() {
|
|
table;
|
|
}
|
|
|
|
function deleteProduct(product_id) {
|
|
$('#notice-message').text('确定删除此产品?');
|
|
$('#notice-dialog').modal('show');
|
|
$('#notice-confirm').off('click').on('click', function () {
|
|
$.ajax({
|
|
url: "/admin/product/" + product_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 copyProduct(product_id) {
|
|
$('#notice-message').text('确定复制此产品?');
|
|
$('#notice-dialog').modal('show');
|
|
$('#notice-confirm').off('click').on('click', function () {
|
|
$.ajax({
|
|
url: "/admin/product/" + product_id + "/copy",
|
|
type: 'POST',
|
|
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 reloadTableAjax() {
|
|
table.ajax.reload(null, false);
|
|
}
|
|
|
|
loadTable();
|
|
<?php echo '</script'; ?>
|
|
>
|
|
|
|
<?php $_smarty_tpl->renderSubTemplate('file:admin/footer.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
|
|
}
|
|
}
|