Rapport-Laravel/resources/views/form/rapport-copd/1687503493-1ac7b235-44c1-49...

157 lines
7.6 KiB
PHP

@php
$doctors = DB::table('copd_doctor_convering')->where('user_id', $form->user_id)->get();
@endphp
<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => "Form"])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
</head>
<div id="pageloader">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
</div>
<body class="loading">
<div class="account-pages">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
<div class="card bg-pattern">
<div class="card-body p-3 row">
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
<br>@endif
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
</div>
<br>@endif
<div class="col-12">
<h4 class="page-title">Are you covering these doctors? <small>(It can be with a different name or different MSL code)</small></h4>
<p>Like:<br />
Ex 1: 'Dr. Akash Kumar Chopra' might be mentioned as 'Dr. A K Chopra'<br />
Ex 2: 'Dr. Shrikumar' might be mentioned as 'Dr. Shreekumar'</p>
</div>
@php
$history = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
$covering = [];
$ids = [];
foreach($history->data->submissions as $sub) {
$covering[$sub->formdata->doctor_name] = $sub->formdata->covering;
$ids[$sub->formdata->doctor_name] = $sub->id;
}
@endphp
<form method="POST" action="/form/submitmultiple" id="report-form">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
<div class="col-md-12 mb-2">
<div class="table-responsive">
<table class="table table-borderless table-hover table-nowrap table-centered m-0">
<thead class="table-light">
<tr>
<th>Doctor Name</th>
<th>Select Option</th>
</tr>
</thead>
<tbody>
@foreach($doctors as $doctor)
@if(isset($ids[$doctor->{'doctor_name'}]))
<input type="hidden" name="id[]" value="{{ $ids[$doctor->{'doctor_name'}] }}">
@endif
<input type="hidden" name="doctor_name[]" value="{{$doctor->{'doctor_name'} }}">
<input type="hidden" name="pcode[]" value="{{$doctor->{'pcode'} }}">
<input type="hidden" name="speciality[]" value="{{$doctor->{'speciality'} }}">
<tr>
<td style="max-width: calc(100vw - 200px) ;">{{$doctor->{'doctor_name'} }}</td>
<td style="min-width: 100px;">
<select name="covering[]" class="form-control">
<option value="">-- Select --</option>
<option value="Yes" {{isset($covering[$doctor->{'doctor_name'}])&&$covering[$doctor->doctor_name]=='Yes'?'selected':''}}>Yes</option>
<option value="No" {{isset($covering[$doctor->{'doctor_name'}])&&$covering[$doctor->doctor_name]=='No'?'selected':''}}>No</option>
</select>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
@endif
</form>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<style type="text/css">
#pageloader {
background: rgba( 255, 255, 255, 0.8 );
display: none;
height: 100%;
position: fixed;
width: 100%;
z-index: 9999;
}
#pageloader img {
left: 50%;
margin-left: -32px;
margin-top: -32px;
position: absolute;
top: 50%;
}
</style>
@include('layouts.shared/footer-script')
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#report-form').on('submit', function(event){
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/ajaxsubmitmultiple',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
if(data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
})
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
})
}
},
});
});
$('#field-record_date').change(function(){
window.location.href = window.location.href.split('?')[0] + '?record_date=' + $(this).val()
})
});
</script>
</body>
</html>