[TASK] refactor select
This commit is contained in:
parent
85d35eaf41
commit
c6fa27f046
@ -10,7 +10,7 @@
|
|||||||
{{ macros::checkbox(label='Gäste erlauben', name='tripdetails.allow_guests') }}
|
{{ macros::checkbox(label='Gäste erlauben', name='tripdetails.allow_guests') }}
|
||||||
{{ macros::checkbox(label='Immer anzeigen', name='tripdetails.always_show') }}
|
{{ macros::checkbox(label='Immer anzeigen', name='tripdetails.always_show') }}
|
||||||
{{ macros::input(label='Anmerkungen', name='tripdetails.notes', type='input') }}
|
{{ macros::input(label='Anmerkungen', name='tripdetails.notes', type='input') }}
|
||||||
{{ macros::select(data=trip_types, name='tripdetails.trip_type', default='Reguläre Ausfahrt') }}
|
{{ macros::select(label='Typ', data=trip_types, name='tripdetails.trip_type', default='Reguläre Ausfahrt') }}
|
||||||
|
|
||||||
<input value="Erstellen" class="w-full btn btn-primary" type="submit"/>
|
<input value="Erstellen" class="w-full btn btn-primary" type="submit"/>
|
||||||
</form>
|
</form>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
{{ macros::checkbox(label='Gäste erlauben', name='allow_guests') }}
|
{{ macros::checkbox(label='Gäste erlauben', name='allow_guests') }}
|
||||||
{{ macros::checkbox(label='Immer anzeigen', name='always_show') }}
|
{{ macros::checkbox(label='Immer anzeigen', name='always_show') }}
|
||||||
{{ macros::input(label='Anmerkungen', name='notes', type='input') }}
|
{{ macros::input(label='Anmerkungen', name='notes', type='input') }}
|
||||||
{{ macros::select(data=trip_types, name='trip_type', default='Reguläre Ausfahrt') }}
|
{{ macros::select(label='Typ', data=trip_types, name='trip_type', default='Reguläre Ausfahrt') }}
|
||||||
|
|
||||||
<input value="Erstellen" class="w-full btn btn-primary" type="submit"/>
|
<input value="Erstellen" class="w-full btn btn-primary" type="submit"/>
|
||||||
</form>
|
</form>
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
{{ macros::input(label="Anzahl Sitze", name="amount_seats", type="number", required=true, min=1) }}
|
{{ macros::input(label="Anzahl Sitze", name="amount_seats", type="number", required=true, min=1) }}
|
||||||
{{ macros::input(label="Baujahr", name="year_built", type="number", min=1950, max=2050) }}
|
{{ macros::input(label="Baujahr", name="year_built", type="number", min=1950, max=2050) }}
|
||||||
{{ macros::input(label="Bootsbauer", name="boatbuilder", type="text") }}
|
{{ macros::input(label="Bootsbauer", name="boatbuilder", type="text") }}
|
||||||
{{ macros::select(data=locations, label='location', name='location_id', selected_id=1) }}
|
{{ macros::select(label="Standort", data=locations, name='location_id', selected_id=1) }}
|
||||||
{{ macros::select(data=users, label='users', name='owner', default="Vereinsboot") }}
|
{{ macros::select(label="Besitzer", data=users, name='owner', default="Verein") }}
|
||||||
{{ macros::checkbox(label="Steuerperson steuert nur", name="default_shipmaster_only_steering")}}
|
{{ macros::checkbox(label="handgesteuert", name="default_shipmaster_only_steering")}}
|
||||||
{{ macros::checkbox(label="Skull", name="skull", checked=true)}}
|
{{ macros::checkbox(label="Skull", name="skull", checked=true)}}
|
||||||
{{ macros::checkbox(label="Externes Boot (anderer Verein)", name="external")}}
|
{{ macros::checkbox(label="Externes Boot (anderer Verein)", name="external")}}
|
||||||
</div>
|
</div>
|
||||||
@ -29,8 +29,8 @@
|
|||||||
<div class="grid md:grid-cols-3">
|
<div class="grid md:grid-cols-3">
|
||||||
{{ macros::input(label='Name', name='name', type='text', value=boat.name) }}
|
{{ macros::input(label='Name', name='name', type='text', value=boat.name) }}
|
||||||
{{ macros::input(label='Amount Seats', name='amount_seats', type='number', min=0, value=boat.amount_seats) }}
|
{{ macros::input(label='Amount Seats', name='amount_seats', type='number', min=0, value=boat.amount_seats) }}
|
||||||
{{ macros::select(data=locations, label='location', name='location_id', selected_id=boat.location_id) }}
|
{{ macros::select(data=locations, label='Standort', name='location_id', selected_id=boat.location_id) }}
|
||||||
{{ macros::select(data=users, label='users', name='owner', selected_id=boat.owner, default="Vereinsboot") }}
|
{{ macros::select(data=users, label='Besitzer', name='owner', selected_id=boat.owner, default="Vereinsboot") }}
|
||||||
{{ macros::input(label='Baujahr', name='year_built', type='number', min=1950, value=boat.year_built) }}
|
{{ macros::input(label='Baujahr', name='year_built', type='number', min=1950, value=boat.year_built) }}
|
||||||
{{ macros::input(label='Bootsbauer', name='boatbuilder', type='text', value=boat.boatbuilder) }}
|
{{ macros::input(label='Bootsbauer', name='boatbuilder', type='text', value=boat.boatbuilder) }}
|
||||||
{{ macros::checkbox(label='default_shipmaster_only_steering', name='default_shipmaster_only_steering', id=uuid , checked=boat.default_shipmaster_only_steering) }}
|
{{ macros::checkbox(label='default_shipmaster_only_steering', name='default_shipmaster_only_steering', id=uuid , checked=boat.default_shipmaster_only_steering) }}
|
||||||
|
@ -88,25 +88,20 @@
|
|||||||
|
|
||||||
{{ macros::input(label="Kommentar", name="comments", type="text", wrapper_class="col-span-2") }}
|
{{ macros::input(label="Kommentar", name="comments", type="text", wrapper_class="col-span-2") }}
|
||||||
|
|
||||||
<div class="col-span-2">
|
{{ macros::select(label="Typ", data=logtypes, name='logtype', default="Normal", wrapper_class="col-span-2") }}
|
||||||
<label for="logtype" class=" text-sm text-gray-600 ">Typ</label>
|
|
||||||
{{ macros::select(data=logtypes, name='logtype', default="Normal") }}
|
|
||||||
</div>
|
|
||||||
<input type="submit" value="Ausfahrt starten" class="btn btn-primary w-full col-span-2 m-auto"/>
|
<input type="submit" value="Ausfahrt starten" class="btn btn-primary w-full col-span-2 m-auto"/>
|
||||||
</form>
|
</form>
|
||||||
{% endmacro new %}
|
{% endmacro new %}
|
||||||
|
|
||||||
|
|
||||||
{% macro boat_select(only_ones) %}
|
{% macro boat_select(only_ones) %}
|
||||||
<div class="col-span-2">
|
|
||||||
<label for="boat_id" class=" text-sm text-gray-600 ">Boot</label>
|
|
||||||
{% if not only_ones %}
|
{% if not only_ones %}
|
||||||
{{ macros::select(data=boats, name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water"], class="col-span-2") }}
|
{{ macros::select(label="Boot", data=boats, name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water"], wrapper_class="col-span-2") }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set ones = boats | filter(attribute="amount_seats", value=1) %}
|
{% set ones = boats | filter(attribute="amount_seats", value=1) %}
|
||||||
{{ macros::select(data=ones, name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water"], class="col-span-2") }}
|
{{ macros::select(label="Boot", data=ones, name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water"], wrapper_class="col-span-2") }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
{% endmacro boat_select %}
|
{% endmacro boat_select %}
|
||||||
|
|
||||||
{% macro rower_select(id, selected, amount_seats='', class='', init='false') %}
|
{% macro rower_select(id, selected, amount_seats='', class='', init='false') %}
|
||||||
@ -266,11 +261,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ macros::input(label="Kommentar", name="comments", id="comments" ~ log.id, type="text", value=log.comments, class="rounded-md change-id-js") }}
|
{{ macros::input(label="Kommentar", name="comments", id="comments" ~ log.id, type="text", value=log.comments, class="rounded-md change-id-js") }}
|
||||||
|
{{ macros::select(label="Typ", data=logtypes, name="logtype", id="logtype" ~ log.id, default="Normal", selected_id=log.logtype, class="rounded-md change-id-js") }}
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="logtype" class="text-sm text-gray-600 ">Typ</label>
|
|
||||||
{{ macros::select(data=logtypes, name="logtype", id="logtype" ~ log.id, default="Normal", selected_id=log.logtype, class="rounded-md change-id-js") }}
|
|
||||||
</div>
|
|
||||||
<input class="btn btn-primary" type="submit" value="Ausfahrt beenden"/>
|
<input class="btn btn-primary" type="submit" value="Ausfahrt beenden"/>
|
||||||
</form>
|
</form>
|
||||||
{% endmacro home %}
|
{% endmacro home %}
|
||||||
|
@ -74,7 +74,9 @@
|
|||||||
</label>
|
</label>
|
||||||
{% endmacro checkbox %}
|
{% endmacro checkbox %}
|
||||||
|
|
||||||
{% macro select(data, name='trip_type', default='', id='', selected_id='', display='', extras='', class='') %}
|
{% macro select(label, data, name='trip_type', default='', id='', selected_id='', display='', extras='', class='', wrapper_class='') %}
|
||||||
|
<div class="{{wrapper_class}}">
|
||||||
|
<label for="{{ name }}" class="text-sm text-gray-600">{{ label }}</label>
|
||||||
{% if display == '' %}
|
{% if display == '' %}
|
||||||
{% set display = ["name"] %}
|
{% set display = ["name"] %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -94,6 +96,7 @@
|
|||||||
</option>
|
</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
</div>
|
||||||
{% endmacro select %}
|
{% endmacro select %}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@
|
|||||||
{{ macros::input(label='Anmerkungen', name='notes', type='input', value=trip.notes) }}
|
{{ macros::input(label='Anmerkungen', name='notes', type='input', value=trip.notes) }}
|
||||||
{{ macros::checkbox(label='Immer anzeigen', name='always_show', id=trip.id,checked=trip.always_show) }}
|
{{ macros::checkbox(label='Immer anzeigen', name='always_show', id=trip.id,checked=trip.always_show) }}
|
||||||
{{ macros::checkbox(label='Gesperrt', name='is_locked', id=trip.id,checked=trip.is_locked) }}
|
{{ macros::checkbox(label='Gesperrt', name='is_locked', id=trip.id,checked=trip.is_locked) }}
|
||||||
{{ macros::select(name='trip_type', data=trip_types, default='Reguläre Ausfahrt', selected_id=trip.trip_type_id) }}
|
{{ macros::select(label='Typ', name='trip_type', data=trip_types, default='Reguläre Ausfahrt', selected_id=trip.trip_type_id) }}
|
||||||
|
|
||||||
<input value="Speichern" class="btn btn-primary" type="submit"/>
|
<input value="Speichern" class="btn btn-primary" type="submit"/>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user