Files
streamline-emr/docker/streamline-src/Modules/ClinicalData/Resources/views/drugs/edit.blade.php
T

187 lines
9.6 KiB
PHP
Executable File

@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/icheck/skins/all.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">{{ __('drugs.edit_drug') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('drugs.dashboard') }}</a></li>
<li><a href="{{ route('drugs.index') }}">{{ __('drugs.drugs') }}</a></li>
<li class="active">{{ __('drugs.edit') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
{{ Form::model($drug, ['method' => 'PUT', 'route' => ['drugs.update',$drug], 'data-toggle' => 'validator']) }}
<div class="form-group">
{{ Form::label('name', __('drugs.drug_name')) }}
{{ Form::text('name', $drug->name, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('category_id', __('drugs.drug_category')) }}
{{ Form::select('category_id', $drug_categories, $drug->category_id, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('form_id', __('drugs.drug_form')) }}
{{ Form::select('form_id', $drug_forms, $drug->form_id, ['class'=>'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('available', __('drugs.is_drug_available'), ["class"=>'col-md-12']) }}
&nbsp;{{ __('drugs.yes') }} {{ Form::radio('available', 1, $drug->available == 1, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
&nbsp;{{ __('drugs.no') }} {{ Form::radio('available', 0, $drug->available == 0, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('unit_id', __('drugs.drug_unit')) }}
{{ Form::select('unit_id', $drug_units, $drug->unit_id, ['class'=>'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('pharmacy_stock', __('drugs.current_pharmacy_stock')) }}
{{ Form::number('pharmacy_stock', $drug->pharmacy_stock, ['class'=>'form-control compulsory', 'required', 'readonly']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('store_stock', __('drugs.current_store_stock')) }}
{{ Form::number('store_stock', $drug->quantity, ['class' => 'form-control compulsory', 'required', 'readonly']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('reorder_level', __('drugs.re_order_level')) }}
{{ Form::number('reorder_level', $drug->reorder_level, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('', __('drugs.long_term'), ["class"=>'col-md-12']) }}
&nbsp;Yes {{ Form::radio('long_term', 1, $drug->long_term == 1, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
&nbsp;No {{ Form::radio('long_term', 0, $drug->long_term == 0, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('hssip', __('drugs.hssip')) }}
{{ Form::text('hssip', $drug->hssip, ['class'=>'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('account_id', __('drugs.income_account')) }}
{{ Form::select('account_id', $income_accounts, $drug->account_id, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('cog_account', __('drugs.cost_of_goods_account')) }}
{{ Form::select('cog_account', $cost_of_goods_accounts, $drug->cost_of_goods_account, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('inventory_account', __('drugs.inventory_asset_account')) }}
{{ Form::select('inventory_account', $inventory_asset_accounts, $drug->inventory_account, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
@php
$reference_array = !empty($drug->reference_areas)? explode(",", $drug->reference_areas):[];
$reference_name = !empty($drug->reference_name)? explode(",", $drug->reference_name): [];
@endphp
@if (!empty($reference_array) && !empty($reference_name))
@for($i = 0; $i < count($reference_array); $i++)
<div class="row form-group">
<div class="col-sm-4">
{{ Form::text('reference_name[]', $reference_name[$i] ?? '', ['class'=>'form-control', 'placeholder' => 'Reference Name']) }}
</div>
<div class="col-sm-8">
{{ Form::url('reference_areas[]', $reference_array[$i] ?? '', ['class'=>'form-control', 'placeholder' => 'eg http://www.google.com']) }}
</div>
</div>
@endfor
@if (count($reference_array) < 4)
<div class="row form-group">
<div class="col-sm-12 input_fields_wrap"></div>
<div class="col-sm-12"><a class="add_field_button" style="color: blue;">{{ __('symptoms.add_more') }}</a></div>
</div>
@endif
@else
<div class="form-group">
{{ Form::label('reference_text', __('symptoms.reference_area')) }}
<div class="row">
<div class="col-sm-4">
{{ Form::text('reference_name[]', '', ['class'=>'form-control', 'placeholder' => 'Reference Name']) }}
</div>
<div class="col-sm-8">
{{ Form::url('reference_areas[]', '', ['class'=>'form-control', 'placeholder' => 'eg http://www.google.com']) }}
</div>
</div>
<div class="col-sm-12 input_fields_wrap"></div>
<div class="col-sm-12"><a class="add_field_button" style="color: blue;">{{ __('symptoms.add_more') }}</a></div>
</div>
@endif
{{ Form::button(__('drugs.submit'),['type'=>'submit','class'=>'btn btn-rounded btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('drugs.cancel'),['type'=>'reset','class'=>'btn btn-rounded btn-default waves-effect waves-light']) }}
{{ 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 type="text/javascript">
$(document).ready(function () {
var max_fields = 4; //maximum input boxes allowed
var wrapper = $(".input_fields_wrap"); //Fields wrapper
let number = {{ count($reference_array) }};
var x = number? number: 1; //initlal text box count
$(".add_field_button").click(function (e) { //on add input button click
e.preventDefault();
if (x < max_fields) { //max input box allowed
x++; //text box increment
$(wrapper).append('<br><div class="row"><div class="col-sm-4"><input type="text" class="form-control compulsory" placeholder="Reference name" name="reference_name[]" required/></div><div class="help-block with-errors"></div>' +
'<div class="col-sm-7"><input type="url" placeholder="eg http://www.google.com" class="form-control compulsory" name="reference_areas[]" required/></div><div class="help-block with-errors"></div>'
+ '<a href="#" class="remove_field" style="color: maroon"><sup>X</sup></a></div>'); //add input box
}else {
$(".add_field_button").hide();
alert('Only four references can be added.');
}
});
$(wrapper).on("click", ".remove_field", function (e) { //user click on remove text
e.preventDefault();
$(this).parent('div').remove();
x--;
})
});
</script>
@endpush