Changes
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m28s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m28s
Details
This commit is contained in:
parent
ba46a82103
commit
f0f7e6ddde
|
|
@ -244,7 +244,10 @@
|
|||
@php
|
||||
$isSubmitted = ($question->code == 'month' && in_array(trim($option->value), $submittedMonths, true));
|
||||
$isSelected = (isset($question->value) && $question->value == $option->value);
|
||||
$isDisabled = ($isEditMode && $isSubmitted && !$isSelected);
|
||||
// Create: block already-submitted months. Edit: block other submitted months.
|
||||
$isDisabled = $question->code == 'month'
|
||||
? (($isEditMode && $isSubmitted && !$isSelected) || (!$isEditMode && $isSubmitted))
|
||||
: false;
|
||||
@endphp
|
||||
|
||||
@if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor')
|
||||
|
|
@ -258,7 +261,7 @@
|
|||
<option value="{{ $option->value }}"
|
||||
{{ $isSelected ? 'selected' : '' }}
|
||||
{{ $isDisabled ? 'disabled' : '' }}>
|
||||
{{ $option->display }}@if($isDisabled) (Already Submitted)@elseif($isSubmitted && !$isEditMode) (I want to change)@endif
|
||||
{{ $option->display }}@if($isSubmitted) (Already Submitted)@endif
|
||||
</option>
|
||||
@else
|
||||
<option value="{{ $option->value }}"
|
||||
|
|
@ -494,7 +497,15 @@
|
|||
}
|
||||
|
||||
$('#field-month').on('change', function () {
|
||||
applyMonth(String($(this).val() || ''));
|
||||
// Create flow: do not prefill/replace prior month submissions.
|
||||
// True edit (/form/edit?id=...) keeps existing values from the server.
|
||||
if ($('#report-form input[name="id"]').length) {
|
||||
return;
|
||||
}
|
||||
var replaceField = $('#field-replace_submission_id');
|
||||
if (replaceField.length) {
|
||||
replaceField.val('');
|
||||
}
|
||||
});
|
||||
|
||||
if ($('#report-form input[name="id"]').length) {
|
||||
|
|
@ -503,13 +514,6 @@
|
|||
|
||||
$('[data-toggle="select2"]').select2();
|
||||
var managerEntryMode = @json($form->manager_entry_mode ?? 'abm');
|
||||
var managerUserHierarchies = [
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
@foreach(($form->users ?? []) as $option)
|
||||
'{{ $option->hierarchy_id }}',
|
||||
@endforeach
|
||||
@endif
|
||||
].filter(Boolean);
|
||||
|
||||
function applySelect2ToDoctorDropdowns() {
|
||||
$("[id^='field-contact_id']").each(function () {
|
||||
|
|
@ -593,9 +597,6 @@
|
|||
select.val(String(existingVal)).trigger('change');
|
||||
}
|
||||
});
|
||||
if ($('#field-replace_submission_id').length && $('#field-month').val()) {
|
||||
applyMonth(String($('#field-month').val()));
|
||||
}
|
||||
}
|
||||
|
||||
function loadDoctorsForHierarchies(hierarchyIds) {
|
||||
|
|
@ -663,7 +664,31 @@
|
|||
});
|
||||
}
|
||||
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
function loadTmDoctorsForUser(userId) {
|
||||
if (!userId) {
|
||||
clearDoctorDropdowns();
|
||||
return;
|
||||
}
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/hierarchybelow?partition={{$form->partition}}&user_id=' + encodeURIComponent(userId),
|
||||
success: function (data) {
|
||||
var hierarchies = (data && data.hierarchies) ? data.hierarchies : [];
|
||||
var tmIds = hierarchies
|
||||
.filter(function (h) { return h && h.type === 'Territory' && h.id; })
|
||||
.map(function (h) { return h.id; });
|
||||
loadDoctorsForHierarchies(tmIds);
|
||||
},
|
||||
error: function (err) {
|
||||
console.log(err);
|
||||
clearDoctorDropdowns();
|
||||
$("#pageloader").fadeOut();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@if(!empty($form->manager_can_submit) || (($form->manager_entry_mode ?? '') === 'abm'))
|
||||
bindCityPinHandlers();
|
||||
if (managerEntryMode === 'rbm') {
|
||||
$('#field-user_id').on('change', function () {
|
||||
|
|
@ -674,26 +699,11 @@
|
|||
clearDoctorDropdowns();
|
||||
return;
|
||||
}
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/hierarchybelow?partition={{$form->partition}}&user_id=' + encodeURIComponent(abmUserId),
|
||||
success: function (data) {
|
||||
var hierarchies = (data && data.hierarchies) ? data.hierarchies : [];
|
||||
var tmIds = hierarchies
|
||||
.filter(function (h) { return h && h.type === 'Territory' && h.id; })
|
||||
.map(function (h) { return h.id; });
|
||||
loadDoctorsForHierarchies(tmIds);
|
||||
},
|
||||
error: function (err) {
|
||||
console.log(err);
|
||||
clearDoctorDropdowns();
|
||||
$("#pageloader").fadeOut();
|
||||
}
|
||||
});
|
||||
loadTmDoctorsForUser(abmUserId);
|
||||
});
|
||||
} else {
|
||||
loadDoctorsForHierarchies(managerUserHierarchies);
|
||||
// ABM: load all TM doctors under the logged-in ABM (do not rely on $form->users).
|
||||
loadTmDoctorsForUser(@json($form->user_id ?? ''));
|
||||
}
|
||||
@endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue