Team 3 and team 4 Form changes
Specific Folder FTP Upload / ftp-deploy (push) Successful in 5m31s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 5m31s
Details
This commit is contained in:
parent
b20d46a908
commit
f36a850281
|
|
@ -136,7 +136,7 @@
|
|||
{{-- <td>{{ $sub->formdata->team_name }}</td> --}}
|
||||
<td>{{ $sub->formdata->type_of_meeting }}</td>
|
||||
<td>{{ $sub->formdata->record_date }}</td>
|
||||
<td>{{$sub->formdata->name_of_the_speaker}}</td>
|
||||
<!-- <td>{{$sub->formdata->name_of_the_speaker}}</td> -->
|
||||
<td>{{ $sub->formdata->msl_code }}</td>
|
||||
<td>{{ $sub->formdata->speciality }}</td>
|
||||
<td>{{ $sub->formdata->attendence }}</td>
|
||||
|
|
|
|||
|
|
@ -38,6 +38,31 @@
|
|||
<h6>Submitted By: {{$form->user_info->name}}</h6>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@php
|
||||
$submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
|
||||
$submissions = $submissions->data->submissions;
|
||||
|
||||
/* echo "<pre>";
|
||||
print_r($submissions);
|
||||
echo "</pre>"; */
|
||||
|
||||
|
||||
|
||||
$historyDoctorIds = [];
|
||||
|
||||
foreach ($submissions as $sub) {
|
||||
if (isset($sub->formdata->cont_id) && $sub->formdata->cont_id != '') {
|
||||
$historyDoctorIds[] = (string) $sub->formdata->cont_id;
|
||||
}
|
||||
}
|
||||
|
||||
$historyDoctorIds = array_unique($historyDoctorIds);
|
||||
|
||||
@endphp
|
||||
|
||||
@if(count($submissions)<20)
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
|
|
@ -87,17 +112,44 @@
|
|||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}"
|
||||
msl_code="{{ isset($option->contact->legacy_code) ? $option->contact->legacy_code : '' }}"
|
||||
speciality="{{ isset($option->contact->speciality) ? $option->contact->speciality : '' }}"
|
||||
<select class="form-control"
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
{{$question->required == 'yes'?'required':'' }}>
|
||||
|
||||
{{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
<option value=""> -- Select -- </option>
|
||||
|
||||
@foreach($question->options as $option)
|
||||
|
||||
{{-- 🔥 NEW: Check whether this doctor was already submitted --}}
|
||||
@php
|
||||
$alreadySubmitted = in_array(
|
||||
(string) $option->value,
|
||||
$historyDoctorIds
|
||||
);
|
||||
@endphp
|
||||
|
||||
<option value="{{$option->value}}"
|
||||
msl_code="{{ isset($option->contact->legacy_code) ? $option->contact->legacy_code : '' }}"
|
||||
speciality="{{ isset($option->contact->speciality) ? $option->contact->speciality : '' }}"
|
||||
|
||||
{{-- 🔥 NEW --}}
|
||||
{{ $alreadySubmitted ? 'disabled' : '' }}
|
||||
|
||||
{{isset($question->value) && $question->value == $option->value ? 'selected':''}}>
|
||||
|
||||
{{$option->display}}
|
||||
|
||||
{{-- 🔥 NEW --}}
|
||||
@if($alreadySubmitted)
|
||||
(Already Submitted)
|
||||
@endif
|
||||
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('radio')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-success">
|
||||
|
|
@ -192,7 +244,9 @@
|
|||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
@else
|
||||
<h4>You have submitted 20 Doctors</h4>
|
||||
@endif
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
|
@ -232,27 +286,93 @@
|
|||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
let historyDoctorIds = @json($historyDoctorIds).map(String);
|
||||
console.log("HISTORY DOCTOR IDS:", historyDoctorIds);
|
||||
// 🔥 NEW - Disable doctors that were already submitted
|
||||
// NEW - DEBUG duplicate doctor check
|
||||
// 🔥 NEW - Disable previously submitted doctors
|
||||
function preventDuplicateDoctors() {
|
||||
|
||||
$('#field-contact_id option').each(function () {
|
||||
|
||||
let option = $(this);
|
||||
let doctorId = String(option.val());
|
||||
|
||||
if (!doctorId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove old label first
|
||||
let cleanText = option.text()
|
||||
.replace(' (Already Submitted)', '');
|
||||
|
||||
console.log(
|
||||
"Doctor ID:",
|
||||
doctorId,
|
||||
"History IDs:",
|
||||
historyDoctorIds
|
||||
);
|
||||
|
||||
if (historyDoctorIds.includes(doctorId)) {
|
||||
|
||||
// 🔥 Disable doctor
|
||||
option.prop('disabled', true);
|
||||
|
||||
// 🔥 Show label
|
||||
option.text(cleanText + ' (Already Submitted)');
|
||||
|
||||
} else {
|
||||
|
||||
option.prop('disabled', false);
|
||||
option.text(cleanText);
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#field-user_id').change(function(){
|
||||
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
|
||||
$('#field-hierarchy_id').val(hierarchy);
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy=' + hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
|
||||
success: function(data) {
|
||||
|
||||
$("#pageloader").fadeOut();
|
||||
|
||||
$('#field-contact_id').html('');
|
||||
|
||||
$('#field-contact_id').append(
|
||||
$("<option></option>")
|
||||
.attr("value", '')
|
||||
.text('-- Select --')
|
||||
);
|
||||
|
||||
for (let itm of data) {
|
||||
|
||||
$('#field-contact_id').append(
|
||||
$("<option></option>")
|
||||
.attr("value", itm.value)
|
||||
.text(itm.display)
|
||||
.attr("legacy_code", itm.contact.legacy_code)
|
||||
.attr("speciality", itm.contact.speciality)
|
||||
);
|
||||
}
|
||||
|
||||
// 🔥 NEW - Disable doctors already submitted by this user
|
||||
preventDuplicateDoctors();
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy);
|
||||
});
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
|
|
|
|||
Loading…
Reference in New Issue