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
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:
@@ -64,57 +64,57 @@ 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; // 1–12 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) {
|
||||
let totalDays = new Date(
|
||||
date.getFullYear(),
|
||||
date.getMonth() + 1,
|
||||
date.getMonth()+1,
|
||||
0
|
||||
).getDate();
|
||||
|
||||
let workingDays = totalDays - selectedDates.length;
|
||||
// document.querySelector('input[name="working_days"]').value = workingDays;
|
||||
|
||||
// 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(',');
|
||||
const input = document.querySelector('#working_days');
|
||||
|
||||
input.value = workingDays;
|
||||
|
||||
input.dispatchEvent(new Event('input'));
|
||||
|
||||
const monthInput = document.querySelector('#month');
|
||||
monthInput.value = date.getMonth() + 1; // 1–12 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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user