You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

110 lines
6.1 KiB

<?php
include '../header.php';
require_once './conn.php';
$kind = $_GET['kind'];
$sql_str = "SELECT * FROM option_price WHERE kind = :kind AND status ='Y'";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':kind', $kind);
$stmt->execute();
$options = $stmt->fetchAll(PDO::FETCH_ASSOC);
$optional_arr = [1=>'標', 2=>'選'];
?>
<link rel="stylesheet" href="./css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="../contract/semantic/dist/semantic.min.css">
<script defer src="../contract/js/alpinejs/cdn.min.js"></script>
<script src="../contract/js/axios/axios.min.js"></script>
<div class="price_option-index" x-data="priceOptionIndex">
<div class="sidebar">
<a href="./price_option-select.php?<?php echo $token_link; ?> ">全部顯示</a>
<a <?php if($kind == 'A'){echo 'class="active"';} ?> href="./price_option-index.php?kind=A&<?php echo $token_link; ?>">A-1車廂意匠</a>
<a <?php if($kind == 'B'){echo 'class="active"';} ?> href="./price_option-index.php?kind=B&<?php echo $token_link; ?>">A-2車廂內裝</a>
<a <?php if($kind == 'C'){echo 'class="active"';} ?> href="./price_option-index.php?kind=C&<?php echo $token_link; ?>">A-3車廂外部</a>
<a <?php if($kind == 'D'){echo 'class="active"';} ?> href="./price_option-index.php?kind=D&<?php echo $token_link; ?>">A-4控制與其他</a>
<a <?php if($kind == 'E'){echo 'class="active"';} ?> href="./price_option-index.php?kind=E&<?php echo $token_link; ?>">B-1平台梯</a>
<a <?php if($kind == 'F'){echo 'class="active"';} ?> href="./price_option-index.php?kind=F&<?php echo $token_link; ?>">C-1汰改</a>
</div>
<div class="options">
<div class="container"><h2>OPTION價格查詢</h2></div>
<div id="exTab1" class="container">
<div class="toolbar">
<label for="">
顯示
<select x-model="pageLength" @change="changeType()">
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="999999">顯示全部</option>
</select>
</label>
<label for="">
<template x-for="btn in buttons">
<button style="margin-right:4px" :class="['btn', (btn.type == btntype) ? 'btn-primary' : 'btn-secondary text-light']" x-text="btn.name" @click="changeType(btn.type)"></button>
</template>
</label>
<label for="">
搜尋
<input type="text" @keyup="inputSearch($event)" />
</label>
</div>
<table id="table_index2" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr class="kind-col">
<th scope="col" nowrap>名稱</th>
<th scope="col" nowrap>規格</th>
<th scope="col" nowrap>備註</th>
<th scope="col" nowrap>配置</th>
<th scope="col" nowrap>單位</th>
<th scope="col" nowrap>定價</th>
</tr>
</thead>
<tbody>
<template x-if="options.length <= 0">
<tr>
<td colspan="6"><p style="font-size:13px;color:#a00">沒有符合的結果。</p></td>
</tr>
</template>
<template x-for="option in options">
<tr>
<td x-text="option.group_name"></td>
<td x-text="option.spec"></td>
<td x-text="option.memo"></td>
<td x-text="options_arr[option.optional]"></td>
<td x-text="option.unit"></td>
<td x-html="option.price!=null ? Number(option.price).toLocaleString() : ''"></td>
</tr>
</template>
</table>
<div class="pagination">
<small x-text="'顯示第'+((Number(currentpage)-1)*Number(pageLength)+1)+' 至 '+((((Number(currentpage)-1)*Number(pageLength) +Number(pageLength))< dataLangth) ? ((Number(currentpage)-1)*Number(pageLength) +Number(pageLength)) : dataLangth )+' 項結果,共 '+dataLangth+' 項'"></small>
<div class="links">
<template x-if="currentpage>1">
<a href="###" @click="switchPage(currentpage-1)">&laquo;</a>
</template>
<template x-if="pageNumber <= 10">
<template x-for="page in pageNumber">
<a href="javascript:;" @click="switchPage(page)" :class="[(page == currentpage) ? 'active' : '']" x-text="page" ></a>
</template>
</template>
<template x-if="pageNumber > 10">
<select @change="selectPage($event)" style="width:66px;padding:8px 2px" x-model="currentpage">
<template x-for="page in pageNumber">
<option :value="page" x-text="page"></option>
</template>
</select>
</template>
<template x-if="currentpage<pageNumber">
<a href="###" @click="switchPage(currentpage+1)">&raquo;</a>
</template>
</div>
</div>
</div>
</div>
</div>
<script src="./assets/js/alpine.js"></script>
<script>
const options = [...<?php echo json_encode($options); ?>];
const kind = '<?php echo $kind; ?>';
</script>