File manager - Edit - /home/webapp69.cm.in.th/u69319090039/Shop39/app/Views/admin/orders/index.php
Back
<div class="d-flex justify-content-between align-items-center mb-4 flex-wrap gap-2"> <div> <h4 class="fw-bold m-0"><i class="bi bi-receipt-cutoff text-danger me-2"></i>จัดการคำสั่งซื้อและการเงิน (Admin Orders & Finance)</h4> <p class="text-muted small mb-0">ตรวจสอบคำสั่งซื้อทั้งหมดในแพลตฟอร์ม ยอดชำระเงินต้นทาง และยอดเรียกเก็บเงินปลายทาง (COD)</p> </div> </div> <!-- Financial Summary Cards --> <div class="row g-3 mb-4"> <div class="col-md-3"> <div class="card border-0 shadow-sm rounded-4 p-3 bg-success text-white"> <div class="d-flex justify-content-between align-items-center"> <div> <div class="text-white-50 small fw-bold">ยอดเงินที่ชำระแล้วทั้งหมด</div> <div class="fs-4 fw-bold mt-1">฿<?= number_format($totalCollected, 2) ?></div> </div> <div class="fs-1 opacity-50"><i class="bi bi-cash-stack"></i></div> </div> <div class="small mt-2 text-white-50"><i class="bi bi-check-circle me-1"></i>Prepaid & COD ที่เก็บเงินแล้ว</div> </div> </div> <div class="col-md-3"> <div class="card border-0 shadow-sm rounded-4 p-3 bg-warning text-dark"> <div class="d-flex justify-content-between align-items-center"> <div> <div class="text-dark-50 small fw-bold">ยอด COD ที่รอเรียกเก็บ</div> <div class="fs-4 fw-bold mt-1 text-danger">฿<?= number_format($totalCodPending, 2) ?></div> </div> <div class="fs-1 opacity-50"><i class="bi bi-truck"></i></div> </div> <div class="small mt-2 text-dark-50"><i class="bi bi-hourglass-split me-1"></i>รอพนักงานขนส่งส่งมอบเงิน</div> </div> </div> <div class="col-md-3"> <div class="card border-0 shadow-sm rounded-4 p-3 bg-primary text-white"> <div class="d-flex justify-content-between align-items-center"> <div> <div class="text-white-50 small fw-bold">ออเดอร์ชำระต้นทาง (Prepaid)</div> <div class="fs-4 fw-bold mt-1"><?= number_format($totalPrepaidCount) ?> รายการ</div> </div> <div class="fs-1 opacity-50"><i class="bi bi-credit-card"></i></div> </div> <div class="small mt-2 text-white-50">ชำระผ่าน PromptPay / QR Code</div> </div> </div> <div class="col-md-3"> <div class="card border-0 shadow-sm rounded-4 p-3 bg-dark text-white"> <div class="d-flex justify-content-between align-items-center"> <div> <div class="text-white-50 small fw-bold">ออเดอร์เก็บปลายทาง (COD)</div> <div class="fs-4 fw-bold mt-1"><?= number_format($totalCodCount) ?> รายการ</div> </div> <div class="fs-1 opacity-50"><i class="bi bi-box-seam"></i></div> </div> <div class="small mt-2 text-white-50">Cash on Delivery Orders</div> </div> </div> </div> <!-- Search & Filter Card --> <div class="card border-0 shadow-sm rounded-4 mb-4"> <div class="card-body p-4"> <form method="GET" action="<?= APP_URL ?>/admin/orders" class="row g-3"> <div class="col-md-4"> <label class="form-label small fw-bold text-muted">ค้นหาคำสั่งซื้อ</label> <div class="input-group"> <span class="input-group-text bg-light border-end-0"><i class="bi bi-search text-muted"></i></span> <input type="text" name="q" class="form-control border-start-0 bg-light" placeholder="เลขที่ออเดอร์ / ลูกค้า / ร้านค้า / Tracking..." value="<?= Security::e($search) ?>"> </div> </div> <div class="col-md-3"> <label class="form-label small fw-bold text-muted">วิธีชำระเงิน (Payment Method)</label> <select name="payment_method" class="form-select bg-light"> <option value="">ทั้งหมด (All Methods)</option> <option value="prepaid" <?= $paymentMethodFilter === 'prepaid' ? 'selected' : '' ?>>💳 ชำระเงินต้นทาง (Prepaid)</option> <option value="cod" <?= $paymentMethodFilter === 'cod' ? 'selected' : '' ?>>🚚 เก็บเงินปลายทาง (COD)</option> </select> </div> <div class="col-md-3"> <label class="form-label small fw-bold text-muted">สถานะการเงิน (Payment Status)</label> <select name="payment_status" class="form-select bg-light"> <option value="">ทุกสถานะการเงิน</option> <option value="paid" <?= $paymentStatusFilter === 'paid' ? 'selected' : '' ?>>✅ ชำระแล้ว / เก็บเงินแล้ว (Paid)</option> <option value="pending" <?= $paymentStatusFilter === 'pending' ? 'selected' : '' ?>>⏳ รอชำระ / รอเก็บเงิน (Pending)</option> </select> </div> <div class="col-md-2 d-flex align-items-end gap-2"> <button type="submit" class="btn btn-primary rounded-pill px-4 flex-grow-1 fw-bold"> <i class="bi bi-funnel me-1"></i>กรอง </button> <a href="<?= APP_URL ?>/admin/orders" class="btn btn-outline-secondary rounded-circle" title="รีเซ็ต"> <i class="bi bi-arrow-counterclockwise"></i> </a> </div> </form> </div> </div> <!-- Orders Table Card --> <div class="card border-0 shadow-sm rounded-4 overflow-hidden"> <div class="card-body p-0"> <?php if (empty($orders)): ?> <div class="text-center py-5"> <i class="bi bi-receipt text-muted display-4"></i> <h5 class="mt-3 text-secondary">ไม่พบรายการคำสั่งซื้อ</h5> <p class="small text-muted mb-0">ลองปรับเปลี่ยนตัวกรอง หรือค้นหาด้วยคำใหม่อีกครั้ง</p> </div> <?php else: ?> <div class="table-responsive"> <table class="table table-hover align-middle mb-0"> <thead class="table-light"> <tr> <th class="ps-4">หมายเลขออเดอร์</th> <th>ร้านค้า</th> <th>ลูกค้า & เบอร์ติดต่อ</th> <th>ยอดรวมคำสั่งซื้อ</th> <th>วิธีชำระเงิน</th> <th>สถานะการเงิน</th> <th>สถานะพัสดุ</th> <th>วันเวลาชำระเงิน</th> <th class="text-end pe-4">การจัดการ</th> </tr> </thead> <tbody> <?php foreach ($orders as $ord): ?> <?php $isCod = ($ord['payment_method'] ?? 'prepaid') === 'cod'; $isPaid = ($ord['payment_status'] ?? '') === 'paid'; ?> <tr> <td class="ps-4"> <span class="fw-bold text-primary">#<?= Security::e($ord['order_number']) ?></span> <div class="small text-muted"><?= date('d/m/Y H:i', strtotime($ord['created_at'])) ?></div> </td> <td> <span class="badge bg-light text-dark border"><i class="bi bi-shop me-1 text-primary"></i><?= Security::e($ord['shop_name']) ?></span> </td> <td> <div class="fw-bold"><?= Security::e($ord['customer_name']) ?></div> <div class="small text-muted"><i class="bi bi-telephone me-1"></i><?= Security::e($ord['customer_phone'] ?? '-') ?></div> </td> <td> <div class="fw-bold text-dark fs-6">฿<?= number_format($ord['total_amount'], 2) ?></div> <?php if ($isCod && !$isPaid): ?> <div class="small text-danger fw-bold">ยอด COD: ฿<?= number_format($ord['total_amount'], 2) ?></div> <?php endif; ?> </td> <td> <?php if ($isCod): ?> <span class="badge bg-warning text-dark border border-warning px-2 py-1 rounded-pill"> <i class="bi bi-cash me-1"></i>เก็บเงินปลายทาง (COD) </span> <?php else: ?> <span class="badge bg-info-subtle text-primary border border-primary-subtle px-2 py-1 rounded-pill"> <i class="bi bi-credit-card me-1"></i>ชำระต้นทาง (Prepaid) </span> <?php endif; ?> </td> <td> <?php if ($isPaid): ?> <span class="badge bg-success px-2 py-1 rounded-pill"> <i class="bi bi-check-circle-fill me-1"></i>ชำระแล้ว </span> <?php else: ?> <span class="badge bg-warning-subtle text-warning-emphasis border border-warning px-2 py-1 rounded-pill"> <i class="bi bi-hourglass-split me-1"></i>รอเก็บเงิน </span> <?php endif; ?> </td> <td> <span class="badge bg-secondary-subtle text-dark border px-2 py-1 rounded-pill small"> <?= ucfirst(Security::e($ord['status'])) ?> </span> </td> <td class="small text-muted"> <?php if (!empty($ord['paid_at'])): ?> <div class="text-success fw-bold"><i class="bi bi-clock-history me-1"></i><?= date('d/m/Y H:i', strtotime($ord['paid_at'])) ?></div> <?php else: ?> <span class="text-muted">-</span> <?php endif; ?> </td> <td class="text-end pe-4"> <?php if ($isCod && !$isPaid): ?> <form action="<?= APP_URL ?>/admin/orders/update-payment/<?= $ord['id'] ?>" method="POST" class="d-inline" onsubmit="return confirm('ยืนยันว่าเก็บเงินปลายทางสำเร็จแล้วจำนวน ฿<?= number_format($ord['total_amount'], 2) ?> ใช่หรือไม่?');"> <input type="hidden" name="csrf_token" value="<?= Session::getCsrfToken() ?>"> <input type="hidden" name="payment_status" value="paid"> <button type="submit" class="btn btn-sm btn-success rounded-pill px-3 fw-bold shadow-sm" title="บันทึกว่าเก็บเงินปลายทางแล้ว"> <i class="bi bi-cash-coin me-1"></i>เก็บเงินแล้ว </button> </form> <?php else: ?> <span class="badge bg-light text-muted border">เรียบร้อย</span> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <div class="p-3 text-muted small border-top bg-light"> แสดงผลทั้งหมด <?= count($orders) ?> รายการ </div> <?php endif; ?> </div> </div>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.23 |
proxy
|
phpinfo
|
Settings