fix: Update search functionality to use service_name for Rate Cards and improve invoice form script
This commit is contained in:
@@ -175,7 +175,7 @@
|
||||
<script>
|
||||
function invoiceForm() {
|
||||
return {
|
||||
items: [{ description: '{{ addslashes($invoiceSettings->default_service_description ?? '') }}', quantity: 1, unit_price: 0, is_taxable: true }],
|
||||
items: [{ description: @json($invoiceSettings->default_service_description ?? ''), quantity: 1, unit_price: 0, is_taxable: true }],
|
||||
taxRate: {{ $invoiceSettings->default_tax_rate ?? 11 }},
|
||||
get subtotal() {
|
||||
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user