Files
streamline-emr/docker/statistics/Modules/Investigations/Resources/views/investigations/edit.blade.php
T
2025-03-31 03:46:05 +03:00

361 lines
22 KiB
PHP
Executable File

@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
<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">{{ __('investigations.edit_investigation') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('investigations.dashboard') }}</a></li>
<li><a href="{{ route('investigations.index') }}">{{ __('investigations.investigations') }}</a></li>
<li class="active">{{ __('investigations.edit') }}</li>
</ol>
</div>
</div>
@include('investigations::investigations.menu')
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="panel">
{{ Form::model($investigation, ['method' => 'PUT', 'route' => ['investigations.update',$investigation], 'data-toggle' => 'validator']) }}
<div class="panel-body">
<div clas="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('name', __('investigations.investigation_name')) }}
{{ Form::text('name', $investigation->name, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('category', __('investigations.category')) }}
{{ Form::select('category',$investigation_categories,$investigation->category,['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('units', __('investigations.unit')) }}
{{ Form::select('units',$unit_of_measure,$investigation->units,['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('range_type', __('investigations.is_the_reference_range')) }}
{{ Form::select('range_type', [null => '--select--', 1 => 'Dynamic', 2 => 'Constant'], $investigation->range_type, ['class' => 'form-control']) }}
</div>
<div class="form-group" @if($investigation->range_type == 1) style="display: none;" @endif id="constant_div">
{{ Form::label('normal_ranges', __('investigations.normal_ranges')) }}
{{ Form::text('normal_ranges', $investigation->normal_ranges, ['class' => 'form-control']) }}
</div>
<div @if($investigation->range_type != 1) style="display: none;" @endif id="dynamic_div">
@php $age_groups = \Streamline\Models\AgeGroup::get(); @endphp
<div class="row">
<div class="col-md-6">
<h5>{{ __('investigations.male') }}</h5>
<br>
@foreach($age_groups as $age)
{{ Form::label('dynamic_range', $age->name) }}
{{ Form::text('dynamic_range_male[]', get_dynamic_normal_range($investigation->id, $age->id, 1), ['class' => 'form-control']) }}
{{ Form::hidden('age_id[]', $age->id) }}
<br>
@endforeach
</div>
<div class="col-md-6">
<h5>{{ __('investigations.female') }}</h5>
<br>
@foreach($age_groups as $age)
{{ Form::label('dynamic_range', $age->name) }}
{{ Form::text('dynamic_range_female[]', get_dynamic_normal_range($investigation->id, $age->id, 2), ['class' => 'form-control']) }}
<br>
@endforeach
</div>
</div>
<hr>
</div>
<div class="form-group">
{{ Form::label('minimum', __('investigations.minimum')) }}
{{ Form::text('minimum', $investigation->minimum, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('sample_container', __('investigations.sample_container')) }}
{{ Form::text('sample_container', $investigation->sample_container, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('non_insured_price', __('investigations.non_insured_price')) }}
{{ Form::number('non_insured_price', $investigation->non_insured_price, ['class' => 'form-control']) }}
</div>
@if($investigation->price_list_category && $investigation->price_list_category != '')
@php
$price_list_categories = explode(",", $investigation->price_list_category);
$price_list_prices = explode(",", $investigation->price_list_price);
@endphp
@for($i = 0; $i < count($price_list_categories); $i++)
<div class="form-group">
{{ Form::label('non_insured_price', get_name($price_list_categories[$i], 'id', 'name', 'patient_categories').' Price') }}
{{ Form::hidden('price_list_category_id[]', $price_list_categories[$i]) }}
{{ Form::number('price_list_price[]', $price_list_prices[$i], ['class'=>'form-control price_list_price']) }}
</div>
@endfor
@endif
<div class="form-group">
{{ Form::label('comments', __('investigations.comments')) }}
{{ Form::textArea('comments', $investigation->comments, ['class'=>'form-control', 'rows' => 2]) }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('lab_time', __('investigations.lab_time')) }}
{{ Form::text('lab_time', $investigation->lab_time, ['class' => 'form-control']) }}
</div>
<div class="row">
<div class="col-6">
<div class="form-group">
{{ Form::label('', __('investigations.is_investigation_available'), ["class"=>'col-md-12']) }}
&nbsp;{{ __('investigations.yes') }} {{ Form::radio('available', 1, $investigation->available == 1, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
&nbsp;{{ __('investigations.no') }} {{ Form::radio('available', 0, $investigation->available == 0, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-6">
<div class="form-group">
{{ Form::label('', __('investigations.is_investigation_chronic'), ["class"=>'col-md-12']) }}
&nbsp;{{ __('investigations.yes') }} {{ Form::radio('is_chronic', 1, $investigation->is_chronic == 1, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
&nbsp;{{ __('investigations.no') }} {{ Form::radio('is_chronic', 0, $investigation->is_chronic == 0, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('account_id',__('investigations.chart_of_account_name')) }}
{{ Form::select('account_id',$chart_of_accounts,$investigation->account_id,['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="echo_div">
{{ Form::label('echo', __('investigations.echo_investigation_template'), ["class"=>'col-md-12']) }}
&nbsp;{{ __('investigations.yes') }} {{ Form::radio('echo', 1, $investigation->slug == 'echo', ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
&nbsp;{{ __('investigations.no') }} {{ Form::radio('echo', 0, $investigation->slug == null, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('code', 'Item Code') }}
{{ Form::text('code', $investigation->code, ['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('reference_areas', __('diagnoses.reference_areas')) }}
{{ Form::text('reference_text', $investigation->reference_text, ['class' => 'form-control', 'placeholder' => 'Reference text']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::text('reference_link', $investigation->reference_link, ['class' => 'form-control', 'placeholder' => 'Reference link e.g. http://google.com']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="wrapper">
<?php
$hmis_no_outpatient_array = array_filter(explode(",", $investigation->hmis_no_outpatient));
$hmis_category_array = array_filter(explode(",", $investigation->hmis_category));
?>
@if(count($hmis_no_outpatient_array) > 0)
@for ($x = 0; $x < count($hmis_no_outpatient_array); $x++)
<div class="row input_fields_wrap1 copy1">
<div class="col-sm-5">
{{ Form::label('hmis_no_outpatient', 'HMIS-out-patient No.') }}
{{ Form::text('hmis_no_outpatient[]', $hmis_no_outpatient_array[$x], ['class'=>'form-control']) }}
</div>
<div class="col-sm-5">
{{ Form::label('hmis_category', 'HMIS category (Out Patient)') }}
{{ Form::select('hmis_category_opd[]', $hmis_categories_opd, isset($hmis_category_array[$x]) ? $hmis_category_array[$x] : "", ['class' => 'form-control']) }}
</div>
</div>
@endfor
@else
<div class="row input_fields_wrap1 copy1">
<div class="col-sm-5">
{{ Form::label('hmis_no_outpatient', 'HMIS-out-patient No.') }}
{{ Form::text('hmis_no_outpatient[]', '', ['class'=>'form-control']) }}
</div>
<div class="col-sm-5">
{{ Form::label('hmis_category', 'HMIS category (Out Patient)') }}
{{ Form::select('hmis_category_opd[]', $hmis_categories_opd, '', ['class' => 'form-control']) }}
</div>
</div>
@endif
</div>
<a class="add_field_hmis" style="color: blue;">{{ __('investigations.add_more') }}</a><br><br>
<div class="form-group">
@php
$inpatient_option =$investigation->hmis_category_inpatient;
$inpatient_other = array_filter($inpatient_hmis_categories, function ($item) use ($inpatient_option) {
return $item['id'] !== $inpatient_option;
});
$inpatient_selected = array_filter($inpatient_hmis_categories, function ($item) use ($inpatient_option) {
return $item['id'] == $inpatient_option;
});
$categories_option = $investigation->hmis_no_inpatient;
$selected_hmis_categories_option=array_filter($inpatient_hmis_category_options, function ($item) use ($categories_option) {
return $item['id'] == $categories_option;
});
$other_hmis_categories_options= array_filter($inpatient_hmis_category_options, function ($item) use ($categories_option) {
return $item['id'] != $categories_option;
});
@endphp
{{ Form::label('hmis_category_inpatient', __('investigations.hmis_category_in_patient')) }}
<select class="form-control" id="hmis_category_inpatient" name="hmis_category_inpatient">
<option value="" <?php echo empty($inpatient_selected)? 'selected ':''; ?>disabled>- Select HMIS category -</option>
@foreach ($inpatient_selected as $option)
<option value="{{ $option['id'] }}" selected>{{ $option['title'] }}</option>
@endforeach
@foreach ($inpatient_other as $inpatient_item)
<option value="{{ $inpatient_item['id'] }}">{{ $inpatient_item['title'] }}</option>
@endforeach
</select>
<div class="help-block with-errors"></div>
{{ Form::label('hmis_no_inpatient', __('investigations.hmis_category_in_patient_number')) }}
<select class="form-control" id="inpatient_hmis_category_options" name="hmis_no_inpatient">
@if (empty($selected_hmis_categories_option))
<option value="" selected disabled>- Select HMIS category <?php echo empty($inpatient_selected)? 'first ':'Option'; ?> -</option>
@else
@foreach ($selected_hmis_categories_option as $selected_option )
<option value="{{ $selected_option['id'] }}" selected>{{ $selected_option['name'] }}</option>
@endforeach
@endif
@foreach ($other_hmis_categories_options as $option )
<option value="{{ $option['id'] }}">{{ $option['name'] }}</option>
@endforeach
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('hmis_002_slug', __('investigations.hmis_002_category')) }}
{{ Form::select('hmis_002_slug', ['' => '--select--',1 => 'TB', 2 => 'RDT', 3=>'B/S', 4=>'RBS'], $investigation->hmis_002_slug?? '', ['class' => 'form-control', 'id'=>'hmis_002_slug']) }}
</div>
{{ Form::button(__('investigations.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('investigations.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
@php $spec_vars = \DB::table('investigation_specialised_variables')->whereNull('deleted_at')->where('investigation_id', $investigation->id)->get(); @endphp
@if(count($spec_vars) > 0)
<br><br>
<a class="btn btn-warning" href="/investigations/edit_specialised_variables_ranking/{{ $investigation->id }}">{{ __('investigations.edit_specialised_variables_ranking') }}</a>
@endif
</div>
</div>
</div>
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<!-- icheck -->
<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/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$('#account_id, #category, #units').select2();
var echo_value = '{{ $investigation->slug }}';
var max_fields1 = 4; //maximum reference area/name divs allowed
var x1 = 1; //initial reference area/name div count
if(echo_value == 'echo') $('#echo_div').show();
else $('#echo_div').hide();
$('#category').change(function() {
if($(this).val() == '17') $('#echo_div').show();
else {
$('#echo_div').hide();
$('#echo').val(0)
}
});
$(".add_field_hmis").on("click", function (e) {
//alert('clicked here');
e.preventDefault();
if (x1 < max_fields1) {
x1++;
var copy1 = $('.copy1').clone();
copy1.attr("class", 'row input_fields_wrap1');
copy1.attr("id", 'copy1' + x1);
copy1.append('<a href="#" class="remove_field1" style="color: maroon"><sup>X</sup></a>');
copy1.insertAfter('.copy1');
}
});
$("#wrapper").on("click", ".remove_field1", function (e) {
e.preventDefault();
$(this).parent('div').remove();
x1--;
});
$('#range_type').change(function (e) {
e.preventDefault();
if(this.value == 2){
$('#constant_div').show();
$('#dynamic_div').hide();
}else{
$('#constant_div').hide();
$('#dynamic_div').show();
}
});
$('#hmis_category_inpatient').change(function(e) {
category_options();
});
function category_options(){
let category = $('#hmis_category_inpatient').val();
$.ajax({
type: "POST",
url: "/get_hmis_categories_options",
data: {hmis_category: category},
cache: false,
success: function (response) {
if(response == 'false'){
alert("<?php echo __('procedures.failed_options'); ?>");
} else {
$('#inpatient_hmis_category_options').html(response);
$('#inpatient_hmis_category_options').prop('required',true);
}
}
});
}
</script>
@endpush