| 1 | @model List<StockMaster.Models.PurchaseOrder>
|
|---|
| 2 | @{
|
|---|
| 3 | ViewData["Title"] = "Purchase Orders";
|
|---|
| 4 | }
|
|---|
| 5 |
|
|---|
| 6 | <div class="row mb-4">
|
|---|
| 7 | <div class="col-md-6">
|
|---|
| 8 | <h2><i class="fas fa-truck"></i> Purchase Order Management</h2>
|
|---|
| 9 | </div>
|
|---|
| 10 | <div class="col-md-6 text-end">
|
|---|
| 11 | <a href="/PurchaseOrder/Create" class="btn btn-primary">
|
|---|
| 12 | <i class="fas fa-plus"></i> Create New Order
|
|---|
| 13 | </a>
|
|---|
| 14 | </div>
|
|---|
| 15 | </div>
|
|---|
| 16 |
|
|---|
| 17 | <div class="row mb-4">
|
|---|
| 18 | <div class="col-md-3">
|
|---|
| 19 | <div class="stat-card">
|
|---|
| 20 | <div class="d-flex justify-content-between align-items-center">
|
|---|
| 21 | <div>
|
|---|
| 22 | <p class="text-muted mb-1">Total Orders</p>
|
|---|
| 23 | <h4 class="mb-0">@Model.Count</h4>
|
|---|
| 24 | </div>
|
|---|
| 25 | <div class="stat-icon" style="background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);">
|
|---|
| 26 | <i class="fas fa-file-invoice"></i>
|
|---|
| 27 | </div>
|
|---|
| 28 | </div>
|
|---|
| 29 | </div>
|
|---|
| 30 | </div>
|
|---|
| 31 |
|
|---|
| 32 | <div class="col-md-3">
|
|---|
| 33 | <div class="stat-card">
|
|---|
| 34 | <div class="d-flex justify-content-between align-items-center">
|
|---|
| 35 | <div>
|
|---|
| 36 | <p class="text-muted mb-1">Pending</p>
|
|---|
| 37 | <h4 class="mb-0">@Model.Count(p => p.Status == "Pending")</h4>
|
|---|
| 38 | </div>
|
|---|
| 39 | <div class="stat-icon" style="background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);">
|
|---|
| 40 | <i class="fas fa-clock"></i>
|
|---|
| 41 | </div>
|
|---|
| 42 | </div>
|
|---|
| 43 | </div>
|
|---|
| 44 | </div>
|
|---|
| 45 |
|
|---|
| 46 | <div class="col-md-3">
|
|---|
| 47 | <div class="stat-card">
|
|---|
| 48 | <div class="d-flex justify-content-between align-items-center">
|
|---|
| 49 | <div>
|
|---|
| 50 | <p class="text-muted mb-1">Confirmed</p>
|
|---|
| 51 | <h4 class="mb-0">@Model.Count(p => p.Status == "Confirmed")</h4>
|
|---|
| 52 | </div>
|
|---|
| 53 | <div class="stat-icon" style="background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);">
|
|---|
| 54 | <i class="fas fa-check-circle"></i>
|
|---|
| 55 | </div>
|
|---|
| 56 | </div>
|
|---|
| 57 | </div>
|
|---|
| 58 | </div>
|
|---|
| 59 |
|
|---|
| 60 | <div class="col-md-3">
|
|---|
| 61 | <div class="stat-card">
|
|---|
| 62 | <div class="d-flex justify-content-between align-items-center">
|
|---|
| 63 | <div>
|
|---|
| 64 | <p class="text-muted mb-1">Received</p>
|
|---|
| 65 | <h4 class="mb-0">@Model.Count(p => p.Status == "Received")</h4>
|
|---|
| 66 | </div>
|
|---|
| 67 | <div class="stat-icon" style="background: linear-gradient(135deg, #10b981 0%, #059669 100%);">
|
|---|
| 68 | <i class="fas fa-box-check"></i>
|
|---|
| 69 | </div>
|
|---|
| 70 | </div>
|
|---|
| 71 | </div>
|
|---|
| 72 | </div>
|
|---|
| 73 | </div>
|
|---|
| 74 |
|
|---|
| 75 | <div class="card">
|
|---|
| 76 | <div class="card-header">
|
|---|
| 77 | <i class="fas fa-list"></i> Purchase Order List
|
|---|
| 78 | </div>
|
|---|
| 79 | <div class="card-body">
|
|---|
| 80 | <div class="mb-3">
|
|---|
| 81 | <input type="text" class="form-control" placeholder="Search orders..." id="searchBox">
|
|---|
| 82 | </div>
|
|---|
| 83 |
|
|---|
| 84 | <div class="table-responsive">
|
|---|
| 85 | <table class="table table-hover" id="ordersTable">
|
|---|
| 86 | <thead>
|
|---|
| 87 | <tr>
|
|---|
| 88 | <th>Order No</th>
|
|---|
| 89 | <th>Order Date</th>
|
|---|
| 90 | <th>Supplier</th>
|
|---|
| 91 | <th>Warehouse</th>
|
|---|
| 92 | <th>Expected Delivery</th>
|
|---|
| 93 | <th>Status</th>
|
|---|
| 94 | <th>Actions</th>
|
|---|
| 95 | </tr>
|
|---|
| 96 | </thead>
|
|---|
| 97 | <tbody>
|
|---|
| 98 | @foreach (var po in Model)
|
|---|
| 99 | {
|
|---|
| 100 | <tr>
|
|---|
| 101 | <td>
|
|---|
| 102 | <strong>#PO-@po.PoId</strong>
|
|---|
| 103 | </td>
|
|---|
| 104 | <td>
|
|---|
| 105 | <i class="fas fa-calendar me-1"></i>
|
|---|
| 106 | @po.OrderDate.ToString("dd.MM.yyyy")
|
|---|
| 107 | </td>
|
|---|
| 108 | <td>
|
|---|
| 109 | @if (po.Supplier != null)
|
|---|
| 110 | {
|
|---|
| 111 | <span>
|
|---|
| 112 | <i class="fas fa-building me-1"></i>
|
|---|
| 113 | @po.Supplier.Name
|
|---|
| 114 | </span>
|
|---|
| 115 | }
|
|---|
| 116 | else
|
|---|
| 117 | {
|
|---|
| 118 | <span class="text-muted">-</span>
|
|---|
| 119 | }
|
|---|
| 120 | </td>
|
|---|
| 121 | <td>
|
|---|
| 122 | <i class="fas fa-warehouse me-1"></i>
|
|---|
| 123 | @po.Warehouse.Name
|
|---|
| 124 | </td>
|
|---|
| 125 | <td>
|
|---|
| 126 | @po.ExpectedDeliveryDate.ToString("dd.MM.yyyy")
|
|---|
| 127 | @if (po.ActualDeliveryDate != null)
|
|---|
| 128 | {
|
|---|
| 129 | <br>
|
|---|
| 130 | <small class="text-success">
|
|---|
| 131 | <i class="fas fa-check"></i>
|
|---|
| 132 | Received: @po.ActualDeliveryDate.Value.ToString("dd.MM.yyyy")
|
|---|
| 133 | </small>
|
|---|
| 134 | }
|
|---|
| 135 | </td>
|
|---|
| 136 | <td>
|
|---|
| 137 | @switch (po.Status)
|
|---|
| 138 | {
|
|---|
| 139 | case "Pending":
|
|---|
| 140 | <span class="badge bg-warning">
|
|---|
| 141 | <i class="fas fa-clock"></i> Pending
|
|---|
| 142 | </span>
|
|---|
| 143 | break;
|
|---|
| 144 | case "Confirmed":
|
|---|
| 145 | <span class="badge bg-info">
|
|---|
| 146 | <i class="fas fa-check"></i> Confirmed
|
|---|
| 147 | </span>
|
|---|
| 148 | break;
|
|---|
| 149 | case "Received":
|
|---|
| 150 | <span class="badge bg-success">
|
|---|
| 151 | <i class="fas fa-box-check"></i> Received
|
|---|
| 152 | </span>
|
|---|
| 153 | break;
|
|---|
| 154 | default:
|
|---|
| 155 | <span class="badge bg-secondary">@po.Status</span>
|
|---|
| 156 | break;
|
|---|
| 157 | }
|
|---|
| 158 | </td>
|
|---|
| 159 | <td>
|
|---|
| 160 | <div class="btn-group btn-group-sm">
|
|---|
| 161 | <a href="/PurchaseOrder/Details/@po.PoId" class="btn btn-primary">
|
|---|
| 162 | <i class="fas fa-eye"></i> Details
|
|---|
| 163 | </a>
|
|---|
| 164 | @if (po.Status != "Received")
|
|---|
| 165 | {
|
|---|
| 166 | <form method="post" action="/PurchaseOrder/Receive/@po.PoId" style="display: inline;">
|
|---|
| 167 | @Html.AntiForgeryToken()
|
|---|
| 168 | <button type="submit" class="btn btn-success" onclick="return confirm('Are you sure you want to receive this order?')">
|
|---|
| 169 | <i class="fas fa-check"></i> Receive
|
|---|
| 170 | </button>
|
|---|
| 171 | </form>
|
|---|
| 172 | }
|
|---|
| 173 | </div>
|
|---|
| 174 | </td>
|
|---|
| 175 | </tr>
|
|---|
| 176 | }
|
|---|
| 177 | </tbody>
|
|---|
| 178 | </table>
|
|---|
| 179 | </div>
|
|---|
| 180 |
|
|---|
| 181 | @if (!Model.Any())
|
|---|
| 182 | {
|
|---|
| 183 | <div class="text-center py-5">
|
|---|
| 184 | <i class="fas fa-inbox fa-3x text-muted mb-3"></i>
|
|---|
| 185 | <p class="text-muted">No purchase orders found.</p>
|
|---|
| 186 | <a href="/PurchaseOrder/Create" class="btn btn-primary">
|
|---|
| 187 | <i class="fas fa-plus"></i> Create First Order
|
|---|
| 188 | </a>
|
|---|
| 189 | </div>
|
|---|
| 190 | }
|
|---|
| 191 | </div>
|
|---|
| 192 | </div>
|
|---|
| 193 |
|
|---|
| 194 | @section Scripts {
|
|---|
| 195 | <script>
|
|---|
| 196 | $(document).ready(function() {
|
|---|
| 197 | $('#searchBox').on('keyup', function() {
|
|---|
| 198 | const value = $(this).val().toLowerCase();
|
|---|
| 199 | $('#ordersTable tbody tr').filter(function() {
|
|---|
| 200 | $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
|
|---|
| 201 | });
|
|---|
| 202 | });
|
|---|
| 203 | });
|
|---|
| 204 | </script>
|
|---|
| 205 | } |
|---|