網站程式設計-PHP
{* 商品管理 列表 *}
{if $WEB.file_name == "prod.php" and $op == "op_list"}
{literal}
<link rel="stylesheet" href="../class/sweet-alert/sweet-alert.css" type="text/css" />
<script src="../class/sweet-alert/sweet-alert.js" type="text/javascript"></script>
<script type="text/javascript">
function op_delete_js(sn){
swal({
title: '確定要刪除此資料?',
text: '相關資料通通都將會被移除!',
type: 'warning',
showCancelButton: 1,
confirmButtonColor: '#DD6B55',
confirmButtonText: '確定刪除!',
closeOnConfirm: false ,
allowOutsideClick: true
},
function(){
location.href='prod.php?op=op_delete&sn=' + sn;
});
}
</script>
{/literal}
<div class="container" style="margin-top:20px;">
<h2 class="text-center">商品管理</h2>
<table class="table table-bordered table-hover list-table">
<thead>
<tr class="active">
<th class="text-center col-md-1">縮圖</th>
<th class="text-center col-md-1">日期</th>
<th class="text-center col-md-3">標題</th>
<th class="text-center col-md-2">價格</th>
<th class="text-center col-md-1">排序</th>
<th class="text-center col-md-1">人氣</th>
<th class="text-center col-md-1">啟用</th>
<th class="text-center col-md-2">
<button onclick="window.location.href='?op=op_form'" type="button" class="btn btn-primary btn-xs">新增</button>
</th>
</tr>
</thead>
<tbody>
{foreach from=$rows item=row}
<tr>
<td>{if $row.file_name} <img src="{$row.file_name}" class="img-responsive">{/if}</td>
<td>{$row.date}</td>
<td>{$row.title}</td>
<td class="text-right">{$row.price}</td>
<td class="text-center">{$row.sort}</td>
<td class="text-center">{$row.counter}</td>
<td class="text-center">{$row.enable}</td>
<td class="text-center">
<button onclick="window.location.href='?op=op_show&sn={$row.sn}'" type="button" class="btn btn-warning btn-xs">瀏覽</button>
<button onclick="window.location.href='?op=op_form&sn={$row.sn}'" type="button" class="btn btn-success btn-xs">編輯</button>
<button onclick="javascript:op_delete_js({$row.sn});" type="button" class="btn btn-danger btn-xs">刪除</button>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/if}