Lager-v3/resources/views/Partials/Pages/loan_items.blade.php

79 lines
5.1 KiB
PHP

<button data-toggle="modal" data-target="#itemModal_{{$loan->id}}" class="btn btn-info">@lang('items')</button>
<div class="product-edit-buttons">
<!-- Modal -->
<div class="modal" tabindex="-1" role="dialog" id="itemModal_{{$loan->id}}">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="alert alert-danger" style="display:none"></div>
<div class="modal-header">
<h5 class="modal-title">@lang('loan') @lang('items')</h5>
<button type="button" class="btn btn-secondary close fold" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<table class="table table-striped">
<thead>
<th>@lang('type')</th>
<th>@lang('item')</th>
<th class="text-center">@lang('amount')</th>
</thead>
<tbody>
@foreach($loans as $tracked)
@if($loan->date_start == $tracked->date_start)
@if($loan->date_end == $tracked->date_end)
@if($loan->user->id == $tracked->user->id)
<tr>
<td class="align-middle">
@switch($tracked->loanable_type)
@case('App\Models\Product')
@lang('product')
@break
@case('App\Models\Cabel')
@lang('cabel')
@break
@endswitch
</td>
<td class="align-middle">
@switch($tracked->loanable_type)
@case('App\Models\Product')
<a href="{{route('products.show',['product' => $tracked->loanable->id])}}" target="_blank" class="btn btn-success">
@if(config('app.barcode_mode') == 'dynamic')
{{$tracked->loanable->category->name}}.@if(!empty($tracked->loanable->subcategory->name)){{$tracked->loanable->subcategory->name}}.@endif{{$tracked->loanable->brand->name}}.{{$tracked->loanable->model->name}}@if(!empty($tracked->loanable->name)).{{$tracked->loanable->name}}@endif
@endif
@if(config('app.barcode_mode') == 'static')
{{$tracked->loanable->barcode}}
@endif
</a>
@break
@case('App\Models\Cabel')
<a href="{{route('cabels.show',['cabel' => $tracked->loanable->id])}}" target="_blank" class="btn btn-success">
{{$tracked->loanable->category->name}}.{{$tracked->loanable->name}}
</a>
@break
@endswitch
</td>
<td class="align-middle text-center">
{{$tracked->amount}}
</td>
</tr>
@endif
@endif
@endif
@endforeach
<tr>
<td class="align-middle fw-bold">Total</td>
<td class="align-middle fw-bold">:</td>
<td class="align-middle text-center fw-bold">{{$loan->amount}}</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">@lang('cancel')</button>
</div>
</div>
</div>
</div>
</div>