ldc-supportweb/resources/views/bo/pages/credit_logs/index.blade.php
2023-08-14 09:23:39 +00:00

112 lines
5.2 KiB
PHP

@extends('layout.app', ['brParam' => $credit_accountModel->brand])
@section('title', Str::singular(__('models.classes.creditlogs')))
@section('description', __(':model1 du :model2: :account', [
'model1' => Str::singular(__('models.classes.creditlogs')),
'model2' => Str::singular(__('models.classes.accounts')),
'account' => $credit_accountModel->label])
)
@section('breadcrumb', request()->route()->getName())
@section('content')
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center">
<div class="d-flex flex-row align-items-start">
@can('isAdmin')
<a href="{{ route('bo.brands.credit_accounts.index', ['brand' => $credit_accountModel->brand]) }}"
class="btn btn-primary text-decoration-none m-0 me-2"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.list_all', ['model' => __('models.classes.brands')]) }}">
<i class="fa-solid fa-arrow-left"></i>
</a>
@endcan
@include('breadcrumbs.breadcrumb-body', ['brParam' => $credit_accountModel->brand])
</div>
<div class="mb-2 mb-md-0">
<div class="btn-group" role="group">
@can('isAdmin')
<a href="{{ route('bo.brands.credit_accounts.index', ['brand' => $credit_accountModel->brand->id] ) }}"
class="btn btn-secondary"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.view_model', ['model' => __('models.classes.accounts')]) }}">
<i class="fa-solid fa-users"></i>
</a>
<a class="btn btn-warning"
href="{{ route('bo.brands.credit_accounts.credit_logs.create', [
'brand' => $credit_accountModel->brand,
'account' => $credit_accountModel,
]) }}"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.credit_model', ['model' => Str::singular(__('models.classes.accounts'))]) }}">
<i class="fa-solid fa-credit-card"></i>
</a>
<a class="btn btn-info"
href="{{ route('bo.brands.show', ['brand' => $credit_accountModel->brand->id]) }}"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.view_model', ['model' => Str::singular(__('models.classes.brands'))]) }}">
<i class="fa-solid fa-eye"></i>
</a>
@endcan
</div>
</div>
</div>
@include('bo.modules.search-bar')
<div class="d-flex flex-row">
<p class="fw-bold m-0">{{ __('Marque :') }}&nbsp;</p>
<p class="m-0">{{ $credit_accountModel->brand->name }}</p>
</div>
<div class="d-flex flex-row">
<p class="fw-bold m-0">{{ __('Compte :') }}&nbsp;</p>
<p class="m-0">{{ $credit_accountModel->label }}</p>
</div>
<table class="table table-hover mt-3">
@if (count($credit_logModels) > 0)
<thead>
@include('bo.modules.table-col-sorter', [
'cols' => [
'amount' => Str::ucfirst(__('validation.attributes.amount.default')),
'type' => Str::ucfirst(__('validation.attributes.operation')),
'created_at' => Str::ucfirst(__('validation.attributes.date')),
],
])
</thead>
<tbody>
@foreach ($credit_logModels as $credit_logModel)
<tr class="list-item border-bottom">
<td class="text-center align-middle">{{ __(':amount jour(s)/homme', ['amount' => number_format($credit_logModel->amount, 1, ',', '')]) }}</td>
<td class="text-center align-middle">
@if ($credit_logModel->type->value === \App\Enums\Credit\BalanceOperationEnum::credit->value)
<span class="badge bg-success">{{ \App\Enums\Credit\BalanceOperationEnum::credit->label() }}</span>
@else
<span class="badge bg-danger">{{ \App\Enums\Credit\BalanceOperationEnum::debit->label() }}</span>
@endif
</td>
<td class="text-center align-middle">
<span class="badge bg-info">{{ $credit_logModel->created_at }}</span>
</td>
<td class="text-center align-middle">
@if($credit_logModel->estimation->first() !== null)
<a href="{{ route('bo.ticket.show', ['ticket' => $credit_logModel->estimation->first()->ticket]) }}">
<button class="btn btn-sm btn-primary"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ __('crud.helpers.view_model', ['model' => Str::singular(__('models.classes.tickets'))]) }}">
{{ __('Ticket n°:id', ['id' => $credit_logModel->estimation->first()->ticket->id]) }}
</button>
</a>
@endif
</td>
</tr>
@endforeach
</tbody>
@else
<tr>
<td class="text-center fw-bold border-0">{{ __('crud.other.no_model_found', ['model' => Str::singular(__('models.classes.creditlogs'))]) }}</td>
</tr>
@endif
</table>
{!! $credit_logModels->links() !!}
@endsection