Files

1346 lines
73 KiB
PHP
Executable File

@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css"/>
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
<link rel="stylesheet" href="{{ asset('elite/bower_components/dropify/dist/css/dropify.min.css') }}">
<style>
.nav-pills .nav-link.active {
background: #80a783;
}
.nav-pills .nav-link {
border-radius: 0.25rem;
background-color: #d0ddd4;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-6">
<h4 class="page-title">{{ __('insurance_members.create_insurance_member') }}</h4>
</div>
<div class="col-md-6">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('insurance_members.dashboard') }}</a></li>
<li><a href="/insurance/scheme_administration">{{ __('insurance.scheme_administration') }}</a></li>
<li><a href="/insurance_members/">{{ __('insurance_members.insurance_members') }}</a></li>
<li class="active">{{ __('insurance_members.register') }}</li>
</ol>
</div>
</div>
@include('flash::message')
@include('insurance::insurance_members.menu')
<div class="white-box">
<div class="row">
<div class="col-md-12">
<ul class="nav nav-pills nav-justified">
<li class="active nav-item"> <a href="#patient_nav_pill" class="nav-link" data-toggle="tab" aria-expanded="false">{{ __('insurance_members.patient_bio_data') }}</a> </li>
<li class="nav-item" style="background-color: #a6e5e7;"> <a href="#insurance_nav_pill" class="nav-link" data-toggle="tab" aria-expanded="false">{{ __('insurance_members.insurance_member_registration') }}</a> </li>
</ul>
{{ Form::open(['route' => 'insurance_members.store','method'=>'POST','enctype'=>'multipart/form-data','data-toggle'=>'validator','autocomplete'=>'off']) }}
<div class="tab-content br-n pn">
<div id="patient_nav_pill" class="tab-pane active">
<div class="row">
<div class="col-sm-4">
<div class="form-group">
{{ Form::label('first_name',__('insurance_members.first_name')) }}
{{ Form::text('first_name','',['class' => 'form-control compulsory', 'required', 'data-error'=>'','placeholder'=>'Christian name eg Fred', 'id' => 'first_name']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('last_name',__('insurance_members.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',__('insurance_members.gender')) }}
<br>
{{ Form::radio('gender', 1, false, ["required"]) }} {{ __('insurance_members.male') }} &nbsp;&nbsp;
{{ Form::radio('gender', 2, false, ["required"]) }} {{ __('insurance_members.female') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('national_id',__('insurance_members.national_id_number')) }}
{{ Form::text('national_id','',['class' => 'form-control','maxlength'=>15]) }}
</div>
<div class="form-group">
{{ Form::label('date_of_birth',__('insurance_members.date_of_birth')) }}
<div class="input-group">
{{ Form::text('date_of_birth','',['class' => 'form-control compulsory','readonly','id'=>'date_of_birth']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
@if (!empty($errors->get('date_of_birth')))
<div class="help-block with-errors alert alert-danger">
@foreach ($errors->get('date_of_birth') as $message)
{{ $message }}
@endforeach
</div>
@endif
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('age',__('insurance_members.years')) }}
{{ Form::number('age_in_years','',['class' => 'form-control compulsory','id'=>'age_in_years','min'=>'0']) }}
@if (!empty($errors->get('age_in_years')))
<div class="help-block with-errors alert alert-danger">
@foreach ($errors->get('age_in_years') as $message)
{{ $message }}
@endforeach
</div>
@endif
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
{{ Form::label('age',__('insurance_members.months')) }}
{{ Form::number('age_in_months','',['class' => 'form-control','id'=>'age_in_months','readonly','min'=>'0']) }}
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('marital_status',__('insurance_members.marital_status')) }}
<br>
@foreach($marital_statuses as $key=>$value)
{{ Form::radio('marital_status', $key,false,['required']) }} {{ $value }} &nbsp;&nbsp;
@endforeach
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('religion',__('insurance_members.religion')) }}
{{ Form::select('religion',$religions,'',['class' => 'form-control compulsory','required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('occupation',__('insurance_members.occupation')) }}
{{ Form::select('occupation',$occupations,'',['class' => 'form-control compulsory occupation', 'required']) }}
<a href="#modal_occupation" data-toggle="modal" id="modal_occupation_link"><font size="1"> {{ __('insurance_members.add_new_occupation') }} </font></a>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('next_of_kin',__('insurance_members.next_of_kin')) }}
{{ Form::text('next_of_kin','',['class' => 'form-control', 'onchange' => "show('kin_div')"]) }}
</div>
<div class="form-group" id="kin_div" style="display: none;">
<div class="row">
<div class="col-sm-6">
{{ Form::label('next_of_kin_relationship',__('insurance_members.relationship_to_next_of_kin')) }}
{{ Form::select('next_of_kin_relationship',$relationships,'',['class' => 'form-control compulsory']) }}
</div>
<div class="col-sm-6">
{{ Form::label('next_of_kin_phone',__('insurance_members.next_of_kins_phone')) }}
{{ Form::text('next_of_kin_phone','',['class' => 'form-control']) }}
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('phone',__('insurance_members.phone_number')) }}
{{ Form::text('phone','',['class' => 'form-control', 'id' => 'phone']) }}
<span class="font-13 text-muted">(07xx) 123-456</span>
</div>
<label class="alert alert-danger" id="similar_phone_number" style="display: none"></label>
<div class="form-group">
{{ Form::label('phone_owner',__('insurance_members.phone_owner')) }}
<br>
{{ Form::radio('phone_owner','self',false,['id'=>'owned',"required"]) }} {{ __('insurance_members.self') }} &nbsp;&nbsp;
{{ Form::radio('phone_owner','other',false,['id'=>'non_owned',"required"]) }} {{ __('insurance_members.other') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group owner_name" style="display: none;">
{{ Form::label("owner_name",__('insurance_members.phone_owners_name')) }}
{{ Form::text('owner_name','',['id'=>'owner_name','class' => 'form-control compulsory']) }}
</div>
<div class="form-group">
{{ Form::label('lc_one', __('insurance_members.name_of_lc1_chairman')) }}
{{ Form::text('lc_one','',['class' => 'form-control compulsory', 'data-error'=>'LC 1 chairman\'s name']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('contact',__('insurance_members.any_hospital_contact')) }}
<br>
{{ Form::radio('contact','yes',false,['id'=>'h_contact_yes','required']) }} {{ __('insurance_members.yes') }} &nbsp;&nbsp;
{{ Form::radio('contact','no',false,['id'=>'h_contact_no','required']) }} {{ __('insurance_members.no') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group hosp_contact_div" style="display: none;">
<div class="form-group">
{{ Form::label('hospital_contact',__('insurance_members.name_of_contact_in').$hospital_information->name) }}
{{ Form::text('hospital_contact','',['class' => 'form-control compulsory']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('patient_category',__('insurance_members.patient_category'))}}
{{ Form::select('patient_category',$patient_categories,'5',['class' => 'form-control compulsory', 'required', 'data-error'=>'']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
{{ Form::label('language',__('insurance_members.preferred_language')) }}
{{ Form::select('language',['vern'=>'Vernacular','eng'=>'English',],'vern',['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']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="ugandan_regions">
<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>
</div>
@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 class="form-group" id="div_district">
{{ Form::label('district_id',__('insurance_members.district')) }}
{{ Form::select('district_id',$districts,'',['class' => 'form-control compulsory district', 'required', 'data-error'=>'']) }}
<a href="#modal_district" data-toggle="modal" id="modal_district_link"><font size="1">{{ __('insurance_members.add_new_district') }} </font></a>
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="div_county">
<label for='county_id'>{{ __('insurance_members.county') }}</label>
<select class='form-control county' name='county_id' id='county_id' data-error=''>
<option> {{ __('insurance_members.select') }} </option>
</select>
<a href="#modal_county" data-toggle="modal" id="modal_county_link"><font size="1">{{ __('insurance_members.add_new_county') }} </font></a>
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="div_subcounty">
<label for='subcounty_id'>{{ __('insurance_members.subcounty') }}</label>
<select class='form-control subcounty' name='subcounty_id' id='subcounty_id' data-error=''>
<option> {{ __('insurance_members.select') }} </option>
</select>
<a href="#modal_subcounty" data-toggle="modal" id="modal_subcounty_link"><font size="1">{{ __('insurance_members.add_new_subcounty') }} </font></a>
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="div_parish">
<label for='parish'>{{ __('insurance_members.parish') }}</label>
<select class='form-control parish' name='parish' id='parish' data-error=''>
<option> {{ __('insurance_members.select') }} </option>
</select>
<a href="#modal_parish" data-toggle="modal" id="modal_parish_link"><font size="1">{{ __('insurance_members.add_new_parish') }} </font></a>
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="div_village">
<label for='village'>{{ __('insurance_members.village') }}</label>
<select class='form-control village' name='village' id="village" data-error=''>
<option> {{ __('insurance_members.select') }} </option>
</select>
<a href="#modal_village" data-toggle="modal" id="modal_village_link"><font size="1">{{ __('insurance_members.add_new_village') }} </font></a>
<div class="help-block with-errors"></div>
</div> --}}
</div>
</div>
</div>
<div id="insurance_nav_pill" class="tab-pane">
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('duplicate_research_id', __('insurance.research_id')) }}
{{ Form::text('duplicate_research_id', null, ['class' => 'form-control']) }}
@if (!empty($errors->get('duplicate_research_id')))
<div class="help-block with-errors alert alert-danger">
@foreach ($errors->get('duplicate_research_id') as $message)
{{ $message }}
@endforeach
</div>
@endif
</div>
<div class="form-group">
{{ Form::label('is_family_head',__('insurance_members.is_member_head_of_family')) }}
<br>
{{ Form::radio('is_family_head', 1, false, ["required",'onclick'=>'displayFamilies(1)']) }} {{ __('insurance_members.yes') }} &nbsp;&nbsp;
{{ Form::radio('is_family_head', 0, false, ["required",'onclick'=>'displayFamilies(0)']) }} {{ __('insurance_members.no') }}
</div>
<div class="family_div" style="display: none">
<div class="form-group">
{{ Form::label('family_id', __('insurance_members.select_family')) }}
<select name="family_id" required class="form-control compulsory family_id">
<option value="">{{ __('insurance_members.select') }}</option>
@foreach($families as $id)
<option value="{{ $id }}">{{ get_name($id, 'id', 'name', 'insurance_heads_of_family') }} ({{ get_name(get_name($id, 'id', 'group_id', 'insurance_heads_of_family'), 'id', 'name', 'insurance_groups') }})</option>
@endforeach
</select>
</div>
</div>
<div class="family_risk_div" style="display: none">
<div class="form-group">
{{ Form::label('family_risk_id', __('insurance_members.family_insurance_risk')) }}
{{ Form::select('family_risk_id[]', $chi_risks, '',['class' => 'form-control compulsory risk_id', 'data-error'=>'Select the risk', 'multiple']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
{{ Form::label('relationship_to_head', __('insurance_members.relationship_to_head')) }}
{{ Form::select('relationship_to_head', $relations, 1, ['class' => 'form-control compulsory']) }}
</div>
<div class="form-group">
{{ Form::label('group_id', __('insurance_members.insurance_group')) }}
{{ Form::select('group_id', $insurance_groups, null, ['class' => 'form-control compulsory', 'required', 'id' => 'group_id']) }}
</div>
<div class="form-group">
{{ Form::label('chi_plan', __('insurance.chi_plan')) }}
{{ Form::select('chi_plan', $chi_plans, null, ['class' => 'form-control compulsory', 'required', 'id' => 'chi_plan']) }}
</div>
{{-- <div class="form-group">
{{ Form::label('other_plan', __('insurance.other_plan')) }}
{{ Form::select('other_plan', $chi_plans, null, ['class' => 'form-control']) }}
</div> --}}
<div class="form-group">
{{ Form::label('risk_id',__('insurance.risk')) }}
{{ Form::select('risk_id[]', $chi_risks, '',['class' => 'form-control compulsory risk_id', 'data-error'=>'Select the risk', 'required', 'multiple']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('member_premium', __('insurance.member_premium')) }}
{{ Form::number('member_premium', null, ['class' => 'form-control compulsory', 'required']) }}
</div>
@if( Auth::user()->can('register-chi-members-with-pre-existing-premiums'))
<div class="form-group">
{{ Form::label('does_member_have_existing_premium',__('insurance_members.does_member_have_existing_premium')) }}
<br>
{{ Form::radio('does_member_have_existing_premium', 1, false, ["required",'onclick'=>'displayPremiumActiveDateDiv(1)']) }} {{ __('insurance_members.yes') }} &nbsp;&nbsp;
{{ Form::radio('does_member_have_existing_premium', 0, false, ["required",'onclick'=>'displayPremiumActiveDateDiv(0)']) }} {{ __('insurance_members.no') }}
</div>
<div class="existing_premiums_dates_div" style="display: none">
<div class="form-group">
{{ Form::label('existing_premium_start_date', __('insurance_members.existing_premium_start_date')) }}
<div class="input-group">
{{ Form::text('existing_premium_start_date','',['class' => 'form-control','readonly','id'=>'existing_premium_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('existing_premium_end_date', __('insurance_members.existing_premium_end_date')) }}
<div class="input-group">
{{ Form::text('existing_premium_end_date','',['class' => 'form-control','readonly','id'=>'existing_premium_end_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<div class="help-block with-errors"></div>
</div>
</div>
@endif
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('title', __('insurance.title')) }}
{{ Form::select('title', $person_titles, null, ['class' => 'form-control compulsory', 'required']) }}
</div>
<div class="form-group">
{{ Form::label('photo',__('insurance_members.photo')) }}
{{ Form::file('photo',['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('membership_start_date', __('insurance.membership_start_date')) }}
<div class="input-group">
{{ Form::text('membership_start_date','',['class' => 'form-control','readonly','id'=>'membership_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('membership_registration_date', __('insurance.membership_registration_date')) }}
<div class="input-group">
{{ Form::text('membership_registration_date','',['class' => 'form-control','readonly','id'=>'membership_registration_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('social_security_number', __('insurance.social_security_number')) }}
{{ Form::text('social_security_number', null, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('research_id', __('insurance.research_id')) }}
{{ Form::text('research_id', null, ['class' => 'form-control']) }}
@if (!empty($errors->get('research_id')))
<div class="help-block with-errors alert alert-danger">
@foreach ($errors->get('research_id') as $message)
{{ $message }}
@endforeach
</div>
@endif
</div>
<div class="form-group">
{{ Form::label('next_anniversary_date', __('insurance.next_anniversary_date_bracket_moved_with_rollover')) }}
<div class="input-group">
{{ Form::text('next_anniversary_date','',['class' => 'form-control','readonly','id'=>'next_anniversary_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<div class="help-block with-errors"></div>
</div>
{{ Form::button(__('insurance_members.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('insurance_members.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
</div>
</div>
</div>
</div>
{{ Form::close() }}
</div>
</div>
</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">{{ __('insurance_members.register_a_new_occupation') }}</h4>
</div>
<div class="modal-body">
<div class="controls">
<input class="form-control compulsory" 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">{{ __('insurance_members.cancel') }}</button>
<input type="button" class="btn btn-success" id="submit_new_occupation" value="{{ __('insurance_members.save') }} "/>
</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>
<div class="modal fade" id="modal_district" 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">{{ __('insurance_members.register_a_new_district') }}</h4>
</div>
<div class="modal-body">
<div class="controls">
<input class="form-control compulsory" id="new_district_name" name="new_district_name" type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('insurance_members.cancel') }}</button>
<input type="button" class="btn btn-success" id="submit_new_district" value="{{ __('insurance_members.save') }} "/>
</div>
</div>
</div>
</div>
<!-- new county modal -->
<div class="modal fade" id="modal_county" 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">{{ __('insurance_members.register_a_new_county') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('insurance_members.district') }}</label>
{{ Form::select('dynamic_district_name', $districts, '', ['id'=>'dynamic_district_name','class'=>'form-control compulsory']) }}
</div>
<div class="form-group">
<label>{{ __('insurance_members.county') }}</label>
<input class="form-control compulsory" id="new_county_name" name="new_county_name" type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('insurance_members.cancel') }}</button>
<input type="button" class="btn btn-success" id="submit_new_county" value="{{ __('insurance_members.save') }} "/>
</div>
</div>
</div>
</div>
<!-- new subcounty modal -->
<div class="modal fade" id="modal_subcounty" 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">{{ __('insurance_members.register_a_new_sub_county') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('insurance_members.county') }}</label>
{{ Form::select('dynamic_county_name', $dynamic_counties, '', ['id'=>'dynamic_county_name','class'=>'form-control compulsory']) }}
</div>
<div class="form-group">
<label>{{ __('insurance_members.subcounty') }}</label>
<input class="form-control compulsory" id="new_subcounty_name" name="new_subcounty_name"
type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('insurance_members.cancel') }}</button>
<input type="button" class="btn btn-success" id="submit_new_subcounty" value="{{ __('insurance_members.save') }} "/>
</div>
</div>
</div>
</div>
<!-- new parish modal -->
<div class="modal fade" id="modal_parish" 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">{{ __('insurance_members.subcounty') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('insurance_members.subcounty') }}</label>
{{ Form::select('dynamic_sub_county_name', $dynamic_sub_counties, '', ['id'=>'dynamic_sub_county_name','class'=>'form-control compulsory']) }}
</div>
<div class="form-group">
<label>{{ __('insurance_members.parish') }}</label>
<input class="form-control compulsory" id="new_parish_name" name="new_parish_name" type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('insurance_members.cancel') }}</button>
<input type="button" class="btn btn-success" id="submit_new_parish" value="{{ __('insurance_members.save') }} "/>
</div>
</div>
</div>
</div>
<!-- new village modal -->
<div class="modal fade" id="modal_village" 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">{{ __('insurance_members.register_a_new_village') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('insurance_members.parish') }}</label>
{{ Form::select('dynamic_parish_name', $dynamic_parishes, '', ['id'=>'dynamic_parish_name','class'=>'form-control compulsory']) }}
</div>
<div class="form-group">
<label>{{ __('insurance_members.village') }}</label>
<input class="form-control compulsory" id="new_village_name" name="new_village_name" type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('insurance_members.cancel') }}</button>
<input type="button" class="btn btn-success" id="submit_new_village" value="{{ __('insurance_members.save') }} "/>
</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>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">Close</button>
</div>
</div>
</div>
</div>
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('js/insurance_members/create.js') }}"></script>
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script src="{{ asset('elite/bower_components/icheck/icheck.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/icheck/icheck.init.js') }}"></script>
<script src="{{ asset('elite/bower_components/dropify/dist/js/dropify.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('js/patients/create.js') }}"></script>
<script src="{{ asset('elite/js/mask.js') }}"></script>
<script type="text/javascript">
function displayFamilies(option){
if (option == 0){
document.querySelector(".family_div").style.display = "block";
document.querySelector(".family_risk_div").style.display = "none";
} else {
document.querySelector(".family_div").style.display = "none";
document.querySelector(".family_risk_div").style.display = "block";
}
}
function displayPremiumActiveDateDiv(option){
if (option == 0){
document.querySelector(".existing_premiums_dates_div").style.display = "none";
} else {
document.querySelector(".existing_premiums_dates_div").style.display = "block";
}
}
function capture_fingerprint() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE) { // XMLHttpRequest.DONE == 4
if (xmlhttp.status == 200) {
let json_response = JSON.parse(xmlhttp.responseText);
if (json_response["ScannerError"]["errorCode"] === "0") {
let template = json_response["ApiRequestInfo"]["OperationData"]["Signature"][0]["Template"];
let pngImage = "data:image/png;base64," + json_response["ApiRequestInfo"]["OperationData"]["Signature"][0]["Image"];
$("#fingerprint_image").attr('src', pngImage);
$('#fingerprint_template').val(template);
$('#scanner_msg').text("Fingerprint Captured").css('color', 'green');
} else {
$('#scanner_msg').text("Error Code: " + json_response["ScannerError"]["errorCode"] + " - Error Message: " + json_response["ScannerError"]["errorString"]).css('color', 'red');
}
} else if (xmlhttp.status == 400) {
alert('There was an error 400');
} else {
alert('something else other than 200 was returned');
}
}
};
xmlhttp.open("GET", "http://localhost:13124/cams/fp-scanner/capture?sendimage=1&apikey=w43CiMOtw40KKsOOw6oOD8KOw6jChmrCrsOpwqlqD0xoL8OJKGjDicOpDydmS8OGZk0OacONLsOIworDpsOpKMOOTg8Pw6Zmw4oLwo4rw67DiGZqw6hNw6rCrMKmbcOKwqbDiMOIK8KIw4xtw4lJS8OJSsKKwo7DicKmbG4Owqpuwo5NTi3CqW4swqxlw40qw60LL8ONZihmw6zCqkttSMOGTAvDiMKIw6puRk3DjsOlD8KIB8KmTcKuwqzDrCvDqAfCiS3DrmllDcKqTcOqDcKOwq3DrMOqw6hLBsKMLcOuw4jDrMKuw4zCqmpuw4onw6bCiEYuw61tJ8KNJwnDiChpaCwvw60OSsKGJkbDjcOJJi5lTi/DqMOMwo3DqWrCisOtw6bCiA5sSgctw6nDisKpwowtSsKuw6YJTcOlwq4HaMOqw44nbivDrS/DrS/DjMKuwo3DjcOuCSwrJwkNw67CjApNCSfChsKIK8OIaA3DiC/DqglJLMOIw4oGwo1mw4pGRgnCqUvDqEsJT01uDkoHbsOMak7CiMKmDUbDjMKNZcOuwqbCqCdGBgYswqYmS03ChsKGwoZJT8OlaMOMD2zCicKMwqjCicKpSsOJw4bDhirDqsOsTSjCqmnDqG3DicONDsKKZcOIBsOoSMKMw65lSMKmw4YOTWrCpsONwqoJC2wsT0jCrMKMwq4qLcKtTGYoamjDrizChsKGLAbCrMKuTkzCiMOowqwHDU0mCypuw6XCiMOISMKqTMKGRi7DpgfCqSsHZcOJB24HSMKmw67DpcOqTyZObCgHw47DisKJKm5Iw4zDrcKNTcOsLgvCicOlw6nDicKJw43ChgYtSUbCrSnCrMKtKQfCqsOMKMKtJsKtSmplSgnCrg3CqkZGD07DrCzDqG4LCg4rw4kvw60tw41LD8OowoZpKMKGw6xOSUwuDcKIw6pOw64PaQbCqmjCqQ9uwq3CqMOqTsOtw6lNKcKowq7CqsOISMONKsOJTgZlwokvaWgqTEjDiklsTsOqw65sRmnCqG5Mw6zCiQtlakxLw4zCqEnCiMKowqxGw4llwqYmwqYoK04GC8ONDsOlK8KmLQ0mwo4mw6rCicOmLkbCqQ1Nw4jCjGpLw6xuJ21MJkbDqcKMD8OoKsOqSCfDqCwOw6lOLcKqw4jDjGULSWwGDWrDjWUowq0NwqjCjsKsB8KqwqnDqCzCisOsDcKMbUxsKcKpwo5PaWzCiMKmw44HD8OlCsOuJyoqwqfCp07CiQ1MwozChmxqDcKOacKNBsOmSCYNKsOuw4zDrMOswqfCp0wDQUFZTQ==", true);
xmlhttp.send();
}
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));
}
});
}
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;
}
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));
}
});
}
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,#membership_start_date,#membership_registration_date,#next_anniversary_date,#existing_premium_start_date,#existing_premium_end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
});
$("#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);
});
$('#age_in_years').on('change', function () {
let years = parseInt($(this).val());
let possibleBirthday = new Date();
if (!isNaN(years)) {
possibleBirthday.setMonth(possibleBirthday.getMonth() - (years * 12));
$('#date_of_birth').val(format_date(possibleBirthday));
} else {
alert("<?php echo __('patients.valid_number_years')?>")
}
});
$('#next_of_kin').on('change', function () {
if ($(this).val() != "" && $(this).val() != " ") {
$('#kin_div').show();
} else {
$('#kin_div').hide();
}
});
$('#div_district').on('change', function () {
var id = $('#district_id').val();
//add dropdown to immediate dependant dropdown
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
//set counties dropdown options for selected district
document.getElementById("county_id").innerHTML = xmlhttp.responseText;
document.getElementById("subcounty_id").innerHTML = xmlhttp.responseText;
document.getElementById("parish").innerHTML = xmlhttp.responseText;
document.getElementById("village").innerHTML = xmlhttp.responseText;
//set sub counties dropdown options for selected district
//set parishes dropdown options for selected district
//set the villages dropdown options for the selected district
}
}
xmlhttp.open("GET", "/patients/get_counties/" + id, false);
xmlhttp.send();
});
$('#div_county').on('change', function () {
//get selected value
var id = $('#county_id').val();
//add dropdown to immediate dependant dropdown
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("subcounty_id").innerHTML = xmlhttp.responseText;
document.getElementById("parish").innerHTML = xmlhttp.responseText;
document.getElementById("village").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "/patients/get_subcounties/" + id, false);
xmlhttp.send();
});
$('#div_subcounty').on('change', function () {
//get selected value
var id = $('#subcounty_id').val();
var district_id = $('#district_id').val();
//add dropdown to immediate dependant dropdown
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("parish").innerHTML = xmlhttp.responseText;
document.getElementById("village").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "/patients/get_parishes/" + id, false);
xmlhttp.send();
});
$('#div_parish').on('change', function () {
//get selected value
var id = $('#parish').val();
//add dropdown to immediate dependant dropdown
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("village").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "/patients/get_villages/" + id, false);
xmlhttp.send();
});
$('#district_id').on('click', function () {
var district_id = $('#district_id').val();
$.ajax({
type: 'GET',
url: '/patient_residence/' + district_id,
cache: false,
success: function (response) {
/* auto fill the subcounties based on the district that is selected */
var subcounties = response.subcounties;
for (var id in subcounties) {
var subcounty_select = document.getElementById("subcounty_id");
var subcounty_option = document.createElement("option");
subcounty_option.value = id;
subcounty_option.text = subcounties[id];
subcounty_select.appendChild(subcounty_option);
}
/* auto fill the parishes based on the selected district */
var parishes = response.parishes;
for (var id in parishes) {
var parish_select = document.getElementById("parish");
var parish_option = document.createElement("option");
parish_option.value = id;
parish_option.text = parishes[id];
parish_select.appendChild(parish_option);
}
/* auto fill the villages based on the selected district */
var villages = response.villages;
for (var id in villages) {
var village_select = document.getElementById("village");
var village_option = document.createElement("option");
village_option.value = id;
village_option.text = villages[id];
village_select.appendChild(village_option);
}
}
});
});
/* make residence drop downs searchable */
$('.district,#county_id,#subcounty_id,#parish,#village, #group_id').select2({
placeholder: "-- select --",
width: "100%"
});
$('.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 __('insurance_members.please_fill_in_a_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 __('insurance_members.error_occured_occupation_not_added')?>");
} 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();
});
$("#submit_new_district").click(function () {
var new_district_name = $("#new_district_name").val();
if (new_district_name == '') {
alert("Please fill out a name");
} else {
$.ajax({
type: "POST",
url: "/add_new_district_dynamically",
data: {name: new_district_name},
cache: false,
success: function (response) {
if (response == 'false') {
alert("<?php echo __('insurance_members.district_already_exists')?>");
} else {
$('.district').append($('<option>', {
value: response,
text: new_district_name
}));
$('.district').val(response);//preselect the newly added referral
//$('#modal_occupation').hide();
$('#modal_district').modal('hide');
alert("<?php echo __('insurance_members.new_district_has_been_added')?>");
}
},
error: function (error) {
console.log(error);
}
});
}
$("#new_district_name").val('');
$("#modal_district #close").click();
});
$("#submit_new_county").click(function () {
var new_county_name = $("#new_county_name").val();
var district_id = $("#dynamic_district_name").val();
//dynamic_sub_county_name
if (new_county_name == '') {
alert("Please fill out a name");
} else {
$.ajax({
type: "POST",
url: "/add_new_county_dynamically",
data: {name: new_county_name, district_id: district_id},
cache: false,
success: function (response) {
if (response == 'false') {
alert("County already Exists");
} else {
$('.county').append($('<option>', {
value: response,
text: new_county_name
}));
$('.county').val(response);//preselect the newly added referral
$('#modal_county').modal('hide');
alert("<?php echo __('insurance_members.new_county_has_been_added')?>");
}
}
});
}
$("#new_county_name").val('');
$("#modal_county #close").click();
});
$("#submit_new_subcounty").click(function () {
var new_subcounty_name = $("#new_subcounty_name").val();
var county_id = $("#dynamic_county_name").val();
if (new_subcounty_name == '') {
alert("Please fill out a name");
} else {
$.ajax({
type: "POST",
url: "/add_new_subcounty_dynamically",
data: {name: new_subcounty_name, county_id: county_id},
cache: false,
success: function (response) {
if (response == 'false') {
alert("<?php echo __('insurance_members.subcounty_already_exists')?>");
} else {
$('.subcounty').append($('<option>', {
value: response,
text: new_subcounty_name
}));
$('.subcounty').val(response);//preselect the newly added referral
$('#modal_subcounty').modal('hide');
alert("<?php echo __('insurance_members.new_subcounty_has_been_added')?>");
}
}
});
}
$("#new_subcounty_name").val('');
$("#modal_subcounty #close").click();
});
$("#submit_new_parish").click(function () {
var new_parish_name = $("#new_parish_name").val();
var subcounty_id = $("#dynamic_sub_county_name").val();
if (new_parish_name == '') {
alert("Please fill out a name");
} else {
$.ajax({
type: "POST",
url: "/add_new_parish_dynamically",
data: {name: new_parish_name, subcounty_id: subcounty_id},
cache: false,
success: function (response) {
if (response == 'false') {
alert("<?php echo __('insurance_members.parish_already_exists')?>");
} else {
$('.parish').append($('<option>', {
value: response,
text: new_parish_name
}));
$('.parish').val(response);//preselect the newly added referral
$('#modal_parish').modal('hide');
alert("<?php echo __('insurance_members.new_parish_has_been_added')?>");
}
}
});
}
$("#new_parish_name").val('');
$("#modal_parish #close").click();
});
$("#submit_new_village").click(function () {
var new_village_name = $("#new_village_name").val();
var parish_id = $("#dynamic_parish_name").val();
if (new_village_name == '') {
alert("Please fill out a name");
} else {
$.ajax({
type: "POST",
url: "/add_new_village_dynamically",
data: {name: new_village_name, parish_id: parish_id},
cache: false,
success: function (response) {
if (response == 'false') {
alert("<?php echo __('insurance_members.village_already_exists')?>");
} else {
$('.village').append($('<option>', {
value: response,
text: new_village_name
}));
$('.village').val(response);//preselect the newly added referral
$('#modal_village').modal('hide');
alert("<?php echo __('insurance_members.new_village_has_been_added')?>");
}
}
});
}
$("#new_village_name").val('');
$("#modal_village #close").click();
});
$(document).ready(function() {
// Basic
$('.dropify').dropify();
});
$('#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');
});
$('#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
}
});
$("#citizenship").click(function(){
var citizenship = $("#citizenship").val();
if (citizenship == 0) {
$("#not_ugandan_regions").show();
$("#ugandan_regions").hide();
} else {
$("#not_ugandan_regions").hide();
$("#ugandan_regions").show();
$("#country_id").val('');
}
});
$('.risk_id,.family_id').select2({
placeholder: "Select",
width: "100%"
});
$('#chi_plan').change(function(){
let chi_plan = $(this).val();
$.ajax({
method: 'GET',
url: '/get_chi_plan_amount/' + chi_plan,
success: function(response){
$('#member_premium').val(response);
},
error: function (error) {
console.log(error);
}
});
});
$('.family_id').change(function(){
let family_id = $(this).val();
console.log("family id ==>>> " + family_id);
//
$.ajax({
method: 'GET',
url: '/get_family_group_id/' + family_id,
success: function(response){
$('#group_id').val(response).attr("selected","selected");
},
error: function (error) {
console.log(error);
}
});
});
</script>
@endpush