resolved conflicts

This commit is contained in:
2025-03-31 03:46:05 +03:00
6454 changed files with 1520539 additions and 9 deletions
@@ -0,0 +1,930 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css"/>
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet"/>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.new_patient') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.register') }}</li>
</ol>
</div>
</div>
<div class="white-box" id="white-box">
@include('flash::message')
{{ Form::open(['route' => 'patients.store','data-toggle'=>'validator']) }}
<div class="row">
<div class="col-sm-4">
<div class="form-group">
{{ Form::label('first_name',__('patients.first_name')) }}
{{ Form::text('first_name','',['class' => 'form-control compulsory', 'required', 'placeholder'=>'Christian name eg Fred', 'id' => 'first_name']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('last_name',__('patients.last_name')) }}
{{ Form::text('last_name','',['class' => 'form-control compulsory', 'required','placeholder'=>'Surname eg Asiimwe', 'id' => 'last_name']) }}
<div class="help-block with-errors"></div>
</div>
<label class="alert alert-danger" id="similar_patients_names" style="display: none"></label>
<div class="form-group">
{{ Form::label('gender',__('patients.gender')) }}
<br>
{{ Form::radio('gender', 1, false, ["required"]) }} {{ __('patients.male') }} &nbsp;&nbsp;
{{ Form::radio('gender', 2, false, ["required"]) }} {{ __('patients.female') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('national_id',__('patients.national_id')) }}
{{ Form::text('national_id','',['class' => 'form-control','maxlength'=>15]) }}
</div>
<div class="form-group">
{{ Form::label('date_of_birth',__('patients.date_of_birth')) }}
<div class="input-group">
{{ Form::text('date_of_birth','',['class' => 'form-control compulsory','readonly','id'=>'date_of_birth', 'required']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<div class="help-block with-errors"></div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('age',__('patients.years')) }}
{{ Form::number('age_in_years','0',['class' => 'form-control compulsory','id'=>'age_in_years','min'=>'0','max'=>'120', 'required']) }}
</div>
<div class="help-block with-errors"></div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
{{ Form::label('age',__('patients.months')) }}
{{ Form::number('age_in_months','0',['class' => 'form-control','id'=>'age_in_months','min'=>'0','max'=>'12']) }}
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('marital_status',__('patients.marital_status')) }}
<br>
@foreach($marital_statuses as $key=>$value)
{{ Form::radio('marital_status', $key,false,[]) }} {{ $value }} &nbsp;&nbsp;
@endforeach
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('religion',__('patients.religion')) }}
{{ Form::select('religion',$religions,'',['class' => 'form-control x']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('occupation',__('patients.occupation')) }}
{{ Form::select('occupation',$occupations,'',['class' => 'form-control occupation', 'id' => 'occupation']) }}
<a href="#modal_occupation" data-toggle="modal" id="modal_occupation_link"><font size="1">Add new occupation </font></a>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('next_of_kin',__('patients.next_of_kin')) }}
{{ Form::text('next_of_kin','',['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="kin_div">
<div class="row">
<div class="col-sm-6">
{{ Form::label('next_of_kin_relationship',__('patients.next_of_kin_relationship')) }}
{{ Form::select('next_of_kin_relationship',$relationships,'',['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="col-sm-6">
{{ Form::label('next_of_kin_phone',__('patients.next_of_kin_phone')) }}
{{ Form::text('next_of_kin_phone','',['class' => 'form-control compulsory', 'required','pattern' => '\d{10}', 'title'=>'Phone number must be exactly 10 digits']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('phone',__('patients.phone')) }}
{{ Form::text('phone','',['class' => 'form-control compulsory','id' => 'phone', 'required','pattern' => '\d{10}', 'title'=>'Phone number must be exactly 10 digits' ]) }}
<div class="help-block with-errors"></div>
</div>
<label class="alert alert-danger" id="similar_phone_number" style="display: none"></label>
<div class="form-group">
{{ Form::label('alternative_phone', 'Alternative Phone Number') }}
{{ Form::text('alternative_phone','',['class' => 'form-control','id' => 'alternative_phone','pattern' => '\d{10}', 'title'=>'Phone number must be exactly 10 digits']) }}
</div>
<div class="form-group">
{{ Form::label('phone_owner',__('patients.phone_owner')) }}
<br>
{{ Form::radio('phone_owner','self',false,['id'=>'owned']) }} {{ __('patients.self') }} &nbsp;&nbsp;
{{ Form::radio('phone_owner','other',false,['id'=>'non_owned']) }} {{ __('patients.other') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group owner_name" style="display: none;">
{{ Form::label("owner_name",__('patients.phone_owner_name')) }}
{{ Form::text('owner_name','',['id'=>'owner_name','class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('patient_category',__('patients.patient_category'))}}
{{ Form::select('patient_category',$patient_categories,'1',['class' => 'form-control compulsory', 'required', 'data-error'=>'']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company',__('patients.company_slash_employer'))}}
{{ Form::select('company', $companies ,'',['class' => 'form-control', 'data-error'=>'', 'id' => 'company']) }}
<div class="help-block with-errors"></div>
<a href="#modal_company" data-toggle="modal" id="modal_company_link"><font size="1">{{ __('patients.add_new_company') }} </font></a>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
{{ Form::label('language',__('patients.preferred_language')) }}
{{ Form::select('language',['vern'=>'Vernacular','eng'=>'English',],'eng',['class' => 'form-control compulsory', 'required', 'data-error'=>'Select the language']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('citizenship',__('patients.citizenship')) }}
{{ Form::select('citizenship',['1'=>'Ugandan','0'=>'Non Ugandan'],'',['class' => 'form-control compulsory', 'required', 'data-error'=>'Select the language','id' => 'citizenship']) }}
<div class="help-block with-errors"></div>
</div>
<div id="not_ugandan_regions" style="display: none;">
<div class="form-group">
{{ Form::label('country_id',__('patients.country_of_origin')) }}
{{ Form::select('country_id', $countries, '',['class' => 'form-control', 'data-error'=>'Select the country','id' => 'country_picker']) }}
<div class="help-block with-errors"></div>
{{-- <a href="#modal_residence" data-toggle="modal" id="modal_residence_link"><font size="1">{{ __('patients.add_new_residence') }} </font></a> --}}
<a href="#modal_add_country_foreigner" data-toggle="modal" id="modal_add_country_foreigner_id"><font size="1">Add new country </font></a>
</div>
<div class="form-group">
<label for="non_ugandan_foreigner_or_refugee">{{ __('patients.foreigner_or_refugee') }}</label>
<select id="foreginer_refugee" name="non_ugandan_foreigner_or_refugee" class="form-control ">
<option value="null"> -- {{ __('patients.select') }} --</option>
<option value="1"> {{ __('patients.foreigner') }} </option>
<option value="2"> {{ __('patients.refugee') }} </option>
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="non_ugandan_national_id">{{ __('patients.national_id') }}</label>
<input type="text" name="non_ugandan_national_id_no" value="" class="form-control">
<div class="help-block with-errors"></div>
</div>
</div>
<div id="ugandan_regions">
<div class="form-group">
{{ Form::label('residence','Residence') }}
<select class="form-control col-md-12" name="residence" id="residence" style="display: block; width: 100%" required></select>
<div class="help-block with-errors"></div>
<a href="#modal_residence" data-toggle="modal" id="modal_residence_link"><font size="1">{{ __('patients.add_new_residence') }} </font></a>
</div>
</div>
@if (!empty($patient_registration_fields))
@foreach ($patient_registration_fields as $patient_registration_field)
<input type="hidden" name="registration_field_names[]" id="reg_field_{{$patient_registration_field->id}}" value="reg_field_{{$patient_registration_field->id}}"/>
@if (!empty($patient_registration_field->options))
<div class="form-group">
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
<select name="registration_field_values[]" id="{{$patient_registration_field->name}}" class="col-sm-12 {{ ($patient_registration_field->compulsory == 1)? 'compulsory':'' }} form-control" {{ ($patient_registration_field->compulsory == 1)? 'required':'' }}>
<option value="">--select--</option>
@php
$options = explode(',',$patient_registration_field->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
</div>
@else
<div class="form-group">
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
<input type="text" name="registration_field_values[]" class="col-sm-12 {{ ($patient_registration_field->compulsory == 1)? 'compulsory':'' }} form-control" {{ ($patient_registration_field->compulsory == 1)? 'required':'' }}>
</div>
@endif
@endforeach
@endif
@if(is_fingerprint_enabled())
<div>
{{ Form::label('fingerprint_template',__('patients.patient_fingerprint')) }}
<div class="fingerprint_box text-center">
<img id="fingerprint_image" height="240" width="220">
</div>
{{ Form::hidden('fingerprint_template', '', ['id' => 'fingerprint_template']) }}
<button type="button" onClick='capture_fingerprint()' class="btn btn-sm btn-primary">{{ __('patients.capture_fingerprint') }}</button>
<p id="scanner_msg"></p>
</div>
@endif
</div>
<div class="col-md-8">
<hr>
</div>
<div class="col-md-4">
{{ Form::button(__('patients.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id' => 'patients_submit']) }}
{{ Form::button(__('patients.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
</div>
</div>
{{ Form::close() }}
</div>
@endsection
<div class="modal fade" id="modal_occupation" tabindex="-1" role="dialog">
<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="exampleModalLabel1">{{ __('patients.register_occupation') }}</h4>
</div>
<div class="modal-body">
<div class="controls">
<input id="new_occupation_name" name="new_occupation_name"
type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<input type="button" class="btn btn-success" id="submit_new_occupation" value="<?php echo __('patients.save') ?>"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_company" tabindex="-1" role="dialog">
<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="exampleModalLabel1">{{ __('patients.register_company') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
{{ Form::label('company_name', __('patients.company_name')) }}
{{ Form::text('company_name', '', ['class' => 'form-control compulsory', 'id' => 'company_name']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company_contact', __('patients.contact')) }}
{{ Form::text('company_contact', '', ['class' => 'form-control compulsory', 'id' => 'company_contact']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company_identifier', __('patients.identifier')) }}
{{ Form::text('company_identifier', '', ['class' => 'form-control', 'id' => 'company_identifier']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitCompany()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_residence" tabindex="-1" role="dialog">
<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">{{ __('patients.add_new_residence') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('patients.district') }}</label>
<div id="district_id_div">{{ Form::select('district_id', $districts, '', ['id'=>'district_id','class'=>'form-control compulsory']) }}</div>
{{ Form::text('new_district_name', '', ['id' => 'new_district_name', 'class' => 'form-control compulsory', 'style' => 'display: none']) }}
<a href="#" id="modal_district_link">{{ __('patients.add_new_district') }}</a>
</div>
<div class="form-group">
<label>{{ __('patients.county') }}</label>
<div id="county_id_div"><select class='form-control' name='county_id' id='county_id'></select></div>
{{ Form::text('new_county_name', '', ['id' => 'new_county_name', 'class' => 'form-control', 'style' => 'display: none']) }}
<a href="#" id="modal_county_link">{{ __('patients.add_new_county') }}</a>
</div>
<div class="form-group">
<label>{{ __('patients.sub_county') }}</label>
<div id="subcounty_id_div"><select class='form-control' name='subcounty_id' id='subcounty_id'></select></div>
{{ Form::text('new_subcounty_name', '', ['id' => 'new_subcounty_name', 'class' => 'form-control', 'style' => 'display: none']) }}
<a href="#" id="modal_subcounty_link">{{ __('patients.add_new_subcounty') }}</a>
</div>
<div class="form-group">
<label>{{ __('patients.parish') }}</label>
<div id="parish_id_div"><select class='form-control' name='parish_id' id='parish_id'></select></div>
{{ Form::text('new_parish_name', '', ['id' => 'new_parish_name', 'class' => 'form-control', 'style' => 'display: none']) }}
<a href="#" id="modal_parish_link">{{ __('patients.add_new_parish') }}</a>
</div>
<div class="form-group">
<label>{{ __('patients.village') }}</label>
{{ Form::text('new_village_name', '', ['id' => 'new_village_name', 'class' => 'form-control compulsory']) }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitResidenceVillage()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
<!-- end of residence modals -->
{{-- start of add other foreigner country modal --}}
<div class="modal fade" id="modal_add_country_foreigner" tabindex="-1" role="dialog">
<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">Add New Country</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>Country Name</label>
<input type="text" name="new_country_name" id="new_country_name" value="" class="form-control compulsory">
<div class="help-block with-errors"></div>
</div>
{{-- @error('name')
<span class="text-danger">{{ $message }}</span>
@enderror --}}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitCountry()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
<div class="modal" id="modal_similar_patients" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center"><b>{{ __('patients.similar_patients') }}</b></h4>
</div>
<div class="modal-body">
<div class="table-responsive" id="modal_table"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.close') }}</button>
</div>
</div>
</div>
</div>
@push('scripts')
<!-- pull in select2 for auto searchanble drop downs -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
{{-- <script src="{{ asset('elite/js/validator.js') }}"></script> --}}
<script src="{{ asset('js/patients/create.js') }}"></script>
<script src="{{ asset('elite/js/mask.js') }}"></script>
<script type="text/javascript">
function capture_fingerprint() {
$.ajax({
url: '/patients/fetch_fingerprint_from_scanner/',
success: function(response){
let responseArray = JSON.parse(response);
if (responseArray["error_code"] == "0") {
let template = responseArray["template"];
let pngImage = "data:image/png;base64," + responseArray["image"];
$("#fingerprint_image").attr('src', pngImage);
$('#fingerprint_template').val(template);
$('#scanner_msg').text("Fingerprint Captured").css('color', 'green');
} else {
$('#scanner_msg').text("Error Code: " + responseArray["error_code"] + " - Error Message: " + responseArray["error_message"]).css('color', 'red');
}
}
});
}
function submitResidenceVillage() {
let district_id = $("#district_id").val();
let county_id = $("#county_id").val();
let subcounty_id = $("#subcounty_id").val();
let parish_id = $("#parish_id").val();
let new_district_name = $("#new_district_name").val();
let new_county_name = $("#new_county_name").val();
let new_subcounty_name = $("#new_subcounty_name").val();
let new_parish_name = $("#new_parish_name").val();
let new_village_name = $("#new_village_name").val();
if ((district_id === "" && new_district_name === "") || new_village_name === "") {
alert("Please make sure that you fill in a village name and a district");
return false;
}
$.ajax({
method: 'POST',
url: '/patients/quick_add_residence',
data: {
'district_id' : district_id, 'county_id' : county_id, 'subcounty_id' : subcounty_id, 'parish_id' : parish_id, 'new_district_name' : new_district_name,
'new_county_name' : new_county_name, 'new_subcounty_name' : new_subcounty_name, 'new_parish_name' : new_parish_name, 'new_village_name' : new_village_name
},
success: function(response){
$('#residence').append($('<option>', {
value: response,
text: new_village_name
})).val(response);
$('#modal_residence').modal('hide');
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(JSON.stringify(jqXHR));
}
});
}
// add new country
function submitCountry() {
var new_country_name = $("#new_country_name").val();
if ($("#new_country_name").val() === "" || !$("#new_country_name").val()) {
alert("Please make sure that you fill in a country name");
return false;
}
var data = {
'name':new_country_name,
};
// $.ajax({
// method: 'POST',
// url: '/patients/add_country',
// data: data,
// success: function(response){
// if(!isNaN(response)){
// //response = last inserted id
// $('#country_picker').append($('<option>', {
// value: response,
// text: new_country_name
// }));
// $('#country_picker').val(response);//preselect the newly added referral
// $('#modal_add_country_foreigner').modal('hide'); //manually hide the modal
// } else {
// alert("error occurred");
// }
// },
// error: function(jqXHR, textStatus, errorThrown) {
// alert(JSON.stringify(jqXHR));
// console.log(JSON.stringify(jqXHR));
// }
// });
$.ajax({
method: 'POST',
url: '/patients/add_country',
data: data,
success: function(response) {
if (!isNaN(response)) {
// response = last inserted id
$('#country_picker').append($('<option>', {
value: response,
text: new_country_name
}));
$('#country_picker').val(response); // preselect the newly added country
$('#modal_add_country_foreigner').modal('hide'); // manually hide the modal
} else {
alert(response.error || "An unknown error occurred");
}
},
error: function(jqXHR) {
var response = jqXHR.responseJSON;
if (jqXHR.status === 409 && response && response.error) {
alert(response.error); // Show the "Country already exists" message
} else {
alert("An error occurred: " + JSON.stringify(jqXHR));
}
}
});
}
function submitCompany() {
var company_name = $("#company_name").val();
var company_contact = $("#company_contact").val();
var company_identifier = $("#company_identifier").val();
if ($("#company_name").val() === "" || !$("#company_name").val()) {
alert("Please make sure that you fill in a company name");
return false;
}
if ($("#company_contact").val() === "" || !$("#company_contact").val()) {
alert("Please make sure that you add the company contact");
return false;
}
var data = {'company_name':company_name, 'company_contact': company_contact, 'company_identifier': company_identifier};
$.ajax({
method: 'POST',
url: '/patients/add_company',
data: data,
success: function(response){
if(!isNaN(response)){
//response = last inserted id
$('#company').append($('<option>', {
value: response,
text: company_name
}));
$('#company').val(response);//preselect the newly added referral
$('#modal_company').modal('hide'); //manually hide the modal
} else {
alert("error occurred");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
$('#date_of_birth').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
endDate: new Date()
});
$('#age_in_years, #age_in_months').on('change', function () {
let years = parseInt($('#age_in_years').val());
let months = parseInt($('#age_in_months').val());
let possibleBirthday = new Date();
if (!isNaN(years) || !isNaN(months)) {
possibleBirthday.setMonth(possibleBirthday.getMonth() - (months + (years * 12)));
$('#date_of_birth').val(format_date(possibleBirthday));
} else {
alert("<?php echo __('patients.valid_number_years')?>")
}
});
function format_date(date) {
let d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2) {
month = '0' + month;
}
if (day.length < 2) {
day = '0' + day;
}
return [day, month, year].join('/');
}
$("#date_of_birth").on('change', function () {
var today = new Date();
var birthDate = $(this).val();
var temp_date = birthDate.split("/");
birthDate = new Date(temp_date[2], (temp_date[1] - 1), temp_date[0]);
//calculate years
var age = today.getFullYear() - birthDate.getFullYear();
age = parseInt(age);
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
//calculate months
var monthBirth = birthDate.getMonth() + 1;
var monthToday = today.getMonth() + 1;
if (monthToday > monthBirth) {
var months = monthToday - monthBirth;
} else if (monthToday == monthBirth) {
var months = 0;
} else if (monthToday < monthBirth) {
var months = monthToday - monthBirth;
months = months + 12;
}
if (months < 10) {
months = '0' + months
}
//set the values
$('#age_in_years').val(age);
$('#age_in_months').val(months);
});
$('#next_of_kin').on('change', function () {
if ($(this).val() != "" && $(this).val() != " ") {
$('#kin_div').show();
} else {
$('#kin_div').hide();
}
});
$('#first_name, #last_name').change(function () {
let first_name = $('#first_name').val();
let last_name = $('#last_name').val();
if (first_name !== "" && last_name !== "") {
$.ajax({
method: 'POST',
url: '/patients/check_duplicate_patients',
data: {'first_name': first_name, 'last_name': last_name},
success: function(response){
let responseArray = JSON.parse(response);
if (responseArray["results_count"] > 0) {
$("#similar_patients_names").text(responseArray["results_count"] + " patient(s) with similar names were found. Click here to view them and avoid duplicate patient records");
$("#similar_patients_names").show();
$("#modal_table").html(responseArray["html"]);
} else {
$("#similar_patients_names").hide();
}
}
});
}
});
$('#phone').change(function () {
let phone = $('#phone').val();
$.ajax({
method: 'POST',
url: '/patients/check_duplicate_patients',
data: {'phone': phone},
success: function(response){
let responseArray = JSON.parse(response);
if (responseArray["results_count"] > 0) {
$("#similar_phone_number").text(responseArray["results_count"] + " patient(s) with similar phone numbers were found. Click to view them");
$("#similar_phone_number").show();
$("#modal_table").html(responseArray["html"]);
} else {
$("#similar_phone_number").hide();
}
}
});
});
$('#similar_patients_names, #similar_phone_number').click(function () {
$('#modal_similar_patients').modal('show');
});
$('#district_id').on('change', function () {
//remove content from all dependant dropdowns
$('#county_id').empty();
$('#subcounty_id').empty();
$('#parish_id').empty();
//get selected value
let id = $('#district_id').val();
$.ajax({
method: 'GET',
url: '/patients/get_counties/' + id,
success: function(response){
$('#county_id').html(response);
}
});
});
$('#county_id').on('change', function () {
$('#subcounty_id').empty();
$('#parish_id').empty();
//get selected value
let id = $('#county_id').val();
$.ajax({
method: 'GET',
url: '/patients/get_subcounties/' + id,
success: function(response){
$('#subcounty_id').html(response);
}
});
});
$('#subcounty_id').on('change', function () {
$('#parish_id').empty();
//get selected value
let id = $('#subcounty_id').val();
$.ajax({
method: 'GET',
url: '/patients/get_parishes/' + id,
success: function(response){
$('#parish_id').html(response);
}
});
});
/* make residence dropdowns searchable */
$('#district_id,#county_id,#subcounty_id,#parish_id,#company,#occupation,#foreginer_refugee').select2({
placeholder: "<?php echo __('patients.select')?>",
width: '100%',
});
$('#modal_district_link').click(function () {
if($('#new_district_name').is(":visible")) {
$('#district_id_div').show();
$('#new_district_name').val('').hide();
} else {
$('#new_district_name').show();
$('#district_id_div').val('').hide();
$('#district_id').val('');
}
});
$('#modal_county_link').click(function () {
if($('#new_county_name').is(":visible")) {
$('#county_id_div').show();
$('#new_county_name').val('').hide();
} else {
$('#new_county_name').show();
$('#county_id_div').hide();
$('#county_id').val('');
}
});
$('#modal_subcounty_link').click(function () {
if($('#new_subcounty_name').is(":visible")) {
$('#subcounty_id_div').show();
$('#new_subcounty_name').val('').hide();
} else {
$('#new_subcounty_name').show();
$('#subcounty_id_div').hide();
$('#subcounty_id').val('');
}
});
$('#modal_parish_link').click(function () {
if($('#new_parish_name').is(":visible")) {
$('#parish_id_div').show();
$('#new_parish_name').val('').hide();
} else {
$('#new_parish_name').show();
$('#parish_id_div').hide();
$('#parish_id').val('');
}
});
//$('.select2-selection.select2-selection--single').addClass('form-control');//add class to select2 display
$('.select2-selection.select2-selection--single').css('height', 'calc(3.85rem)');
$('.select2-selection.select2-selection--single').css('padding-top', '5px');
$('.select2-selection__arrow').css('top', '3px');
$("#submit_new_occupation").click(function () {
var new_occupation_name = $("#new_occupation_name").val();
if (new_occupation_name == '') {
alert("<?php echo __('patients.fill_name')?>");
} else {
$.ajax({
type: "POST",
url: "/add_new_occupation_dynamically",
data: {name: new_occupation_name},
cache: false,
success: function (response) {
if (response == 'false') {
alert("<?php echo __('patients.new_occupation_error')?>");
} else {
$('.occupation').append($('<option>', {
value: response,
text: new_occupation_name
}));
$('.occupation').val(response);//preselect the newly added referral
//$('#modal_occupation').hide();
$('#modal_occupation').modal('hide');
}
}
});
}
$("#new_occupation_name").val('');
$("#modal_occupation #close").click();
});
$("#citizenship").click(function(){
var citizenship = $("#citizenship").val();
if (citizenship == 0) {
$("#not_ugandan_regions").show();
$("#ugandan_regions").hide();
$('#residence').prop('required', false);
} else {
$("#not_ugandan_regions").hide();
$("#ugandan_regions").show();
$("#country_id").val('');
$('#residence').prop('required', true);
}
});
$('#residence').select2({
placeholder: 'Search residences',
ajax: {
url: '/patients/search_residences',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.text,
id: item.ids
}
})
};
},
cache: true
}
});
$("#patients_submit").click(function (e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$("#white-box.compulsory").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border','1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("Please fill in all compulsory fields");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
</script>
{{-- palm vein scanner --}}
{{-- <script type="text/javascript" src="{{ asset('js/palmsecure/fbf.standalone.js') }}" xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5"></script> --}}
{{-- <script type ="text/javascript" src="{{ asset('js/palmsecure/fbf.module.js') }}"></script> --}}
<script type ="text/javascript" src="{{ asset('js/palmsecure/demo.bundle.js') }}"></script>
<script type ="text/javascript" src="{{ asset('js/palmsecure/demo.js') }}"></script>
<script type="text/javascript">
start();
</script>
{{-- end of palm vein scanner --}}
@endpush
@@ -0,0 +1,788 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}"
rel="stylesheet" type="text/css"/>
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet"/>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.edit_patient') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.edit_patient') }}</li>
</ol>
</div>
<!-- /.col-lg-12 -->
</div>
<div class="row">
<div class="col-md-12">
@include('flash::message')
@foreach ($errors->all() as $error)
<div>
<font color="red">{{ $error }}</font>
</div>
@endforeach
<div class="white-box" id="white-box">
{{ Form::model($patient, ['method' => 'PUT', 'route' => ['patients.update',$patient], 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-sm-4">
<div class="form-group">
{{ Form::label('first_name',__('patients.first_name')) }}
{{ Form::text('first_name',$patient->first_name,['class' => 'form-control compulsory', 'required', 'data-error'=>'','placeholder'=>'Christian name eg Fred']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('last_name',__('patients.last_name')) }}
{{ Form::text('last_name',$patient->last_name,['class' => 'form-control compulsory', 'required','placeholder'=>'Surname eg Asiimwe']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('gender',__('patients.gender')) }}
<br>
{{ Form::radio('gender', 1, false, ["required"]) }} {{ __('patients.male') }} &nbsp;&nbsp;
{{ Form::radio('gender', 2, false, ["required"]) }} {{ __('patients.female') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('national_id',__('patients.national_id')) }}
{{ Form::text('national_id', strtoupper($patient->national_id),['class' => 'form-control','maxlength'=>15]) }}
</div>
<div class="form-group">
{{ Form::label('date_of_birth',__('patients.date_of_birth')) }}
<div class="input-group">
{{ Form::text('date_of_birth',$dob,['class' => 'form-control compulsory', 'required','readonly','id'=>'date_of_birth']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<div class="help-block with-errors"></div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('age',__('patients.years')) }}
{{ Form::number('age_in_years',\Carbon\Carbon::now()->diffInYears($patient->date_of_birth),['class' => 'form-control compulsory','id'=>'age_in_years','min'=>'0', 'max'=>'120']) }}
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
@php
$months = \Carbon\Carbon::now()->diffInMonths($patient->date_of_birth) - (\Carbon\Carbon::now()->diffInYears($patient->date_of_birth) *12);
@endphp
{{ Form::label('age',__('patients.months')) }}
{{ Form::number('age_in_months',$months,['class' => 'form-control','id'=>'age_in_months','min'=>'0','max'=>'12']) }}
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('marital_status',__('patients.marital_status')) }}
<br>
@foreach($marital_statuses as $key=>$value)
{{ Form::radio('marital_status', $key,false,[]) }} {{ $value }} &nbsp;&nbsp;
@endforeach
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('religion',__('patients.religion')) }}
{{ Form::select('religion',$religions,$patient->religion_id,['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
@if( Auth::user()->hasRole('Super Admin'))
<div class="form-group">
{{ Form::label('is_test_patient',__('patients.is_test_patient')) }}
<br>
{{ Form::radio('is_test_patient', 1, $patient->is_test_patient == 1) }} Yes &nbsp;&nbsp;
{{ Form::radio('is_test_patient', 0, $patient->is_test_patient == 0) }} No &nbsp;&nbsp;
<div class="help-block with-errors"></div>
</div>
@endif
</div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('occupation',__('patients.occupation')) }}
{{ Form::select('occupation',$occupations, $patient->occupation_id,['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('next_of_kin',__('patients.next_of_kin')) }}
{{ Form::text('next_of_kin',$patient->next_of_kin,['class' => 'form-control compulsory','required', 'onchange' => "show('kin_div')"]) }}
</div>
<div class="form-group" id="kin_div">
{{ Form::label('next_of_kin_relationship',__('patients.next_of_kin_relationship')) }}
{{ Form::select('next_of_kin_relationship',$relationships,$patient->next_of_kin_relationship,['class' => 'form-control compulsory']) }}
<br>
{{ Form::label('next_of_kin_phone',__('patients.next_of_kin_phone')) }}
{{ Form::text('next_of_kin_phone',$patient->phone_of_next_of_kin,['class' => 'form-control','pattern' => '\d{10}', 'title'=>'Phone number must be exactly 10 digits']) }}
</div>
<div class="form-group">
{{ Form::label('phone',__('patients.phone')) }}
{{ Form::text('phone',$patient->phone,['class' => 'form-control compulsory','pattern' => '\d{10}', 'title'=>'Phone number must be exactly 10 digits']) }}
</div>
<div class="form-group">
{{ Form::label('alternative_phone', 'Alternative Phone Number') }}
{{ Form::text('alternative_phone',$patient->alternative_phone,['class' => 'form-control','id' => 'alternative_phone','pattern' => '\d{10}', 'title'=>'Phone number must be exactly 10 digits']) }}
</div>
<div class="form-group">
{{ Form::label('phone_owner',__('patients.phone_owner')) }}
<br>
{{ Form::radio('phone_owner','self',($patient->phone_owner == "Self" || $patient->phone_owner == "self") ? 1 : 0,['id'=>'owned']) }} {{ __('patients.self') }}
&nbsp;&nbsp;
{{ Form::radio('phone_owner','other',$patient->phone_owner != "Self" ? 1 : 0,['id'=>'non_owned']) }} {{ __('patients.other') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group owners_name">
{{ Form::label("owner_name",__('patients.phone_owner_name')) }}
{{ Form::text('owner_name',$patient->phone_owner,['id'=>'owner_name','class' => 'form-control compulsory']) }}
</div>
<!-- <div class="form-group">
{{ Form::label('lc_one',__('patients.lc_one')) }}
{{ Form::text('lc_one',$patient->lc_one,['class' => 'form-control', 'data-error'=>'LC 1 chairman\'s name']) }}
<div class="help-block with-errors"></div>
</div> -->
<div class="form-group">
{{ Form::label('patient_category',__('patients.patient_category'))}}
{{ Form::select('patient_category',$patient_categories,$patient->category_id,['class' => 'form-control compulsory', 'required', 'data-error'=>'']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company',__('patients.company_slash_employer'))}}
{{ Form::select('company', $companies ,$patient->company_id,['class' => 'form-control', 'data-error'=>'', 'id' => 'company']) }}
<div class="help-block with-errors"></div>
<a href="#modal_company" data-toggle="modal" id="modal_company_link"><font
size="1">{{ __('patients.add_new_company') }} </font></a>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
{{ Form::label('language',__('patients.preferred_language')) }}
{{ Form::select('language',['' => '- select -','eng'=>'English','vern'=>'Vernacular'],$patient->language,['class' => 'form-control compulsory', 'required', 'data-error'=>'Select the language']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('citizenship',__('patients.citizenship')) }}
{{ Form::select('citizenship',['' => '- Select -','1'=>'Ugandan','0'=>'Non Ugandan'],$patient->citizenship,['class' => 'form-control compulsory', 'required', 'data-error'=>'Select the language','id' => 'citizenship']) }}
<div class="help-block with-errors"></div>
</div>
<div id="not_ugandan_regions" @if($patient->citizenship == 1) style="display: none" @endif>
<div class="form-group">
{{ Form::label('country_id',__('patients.country_of_origin')) }}
{{ Form::select('country_id', $countries, $patient->country_id, ['class' => 'form-control', 'data-error'=>'Select the country']) }}
<div class="help-block with-errors"></div>
</div>
@php
$other_patients_info_data = !empty($patient->other_patients_info) ? json_decode($patient->other_patients_info) : '';
@endphp
<div class="form-group">
<label for="non_ugandan_foreigner_or_refugee">{{ __('patients.foreigner_or_refugee') }}</label>
<select id="foreginer_refugee" name="non_ugandan_foreigner_or_refugee" class="form-control ">
<option value="null"> -- {{ __('patients.select') }} --</option>
<option value="1" @selected(isset($other_patients_info_data) && is_int($other_patients_info_data) && $other_patients_info_data->non_ugandan_foreigner_or_refugee == 1 ?? '')> {{ __('patients.foreigner') }} </option>
<option value="2" @selected(isset($other_patients_info_data) && is_int($other_patients_info_data) && $other_patients_info_data->non_ugandan_foreigner_or_refugee == 2 ?? '')> {{ __('patients.refugee') }} </option>
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="non_ugandan_national_id">{{ __('patients.national_id') }}</label>
<input type="text" name="non_ugandan_national_id_no" value=" {{ $other_patients_info_data->non_ugandan_national_id_no ?? '' }}" class="form-control">
<div class="help-block with-errors"></div>
</div>
</div>
<div id="ugandan_regions" @if($patient->citizenship == 0) style="display: none" @endif>
<div class="form-group">
{{ Form::label('residence','Residence') }}
<select class="form-control" name="residence" id="residence" required>
@php
$residence_array = explode(",", $patient->address_details);
$district_id = $residence_array[4] ?? 0;
$county_id = $residence_array[3] ?? 0;
$subcounty_id = $residence_array[2] ?? 0;
$parish_id = $residence_array[1] ?? 0;
$village_id = $residence_array[0] ?? 0;
@endphp
<option value="{{ $patient->address_details ?? '0,0,0,0,0' }}" selected>{{ __('patients.village') }}
: {{ get_name($village_id, "id", "name", "villages") }} {{ __('patients.district') }}
: {{ get_name($district_id, "id", "name", "districts") }}</option>
</select>
<div class="help-block with-errors"></div>
<a href="#modal_village_residence" data-toggle="modal"
id="modal_village_residence_link"><font
size="1">{{ __('patients.add_new_residence') }} </font></a>
</div>
</div>
@if (!empty($patient_registration_fields))
@php $registration_fields = !empty($patient->registration_fields)? json_decode($patient->registration_fields, true):[]; @endphp
@foreach ($patient_registration_fields as $patient_registration_field)
@php
$field_value = 'reg_field_'.$patient_registration_field->id;
@endphp
<input type="hidden" name="registration_field_names[]"
id="reg_field_{{$patient_registration_field->id}}"
value="reg_field_{{$patient_registration_field->id}}"/>
@if (!empty($patient_registration_field->options))
<div class="form-group">
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
<select name="registration_field_values[]"
id="{{$patient_registration_field->name}}"
class="col-sm-12 {{ ($patient_registration_field->compulsory == 1)? 'compulsory':'' }} form-control" {{ ($patient_registration_field->compulsory == 1)? 'required':'' }}>
<option value="">--select--</option>
@php
$options = explode(',',$patient_registration_field->options);
for ($i=0; $i < count($options) ; $i++) {
if(!empty($registration_fields[$field_value]) && $options[$i] == $registration_fields[$field_value]) echo '<option selected value="'.$options[$i].'">'.$options[$i].'</option>';
else echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
</div>
@else
<div class="form-group">
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
<input type="text" name="registration_field_values[]"
class="col-sm-12 {{ ($patient_registration_field->compulsory == 1)? 'compulsory':'' }} form-control"
{{ ($patient_registration_field->compulsory == 1)? 'required':'' }} value="{{ !empty($registration_fields[$field_value])? $registration_fields[$field_value]:'' }}">
</div>
@endif
@endforeach
@endif
@if(is_fingerprint_enabled())
<div>
{{ Form::label('fingerprint_template', __('patients.patient_fingerprint')) }}
<div class="fingerprint_box text-center">
<img id="fingerprint_image" height="240" width="220">
</div>
{{ Form::hidden('fingerprint_template', '', ['id' => 'fingerprint_template']) }}
<button type="button" onClick='capture_fingerprint()'
class="btn btn-sm btn-primary">{{ __('patients.capture_fingerprint') }}</button>
<p id="scanner_msg"></p>
</div>
@endif
</div>
<div class="col-md-8">
<hr>
</div>
<div class="col-md-4">
{{ Form::button(__('patients.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id' => 'patients_submit']) }}
{{ Form::button(__('patients.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
@if (!in_array($patient->id, $episodes))
<form action="{{url('patients', [$patient->id])}}" method="POST" style="float: right;">
<input type="hidden" name="_method" value="<?php echo __('patients.delete') ?>">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input href="#modal_reason" data-toggle="modal" id="modal_reason_link" type="button"
class="btn btn-danger" value="<?php echo __('patients.deactivate_patient') ?>"/>
</form>
@endif
</div>
</div>
</div>
</div>
</div>
<!-- Reason for Patient De-activation modal -->
<div class="modal fade" id="modal_reason" tabindex="-1" role="dialog">
<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="exampleModalLabel1">{{ __('patients.reason_for_deactivating_patient') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<input class="form-control compulsory" id="patient_deactivation_reasons"
name="patient_deactivation_reasons" type="text" cols="44" rows="5"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ __('patients.cancel') }}</button>
<button type="button" class="btn btn-danger"
onclick="submitDeactivationReason()"><?php echo __('patients.deactivate_patient') ?></button>
</div>
</div>
</div>
</div>
<!-- new residence modals (add village + add district) -->
<div class="modal fade" id="modal_village_residence" tabindex="-1" role="dialog">
<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="exampleModalLabel1">{{ __('patients.add_new_residence') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('patients.district') }}</label>
{{ Form::select('residence_district_name', $districts, '', ['id'=>'residence_district_name','class'=>'form-control compulsory']) }}
<a id="modal_district_residence_link" style="cursor: pointer;"><font
size="1">{{ __('patients.add_new_district') }} </font></a>
</div>
<div class="form-group">
<label>{{ __('patients.village') }}</label>
<input class="form-control compulsory" id="new_residence_village_name"
name="new_residence_village_name" type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitResidenceVillage()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_district_residence" tabindex="-1" role="dialog" style="padding-top: 50px;">
<div class="modal-dialog 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" id="exampleModalLabel1">{{ __('patients.add_new_residence') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('patients.district') }}</label>
<input class="form-control compulsory" id="new_residence_district_name"
name="new_residence_district_name" type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitResidenceDistrict()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
<!-- end of residence modals -->
<div class="modal fade" id="modal_company" tabindex="-1" role="dialog">
<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="exampleModalLabel1">{{ __('patients.register_company') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
{{ Form::label('company_name', __('patients.company_name')) }}
{{ Form::text('company_name', '', ['class' => 'form-control compulsory', 'id' => 'company_name']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company_contact', __('patients.contact')) }}
{{ Form::text('company_contact', '', ['class' => 'form-control compulsory', 'id' => 'company_contact']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company_identifier', __('patients.identifier')) }}
{{ Form::text('company_identifier', '', ['class' => 'form-control', 'id' => 'company_identifier']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitCompany()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<!-- <script src="{{ asset('elite/js/validator.js') }}"></script> -->
<!-- pull in select2 for auto searchanble drop downs -->
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/js/mask.js') }}"></script>
<script type="text/javascript">
let patient_id = <?php echo $patient->id; ?>;
function capture_fingerprint() {
$.ajax({
url: '/patients/fetch_fingerprint_from_scanner/',
success: function (response) {
let responseArray = JSON.parse(response);
if (responseArray["error_code"] == "0") {
let template = responseArray["template"];
let pngImage = "data:image/png;base64," + responseArray["image"];
$("#fingerprint_image").attr('src', pngImage);
$('#fingerprint_template').val(template);
$('#scanner_msg').text("Fingerprint Captured").css('color', 'green');
} else {
$('#scanner_msg').text("Error Code: " + responseArray["error_code"] + " - Error Message: " + responseArray["error_message"]).css('color', 'red');
}
}
});
}
function submitResidenceDistrict() {
var new_residence_district_name = $("#new_residence_district_name").val();
if ($("#new_residence_district_name").val() === "" || !$("#new_residence_district_name").val()) {
alert("Please make sure that you fill in a district name");
return false;
}
var data = {'new_residence_district_name': new_residence_district_name};
$.ajax({
method: 'POST',
url: '/patients/quick_add_district_residence',
data: data,
success: function (response) {
if (!isNaN(response)) {
//response = last inserted id
$('#residence_district_name').append($('<option>', {
value: response,
text: new_residence_district_name
}));
$('#residence_district_name').val(response);//preselect the newly added
$('#modal_district_residence').modal('hide'); //manually hide the modal
$('#modal_village_residence').modal('show');
} else {
alert("error occurred");
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
function submitResidenceVillage() {
var residence_district_name = $("#residence_district_name").val();
var new_residence_village_name = $("#new_residence_village_name").val();
if ($("#new_residence_village_name").val() === "" || !$("#new_residence_village_name").val() || !$("#residence_district_name").val()) {
alert("Please make sure that you fill in a village name and a district");
return false;
}
var data = {
'residence_district_name': residence_district_name,
'new_residence_village_name': new_residence_village_name
};
var district_village_ids = "";
$.ajax({
method: 'POST',
url: '/patients/quick_add_village_residence',
data: data,
success: function (response) {
if (!isNaN(response)) {
//response = newly created village. Now create residence string i.e village,parish etc
district_village_ids = response + ",0" + ",0" + ",0," + residence_district_name;
$('#residence').append($('<option>', {
value: district_village_ids,
text: new_residence_village_name
}));
$('#residence').val(district_village_ids);//preselect the newly added
$('#modal_village_residence').modal('hide'); //manually hide the modal
} else {
alert("error occurred");
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
function submitDeactivationReason() {
var reason = $("#patient_deactivation_reasons").val();
if ($("#patient_deactivation_reasons").val() === "" || !$("#patient_deactivation_reasons").val()) {
alert("Please fill in the reason for deleting the Patient");
return false;
}
var data = {'patient_deactivation_reasons': reason, 'patient_id': patient_id};
$.ajax({
method: 'POST',
url: '/patients/delete_patient_with_reason',
data: data,
success: function (response) {
if (response == 1) {
window.location.href = "/patients";
} else {
alert("error occurred");
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
function submitCompany() {
var company_name = $("#company_name").val();
var company_contact = $("#company_contact").val();
var company_identifier = $("#company_identifier").val();
if ($("#company_name").val() === "" || !$("#company_name").val()) {
alert("Please make sure that you fill in a company name");
return false;
}
if ($("#company_contact").val() === "" || !$("#company_contact").val()) {
alert("Please make sure that you add the company contact");
return false;
}
var data = {
'company_name': company_name,
'company_contact': company_contact,
'company_identifier': company_identifier
};
$.ajax({
method: 'POST',
url: '/patients/add_company',
data: data,
success: function (response) {
if (!isNaN(response)) {
//response = last inserted id
$('#company').append($('<option>', {
value: response,
text: company_name
}));
$('#company').val(response);//preselect the newly added referral
$('#modal_company').modal('hide'); //manually hide the modal
} else {
alert("error occurred");
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
$('#owned').on("click", function () {
$('.owners_name').hide();
$('#owner_name').val('');
});
$('#non_owned').on("click", function () {
$('.owners_name').show();
});
$('#h_contact_yes').on("click", function () {
$('.hosp_contact_div').show();
});
$('#h_contact_no').on("click", function () {
$('.hosp_contact_div').hide();
$('#hospital_contact').val('');
});
jQuery('#date_of_birth').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
endDate: new Date()
});
$('#age_in_years, #age_in_months').on('change', function () {
let years = parseInt($('#age_in_years').val());
let months = parseInt($('#age_in_months').val());
let possibleBirthday = new Date();
if (!isNaN(years) || !isNaN(months)) {
possibleBirthday.setMonth(possibleBirthday.getMonth() - (months + (years * 12)));
$('#date_of_birth').val(format_date(possibleBirthday));
} else {
alert("<?php echo __('patients.valid_number_years') ?>")
}
});
function format_date(date) {
let d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2) {
month = '0' + month;
}
if (day.length < 2) {
day = '0' + day;
}
return [day, month, year].join('/');
}
$("#date_of_birth").on('change', function () {
var today = new Date();
var birthDate = $(this).val();
var temp_date = birthDate.split("/");
birthDate = new Date(temp_date[2], (temp_date[1] - 1), temp_date[0]);
//calculate years
var age = today.getFullYear() - birthDate.getFullYear();
age = parseInt(age);
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
//calculate months
var monthBirth = birthDate.getMonth() + 1;
var monthToday = today.getMonth() + 1;
if (monthToday > monthBirth) {
var months = monthToday - monthBirth;
} else if (monthToday == monthBirth) {
var months = 0;
} else if (monthToday < monthBirth) {
var months = monthToday - monthBirth;
months = months + 12;
}
if (months < 10) {
months = '0' + months
}
//set the values
$('#age_in_years').val(age);
$('#age_in_months').val(months);
});
$('#next_of_kin').on('change', function () {
if ($(this).val() != "" && $(this).val() != " ") {
$('#kin_div').show();
} else {
$('#kin_div').hide();
}
});
/* make residence drop downs searchable */
$('#company').select2({
placeholder: "-- select --"
});
//$('.select2-selection.select2-selection--single').addClass('form-control');//add class to select2 display
$('.select2-selection.select2-selection--single').css('height', 'calc(3.85rem)');
$('.select2-selection.select2-selection--single').css('padding-top', '5px');
$('.select2-selection__arrow').css('top', '3px');
$("#citizenship").click(function () {
var citizenship = $("#citizenship").val();
if (citizenship == 0) {
$("#not_ugandan_regions").show();
$("#ugandan_regions").hide();
$('#residence').prop('required', false);
} else {
$("#not_ugandan_regions").hide();
$("#ugandan_regions").show();
$('#residence').prop('required', true);
}
});
$('#residence').select2({
placeholder: 'Search residences',
ajax: {
url: '/patients/search_residences',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.text,
id: item.ids
}
})
};
},
cache: true
}
});
$("#patients_submit").click(function (e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$("#white-box.compulsory").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border', '1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("Please fill in all compulsory fields");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
</script>
@endpush
@@ -0,0 +1,252 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.view') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.view') }}</li>
</ol>
</div>
</div>
<div class="white-box">
@include('flash::message')
{{ Form::open(['route' => 'patients.search', 'method' => 'ANY', 'role' => 'search']) }}
<div class="row">
<div class="col-md-2">
<div class="form-group" id="patient_numbers">
{{ Form::text('number', '', ['class' => 'form-control typeahead', 'placeholder' => 'Patient number', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-2" @if(!is_eye_module_enabled()) style='display: none' @endif>
<div class="form-group" id="previous_numbers">
{{ Form::text('previous_id', '', ['class' => 'form-control typeahead', 'placeholder' => 'Previous Number', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-4">
<div class="form-group" id="full_names">
{{ Form::text('full_name', '', ['class' => 'form-control typeahead', 'placeholder' => 'Patient Name', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="villages">
{{ Form::text('village', '', ['class' => 'form-control typeahead', 'placeholder' => 'Village', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-rounded btn-success"><span class="glyphicon glyphicon-search"></span> {{ __('patients.search') }}</button>
<span class="label label-info float-right" style="font-size: 12.5px;"> {{ count($patient_numbers) }} {{ __('patients.patients_registered') }}</span>
</div>
</div>
@if(isset($criteria))
<p>{{ __('patients.search_criteria') }} : <code>{{ $criteria }}</code></p>
@endif
{{ Form::close() }}
<div class="table-responsive">
<table class="table success-table table-sm table-striped table-hover" style="color: white;">
<thead >
<tr style="background-color: #00c292; color: white;">
<th>{{ __('patients.patient_number') }}</th>
<th>{{ __('patients.full_names') }}</th>
<th>{{ __('patients.gender') }}</th>
<th>{{ __('patients.age') }}</th>
<th>{{ __('patients.phone') }}</th>
<th>{{ __('patients.category') }}</th>
<th>{{ __('patients.village') }}</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($patients as $patient)
<tr>
<td>{{ $patient->number }}</td>
<td>{!! insurance_flag($patient->id) !!}</td>
<td>
@if($patient->gender == 1)
{{ __('patients.male') }}
@else
{{ __('patients.female') }}
@endif
</td>
<td>{{ get_patients_age($patient->date_of_birth) }}</td>
<td>{{ $patient->phone }}</td>
<td>{{ $categories[$patient->category_id] ?? "N/A" }}</td>
<td>{{ $villages[$patient->village_id] ?? '' }}</td>
<td><a href="/patients/{{ $patient->id }}/" class="btn btn-rounded btn-info btn-sm"><i class="fa fa-info-circle"></i> {{ __('patients.details') }}</a></td>
<td>
<a href="/patients/{{ $patient->id }}/edit/" class="btn btn-warning btn-rounded btn-sm"><i class="fa fa-pencil"></i> {{ __('patients.edit') }}</a>
</td>
<td>
<a href="/patient_episodes/set_patient_id/{{ $patient->id }}" class="btn btn-rounded btn-primary btn-sm"><i class="fa fa-hand-pointer-o"></i> <strong>{{ __('patients.select') }}</strong></a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
{{ $patients->links() }}
</div>
@endsection
@push('scripts')
<!-- Typehead Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/typeahead.js-master/dist/typeahead.bundle.min.js') }}"></script>
<!-- Data table javascript -->
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script type="text/javascript">
var substringMatcher = function (strs) {
return function findMatches(q, cb) {
var matches, substringRegex;
// an array that will be populated with substring matches
matches = [];
// regex used to determine if a string contains the substring `q`
substrRegex = new RegExp(q, 'i');
// iterate through the pool of strings and for any string that
// contains the substring `q`, add it to the `matches` array
$.each(strs, function (i, str) {
if (substrRegex.test(str)) {
matches.push(str);
}
});
cb(matches);
};
};
$('#patient_numbers .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'patient_numbers',
source: substringMatcher(<?php echo json_encode($patient_numbers); ?>)
}
);
$('#previous_numbers .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'previous_numbers',
source: substringMatcher(<?php echo json_encode($previous_ids); ?>)
}
);
$('#villages .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'villages',
source: substringMatcher(<?php echo json_encode(array_values($villages)); ?>)
}
);
$('#full_names .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'full_names',
source: substringMatcher(<?php echo json_encode($full_names); ?>)
}
);
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 200,
buttons: [
'copy',
{extend: 'csv',
message: "<php echo __('patients.registered_patients')?>",
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
},
{extend: 'excel',
message: "<php echo __('patients.registered_patients')?>",
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
sheetName: "<php echo __('patients.registered_patients')?>"
},
{extend: 'pdf',
message: "<php echo __('patients.registered_patients')?>",
orientation: 'portrait',
pageSize: 'LETTER',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
customize: function (doc) {
doc.defaultStyle.fontSize = 10;
// doc.styles.tableHeader.alignment = 'left';
}
},
{extend: 'print',
message: "<php echo __('patients.registered_patients')?>",
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
customize: function (win) {
$(win.document.body)
.css('font-size', '10pt')
.css('background', '#fff')
.prepend(
'<img src="<?php echo asset('uploads/logo/logo-sm.png'); ?>" style="position:absolute; top:0; right:0;" />'
);
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
}
]
});
$('.sorting').removeClass('sorting');//remove the sorting class
$('.sorting_asc').removeClass('sorting_asc');//remove the sorting class
</script>
@endpush
@@ -0,0 +1,133 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Patient Card</title>
<style>
@page {
size: A8 landscape;
margin: 0;
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.a8-container {
/*
width: 8.5cm;
height: 5.4cm; */
width: 450px;
height: 280px;
border: 1px solid #000;
display: flex;
/* align-items: center;
justify-content: center; */
/* margin: auto; */
/* page-break-inside: avoid; */
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 0px solid #000;
padding: 0px;
text-align: left;
}
</style>
</head>
<body>
{{-- <div class="a8-container"> --}}
<table >
{{-- row 1 --}}
<tr style=" border-bottom: 1px solid gray; ">
<td style="padding:8px;">
{{-- LOGO --}}
<img style="max-width: 100px; max-height: 25px;" src="{{ asset($data['hospitalInfo']->logo ?? '') }}" class="" alt="">
</td>
<td style="padding:8px; text-align:right; font-weight:600;">PATIENT CARD</td>
</tr>
{{-- row 2 --}}
<tr>
<td colspan="2" style="font-size:5px; padding-top:10px;padding-left:7px; padding-right:7px; ">NAME</td>
</tr>
{{-- row 3 --}}
<tr>
<td colspan="2" style="font-size:9px; font-weight:600;padding-left:7px; padding-right:7px;text-transform: uppercase " >
{{ $data['patient']->first_name ?? '' }}
{{ $data['patient']->last_name ?? '' }}
{{ $data['patient']->other_names ?? '' }}
</td>
</tr>
{{-- row 4 --}}
<tr style="">
<td style="font-size:5px; padding-top:10px;padding-left:7px; ">PATIENT NUMBER</td>
<td style="font-size:5px; padding-top:10px; padding-right:7px; text-transform: uppercase">RESIDENCE</td>
</tr>
{{-- row 5 --}}
<tr >
<td style="font-size:9px; font-weight:600; padding-left:7px; text-transform: uppercase">{{ $data['patient']->number ?? '' }} </td>
<td style="font-size:9px; font-weight:600; padding-right:7px;text-transform: uppercase">{{ get_name(get_name($data['patient']->id, "id", "village_id", "patients"), "id", "name", "villages") }}</td>
</tr>
{{-- row 6 --}}
<tr >
<td style="font-size:5px; padding-top:10px; padding-left:7px;vertical-align: top; ">DISTRICT <br>
<span style="font-size:9px; font-weight:600; text-transform: uppercase">{{ get_name($data['patient']->district_id, "id", "name", "districts") }} </span>
</td>
<td style="font-size:5px; padding-top:10px; padding-right:7px;">
{{ getDNS1DBarcodePNGOCards(sprintf("%04u", $data['patient']->id)) }}
<br>
<h4 style="color: black">{{ sprintf("%04u", $data['patient']->id) }}</h4></td>
</tr>
<tr>
<td colspan="2" style="font-size:5px; padding-top:5px; padding-left:7px; padding-right:7px; text-align:left; border-bottom: 0px solid gray; font-style:italic;">
This card is a property of {{ $data['hospitalInfo']->name ?? '' }}, If found please return to the facility. <br>
</td>
</tr>
<tr >
<td style="font-size:4px; text-align:left; padding-left:7px; padding-top:-12px; ">Supported by Streamline ; www.streamlinehealth.org</td>
<td style="text-align:right; ">
<img style="max-width: 60px; max-height: 25px; padding-right:7px; padding-top:5px;" src="{{ asset('uploads/streamline/color/280X50-06.png') }}" class="" alt="">
</td>
</tr>
</table>
{{-- </div> --}}
</body>
</html>
@@ -0,0 +1,265 @@
@extends('layouts.main')
@section('content')
@php
$other_patients_info_data = !empty($patient->other_patients_info) ? json_decode($patient->other_patients_info) : '';
@endphp
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.view') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.view') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="row">
<div class="col-sm-3">
<a class="img" href="#modal-photo" data-toggle="modal" style="color: whitesmoke">
@if(!is_null($patient->photo) && $patient->photo != "")
<img src='{{ asset($patient->photo) }}' class="img-rounded center" alt='Photo not available' />
@else
<img src="/uploads/streamline_images/person-place-holder.jpg" class="img-rounded center" style='height: 120px; width: 50%' alt='Photo not available' />
@endif
</a>
</div>
<div class="col-sm-6">
<table class="table-bordered table-condensed table-striped">
<tbody>
<tr>
<th><font color="black">{{ __('patients.patient_number') }}</font></th>
<td>{{ $patient->number }}</td>
</tr>
<tr>
<th>Code</th>
<td>
{{ getDNS1DBarcodePNG(sprintf("%04u", $patient->id)) }}
<h4>{{ sprintf("%04u", $patient->id) }}</h4>
</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.full_names') }}</font></th>
<td>{{ $patient->first_name }} {{ $patient->last_name }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.gender') }}</font></th>
<td>{{ $patient->gender == 1 ? 'Male' : 'Female' }}</td>
</tr>
<tr>
<th class="hidden-phone"><font color="black">{{ __('patients.age') }}</font></th>
<td>{{ get_patients_age($patient->date_of_birth) }}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-3">
@if (Auth::user()->can('print-patient-cards'))
<a href="/patient_card/{{ $patient->id }}" target="_blank" class="btn btn-rounded btn-primary btn-sm float-right">{{ __('patients.print_patient_card') }}</a>
@endif
</div>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-sm-4">
<table class="table-bordered table-condensed table-striped">
<tr>
<th><font color="black">{{ __('patients.phone') }}</font></th>
<td>{{ $patient->phone }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.occupation') }}</font></th>
<td>{{ get_name($patient->occupation_id, 'id', 'name', 'occupations') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.insurance') }}</font></th>
<td>{{ $patient->insurance_status == 1 ? __('patients.yes') : __('patients.no') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.religion') }}</font></th>
<td>{{ get_name($patient->religion_id, 'id', 'name', 'religions') }}</td>
</tr>
<tr>
<th><font color="black">{{__('patients.next_of_kin')}}</font></th>
<td>{{ $patient->next_of_kin }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.next_of_kin_relationship') }}</font></th>
<td>{{ get_name($patient->next_of_kin_relationship, 'id', 'name', 'family_relations') }}</td>
</tr>
<tr>
<th><font color="black">{{__('patients.phone_of_next_of_kin')}}</font></th>
<td>{{ $patient->phone_of_next_of_kin }}</td>
</tr>
<tr>
<th><font color="black">Country</font></th>
<td>{{ $country->name ?? '' }}</td>
</tr>
<tr>
</table>
</div>
<div class="col-sm-4">
<table class="table-bordered table-condensed table-striped">
<tr>
<th><font color="black">{{ __('patients.district') }}</font></th>
<td>{{ get_name($patient->district_id, 'id', 'name', 'districts') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.county') }}</font></th>
<td>{{ get_name($patient->county_id, 'id', 'name', 'counties') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.sub_county') }}</font></th>
<td>{{ get_name($patient->subcounty_id, 'id', 'name', 'subcounties') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.parish') }}</font></th>
<td>{{ get_name($patient->parish_id, 'id', 'name', 'parishes') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.village') }}</font></th>
<td>{{ get_name($patient->village_id, 'id', 'name', 'villages') }}</td>
</tr>
<tr>
<th><font color="black">Referred From</font></th>
<td>{{ $patient->referred_from }}</td>
</tr>
<tr>
<th><font color="black">Foreigner / Refugee </font></th>
<td>
@if(!empty($other_patients_info_data))
@if ($other_patients_info_data->non_ugandan_foreigner_or_refugee == 1)
<span>{{ __('patients.foreigner') }} </span>
@elseif ($other_patients_info_data->non_ugandan_foreigner_or_refugee == 2)
<span>{{ __('patients.refugee') }} </span>
@else
<span></span>
@endif
@else
<span></span>
@endif
</td>
</tr>
@if (isset($other_patients_info_data->non_ugandan_national_id_no))
<tr>
<th class="highlight"> ID Number</th>
<td>{{ $other_patients_info_data->non_ugandan_national_id_no ?? '' }}</td>
</tr>
@else
<tr>
<th class="highlight">National ID</th>
<td>{{ $patient->national_id ?? '' }}</td>
</tr>
@endif
@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><font color="black">{{ get_name($keys[2], 'id', 'name', 'patient_registration_fields') }}</font></th>
<td>{{ $registration_field }}</td>
</tr>
@endif
@endforeach
</table>
</div>
<div class="col-sm-4">
<table class="table">
<tr>
<th style="width: 30%"><font color="black">{{ __('patients.last_patient_visit') }} : </font></th>
<td>
@if(!is_null($last_episode))
@php
$diagnosis = null;
$primary_diagnosis_id = get_name($last_episode->id, 'episode_id', 'primary_diagnosis', 'consultations');
if($primary_diagnosis_id != "N/A" && $primary_diagnosis_id != ""){
$diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($primary_diagnosis_id);
}
@endphp
<strong>{{ __('patients.primary_diagnosis') }} : </strong>{{ !is_null($diagnosis) ? $diagnosis->name : '' }}<br>
<strong>{{ __('patients.comments') }} : </strong>{{ get_name($last_episode->id, 'episode_id', 'comments', 'consultations') }}<br>
@endif
<strong>{{ __('patients.date') }} : </strong> {{ !is_null($last_episode) ? streamline_date($last_episode->created_at) : __('patients.no_visit_yet') }}
</td>
</tr>
<tr>
<th style="width: 30%"><font color="black">{{ __('patients.date_registered') }} :</font></th>
<td>{{streamline_date($patient->created_at) }}</td>
</tr>
<tr>
<th style="width: 30%"><font color="black">{{ __('patients.created_by') }} :</font></th>
<td>{{ get_full_name($patient->created_by, "id", "first_name", "last_name", "users") }}</td>
</tr>
@if (mother_of_patient($patient->id))
@php
$mother_id = mother_of_patient($patient->id);
@endphp
<tr>
<th style="width: 30%; font-size: 16px; font-weight:bolder"><font color="black">{{ __('patients.mother_name') }}:</font></th>
<td style="font-size: 16px;">
<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 style="width: 30%; font-size: 16px; font-weight:bolder"><font color="black">{{ __('patients.children') }}:</font></th>
<td style="font-size: 16px;">
<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
</table>
<a href="/patient_episodes/set_patient_id/{{ $patient->id }}" class="btn btn-success btn-sm">{{ __('patients.select_patient_history') }}</a>
</div>
</div>
</div>
</div>
</div>
@endsection