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
|
||||
|
||||
@php
|
||||
$submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
|
||||
$submissions = $submissions->data->submissions;
|
||||
|
||||
echo "<pre>";
|
||||
print_r($submissions);
|
||||
echo "</pre>";
|
||||
$currentRecordId = $id ?? null;
|
||||
$alreadySubmittedDoctors = [];
|
||||
if(isset($submissions) && is_array($submissions)) {
|
||||
foreach($submissions as $sub) {
|
||||
// Edit करताना सध्याचा रेकॉर्ड वगळा
|
||||
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
|
||||
|
||||
|
||||
@if(count($submissions) <=4)
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
|
|
@ -191,7 +203,7 @@
|
|||
$('[data-toggle="select2"]').select2();
|
||||
var hierarcies = [];
|
||||
var contacts = [];
|
||||
|
||||
var submittedDoctors = {!! json_encode(array_values(array_unique($alreadySubmittedDoctors))) !!};
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
@foreach($form->users as $option)
|
||||
hierarcies.push('{{$option->hierarchy_id}}');
|
||||
|
|
@ -269,7 +281,11 @@
|
|||
var select = $(this);
|
||||
// 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('');
|
||||
// Add a default 'Select' option
|
||||
|
|
@ -280,6 +296,26 @@
|
|||
);
|
||||
// Append options from contacts
|
||||
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>")
|
||||
.attr("value", itm.value)
|
||||
.text(itm.display);
|
||||
|
|
|
|||
Loading…
Reference in New Issue