Lager-v3/resources/views/logs.blade.php

198 lines
11 KiB
PHP

@extends('Layouts.master')
@section('content')
<div class="main-container pb-4" id="tables">
@include('Partials.Pages.index_top')
<table class="table table-striped">
<thead>
<th>@lang('date')</th>
<th>@lang('user')</th>
<th>@lang('action')</th>
<th>@lang('item') @lang('type')</th>
<th>@lang('item')</th>
<th class="text-center">@lang('amount')</th>
<th>@lang('data')</th>
</thead>
<tbody>
@foreach($data as $log)
<tr>
<td class="col-2 align-middle ">
{{date('d.m.Y H:i:s',strtotime($log->created_at))}}
</td>
<td class="col-1 align-middle ">
<a href="{{route('users.show',['user' => $log->user->id])}}" target="_blank" class="btn btn-success">
{{$log->user->username}}
</a>
</td>
<td class="col-1 align-middle ">
@lang($log->action->name)
</td>
<td class="col-1 align-middle ">
@switch($log->loggable_type)
@case('App\Models\Product')
<a href="{{route('products.index')}}" target="_blank" class="btn btn-success">
@lang('product')
</a>
@break
@case('App\Models\Cabel')
<a href="{{route('cabels.index')}}" target="_blank" class="btn btn-success">
@lang('cabel')
</a>
@break
@case('App\Models\User')
<a href="{{route('users.index')}}" target="_blank" class="btn btn-success">
@lang('user')
</a>
@break
@case('App\Models\Building')
<a href="{{route('buildings.index')}}" target="_blank" class="btn btn-success">
@lang('building')
</a>
@break
@case('App\Models\Room')
<a href="{{route('rooms.index')}}" target="_blank" class="btn btn-success">
@lang('room')
</a>
@break
@case('App\Models\Brand')
<a href="{{route('brands.index')}}" target="_blank" class="btn btn-success">
@lang('brand')
</a>
@break
@case('App\Models\ProductModel')
<a href="{{route('models.index')}}" target="_blank" class="btn btn-success">
@lang('model')
</a>
@break
@case('App\Models\ProductCategory')
<a href="{{route('categories.index')}}" target="_blank" class="btn btn-success">
@lang('category')
</a>
@break
@case('App\Models\ProductSubcategory')
<a href="{{route('subcategories.index')}}" target="_blank" class="btn btn-success">
@lang('subcategory')
</a>
@break
@case('App\Models\CabelCategory')
<a href="{{route('cabelCategories.index')}}" target="_blank" class="btn btn-success">
@lang('cabel') @lang('category')
</a>
@break
@case('App\Models\Note')
<a href="{{route('notes.index')}}" target="_blank" class="btn btn-success">
@lang('note')
</a>
@break
@case('App\Models\Role')
<a href="{{route('roles.index')}}" target="_blank" class="btn btn-success">
@lang('role')
</a>
@break
@case('App\Models\Loan')
<a href="{{route('loans.index')}}" target="_blank" class="btn btn-success">
@lang('loan')
</a>
@break
@endswitch
</td>
<td class="col-3 align-middle ">
@if(isset($log->loggable))
@switch($log->loggable_type)
@case('App\Models\Product')
<a href="{{route('products.show',['product' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
@if(config('app.barcode_mode') == 'static')
@if(!empty($log->loggable->barcode))
{{$log->loggable->barcode}}
@endif
@elseif(config('app.barcode_mode') == 'dynamic')
{{$log->loggable->category->name}}.@if(!empty($log->loggable->subcategory)){{$log->loggable->subcategory->name}}.@endif{{$log->loggable->brand->name}}.{{$log->loggable->model->name}}@if(!empty($log->loggable->name)).{{$log->loggable->name}}@endif
@endif
</a>
@break
@case('App\Models\Cabel')
<a href="{{route('cabels.show',['cabel' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
{{$log->loggable->category->name}}.{{$log->loggable->name}}
</a>
@break
@case('App\Models\User')
<a href="{{route('users.show',['user' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
{{$log->loggable->username}}
</a>
@break
@case('App\Models\Building')
<a href="{{route('buildings.show',['building' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
{{$log->loggable->name}}
</a>
@break
@case('App\Models\Room')
<a href="{{route('rooms.show',['room' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
{{$log->loggable->name}}
</a>
@break
@case('App\Models\Brand')
<a href="{{route('brands.show',['brand' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
{{$log->loggable->name}}
</a>
@break
@case('App\Models\ProductModel')
<a href="{{route('models.show',['model' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
{{$log->loggable->name}}
</a>
@break
@case('App\Models\ProductCategory')
<a href="{{route('categories.show',['category' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
{{$log->loggable->name}}
</a>
@break
@case('App\Models\ProductSubcategory')
<a href="{{route('subcategories.show',['subcategory' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
{{$log->loggable->name}}
</a>
@break
@case('App\Models\CabelCategory')
<a href="{{route('cabelCategories.show',['cabelCategory' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
{{$log->loggable->name}}
</a>
@break
@case('App\Models\Role')
<a href="{{route('roles.show',['role' => $log->loggable->id])}}" target="_blank" class="btn btn-success">
{{$log->loggable->name}}
</a>
@break
@endswitch
@else
@endif
</td>
<td class="col-1 text-center align-middle">
{{$log->amount}}
</td>
<td class="col-8 align-middle">
@if(isset($log->loggable))
@if(!empty($log->target))
@lang('to')
<a href="{{route('users.show',['user' => $log->target->id])}}" target="_blank" class="btn btn-success ms-2">
{{$log->target->username}}
</a>
@elseif($log->action->name == "reserved")
<a href="{{route('users.show',['user' => $log->target->id])}}" target="_blank" class="btn btn-success">
{{$log->target->username}}
</a>
@elseif($log->action->name == "edited" OR $log->action->name == "adjusted")
{{$log->log}}
@endif
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
@include('Partials.Pages.display')
</div>
@endsection
@section('scripting')
@endsection