File manager - Edit - /home/webapp69.cm.in.th/u69319090028/Shop/views/admin/policies/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-shield-check text-primary me-2"></i>จัดการนโยบายและข้อกำหนด (Agreements & Policies)</h5> <p class="text-muted small mb-0">ระบบควบคุมเวอร์ชันนโยบาย (Version Control) และตรวจสอบการยอมรับข้อกำหนดของผู้ใช้งาน</p> </div> <a href="<?= url('/admin/policies/create') ?>" class="btn btn-cargoo-primary btn-sm px-3 py-2"> <i class="bi bi-plus-lg me-1"></i> สร้างแบบร่างเวอร์ชันใหม่ </a> </div> <!-- Filter Toolbar --> <div class="p-3 border-bottom bg-light"> <form action="<?= url('/admin/policies') ?>" method="GET" class="row g-2 align-items-center"> <div class="col-md-4"> <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-3 col-sm-6"> <select name="type" class="form-select form-select-sm"> <option value="all">ทุกประเภทนโยบาย</option> <?php foreach ($policyTypes as $k => $label): ?> <option value="<?= e($k) ?>" <?= ($filters['type'] ?? '') === $k ? 'selected' : '' ?>><?= e($k) ?></option> <?php endforeach; ?> </select> </div> <div class="col-md-2 col-sm-6"> <select name="status" class="form-select form-select-sm"> <option value="all">ทุกสถานะ</option> <option value="active" <?= ($filters['status'] ?? '') === 'active' ? 'selected' : '' ?>>เผยแพร่ (Active)</option> <option value="draft" <?= ($filters['status'] ?? '') === 'draft' ? 'selected' : '' ?>>แบบร่าง (Draft)</option> <option value="inactive" <?= ($filters['status'] ?? '') === 'inactive' ? 'selected' : '' ?>>ประวัติเก่า (Inactive)</option> </select> </div> <div class="col-md-3 d-flex gap-2"> <button type="submit" class="btn btn-cargoo-primary btn-sm flex-grow-1">กรอง</button> <a href="<?= url('/admin/policies') ?>" class="btn btn-outline-secondary btn-sm">ล้าง</a> </div> </form> </div> <!-- Policies Table --> <div class="cargoo-card-body p-0"> <?php if (empty($policies)): ?> <div class="text-center py-5"> <i class="bi bi-shield-slash 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">ประเภทนโยบาย</th> <th>ชื่อเอกสาร</th> <th class="text-center">เวอร์ชัน</th> <th>วันที่มีผลบังคับใช้</th> <th class="text-center">ผู้กดยอมรับ</th> <th class="text-center">สถานะ</th> <th class="text-end pe-3" style="width: 200px;">จัดการ</th> </tr> </thead> <tbody> <?php foreach ($policies as $p): ?> <tr> <td class="ps-3 small"> <span class="badge bg-secondary-subtle text-secondary border"> <?= e($p['type']) ?> </span> </td> <td> <h6 class="fw-bold text-dark mb-0 small text-truncate" style="max-width: 260px;"> <?= e($p['title']) ?> </h6> </td> <td class="text-center small"> <code>v<?= e($p['version']) ?></code> </td> <td class="small text-muted"> <?= $p['effective_date'] ? date('d/m/Y H:i', strtotime($p['effective_date'])) : '-' ?> </td> <td class="text-center small"> <a href="<?= url('/admin/policies/' . $p['id'] . '/acceptances') ?>" class="badge bg-info-subtle text-info-emphasis border text-decoration-none" title="ดูบันทึกผู้กดยอมรับ"> <i class="bi bi-people me-1"></i> <?= number_format((int)$p['acceptances_count']) ?> คน </a> </td> <td class="text-center small"> <?php if ($p['status'] === 'active'): ?> <span class="badge bg-success-subtle text-success border border-success-subtle px-2 py-1">Active</span> <?php elseif ($p['status'] === 'draft'): ?> <span class="badge bg-warning-subtle text-warning-emphasis border border-warning-subtle px-2 py-1">Draft</span> <?php else: ?> <span class="badge bg-dark-subtle text-muted border px-2 py-1">Archived</span> <?php endif; ?> </td> <td class="text-end pe-3"> <div class="d-flex justify-content-end gap-1"> <!-- Read on public site --> <a href="<?= url('/policy/' . $p['type'] . '?v=' . urlencode($p['version'])) ?>" target="_blank" class="btn btn-outline-secondary btn-sm" title="ดูเอกสาร"> <i class="bi bi-eye"></i> </a> <?php if ($p['status'] === 'draft'): ?> <!-- Edit Draft --> <a href="<?= url('/admin/policies/' . $p['id'] . '/edit') ?>" class="btn btn-outline-primary btn-sm" title="แก้ไขแบบร่าง"> <i class="bi bi-pencil"></i> </a> <!-- Publish Action --> <form action="<?= url('/admin/policies/' . $p['id'] . '/publish') ?>" method="POST" class="d-inline" onsubmit="return confirm('คุณต้องการเผยแพร่นโยบายเวอร์ชันนี้ใช่หรือไม่? เวอร์ชันเดิมจะถูกย้ายไปที่เก็บประวัติ');"> <?= Security::csrfField() ?> <button type="submit" class="btn btn-outline-success btn-sm" title="เผยแพร่นโยบาย (Publish)"> <i class="bi bi-cloud-arrow-up"></i> </button> </form> <?php endif; ?> <!-- History --> <a href="<?= url('/admin/policies/' . $p['id'] . '/history') ?>" class="btn btn-outline-secondary btn-sm" title="ประวัติการแก้ไข"> <i class="bi bi-clock-history"></i> </a> <?php if ($p['status'] === 'active'): ?> <!-- Create new version shortcut --> <a href="<?= url('/admin/policies/create?type=' . $p['type']) ?>" class="btn btn-outline-primary btn-sm" title="สร้างเวอร์ชันใหม่ต่อจากนี้"> <i class="bi bi-plus-lg"></i> </a> <?php endif; ?> </div> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <!-- Pagination --> <?php if ($pages > 1): ?> <nav aria-label="Policy 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('/admin/policies?' . 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.24 |
proxy
|
phpinfo
|
Settings