274 lines
14 KiB
PHP
274 lines
14 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" />
|
|
<link href="{{ asset('assets/libs/select2/select2.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">{{$form->title}}</h4>
|
|
</div>
|
|
|
|
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'
|
|
) )
|
|
|
|
@endif
|
|
@if(isset($form->user_info))
|
|
<div class="col-12">
|
|
<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;
|
|
@endphp
|
|
|
|
<div style="display: none;">
|
|
@php
|
|
echo "<pre>";
|
|
print_r($submissions);
|
|
@endphp
|
|
</div>
|
|
|
|
|
|
<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="user_id" value="{{$form->user_id}}">
|
|
@csrf
|
|
@if($id)
|
|
<input type="hidden" name="id" value="{{$id}}">
|
|
@endif
|
|
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
|
|
|
|
|
<div class="col-md-12 mb-2">
|
|
<label for="field-user_id" class="form-label"> Select User / Territory <span
|
|
class="text-danger">*</span> </label>
|
|
<select class="form-control" id="field-user_id" name="user_id" required>
|
|
<option value=""> -- Select -- </option>
|
|
@foreach($form->users as $option)
|
|
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}"
|
|
{{isset($question->value) && $question->value == $option->value ? 'selected':''}}>
|
|
{{$option->display}}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
|
</div>
|
|
@endif
|
|
|
|
<div class="criteria">
|
|
<p>Criteria</p>
|
|
<p>1. BF serviced Drs(PT/FT)</p>
|
|
<p>2. Dr should be giving < 2k business of Montair LC Adult </p>
|
|
<p>3. Dr should be present in your HQ, to ensure your visit on the day of the clinic.</p>
|
|
</div>
|
|
|
|
<div class="col-md-12 mb-2">
|
|
<div class="mb-2">
|
|
<label for="record_date">Date</label>
|
|
<input type="date" name="record_date" class="form-control" id="record_date" required>
|
|
</div>
|
|
<div class="table-responsive sticky-table">
|
|
<table id="doctor_table" class="table table-borderless table-hover table-nowrap table-centered m-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Doctor Name </th>
|
|
<th>ARDC-BF Competition </th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php
|
|
$doctors = [];
|
|
foreach ($questions as $question) {
|
|
if($question->code == 'contact_id') {
|
|
$doctors = $question->options;
|
|
}
|
|
}
|
|
@endphp
|
|
@foreach($doctors as $i => $doctor)
|
|
@php
|
|
$submission = null;
|
|
foreach($submissions as $sub) {
|
|
if($sub->formdata->cont_id == $doctor->value || $sub->formdata->contact_id == $doctor->value) {
|
|
$submission = $sub;
|
|
}
|
|
}
|
|
@endphp
|
|
|
|
<tr>
|
|
<th>{{$doctor->display}}<br/><small>MSL Code: {{isset($doctor->contact->msl_code)?$doctor->contact->msl_code:'-'}}</small>
|
|
<input type="hidden" name="contact_id[{{$i}}]" value="{{$doctor->value}}" />
|
|
</th>
|
|
|
|
<!-- @if(isset($submission->id))
|
|
<input type="hidden" name="id[{{$i}}]" value="{{$submission->id}}" />
|
|
@endif
|
|
|
|
@if(isset($submission->formdata->ardc_bf_competition_dr_list_check))
|
|
<input type="hidden" name="ardc_bf_competition_dr_list_check[{{$i}}]" value="No" />
|
|
@endif -->
|
|
<th>
|
|
<input
|
|
type="checkbox"
|
|
class="competition-check"
|
|
data-index="{{ $i }}"
|
|
name="ardc_bf_competition_dr_list_check[{{$i}}]"
|
|
value="Yes"
|
|
{!! isset($submission->formdata->ardc_bf_competition_dr_list_check) && $submission->formdata->ardc_bf_competition_dr_list_check == 'Yes' ? 'checked' : '' !!}
|
|
/>
|
|
</th>
|
|
|
|
</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%;
|
|
}
|
|
small {
|
|
font-size:10px;
|
|
}
|
|
div.sticky-table {
|
|
position: relative;
|
|
height: 100%;
|
|
max-height: 500px;
|
|
}
|
|
div.sticky-table table thead {
|
|
position: sticky;
|
|
top: 0;
|
|
}
|
|
.criteria p{
|
|
color: #e3401d;
|
|
margin-bottom: 0rem;
|
|
}
|
|
</style>
|
|
@include('layouts.shared/footer-script')
|
|
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
|
<script src="{{ asset('assets/libs/select2/select2.min.js') }}"></script>
|
|
<script type="text/javascript">
|
|
jQuery(document).ready(function($) {
|
|
|
|
// let anyChecked = $('input[name^="ardc_bf_competition_dr_list_check["]:checked').length > 0;
|
|
// if (anyChecked) {
|
|
// $('#submit-btn').prop('disabled', true).text('Already Submitted');
|
|
// }
|
|
|
|
|
|
let doctors = [];
|
|
$('#report-form').on('submit', function(event) {
|
|
event.preventDefault();
|
|
let arrChecks = [];
|
|
let selectedardc_bf_competition_dr_list_check = 0;
|
|
|
|
$('input[type="checkbox"]:checked').each(function(e){
|
|
arrChecks.push({'name': this.name, 'val': this.value});
|
|
});
|
|
|
|
arrChecks.forEach((item, index) => {
|
|
if(item.name.includes('ardc_bf_competition_dr_list_check')) {
|
|
selectedardc_bf_competition_dr_list_check++;
|
|
}
|
|
});
|
|
|
|
if(selectedardc_bf_competition_dr_list_check !== 5) {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Data not submitted',
|
|
text: `Please select exactly 5 ARDC-BF Competition doctors! Current Selection: ${selectedardc_bf_competition_dr_list_check}.`,
|
|
});
|
|
return;
|
|
}
|
|
|
|
$("#pageloader").fadeIn();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/form/ajaxsubmitmultiple',
|
|
data: new FormData($('#report-form')[0]),
|
|
processData: false,
|
|
contentType: false,
|
|
success: function(data) {
|
|
console.log('data = ',data)
|
|
$("#pageloader").fadeOut();
|
|
if (data.status == 'success') {
|
|
Swal.fire({
|
|
title: 'Great!',
|
|
text: 'Your data is successfully submitted!',
|
|
icon: 'success'
|
|
})
|
|
// $('#report-form').trigger("reset");
|
|
// $('#doctor_table tbody').html('')
|
|
window.location.reload()
|
|
} else {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Data not submitted',
|
|
text: 'Something went wrong, please try again after some time!'
|
|
})
|
|
}
|
|
},
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |