lk.zachem.info/app/Modules/Contracts/Views/livewire/table/index.blade.php
2025-09-15 23:37:40 +08:00

91 lines
4.7 KiB
PHP

@php($statuses = Modules\Contracts\Models\ContractStatus::class)
<div>
<div class="fs-5 bg-light p-0 m-0 border border-1 rounded-4 py-3">
<table class="table m-0">
<thead>
<tr scope="col">
<th>Клиент
<th>Город
<th>ЖК
<th>Площадь
<th>Сумма
<th>Вознаграждение
<th>Статус
<th>
</tr>
</thead>
<tbody class="">
@foreach ($contracts as $contract)
<tr scope="row">
<td class="align-middle">
{{ $contract->deal->user->name }}
</td>
<td class="align-middle">
{{ $contract->deal->complex->city->name }}
</td>
<td class="align-middle">
{{ $contract->deal->complex->name }}
</td>
<td class="align-middle">
{{ $contract->square }}
</td>
<td class="align-middle">
<?php
$price = Number::forHumans($contract->price, precision: 2);
$price = str_replace('million', 'млн', $price);
$price = str_replace('thousand', 'тыс', $price);
$price = $price . ' &#8381';
$price = str_replace(' ', '&nbsp;', $price);
?>
{!! $price !!}
</td>
<td class="align-middle">
<?php
$contract->reward = GetAgentPaymentForContract($contract);
//$contract->reward = $contract->reward ? $contract->reward : 0;
$reward = Number::forHumans($contract->reward, precision: 2);
$reward = str_replace('million', 'млн', $reward);
$reward = str_replace('thousand', 'тыс', $reward);
$reward = $reward . ' &#8381';
$reward = str_replace(' ', '&nbsp;', $reward);
?>
@if ($contract->status == 'TREATY')
<span class="fw-bold">{!! $reward !!}</span>
@else
<span style="text-decoration:underline;text-decoration-style: dotted;cursor:pointer"
title='Вознаграждение будет зафиксировано при изменении статуса на "Выплачено"'>
{!! $reward !!}
</span>
@endif
</td>
<td class="align-middle">
<div class="py-1 px-3 border rounded rounded-5 text-center"
style="background-color:{{ $statuses::getHtmlColor($contract->status) }}">
{{ $statuses::getName($contract->status) }}
</div>
</td>
<td class="align-middle">
<div class="dropdown" style="">
<button class="btn btn-light" type="button" id="dropdownMenuButton"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="bi bi-three-dots-vertical"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item"
href="{{ route('contract', ['contract' => $contract->id]) }}">Детали</a>
<form method="post"
action="{{ route('contract.delete', ['contract' => $contract]) }}">
@csrf
<button class="dropdown-item disabled" type="submit">Удалить</button>
</form>
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>