File manager - Edit - /home/webapp69.cm.in.th/u69319090039/Shop39/public/assets/app/Views/orders/detail.php
Back
<div class="container py-4"> <!-- Breadcrumb --> <nav aria-label="breadcrumb" class="mb-4"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="<?= APP_URL ?>" class="text-decoration-none">หน้าแรก</a></li> <li class="breadcrumb-item"><a href="<?= APP_URL ?>/orders" class="text-decoration-none">คำสั่งซื้อของฉัน</a></li> <li class="breadcrumb-item active">#<?= Security::e($order['order_number']) ?></li> </ol> </nav> <div class="card border-0 shadow-sm rounded-3 overflow-hidden mb-4"> <div class="card-header bg-primary text-white p-4 d-flex justify-content-between align-items-center"> <div> <h5 class="fw-bold mb-1">คำสั่งซื้อ #<?= Security::e($order['order_number']) ?></h5> <span class="small opacity-75">สั่งซื้อเมื่อ: <?= date('d/m/Y H:i', strtotime($order['created_at'])) ?></span> </div> <div> <span class="badge bg-light text-primary fs-6 px-3 py-2 rounded-pill"><?= ucfirst($order['status']) ?></span> </div> </div> <div class="card-body p-4"> <div class="row g-4 mb-4"> <div class="col-md-6"> <h6 class="fw-bold text-secondary mb-2">ข้อมูลผู้ขาย</h6> <p class="mb-1 fw-bold text-dark"><i class="bi bi-shop me-2"></i><?= Security::e($order['shop_name']) ?></p> <p class="small text-muted mb-0"><i class="bi bi-telephone me-2"></i><?= Security::e($order['seller_phone']) ?></p> </div> <div class="col-md-6"> <h6 class="fw-bold text-secondary mb-2">ที่อยู่จัดส่ง</h6> <p class="mb-0 small text-dark"><i class="bi bi-geo-alt me-2"></i><?= Security::e($order['shipping_address']) ?></p> </div> </div> <h6 class="fw-bold mb-3">รายการสินค้า & การรีวิว</h6> <div class="table-responsive mb-4"> <table class="table table-bordered align-middle"> <thead class="table-light"> <tr> <th>สินค้า</th> <th>ตัวเลือก</th> <th>ราคา</th> <th>จำนวน</th> <th class="text-end">ราคารวม</th> <th class="text-center" style="width: 220px;">การรีวิวสินค้า</th> </tr> </thead> <tbody> <?php foreach ($items as $item): ?> <?php $imgSrc = !empty($item['primary_image']) ? APP_URL . '/public/' . ltrim(Security::e($item['primary_image']), '/') : APP_URL . '/public/images/no-image.png'; ?> <tr> <td> <div class="d-flex align-items-center gap-3"> <img src="<?= $imgSrc ?>" alt="<?= Security::e($item['title']) ?>" class="rounded-3 border object-fit-cover" style="width: 60px; height: 60px;"> <div> <a href="<?= APP_URL ?>/product/<?= $item['slug'] ?>" class="text-decoration-none fw-bold text-dark hover-primary d-block"><?= Security::e($item['title']) ?></a> <div class="small text-muted">SKU: <?= Security::e($item['sku']) ?></div> </div> </div> </td> <td><span class="badge bg-light text-secondary border"><?= Security::e($item['variant_info']) ?></span></td> <td>฿<?= number_format($item['price'], 2) ?></td> <td><?= $item['quantity'] ?></td> <td class="text-end fw-bold">฿<?= number_format($item['subtotal'], 2) ?></td> <td class="text-center"> <?php if (!empty($item['review'])): ?> <div class="mb-1"> <?php for ($s = 1; $s <= 5; $s++): ?> <i class="bi bi-star-fill <?= $s <= $item['review']['rating'] ? 'text-warning' : 'text-muted opacity-25' ?> small"></i> <?php endfor; ?> <span class="ms-1 small fw-bold text-dark"><?= $item['review']['rating'] ?>/5</span> </div> <span class="badge bg-success-subtle text-success border border-success-subtle rounded-pill mb-2 px-2 py-1 small"> <i class="bi bi-check-circle-fill me-1"></i>รีวิวแล้ว </span> <div> <button type="button" class="btn btn-sm btn-outline-secondary rounded-pill px-3 py-1 btn-open-review" data-order-id="<?= $order['id'] ?>" data-item-id="<?= $item['id'] ?>" data-product-title="<?= Security::e($item['title']) ?>" data-rating="<?= $item['review']['rating'] ?>" data-comment="<?= Security::e($item['review']['comment'] ?? '') ?>"> <i class="bi bi-pencil-square me-1"></i>แก้ไขรีวิว </button> </div> <?php else: ?> <button type="button" class="btn btn-sm btn-warning text-dark rounded-pill px-3 py-1 fw-bold btn-open-review" data-order-id="<?= $order['id'] ?>" data-item-id="<?= $item['id'] ?>" data-product-title="<?= Security::e($item['title']) ?>" data-rating="5" data-comment=""> <i class="bi bi-star me-1"></i>เขียนรีวิว </button> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <div class="d-flex justify-content-between align-items-center pt-3 border-top"> <a href="<?= APP_URL ?>/orders" class="btn btn-outline-secondary rounded-pill px-4">กลับไปรายการคำสั่งซื้อ</a> <h4 class="fw-bold m-0 text-primary">ยอดชำระสุทธิ: ฿<?= number_format($order['total_amount'], 2) ?></h4> </div> </div> </div> </div> <!-- Modal เขียน / แก้ไขรีวิว --> <div class="modal fade" id="reviewModal" tabindex="-1" aria-labelledby="reviewModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content border-0 shadow rounded-4 overflow-hidden"> <form action="<?= APP_URL ?>/orders/review" method="POST" enctype="multipart/form-data"> <input type="hidden" name="csrf_token" value="<?= Session::getCsrfToken() ?>"> <input type="hidden" name="order_id" id="modalOrderId" value=""> <input type="hidden" name="order_item_id" id="modalItemId" value=""> <input type="hidden" name="rating" id="modalRatingInput" value="5"> <div class="modal-header bg-warning text-dark border-0 py-3"> <h5 class="modal-title fw-bold" id="reviewModalLabel"><i class="bi bi-star-fill me-2"></i>ให้คะแนนและรีวิวสินค้า</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body p-4"> <div class="mb-3 text-center"> <h6 class="fw-bold text-secondary mb-1" id="modalProductTitle">ชื่อสินค้า</h6> <p class="small text-muted mb-0">แชร์ประสบการณ์และคะแนนความพึงพอใจของคุณ</p> </div> <!-- Interactive Star Picker --> <div class="mb-4 text-center"> <label class="form-label d-block fw-semibold mb-2">คะแนนคุณภาพสินค้า</label> <div class="star-rating-select d-inline-flex gap-2 fs-2 cursor-pointer" id="starContainer"> <i class="bi bi-star-fill text-warning star-btn" data-value="1"></i> <i class="bi bi-star-fill text-warning star-btn" data-value="2"></i> <i class="bi bi-star-fill text-warning star-btn" data-value="3"></i> <i class="bi bi-star-fill text-warning star-btn" data-value="4"></i> <i class="bi bi-star-fill text-warning star-btn" data-value="5"></i> </div> <div class="small fw-bold text-warning mt-1" id="starLabel">5/5 - ดีมาก</div> </div> <!-- Comment input --> <div class="mb-3"> <label for="reviewComment" class="form-label fw-semibold">ความคิดเห็น / ข้อเสนอแนะ</label> <textarea class="form-control rounded-3" id="reviewComment" name="comment" rows="4" placeholder="เขียนรีวิวสินค้า คุณภาพการใช้งาน การจัดส่ง ฯลฯ..."></textarea> </div> <!-- Photos Upload --> <div class="mb-3"> <label class="form-label fw-semibold">อัปโหลดรูปภาพสินค้า (ไม่เกิน 5 รูป)</label> <input type="file" class="form-control rounded-3" name="images[]" multiple accept="image/*"> <div class="form-text small">รองรับไฟล์ JPG, PNG, WEBP</div> </div> </div> <div class="modal-footer border-0 p-4 pt-0"> <button type="button" class="btn btn-light rounded-pill px-4" data-bs-dismiss="modal">ยกเลิก</button> <button type="submit" class="btn btn-warning text-dark fw-bold rounded-pill px-4">บันทึกรีวิว</button> </div> </form> </div> </div> </div> <script> document.addEventListener('DOMContentLoaded', function () { const reviewModalEl = document.getElementById('reviewModal'); const reviewModal = new bootstrap.Modal(reviewModalEl); const modalOrderId = document.getElementById('modalOrderId'); const modalItemId = document.getElementById('modalItemId'); const modalProductTitle = document.getElementById('modalProductTitle'); const modalRatingInput = document.getElementById('modalRatingInput'); const reviewComment = document.getElementById('reviewComment'); const starBtns = document.querySelectorAll('.star-btn'); const starLabel = document.getElementById('starLabel'); const starTexts = { 1: '1/5 - ปรับปรุง', 2: '2/5 - พอใช้', 3: '3/5 - ปานกลาง', 4: '4/5 - ดี', 5: '5/5 - ดีมาก' }; function updateStars(val) { modalRatingInput.value = val; starLabel.textContent = starTexts[val] || (val + '/5'); starBtns.forEach(btn => { const btnVal = parseInt(btn.getAttribute('data-value')); if (btnVal <= val) { btn.classList.remove('text-muted', 'opacity-25'); btn.classList.add('text-warning'); } else { btn.classList.remove('text-warning'); btn.classList.add('text-muted', 'opacity-25'); } }); } starBtns.forEach(btn => { btn.addEventListener('click', function () { const val = parseInt(this.getAttribute('data-value')); updateStars(val); }); }); document.querySelectorAll('.btn-open-review').forEach(btn => { btn.addEventListener('click', function () { modalOrderId.value = this.getAttribute('data-order-id'); modalItemId.value = this.getAttribute('data-item-id'); modalProductTitle.textContent = this.getAttribute('data-product-title'); reviewComment.value = this.getAttribute('data-comment') || ''; const initialRating = parseInt(this.getAttribute('data-rating')) || 5; updateStars(initialRating); reviewModal.show(); }); }); }); </script>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.23 |
proxy
|
phpinfo
|
Settings