mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 19:21:33 +00:00
446 lines
19 KiB
PHP
446 lines
19 KiB
PHP
@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">{{ __('insurance.new_premium') }}</h4>
|
|
</div>
|
|
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
|
<ol class="breadcrumb">
|
|
<li><a href="{{ route('home') }}">{{ __('insurance.dashboard') }}</a></li>
|
|
<li class="active">{{ __('insurance.new_premium') }}</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
@include('insurance::insurance_premiums.menu')
|
|
</div>
|
|
</div>
|
|
|
|
@include('flash::message')
|
|
|
|
@include ('errors.list')
|
|
@php
|
|
$back_date = \Streamline\Models\HospitalInformation::first()->pluck('back_date');
|
|
@endphp
|
|
<div class="white-box">
|
|
{{ Form::open(['route' => 'insurance_premiums.store','data-toggle'=>'validator']) }}
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
{{ Form::label('group_id', __('insurance.insurance_groups_lc')) }}
|
|
{{ Form::select('group_id', $insurance_groups, $group_id, ['class' => 'form-control compulsory', 'required', 'id' => 'group_id']) }}
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('amount', __('insurance.amount')) }}
|
|
{{ Form::number('amount', '', ['class' => 'form-control compulsory', 'readonly', 'id' => 'amount']) }}
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('start_date', __('insurance.insurance_start_date')) }}
|
|
<div class="input-group">
|
|
{{ Form::text('start_date', '', ['class'=>'form-control compulsory', 'readonly', 'required', 'id'=>'start_date']) }}
|
|
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
|
</div>
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('end_date', __('insurance.insurance_end_date')) }}
|
|
<div class="input-group">
|
|
{{ Form::text('end_date', '', ['class'=>'form-control compulsory', 'readonly', 'required', 'id'=>'end_date']) }}
|
|
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
|
</div>
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{{ Form::label('payment_date', __('insurance.payment_date')) }}
|
|
<div class="input-group">
|
|
{{ Form::text('payment_date', '', ['class'=>'form-control compulsory', 'readonly', 'required', 'id'=>'payment_date']) }}
|
|
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
|
</div>
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
<a class="btn btn-success" id="proceed_button">{{ __('insurance.proceed') }}</a>
|
|
|
|
<div id="submit_buttons" style="display: none">
|
|
{{ Form::button(__('insurance.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
|
|
{{ Form::button(__('insurance.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light', 'id'=>'reset_button']) }}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div id="family_details"></div>
|
|
</div>
|
|
</div>
|
|
|
|
{{ Form::close() }}
|
|
</div>
|
|
|
|
{{-- modal --}}
|
|
<div class="modal fade" id="view_family_members" 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">×</span></button>
|
|
<h4 class="modal-title" id="exampleModalLabel1">{{ __('insurance.family_members') }}</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12" id="family_members_table">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('insurance.cancel') }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="saved_member_info" 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">×</span></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<h3>{{ __('insurance.new_fam_saved') }}</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('insurance.cancel') }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@include('insurance::insurance_premiums.add_new_family_member_modal')
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script src="{{ asset('elite/js/validator.js') }}"></script>
|
|
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
|
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
|
|
|
<script type="text/javascript">
|
|
let group_id = <?php echo $group_id; ?>;
|
|
|
|
$.ajax({
|
|
method: 'GET',
|
|
url: '/insurance_premiums/group_details/' + group_id,
|
|
success: function(response){
|
|
$('#family_details').html(response);
|
|
},
|
|
error: function () {
|
|
//
|
|
}
|
|
});
|
|
|
|
$('#proceed_button').click(function () {
|
|
// calculate total cost for the group
|
|
let total_amount = 0;
|
|
let submit_btn_state = true;
|
|
|
|
$('.family_amount').each(function () {
|
|
var elementIdString = $(this).attr('id'); // e.g family_id_3
|
|
var family_id = elementIdString.substring(10); // e.g get the actual family id from string above
|
|
var family_total_premium = this.value;
|
|
|
|
$.ajax({
|
|
method: 'GET',
|
|
url: '/validate_family_premium/' + family_id + '/' + family_total_premium,
|
|
success: function(response){
|
|
if (isNaN(response) == true) {
|
|
$(this).css('border','1px solid #F08080');
|
|
alert(response);
|
|
submit_btn_state = false;
|
|
console.log("submit btn state ==>> "+submit_btn_state);
|
|
// hide the submit button
|
|
$('#submit_buttons').hide();
|
|
// show the proceed button
|
|
$('#proceed_button').show();
|
|
return false;
|
|
}
|
|
},
|
|
error: function (error) {
|
|
console.log(error);
|
|
}
|
|
});
|
|
|
|
total_amount += parseInt(this.value);
|
|
});
|
|
console.log("submit btn state outside the loop ==>> "+submit_btn_state);
|
|
|
|
$('#amount').val(total_amount);
|
|
|
|
// display the submit buttons
|
|
$('#submit_buttons').show();
|
|
// hide the proceed button
|
|
$('#proceed_button').hide();
|
|
});
|
|
|
|
$('#reset_button').click(function () {
|
|
// hide the submit buttons
|
|
$('#submit_buttons').hide();
|
|
|
|
// display the proceed button
|
|
$('#proceed_button').show();
|
|
});
|
|
|
|
$('#group_id').change(function() {
|
|
let group_id = $('#group_id').val();
|
|
|
|
$.ajax({
|
|
method: 'GET',
|
|
url: '/insurance_premiums/group_details/' + group_id,
|
|
success: function(response){
|
|
$('#family_details').html(response);
|
|
},
|
|
error: function () {
|
|
//
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#start_date').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'dd-mm-yyyy'
|
|
});
|
|
|
|
$('#end_date').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'dd-mm-yyyy'
|
|
});
|
|
|
|
let min_days = <?php echo $back_date[0]; ?>;
|
|
var min_date = new Date();
|
|
min_date.setDate(min_date.getDate()-min_days);
|
|
$('#payment_date').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
endDate: new Date(),
|
|
startDate: min_date,
|
|
format: 'dd-mm-yyyy'
|
|
});
|
|
|
|
$("#family_details").on('click', "[id^=view_chi_family_]", function () {
|
|
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
|
var id_string = id.toString();
|
|
//console.log(id_string);
|
|
var family_head_and_group_id_array = id_string.split("000000000000000");
|
|
//console.log(family_head_and_group_id_array);
|
|
var family_head_id = family_head_and_group_id_array[0];
|
|
var group_id = family_head_and_group_id_array[1];
|
|
|
|
$.ajax({
|
|
method: 'GET',
|
|
url: '/view_chi_family_members/' + group_id + '/' + family_head_id,
|
|
success: function(response){
|
|
$('#family_members_table').html(response);
|
|
},
|
|
error: function () {
|
|
//
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#new_member_district_id,#new_member_county_id,#new_member_subcounty_id,#new_member_parish,#new_member_village').select2({
|
|
placeholder: "Select",
|
|
width: "100%",
|
|
dropdownParent: $('#new_family_member_modal')
|
|
});
|
|
|
|
$('#new_member_date_of_birth').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true,
|
|
format: 'dd/mm/yyyy',
|
|
endDate: new Date()
|
|
});
|
|
|
|
$('#new_member_age_in_years').on('change', function () {
|
|
let years = parseInt($(this).val());
|
|
let possibleBirthday = new Date();
|
|
|
|
if (!isNaN(years)) {
|
|
possibleBirthday.setMonth(possibleBirthday.getMonth() - (years * 12));
|
|
$('#new_member_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('/');
|
|
}
|
|
|
|
$("#new_member_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
|
|
$('#new_member_age_in_years').val(age);
|
|
$('#new_member_age_in_months').val(months);
|
|
});
|
|
|
|
$("#family_members_table").on('click', ".addMemberBtn", function () {
|
|
$("#view_family_members").modal("hide");
|
|
$("#new_family_member_modal").modal("show");
|
|
|
|
var id = $(this).attr('id');
|
|
$("#new_member_family_head_id").val(id);
|
|
});
|
|
|
|
$("#submitFamilyNewMember").click(function (e) {
|
|
let group_id = $('#group_id').val();
|
|
let new_member_family_head_id = $('#new_member_family_head_id').val();
|
|
let new_member_first_name = $('#new_member_first_name').val();
|
|
let new_member_last_name = $('#new_member_last_name').val();
|
|
let new_member_national_id = $('#new_member_national_id').val();
|
|
let new_member_religion = $('#new_member_religion').val();
|
|
let new_member_lc_one = $('#new_member_lc_one').val();
|
|
let new_member_subcounty_id = $('#new_member_subcounty_id').val();
|
|
let new_member_parish = $('#new_member_parish').val();
|
|
let new_member_patient_category = $('#new_member_patient_category').val();
|
|
let new_member_occupation = $('#new_member_occupation').val();
|
|
let new_member_village = $('#new_member_village').val();
|
|
let new_member_district_id = $('#new_member_district_id').val();
|
|
let new_member_language = $('#new_member_language').val();
|
|
let new_member_next_of_kin = $('#new_member_next_of_kin').val();
|
|
let new_member_phone = $('#new_member_phone').val();
|
|
let new_member_relationship_to_head = $('#new_member_relationship_to_head').val();
|
|
let new_member_gender = $("input[name='gender']" ).val();
|
|
let new_member_marital_status = $("input[name='marital_status']" ).val();
|
|
let new_member_phone_owner = $("input[name='phone_owner']" ).val();//contact
|
|
let new_member_date_of_birth = $('#new_member_date_of_birth').val();
|
|
let new_member_county_id = $('#new_member_county_id').val();
|
|
|
|
let data = {'group_id': group_id,'new_member_first_name': new_member_first_name,'new_member_last_name': new_member_last_name,'new_member_national_id':new_member_national_id,'new_member_religion':new_member_religion,'new_member_lc_one':new_member_lc_one,'new_member_subcounty_id':new_member_subcounty_id,'new_member_parish':new_member_parish,'new_member_patient_category':new_member_patient_category,'new_member_occupation':new_member_occupation,'new_member_village':new_member_village,'new_member_district_id':new_member_district_id,'new_member_language':new_member_language,'new_member_next_of_kin':new_member_next_of_kin,'new_member_phone':new_member_phone,'new_member_relationship_to_head':new_member_relationship_to_head,'new_member_gender': new_member_gender,'new_member_marital_status':new_member_marital_status,'new_member_phone_owner':new_member_phone_owner,'new_member_date_of_birth':new_member_date_of_birth,'new_member_family_head_id':new_member_family_head_id,'new_member_county_id': new_member_county_id};
|
|
|
|
$.ajax({
|
|
method: 'POST',
|
|
url: '/add_new_family_members_dynamically',
|
|
dataType: 'json',
|
|
data: data,
|
|
success: function(response){
|
|
$("#new_family_member_modal").modal("hide");
|
|
$(".dynamicFamilyMembers").append(response["html"]);
|
|
$("#saved_member_info").modal("show");
|
|
},
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
alert(JSON.stringify(jqXHR));
|
|
console.log(JSON.stringify(jqXHR));
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#new_member_first_name, #new_member_last_name').change(function () {
|
|
let first_name = $('#new_member_first_name').val();
|
|
let last_name = $('#new_member_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();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
$('#new_member_phone').change(function () {
|
|
let phone = $('#new_member_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');
|
|
});
|
|
</script>
|
|
|
|
@endpush
|