439 lines
28 KiB
PHP
439 lines
28 KiB
PHP
@extends('Layouts.master')
|
|
|
|
@section('content')
|
|
<div class="main-container">
|
|
<div class="edit-profile">
|
|
<div class="user-loan-lists">
|
|
<div class="table-responsive">
|
|
<h2>@lang('loans')</h2>
|
|
@if(count($loans) >= 1)
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<th>@lang('type')</th>
|
|
<th>@lang('item')</th>
|
|
<th class="text-center">@lang('amount')</th>
|
|
<!--
|
|
<th>@lang('date_start')</th>
|
|
-->
|
|
<th>@lang('date_end')</th>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($loans as $loan)
|
|
<tr>
|
|
<td class="col align-middle">
|
|
@switch($loan->loanable_type)
|
|
@case('App\Models\Product')
|
|
@can('products_viewAny')
|
|
<a href="{{route('products.index')}}" class="btn btn-outline-success" target="_blank">@lang('product')</a>
|
|
@else
|
|
@lang('product')
|
|
@endcan
|
|
@break
|
|
@case('App\Models\Cabel')
|
|
@can('cabels_viewAny')
|
|
<a href="{{route('cabels.index')}}" class="btn btn-outline-success" target="_blank">@lang('cabel')</a>
|
|
@else
|
|
@lang('cabel')
|
|
@endcan
|
|
@break
|
|
@endswitch
|
|
</td>
|
|
<td class="col align-middle">
|
|
@switch($loan->loanable_type)
|
|
@case('App\Models\Product')
|
|
@can('products_view')
|
|
<a href="{{route('products.show',['product' => $loan->loanable->id])}}" target="_blank" class="btn btn-outline-success">
|
|
@if(config('app.barcode_mode') == 'dynamic')
|
|
{{$loan->loanable->category->name}}.@if(!empty($loan->loanable->subcategory)){{$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>
|
|
@else
|
|
@if(config('app.barcode_mode') == 'dynamic')
|
|
{{$loan->loanable->category->name}}.@if(!empty($loan->loanable->subcategory)){{$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
|
|
@endcan
|
|
@break
|
|
@case('App\Models\Cabel')
|
|
@can('cabels_view')
|
|
<a href="{{route('cabels.show',['cabel' => $loan->loanable->id])}}" target="_blank" class="btn btn-outline-success">
|
|
{{$loan->loanable->category->name}}.{{$loan->loanable->name}}
|
|
</a>
|
|
@else
|
|
{{$loan->loanable->category->name}}.{{$loan->loanable->name}}
|
|
@endcan
|
|
@break
|
|
@endswitch
|
|
</td>
|
|
<td class="col align-middle text-center">
|
|
{{$loan->amount}}
|
|
</td>
|
|
<!--
|
|
<td class="col align-middle">
|
|
{{date('d.m.Y',strtotime($loan->date_start))}}
|
|
</td>
|
|
-->
|
|
<td class="col align-middle">
|
|
@if(!empty($loan->date_end))
|
|
{{date('d.m.Y',strtotime($loan->date_end))}}
|
|
@else
|
|
@lang('permanent')
|
|
@endif
|
|
</td>
|
|
|
|
</tr>
|
|
@endforeach
|
|
<tr>
|
|
<td class="col fw-bold" colspan="2">Total : </td>
|
|
<td class="col text-center fw-bold">{{count($data->loans)}}</td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
@else
|
|
@lang('no_amount') @lang('loans')
|
|
@endif
|
|
|
|
<br>
|
|
<hr>
|
|
<br>
|
|
|
|
<h2>@lang('reservations')</h2>
|
|
@if(count($reservations) >= 1)
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<th>@lang('type')</th>
|
|
<th>@lang('item')</th>
|
|
<th class="text-center">@lang('amount')</th>
|
|
<th>@lang('date_start')</th>
|
|
<th>@lang('date_end')</th>
|
|
<th>@lang('status')</th>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($reservations as $loan)
|
|
<tr>
|
|
<td class="col align-middle">
|
|
@switch($loan->loanable_type)
|
|
@case('App\Models\Product')
|
|
@can('products_viewAny')
|
|
<a href="{{route('products.index')}}" class="btn btn-outline-success" target="_blank">@lang('product')</a>
|
|
@else
|
|
@lang('product')
|
|
@endcan
|
|
@break
|
|
@case('App\Models\Cabel')
|
|
@can('cabels_viewAny')
|
|
<a href="{{route('cabels.index')}}" class="btn btn-outline-success" target="_blank">@lang('cabel')</a>
|
|
@else
|
|
@lang('cabel')
|
|
@endcan
|
|
@break
|
|
@endswitch
|
|
</td>
|
|
<td class="col align-middle">
|
|
@switch($loan->loanable_type)
|
|
@case('App\Models\Product')
|
|
@can('products_view')
|
|
<a href="{{route('products.show',['product' => $loan->loanable->id])}}" target="_blank" class="btn btn-outline-success">
|
|
@if(config('app.barcode_mode') == 'dynamic')
|
|
{{$loan->loanable->category->name}}.@if(!empty($loan->loanable->subcategory)){{$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>
|
|
@else
|
|
@if(config('app.barcode_mode') == 'dynamic')
|
|
{{$loan->loanable->category->name}}.@if(!empty($loan->loanable->subcategory)){{$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
|
|
@endcan
|
|
@break
|
|
@case('App\Models\Cabel')
|
|
@can('cabels_view')
|
|
<a href="{{route('cabels.show',['cabel' => $loan->loanable->id])}}" target="_blank" class="btn btn-outline-success">
|
|
{{$loan->loanable->category->name}}.{{$loan->loanable->name}}
|
|
</a>
|
|
@else
|
|
{{$loan->loanable->category->name}}.{{$loan->loanable->name}}
|
|
@endcan
|
|
@break
|
|
@endswitch
|
|
</td>
|
|
<td class="col align-middle text-center">
|
|
{{$loan->amount}}
|
|
</td>
|
|
|
|
<td class="col align-middle">
|
|
{{date('d.m.Y',strtotime($loan->date_start))}}
|
|
</td>
|
|
|
|
<td class="col align-middle">
|
|
{{date('d.m.Y',strtotime($loan->date_end))}}
|
|
</td>
|
|
<td class="col align-middle">
|
|
@switch($loan->type->name)
|
|
@case('Reservation - Awaiting')
|
|
@lang('validation')
|
|
- @lang('deadline') :
|
|
@if(!empty($loan->date_deadline))
|
|
{{date('d.m.Y H:i:s',strtotime($loan->date_deadline))}}
|
|
@endif
|
|
@break
|
|
@case('Reservation - Set Up')
|
|
@lang('awaiting') @lang('setup')
|
|
@break
|
|
@case('Reservation - Pick Up')
|
|
@lang('awaiting') @lang('pickup')
|
|
@break
|
|
@endswitch
|
|
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
<tr>
|
|
<td class="col fw-bold" colspan="2">Total : </td>
|
|
<td class="col text-center fw-bold">{{count($data->reservations)}}</td>
|
|
<td colspan="3"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
@else
|
|
@lang('no_amount') @lang('reservations')
|
|
@endif
|
|
|
|
<br>
|
|
<hr>
|
|
<br>
|
|
|
|
<h2>@lang('contracts')</h2>
|
|
@if(count($contracts) >= 1)
|
|
@can('pdf_view')
|
|
<table class="table table-striped" id="loanTable">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col"> @lang('date') </th>
|
|
<th scope="col"> @lang('type') </th>
|
|
<th scope="col"> @lang('action') </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($contracts as $file)
|
|
<tr>
|
|
<td class="align-middle">
|
|
{{ date('d.m.Y H:i:s', $file->timestamp) }}
|
|
</td>
|
|
<td class="align-middle">
|
|
@if($file->type == 'contracts')
|
|
@lang('loan')
|
|
@elseif($file->type == 'laptops')
|
|
@lang('laptop')
|
|
@elseif($file->type == 'reservations')
|
|
@lang('reservation')
|
|
@endif
|
|
</td>
|
|
<td class="align-middle">
|
|
<a href="{{ route('pdf.show',['user' => $data->username,'timestamp' => $file->timestamp,'type' => $file->type]) }}" target="_BLANK" class="btn btn-xs btn-outline-info pull-right">
|
|
@lang('show')
|
|
</a>
|
|
@can('delete', App\Models\PDF::class)
|
|
<form method="post" action="{{ route('pdf.delete',['user' => $data->username,'timestamp' => $file->timestamp,'type' => $file->type]) }}" class="d-inline">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="btn btn-outline-danger btn-xs pull-right">@lang('delete')</button>
|
|
</form>
|
|
@endcan
|
|
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
<tr>
|
|
<td class="col fw-bold">Total : {{count($contracts)}}</td>
|
|
<td colspan="2"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
@endcan
|
|
@cannot('pdf_view')
|
|
@if(Auth::user()->id == $data->id)
|
|
<table class="table table-striped table-hover table-size" id="loanTable">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col"> @lang('date') </th>
|
|
<th scope="col"> @lang('type') </th>
|
|
<th scope="col"> @lang('action') </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($contracts as $file)
|
|
<tr>
|
|
<td>{{ date('d.m.Y H:i:s', $file->timestamp) }}</td>
|
|
<td>
|
|
@if($file->type == 'contracts')
|
|
@lang('loan')
|
|
@elseif($file->type == 'laptops')
|
|
@lang('laptop')
|
|
@elseif($file->type == 'reservations')
|
|
@lang('reservation')
|
|
@endif
|
|
</td>
|
|
<td>
|
|
<a href="{{ route('pdf.show',['user' => $data->username,'timestamp' => $file->timestamp,'type' => $file->type]) }}" target="_BLANK" class="btn btn-xs btn-outline-info pull-right">
|
|
@lang('show')
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
<tr>
|
|
<td class="col fw-bold">Total : {{count($contracts)}}</td>
|
|
<td colspan="2"></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
@endif
|
|
@endcannot
|
|
@else
|
|
@lang('no_amount') @lang('contracts')
|
|
@endif
|
|
|
|
<br>
|
|
<hr>
|
|
<br>
|
|
|
|
@can('notes_view')
|
|
<h2>@lang('notes')</h2>
|
|
@if(count($notes) >= 1)
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<th>@lang('item') @lang('type')</th>
|
|
<th>@lang('item')</th>
|
|
<th>@lang('note') @lang('type')</th>
|
|
<th>@lang('note')</th>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($notes as $note)
|
|
<tr>
|
|
<td>
|
|
@switch($note->loanable_type)
|
|
@case('App\Models\Product')
|
|
@can('products_viewAny')
|
|
<a href="{{route('products.index')}}" class="btn btn-outline-success" target="_blank">@lang('product')</a>
|
|
@else
|
|
@lang('product')
|
|
@endcan
|
|
@break
|
|
@case('App\Models\Cabel')
|
|
@can('cabels_viewAny')
|
|
<a href="{{route('cabels.index')}}" class="btn btn-outline-success" target="_blank">@lang('cabel')</a>
|
|
@else
|
|
@lang('cabel')
|
|
@endcan
|
|
@break
|
|
@endswitch
|
|
</td>
|
|
<td>
|
|
@switch($note->loanable_type)
|
|
@case('App\Models\Product')
|
|
@can('products_view')
|
|
<a href="{{route('products.show',['product' => $note->loanable->id])}}" target="_blank" class="btn btn-outline-success">
|
|
@if(config('app.barcode_mode') == 'dynamic')
|
|
{{$note->loanable->category->name}}.@if(!empty($note->loanable->subcategory)){{$note->loanable->subcategory->name}}.@endif{{$note->loanable->brand->name}}.{{$note->loanable->model->name}}@if(!empty($note->loanable->name)).{{$note->loanable->name}}@endif
|
|
@endif
|
|
@if(config('app.barcode_mode') == 'static')
|
|
{{$note->loanable->barcode}}
|
|
@endif
|
|
</a>
|
|
@else
|
|
@if(config('app.barcode_mode') == 'dynamic')
|
|
{{$note->loanable->category->name}}.@if(!empty($note->loanable->subcategory)){{$note->loanable->subcategory->name}}.@endif{{$note->loanable->brand->name}}.{{$note->loanable->model->name}}@if(!empty($note->loanable->name)).{{$note->loanable->name}}@endif
|
|
@endif
|
|
@if(config('app.barcode_mode') == 'static')
|
|
{{$note->loanable->barcode}}
|
|
@endif
|
|
@endcan
|
|
@break
|
|
@case('App\Models\Cabel')
|
|
@can('cabels_view')
|
|
<a href="{{route('cabels.show',['cabel' => $note->loanable->id])}}" target="_blank" class="btn btn-outline-success">
|
|
{{$note->loanable->category->name}}.{{$note->loanable->name}}
|
|
</a>
|
|
@else
|
|
{{$note->loanable->category->name}}.{{$note->loanable->name}}
|
|
@endcan
|
|
@break
|
|
@endswitch
|
|
</td>
|
|
<td>
|
|
{{$note->type->name}}
|
|
</td>
|
|
<td>
|
|
{{$note->note}}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@else
|
|
@lang('no_amount') @lang('notes')
|
|
@endif
|
|
@endcan
|
|
</div>
|
|
</div>
|
|
<div class="profile-inputs">
|
|
<div class="mb-3 justify-content-center">
|
|
<label for="Name" class="form-label">@lang('username'):</label>
|
|
<input disabled type="text" class="form-control" placeholder="{{$data->username}}">
|
|
</div>
|
|
|
|
<div class="mb-3 justify-content-center">
|
|
<label for="Name" class="form-label">@lang('name_full'):</label>
|
|
<input disabled type="text" class="form-control" placeholder="{{$data->name}}">
|
|
</div>
|
|
|
|
<div class="mb-3 justify-content-center">
|
|
<label for="Name" class="form-label">@lang('role'):</label>
|
|
<input disabled type="text" class="form-control" placeholder="{{$data->role->name}}">
|
|
</div>
|
|
|
|
<div class="mb-3 justify-content-center">
|
|
<label for="Name" class="form-label">@lang('type'):</label>
|
|
@switch($data->loanerType->name)
|
|
@case('adUser')
|
|
<input disabled type="text" class="form-control" placeholder="@lang('ADUser')">
|
|
@break
|
|
@case('nadUser')
|
|
<input disabled type="text" class="form-control" placeholder="@lang('notADUser')">
|
|
@break
|
|
@endswitch
|
|
|
|
</div>
|
|
<div class="d-flex justify-content-center">
|
|
@can('users_edit')
|
|
@if($data->loanerType->name != 'adUser')
|
|
<a href="{{route('users.edit', $data)}}" class="btn btn-outline-success">@lang('update')</a>
|
|
@else
|
|
@can('users_edit_role')
|
|
@if(Auth::user()->id != $data->id)
|
|
<a href="{{route('users.edit', $data)}}" class="btn btn-outline-success">@lang('update')</a>
|
|
@endif
|
|
@else
|
|
<a disabled class="btn btn-outline-success disabled-button">@lang('update')</a>
|
|
@endcan
|
|
@endif
|
|
@endcan
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@section('scripting')
|
|
@endsection
|