Files
mkspc-mgmt/app/base/static/js/forms.js
2023-05-29 17:41:48 +02:00

35 lines
962 B
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function dateTimeSetNow(theId) {
const now = new Date();
const localNow = new Date(Date.UTC(
now.getFullYear(), now.getMonth(), now.getDate(),
now.getHours(), now.getMinutes()));
dateFieldSet(theId, localNow);
dateFieldSet(theId + '_day', localNow);
dateFieldSet(theId + '_time', localNow);
}
function dateTimeReset(theId) {
dateFieldSet(theId, null);
dateFieldSet(theId + '_day', null);
dateFieldSet(theId + '_time', null);
}
function dateFieldSet(theId, value = null) {
const el = document.getElementById(theId);
if (el) el.valueAsDate = value;
}
$(document).ready(function () {
$('select').select2({
width: '100%',
placeholder: ' nicht ausgewählt ',
allowClear: true,
// minimumResultsForSearch: 7,
// minimumInputLength: 1,
});
});
$(document).on('select2:open', () => {
document.querySelector('.select2-search__field').focus();
});