File manager - Edit - /home/webapp69.cm.in.th/u69319090028/Shop/views/seller/inventory/index.php
Back
<div class="cargoo-card"> <div class="cargoo-card-header d-flex flex-column flex-sm-row justify-content-between align-items-sm-center gap-3"> <div> <h5 class="mb-1 fw-bold"><i class="bi bi-boxes text-primary me-2"></i>จัดการสต็อกสินค้า (Inventory Management)</h5> <p class="text-muted small mb-0">ตรวจสอบจำนวนสินค้าคงคลัง สินค้าใกล้หมด และปรับปรุงสต็อกแบบรวดเร็ว</p> </div> </div> <!-- Filter Toolbar --> <div class="p-3 border-bottom bg-light"> <form action="<?= url('/seller/inventory') ?>" method="GET" class="row g-2 align-items-center"> <div class="col-md-6"> <div class="input-group input-group-sm"> <span class="input-group-text bg-white"><i class="bi bi-search text-muted"></i></span> <input type="text" name="q" class="form-control" placeholder="ค้นหาชื่อสินค้า..." value="<?= e($filters['q'] ?? '') ?>"> </div> </div> <div class="col-md-4 col-sm-6"> <select name="stock_state" class="form-select form-select-sm"> <option value="all">สถานะสต็อกทั้งหมด</option> <option value="low_stock" <?= ($filters['stock_state'] ?? '') === 'low_stock' ? 'selected' : '' ?>>สินค้าใกล้หมด (คงเหลือ 1-5 ชิ้น)</option> <option value="out_of_stock" <?= ($filters['stock_state'] ?? '') === 'out_of_stock' ? 'selected' : '' ?>>สินค้าหมด (คงเหลือ 0 ชิ้น)</option> </select> </div> <div class="col-md-2 col-sm-6"> <button type="submit" class="btn btn-cargoo-primary btn-sm w-100"><i class="bi bi-funnel me-1"></i> กรอง</button> </div> </form> </div> <!-- Inventory Table --> <div class="cargoo-card-body p-0"> <?php if (empty($products)): ?> <div class="text-center py-5"> <i class="bi bi-boxes text-muted" style="font-size: 3rem;"></i> <h6 class="mt-3 text-dark fw-bold">ไม่พบรายการสินค้าในสต็อก</h6> </div> <?php else: ?> <div class="table-responsive"> <table class="table align-middle mb-0"> <thead class="table-light small"> <tr> <th class="ps-3" style="width: 70px;">รูปภาพ</th> <th>ชื่อสินค้า</th> <th>หมวดหมู่</th> <th class="text-center">สต็อกปัจจุบัน</th> <th>รูปแบบสินค้า (SKUs)</th> <th class="text-end pe-3" style="width: 200px;">ปรับปรุงสต็อก</th> </tr> </thead> <tbody> <?php foreach ($products as $p): ?> <tr> <td class="ps-3"> <div class="rounded-2 overflow-hidden border bg-light d-flex align-items-center justify-content-center" style="width: 50px; height: 50px;"> <?php if (!empty($p['gallery_image']) || !empty($p['main_image'])): ?> <img src="<?= product_image_url($p['gallery_image'] ?? $p['main_image']) ?>" alt="Thumbnail" class="w-100 h-100 object-fit-contain"> <?php else: ?> <i class="bi bi-image text-muted"></i> <?php endif; ?> </div> </td> <td> <h6 class="fw-bold text-dark mb-0 small text-truncate" style="max-width: 250px;"> <?= e($p['name']) ?> </h6> <small class="text-muted">ราคา: ฿<?= number_format((float)$p['price'], 2) ?></small> </td> <td class="small text-muted"> <?= e($p['category_name'] ?? 'ทั่วไป') ?> </td> <td class="text-center"> <?php if ((int)$p['stock'] <= 0): ?> <span class="badge bg-danger">หมด (0)</span> <?php elseif ((int)$p['stock'] <= 5): ?> <span class="badge bg-warning text-dark">ใกล้หมด (<?= (int)$p['stock'] ?>)</span> <?php else: ?> <span class="badge bg-success-subtle text-success border border-success-subtle"><?= (int)$p['stock'] ?> ชิ้น</span> <?php endif; ?> </td> <td class="small"> <?php if (!empty($p['skus'])): ?> <div class="d-flex flex-column gap-1"> <?php foreach ($p['skus'] as $sku): ?> <div class="d-flex align-items-center justify-content-between gap-2 p-1 bg-light rounded border" style="max-width: 240px; font-size: 0.75rem;"> <span class="text-truncate"><strong><?= e($sku['variation_summary']) ?></strong></span> <span class="badge bg-white text-dark border"><?= (int)$sku['stock'] ?> ชิ้น</span> </div> <?php endforeach; ?> </div> <?php else: ?> <span class="text-muted small">- ไม่มีตัวเลือก -</span> <?php endif; ?> </td> <td class="text-end pe-3"> <!-- Quick Stock Update Form --> <form action="<?= url('/seller/inventory/update-stock') ?>" method="POST" class="d-flex align-items-center justify-content-end gap-1 m-0"> <?= Security::csrfField() ?> <input type="hidden" name="product_id" value="<?= (int)$p['id'] ?>"> <input type="number" name="stock" class="form-control form-control-sm text-center fw-bold" value="<?= (int)$p['stock'] ?>" min="0" max="99999" style="width: 80px;" required> <button type="submit" class="btn btn-outline-primary btn-sm px-2" title="บันทึกสต็อก"> <i class="bi bi-check2"></i> </button> </form> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <!-- Pagination --> <?php if ($pages > 1): ?> <nav aria-label="Inventory pagination" class="d-flex justify-content-center p-3 border-top"> <ul class="pagination pagination-sm mb-0"> <?php for ($i = 1; $i <= $pages; $i++): ?> <?php $queryParams = array_merge($filters, ['page' => $i]); $pageUrl = url('/seller/inventory?' . http_build_query($queryParams)); ?> <li class="page-item <?= $i === $page ? 'active' : '' ?>"> <a class="page-link" href="<?= $pageUrl ?>"><?= $i ?></a> </li> <?php endfor; ?> </ul> </nav> <?php endif; ?> <?php endif; ?> </div> </div>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.28 |
proxy
|
phpinfo
|
Settings