Team 2 (Report Ace-Code by Ravi)
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m15s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m15s
Details
This commit is contained in:
parent
82ec3691a0
commit
81e5c3bf8f
|
|
@ -45,6 +45,8 @@
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||||
|
$defaultHierarchyId = $form->hierarchy_id ?? $form->hierarchy ?? '';
|
||||||
|
$formUsersForJs = isset($form->users) ? array_values((array) $form->users) : [];
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<div class="col-12" id="table-wrapper">
|
<div class="col-12" id="table-wrapper">
|
||||||
|
|
@ -140,6 +142,8 @@
|
||||||
</select>
|
</select>
|
||||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||||
</div>
|
</div>
|
||||||
|
@elseif(!empty($defaultHierarchyId))
|
||||||
|
<input type="hidden" name="hierarchy_id" value="{{ $defaultHierarchyId }}">
|
||||||
@endif
|
@endif
|
||||||
@foreach ($questions as $question)
|
@foreach ($questions as $question)
|
||||||
@if (in_array($question->code, ['execution_date','actual_no_of_attendees' ,'hcp_name','pcode_of_wrapper_doctor','speaker_name']))
|
@if (in_array($question->code, ['execution_date','actual_no_of_attendees' ,'hcp_name','pcode_of_wrapper_doctor','speaker_name']))
|
||||||
|
|
@ -413,13 +417,21 @@
|
||||||
<script src="{{ asset('assets/libs/select2/select2.min.js') }}"></script>
|
<script src="{{ asset('assets/libs/select2/select2.min.js') }}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
|
var defaultHierarchyId = @json($defaultHierarchyId);
|
||||||
|
var formUsers = @json($formUsersForJs);
|
||||||
|
|
||||||
$('#form-wrapper').hide()
|
$('#form-wrapper').hide()
|
||||||
$('#execution-form-wrapper').hide();
|
$('#execution-form-wrapper').hide();
|
||||||
$('[data-toggle="select2"]').select2();
|
$('[data-toggle="select2"]').select2();
|
||||||
$('#field-user_id').change(function() {
|
$('#field-user_id').change(function() {
|
||||||
|
let hierarchy = String($('option:selected', this).attr('hierarchy') || '').trim();
|
||||||
|
$('#field-hierarchy_id').val(hierarchy);
|
||||||
|
|
||||||
|
if (!hierarchy || hierarchy === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$("#pageloader").fadeIn();
|
$("#pageloader").fadeIn();
|
||||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
|
||||||
$('#field-hierarchy_id').val(hierarchy)
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
|
|
@ -485,6 +497,9 @@
|
||||||
|
|
||||||
$('#field-name_of_additional_speaker').select2();
|
$('#field-name_of_additional_speaker').select2();
|
||||||
|
|
||||||
|
bindAdditionalSpeakerExclusion();
|
||||||
|
syncAdditionalSpeakerExclusion();
|
||||||
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -497,27 +512,70 @@
|
||||||
var count = 1
|
var count = 1
|
||||||
let executionHierarchyId = '';
|
let executionHierarchyId = '';
|
||||||
let executionPlanDetails = null;
|
let executionPlanDetails = null;
|
||||||
|
let cachedExecutionDoctors = null;
|
||||||
|
let doctorGroupTemplate = $('.doctor-group').first().html();
|
||||||
|
let executionDoctorGroupTemplate = null;
|
||||||
|
|
||||||
|
function getExecutionDoctorGroupTemplate() {
|
||||||
|
if (!executionDoctorGroupTemplate) {
|
||||||
|
let $wrap = $('<div>').html(doctorGroupTemplate);
|
||||||
|
$wrap.find('#field-speaker_name, label[for="field-speaker_name"]').remove();
|
||||||
|
executionDoctorGroupTemplate = $wrap.html();
|
||||||
|
}
|
||||||
|
return executionDoctorGroupTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renameDoctorGroupFields(html, attendeeCount) {
|
||||||
|
return html
|
||||||
|
.replace(/id="field-hcp_name"/g, 'id="field-hcp_name_' + attendeeCount + '"')
|
||||||
|
.replace(/name="hcp_name"/g, 'name="hcp_name_' + attendeeCount + '"')
|
||||||
|
.replace(/for="field-hcp_name"/g, 'for="field-hcp_name_' + attendeeCount + '"')
|
||||||
|
.replace(/id="field-pcode_of_wrapper_doctor"/g, 'id="field-pcode_of_wrapper_doctor_' + attendeeCount + '"')
|
||||||
|
.replace(/name="pcode_of_wrapper_doctor"/g, 'name="pcode_of_wrapper_doctor_' + attendeeCount + '"')
|
||||||
|
.replace(/for="field-pcode_of_wrapper_doctor"/g, 'for="field-pcode_of_wrapper_doctor_' + attendeeCount + '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
function stripSelect2Artifacts($container) {
|
||||||
|
$container.find('select.doctor_select').each(function() {
|
||||||
|
var $select = $(this);
|
||||||
|
if ($select.hasClass('select2-hidden-accessible')) {
|
||||||
|
$select.select2('destroy');
|
||||||
|
}
|
||||||
|
$select.removeClass('select2-hidden-accessible')
|
||||||
|
.removeAttr('data-select2-id')
|
||||||
|
.removeAttr('tabindex')
|
||||||
|
.removeAttr('aria-hidden');
|
||||||
|
});
|
||||||
|
$container.find('span.select2-container').remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
function collectCurrentHcpValues() {
|
||||||
|
var values = {};
|
||||||
|
$('#execution-form-wrapper select[id^="field-hcp_name"]').each(function() {
|
||||||
|
var fieldName = $(this).attr('name');
|
||||||
|
if (fieldName) {
|
||||||
|
values[fieldName] = $(this).val() || '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
function fillHcpSelect($select, doctors, selectedValue) {
|
function fillHcpSelect($select, doctors, selectedValue) {
|
||||||
|
if ($select.hasClass('select2-hidden-accessible')) {
|
||||||
|
$select.select2('destroy');
|
||||||
|
}
|
||||||
|
|
||||||
$select.html('');
|
$select.html('');
|
||||||
$select.append($("<option></option>").attr("value", '').text('-- Select --'));
|
$select.append($("<option></option>").attr("value", '').text('-- Select --'));
|
||||||
for (let itm of doctors) {
|
for (let itm of doctors) {
|
||||||
if (itm.contact && itm.contact.type == 'doctor') {
|
if (itm.contact && itm.contact.type == 'doctor') {
|
||||||
$select.append(
|
$select.append(
|
||||||
$("<option></option>")
|
$("<option></option>")
|
||||||
.attr("value", itm.display)
|
.attr("value", itm.display)
|
||||||
.text(itm.display)
|
.text(itm.display)
|
||||||
.attr("msl_code", (itm.contact && itm.contact.msl_code) ? itm.contact.msl_code : '')
|
.attr("msl_code", (itm.contact && itm.contact.msl_code) ? itm.contact.msl_code : '')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($select.hasClass('select2-hidden-accessible')) {
|
|
||||||
$select.trigger('change');
|
|
||||||
} else {
|
|
||||||
$select.select2({
|
|
||||||
width: '100%'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!selectedValue) {
|
if (!selectedValue) {
|
||||||
|
|
@ -525,9 +583,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
let normalized = String(selectedValue).trim();
|
let normalized = String(selectedValue).trim();
|
||||||
let $byValue = $select.find('option[value="' + normalized.replace(/"/g, '\\"') + '"]');
|
let $byValue = $select.find('option').filter(function() {
|
||||||
|
return String($(this).val()).trim() === normalized;
|
||||||
|
});
|
||||||
if ($byValue.length) {
|
if ($byValue.length) {
|
||||||
$select.val(normalized);
|
$select.val($byValue.first().val());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -537,8 +597,6 @@
|
||||||
if ($byText.length) {
|
if ($byText.length) {
|
||||||
$select.val($byText.first().val());
|
$select.val($byText.first().val());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindHcpPcodeLinkage($hcpSelect) {
|
function bindHcpPcodeLinkage($hcpSelect) {
|
||||||
|
|
@ -563,8 +621,27 @@
|
||||||
// NEW CODE END
|
// NEW CODE END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applyHcpDoctorDropdowns(data, selectedValues) {
|
||||||
|
$('#execution-form-wrapper select[id^="field-hcp_name"]').each(function() {
|
||||||
|
let $select = $(this);
|
||||||
|
let fieldName = $select.attr('name');
|
||||||
|
let selectedVal = selectedValues && selectedValues[fieldName] ? selectedValues[fieldName] : '';
|
||||||
|
fillHcpSelect($select, data, selectedVal);
|
||||||
|
bindHcpPcodeLinkage($select);
|
||||||
|
if (selectedVal) {
|
||||||
|
$select.trigger('change.hcpPcode');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
bindUniqueDoctorSelection();
|
||||||
|
}
|
||||||
|
|
||||||
function loadHcpDoctorDropdowns(selectedValues) {
|
function loadHcpDoctorDropdowns(selectedValues) {
|
||||||
if (!executionHierarchyId) {
|
if (!executionHierarchyId || executionHierarchyId === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cachedExecutionDoctors) {
|
||||||
|
applyHcpDoctorDropdowns(cachedExecutionDoctors, selectedValues);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -574,19 +651,8 @@
|
||||||
url: '/form/getdoctorlist?partition={{ $form->partition }}&hierarchy=' + executionHierarchyId,
|
url: '/form/getdoctorlist?partition={{ $form->partition }}&hierarchy=' + executionHierarchyId,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#pageloader").fadeOut();
|
$("#pageloader").fadeOut();
|
||||||
$('.doctor-group').each(function() {
|
cachedExecutionDoctors = data;
|
||||||
$(this).find('select.doctor_select[id^="field-hcp_name"]').each(function() {
|
applyHcpDoctorDropdowns(data, selectedValues);
|
||||||
let $select = $(this);
|
|
||||||
let fieldName = $select.attr('name');
|
|
||||||
let selectedVal = selectedValues && selectedValues[fieldName] ? selectedValues[fieldName] : '';
|
|
||||||
fillHcpSelect($select, data, selectedVal);
|
|
||||||
bindHcpPcodeLinkage($select);
|
|
||||||
if (selectedVal) {
|
|
||||||
$select.trigger('change.hcpPcode');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
bindUniqueDoctorSelection(); // <-- Add this line
|
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
$("#pageloader").fadeOut();
|
$("#pageloader").fadeOut();
|
||||||
|
|
@ -647,24 +713,24 @@
|
||||||
|
|
||||||
$(document).off(
|
$(document).off(
|
||||||
'change.uniqueDoctor',
|
'change.uniqueDoctor',
|
||||||
'select[id^="field-hcp_name"]'
|
'#execution-form-wrapper select[id^="field-hcp_name"]'
|
||||||
);
|
);
|
||||||
|
|
||||||
$(document).on(
|
$(document).on(
|
||||||
'change.uniqueDoctor',
|
'change.uniqueDoctor',
|
||||||
'select[id^="field-hcp_name"]',
|
'#execution-form-wrapper select[id^="field-hcp_name"]',
|
||||||
function() {
|
function() {
|
||||||
|
|
||||||
let selectedDoctors = [];
|
let selectedDoctors = [];
|
||||||
|
|
||||||
$('select[id^="field-hcp_name"]').each(function() {
|
$('#execution-form-wrapper select[id^="field-hcp_name"]').each(function() {
|
||||||
let val = $(this).val();
|
let val = $(this).val();
|
||||||
if (val) {
|
if (val) {
|
||||||
selectedDoctors.push(val);
|
selectedDoctors.push(val);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('select[id^="field-hcp_name"]').each(function() {
|
$('#execution-form-wrapper select[id^="field-hcp_name"]').each(function() {
|
||||||
|
|
||||||
let currentVal = $(this).val();
|
let currentVal = $(this).val();
|
||||||
|
|
||||||
|
|
@ -689,7 +755,115 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$('select[id^="field-hcp_name"]').trigger('change.uniqueDoctor');
|
$('#execution-form-wrapper select[id^="field-hcp_name"]').trigger('change.uniqueDoctor');
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncAdditionalSpeakerExclusion() {
|
||||||
|
var $speaker = $('#field-contact_id');
|
||||||
|
var $additional = $('#field-name_of_additional_speaker');
|
||||||
|
|
||||||
|
if (!$speaker.length || !$additional.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var selectedSpeaker = ($speaker.val() || '').trim();
|
||||||
|
|
||||||
|
$additional.find('option').each(function() {
|
||||||
|
var optionVal = ($(this).val() || '').trim();
|
||||||
|
if (!optionVal) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).prop('disabled', optionVal === selectedSpeaker);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (selectedSpeaker && ($additional.val() || '').trim() === selectedSpeaker) {
|
||||||
|
$additional.val('');
|
||||||
|
$('#field-additional_speaker_pcode').val('');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($additional.hasClass('select2-hidden-accessible')) {
|
||||||
|
$additional.trigger('change.select2');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindAdditionalSpeakerExclusion() {
|
||||||
|
$('#field-contact_id')
|
||||||
|
.off('change.speakerExclusion')
|
||||||
|
.on('change.speakerExclusion', function() {
|
||||||
|
syncAdditionalSpeakerExclusion();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#field-name_of_additional_speaker')
|
||||||
|
.off('change.speakerExclusion')
|
||||||
|
.on('change.speakerExclusion', function() {
|
||||||
|
var speakerVal = ($('#field-contact_id').val() || '').trim();
|
||||||
|
var additionalVal = ($(this).val() || '').trim();
|
||||||
|
|
||||||
|
if (speakerVal && additionalVal === speakerVal) {
|
||||||
|
$(this).val('');
|
||||||
|
$('#field-additional_speaker_pcode').val('');
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'warning',
|
||||||
|
title: 'Invalid selection',
|
||||||
|
text: 'Additional Speaker cannot be the same as Speaker Name.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveExecutionHierarchyId(selected) {
|
||||||
|
var hierarchyId = String(
|
||||||
|
selected.hierarchy_id || selected.hierarchy || defaultHierarchyId || ''
|
||||||
|
).trim();
|
||||||
|
|
||||||
|
if ((!hierarchyId || hierarchyId === 'undefined') && selected.manager_id && Array.isArray(formUsers)) {
|
||||||
|
var manager = formUsers.find(function(user) {
|
||||||
|
return String(user.value) === String(selected.manager_id);
|
||||||
|
});
|
||||||
|
if (manager && manager.hierarchy_id) {
|
||||||
|
hierarchyId = String(manager.hierarchy_id).trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hierarchyId && hierarchyId !== 'undefined' ? hierarchyId : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function setExecutionReadonlySelect(selectId, displayText, valueId) {
|
||||||
|
var $select = $(selectId);
|
||||||
|
if (!$select.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = String(displayText || '').trim();
|
||||||
|
var value = String(valueId || '').trim();
|
||||||
|
|
||||||
|
if (!text && !value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var $match = $();
|
||||||
|
if (value) {
|
||||||
|
$match = $select.find('option').filter(function() {
|
||||||
|
return String($(this).val()).trim() === value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!$match.length && text) {
|
||||||
|
$match = $select.find('option').filter(function() {
|
||||||
|
return $(this).text().trim() === text;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($match.length) {
|
||||||
|
$select.val($match.first().val());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var optionValue = value || text;
|
||||||
|
$select.append(
|
||||||
|
$('<option></option>').attr('value', optionValue).text(text || optionValue)
|
||||||
|
);
|
||||||
|
$select.val(optionValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*function renderExecutionDoctorGroups(attendees) {
|
/*function renderExecutionDoctorGroups(attendees) {
|
||||||
|
|
@ -729,7 +903,12 @@
|
||||||
|
|
||||||
|
|
||||||
function renderExecutionDoctorGroups(attendees) {
|
function renderExecutionDoctorGroups(attendees) {
|
||||||
|
let currentValues = collectCurrentHcpValues();
|
||||||
|
let selectedValues = Object.assign({}, executionPlanDetails || {}, currentValues);
|
||||||
|
let attendeeTemplate = getExecutionDoctorGroupTemplate();
|
||||||
|
|
||||||
$('.execution-doctor-group-wrapper').empty();
|
$('.execution-doctor-group-wrapper').empty();
|
||||||
|
stripSelect2Artifacts($('#execution-form-wrapper'));
|
||||||
|
|
||||||
if (attendees <= 0) {
|
if (attendees <= 0) {
|
||||||
$('.doctor-group-wrapper').hide();
|
$('.doctor-group-wrapper').hide();
|
||||||
|
|
@ -738,22 +917,14 @@
|
||||||
|
|
||||||
$('.doctor-group-wrapper').show();
|
$('.doctor-group-wrapper').show();
|
||||||
|
|
||||||
let firstGroup = $('.doctor-group').first();
|
let $firstGroup = $('.doctor-group').first();
|
||||||
firstGroup.find('select.doctor_select').val('');
|
$firstGroup.html(attendeeTemplate);
|
||||||
firstGroup.find('input[type=text]').val('');
|
|
||||||
|
|
||||||
for (let attendeeCount = 2; attendeeCount <= attendees; attendeeCount++) {
|
for (let attendeeCount = 2; attendeeCount <= attendees; attendeeCount++) {
|
||||||
|
let doctor_html = renameDoctorGroupFields(attendeeTemplate, attendeeCount);
|
||||||
let doctor_html = firstGroup.html();
|
|
||||||
|
|
||||||
doctor_html = doctor_html.replaceAll('hcp_name', 'hcp_name_' + attendeeCount);
|
|
||||||
doctor_html = doctor_html.replaceAll('pcode_of_wrapper_doctor', 'pcode_of_wrapper_doctor_' + attendeeCount);
|
|
||||||
doctor_html = doctor_html.replaceAll('speaker_name', 'speaker_name_' + attendeeCount);
|
|
||||||
|
|
||||||
let tempDiv = $('<div>').html(doctor_html);
|
let tempDiv = $('<div>').html(doctor_html);
|
||||||
|
|
||||||
tempDiv.find('label').each(function() {
|
tempDiv.find('label').each(function() {
|
||||||
|
|
||||||
let labelText = $(this).clone()
|
let labelText = $(this).clone()
|
||||||
.children()
|
.children()
|
||||||
.remove()
|
.remove()
|
||||||
|
|
@ -762,34 +933,20 @@
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
if (labelText === 'HCP Name') {
|
if (labelText === 'HCP Name') {
|
||||||
$(this).contents().first()[0].textContent =
|
$(this).contents().first()[0].textContent = 'HCP Name ' + attendeeCount + ' ';
|
||||||
'HCP Name ' + attendeeCount + ' ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labelText === 'P Code') {
|
if (labelText === 'P Code') {
|
||||||
$(this).contents().first()[0].textContent =
|
$(this).contents().first()[0].textContent = 'P Code ' + attendeeCount + ' ';
|
||||||
'P Code ' + attendeeCount + ' ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labelText === 'Speaker/ Attendee') {
|
|
||||||
$(this).contents().first()[0].textContent =
|
|
||||||
'Speaker/ Attendee ' + attendeeCount + ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
doctor_html = tempDiv.html();
|
|
||||||
|
|
||||||
$('.execution-doctor-group-wrapper').append(
|
$('.execution-doctor-group-wrapper').append(
|
||||||
'<div class="doctor-group row">' + doctor_html + '</div>'
|
'<div class="doctor-group row">' + tempDiv.html() + '</div>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadHcpDoctorDropdowns(executionPlanDetails);
|
loadHcpDoctorDropdowns(selectedValues);
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
bindUniqueDoctorSelection();
|
|
||||||
}, 200);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -879,152 +1036,45 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
let selected = JSON.parse($(this).attr('plan_details'));
|
let selected = JSON.parse($(this).attr('plan_details'));
|
||||||
executionHierarchyId = selected['hierarchy_id'] || '';
|
executionHierarchyId = resolveExecutionHierarchyId(selected);
|
||||||
executionPlanDetails = selected;
|
executionPlanDetails = selected;
|
||||||
|
cachedExecutionDoctors = null;
|
||||||
|
|
||||||
|
if (selected['contact_id']) {
|
||||||
|
selected['contact_id'] = selected['contact_id'].trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let k of Object.keys(selected)) {
|
||||||
|
if (selected[k] === '' || selected[k] === null || selected[k] === undefined) {
|
||||||
|
continue;
|
||||||
if (selected['contact_id']) {
|
|
||||||
selected['contact_id'] = selected['contact_id'].trim();
|
|
||||||
}
|
|
||||||
console.log("Selected Doctor:", selected['contact_id']);
|
|
||||||
console.log("selected : ",selected);
|
|
||||||
|
|
||||||
|
|
||||||
/* for (let k of Object.keys(selected)) {
|
|
||||||
//console.log("k",k);
|
|
||||||
if (selected[k] != '') {
|
|
||||||
if (k == 'contact_id') {
|
|
||||||
//$("#execution-contact_id option:contains(" + selected[k] + ")").prop('selected', true)
|
|
||||||
// console.log($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'))
|
|
||||||
$('#execution-contact_id').val($("#execution-contact_id option:contains(" +
|
|
||||||
selected[k] + ")").attr('value'));
|
|
||||||
} else if (k == 'upload_photo_1' || k == 'upload_photo_2') {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
$('#execution-' + k).val(selected[k]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if(selected[k] != '')
|
|
||||||
// $('#execution-'+k).val(selected[k]);
|
|
||||||
} */
|
|
||||||
|
|
||||||
for (let k of Object.keys(selected)) {
|
|
||||||
if (selected[k] != '') {
|
|
||||||
if (k == 'contact_id') {
|
|
||||||
console.log('insie')
|
|
||||||
console.log(selected['hierarchy_id'])
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy=' + selected['hierarchy_id'],
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
success: function(data) {
|
|
||||||
$("#pageloader").fadeOut();
|
|
||||||
$('#execution-contact_id').html('')
|
|
||||||
$('#execution-contact_id').append(
|
|
||||||
$("<option></option>").attr("value", '').text('-- Select --')
|
|
||||||
);
|
|
||||||
|
|
||||||
for (var itm of data) {
|
|
||||||
$('#execution-contact_id').append(
|
|
||||||
$("<option></option>").attr("value", itm.value).text(itm.display)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var targetText = selected[k];
|
|
||||||
var option = $("#execution-contact_id option").filter(function() {
|
|
||||||
return $(this).text().trim() === targetText;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (option.length) {
|
|
||||||
$('#execution-contact_id').val(option.val());
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('actual con', selected[k]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (k == 'name_of_additional_speaker') {
|
|
||||||
console.log('insie')
|
|
||||||
console.log(selected['hierarchy_id'])
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy=' + selected['hierarchy_id'],
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
success: function(data) {
|
|
||||||
$("#pageloader").fadeOut();
|
|
||||||
$('#execution-name_of_additional_speaker').html('')
|
|
||||||
$('#execution-name_of_additional_speaker').append(
|
|
||||||
$("<option></option>").attr("value", '').text('-- Select --')
|
|
||||||
);
|
|
||||||
|
|
||||||
for (var itm of data) {
|
|
||||||
$('#execution-name_of_additional_speaker').append(
|
|
||||||
$("<option></option>").attr("value", itm.value).text(itm.display)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var targetText = selected[k];
|
|
||||||
var option = $("#execution-name_of_additional_speaker option").filter(function() {
|
|
||||||
return $(this).text().trim() === targetText;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (option.length) {
|
|
||||||
$('#execution-name_of_additional_speaker').val(option.val());
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('actual additional con', selected[k]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (k == 'upload_photo_1' || k == 'upload_photo_2') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#execution-' + k).val(selected[k]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (k === 'contact_id') {
|
||||||
|
setExecutionReadonlySelect(
|
||||||
|
'#execution-contact_id',
|
||||||
|
selected[k],
|
||||||
|
selected.cont_id || selected.contact_uuid || ''
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let docid = $('#execution-contact_id option').map(function() {
|
if (k === 'name_of_additional_speaker') {
|
||||||
if ($(this).text().trim() == selected['contact_id'] || $(this).val().trim() == selected['cont_id']) return this;
|
setExecutionReadonlySelect(
|
||||||
}).attr('value')
|
'#execution-name_of_additional_speaker',
|
||||||
|
selected[k],
|
||||||
console.log("docid",docid);
|
selected.additional_speaker_id || selected.cont_id_2 || ''
|
||||||
|
);
|
||||||
$('#execution-contact_id').val(docid)
|
continue;
|
||||||
|
}
|
||||||
$('#execution-id').val(selected['id'])
|
|
||||||
|
|
||||||
|
|
||||||
let docid2 = $('#execution-name_of_additional_speaker option').map(function() {
|
|
||||||
if ($(this).text().trim() == selected['name_of_additional_speaker'] || $(this).val().trim() == selected['cont_id']) return this;
|
|
||||||
}).attr('value')
|
|
||||||
|
|
||||||
console.log("docid2",docid2);
|
|
||||||
|
|
||||||
$('#execution-name_of_additional_speaker').val(docid2)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (k === 'upload_photo_1' || k === 'upload_photo_2') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#execution-' + k).val(selected[k]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#execution-id').val(selected['id']);
|
||||||
if(selected['contact_id']==='Other'){
|
if(selected['contact_id']==='Other'){
|
||||||
$('#execution-name_of_other_doctor,#execution-pcode_of_other_doctor').parent().show();
|
$('#execution-name_of_other_doctor,#execution-pcode_of_other_doctor').parent().show();
|
||||||
$('#execution-name_of_other_doctor,#execution-pcode_of_other_doctor').prop({"required":true});
|
$('#execution-name_of_other_doctor,#execution-pcode_of_other_doctor').prop({"required":true});
|
||||||
|
|
@ -1078,6 +1128,18 @@
|
||||||
|
|
||||||
$('#report-form').on('submit', function(event) {
|
$('#report-form').on('submit', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
var speakerVal = ($('#field-contact_id').val() || '').trim();
|
||||||
|
var additionalVal = ($('#field-name_of_additional_speaker').val() || '').trim();
|
||||||
|
if (speakerVal && additionalVal && speakerVal === additionalVal) {
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'warning',
|
||||||
|
title: 'Invalid selection',
|
||||||
|
text: 'Additional Speaker cannot be the same as Speaker Name.'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$("#pageloader").fadeIn();
|
$("#pageloader").fadeIn();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
@ -1150,6 +1212,9 @@
|
||||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
bindAdditionalSpeakerExclusion();
|
||||||
|
syncAdditionalSpeakerExclusion();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#execution-form').on('submit', function(event) {
|
$('#execution-form').on('submit', function(event) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue