Changes
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m28s Details

This commit is contained in:
Ravi Gulhane 2026-11-22 17:20:30 +05:30
parent ba46a82103
commit f0f7e6ddde
1 changed files with 42 additions and 32 deletions

View File

@ -244,7 +244,10 @@
@php @php
$isSubmitted = ($question->code == 'month' && in_array(trim($option->value), $submittedMonths, true)); $isSubmitted = ($question->code == 'month' && in_array(trim($option->value), $submittedMonths, true));
$isSelected = (isset($question->value) && $question->value == $option->value); $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 @endphp
@if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor') @if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor')
@ -258,7 +261,7 @@
<option value="{{ $option->value }}" <option value="{{ $option->value }}"
{{ $isSelected ? 'selected' : '' }} {{ $isSelected ? 'selected' : '' }}
{{ $isDisabled ? 'disabled' : '' }}> {{ $isDisabled ? 'disabled' : '' }}>
{{ $option->display }}@if($isDisabled) (Already Submitted)@elseif($isSubmitted && !$isEditMode) (I want to change)@endif {{ $option->display }}@if($isSubmitted) (Already Submitted)@endif
</option> </option>
@else @else
<option value="{{ $option->value }}" <option value="{{ $option->value }}"
@ -494,7 +497,15 @@
} }
$('#field-month').on('change', function () { $('#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) { if ($('#report-form input[name="id"]').length) {
@ -503,13 +514,6 @@
$('[data-toggle="select2"]').select2(); $('[data-toggle="select2"]').select2();
var managerEntryMode = @json($form->manager_entry_mode ?? 'abm'); 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() { function applySelect2ToDoctorDropdowns() {
$("[id^='field-contact_id']").each(function () { $("[id^='field-contact_id']").each(function () {
@ -593,9 +597,6 @@
select.val(String(existingVal)).trigger('change'); select.val(String(existingVal)).trigger('change');
} }
}); });
if ($('#field-replace_submission_id').length && $('#field-month').val()) {
applyMonth(String($('#field-month').val()));
}
} }
function loadDoctorsForHierarchies(hierarchyIds) { 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(); bindCityPinHandlers();
if (managerEntryMode === 'rbm') { if (managerEntryMode === 'rbm') {
$('#field-user_id').on('change', function () { $('#field-user_id').on('change', function () {
@ -674,26 +699,11 @@
clearDoctorDropdowns(); clearDoctorDropdowns();
return; return;
} }
$("#pageloader").fadeIn(); loadTmDoctorsForUser(abmUserId);
$.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();
}
});
}); });
} else { } 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 @endif