source: StockMaster/Views/Category/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: 2.8 KB
Line 
1@model List<StockMaster.Models.Category>
2@{
3 ViewData["Title"] = "Categories";
4}
5
6<div class="row mb-4">
7 <div class="col-md-6">
8 <h2><i class="fas fa-tag"></i> Category Management</h2>
9 </div>
10 <div class="col-md-6 text-end">
11 <a href="/Category/Create" class="btn btn-primary">
12 <i class="fas fa-plus"></i> Add New Category
13 </a>
14 </div>
15</div>
16
17<div class="card">
18 <div class="card-header">
19 <i class="fas fa-list"></i> Category List
20 </div>
21 <div class="card-body">
22 <div class="table-responsive">
23 <table class="table table-hover">
24 <thead>
25 <tr>
26 <th>ID</th>
27 <th>Name</th>
28 <th>Description</th>
29 <th>Created Date</th>
30 <th>Actions</th>
31 </tr>
32 </thead>
33 <tbody>
34 @foreach (var category in Model)
35 {
36 <tr>
37 <td>@category.CategoryId</td>
38 <td><strong>@category.Name</strong></td>
39 <td>@(category.Description ?? "-")</td>
40 <td>@category.CreatedAt.ToString("dd.MM.yyyy")</td>
41 <td>
42 <div class="btn-group btn-group-sm">
43 <a href="/Category/Edit/@category.CategoryId" class="btn btn-warning">
44 <i class="fas fa-edit"></i>
45 </a>
46 <button onclick="deleteCategory(@category.CategoryId)" class="btn btn-danger">
47 <i class="fas fa-trash"></i>
48 </button>
49 </div>
50 </td>
51 </tr>
52 }
53 </tbody>
54 </table>
55 </div>
56
57 @if (!Model.Any())
58 {
59 <div class="text-center py-5">
60 <i class="fas fa-inbox fa-3x text-muted mb-3"></i>
61 <p class="text-muted">No categories found.</p>
62 <a href="/Category/Create" class="btn btn-primary">
63 <i class="fas fa-plus"></i> Add First Category
64 </a>
65 </div>
66 }
67 </div>
68</div>
69
70@section Scripts {
71 <script>
72 function deleteCategory(id) {
73 if (confirm('Are you sure you want to delete this category?')) {
74 const form = document.createElement('form');
75 form.method = 'POST';
76 form.action = '/Category/Delete/' + id;
77 document.body.appendChild(form);
78 form.submit();
79 }
80 }
81 </script>
82}
Note: See TracBrowser for help on using the repository browser.