Numex yayın: views/products/form.ejs
This commit is contained in:
parent
f5058aa968
commit
17215b3f2a
57
views/products/form.ejs
Normal file
57
views/products/form.ejs
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
<div class="page-head">
|
||||||
|
<h1><%= product ? 'Ürünü Düzenle' : 'Yeni Ürün' %></h1>
|
||||||
|
<p class="muted"><%= product ? '#' + product.id + ' · ' + product.name : 'Stok panele yeni ürün ekleyin' %></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card form-card">
|
||||||
|
<form id="productForm" method="<%= product ? 'PUT' : 'POST' %>"
|
||||||
|
action="<%= action %>" class="form">
|
||||||
|
<input type="hidden" name="_method" value="<%= product ? 'PUT' : 'POST' %>">
|
||||||
|
<input type="hidden" name="_api" value="1">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name">Ürün Adı *</label>
|
||||||
|
<input type="text" id="name" name="name" required
|
||||||
|
value="<%= product ? product.name : '' %>" placeholder="Örn: Kablosuz Kulaklık">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="categoryId">Kategori</label>
|
||||||
|
<select id="categoryId" name="categoryId">
|
||||||
|
<% categories.forEach(c => { %>
|
||||||
|
<option value="<%= c.id %>" <%= product && product.categoryId == c.id ? 'selected' : '' %>>
|
||||||
|
<%= c.name %>
|
||||||
|
</option>
|
||||||
|
<% }) %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="unitPrice">Birim Fiyat (₺)</label>
|
||||||
|
<input type="number" id="unitPrice" name="unitPrice" min="0" step="0.01" required
|
||||||
|
value="<%= product ? product.unitPrice : '' %>" placeholder="2500">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="stock">Stok Miktarı</label>
|
||||||
|
<input type="number" id="stock" name="stock" min="0" required
|
||||||
|
value="<%= product ? product.stock : 0 %>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="minimumStock">Düşük Stok Eşiği</label>
|
||||||
|
<input type="number" id="minimumStock" name="minimumStock" min="0"
|
||||||
|
value="<%= product ? product.minimumStock : 10 %>">
|
||||||
|
<span class="hint">Stok bu değerin altına düşünce uyarı gösterilir.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<button type="submit" class="btn btn-primary">Kaydet</button>
|
||||||
|
<a href="/api/products" class="btn btn-ghost">İptal</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="formError" class="alert alert-danger" style="display:none;"></div>
|
||||||
|
|
||||||
|
<script src="/js/products.js"></script>
|
||||||
Loading…
Reference in New Issue
Block a user