Implement change amount / watermark form

This commit is contained in:
2021-11-07 20:36:12 +01:00
parent c0eff5822b
commit 88bebfa2c8
4 changed files with 111 additions and 34 deletions

View File

@@ -1,7 +1,6 @@
{% comment "" %}
needs following context:
- stock: Creates a modal with id = change_stock-modal-{{stock.id}}
- form: EditStockForm
{% endcomment %}
{% load crispy_forms_tags %}
{% load static %}
@@ -27,14 +26,28 @@ needs following context:
</div>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form action="" method="post">
{% csrf_token %}
<div class="modal-body">
<form method="post">
{% csrf_token %}
<input type="hidden" name="stock_uuid" value="{{stock.id}}">
<div class="input-group mb-3">
<input type="submit" class="btn btn-primary" name="submit-amount-reduce" value="-">
<input type="number" name="amount" id="ch-stk-amount-{{stock.id}}" class="form-control" value="1" min="0" required>
<input type="submit" class="btn btn-primary" name="submit-amount-increase" value="+">
</div>
</form>
<form method="post">
{% csrf_token %}
<input type="hidden" name="stock_uuid" value="{{stock.id}}">
<div class="input-group mb-3">
<div class="input-group-text">
<input type="checkbox" class="form-check-input mt-0" name="watermark_active" id="ch-stk-watermark-act-{{stock.id}}" {% if stock.watermark >= 0 %}checked{%endif%}>
</div>
<input type="number" name="watermark" id="ch-stk-watermark-{{stock.id}}" class="form-control" value="{% if stock.watermark < 0 %}0{% else %}{{stock.watermark}}{% endif %}" required>
<input type="submit" class="btn btn-primary" name="submit-edit-watermark" value="Update Watermark">
</div>
</form>
</div>
<div class="modal-footer">
</div>
</form>
</div>
</div>
</div>