149 lines
12 KiB
PHP
149 lines
12 KiB
PHP
@extends('Layouts.master')
|
|
|
|
@section('content')
|
|
<div class="main-container pb-4" id="tables">
|
|
@include('Partials.Pages.index_top')
|
|
<div class="table-responsive">
|
|
<table id="userTable" class="table table-hover table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">@lang('username')</th>
|
|
<th scope="col">@lang('name_full')</th>
|
|
<th scope="col">@lang('role')</th>
|
|
<th scope="col">@lang('action')</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($data as $object)
|
|
<tr>
|
|
<td scope="row">{{$object->username}}</td>
|
|
<td>{{$object->name}}</td>
|
|
<td>{{$object->role->name}}</td>
|
|
<td>
|
|
@can(Request::segment(1).'_edit')
|
|
<a href="{{route(Request::segment(1).'.edit',[$data_name => $object])}}"
|
|
class="btn btn-outline-success">
|
|
@lang('edit')
|
|
</a>
|
|
@endcan
|
|
@can(Request::segment(1).'_restore')
|
|
<a href="{{route(Request::segment(1).'.restore',[$data_name => $object])}}"
|
|
class="btn btn-outline-success">
|
|
@lang('restore')
|
|
</a>
|
|
@endcan
|
|
@can(Request::segment(1).'_delete_force')
|
|
<button data-toggle="modal" data-target="#deleteModal_{{$object->id}}" class="btn btn-outline-danger">@lang('delete_force')</button>
|
|
<div class="product-edit-buttons">
|
|
<!-- Modal -->
|
|
<div class="modal" tabindex="-1" role="dialog" id="deleteModal_{{$object->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('deletion_force') @lang('of') @lang($data_name)</h5>
|
|
<button type="button" class="btn btn-secondary close fold" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
@lang($data_name) {{$object->name}}
|
|
<h2>@lang('loans')</h2>
|
|
@if(count($object->loans) >= 1)
|
|
<table class="table table-striped">
|
|
<tbody>
|
|
@foreach($object->loans as $loan)
|
|
<tr>
|
|
<td class="align-middle">
|
|
@switch($loan->loanable_type)
|
|
@case('App\Models\Product')
|
|
<a href="{{route('products.show',['product' => $loan->loanable->id])}}" target="_blank" class="btn btn-success">
|
|
@if(config('app.barcode_mode') == 'dynamic')
|
|
{{$loan->loanable->category->name}}.@if(!empty($loan->loanable->subcategory->name)){{$loan->loanable->subcategory->name}}.@endif{{$loan->loanable->brand->name}}.{{$loan->loanable->model->name}}@if(!empty($loan->loanable->name)).{{$loan->loanable->name}}@endif
|
|
@endif
|
|
@if(config('app.barcode_mode') == 'static')
|
|
{{$loan->loanable->barcode}}
|
|
@endif
|
|
</a>
|
|
@break
|
|
@case('App\Models\Cabel')
|
|
<a href="{{route('cabels.show',['cabel' => $loan->loanable->id])}}" target="_blank" class="btn btn-success">
|
|
{{$loan->loanable->category->name}}.{{$loan->loanable->name}}
|
|
</a>
|
|
@break
|
|
@endswitch
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@else
|
|
@lang('no_amount') @lang('loans')
|
|
@endif
|
|
<h2>@lang('reservations')</h2>
|
|
|
|
@if(count($object->reservations) >= 1)
|
|
<table class="table table-striped">
|
|
<tbody>
|
|
@foreach($object->reservations as $loan)
|
|
<tr>
|
|
|
|
<td class="align-middle">
|
|
@switch($loan->loanable_type)
|
|
@case('App\Models\Product')
|
|
<a href="{{route('products.show',['product' => $loan->loanable->id])}}" target="_blank" class="btn btn-success">
|
|
@if(config('app.barcode_mode') == 'dynamic')
|
|
{{$loan->loanable->category->name}}.@if(!empty($loan->loanable->subcategory->name)){{$loan->loanable->subcategory->name}}.@endif{{$loan->loanable->brand->name}}.{{$loan->loanable->model->name}}@if(!empty($loan->loanable->name)).{{$loan->loanable->name}}@endif
|
|
@endif
|
|
@if(config('app.barcode_mode') == 'static')
|
|
{{$loan->loanable->barcode}}
|
|
@endif
|
|
</a>
|
|
@break
|
|
@case('App\Models\Cabel')
|
|
<a href="{{route('cabels.show',['cabel' => $loan->loanable->id])}}" target="_blank" class="btn btn-success">
|
|
{{$loan->loanable->category->name}}.{{$loan->loanable->name}}
|
|
</a>
|
|
@break
|
|
@endswitch
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
|
|
@else
|
|
@lang('no_amount') @lang('reservations')
|
|
@endif
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">@lang('cancel')</button>
|
|
<form method="get" action="{{route(Request::segment(1).".forceDelete", [$data_name => $object])}}" id="deleteForm" class="form-inline">
|
|
@method('delete')
|
|
@csrf
|
|
<button class="btn btn-danger" id="ajaxSubmit" @if(count($object->loans) >= 1 OR count($object->loans) >= 1)disabled @endif>@lang('delete_force')</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
|
|
<script src="https://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
|
|
integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS"
|
|
crossorigin="anonymous"></script>
|
|
|
|
@endcan
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@include('Partials.Pages.display')
|
|
</div>
|
|
@endsection
|
|
@section('scripting')
|
|
@endsection
|