192 lines
9.0 KiB
PHP
192 lines
9.0 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" />
|
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.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">
|
|
{{-- @php echo "<pre>" @endphp
|
|
{{ print_r($questions) }} --}}
|
|
@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>
|
|
|
|
<div class="col-md-12 mb-2">
|
|
<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>Healthy Lungs</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php
|
|
$doctors = [];
|
|
foreach ($questions as $question) {
|
|
if ($question->code == 'contact_id') {
|
|
$doctors = $question->options;
|
|
}
|
|
}
|
|
@endphp
|
|
@foreach ($doctors as $key => $doctor)
|
|
<tr>
|
|
<th>{{ $doctor->display }}<br /><small>MSL Code:
|
|
{{ isset($doctor->contact->msl_code) ? $doctor->contact->msl_code : '-' }}<input
|
|
type="hidden" name="contact_id[{{ $key }}]"
|
|
value="{{ $doctor->value }}" /></th>
|
|
<th>
|
|
<input type="checkbox" name="healthy_lungs[{{ $key }}]"
|
|
value="Yes" data-field="healthy_lungs"
|
|
data-contact-id="{{ $doctor->value }}"
|
|
data-msl-code="{{ isset($doctor->contact->msl_code) ? $doctor->contact->msl_code : '-' }}"
|
|
data-user-id="{{ $form->user_id }}"
|
|
data-form-id="{{ $form_id }}"
|
|
data-partition="{{ $form->partition }}"
|
|
{!! isset($doctor->contact->healthy_lungs) && $doctor->contact->healthy_lungs == 'Yes'
|
|
? 'checked'
|
|
: '' !!}
|
|
/>
|
|
</th>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</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;
|
|
}
|
|
</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" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
|
|
<script type="text/javascript">
|
|
jQuery(document).ready(function($) {
|
|
$('#doctor_table').on('change', 'input[type="checkbox"][data-field]', function() {
|
|
const $checkbox = $(this);
|
|
const fieldName = $checkbox.data('field');
|
|
const isChecked = $checkbox.is(':checked') ? 'Yes' : 'No';
|
|
const payload = {
|
|
user_id: $checkbox.data('user-id'),
|
|
id: $checkbox.data('contact-id'),
|
|
msl_code: $checkbox.data('msl-code'),
|
|
form_id: $checkbox.data('form-id'),
|
|
partition: $checkbox.data('partition'),
|
|
[fieldName]: isChecked,
|
|
_token: $('input[name="_token"]').val()
|
|
};
|
|
|
|
console.log('payload', payload);
|
|
|
|
// $("#pageloader").fadeIn();
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/form/ajaxdoctortagging',
|
|
data: payload,
|
|
success: function(data) {
|
|
// $("#pageloader").fadeOut();
|
|
if (data.status === 'success') {
|
|
Toastify({
|
|
text: "Doctor status updated successfully!",
|
|
duration: 1000,
|
|
gravity: "top",
|
|
position: "right",
|
|
backgroundColor: "#28a745", // green
|
|
stopOnFocus: true
|
|
}).showToast();
|
|
} else {
|
|
Toastify({
|
|
text: "Something went wrong. Please try again.",
|
|
duration: 1000,
|
|
gravity: "top",
|
|
position: "right",
|
|
backgroundColor: "#dc3545", // red
|
|
stopOnFocus: true
|
|
}).showToast();
|
|
}
|
|
},
|
|
error: function() {
|
|
// $("#pageloader").fadeOut();
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Server Error',
|
|
text: 'Unable to reach server.'
|
|
});
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|