|
1 | 1 | <?php |
2 | 2 | include_once 'functions/connection.php'; |
3 | | -if(isset($_GET['id'])){ |
| 3 | +if (isset($_GET['id'])) { |
4 | 4 | $id = $_GET['id']; |
5 | | - |
6 | | - $sql = 'SELECT id, status, queue_number |
7 | | - FROM ( SELECT id, status, ROW_NUMBER() |
8 | | - OVER (ORDER BY status DESC, kilo ASC) AS queue_number |
9 | | - FROM laundry ) AS subquery WHERE id = :id AND status <= 4'; |
10 | | - |
11 | | - $stmt = $db->prepare($sql); |
12 | | - $stmt->execute(['id' => $id]); |
13 | | - $result = $stmt->fetch(); |
14 | | - |
15 | | - $status = $result['status']; |
16 | | - $queue_number = $result['queue_number']; |
17 | | - if($status == 1){ |
18 | | - $status = 20; |
19 | | - }else if($status == 2){ |
20 | | - $status = 50; |
21 | | - }else if($status == 3){ |
22 | | - $status = 80; |
23 | | - }else if($status == 4){ |
24 | | - $status = 100; |
25 | | - $queue_number = "Done!"; |
26 | | - }else{ |
27 | | - $status = 0; |
28 | | - } |
29 | 5 | } else { |
30 | 6 | $queue_number = "Invalid Tracking Number!"; |
31 | 7 | $status = 0; |
32 | 8 | } |
33 | 9 |
|
| 10 | +$sql = 'SELECT l.status, l.id AS laundry_id, l.kilo, p.price, p.name, t.id, t.customer_id, t.total, l.created_at, c.fullname, ROW_NUMBER() OVER (ORDER BY status DESC, kilo ASC) AS queue_number |
| 11 | + FROM laundry AS l |
| 12 | + JOIN prices AS p ON l.type = p.id |
| 13 | + JOIN transactions AS t ON l.transaction_id = t.id |
| 14 | + JOIN customers AS c ON t.customer_id = c.id |
| 15 | + WHERE l.transaction_id = :id'; |
34 | 16 |
|
35 | | - |
| 17 | +$stmt = $db->prepare($sql); |
| 18 | +$stmt->bindParam(':id', $id); |
| 19 | +$stmt->execute(); |
| 20 | +$result = $stmt->fetchAll(); |
36 | 21 | ?> |
37 | 22 | <!DOCTYPE html> |
38 | 23 | <html data-bs-theme="light" lang="en"> |
|
48 | 33 | <link rel="stylesheet" href="assets/css/dataTables.bootstrap5.min.css"> |
49 | 34 | </head> |
50 | 35 |
|
51 | | -<body> |
52 | | - <section class="vh-100" style="background-color: var(--bs-blue);"> |
| 36 | +<body style="background-color: #4e73df;"> |
| 37 | + <section class="" style="background-color: var(--bs-blue);"> |
53 | 38 | <div class="container py-5 h-100"> |
54 | 39 | <div class="row d-flex justify-content-center align-items-center h-100"> |
55 | 40 | <div class="col-12"> |
|
59 | 44 | <div class="col-xl-6"> |
60 | 45 | <div class="d-flex justify-content-between align-items-center mb-5"> |
61 | 46 | <div> |
62 | | - <h2 class="mb-0">Queue <span class="text-primary font-weight-bold">#<?php echo $queue_number; ?></span></h2> |
| 47 | + <a class="text-decoration-none" href="reciept.php?id=8&type=invoice"><h2 class="mb-0"><i class="fas fa-print"></i> Invoice <span class="text-primary font-weight-bold">#<?php echo $id; ?></span></h2></a> |
63 | 48 | </div> |
64 | 49 | </div> |
65 | 50 | </div> |
|
69 | 54 | </div> |
70 | 55 | </div> |
71 | 56 | </div> |
72 | | - <div class="row row-cols-1 row-cols-md-2 row-cols-xl-3 d-xl-flex justify-content-center gutter-y"> |
73 | | - <div class="col"><img src="assets/img/washing-clothes.gif" width="100%"></div> |
74 | | - </div> |
75 | | - <div class="progress d-flex justify-content-between d-flex justify-content-between mx-0 mt-0 mb-5"> |
76 | | - <div class="progress-bar bg-success progress-bar-animated" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $status?>%;"></div> |
77 | | - </div> |
78 | | - <div class="row row-cols-6 row-cols-md-6 row-cols-xl-6 d-xl-flex justify-content-around gutter-y"> |
79 | | - <div class="col"> |
80 | | - <div class="d-lg-flex align-items-center"><i class="fas fa-tshirt fa-2x me-lg-4 mb-3 <?php if ($status >= 20){echo 'text-success';}?>"></i> |
81 | | - <div class="d-none d-lg-block"> |
82 | | - <p class="fw-bold mb-0">Washing</p> |
83 | | - </div> |
| 57 | + <?php |
| 58 | + foreach ($result as $row) { |
| 59 | + |
| 60 | + $status = $row['status']; |
| 61 | + $queue_number = $row['queue_number']; |
| 62 | + if ($status == 1) { |
| 63 | + $status = 20; |
| 64 | + } else if ($status == 2) { |
| 65 | + $status = 50; |
| 66 | + } else if ($status == 3) { |
| 67 | + $status = 80; |
| 68 | + } else if ($status == 4) { |
| 69 | + $status = 100; |
| 70 | + $queue_number = "Done!"; |
| 71 | + } else { |
| 72 | + $status = 0; |
| 73 | + } |
| 74 | + ?> |
| 75 | + <div class="d-flex justify-content-between align-items-center mb-5"> |
| 76 | + <div> |
| 77 | + <h2 class="mb-0">Queue <span class="text-primary font-weight-bold">#<?php echo $queue_number; ?></span></h2> |
| 78 | + <h4 class="mb-0">Type - <span class="text-primary font-weight-bold"><?php echo $row['name']; ?></span></h4> |
| 79 | + <h4 class="mb-0">Load - <span class="text-primary font-weight-bold"><?php echo $row['kilo']; ?>kg</span></h4> |
84 | 80 | </div> |
85 | 81 | </div> |
86 | | - <div class="col"> |
87 | | - <div class="d-lg-flex align-items-center"><i class="fas fa-box-open fa-2x me-lg-4 mb-3 <?php if ($status >= 50){echo 'text-success';}?>"></i> |
88 | | - <div class="d-none d-lg-block"> |
89 | | - <p class="fw-bold mb-0">Folding</p> |
| 82 | + <div class="progress d-flex justify-content-between d-flex justify-content-between mx-0 mt-0 mb-5"> |
| 83 | + <div class="progress-bar bg-success progress-bar-animated" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $status ?>%;"></div> |
| 84 | + </div> |
| 85 | + <div class="row row-cols-6 row-cols-md-6 row-cols-xl-6 d-xl-flex justify-content-around gutter-y"> |
| 86 | + <div class="col"> |
| 87 | + <div class="d-lg-flex align-items-center"><i class="fas fa-tshirt fa-2x me-lg-4 mb-3 <?php if ($status >= 20) { |
| 88 | + echo 'text-success'; |
| 89 | + } ?>"></i> |
| 90 | + <div class="d-none d-lg-block"> |
| 91 | + <p class="fw-bold mb-0">Washing</p> |
| 92 | + </div> |
90 | 93 | </div> |
91 | 94 | </div> |
92 | | - </div> |
93 | | - <div class="col"> |
94 | | - <div class="d-lg-flex align-items-center"><i class="fas fa-box fa-2x me-lg-4 mb-3 <?php if ($status >= 80){echo 'text-success';}?>"></i> |
95 | | - <div class="d-none d-lg-block"> |
96 | | - <p class="fw-bold mb-1">Ready for</p> |
97 | | - <p class="fw-bold mb-0">Pickup</p> |
| 95 | + <div class="col"> |
| 96 | + <div class="d-lg-flex align-items-center"><i class="fas fa-box-open fa-2x me-lg-4 mb-3 <?php if ($status >= 50) { |
| 97 | + echo 'text-success'; |
| 98 | + } ?>"></i> |
| 99 | + <div class="d-none d-lg-block"> |
| 100 | + <p class="fw-bold mb-0">Folding</p> |
| 101 | + </div> |
98 | 102 | </div> |
99 | 103 | </div> |
100 | | - </div> |
101 | | - <div class="col"> |
102 | | - <div class="d-lg-flex align-items-center"><i class="fas fa-check fa-2x me-lg-4 mb-3 <?php if ($status >= 100){echo 'text-success';}?>"></i> |
103 | | - <div class="d-none d-lg-block"> |
104 | | - <p class="fw-bold mb-1">Order</p> |
105 | | - <p class="fw-bold mb-0">Claim</p> |
| 104 | + <div class="col"> |
| 105 | + <div class="d-lg-flex align-items-center"><i class="fas fa-box fa-2x me-lg-4 mb-3 <?php if ($status >= 80) { |
| 106 | + echo 'text-success'; |
| 107 | + } ?>"></i> |
| 108 | + <div class="d-none d-lg-block"> |
| 109 | + <p class="fw-bold mb-1">Ready for</p> |
| 110 | + <p class="fw-bold mb-0">Pickup</p> |
| 111 | + </div> |
| 112 | + </div> |
| 113 | + </div> |
| 114 | + <div class="col"> |
| 115 | + <div class="d-lg-flex align-items-center"><i class="fas fa-check fa-2x me-lg-4 mb-3 <?php if ($status >= 100) { |
| 116 | + echo 'text-success'; |
| 117 | + } ?>"></i> |
| 118 | + <div class="d-none d-lg-block"> |
| 119 | + <p class="fw-bold mb-1">Order</p> |
| 120 | + <p class="fw-bold mb-0">Claim</p> |
| 121 | + </div> |
106 | 122 | </div> |
107 | 123 | </div> |
108 | 124 | </div> |
109 | | - </div> |
110 | | - <div class="d-flex justify-content-between"></div> |
| 125 | + <?php |
| 126 | + } |
| 127 | + ?> |
111 | 128 | </div> |
112 | 129 | </div> |
113 | 130 | </div> |
|
0 commit comments