Files
streamline-emr/docker/streamline-src/Modules/Finance/Resources/views/fixed_assets/index.blade.php
T

151 lines
7.2 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">{{ __('fixed_assets.fixed_assets') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('fixed_assets.dashboard') }}</a></li>
<li><a href="/service_items/index">{{ __('fixed_assets.fixed_assets') }}</a></li>
<li class="active">{{ __('fixed_assets.view') }}</li>
</ol>
</div>
</div>
@include('flash::message')
@include('finance::fixed_assets.menu')
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<p class="text-muted m-b-30">{{ __('fixed_assets.export_to_pdf') }}</p>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('fixed_assets.asset_name') }}</th>
<th>{{ __('fixed_assets.serial_number') }}</th>
<th>{{ __('fixed_assets.cost_price') }}</th>
<th>{{ __('fixed_assets.acquisition_date') }}</th>
<th>{{ __('fixed_assets.description') }}</th>
<th>{{ __('fixed_assets.warranty_expiry') }}</th>
<th>{{ __('fixed_assets.item_condition') }}</th>
<th>{{ __('fixed_assets.supplier') }}</th>
<th>{{ __('fixed_assets.payment_type') }}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@php $total_fixed_assets_value = 0; @endphp
@if(count($fixed_assets) > 0)
@foreach($fixed_assets as $fixed_asset)
@php $total_fixed_assets_value += $fixed_asset->cost_price; @endphp
<tr>
<td>{{ $fixed_asset->name }}</td>
<td>{{ $fixed_asset->serial_number }}</td>
<td>{{ ugandan_shillings($fixed_asset->cost_price) }}</td>
<td>{{ $fixed_asset->acquisition_date }}</td>
<td>{{ $fixed_asset->description }}</td>
<td>{{ $fixed_asset->warranty_expiration_date }}</td>
<td>{{ $fixed_asset->item_condition == 1 ? 'New' : 'Used' }}</td>
<td>{{ isset($suppliers[$fixed_asset->supplier_id]) ? $suppliers[$fixed_asset->supplier_id] : "" }}</td>
<td>
@switch($fixed_asset->payment_type)
@case("cash")
<span>Cash/EFT/Cheque</span>
@break
@case("bill")
<span>Bill</span>
@break
@case("asset_exists")
<span>Already existing asset</span>
@break
@default
@endswitch
</td>
<td>
@if(Auth::user()->can('edit-fixed-assets'))
<a href="/fixed_assets/{{ $fixed_asset->id }}/edit/" class="btn btn-default btn-sm"><i class="fa fa-pencil"></i> {{ __('fixed_assets.edit') }}</a>
@endif
</td>
<td>
@if(Auth::user()->can('delete-fixed-assets'))
{{ Form::model($fixed_asset->id ,['method' => 'DELETE', 'route' => ['fixed_assets.destroy', $fixed_asset->id]]) }}
<button type="submit" class="btn btn-danger btn-sm deleteButton" value="{{$fixed_asset->id}}"><i class="fa fa-trash"></i>
{{ __('fixed_assets.delete') }}</button>
{{ Form::close() }}
@endif
</td>
</tr>
@endforeach
@endif
</tbody>
<tfoot>
<tr>
<td></td>
<td><strong>{{ __('family_accounts.total') }}</strong></td>
<td colspan="9"><strong>{{ ugandan_shillings($total_fixed_assets_value) }}</strong></td>
</tr>
</tfoot>
</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'
]
});
$(".deleteButton").click(function(e){
//e.preventDefault();
var fixedAssetId = $(this).val();
console.log(fixedAssetId);
checkBeforeSubmission(fixedAssetId);
})
function checkBeforeSubmission(fixedAssetId) {
$.ajax({
url: '/is_fixed_asset_attached_to_bill',
data: {'fixed_asset_id':fixedAssetId},
success: function(response){
if (response == "has_attached_bill") {
return confirm('The corresponding bill attached to this asset will also be deleted. Do you want to proceed');
} else {
return confirm('The corresponding chart of accounts will be affected by this action. Do you want to proceed');
}
}
});
}
</script>
@endpush