forked from
smokesignal.events/smokesignal
i18n+filtering fork - fluent-templates v2
1{% from "form_include.html" import text_input, text_input_display %}
2<div id="locationGroup" class="field">
3 <div class="control">
4 {% if is_development %}
5 <pre><code>{{ location_form | tojson(indent=2) }}</code></pre>
6 {% endif %}
7 {% if location_form.build_state == "Selecting" %}
8 <div id="locationModal" class="modal is-active" tabindex="-1">
9 <div class="modal-background"></div>
10 <div class="modal-content">
11 <div class="box">
12 <div class="field">
13 <label class="label" for="createEventLocationCountryInput">{{ t("label-country") }} ({{ t("required-field") }})</label>
14 <div class="control">
15 <div class="select">
16 <input class="input" id="createEventLocationCountryInput" name="location_country"
17 list="locations_country_data" {% if location_form.location_country %}
18 value="{{ location_form.location_country }}" {% endif %} autocomplete="off"
19 data-1p-ignore hx-get="/event/location/datalist" hx-target="#locations_country_data"
20 hx-trigger="keyup[checkUserKeydown.call(this, event)] changed delay:50ms, load" />
21 <datalist id="locations_country_data">
22 <option value="US">{{ t("country-us") }}</option>
23 <option value="GB">{{ t("country-gb") }}</option>
24 <option value="MX">{{ t("country-mx") }}</option>
25 <option value="CA">{{ t("country-ca") }}</option>
26 <option value="DE">{{ t("country-de") }}</option>
27 </datalist>
28 </div>
29 </div>
30 {% if location_form.location_country_error %}
31 <p class="help is-danger">{{ location_form.location_country_error }}</p>
32 {% endif %}
33 </div>
34
35 {{ text_input(t("label-location-name") + ' (' + t("optional-field") + ')', 'locationAddressName', 'location_name',
36 value=location_form.location_name, error=location_form.location_name_error,
37 extra='autocomplete="off" data-1p-ignore placeholder="' + t("placeholder-location-name") + '"') }}
38
39 {{ text_input(t("label-street-address") + ' (' + t("optional-field") + ')', 'locationAddressStreet', 'location_street',
40 value=location_form.location_street, error=location_form.location_street_error,
41 extra='autocomplete="off" data-1p-ignore placeholder="' + t("placeholder-street-address") + '"') }}
42
43 {{ text_input(t("label-locality") + ' (' + t("optional-field") + ')', 'locationAddressLocality', 'location_locality',
44 value=location_form.location_locality, error=location_form.location_locality_error,
45 extra='autocomplete="off" data-1p-ignore placeholder="' + t("placeholder-locality") + '"') }}
46
47 {{ text_input(t("label-region") + ' (' + t("optional-field") + ')', 'locationAddressRegion', 'location_region',
48 value=location_form.location_region, error=location_form.location_region_error,
49 extra='autocomplete="off" data-1p-ignore placeholder="' + t("placeholder-region") + '"') }}
50
51 {{ text_input(t("label-postal-code") + ' (' + t("optional-field") + ')', 'locationAddressPostalCode', 'location_postal_code',
52 value=location_form.location_postal_code, error=location_form.location_postal_code_error,
53 extra='autocomplete="off" data-1p-ignore placeholder="' + t("placeholder-postal-code") + '"') }}
54
55 <div class="field is-grouped pt-4">
56 <p class="control">
57 <button hx-post="/event/location" hx-target="#locationGroup" hx-swap="outerHTML"
58 hx-trigger="click"
59 hx-params="build_state,location_country,location_name,location_street,location_locality,location_region,location_postal_code"
60 hx-vals='{ "build_state": "Selected" }' class="button is-primary">{{ t("button-save") }}</button>
61 </p>
62 </div>
63 </div>
64 </div>
65 <button hx-post="/event/location" hx-target="#locationGroup" hx-swap="outerHTML" hx-trigger="click"
66 hx-params="build_state" hx-vals='{ "build_state": "Reset" }' class="modal-close is-large"
67 aria-label="{{ t('button-close') }}"></button>
68 </div>
69 {% elif (location_form.build_state == "Selected") %}
70
71 {{ text_input_display(t("label-location-name"), 'location_name', value=location_form.location_name) }}
72
73 {{ text_input_display(t("label-street-address"), 'location_street', value=location_form.location_street) }}
74
75 {{ text_input_display(t("label-locality"), 'location_locality', value=location_form.location_locality) }}
76
77 {{ text_input_display(t("label-region"), 'location_region', value=location_form.location_region) }}
78
79 {{ text_input_display(t("label-postal-code"), 'location_postal_code', value=location_form.location_postal_code) }}
80
81 {{ text_input_display(t("label-country"), 'location_country', value=location_form.location_country) }}
82
83 <div class="field is-grouped">
84 <p class="control">
85 <button hx-post="/event/location" hx-target="#locationGroup" hx-swap="outerHTML" hx-trigger="click"
86 hx-params="build_state,location_country,location_name,location_street,location_locality,location_region,location_postal_code"
87 hx-vals='{ "build_state": "Selecting" }' data-bs-toggle="modal" data-bs-target="startAtModal"
88 class="button is-link is-outlined">{{ t("button-edit") }}</button>
89 </p>
90 <p class="control">
91 <button hx-post="/event/location" hx-target="#locationGroup" hx-swap="outerHTML" hx-trigger="click"
92 hx-params="build_state" hx-vals='{ "build_state": "Reset" }'
93 class="button is-danger is-outlined">{{ t("button-clear") }}</button>
94 </p>
95 </div>
96 {% if location_form.location_country %}
97 <input hidden type="text" name="location_country" value="{{ location_form.location_country }}">
98 {% endif %}
99 {% if location_form.location_name %}
100 <input hidden type="text" name="location_name" value="{{ location_form.location_name }}">
101 {% endif %}
102 {% if location_form.location_street %}
103 <input hidden type="text" name="location_street" value="{{ location_form.location_street }}">
104 {% endif %}
105 {% if location_form.location_locality %}
106 <input hidden type="text" name="location_locality" value="{{ location_form.location_locality }}">
107 {% endif %}
108 {% if location_form.location_region %}
109 <input hidden type="text" name="location_region" value="{{ location_form.location_region }}">
110 {% endif %}
111 {% if location_form.location_postal_code %}
112 <input hidden type="text" name="location_postal_code" value="{{ location_form.location_postal_code }}">
113 {% endif %}
114 {% elif location_form.build_state == "Reset" %}
115 <div class="field">
116 <div class="field-body is-align-items-end">
117 <div class="field">
118 <label class="label" for="createEventLocationCountryInput">{{ t("label-location") }}</label>
119 <div class="control">
120 <input id="createEventLocationCountryInput" type="text" class="input is-static" value="{{ t('not-set') }}"
121 readonly />
122 </div>
123 </div>
124 <div class="field">
125 <p class="control">
126 <button hx-post="/event/location" hx-target="#locationGroup" hx-swap="outerHTML"
127 hx-trigger="click"
128 hx-params="build_state,location_country,location_name,location_street,location_locality,location_region,location_postal_code"
129 hx-vals='{ "build_state": "Selecting" }' class="button is-link is-outlined">{{ t("button-edit") }}</button>
130 </p>
131 </div>
132 </div>
133 </div>
134 {% endif %}
135 </div>
136</div>