Files
streamline-emr/docker/streamline-src/Modules/Patients/Resources/views/patient_episodes/menu.blade.php
T
alec.turner 4a89356390 Import latest app updates from streamline
An updated set of source files and initialization was provided by streamline to
address issues observed during initial testing. These files have been updated in
order to generate a new set of app images.
2024-04-11 11:16:51 -07:00

905 lines
52 KiB
PHP
Executable File

@push('styles')
<style>
.episode-menu li {
display: inline-block;
}
.episode-menu a {
white-space: normal !important;
}
.highlight {
font-weight: bold;
}
.modal-dialog {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%) !important;
}
</style>
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
<div class="row d-flex align-items-stretch">
<div class="col-sm-9 mb-4">
<div class="white-box h-100 br-5 mb-0">
<ul class="episode-menu m-0 p-0">
<div class="row m-0 w-100">
<div class="col-sm-2">
<li class="w-100">
<button type="button" class="btn btn-success btn-sm w-100 h-100 br-5" data-toggle="modal"
data-target="#demographicsModal">{{ __('layout.demographics') }}</button>
</li>
</div>
<div class="col-sm-3">
<div class="form-group">
<select class="form-control w-100" name="new_episode_option" id="new_episode_options">
<option value="" selected disabled>{{ __('layout.create_new_episode') }}</option>
@if (Auth::user()->can('create-patient-episode'))
<option value="1">{{ __('layout.new_episode') }}</option>
@endif
@if (Auth::user()->can('create-patient-episode-with-clinic'))
<option value="2"> {{ __('layout.new_episode_with_clinic') }}</option>
@endif
@if (Auth::user()->can('create-patient-episode-with-doctor'))
<option value="3">{{ __('layout.new_episode_with_doctor') }}</option>
@endif
@if (Auth::user()->can('create-patient-episode-with-doctor-and-clinic'))
<option value="4"> {{ __('layout.new_episode_with_doctor_and_clinic') }}
</option>
@endif
@if (Auth::user()->can('create-patient-episode-with-admission'))
<option value="5"> {{ __('layout.new_episode_with_admission') }}</option>
@endif
@if (Auth::user()->can('create-patient-episode-with-self-lab-request'))
<option value="6"> {{ __('layout.new_episode_with_inv_self_request') }}
</option>
@endif
</select>
</div>
<div class="modal fade" id="newEpisodeModal" tabindex="-1" role="dialog"
aria-labelledby="modalNewEpisodeModelLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalNewEpisodeModelLabel1">
{{ __('patient_episode.new_episode_option') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.create_special_clinic_episode']) }}
{{ Form::hidden('patient_id', $patient->id) }}
{{ Form::label('new_episode_option', __('patient_episode.new_episode_option')) }}
{{ Form::select('new_episode_option', [], '', ['class' => 'form-control', 'required' => 'true']) }}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm w-100 h-100 br-5"
onclick="return confirm('<?php echo __('layout.are_you_sure_clinic'); ?>');">{{ __('layout.continue_clinic_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm w-100 h-100 br-5"
data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
@if (Auth::user()->can('create-patient-episode'))
<li>
<!-- <button type="submit" class="btn btn-success btn-sm show-episode-modal" data-backdrop="static" data-keyboard="false" data-toggle="modal" data-target="#episodeModal">{{ __('layout.new_episode') }}</button> -->
</li>
@endif
@if (Auth::user()->can('create-patient-episode-with-clinic'))
<li>
<!-- <a class="btn btn-success btn-sm" data-toggle="modal" data-target="#newEpisodeAndClinicModal">{{ __('layout.new_episode_clinic') }}</a> -->
<div class="modal fade" id="newEpisodeAndClinicModal" tabindex="-1" role="dialog"
aria-labelledby="modalSpecialLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalSpecialLabel1">
{{ __('layout.clinic_allocation') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.create_special_clinic_episode']) }}
{{ Form::hidden('patient_id', $patient->id) }}
{{ Form::label('special_clinic_id', __('layout.select_clinic')) }}
{{ Form::select('special_clinic_id', $special_clinics, '', ['class' => 'form-control', 'required' => 'true']) }}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm w-100 h-100 br-5"
onclick="return confirm('<?php echo __('layout.are_you_sure_clinic'); ?>');">{{ __('layout.continue_clinic_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm w-100 h-100 br-5"
data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
</li>
@endif
@if (Auth::user()->can('create-patient-episode-with-doctor-and-clinic'))
<li>
<!-- <a class="btn btn-success btn-sm" data-toggle="modal" data-target="#episodeWithDoctorAndClinicModal">{{ __('patient_episode.new_episode_with_doctor_and_clinic') }}</a> -->
<div class="modal fade" id="episodeWithDoctorAndClinicModal" tabindex="-1"
role="dialog" aria-labelledby="episodeWithDoctorAndClinicLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="episodeWithDoctorAndClinicLabel1">
{{ __('patient_episode.doctor_and_clinic_allocation') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.create_episode_with_doctor_and_clinic']) }}
{{ Form::hidden('patient_id', $patient->id) }}
<div class="form-group">
{{ Form::label('special_clinic_id', __('layout.select_clinic')) }}
{{ Form::select('special_clinic_id', $special_clinics, '', ['class' => 'form-control', 'required' => 'true']) }}
</div>
<div class="form-group">
{{ Form::label('allocated_services_id_with_doctor_id', __('patient_episode.doctor_allocation')) }}
{{ Form::select('allocated_services_id_with_doctor_id', $users_array, '', ['class' => 'form-control doctorWithClinicDoctorDropDown', 'required' => 'true']) }}
</div>
@if (is_patient_category_pay_later($patient->category_id))
<div class="form-group">
{{ Form::label('claim_number', __('patient_episode.claim_number')) }}
{{ Form::text('claim_number', '', ['class' => 'form-control', 'required' => 'true', 'id' => 'claim_number']) }}
</div>
@endif
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm w-100 h-100 br-5"
onclick="return confirm('<?php echo __('patient_episode.are_you_sure_doctor_and_clinic'); ?>');">{{ __('patient_episode.continue_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm w-100 h-100 br-5"
data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
</li>
@endif
@if (Auth::user()->can('create-patient-episode-with-doctor'))
<li>
<!-- <a class="btn btn-success btn-sm" data-toggle="modal" data-target="#episodeWithDoctorModal">{{ __('patient_episode.new_episode_with_doctor') }}</a> -->
<div class="modal fade" id="episodeWithDoctorModal" tabindex="-1" role="dialog"
aria-labelledby="episodeWithDoctorLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="episodeWithDoctorLabel1">
{{ __('patient_episode.doctor_allocation') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.create_episode_with_doctor']) }}
{{ Form::hidden('patient_id', $patient->id) }}
{{ Form::label('allocated_services_id_with_doctor_id', __('patient_episode.doctor_allocation')) }}
{{ Form::select('allocated_services_id_with_doctor_id', $users_array, '', ['class' => 'form-control doctorDropDown', 'required' => 'true']) }}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm w-100 h-100 br-5"
onclick="return confirm('<?php echo __('patient_episode.are_you_sure_doctor'); ?>');">{{ __('patient_episode.continue_doctor_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm w-100 h-100 br-5"
data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
</li>
@endif
@if (Auth::user()->can('create-patient-episode-with-self-lab-request'))
<li>
<div class="modal fade" id="episodeWithSelfLabRequestModal" tabindex="-1"
role="dialog" aria-labelledby="episodeWithSelfLabRequestLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="episodeWithSelfLabRequestLabel1">
{{ __('patient_episode.new_episode_with_self_lab_request') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-9" style="margin-top: 5px;">
{{ __('layout.are_you_sure_inv_self_request') }}</div>
<div class="col-sm-3">
{{ Form::open(['route' => 'patient_episodes.create_episode_with_lab_self_request']) }}
{{ Form::hidden('patient_id', $patient->id) }}
<button type="submit"
class="btn btn-success btn-sm w-100 h-100 br-5"
name="createNewEpisode">{{ __('layout.yes') }}</button>
<button type="button"
class="btn btn-default w-100 h-100 br-5"
data-dismiss="modal">{{ __('layout.cancel') }}</button>
{{ Form::close() }}
</div>
</div>
</div>
</div>
</div>
</div>
</li>
@endif
</div>
<div class="col-sm-4">
<li>
<a class="btn btn-info btn-small"
onclick="return popitup('https://primaryreporting.who-umc.org/Reporting/Reporter?OrganizationID=UG')">
{{ __('layout.sadr_report') }}
</a>
</li>
</div>
<div class="col-sm-3">
@if ($patient->gender == 2)
<li>
@if (Auth::user()->can('create-maternity-admission'))
<a class="btn btn-default" id="maternityAdmissionBtn"><i
class="fa fa-plus-square"></i> {{ __('layout.maternity_admission') }}</a>
@endif
@if (Module::has('Maternity') && Module::isEnabled('Maternity'))
<!-- materninty modal -->
<div class="modal fade" id="maternityModal" tabindex="-1" role="dialog"
aria-labelledby="modalMaternityLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalMaternityLabel1">
{{ __('layout.date_of_maternity_admission') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'maternity.create_episode']) }}
{{ Form::hidden('patient_id', $patient->id) }}
<input type="date" class="form-control" name="maternity_date"
id="maternity_date_field" value="{{ date('Y-m-d') }}">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm"
onclick="return confirm('<?php echo __('layout.are_you_sure_admit_maternity'); ?>');">{{ __('layout.continue_maternity_admission') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm"
data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
<!-- end maternity modal -->
@endif
</li>
@endif
<li>
@if (Auth::user()->can('create-ward-admission'))
<!-- <a class="btn btn-success btn-sm" data-toggle="modal" data-target="#wardAdmissionModal">{{ __('layout.ward_admission') }}</a> -->
@endif
<div class="modal fade" id="wardAdmissionModal" tabindex="-1" role="dialog"
aria-labelledby="modalWardAdmissionLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalWardAdmissionLabel1">
{{ __('layout.ward_admission') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.create_episode_with_ward']) }}
{{ Form::hidden('patient_id', $patient->id, ['id' => 'patient_id']) }}
{{ Form::label('admission_ward_id', __('layout.select_ward')) }}
{{ Form::select('admission_ward_id', $wards, '', ['class' => 'form-control', 'required' => 'true']) }}
<br>
{{ Form::label('ward_admission_date', __('layout.admission_date')) }}
<input type="date" class="form-control" name="ward_admission_date"
id="ward_admission_date" value="{{ date('Y-m-d') }}"
required="true">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm"
onclick="return confirm('<?php echo __('layout.are_you_sure_admit'); ?>');">{{ __('layout.continue_ward_admission') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm"
data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
</li>
</div>
</div>
</ul>
</div>
</div>
<div class="col-sm-3 mb-4">
<div class="white-box h-100 br-5 mb-0">
<div class="row">
<a data-toggle="collapse" data-target="#collapseDiv" class="white-link">
<b>{{ __('layout.patient_documents') }} </b><small
style="color: blue;">({{ $documents ? count($documents) : '' }})</small>
<span class="fa fa-angle-down">
</span>
</a>
<a href="#" style="color: #003399" class="details pull-right">
</a>
</div>
<div id="collapseDiv" class="">
<div class="row">
<div class="col-sm-8">
@if (!is_null($documents))
<ul>
@foreach ($documents as $document)
<li><a href="/patient_documents/{{ $document->id }}"
target="_blank">{{ $document->title }}</a></li>
@endforeach
<li>
<div class="label label-danger">
{{ count($documents) }} {{ __('layout.documents_attached') }}
</div>
</li>
<small>
<a href="#" onclick="go()"
style="font: blue; cursor: pointer; font-weight: bold;">
{{ __('layout.view_all') }} </a>
</small>
<ul>
@endif
</div>
<div class="col-sm-4">
<!-- <a class="btn btn-warning btn-sm" href="">Add New</a> -->
</div>
</div>
</div>
</div>
</div>
<!-- patient appointments not attached to any episode -->
@php
$un_fullfilled_appointments = un_fullfilled_patient_appointments($patient->id);
@endphp
@if (count($un_fullfilled_appointments) > 0)
<div class="col-sm-12">
<div class="white-box" style="padding: 10px;">
<strong>{{ __('layout.patient_appointments') }}</strong>
<div class="table-responsive">
<table class="table color-bordered-table warning-bordered-table">
<thead>
<tr>
<th>{{ __('layout.appointment_date') }}</th>
<th>{{ __('layout.appointment_time') }}</th>
<th>{{ __('layout.episode_started_on') }}</th>
<th>{{ __('layout.clinic') }}</th>
<th>{{ __('layout.in_charge') }}</th>
<th>{{ __('layout.comments') }}</th>
<th style="width: 5%"></th>
</tr>
</thead>
<tbody>
@foreach ($un_fullfilled_appointments as $appointment)
<tr>
<td>
{{ is_null($appointment->appointment_date) ? '' : streamline_date($appointment->appointment_date) }}
</td>
<td>
{{ $appointment->appointment_time }}
</td>
<td>
{{ $appointment->episode_id == 0 ? '' : streamline_date_time(get_name($appointment->episode_id, 'id', 'created_at', 'patient_episodes')) }}
</td>
<td>
{{ get_name($appointment->clinic_allocation, 'id', 'name', 'clinics') }}
</td>
<td>
{{ get_full_name($appointment->incharge_id, 'id', 'first_name', 'last_name', 'users') != 'ALL STAFF' ? get_full_name($appointment->incharge_id, 'id', 'first_name', 'last_name', 'users') : 'N/A' }}
</td>
<td>
{{ $appointment->comments }}
</td>
<td class="text-center">
<a class="btn btn-success btn-rounded btn-xs"
onclick="displayAppointmentActions({{ $appointment->patient_id }},{{ $appointment->id }})">{{ __('layout.appointment_actions') }}</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endif
</div>
@php $dob = new Carbon\Carbon($patient->date_of_birth); @endphp
<div class="modal fade" id="demographicsModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('layout.patient_details') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-6">
<table class="table table-bordered">
<tbody>
<tr>
<th class="highlight">{{ __('layout.patient_number') }}</th>
<td>{{ $patient->number }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.patient_names') }}</th>
<td>{{ $patient->first_name }} {{ $patient->last_name }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('layout.male') : __('layout.female') }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.date_of_birth') }}</th>
<td>{{ streamline_date($patient->date_of_birth) }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.age') }}</th>
<td>{{ $dob->diffInYears(Carbon\Carbon::now()) }} {{ __('layout.years') }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.residence') }}</th>
<td>
{{ patient_residence($patient->id) }}
</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.marital_status') }}</th>
<td>
{{ isset($marital_statuses[$patient->marital_status]) ? $marital_statuses[$patient->marital_status] : 'N/A' }}
</td>
</tr>
<tr>
<th class="highlight">National ID</th>
<td>
{{ strtoupper($patient->national_id) }}
</td>
</tr>
@if (mother_of_patient($patient->id))
@php
$mother_id = mother_of_patient($patient->id);
@endphp
<tr>
<th class="highlight">
<font color="black">{{ __('patients.mother_name') }}:</font>
</th>
<td>
<a href="/patients/{{ $mother_id }}">
{{ get_full_name($mother_id, 'id', 'first_name', 'last_name', 'patients') }}
({{ get_name($mother_id, 'id', 'number', 'patients') }})
</a>
</td>
</tr>
@endif
@if (children_of_patient($patient->id))
@php
$children_ids_array = children_of_patient($patient->id);
@endphp
<tr>
<th class="highlight">
<font color="black">{{ __('patients.children') }}:</font>
</th>
<td>
<ol>
@for ($i = 0; $i < count($children_ids_array); $i++)
<li>
<a href="/patients/{{ $children_ids_array[$i] }}">
{{ get_full_name($children_ids_array[$i], 'id', 'first_name', 'last_name', 'patients') }}
({{ get_name($children_ids_array[$i], 'id', 'number', 'patients') }})
</a>
</li>
@endfor
</ol>
</td>
</tr>
@endif
</tbody>
</table>
</div>
<div class="col-sm-6">
<table class="table table-bordered">
<tbody>
<tr>
<th class="highlight">{{ __('layout.next_of_kin') }}</th>
<td>{{ $patient->next_of_kin }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.relationship') }}</th>
<td>
{{ isset($relationships[$patient->next_of_kin_relationship]) ? $relationships[$patient->next_of_kin_relationship] : 'N/A' }}
</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.mobile_number') }}</th>
<td>{{ $patient->phone }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.phone_name') }}</th>
<td>{{ $patient->phone_owner }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.insurance_status') }}</th>
<td>
@if ($patient->insurance_status == 1)
{{ __('layout.insured') }}
@else
{{ __('layout.not_insured') }}
@endif
</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.occupation') }}</th>
<td>
{{ isset($occupations[$patient->occupation_id]) ? $occupations[$patient->occupation_id] : 'N/A' }}
</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.patient_category') }}</th>
<td>
{{ isset($patient_categories[$patient->category_id]) ? $patient_categories[$patient->category_id] : 'N/A' }}
</td>
</tr>
@php
$registration_fields = !empty($patient->registration_fields)? json_decode($patient->registration_fields, true):[];
@endphp
@foreach ($registration_fields as $key => $registration_field)
@php $keys = explode("_",$key) @endphp
@if (!empty($keys[2]))
<tr>
<th class="highlight">{{ get_name($keys[2], 'id', 'name', 'patient_registration_fields') }}</th>
<td>{{ $registration_field }}</td>
</tr>
@endif
@endforeach
<tr>
<th class="highlight">Referred From</th>
<td>{{ $patient->referred_from }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.registered_by') }}</th>
<td>{{ get_full_name($patient->created_by, 'id', 'first_name', 'last_name', 'users') }}
</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.registered_on') }}</th>
<td>
{{ streamline_date($patient->created_at) }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ __('layout.close') }}</button>
<button type="button" class="btn btn-primary" id="edit_patient"
onclick="window.location.href='/patients/{{ $patient->id }}/edit'">{{ __('layout.edit_patient') }}</button>
</div>
</div>
</div>
</div>
<!-- modal that pops up when a new episode is clicked -->
@if (Auth::user()->can('create-patient-episode'))
<div class="modal fade" id="episodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="row">
<div class="col-sm-9" style="margin-top: 5px;">{{ __('layout.begin_episode_for_patient') }}
</div>
<div class="col-sm-3">
{{ Form::open(['route' => 'patient_episodes.create_episode', 'onsubmit' => 'createNewEpisode.disabled = true; return true;']) }}
{{ Form::hidden('patient_id', $patient->id) }}
<button type="submit" class="btn btn-success btn-sm"
name="createNewEpisode">{{ __('layout.yes') }}</button>
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ __('layout.cancel') }}</button>
{{ Form::close() }}
</div>
</div>
</div>
</div>
</div>
</div>
@endif
<!-- modal that pops up when its an action on an appointment -->
<div class="modal" id="modal_select_actions" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">{{ __('layout.select_actions') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-3">
<button class="btn btn-success btn-rounded" data-toggle="modal"
id="startAppWithClinicBtn">{{ __('layout.start_appointment_with_clinic') }}</button>
</div>
<div class="col-md-3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-success btn-rounded"
onclick="displayActivationModel()">{{ __('layout.start_appointment') }}</a>
</div>
<div class="col-md-3">
<a class="btn btn-warning btn-rounded"
onclick="reschedule_appointment()">{{ __('layout.reschedule_appointment') }}</a>
</div>
<div class="col-md-3">
<a class="btn btn-danger btn-rounded"
onclick="cancel_appointment()">{{ __('layout.cancel_appointment') }}</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal" id="modal_patient_already_admitted" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">{{ __('layout.patient_alert') }}</h4>
</div>
<div class="modal-body">
<h5>{{ __('layout.pat_still_admitted_discharge') }}</h5>
<div class="row">
<div class="col-md-6">
<a class="btn btn-info btn-rounded" data-dismiss="modal">{{ __('layout.cancel') }}</a>
</div>
<div class="col-md-6">
<a class="btn btn-info btn-rounded pull-right"
id="discharge_patient_button">{{ __('layout.discharge_pat_continue') }}</a>&nbsp;&nbsp;&nbsp;
</div>
</div>
</div>
</div>
</div>
</div>
<!-- start an appointment with a clinic and a doctor option -->
<div class="modal fade" id="startAppointmentWithClinicModal" tabindex="-1" role="dialog"
aria-labelledby="appointmentWithDoctorAndClinicLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="appointmentWithDoctorAndClinicLabel1">
{{ __('patient_episode.doctor_and_clinic_allocation') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.start_appointment_with_doctor_and_clinic']) }}
{{ Form::hidden('patient_id', $patient->id) }}
{{ Form::hidden('selected_appointment_id', 0, ['id' => 'selected_appointment_id']) }}
<div class="form-group">
{{ Form::label('special_clinic_id', __('layout.select_clinic')) }}
{{ Form::select('special_clinic_id', $special_clinics, '', ['class' => 'form-control', 'required' => 'true']) }}
</div>
<div class="form-group">
{{ Form::label('allocated_services_id_with_doctor_id', __('patient_episode.doctor_allocation')) }}
{{ Form::select('allocated_services_id_with_doctor_id', $users_array, '', ['class' => 'form-control appWithClinicDoctorDropDown']) }}
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm"
onclick="return confirm('<?php echo __('patient_episode.are_you_sure_doctor_and_clinic'); ?>');">{{ __('patient_episode.continue_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm"
data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$("#new_episode_options").change(function() {
var clicked_episode_option = $(this).val();
if (clicked_episode_option == 1) {
$("#episodeModal").modal("show");
} else if (clicked_episode_option == 2) {
$("#newEpisodeAndClinicModal").modal("show");
} else if (clicked_episode_option == 3) {
$("#episodeWithDoctorModal").modal("show");
} else if (clicked_episode_option == 4) {
$("#episodeWithDoctorAndClinicModal").modal("show");
} else if (clicked_episode_option == 5) {
$.ajax({
url: '/inpatient/check_for_open_admissions/' + $('#patient_id').val(),
type: 'get',
success: function(response) {
if (response > 0) {
$("#modal_patient_already_admitted").modal("show");
} else {
$("#wardAdmissionModal").modal("show");
}
},
error: function(response) {}
});
} else if (clicked_episode_option == 6) {
$("#episodeWithSelfLabRequestModal").modal("show");
}
});
$("#discharge_patient_button").click(function() {
$.ajax({
url: '/inpatient/discharge_patient_past_admissions/' + $('#patient_id').val(),
type: 'get',
success: function(response) {
$("#modal_patient_already_admitted").modal("hide");
$("#wardAdmissionModal").modal("show");
},
error: function(response) {}
});
});
$("#maternityAdmissionBtn").click(function(e) {
e.preventDefault();
$.ajax({
url: '/inpatient/check_for_open_admissions/' + $('#patient_id').val(),
type: 'get',
success: function(response) {
if (response > 0) {
$("#modal_patient_already_admitted").modal("show");
} else {
$("#maternityModal").modal("show");
}
},
error: function(response) {}
});
});
$('.doctorDropDown').select2({
placeholder: "Select",
width: "100%",
dropdownParent: $('#episodeWithDoctorModal')
});
$('.doctorWithClinicDoctorDropDown').select2({
placeholder: "Select",
width: "100%",
dropdownParent: $('#episodeWithDoctorAndClinicModal')
});
$('#startAppWithClinicBtn').click(function(e) {
$('#modal_select_actions').modal('hide');
$('#selected_appointment_id').val(appointmentId);
$('#startAppointmentWithClinicModal').modal('show');
});
$('.appWithClinicDoctorDropDown').select2({
placeholder: "Select",
width: "100%",
dropdownParent: $('#startAppointmentWithClinicModal')
});
function popitup(url) {
newwindow = window.open(url, 'name', 'height=700,width=850, top=50, left=300');
if (window.focus) {
newwindow.focus();
}
return false;
}
function go(url) {
event.preventDefault();
let options = document.getElementsByName('episode_id');
let episodeId = 0;
if (options) {
for (let i = 0; i < options.length; i++) {
if (options[i].checked) {
episodeId = options[i].value;
}
}
}
$.ajax({
url: 'set_episode_id/' + episodeId + '/patient_documents',
type: 'get',
success: function(response) {
window.location.href = '/patient_documents';
},
error: function(response) {}
});
}
/* stuff for patient appointments */
let selectedPatientId = 0;
let appointmentId = 0;
function reschedule_appointment() {
if (confirm("<?php echo __('layout.reschedule_appointment_question'); ?>")) {
window.location.href = "/patients/reschedule_appointment/" + appointmentId;
}
}
function cancel_appointment() {
if (confirm("<?php echo __('layout.cancel_appointment_cancel'); ?>")) {
$.ajax({
method: 'GET',
url: '/patients/cancel_patient_appointment/' + appointmentId,
success: function(response) {
if (response == 1) {
alert("<?php echo __('layout.appointment_cancelled'); ?>");
$("#modal_select_actions").modal("hide");
fetch_patients();
} else {
alert("<?php echo __('layout.cancel_appointment_failed'); ?>");
}
}
});
}
}
function displayAppointmentActions(patientId, appointment_id) {
selectedPatientId = patientId;
appointmentId = appointment_id;
$("#modal_select_actions").modal("show");
}
function displayActivationModel() {
window.location.href = "/patients/complete_appointment/" + appointmentId;
}
</script>
@endpush
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$('#new_episode_options').select2();
</script>
@endpush