Initial commit

This commit is contained in:
Porawit Dongwang
2026-09-16 23:20:08 +07:00
commit 0041668dbb
32577 changed files with 3687927 additions and 0 deletions
@@ -0,0 +1,76 @@
<?php
require_once 'config.php';
include 'header.php';
$statuses = ['รอการยืนยันแผน', 'อยู่ระหว่างดำเนินการ', 'ใบส่งซื้อ/ทำสัญญา', 'ดำเนินการเสร็จสิ้น'];
?>
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="fw-bold"><i class="bi bi-kanban me-2"></i>Kanban Board การจัดซื้อ</h4>
<span class="text-muted"><i class="bi bi-info-circle"></i> ลากวางการ์ดเพื่อเปลี่ยนสถานะแบบ Real-time</span>
</div>
<div class="row g-3">
<?php foreach ($statuses as $st):
$stmt = $pdo->prepare("SELECT * FROM procurement_items WHERE status = ? AND budget_year = ? ORDER BY id DESC LIMIT 20");
$stmt->execute([$st, $active_year]);
$items = $stmt->fetchAll();
?>
<div class="col-md-3">
<div class="kanban-col">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="fw-bold m-0"><?= $st ?></h6>
<span class="badge bg-white text-dark shadow-sm rounded-pill"><?= count($items) ?></span>
</div>
<div class="kanban-list" data-status="<?= $st ?>" style="min-height: 500px;">
<?php foreach ($items as $item): ?>
<div class="kanban-card" data-id="<?= $item['id'] ?>">
<div class="d-flex justify-content-between">
<small class="text-muted">#<?= $item['item_code'] ?? $item['id'] ?></small>
<span class="badge bg-light text-primary border"><?= $item['department'] ?></span>
</div>
<div class="fw-bold my-2"><?= htmlspecialchars($item['item_name']) ?></div>
<div class="text-muted small mb-2">งบประมาณ: <strong>฿<?= number_format($item['total_price'], 2) ?></strong></div>
<div class="progress mb-2" style="height: 6px;">
<div class="progress-bar bg-success" style="width: <?= $item['progress'] ?>%"></div>
</div>
<div class="d-flex justify-content-between align-items-center small">
<span>Progress: <?= $item['progress'] ?>%</span>
<?= getTimelineBadge($item['due_date'], $item['status']) ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.0/Sortable.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
document.querySelectorAll('.kanban-list').forEach(col => {
new Sortable(col, {
group: 'kanban',
animation: 150,
onEnd: function(evt) {
let itemId = evt.item.getAttribute('data-id');
let newStatus = evt.to.getAttribute('data-status');
$.post('update_status.php', {
id: itemId,
status: newStatus
}, function(res) {
if (res.success) {
location.reload();
} else {
alert('เกิดข้อผิดพลาดในการอัปเดต');
}
}, 'json');
}
});
});
</script>
</body>
</html>