Team 4 (Montair LC Kid ABM Conversion) Already Added Doctor
Specific Folder FTP Upload / ftp-deploy (push) Successful in 43s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 43s
Details
This commit is contained in:
parent
3a47f7e016
commit
ab0ac794ac
|
|
@ -41,14 +41,26 @@
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
|
$currentRecordId = $id ?? null;
|
||||||
$submissions = $submissions->data->submissions;
|
$alreadySubmittedDoctors = [];
|
||||||
|
if(isset($submissions) && is_array($submissions)) {
|
||||||
echo "<pre>";
|
foreach($submissions as $sub) {
|
||||||
print_r($submissions);
|
// Edit करताना सध्याचा रेकॉर्ड वगळा
|
||||||
echo "</pre>";
|
if($currentRecordId && isset($sub->id) && $sub->id == $currentRecordId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(isset($sub->formdata->contact_id) && !empty($sub->formdata->contact_id)) {
|
||||||
|
$alreadySubmittedDoctors[] = (string)$sub->formdata->contact_id;
|
||||||
|
}
|
||||||
|
if(isset($sub->formdata->cont_id) && !empty($sub->formdata->cont_id)) {
|
||||||
|
$alreadySubmittedDoctors[] = (string)$sub->formdata->cont_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
|
|
||||||
@if(count($submissions) <=4)
|
@if(count($submissions) <=4)
|
||||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||||
|
|
@ -191,7 +203,7 @@
|
||||||
$('[data-toggle="select2"]').select2();
|
$('[data-toggle="select2"]').select2();
|
||||||
var hierarcies = [];
|
var hierarcies = [];
|
||||||
var contacts = [];
|
var contacts = [];
|
||||||
|
var submittedDoctors = {!! json_encode(array_values(array_unique($alreadySubmittedDoctors))) !!};
|
||||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||||
@foreach($form->users as $option)
|
@foreach($form->users as $option)
|
||||||
hierarcies.push('{{$option->hierarchy_id}}');
|
hierarcies.push('{{$option->hierarchy_id}}');
|
||||||
|
|
@ -269,7 +281,11 @@
|
||||||
var select = $(this);
|
var select = $(this);
|
||||||
// Clear previous options
|
// Clear previous options
|
||||||
|
|
||||||
var existingVal = select.val() || select.attr('data-preselected') || '';
|
//var existingVal = select.val() || select.attr('data-preselected') || '';
|
||||||
|
|
||||||
|
var existingVal = select.attr('data-preselected') !== undefined && select.attr('data-preselected') !== ''
|
||||||
|
? String(select.attr('data-preselected'))
|
||||||
|
: (select.val() ? String(select.val()) : '');
|
||||||
|
|
||||||
select.html('');
|
select.html('');
|
||||||
// Add a default 'Select' option
|
// Add a default 'Select' option
|
||||||
|
|
@ -280,6 +296,26 @@
|
||||||
);
|
);
|
||||||
// Append options from contacts
|
// Append options from contacts
|
||||||
contacts.forEach(function(itm) {
|
contacts.forEach(function(itm) {
|
||||||
|
var itmVal = String(itm.value);
|
||||||
|
var itmText = itm.display;
|
||||||
|
|
||||||
|
// चेक करा: डॉक्टरचे नाव किंवा व्हॅल्यू आधीच सबमिट झाली आहे का?
|
||||||
|
var isAlreadySubmitted = submittedDoctors.includes(itmVal) || submittedDoctors.includes(itmText);
|
||||||
|
|
||||||
|
// जर Edit मोडमध्ये हाच डॉक्टर आधी सिलेक्ट केलेला असेल, तर त्याला Allow करा
|
||||||
|
var isCurrentSelected = (existingVal !== '' && (existingVal === itmVal || existingVal === itmText));
|
||||||
|
|
||||||
|
var displayText = itmText;
|
||||||
|
var isDisabled = false;
|
||||||
|
|
||||||
|
if (isAlreadySubmitted && !isCurrentSelected) {
|
||||||
|
displayText += " - Already Added";
|
||||||
|
isDisabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var option = $("<option></option>")
|
var option = $("<option></option>")
|
||||||
.attr("value", itm.value)
|
.attr("value", itm.value)
|
||||||
.text(itm.display);
|
.text(itm.display);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue