pipicar/modules/UserProfile/views/profile.blade.php

120 lines
6.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
use \Illuminate\Support\Carbon;
use \A7kz\Platform\Models\UniModel;
use A7kz\Platform\Modules\Platform\Acl\Facades\Acl;
use \App\Modules\applications\Enum\ApplicationStatus;
// Заявки с утвержденным статусом
$approvedApplications = UniModel::model('pipi_applications', Acl::connection())
->where('user_id', auth()->user()->id)
->where('status', ApplicationStatus::approved)
->get();
// Заявки с ожидающим статусом
$pendingApplications = UniModel::model('pipi_applications', Acl::connection())
->where('user_id', auth()->user()->id)
->where('status', ApplicationStatus::reserved)
->get();
?>
<div class="row">
<div class="col-12 col-sm-3">
@include('platform.user_profile::user',['name'=>$user->name, 'about'=>$user->about])
</div>
<div class="card col-12 col-sm-8 ms-sm-5 applications-history">
<div class="card-body">
<ul class="nav nav-tabs" id="applicationsTab" role="tablist">
<li class="nav-item me-4" role="presentation">
<a class="nav-link active" id="applications-tab" data-bs-toggle="tab" href="#applications" role="tab" aria-controls="applications" aria-selected="true">@lang('История заказов')</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="reserves-tab" data-bs-toggle="tab" href="#reserves" role="tab" aria-controls="reserves" aria-selected="false">@lang('Бронирования')</a>
</li>
</ul>
<div class="tab-content" id="applicationsTabContent">
<div class="tab-pane fade show active" id="applications" role="tabpanel" aria-labelledby="applications-tab">
<div class="card-body">
<div class="table-container">
<table class="table">
<thead>
<tr>
<th><b>@lang('Дата начала')</b></th>
<th><b>@lang('Дата окончания')</b></th>
<th><b>@lang('Дней')</b></th>
<th><b>@lang('Машина')</b></th>
</tr>
</thead>
<tbody>
@foreach($approvedApplications as $applications_item)
<tr>
<td>
{{ $applications_item->started_at ? Carbon::parse($applications_item->started_at)->format('d.m.Y') : '' }}
</td>
<td>
{{ $applications_item->ended_at ? Carbon::parse($applications_item->ended_at)->format('d.m.Y') : '' }}
</td>
<td>
{{ $applications_item->rent_day }}
</td>
<td>
@php
$car = \A7kz\Platform\Models\UniModel::model('pipi_auto')->where('id', $applications_item->car_id)->first();
@endphp
{{ $car->name }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<!-- Бронирования -->
<div class="tab-pane fade" id="reserves" role="tabpanel" aria-labelledby="reserves-tab">
<div class="card-body">
<div class="table-container">
<table class="table">
<thead>
<tr>
<th><b>@lang('Дата начала')</b></th>
<th><b>@lang('Дата окончания')</b></th>
<th><b>@lang('Дней')</b></th>
<th><b>@lang('Машина')</b></th>
</tr>
</thead>
<tbody>
@foreach($pendingApplications as $applications_item)
<tr>
<td>
{{ $applications_item->started_at ? Carbon::parse($applications_item->started_at)->format('d.m.Y') : '' }}
</td>
<td>
{{ $applications_item->ended_at ? Carbon::parse($applications_item->ended_at)->format('d.m.Y') : '' }}
</td>
<td>
{{ $applications_item->rent_day }}
</td>
<td>
@php
$car = \A7kz\Platform\Models\UniModel::model('pipi_auto')->where('id', $applications_item->car_id)->first();
@endphp
{{ $car->name }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var myTab = new bootstrap.Tab(document.getElementById('applications-tab'))
myTab.show()
</script>