Team 2 (Purview Doctor Tagging) ABM Doctor Loading
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m45s Details

This commit is contained in:
zeeshan 2026-10-08 13:00:25 +05:30
parent 0f5a74dd03
commit 9a90988556
1 changed files with 35 additions and 4 deletions

View File

@ -237,7 +237,7 @@
// Loop through contacts and append options to select elements whose id starts with 'field-contact_id'
// We assume contact_id fields may be suffixed, e.g. field-contact_id_1, field-contact_id, etc.
function applySelect2ToDoctorDropdowns() {
$("[id^='field-contact_id']").each(function () {
$("select[id^='field-contact_id']").each(function () {
var select = $(this);
// Avoid re-initializing select2
if (select.data("select2")) return;
@ -249,7 +249,7 @@
});
}
function enforceUniqueDoctorSelections() {
/* function enforceUniqueDoctorSelections() {
var selectedValues = [];
// Collect selected values (ignore empty)
@ -279,9 +279,40 @@
currentSelect.trigger("change.select2");
}
});
}
} */
$("[id^='field-contact_id']").each(function() {
function enforceUniqueDoctorSelections() {
var selectedValues = [];
// Collect selected values from select dropdowns only
$("select[id^='field-contact_id']").each(function () {
var v = $(this).val();
if (v) selectedValues.push(String(v));
});
// Reset all option disabled states, then disable duplicates across selects
$("select[id^='field-contact_id']").each(function () {
var currentSelect = $(this);
var currentVal = currentSelect.val() ? String(currentSelect.val()) : "";
currentSelect.find("option").prop("disabled", false);
selectedValues.forEach(function (v) {
if (v && v !== currentVal) {
currentSelect
.find("option[value=\"" + v.replace(/"/g, '\\"') + "\"]")
.prop("disabled", true);
}
});
if (currentSelect.data("select2")) {
currentSelect.trigger("change.select2");
}
});
}
$("select[id^='field-contact_id']").each(function() {
var select = $(this);
// Clear previous options
select.html('');