Files

113 lines
5.7 KiB
PHP
Executable File

@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@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">{{ __('sundries.sundries') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('sundries.dashboard') }}</a></li>
<li class="active">{{ __('sundries.sundries') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('clinical_data::sundries.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('sundries.sundry_name') }}</th>
<th>{{ __('sundries.buying_price') }}</th>
<th>{{ __('sundries.non_insured_price') }}</th>
<th>{{ __('sundries.income_account') }}</th>
<th>Cost of Goods Account</th>
<th>Inventory Account</th>
<th></th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>{{ __('sundries.sundry_name') }}</th>
<th>{{ __('sundries.buying_price') }}</th>
<th>{{ __('sundries.non_insured_price') }}</th>
<th>{{ __('sundries.income_account') }}</th>
<th>Cost of Goods Account</th>
<th>Inventory Account</th>
<th></th>
<th></th>
</tr>
</tfoot>
<tbody>
@foreach($sundries as $sundry)
<tr>
<td>{{ $sundry['name'] }}</td>
<td>{{ ugandan_shillings($sundry['cost_price']) }}</td>
<td>{{ ugandan_shillings($sundry['non_insured_price']) }}</td>
<td>{{ isset($chart_of_accounts[$sundry['account_id']]) ? $chart_of_accounts[$sundry['account_id']] : 'N/A' }}</td>
<td>{{ isset($chart_of_accounts[$sundry['cost_of_goods_account']]) ? $chart_of_accounts[$sundry['cost_of_goods_account']] : 'N/A' }}</td>
<td>{{ isset($chart_of_accounts[$sundry['inventory_account']]) ? $chart_of_accounts[$sundry['inventory_account']] : 'N/A' }}</td>
<td>
<a href="/sundries/{{ $sundry['id'] }}/edit/" class="btn btn-info"><i class="fa fa-pencil"></i> {{ __('sundries.edit') }}</a>
</td>
<td>
@if (Auth::user()->can('sundry-delete') && empty($sundry['pharmacy_stock']) && empty($sundry['store_stock']) && empty($sundry['opening_stock']) && !in_array($sundry['id'], $ordered_sundries_ids))
{{ Form::model($sundry['id'] ,['method' => 'DELETE', 'route' => ['sundries.destroy', $sundry['id']]]) }}
<button type="submit" class="btn btn-danger" onclick="return confirm('<?php echo __('sundries.are_you_sure');?>')"><i class="fa fa-trash"></i> {{ __('sundries.delete') }}</button>
{{ Form::close() }}
@elseif (Auth::user()->can('sundry-delete') && (!empty($sundry['pharmacy_stock']) || !empty($sundry['store_stock']) || !empty($sundry['opening_stock'])))
<b class="text-success">Still Stocked</b>
@elseif (in_array($sundry['id'], $ordered_sundries_ids))
<b class="text-success">Sundry was Ordered</b>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 50,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush