Merge pull request 'Changed logic in calender blade file' (#370) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 24s

Reviewed-on: #370
This commit was merged in pull request #370.
This commit is contained in:
2026-02-23 04:19:05 +00:00

View File

@@ -64,36 +64,6 @@ document.addEventListener('DOMContentLoaded', function () {
}); });
// function updateWorkingDays(date) {
// let totalDays = new Date(
// date.getFullYear(),
// date.getMonth()+1,
// 0
// ).getDate();
// let workingDays = totalDays - selectedDates.length;
// // document.querySelector('input[name="working_days"]').value = workingDays;
// const input = document.querySelector('#working_days');
// input.value = workingDays;
// input.dispatchEvent(new Event('input'));
// const monthInput = document.querySelector('#month');
// monthInput.value = date.getMonth() + 1; // 112 month number
// monthInput.dispatchEvent(new Event('input'));
// const yearInput = document.querySelector('#year');
// yearInput.value = date.getFullYear();
// yearInput.dispatchEvent(new Event('input'));
// const selectedDatesInput = document.querySelector('#selected_dates');
// selectedDatesInput.value = selectedDates.join(',');
// selectedDatesInput.dispatchEvent(new Event('input'));
// }
function updateWorkingDays(date) { function updateWorkingDays(date) {
let totalDays = new Date( let totalDays = new Date(
date.getFullYear(), date.getFullYear(),
@@ -102,19 +72,49 @@ document.addEventListener('DOMContentLoaded', function () {
).getDate(); ).getDate();
let workingDays = totalDays - selectedDates.length; let workingDays = totalDays - selectedDates.length;
// document.querySelector('input[name="working_days"]').value = workingDays;
// Set values only const input = document.querySelector('#working_days');
document.querySelector('#working_days').value = workingDays;
document.querySelector('#month').value = date.getMonth() + 1; input.value = workingDays;
document.querySelector('#year').value = date.getFullYear();
document.querySelector('#selected_dates').value = selectedDates.join(','); input.dispatchEvent(new Event('input'));
const monthInput = document.querySelector('#month');
monthInput.value = date.getMonth() + 1; // 112 month number
monthInput.dispatchEvent(new Event('input'));
const yearInput = document.querySelector('#year');
yearInput.value = date.getFullYear();
yearInput.dispatchEvent(new Event('input'));
const selectedDatesInput = document.querySelector('#selected_dates');
selectedDatesInput.value = selectedDates.join(',');
selectedDatesInput.dispatchEvent(new Event('input'));
// Trigger only ONE update (important)
document
.querySelector('#selected_dates')
.dispatchEvent(new Event('input'));
} }
// function updateWorkingDays(date) {
// let totalDays = new Date(
// date.getFullYear(),
// date.getMonth() + 1,
// 0
// ).getDate();
// let workingDays = totalDays - selectedDates.length;
// // Set values only
// document.querySelector('#working_days').value = workingDays;
// document.querySelector('#month').value = date.getMonth() + 1;
// document.querySelector('#year').value = date.getFullYear();
// document.querySelector('#selected_dates').value = selectedDates.join(',');
// // Trigger only ONE update (important)
// document
// .querySelector('#selected_dates')
// .dispatchEvent(new Event('input'));
// }
calendar.render(); calendar.render();
}); });