Team 3 (Levoswitch Enrollment)
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m19s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m19s
Details
This commit is contained in:
parent
27637a2707
commit
fd76dcda75
|
|
@ -397,70 +397,12 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/* function preventDuplicateDoctors() {
|
||||
|
||||
let selectedValues = [];
|
||||
|
||||
// Get all selected doctor values
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
if (value) {
|
||||
selectedValues.push(value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Apply duplicate prevention
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let currentSelect = $(this);
|
||||
let currentValue = currentSelect.val();
|
||||
|
||||
currentSelect.find('option').each(function () {
|
||||
|
||||
let option = $(this);
|
||||
let optionValue = option.val();
|
||||
|
||||
if (!optionValue) return;
|
||||
|
||||
// Remove old text
|
||||
let cleanText = option.text().replace(' (Already Added)', '');
|
||||
|
||||
if (
|
||||
selectedValues.includes(optionValue) &&
|
||||
optionValue !== currentValue
|
||||
) {
|
||||
|
||||
option.prop('disabled', true);
|
||||
option.text(cleanText + ' (Already Added)');
|
||||
|
||||
} else {
|
||||
|
||||
option.prop('disabled', false);
|
||||
option.text(cleanText);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 🔥 IMPORTANT
|
||||
currentSelect.select2('destroy');
|
||||
|
||||
currentSelect.select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
} */
|
||||
|
||||
function preventDuplicateDoctors() {
|
||||
|
||||
let selectedValues = [];
|
||||
|
||||
// Collect selected values
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
|
|
@ -521,8 +463,47 @@
|
|||
|
||||
});
|
||||
|
||||
}
|
||||
} */
|
||||
|
||||
function preventDuplicateDoctors() {
|
||||
let selectedValues = [];
|
||||
|
||||
// Collect all selected doctor IDs (ignoring empty selections)
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
let val = $(this).val();
|
||||
if (val) {
|
||||
selectedValues.push(val);
|
||||
}
|
||||
});
|
||||
|
||||
// Update options for each select
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
let currentSelect = $(this);
|
||||
let currentValue = currentSelect.val();
|
||||
|
||||
currentSelect.find('option').each(function () {
|
||||
let option = $(this);
|
||||
let optionValue = option.val();
|
||||
|
||||
if (!optionValue) return;
|
||||
|
||||
// Clean previously appended text
|
||||
let originalText = option.text().replace(' (Already Added)', '').trim();
|
||||
|
||||
// If selected in another dropdown, disable it and add indicator
|
||||
if (selectedValues.includes(optionValue) && optionValue !== currentValue) {
|
||||
option.prop('disabled', true);
|
||||
option.text(originalText + ' (Already Added)');
|
||||
} else {
|
||||
option.prop('disabled', false);
|
||||
option.text(originalText);
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger change to update Select2 without destroying entire DOM binding
|
||||
currentSelect.trigger('change.select2');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).on('change', 'select[id^="field-contact_id"]', function () {
|
||||
|
|
@ -721,12 +702,20 @@
|
|||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
|
||||
var isEditMode = @json((bool)$id);
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
if (numberOfSubmission !=9) {
|
||||
/* if (numberOfSubmission !=9) {
|
||||
alert(`You must submit 10 Doctors for Levoswitch , Current Doctors : ${numberOfSubmission+1}`);
|
||||
return;
|
||||
} */
|
||||
|
||||
if (!isEditMode) {
|
||||
let currentTotal = $('.doctor-wrapper').length;
|
||||
if (currentTotal !== 10) {
|
||||
alert(`You must submit 10 Doctors for Levoswitch, Current Doctors: ${currentTotal}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue