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.
142 lines
4.0 KiB
142 lines
4.0 KiB
<!doctype html>
|
|
<html lang="en">
|
|
|
|
<!-- 主頁header -->
|
|
<?php
|
|
/*--- 處理session ----*/
|
|
include "include-session-security.php"; #確認session
|
|
/*
|
|
if(isset($_SESSION['user_id'])){
|
|
#echo $_SESSION['user_id'];
|
|
$userid = $_SESSION['user_id'];
|
|
}
|
|
*/
|
|
/*--- 處理session ----*/
|
|
|
|
include "include-header.php";
|
|
|
|
#$userid = "B000000001";
|
|
#$repairerid = $user_id;
|
|
|
|
require_once "db/database.php"; # 載入db.php來連結資料庫
|
|
$data = array(); # 設置一個空陣列來放資料is
|
|
#$sql = "SELECT category, equipment_name, picture, count(*) as count FROM equipment GROUP BY equipment_name"; # sql語法存在變數中,會出現ERROR 1055
|
|
$sql = "SELECT category, equipment_name, picture, COUNT(*) as count FROM equipment GROUP BY category, equipment_name, picture";
|
|
$data = mysqli_query($link, $sql); # 用mysqli_query方法執行(sql語法)將結果存在變數中
|
|
|
|
|
|
/*
|
|
foreach($data as $data){
|
|
echo $data['repairerid'] . "<br>";
|
|
}
|
|
*/
|
|
|
|
|
|
?>
|
|
<!-- * 主頁header -->
|
|
|
|
<body>
|
|
|
|
<!-- loader -->
|
|
<div id="loader">
|
|
<div class="spinner-border text-primary" role="status"></div>
|
|
</div>
|
|
<!-- * loader -->
|
|
|
|
<!-- App Header -->
|
|
<div class="appHeader bg-primary text-light">
|
|
<!--
|
|
<div class="left">
|
|
<a href="javascript:;" class="headerButton goBack">
|
|
<ion-icon name="chevron-back-outline"></ion-icon>
|
|
</a>
|
|
</div>
|
|
-->
|
|
<!-- <div class="right">
|
|
<a href="app-productscart.php?token=<?php echo $token; ?>" class="headerButton">
|
|
<ion-icon name="cart-outline"></ion-icon>
|
|
</a>
|
|
</div> -->
|
|
<div class="pageTitle">配件總類</div>
|
|
<!--
|
|
<div class="right">
|
|
</div>
|
|
-->
|
|
</div>
|
|
|
|
<!-- * App Header -->
|
|
|
|
<!-- App Capsule -->
|
|
<div id="appCapsule">
|
|
<ul class="listview bm-2" style="border: none;">
|
|
<li id="123">
|
|
<div class="mb-1" style="float: right;">
|
|
<input class="bi bi-search" oninput="search(event)">
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
|
|
<!-- Media Multi Listview -->
|
|
<ul class="listview image-listview media mb-2">
|
|
|
|
<?php foreach ($data as $data) { ?>
|
|
<li id=<?=$data['equipment_name']?> style="display:flex;">
|
|
<a href="app-productsdetail.php?category=<?php echo $data['category']; ?>&token=<?php echo $token; ?>" class="item">
|
|
<div class="imageWrapper" style="height: 80px;">
|
|
<img src="../wms/<?php echo $data['picture']; ?>" alt="image" class="imaged w64" style="height:100% ;width:max-content">
|
|
</div>
|
|
<div class="in">
|
|
<div><?php echo $data['equipment_name']; ?></div>
|
|
<span class="badge badge-primary"><?php echo $data['count']; ?></span>
|
|
</div>
|
|
</a>
|
|
</li>
|
|
<?php } ?>
|
|
|
|
</ul>
|
|
<!-- * Simple Multi Listview -->
|
|
|
|
</div>
|
|
<!-- * App Capsule -->
|
|
|
|
<!-- 主頁頁尾 -->
|
|
<?php
|
|
include "include-footer.php";
|
|
mysqli_close($link); #代表結束連線
|
|
?>
|
|
<!-- * 主頁頁尾 -->
|
|
|
|
|
|
<!-- 主頁頁尾按鈕 -->
|
|
<?php
|
|
#include "include-bottom-menu.php";
|
|
?>
|
|
<!-- * 主頁頁尾按鈕 -->
|
|
|
|
|
|
<!-- ///////////// Js Files //////////////////// -->
|
|
<!-- Jquery -->
|
|
<?php
|
|
include "include-jsfiles.php";
|
|
?>
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
<script>
|
|
function search(event) {
|
|
var product = event.target.value;
|
|
var content = document.getElementsByTagName("li");
|
|
if (content){
|
|
for (var i = 0; i < content.length; i++) {
|
|
console.log(content[i].id);
|
|
if(content[i].id.search(product)===0 || content[i].id==="123"){
|
|
content[i].style['display']="";
|
|
}else{
|
|
content[i].style['display']='none';
|
|
}
|
|
|
|
}
|
|
}}
|
|
</script>
|