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

{{ __('drugs.edit_drug') }}

@include('flash::message')
{{ Form::model($drug, ['method' => 'PUT', 'route' => ['drugs.update',$drug], 'data-toggle' => 'validator']) }}
{{ Form::label('name', __('drugs.drug_name')) }} {{ Form::text('name', $drug->name, ['class' => 'form-control compulsory', 'required']) }}
{{ Form::label('category_id', __('drugs.drug_category')) }} {{ Form::select('category_id', $drug_categories, $drug->category_id, ['class' => 'form-control compulsory', 'required']) }}
{{ Form::label('form_id', __('drugs.drug_form')) }} {{ Form::select('form_id', $drug_forms, $drug->form_id, ['class'=>'form-control compulsory', 'required']) }}
{{ Form::label('available', __('drugs.is_drug_available'), ["class"=>'col-md-12']) }}  {{ __('drugs.yes') }} {{ Form::radio('available', 1, $drug->available == 1, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}  {{ __('drugs.no') }} {{ Form::radio('available', 0, $drug->available == 0, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
{{ Form::label('unit_id', __('drugs.drug_unit')) }} {{ Form::select('unit_id', $drug_units, $drug->unit_id, ['class'=>'form-control compulsory', 'required']) }}
{{ Form::label('pharmacy_stock', __('drugs.current_pharmacy_stock')) }} {{ Form::number('pharmacy_stock', $drug->pharmacy_stock, ['class'=>'form-control compulsory', 'required', 'readonly']) }}
{{ Form::label('store_stock', __('drugs.current_store_stock')) }} {{ Form::number('store_stock', $drug->quantity, ['class' => 'form-control compulsory', 'required', 'readonly']) }}
{{ Form::label('reorder_level', __('drugs.re_order_level')) }} {{ Form::number('reorder_level', $drug->reorder_level, ['class' => 'form-control compulsory', 'required']) }}
{{ Form::label('', __('drugs.long_term'), ["class"=>'col-md-12']) }}  Yes {{ Form::radio('long_term', 1, $drug->long_term == 1, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}  No {{ Form::radio('long_term', 0, $drug->long_term == 0, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }}
{{ Form::label('hssip', __('drugs.hssip')) }} {{ Form::text('hssip', $drug->hssip, ['class'=>'form-control']) }}
{{ Form::label('account_id', __('drugs.income_account')) }} {{ Form::select('account_id', $income_accounts, $drug->account_id, ['class' => 'form-control']) }}
{{ 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']) }}
{{ Form::label('inventory_account', __('drugs.inventory_asset_account')) }} {{ Form::select('inventory_account', $inventory_asset_accounts, $drug->inventory_account, ['class' => 'form-control']) }}
@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++)
{{ Form::text('reference_name[]', $reference_name[$i] ?? '', ['class'=>'form-control', 'placeholder' => 'Reference Name']) }}
{{ Form::url('reference_areas[]', $reference_array[$i] ?? '', ['class'=>'form-control', 'placeholder' => 'eg http://www.google.com']) }}
@endfor @if (count($reference_array) < 4) @endif @else
{{ Form::label('reference_text', __('symptoms.reference_area')) }}
{{ Form::text('reference_name[]', '', ['class'=>'form-control', 'placeholder' => 'Reference Name']) }}
{{ Form::url('reference_areas[]', '', ['class'=>'form-control', 'placeholder' => 'eg http://www.google.com']) }}
@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() }}
@endsection @push('scripts') @endpush