mirror of
https://github.com/Sosokker/Inventory-Management-System.git
synced 2025-12-18 23:24:05 +01:00
Add inventorydetail view
This commit is contained in:
parent
921d43c8a1
commit
83f55e8193
@ -47,7 +47,8 @@ class WarehouseDetailView(FilterView, LoginRequiredMixin):
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['warehouse_id'] = self.kwargs.get('id')
|
||||
context['inventory_list'] = Inventory.objects.all()
|
||||
context['warehouse_name'] = Warehouse.objects.get(id=self.kwargs.get('id')).name
|
||||
context['inventory_list'] = Inventory.objects.filter(warehouse__id=self.kwargs.get('id'))
|
||||
return context
|
||||
|
||||
|
||||
@ -56,5 +57,8 @@ class InventoryView(TemplateView, LoginRequiredMixin):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['warehouse_list'] = Warehouse.objects.all()
|
||||
inventory = Inventory.objects.get(id=self.kwargs.get('iid'))
|
||||
context['item_list'] = inventory.item_set.all()
|
||||
context['inventory_name'] = inventory.stock_identifier
|
||||
context['warehouse_name'] = inventory.warehouse.name
|
||||
return context
|
||||
@ -20,13 +20,38 @@
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- Page Heading -->
|
||||
<h1 class="h3 mb-2 text-gray-800">Warehouse Tables</h1>
|
||||
<p class="mb-4">Warehouse Table</p>
|
||||
<h1 class="h3 mb-2 text-gray-800">Inventory : {{ inventory_name }}</h1>
|
||||
<p class="mb-4">Warehouse: {{ warehouse_name }}</p>
|
||||
<!-- Filter -->
|
||||
<div class="card shadow mb-4">
|
||||
<!-- Card Header - Accordion -->
|
||||
<a class="d-block card-header py-3">
|
||||
<h6 class="m-0 font-weight-bold text-primary">Filter</h6>
|
||||
</a>
|
||||
<!-- Card Content - Collapse -->
|
||||
<form method="get">
|
||||
<div class="row g-3 align-items-center mx-2 my-4">
|
||||
{{ filter.form.as_p }}
|
||||
<div class="col-auto">
|
||||
<button type="submit" class="btn btn-primary">Filter</button>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<a href={{ request.path }} class="btn btn-danger">
|
||||
<i class="fas fa-trash"></i> Clear Filter
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- End Filter -->
|
||||
|
||||
<!-- DataTales Example -->
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 font-weight-bold text-primary">Warehouse</h6>
|
||||
<h6 class="m-0 font-weight-bold text-primary">Items</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
@ -34,31 +59,43 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Address</th>
|
||||
<th>Stock Level</th>
|
||||
<th>Number of Inventory</th>
|
||||
<th>Have Freezer</th>
|
||||
<th>Description</th>
|
||||
<th>Quantity</th>
|
||||
<th>Weight</th>
|
||||
<th>Category</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Address</th>
|
||||
<th>Stock Level</th>
|
||||
<th>Number of Inventory</th>
|
||||
<th>Have Freezer</th>
|
||||
<th>Description</th>
|
||||
<th>Quantity</th>
|
||||
<th>Weight</th>
|
||||
<th>Category</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
{% for warehouse in warehouse_list %}
|
||||
<tr>
|
||||
<td>{{ warehouse.name }}</td>
|
||||
<td>{{ warehouse.address }}</td>
|
||||
<td>{{ warehouse.stock_percentage|floatformat:3 }}</td>
|
||||
<td>{{ warehouse.inventory_count }}</td>
|
||||
<td>{{ warehouse.have_freeze }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if filter.is_bound %}
|
||||
{% for item in filter.qs %}
|
||||
<tr>
|
||||
<td>{{ item.name }}</td>
|
||||
<td>{{ item.description }}</td>
|
||||
<td>{{ item.quantity }}</td>
|
||||
<td>{{ item.weight }}</td>
|
||||
<td>{{ item.category }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for item in item_list %}
|
||||
<tr>
|
||||
<td>{{ item.name }}</td>
|
||||
<td>{{ item.description }}</td>
|
||||
<td>{{ item.quantity }}</td>
|
||||
<td>{{ item.weight }}</td>
|
||||
<td>{{ item.category }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- Page Heading -->
|
||||
<h1 class="h3 mb-2 text-gray-800">Warehouse Tables</h1>
|
||||
<p class="mb-4">Warehouse Table</p>
|
||||
<h1 class="h3 mb-2 text-gray-800">{{ warehouse_name }}</h1>
|
||||
<p class="mb-4">Inventory Table</p>
|
||||
<!-- Filter -->
|
||||
<div class="card shadow mb-4">
|
||||
<!-- Card Header - Accordion -->
|
||||
@ -51,7 +51,7 @@
|
||||
<!-- DataTales Example -->
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 font-weight-bold text-primary">Warehouse</h6>
|
||||
<h6 class="m-0 font-weight-bold text-primary">Inventory</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user