Team 4 (Mother Form New)
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m40s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m40s
Details
This commit is contained in:
parent
46d2d566b8
commit
8a41c9feae
|
|
@ -459,19 +459,19 @@
|
|||
$('#field-expecteed_value_total').val(total)
|
||||
})
|
||||
|
||||
$('#field-tm_contact').on('input', function () {
|
||||
let mobile = $(this).val();
|
||||
$('#field-tm_contact').on('input', function () {
|
||||
let mobile = $(this).val();
|
||||
|
||||
// Allow only digits
|
||||
mobile = mobile.replace(/\D/g, '');
|
||||
// Allow only digits
|
||||
mobile = mobile.replace(/\D/g, '');
|
||||
|
||||
// Limit to 10 digits
|
||||
if (mobile.length > 10) {
|
||||
mobile = mobile.slice(0, 10);
|
||||
}
|
||||
// Limit to 10 digits
|
||||
if (mobile.length > 10) {
|
||||
mobile = mobile.slice(0, 10);
|
||||
}
|
||||
|
||||
$(this).val(mobile);
|
||||
});
|
||||
$(this).val(mobile);
|
||||
});
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
|
|
@ -676,7 +676,7 @@ $(document).on('input', '[id^=field-expected_value_kid_tab], [id^=field-expected
|
|||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
{{-- <script>
|
||||
// 👉 Prevent duplicate doctor selection
|
||||
$(document).on('change', '[id^=field-contact_id]', function () {
|
||||
|
||||
|
|
@ -712,7 +712,84 @@ $(document).on('change', '[id^=field-contact_id]', function () {
|
|||
$wrapper.find('[id^=field-legacy_code]').val('');
|
||||
}
|
||||
});
|
||||
</script> --}}
|
||||
|
||||
<script>
|
||||
// =========================================================
|
||||
// New CODE: DUPLICATE DOCTOR CHECK & '(Already Added)' TEXT
|
||||
// =========================================================
|
||||
|
||||
// 1. Function: All dropdowns options dynamic update
|
||||
function updateDoctorDropdownOptions() {
|
||||
let selectedDoctors = [];
|
||||
|
||||
// Currently selected doctors shodha
|
||||
$('[id^=field-contact_id]').each(function () {
|
||||
let val = $(this).val();
|
||||
let text = $(this).find('option:selected').text().replace(' (Already Added)', '').trim();
|
||||
|
||||
if (val && text !== '-- Select --') {
|
||||
selectedDoctors.push({ val: val, text: text });
|
||||
}
|
||||
});
|
||||
|
||||
// Update status in every wrappers dropdown
|
||||
$('[id^=field-contact_id]').each(function () {
|
||||
let $currentSelect = $(this);
|
||||
let currentVal = $currentSelect.val();
|
||||
|
||||
$currentSelect.find('option').each(function () {
|
||||
let $opt = $(this);
|
||||
let optVal = $opt.val();
|
||||
let cleanText = $opt.text().replace(' (Already Added)', '').trim();
|
||||
|
||||
if (!optVal || optVal === '') return;
|
||||
|
||||
// Check in other wheter this doctor is selected in previous wrapper
|
||||
let isSelectedElsewhere = selectedDoctors.some(d =>
|
||||
(d.val === optVal || d.text === cleanText) && d.val !== currentVal
|
||||
);
|
||||
|
||||
if (isSelectedElsewhere) {
|
||||
$opt.text(cleanText + ' (Already Added)');
|
||||
} else {
|
||||
$opt.text(cleanText);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 2. Change Event: Selection change after validate & update
|
||||
$(document).on('change', '[id^=field-contact_id]', function () {
|
||||
let currentSelect = $(this);
|
||||
let currentWrapper = currentSelect.closest('.doctor-wrapper');
|
||||
let selectedOption = currentSelect.find('option:selected');
|
||||
let currentText = selectedOption.text();
|
||||
|
||||
if (currentText.includes('(Already Added)')) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Duplicate Doctor',
|
||||
text: 'Ha doctor aadhich dusrya wrapper madhye add kela aahe.'
|
||||
});
|
||||
|
||||
currentSelect.val('');
|
||||
currentWrapper.find('[id^=field-speciality]').val('');
|
||||
currentWrapper.find('[id^=field-legacy_code]').val('');
|
||||
}
|
||||
|
||||
// Update in eevry dropdown
|
||||
updateDoctorDropdownOptions();
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
updateDoctorDropdownOptions();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@endif
|
||||
|
||||
@if($id)
|
||||
|
|
|
|||
Loading…
Reference in New Issue