File: /var/www/html/sarvodayahospital/resources/views/pages/reports/index.blade.php
@extends('layouts.main')
@section('content')
<section class="py-4 py-md-3 banner-c">
<div class="container">
<div class="row align-items-center">
<div class="col-md-6">
<h1 class="text-white f-sm-30 f-30 fw-500 mb-0">
My Account
</h1>
</div>
<div class="col-md-6 text-end"></div>
</div>
</div>
</section>
<section class="my-reports-sec pt-4 pb-md-4">
<div class="container">
<div class="row ">
<div class="col-lg-4 col-sm-6">
<h3 class="clrBlueDark f-18 mb-0 fw-500 mb-3">Choose Patient</h3>
<form method="GET" action="{{ route('patient.report.index') }}">
<div class="form-group">
<select id="report-patient"
class="form-select form-control fw-400 inputBox f-16">
@if (($data) && ($data->success))
<option value="">Select Member</option>
@foreach ($data->data as $d)
<option
value='{"facilityGUID":"{{ $d->facilityGUID }}","mobileNo":"{{ $d->registeredMobileNumber }}","mrn":"{{ $d->mrn }}"}'>
{{ $d->prefix }} {{ $d->personName }}</option>
@if (count($data->data) && $loop->last)
<option value='{"facilityGUID":"","mobileNo":"{{ $d->registeredMobileNumber }}","mrn":""}'>Online Appointments</option>
@endif
@endforeach
@else
<option value="">Select Member</option>
<option value='{"facilityGUID":"","mobileNo":"{{ $phone }}","mrn":""}'>Online Appointments</option>
@endif
</select>
</div>
</form>
</div>
</div>
<!-- ++ -->
<div class="row mt-4">
<div class="col-md-6 col-xl-5">
<ul class="nav nav-pills reports-tab justify-content-md-between">
{{-- <li class="nav-item">
<a class="nav-link f-16" data-bs-toggle="pill" href="#my-reports">My Reports</a>
</li> --}}
<li class="nav-item ps-md-0 ps-4">
<a class="nav-link f-16 active" data-bs-toggle="pill" href="#my-booking">My Appointments</a>
</li>
</ul>
</div>
<div class="col-md-1 col-xl-4">
</div>
<div class="col-md-5 col-xl-4 mt-md-0">
<div class="position-relative text-end report-search-doctor">
{{-- <input type="text" placeholder="Search for doctor name/tests name" class="form-control"
value="">
<button class="p-0 border-0 shadow-none bg-transparent" type="submit">
<img src="{{ asset('img/search-grey.svg') }}">
</button> --}}
</div>
</div>
</div>
<!-- ++ -->
<div class="booking-doctor-tab mt-4">
<div class="tab-content">
<div class="tab-pane container p-0" id="my-reports">
<table class="reports-table table d-md-table">
<thead>
<tr>
<th>Test Name</th>
<th>Patient Name</th>
<th>MRN Number</th>
<th>Date</th>
<th class="opacity-0">Null</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
{{-- <table class="reports-table reports-table-phone table d-md-none border-0">
<tbody>
<tr>
<td class="font-bold">Test Name</td>
<td>X-Ray Lumber Spine Ap/LAT View </td>
</tr>
<tr>
<td class="font-bold">Patient Name</td>
<td>Anuja Sharma </td>
</tr>
<tr>
<td class="font-bold">MRN Number </td>
<td>LSHHI501158 </td>
</tr>
<tr>
<td class="font-bold">Date </td>
<td>03-12-2022 </td>
</tr>
<tr>
<td class="font-bold">Download</td>
<td>Download</td>
</tr>
</tbody>
</table> --}}
<!-- Pagination -->
<div class="pagination-sec">
<div class="row">
<div class="col-md-12 lab-pagination">
</div>
</div>
</div>
</div>
<div class="tab-pane container fade p-0 active show" id="my-booking">
<!-- Pagination -->
<div class="pagination-sec pt-3">
<div class="row">
<div class="col-md-12"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
@stop
@section('javascript')
<script type="text/javascript">
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
});
</script>
<script>
$(document).ready(function() {
$("#report-patient").change(function() {
var status = $.parseJSON($(this).val());
fxBookings(status.facilityGUID, status.mobileNo, status.mrn);
if (status.mrn != '') {
fxLabreports(status.facilityGUID, status.mobileNo, status.mrn);
}
});
})
</script>
<script>
function fxLabreports(facilityGUID, mobileNo, mrn, recordsPerPage, pageNumber) {
$.ajax({
type: "POST",
url: "{{ route('patient.report.labreports') }}",
dataType: "json",
data: {
facilityGUID: facilityGUID,
mobileNo: mobileNo,
mrn: mrn,
recordsPerPage: recordsPerPage,
pageNumber: pageNumber
},
success: function(response) {
if (response.labreports != '') {
$('#my-reports tbody').html(response.labreports);
if (response.page) {
$('.lab-pagination').html(response.page);
}
} else {
$('#my-reports tbody').html('<tr><td>No Lab report found</td></tr>');
}
}
});
}
</script>
<script>
function fxCancelBooking(facilityGUID, mobileNo, mrn, recordsPerPage, pageNumber, appointmentID, hospital) {
if (confirm("Are you sure you want to cancel this Appointment?")) {
$.ajax({
type: "POST",
url: "{{ route('appointment.cancel-booking') }}",
dataType: "json",
beforeSend: function() {
// setting a timeout
console.log('loading');
},
data: {
facilityGUID: facilityGUID,
mobileNo: mobileNo,
mrn: mrn,
recordsPerPage: recordsPerPage,
pageNumber: pageNumber,
appointmentID: appointmentID,
cancellationNote: 'NA',
hospital: hospital
},
success: function(response) {
if (response.data) {
Swal.fire({
position: 'top-end',
icon: 'success',
title: 'Your appointment has been cancelled!',
showConfirmButton: false,
timer: 1500
})
}
},
error: function(xhr) { // if error occured
console.log('completed remove loading Error');
},
complete: function() {
console.log('completed remove loading');
},
});
}
}
</script>
<script>
function fxBookings(facilityGUID, mobileNo, mrn, recordsPerPage, pageNumber) {
$.ajax({
type: "POST",
url: "{{ route('patient.report.bookings') }}",
dataType: "json",
beforeSend: function() {
console.log('loading');
},
data: {
facilityGUID: facilityGUID,
mobileNo: mobileNo,
mrn: mrn,
recordsPerPage: recordsPerPage,
pageNumber: pageNumber
},
success: function(response) {
if (response != '') {
$('#my-booking').html(response);
} else {
$('#my-booking').html('No booking found');
}
},
error: function(xhr) { // if error occured
console.log('completed remove loading Error');
},
complete: function() {
console.log('completed remove loading');
},
});
}
</script>
<script>
$(document).ready(function() {
$('#my-booking').on('click', '.btn-bookings', function() {
mrn = $(this).attr("data-mrn");
recordsPerPage = $(this).attr("data-recordsPerPage");
pageNumber = $(this).attr("data-pageNumber");
facilityGUID = $(this).attr("data-facilityGUID");
mobileNo = $(this).attr("data-mobileNo");
fxBookings(facilityGUID, mobileNo, mrn, recordsPerPage, pageNumber);
});
$('#my-reports').on('click', '.btn-labreports', function() {
mrn = $(this).attr("data-mrn");
recordsPerPage = $(this).attr("data-recordsPerPage");
pageNumber = $(this).attr("data-pageNumber");
facilityGUID = $(this).attr("data-facilityGUID");
mobileNo = $(this).attr("data-mobileNo");
fxLabreports(facilityGUID, mobileNo, mrn, recordsPerPage, pageNumber);
});
$('#my-booking').on('click', '.cancel-appointment-btn', function() {
mrn = $(this).attr("data-mrn");
recordsPerPage = $(this).attr("data-recordsPerPage");
pageNumber = $(this).attr("data-pageNumber");
facilityGUID = $(this).attr("data-facilityGUID");
mobileNo = $(this).attr("data-mobileNo");
appointmentID = $(this).attr("data-appointmentID");
hospital = $(this).attr("data-hospital");
fxCancelBooking(facilityGUID, mobileNo, mrn, recordsPerPage, pageNumber, appointmentID,
hospital);
fxBookings(facilityGUID, mobileNo, mrn, recordsPerPage, pageNumber);
});
});
</script>
@stop