mirror of
https://github.com/openclassify/openclassify.git
synced 2026-04-25 16:20:42 -05:00
32 lines
1.6 KiB
Twig
32 lines
1.6 KiB
Twig
{% for custom_field in custom_fields %}
|
|
<div class="{{ custom_field['type'] == 'checkboxes' ? 'col-md-12' : 'col-md-3' }} form-group custom-fields {{ custom_field.type|raw }}_container mx-0 my-4" data-slug="{{ custom_field.custom_field_slug }}">
|
|
<label class="label-title {{ custom_field.type|raw }}_title
|
|
{{ custom_field['type'] == 'checkboxes' ? 'd-flex justify-content-between align-items-center' }}"
|
|
onclick="$(this).hasClass('checkboxes_title') ? $(this).siblings().toggleClass('d-none') : null">
|
|
{{ custom_field.custom_field_label|raw }}
|
|
{% if custom_field['type'] == 'checkboxes' %}
|
|
<i class="fa fa-angle-down"></i>
|
|
{% endif %}
|
|
</label>
|
|
<div class="col-sm-12 {{ custom_field['type'] == 'checkboxes' ? 'd-none' }}">
|
|
<div class="{{ custom_field.type|raw }}_data" data-date="{{ custom_field.data_date }}">
|
|
{{ custom_field.custom_field_input|raw }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
<script>
|
|
let date_customfield = $("[data-date=1] input");
|
|
if (date_customfield) {
|
|
date_customfield.attr('type', 'date');
|
|
|
|
date_customfield.on('change', () => {
|
|
const status = date_customfield.val() > new Date().toISOString().slice(0, 10);
|
|
date_customfield.attr('style', !status ? 'border-color: red !important' : '');
|
|
$("[name='action']").attr('disabled', !status);
|
|
});
|
|
|
|
}
|
|
</script>
|
|
{{ asset_add('styles.css','visiosoft.module.customfields::css/fields.css') }}
|