source: StockMaster/Views/Supplier/Index.cshtml@ dfe03b8

main
Last change on this file since dfe03b8 was dfe03b8, checked in by Ceyda <ceyda.huseini@…>, 3 days ago

Initialize StockMaster project

  • Property mode set to 100644
File size: 3.5 KB
Line 
1@model List<StockMaster.Models.Supplier>
2@{
3 ViewData["Title"] = "Suppliers";
4}
5
6<div class="row mb-4">
7 <div class="col-md-6">
8 <h2><i class="fas fa-truck"></i> Supplier Management</h2>
9 </div>
10 <div class="col-md-6 text-end">
11 <a href="/Supplier/Create" class="btn btn-primary">
12 <i class="fas fa-plus"></i> Add New Supplier
13 </a>
14 </div>
15</div>
16
17<div class="card">
18 <div class="card-header">
19 <i class="fas fa-list"></i> Supplier List
20 </div>
21 <div class="card-body">
22 <div class="mb-3">
23 <input type="text" class="form-control" placeholder="Search suppliers..." id="searchBox">
24 </div>
25
26 <div class="table-responsive">
27 <table class="table table-hover" id="suppliersTable">
28 <thead>
29 <tr>
30 <th>ID</th>
31 <th>Company Name</th>
32 <th>Contact Person</th>
33 <th>Email</th>
34 <th>Phone</th>
35 <th>Address</th>
36 <th>Actions</th>
37 </tr>
38 </thead>
39 <tbody>
40 @foreach (var supplier in Model)
41 {
42 <tr>
43 <td>@supplier.SupplierId</td>
44 <td><strong>@supplier.Name</strong></td>
45 <td>@supplier.ContactPerson</td>
46 <td>@supplier.Email</td>
47 <td>@supplier.Phone</td>
48 <td>@supplier.Address</td>
49 <td>
50 <div class="btn-group btn-group-sm">
51 <a href="/Supplier/Edit/@supplier.SupplierId" class="btn btn-warning">
52 <i class="fas fa-edit"></i>
53 </a>
54 <button onclick="deleteSupplier(@supplier.SupplierId)" class="btn btn-danger">
55 <i class="fas fa-trash"></i>
56 </button>
57 </div>
58 </td>
59 </tr>
60 }
61 </tbody>
62 </table>
63 </div>
64
65 @if (!Model.Any())
66 {
67 <div class="text-center py-5">
68 <i class="fas fa-inbox fa-3x text-muted mb-3"></i>
69 <p class="text-muted">No suppliers found.</p>
70 <a href="/Supplier/Create" class="btn btn-primary">
71 <i class="fas fa-plus"></i> Add First Supplier
72 </a>
73 </div>
74 }
75 </div>
76</div>
77
78@section Scripts {
79 <script>
80 function deleteSupplier(id) {
81 if (confirm('Are you sure you want to delete this supplier?')) {
82 const form = document.createElement('form');
83 form.method = 'POST';
84 form.action = '/Supplier/Delete/' + id;
85 document.body.appendChild(form);
86 form.submit();
87 }
88 }
89
90 $(document).ready(function() {
91 $('#searchBox').on('keyup', function() {
92 const value = $(this).val().toLowerCase();
93 $('#suppliersTable tbody tr').filter(function() {
94 $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
95 });
96 });
97 });
98 </script>
99}
Note: See TracBrowser for help on using the repository browser.