Complex form
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
{% extends "main/base/layout.html" %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<form
|
||||
hx-post="{{ url("complex-form-handle") }}"
|
||||
@ -8,7 +7,7 @@
|
||||
hx-target="#complex-form-content"
|
||||
>
|
||||
<div id="complex-form-content">
|
||||
{% include "main/complex_form_content.html" %}
|
||||
{% include "main/complex_form/route_module.html" %}
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
@ -1,12 +1,14 @@
|
||||
{% from "main/components/inputs.html" import checkbox %}
|
||||
{% from "main/components/inputs.html" import checkbox, select %}
|
||||
|
||||
{% set indent_1 = "ms-4" %}
|
||||
{% set indent_2 = "ms-5" %}
|
||||
|
||||
{% set state = form_state.route_module %}
|
||||
|
||||
{{ checkbox(
|
||||
title="Route module",
|
||||
name="route_module",
|
||||
state=state.route_module
|
||||
state=state.enabled
|
||||
) }}
|
||||
{{ checkbox(
|
||||
title="Smart routing",
|
||||
@ -14,18 +16,38 @@
|
||||
state=state.smart_routing,
|
||||
cls=indent_1
|
||||
) }}
|
||||
{{ checkbox(
|
||||
title="Predictive pickup",
|
||||
name="predictive_pickup",
|
||||
state=state.predictive_pickup,
|
||||
cls=indent_2
|
||||
) }}
|
||||
{{ checkbox(
|
||||
title="Automatic planning",
|
||||
name="automatic_planning",
|
||||
state=state.automatic_planning,
|
||||
cls=indent_2
|
||||
) }}
|
||||
{{ checkbox(
|
||||
title="Geo routing",
|
||||
name="geo_routing",
|
||||
state=state.geo_routing,
|
||||
cls=indent_1
|
||||
) }}
|
||||
{{ checkbox(
|
||||
title="Use packing model per route",
|
||||
name="use_packing_model_per_route",
|
||||
state=state.use_packing_model_per_route,
|
||||
|
||||
{{ select(
|
||||
title="Packing model",
|
||||
name="packing_model",
|
||||
options={
|
||||
"": "No packing model",
|
||||
"per_route": "Packing model per route",
|
||||
"per_machine": "Packing model per machine",
|
||||
},
|
||||
state=state.packing_model,
|
||||
cls=indent_1
|
||||
) }}
|
||||
|
||||
|
||||
{{ checkbox(
|
||||
title="Prekitting to box",
|
||||
name="prekitting_to_box",
|
||||
@ -44,18 +66,18 @@
|
||||
state=state.real_time_stock,
|
||||
cls=indent_2
|
||||
) }}
|
||||
{{ checkbox(
|
||||
title="Use packing model per machine",
|
||||
name="use_packing_model_per_machine",
|
||||
state=state.use_packing_model_per_machine,
|
||||
cls=indent_1
|
||||
) }}
|
||||
{{ checkbox(
|
||||
title="Warehouse",
|
||||
name="warehouse",
|
||||
state=state.warehouse,
|
||||
cls=indent_1
|
||||
) }}
|
||||
{{ checkbox(
|
||||
title="End warehouse tracking",
|
||||
name="end_warehouse_tracking",
|
||||
state=state.end_warehouse_tracking,
|
||||
cls=indent_2
|
||||
) }}
|
||||
{{ checkbox(
|
||||
title="Custom forms in routing",
|
||||
name="custom_forms_in_routing",
|
||||
@ -1,15 +1,15 @@
|
||||
{% macro checkbox(title, name, checked, state, cls="") %}
|
||||
{% macro checkbox(title, name, state, cls="") %}
|
||||
{% if state.visible %}
|
||||
{% set id = random_id() %}
|
||||
|
||||
|
||||
<div class="form-check {{ cls }}">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
id="{{ id }}"
|
||||
name="{{ name }}"
|
||||
{% if state.checked %}checked{% endif %}
|
||||
{% if not state.enabled %}disabled{% endif %}
|
||||
{% if state.checked and state.enabled %}checked {% endif %}
|
||||
{% if not state.enabled %}disabled {% endif %}
|
||||
>
|
||||
<label class="form-check-label" for="{{ id }}">
|
||||
{{ title }}
|
||||
@ -17,3 +17,25 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro select(title, name, options, state, cls="") %}
|
||||
{% if state.visible %}
|
||||
<div class="{{ cls }}">
|
||||
<select
|
||||
name="{{ name }}"
|
||||
class="form-select form-select-sm"
|
||||
>
|
||||
{% for value, title in options.items() %}
|
||||
<option
|
||||
value="{{ value }}"
|
||||
{% if value == state.value %}selected {% endif %}
|
||||
{% if not state.enabled %}disabled {% endif %}
|
||||
>
|
||||
{{ title }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
Reference in New Issue
Block a user