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):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['warehouse_id'] = self.kwargs.get('id')
|
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
|
return context
|
||||||
|
|
||||||
|
|
||||||
@ -56,5 +57,8 @@ class InventoryView(TemplateView, LoginRequiredMixin):
|
|||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**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
|
return context
|
||||||
@ -20,13 +20,38 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
||||||
<!-- Page Heading -->
|
<!-- Page Heading -->
|
||||||
<h1 class="h3 mb-2 text-gray-800">Warehouse Tables</h1>
|
<h1 class="h3 mb-2 text-gray-800">Inventory : {{ inventory_name }}</h1>
|
||||||
<p class="mb-4">Warehouse Table</p>
|
<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 -->
|
<!-- DataTales Example -->
|
||||||
<div class="card shadow mb-4">
|
<div class="card shadow mb-4">
|
||||||
<div class="card-header py-3">
|
<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>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
@ -34,31 +59,43 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Address</th>
|
<th>Description</th>
|
||||||
<th>Stock Level</th>
|
<th>Quantity</th>
|
||||||
<th>Number of Inventory</th>
|
<th>Weight</th>
|
||||||
<th>Have Freezer</th>
|
<th>Category</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Address</th>
|
<th>Description</th>
|
||||||
<th>Stock Level</th>
|
<th>Quantity</th>
|
||||||
<th>Number of Inventory</th>
|
<th>Weight</th>
|
||||||
<th>Have Freezer</th>
|
<th>Category</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for warehouse in warehouse_list %}
|
{% if filter.is_bound %}
|
||||||
<tr>
|
{% for item in filter.qs %}
|
||||||
<td>{{ warehouse.name }}</td>
|
<tr>
|
||||||
<td>{{ warehouse.address }}</td>
|
<td>{{ item.name }}</td>
|
||||||
<td>{{ warehouse.stock_percentage|floatformat:3 }}</td>
|
<td>{{ item.description }}</td>
|
||||||
<td>{{ warehouse.inventory_count }}</td>
|
<td>{{ item.quantity }}</td>
|
||||||
<td>{{ warehouse.have_freeze }}</td>
|
<td>{{ item.weight }}</td>
|
||||||
</tr>
|
<td>{{ item.category }}</td>
|
||||||
{% endfor %}
|
</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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -20,8 +20,8 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
||||||
<!-- Page Heading -->
|
<!-- Page Heading -->
|
||||||
<h1 class="h3 mb-2 text-gray-800">Warehouse Tables</h1>
|
<h1 class="h3 mb-2 text-gray-800">{{ warehouse_name }}</h1>
|
||||||
<p class="mb-4">Warehouse Table</p>
|
<p class="mb-4">Inventory Table</p>
|
||||||
<!-- Filter -->
|
<!-- Filter -->
|
||||||
<div class="card shadow mb-4">
|
<div class="card shadow mb-4">
|
||||||
<!-- Card Header - Accordion -->
|
<!-- Card Header - Accordion -->
|
||||||
@ -51,7 +51,7 @@
|
|||||||
<!-- DataTales Example -->
|
<!-- DataTales Example -->
|
||||||
<div class="card shadow mb-4">
|
<div class="card shadow mb-4">
|
||||||
<div class="card-header py-3">
|
<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>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user