Skip to content

Commit

Permalink
index update
Browse files Browse the repository at this point in the history
  • Loading branch information
ixnur committed Aug 17, 2023
1 parent d4e7b9b commit 00f7e50
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
37 changes: 36 additions & 1 deletion envanter/envanter/teplates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,38 @@
</style>
</head>
<body>
<h1>envanter yönetimi</h1>

<!-- Component Search Form -->
<form method="GET" action="">
<label for="search-model">Search Component Model:</label>
<input type="text" id="search-model" name="search_model">
<button type="submit">Search</button>
</form>

<!-- Component List Table -->
<table border="1">
<tr>
<th>Model</th>
<th>Açıklama</th>
<th>Üretici</th>
<th>Kategori</th>
<th>Paket</th>
<th>Konum</th>
<th>Stok</th>
</tr>
{% for component in components %}
<tr>
<td>{{ component.model }}</td>
<td>{{ component.description }}</td>
<td>{{ component.manufacturer }}</td>
<td>{{ component.category }}</td>
<td>{{ component.package }}</td>
<td>{{ component.location }}</td>
<td>{{ component.stock }}</td>
</tr>
{% endfor %}
</table>
<h1>Envanter</h1>
<div class="container">
<h2>Kategoriler</h2>
Expand All @@ -91,7 +123,10 @@ <h2>Yeni Parça Ekle</h2>
<form action="/parca_ekle" method="post">
<label for="model">Model:</label>
<input type="text" id="model" name="model" required><br>

<input type="text" id="manufacturer" name="üretici" required><br>
<input type="text" id="category" name="kategori" required><br>
<input type="text" id="package" name="paket" required><br>
<input type="text" id="location" name="konum" required><br>
<label for="description">Açıklama:</label>
<input type="text" id="description" name="description"><br>

Expand Down
8 changes: 8 additions & 0 deletions envanter/envanter/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
from django.shortcuts import render
from .models import Category, Component


def index(request):
search_model = request.GET.get('search_model')
components = Component.objects.all()
if search_model:
components = components.filter(model__icontains=search_model)
return render(request, 'inventory/index.html', {'components': components})

def index(request):
categories = Category.objects.all()
components = Component.objects.all()
Expand Down

0 comments on commit 00f7e50

Please sign in to comment.