Fiddling around with forms and stuff. No clue where it will end
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
{% comment "" %}
|
||||
needs following context:
|
||||
- stock: Creates a modal with id = change_stock-modal-{{stock.id}}
|
||||
- form: EditStockForm
|
||||
{% endcomment %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% load static %}
|
||||
<div class="modal fade" id="change-stock-modal-{{stock.id}}">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<div class="flex-shrink-0">
|
||||
{% if stock.component.get_resolved_image %}
|
||||
<img src="{{stock.component.get_resolved_image}}" style="max-width:64px;max-height:64px;" alt="{{ low.component.name }}" class="mr-3">
|
||||
{% else %}
|
||||
<img src="{% static 'css/icons/card-image.svg' %}" style="width:64px;max-height:64px;" alt="{{ low.component.name }}" class="mr-3">
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h6 class="mt-0 text-primary">{{ stock.component.name }}</h6>
|
||||
{% if stock.component.package %}
|
||||
Package: {{stock.component.package}}<br>
|
||||
{% endif %}
|
||||
{% if stock.component.manufacturer %}
|
||||
Manufacturer: {{stock.component.manufacturer}}
|
||||
{% endif %}
|
||||
</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">
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -1,6 +1,8 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load qr_code %}
|
||||
{% load static %}
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<nav aria-label="breadcrumb" class="fs-4">
|
||||
@@ -72,12 +74,33 @@
|
||||
Manufacturer: {{stock.component.manufacturer}}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="ms-3">
|
||||
Amount: {{stock.amount}}
|
||||
{% if stock.watermark >= 0 %}
|
||||
<br>Watermark: {{stock.watermark}}
|
||||
{% else %}
|
||||
<span class="text-secondary"><br>No Watermark</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="ms-3">
|
||||
<button type="button" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#change-stock-modal-{{stock.id}}">Change</button>
|
||||
</div>
|
||||
<div>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="stock_uuid" value="{{stock.id}}">
|
||||
<input type="submit" class="btn btn-danger" name="submit-delete-stock" value="X">
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% include 'paginator.html' with paginator=stocks get_param='stock_page' aria_label='Stock Page Navigation' %}
|
||||
</div>
|
||||
</div>
|
||||
{% for stock in stocks %}
|
||||
{% include 'parts/modals/update-stock-modal.html' with stock=stock form=change_stock_form %}
|
||||
{% endfor %}
|
||||
<!-- Modal for adding a substorage-->
|
||||
{% with add_storage_form as form %}
|
||||
{% include 'parts/modals/new-substorage-modal.html' %}
|
||||
|
Reference in New Issue
Block a user