fixed date format
This commit is contained in:
@@ -1115,15 +1115,15 @@ function getContrastTextColor($hexColor)
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-4">
|
<div class="col-12 col-md-4">
|
||||||
<label for="dlDocDate" class="form-label fw-semibold">Data documento</label>
|
<label for="dlDocDate" class="form-label fw-semibold">Data documento</label>
|
||||||
<input type="date" class="form-control" id="dlDocDate" name="document_date">
|
<input type="text" class="form-control js-date-it" id="dlDocDate" name="document_date" placeholder="gg/mm/aaaa" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-4">
|
<div class="col-12 col-md-4">
|
||||||
<label for="dlDueDate" class="form-label fw-semibold">Data scadenza <span class="text-danger">*</span></label>
|
<label for="dlDueDate" class="form-label fw-semibold">Data scadenza <span class="text-danger">*</span></label>
|
||||||
<input type="date" class="form-control" id="dlDueDate" name="due_date" required>
|
<input type="text" class="form-control js-date-it" id="dlDueDate" name="due_date" placeholder="gg/mm/aaaa" autocomplete="off" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-4">
|
<div class="col-12 col-md-4">
|
||||||
<label for="dlCheckDate" class="form-label fw-semibold">Data ultimo controllo</label>
|
<label for="dlCheckDate" class="form-label fw-semibold">Data ultimo controllo</label>
|
||||||
<input type="date" class="form-control" id="dlCheckDate" name="check_date">
|
<input type="text" class="form-control js-date-it" id="dlCheckDate" name="check_date" placeholder="gg/mm/aaaa" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1221,6 +1221,33 @@ function getContrastTextColor($hexColor)
|
|||||||
var fpDue = flatpickr('#filterDueRange', fpOpts);
|
var fpDue = flatpickr('#filterDueRange', fpOpts);
|
||||||
var fpCheck = flatpickr('#filterCheckRange', fpOpts);
|
var fpCheck = flatpickr('#filterCheckRange', fpOpts);
|
||||||
|
|
||||||
|
// --- Flatpickr Italian date fields in deadline modal ---
|
||||||
|
// Visible format: dd/mm/yyyy
|
||||||
|
// Submitted format: yyyy-mm-dd, compatible with MySQL DATE
|
||||||
|
var fpDocDate = flatpickr('#dlDocDate', {
|
||||||
|
dateFormat: 'Y-m-d',
|
||||||
|
altInput: true,
|
||||||
|
altFormat: 'd/m/Y',
|
||||||
|
locale: 'it',
|
||||||
|
allowInput: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var fpDueDate = flatpickr('#dlDueDate', {
|
||||||
|
dateFormat: 'Y-m-d',
|
||||||
|
altInput: true,
|
||||||
|
altFormat: 'd/m/Y',
|
||||||
|
locale: 'it',
|
||||||
|
allowInput: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var fpCheckDate = flatpickr('#dlCheckDate', {
|
||||||
|
dateFormat: 'Y-m-d',
|
||||||
|
altInput: true,
|
||||||
|
altFormat: 'd/m/Y',
|
||||||
|
locale: 'it',
|
||||||
|
allowInput: true
|
||||||
|
});
|
||||||
|
|
||||||
// --- Select2 ---
|
// --- Select2 ---
|
||||||
$('#dlSubject').select2({
|
$('#dlSubject').select2({
|
||||||
theme: 'bootstrap-5',
|
theme: 'bootstrap-5',
|
||||||
@@ -1295,7 +1322,7 @@ function getContrastTextColor($hexColor)
|
|||||||
var iso = d.getFullYear() + '-' +
|
var iso = d.getFullYear() + '-' +
|
||||||
String(d.getMonth() + 1).padStart(2, '0') + '-' +
|
String(d.getMonth() + 1).padStart(2, '0') + '-' +
|
||||||
String(d.getDate()).padStart(2, '0');
|
String(d.getDate()).padStart(2, '0');
|
||||||
document.getElementById('dlDueDate').value = iso;
|
fpDueDate.setDate(iso, true, 'Y-m-d');
|
||||||
}
|
}
|
||||||
$('#dlDocDate, #dlRecurrence').on('change', computeDueDate);
|
$('#dlDocDate, #dlRecurrence').on('change', computeDueDate);
|
||||||
|
|
||||||
@@ -1464,16 +1491,24 @@ function getContrastTextColor($hexColor)
|
|||||||
var modal = new bootstrap.Modal(document.getElementById('deadlineModal'));
|
var modal = new bootstrap.Modal(document.getElementById('deadlineModal'));
|
||||||
var form = document.getElementById('deadlineForm');
|
var form = document.getElementById('deadlineForm');
|
||||||
|
|
||||||
|
// Add
|
||||||
// Add
|
// Add
|
||||||
document.getElementById('btnAddDeadline').addEventListener('click', function() {
|
document.getElementById('btnAddDeadline').addEventListener('click', function() {
|
||||||
form.reset();
|
form.reset();
|
||||||
|
|
||||||
document.getElementById('dlId').value = '';
|
document.getElementById('dlId').value = '';
|
||||||
document.getElementById('dlNotifDays').value = '7';
|
document.getElementById('dlNotifDays').value = '7';
|
||||||
document.getElementById('modalTitle').textContent = 'Nuova Scadenza';
|
document.getElementById('modalTitle').textContent = 'Nuova Scadenza';
|
||||||
document.getElementById('dlFiles').value = '';
|
document.getElementById('dlFiles').value = '';
|
||||||
|
|
||||||
|
fpDocDate.clear();
|
||||||
|
fpDueDate.clear();
|
||||||
|
fpCheckDate.clear();
|
||||||
|
|
||||||
$('#dlSubject').val('').trigger('change');
|
$('#dlSubject').val('').trigger('change');
|
||||||
$('#dlDepartments').val(null).trigger('change');
|
$('#dlDepartments').val(null).trigger('change');
|
||||||
$('#dlEmployees').val(null).trigger('change');
|
$('#dlEmployees').val(null).trigger('change');
|
||||||
|
|
||||||
renderAttachments([]);
|
renderAttachments([]);
|
||||||
modal.show();
|
modal.show();
|
||||||
});
|
});
|
||||||
@@ -1639,9 +1674,9 @@ function getContrastTextColor($hexColor)
|
|||||||
document.getElementById('dlTopic').value = d.topic || '';
|
document.getElementById('dlTopic').value = d.topic || '';
|
||||||
document.getElementById('dlLaw').value = d.law_regulation || '';
|
document.getElementById('dlLaw').value = d.law_regulation || '';
|
||||||
document.getElementById('dlRecurrence').value = d.recurrence_type || 'once';
|
document.getElementById('dlRecurrence').value = d.recurrence_type || 'once';
|
||||||
document.getElementById('dlDocDate').value = d.document_date || '';
|
fpDocDate.setDate(d.document_date || null, false, 'Y-m-d');
|
||||||
document.getElementById('dlDueDate').value = d.due_date || '';
|
fpDueDate.setDate(d.due_date || null, false, 'Y-m-d');
|
||||||
document.getElementById('dlCheckDate').value = d.check_date || '';
|
fpCheckDate.setDate(d.check_date || null, false, 'Y-m-d');
|
||||||
document.getElementById('dlNotifDays').value = d.notification_days || 7;
|
document.getElementById('dlNotifDays').value = d.notification_days || 7;
|
||||||
document.getElementById('dlStorage').value = d.storage_location || '';
|
document.getElementById('dlStorage').value = d.storage_location || '';
|
||||||
document.getElementById('dlNotes').value = d.notes || '';
|
document.getElementById('dlNotes').value = d.notes || '';
|
||||||
@@ -1765,9 +1800,9 @@ function getContrastTextColor($hexColor)
|
|||||||
document.getElementById('dlTopic').value = d.topic || '';
|
document.getElementById('dlTopic').value = d.topic || '';
|
||||||
document.getElementById('dlLaw').value = d.law_regulation || '';
|
document.getElementById('dlLaw').value = d.law_regulation || '';
|
||||||
document.getElementById('dlRecurrence').value = d.recurrence_type || 'once';
|
document.getElementById('dlRecurrence').value = d.recurrence_type || 'once';
|
||||||
document.getElementById('dlDocDate').value = d.document_date || '';
|
fpDocDate.setDate(d.document_date || null, false, 'Y-m-d');
|
||||||
document.getElementById('dlDueDate').value = d.due_date || '';
|
fpDueDate.setDate(d.due_date || null, false, 'Y-m-d');
|
||||||
document.getElementById('dlCheckDate').value = d.check_date || '';
|
fpCheckDate.setDate(d.check_date || null, false, 'Y-m-d');
|
||||||
document.getElementById('dlNotifDays').value = d.notification_days || 7;
|
document.getElementById('dlNotifDays').value = d.notification_days || 7;
|
||||||
document.getElementById('dlStorage').value = d.storage_location || '';
|
document.getElementById('dlStorage').value = d.storage_location || '';
|
||||||
document.getElementById('dlNotes').value = d.notes || '';
|
document.getElementById('dlNotes').value = d.notes || '';
|
||||||
|
|||||||
Reference in New Issue
Block a user