File manager - Edit - /var/www/order.cmtc.ac.th/admin/orders_self_table.php
Back
<?php include('../config/db.php'); $res_self = $conn->query(" SELECT o.*, GROUP_CONCAT(CONCAT(p.name,' x',i.qty) SEPARATOR ', ') AS items FROM orders o JOIN order_items i ON o.id=i.order_id JOIN products p ON i.product_id=p.id WHERE o.receive_method='รับสินค้าด้วยตนเอง' GROUP BY o.id ORDER BY o.id DESC "); ?> <!-- ✅ กล่องค้นหา --> <div class="mb-2"> <input type="text" id="searchSelf" class="form-control" placeholder="🔍 ค้นหาชื่อหรือเบอร์โทรผู้จอง..."> </div> <table class="table table-bordered bg-white shadow-sm align-middle" id="selfTable"> <thead class="table-success"> <tr> <th>เลขที่ใบจอง</th> <th>ชื่อผู้จอง</th> <th>เบอร์โทร</th> <th>รายการพระ</th> <th>ยอดรวม</th> <th>สถานะ</th> <th>สลิป</th> <th>จัดการ</th> <th>พิมพ์</th> </tr> </thead> <tbody> <?php if($res_self->num_rows > 0): ?> <?php while($row = $res_self->fetch_assoc()): ?> <tr> <td><?=$row['booking_no']?></td> <td><?=$row['fullname']?></td> <td><?=$row['phone']?></td> <td><?=$row['items']?></td> <td><?=number_format($row['total'],2)?></td> <td> <?php if(strpos($row['status'], 'Free Order') !== false): ?> <span class="text-warning fw-bold">🟡 <?= $row['status'] ?></span> <?php else: ?> <span class="text-primary fw-bold"><?= $row['status'] ?></span> <?php endif; ?> </td> <td> <?php if(!empty($row['slip'])): ?> <a href="#" class="view-slip" data-img="../uploads/slip/<?=$row['slip']?>" data-id="<?=$row['id']?>" data-name="<?=htmlspecialchars($row['fullname'])?>" data-total="<?=number_format($row['total'],2)?>" data-status="<?=htmlspecialchars($row['status'])?>">ดู</a> <?php else: ?><span class="text-muted">-</span><?php endif; ?> </td> <td> <?php if($row['status'] == 'ชำระเงินแล้ว' || strpos($row['status'],'ยืนยัน')!==false || !empty($row['booking_no'])): ?> <button class="btn btn-secondary btn-sm mb-1" disabled>✔️ ยืนยันแล้ว</button> <?php else: ?> <a href="?confirm=<?=$row['id']?>" class="btn btn-success btn-sm mb-1" onclick="return confirm('ยืนยันการชำระเงินใบจองนี้หรือไม่?');">ยืนยัน</a> <?php endif; ?> <div class="dropdown d-inline"> <button class="btn btn-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown">เปลี่ยนสถานะ</button> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="?id=<?=$row['id']?>&status=ชำระเงินแล้ว">ชำระเงินแล้ว</a></li> <li><a class="dropdown-item" href="?id=<?=$row['id']?>&status=มารับเหรียญได้ที่วิทยาลัยฯ">มารับเหรียญได้ที่วิทยาลัยฯ</a></li> <li><a class="dropdown-item" href="?id=<?=$row['id']?>&status=รับเหรียญเรียบร้อยแล้ว">รับเหรียญเรียบร้อยแล้ว</a></li> <li><a class="dropdown-item text-danger" href="?id=<?=$row['id']?>&status=ไม่ถูกต้อง / ยกเลิก">ไม่ถูกต้อง / ยกเลิก</a></li> </ul> </div> </td> <td><a href="print_invoice.php?id=<?=$row['id']?>" target="_blank" class="btn btn-outline-primary btn-sm">🖨 พิมพ์</a></td> </tr> <?php endwhile; ?> <?php else: ?> <tr><td colspan="9" class="text-center text-muted">ไม่มีรายการรับสินค้าด้วยตนเอง</td></tr> <?php endif; ?> </tbody> </table> <!-- ✅ Script ค้นหาแบบสด --> <script> document.getElementById('searchSelf').addEventListener('keyup', function(){ const keyword = this.value.toLowerCase(); document.querySelectorAll('#selfTable tbody tr').forEach(row => { const text = row.innerText.toLowerCase(); row.style.display = text.includes(keyword) ? '' : 'none'; }); }); </script>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.48 |
proxy
|
phpinfo
|
Settings