@extends('layouts.main') @push('styles') @endpush @section('content')

{{ __('investigations.order_investigations') }}

@include('patients::allergies.header')
@include('flash::message') @foreach ($errors->all() as $error)
{{ $error }}
@endforeach @if (count($chronic_array) > 0) @foreach ($chronic_array as $chronic_inv) @if(isset($investigations[$chronic_inv->investigation_id])) @endif @endforeach
Patient's Chronic Investigations
{{ $investigations[$chronic_inv->investigation_id] }}

@endif {{ Form::open(['route' => 'investigations.submit_ordered_investigations']) }} @php $patient_insurance_status = patient_insurance_status($patient_id); @endphp {{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id']) }} {{ Form::hidden('episode_id', $episode_id, ['id' => 'episode_id']) }} {{ Form::hidden('patient_insurance_status', $patient_insurance_status, ['id' => 'patient_insurance_status'])}}
@php $counter = 0; $total_selling_price = 0; @endphp @if(count($ordered_investigations) > 0) @foreach($ordered_investigations as $ordered_investigation) {{ Form::hidden('order_id[]', $ordered_investigation->id) }} @php $investigations_ids = explode(",", $ordered_investigation->investigation_id); $urgent_ids_array = explode(",", $ordered_investigation->urgent_ids); $order_comments_array = explode(",", $ordered_investigation->order_comments); $eye_array = explode(",", $ordered_investigation->eye); @endphp @for($i = 0; $i < count($investigations_ids); $i++) @php $counter++; @endphp @endfor @endforeach @else @endif @if( Auth::user()->can('add-row-on-prescription')) @endif
{{ __('investigations.investigation') }}
{{ __('investigations.lab_comments') }}
{{ __('investigations.order_comments') }}
{{ __('investigations.urgent') }}
{{ Form::select('investigations_id[]', $investigations_to_order, $investigations_ids[$i], ['class' => 'form-control compulsory required investigations_id_class', 'id' => 'investigations_id_' . $counter, 'required']) }}
@if (is_chi_enabled()) @if (is_patient_item_covered($patient_id, $investigations_ids[$i], 3))   
Covered by CHI @else   
Not covered by CHI @endif @endif

{{ Form::select('eye[]', [2 => 'Both', 0 => 'Left', 1 => 'Right'], $eye_array[$i] ?? 2, ['class' => 'form-control compulsory', 'required', 'onchange' => 'eye_select(this.value, ' . $counter . ')']) }}
{{ get_name($investigations_ids[$i], 'id', 'comments', 'investigations') }}
@php if($patient_insurance_status == 1) { $selling_price = get_item_insurance_co_payment($patient_id, $investigations_ids[$i], 3, false, 0); } else { // check if the patient category is attached to a price list $price_list_id = is_patient_category_attached_to_price_list($patient_id); if ($price_list_id) { $selling_price = get_price_list_category_price($price_list_id, 2, $investigations_ids[$i]); } else { $selling_price = get_name($investigations_ids[$i], 'id', 'non_insured_price', 'investigations'); } } $selling_price = $selling_price * ((isset($eye_array[$i]) && $eye_array[$i] == 2) ? 2 : 1); $total_selling_price += $selling_price; @endphp
@if($counter == 0) @else @endif

Total: {{ ugandan_shillings($total_selling_price) }}

{{ Form::button(__('investigations.submit_requests'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'submit_button','name'=>'submit_button','value'=>'submit_button']) }} {{ Form::button(__('investigations.print_requests'),['type'=>'submit','class'=>'btn btn-primary waves-effect waves-light m-r-10', 'id'=>'print_request','name'=>'submit_button','value'=>'print_request']) }}

@endsection @push('scripts') @endpush