fix: Update search functionality to use service_name for Rate Cards and improve invoice form script

This commit is contained in:
I-Fun
2026-04-01 22:08:45 +07:00
parent 22f03ccca7
commit 86176c99c7
3 changed files with 22 additions and 21 deletions

View File

@@ -252,24 +252,8 @@ document.addEventListener('DOMContentLoaded', function () {
if (e.target === this) this.classList.add('hidden');
});
// Combine date + time inputs into hidden datetime fields before submit
document.getElementById('new-event-form').addEventListener('submit', function(e) {
const startDate = document.getElementById('start_date').value;
const startTime = document.getElementById('start_time_input').value || '00:00';
const endDate = document.getElementById('end_date').value;
const endTime = document.getElementById('end_time_input').value || '00:00';
if (!startDate) {
e.preventDefault();
alert('Please select a start date.');
return;
}
document.getElementById('start_time_hidden').value = startDate + 'T' + startTime;
if (endDate) {
document.getElementById('end_time_hidden').value = endDate + 'T' + endTime;
}
});
// Note: datetime hidden fields are populated in contractCheck's submitIfClear()
// since @submit.prevent is used on the form (form.submit() bypasses native submit event)
});
</script>
@@ -299,6 +283,23 @@ function contractCheck(checkUrl) {
if (this.contractWarning) {
if (!confirm('⚠️ An exclusive contract is active for this category.\n\nAre you sure you want to proceed?')) return;
}
// Combine date + time inputs into the hidden datetime fields
// (form.submit() bypasses native 'submit' event, so we do it here)
const startDate = document.getElementById('start_date').value;
const startTime = document.getElementById('start_time_input').value || '00:00';
const endDate = document.getElementById('end_date').value;
const endTime = document.getElementById('end_time_input').value || '00:00';
if (!startDate) {
alert('Please select a start date.');
return;
}
document.getElementById('start_time_hidden').value = startDate + 'T' + startTime;
if (endDate) {
document.getElementById('end_time_hidden').value = endDate + 'T' + endTime;
}
form.submit();
}
};