Started addinf a search button for every selecField. now its not well automated but it works. need to make it more proper and then we can concentrate on only funtional stuff
parent
766f850d98
commit
55b9210990
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
<select class="btn btn-lg form-select" hx-get="/sensor/company_options" hx-swap="outerHTML" hx-target="#manufacturer_id" hx-trigger="click" id="manufacturer_id" name="manufacturer_id" required style="color:#191717; font-size: 14pt; background-color: #f1f1f1;" type="">
|
||||||
|
<option value="{{ selected.id }}" selected>{{ selected.name }}</option>
|
||||||
|
</select>
|
@ -0,0 +1,7 @@
|
|||||||
|
<ul class="list-group">
|
||||||
|
{% for result in results %}
|
||||||
|
<li class="list-group-item">
|
||||||
|
<a href="#" hx-get="select/{{ field_name }}/{{ result.id }}" hx-target="#{{ field_name }}" hx-swap="outerHTML" class="text-decoration-none">{{ result.name }}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
@ -0,0 +1,21 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}{{ title }}{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="container text-center rounded-3 mt-2 mb-2" style="{{ theme.form.div_style }};">
|
||||||
|
<h1 class="account-heading" style="color: {{ theme.orange }};">{{ title }}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="container rounded-3 " style="{{ theme.form.div_style }};">
|
||||||
|
{% include 'form.html' %}
|
||||||
|
{% if extraButtons %}
|
||||||
|
</div>
|
||||||
|
<div class="container text-left rounded-3 mt-2 mb-2" style="{{ theme.form.div_style }};">
|
||||||
|
<div class="btn-group">
|
||||||
|
<br>
|
||||||
|
{% for button in extraButtons %}
|
||||||
|
<li><a href ="{{ button.link }}" class="{{ theme.form.submit_class }}" style="{{ theme.form.submit_style }}">{{ button.name }}<a>
|
||||||
|
{% endfor %}
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock content %}
|
@ -0,0 +1,7 @@
|
|||||||
|
{% include 'form/stringField.html' %}
|
||||||
|
{% include 'form/selectFieldModal.html' %}
|
||||||
|
{% include 'form/dateField.html' %}
|
||||||
|
{% include 'form/boolField.html' %}
|
||||||
|
{% include 'form/fileField.html' %}
|
||||||
|
{% include 'form/urlField.html' %}
|
||||||
|
{% include 'form/integerField.html' %}
|
@ -0,0 +1,33 @@
|
|||||||
|
{% if item.type in ['SelectField'] %}
|
||||||
|
<br>
|
||||||
|
{{ item.label(class=theme.form.select_label_class, style=theme.form.select_label_style) }}
|
||||||
|
<br>
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
{{ item(class=theme.form.select_class, type=theme.form.select_type, style=theme.form.select_style)}}
|
||||||
|
<button class="btn btn-outline-secondary" type="button" data-bs-toggle="modal" data-bs-target="#{{ item.name }}SearchModal">Search</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="{{ item.name }}SearchModal" tabindex="-1" aria-labelledby="{{ item.name }}SearchLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="{{ item.name }}SearchLabel">Search {{ item.label.text }}</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="text"
|
||||||
|
name="modalReqArg"
|
||||||
|
id="searchInput{{ item.name }}"
|
||||||
|
class="form-control"
|
||||||
|
placeholder="Search for {{ item.label.text }}..."
|
||||||
|
hx-get="search/{{ item.name }}"
|
||||||
|
hx-trigger="keyup changed delay:500ms"
|
||||||
|
hx-target="#{{ item.name }}Results">
|
||||||
|
<div id="{{ item.name }}Results"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
@ -0,0 +1,18 @@
|
|||||||
|
<form method="POST" action="" enctype="multipart/form-data">
|
||||||
|
{{ form.hidden_tag() }}
|
||||||
|
<fieldset class="form-group">
|
||||||
|
{% for item in form %}
|
||||||
|
{% if item.id == 'submit' %}
|
||||||
|
{% elif item.id == 'csrf_token' %}
|
||||||
|
{% else %}
|
||||||
|
{% include 'form/allFieldsModal.html' %}
|
||||||
|
{% if item.errors %}
|
||||||
|
{% include 'form/formError.html' %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</fieldset>
|
||||||
|
<div>
|
||||||
|
{% include 'form/submitField.html' %}
|
||||||
|
</div>
|
||||||
|
</form>
|
Loading…
Reference in new issue