200 lines
11 KiB
PHP
200 lines
11 KiB
PHP
<!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-8">
|
|
<h4 class="page-title">{{$form->title}}</h4>
|
|
</div>
|
|
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
|
<div class="col-4">
|
|
@if($form->link_type == 'form')
|
|
<a href="/form/history" class="float-end pt-1">View History</a>
|
|
@else
|
|
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@php
|
|
$doctorsdetails = Formhelper::getMultiformData( $form->partition, '1653980040-4da0c8f8-1887-4b9e-82ec-6cb7ba50356b', $form->user_id);
|
|
$doctors = [];
|
|
foreach($doctorsdetails->data->submissions as $sub) {
|
|
$doctors[] = $sub->formdata;
|
|
}
|
|
$history = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
|
|
$histories = [];
|
|
$date = '';
|
|
foreach($history->data->submissions as $sub) {
|
|
$sub->formdata->id = $sub->id;
|
|
$histories[$sub->formdata->doctor] = $sub->formdata;
|
|
$date = $sub->formdata->date;
|
|
}
|
|
@endphp
|
|
|
|
|
|
<form method="POST" action="/form/submitmultiple" id="report-form">
|
|
<input type="hidden" name="form_id" value="{{$form_id}}">
|
|
@csrf
|
|
@if($id)
|
|
<input type="hidden" name="id" value="{{$id}}">
|
|
@endif
|
|
|
|
<div class="col-md-12 mb-2">
|
|
<label for="field-date" class="form-label">Date<span class="text-danger">*</span></label>
|
|
<input type="date" id="field-date" name="date" class="form-control" value="{{ $date }}" required value="">
|
|
</div>
|
|
|
|
<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>Days Visited</th>
|
|
<th>Started Rxing</th>
|
|
<th>No. of Rxs</th>
|
|
<th>Rx Honoured</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($doctors as $doctor)
|
|
<input type="hidden" name="doctor[]" value="{{$doctor->{'doctor-name'} }}">
|
|
@if(array_key_exists($doctor->{'doctor-name'}, $histories))
|
|
<input type="hidden" name="id[]" value="{{$histories[$doctor->{'doctor-name'}]->id}}">
|
|
@endif
|
|
@php
|
|
$hasHistory = false;
|
|
if(array_key_exists($doctor->{'doctor-name'}, $histories)) {
|
|
$hasHistory = true;
|
|
$history = $histories[$doctor->{'doctor-name'}];
|
|
}
|
|
@endphp
|
|
<tr>
|
|
<td>{{$doctor->{'doctor-name'} }}</td>
|
|
<td style="min-width: 100px;">
|
|
<select id="days_visited" name="days_visited[]" class="form-control" required>
|
|
<option value="0" {{$hasHistory && $history->days_visited == "0" ? "selected":"" }}>0</option>
|
|
<option value="1" {{$hasHistory && $history->days_visited == "1" ? "selected":"" }}>1</option>
|
|
<option value="2" {{$hasHistory && $history->days_visited == "2" ? "selected":"" }}>2</option>
|
|
<option value="3" {{$hasHistory && $history->days_visited == "3" ? "selected":"" }}>3</option>
|
|
</select>
|
|
</td>
|
|
<td style="min-width: 100px;">
|
|
<select id="started_rxing" name="started_rxing[]" class="form-control" required>
|
|
<option value="yes" {{$hasHistory && $history->started_rxing == "yes" ? "selected":"" }}>Yes</option>
|
|
<option value="no" {{$hasHistory && $history->started_rxing == "no" ? "selected":"" }}>No</option>
|
|
</select>
|
|
</td>
|
|
<td style="min-width: 100px;">
|
|
<input type="number" id="no-of-rxs" name="no-of-rxs[]" class="form-control" value="{{$hasHistory?$history->{'no-of-rxs'}:'' }}" required />
|
|
</td>
|
|
<td style="min-width: 100px;">
|
|
<select id="rx-honoured" name="rx-honoured[]" class="form-control" required>
|
|
<option value="yes" {{$hasHistory && $history->{'rx-honoured'} == "yes" ? "selected":"" }}>Yes</option>
|
|
<option value="no" {{$hasHistory && $history->{'rx-honoured'} == "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> |