@php use Streamline\Enums\Roles; @endphp @extends('layouts.main') @push('styles') @endpush @section('content')

{{ __('patients.edit_patient') }}

@include('flash::message') @foreach ($errors->all() as $error)
{{ $error }}
@endforeach
{{ Form::model($patient, ['method' => 'PUT', 'route' => ['patients.update',$patient], 'data-toggle' => 'validator']) }}
{{ 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']) }}
{{ Form::label('last_name',__('patients.last_name')) }} {{ Form::text('last_name',$patient->last_name,['class' => 'form-control compulsory', 'required','placeholder'=>'Surname eg Asiimwe']) }}
{{ Form::label('gender',__('patients.gender')) }}
{{ Form::radio('gender', 1, false, ["required"]) }} {{ __('patients.male') }}    {{ Form::radio('gender', 2, false, ["required"]) }} {{ __('patients.female') }}
{{ Form::label('national_id',__('patients.national_id')) }} {{ Form::text('national_id', strtoupper($patient->national_id),['class' => 'form-control','maxlength'=>15]) }}
{{ Form::label('date_of_birth',__('patients.date_of_birth')) }}
{{ Form::text('date_of_birth',$dob,['class' => 'form-control compulsory', 'required','readonly','id'=>'date_of_birth']) }}
{{ 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']) }}
@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']) }}
{{ Form::label('marital_status',__('patients.marital_status')) }}
@foreach($marital_statuses as $key=>$value) {{ Form::radio('marital_status', $key,false,[]) }} {{ $value }}    @endforeach
{{ Form::label('religion',__('patients.religion')) }} {{ Form::select('religion',$religions,$patient->religion_id,['class' => 'form-control']) }}
@if( Auth::user()->hasRole(Roles::SUPER_ADMIN->value))
{{ Form::label('is_test_patient',__('patients.is_test_patient')) }}
{{ Form::radio('is_test_patient', 1, $patient->is_test_patient == 1) }} Yes    {{ Form::radio('is_test_patient', 0, $patient->is_test_patient == 0) }} No   
@endif
{{ Form::label('occupation',__('patients.occupation')) }} {{ Form::select('occupation',$occupations, $patient->occupation_id,['class' => 'form-control']) }}
{{ 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')"]) }}
{{ 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']) }}
{{ 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']) }}
{{ Form::label('phone',__('patients.phone')) }} {{ Form::text('phone',$patient->phone,['class' => 'form-control compulsory']) }}
{{ Form::label('alternative_phone', 'Alternative Phone Number') }} {{ Form::text('alternative_phone',$patient->alternative_phone,['class' => 'form-control','id' => 'alternative_phone']) }}
{{ Form::label('phone_owner',__('patients.phone_owner')) }}
{{ Form::radio('phone_owner','self',($patient->phone_owner == "Self" || $patient->phone_owner == "self") ? 1 : 0,['id'=>'owned']) }} {{ __('patients.self') }}    {{ Form::radio('phone_owner','other',$patient->phone_owner != "Self" ? 1 : 0,['id'=>'non_owned']) }} {{ __('patients.other') }}
{{ Form::label("owner_name",__('patients.phone_owner_name')) }} {{ Form::text('owner_name',$patient->phone_owner,['id'=>'owner_name','class' => 'form-control compulsory']) }}
{{ Form::label('patient_category',__('patients.patient_category'))}} {{ Form::select('patient_category',$patient_categories,$patient->category_id,['class' => 'form-control compulsory', 'required', 'data-error'=>'']) }}
{{ Form::label('company',__('patients.company_slash_employer'))}} {{ Form::select('company', $companies ,$patient->company_id,['class' => 'form-control', 'data-error'=>'', 'id' => 'company']) }}
{{ __('patients.add_new_company') }}
{{ 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']) }}
{{ 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']) }}
citizenship == 1) style="display: none" @endif>
{{ Form::label('country_id',__('patients.country_of_origin')) }} {{ Form::select('country_id', $countries, $patient->country_id, ['class' => 'form-control', 'data-error'=>'Select the country']) }}
citizenship == 0) style="display: none" @endif>
{{ Form::label('residence','Residence') }}
{{ __('patients.add_new_residence') }}
@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 @if (!empty($patient_registration_field->options))
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
@else
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }} compulsory == 1)? 'required':'' }} value="{{ !empty($registration_fields[$field_value])? $registration_fields[$field_value]:'' }}">
@endif @endforeach @endif @if(is_fingerprint_enabled())
{{ Form::label('fingerprint_template', __('patients.patient_fingerprint')) }}
{{ Form::hidden('fingerprint_template', '', ['id' => 'fingerprint_template']) }}

@endif

{{ 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))
@endif
@endsection @push('scripts') @endpush