publik-famille: check event overlaps (#65272)
gitea-wip/publik-base-theme/pipeline/head Build started...
Details
gitea-wip/publik-base-theme/pipeline/head Build started...
Details
This commit is contained in:
parent
200d8451f4
commit
77a77eb365
|
@ -34,6 +34,8 @@
|
|||
{% if widget.readonly or option.disabled %}disabled{% endif %}
|
||||
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}"{% endfor %}
|
||||
type="checkbox"
|
||||
data-event-id="{{ option.options.id }}"
|
||||
data-overlaps="{{ option.options.overlaps|join:" " }}"
|
||||
{% if widget.readonly %}value="yes" disabled
|
||||
{% else %}name="{{ option.name }}" value="yes"
|
||||
{% endif %}><span>{{ option.options.label }}</span></label>
|
||||
|
@ -198,6 +200,17 @@ $('.template-famille-reservations-par-semaine li.day-title').each(function(idx,
|
|||
$(elem).hide();
|
||||
}
|
||||
});
|
||||
/* check overlaps */
|
||||
$('.template-famille-reservations-par-semaine input').on('change', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$(this).parents('ul').find("input[data-overlaps~='"+$(this).data('event-id')+"']").prop('checked', false);
|
||||
}
|
||||
});
|
||||
$('.template-famille-reservations-par-semaine input:disabled').each(function(index) {
|
||||
if ($(this).attr('checked')) {
|
||||
$(this).parents('ul').find("input[data-overlaps~='"+$(this).data('event-id')+"']").prop('disabled', true);
|
||||
}
|
||||
});
|
||||
/* init first week shown */
|
||||
var $cell = $('.template-famille-reservations-par-semaine');
|
||||
$cell.find('li').removeClass('shown');
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
{% elif widget.readonly or option.disabled %}disabled{% endif %}
|
||||
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}"{% endfor %}
|
||||
type="checkbox"
|
||||
data-event-id="{{ option.options.id }}"
|
||||
data-overlaps="{{ option.options.overlaps|join:" " }}"
|
||||
{% if widget.readonly %}value="yes" disabled
|
||||
{% else %}name="{{ option.name }}" value="yes"
|
||||
{% endif %}><span>{{ option.options.label }}</span></label>
|
||||
|
@ -77,4 +79,12 @@
|
|||
background: #3c3;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
/* check overlaps */
|
||||
$('.template-famille-reservations-recurrentes input').on('change', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$(this).parents('ul').find("input[data-overlaps~='"+$(this).data('event-id')+"']").prop('checked', false);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue