125 lines
7.7 KiB
PHP
125 lines
7.7 KiB
PHP
<div>
|
||
<button wire:click="back" class="btn border-0 icon-link icon-link-hover fs-5 mb-3 text-decoration-none text-primary"
|
||
style="--bs-icon-link-transform: translate3d(-.125rem, 0, 0);" href="#">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-left"
|
||
viewBox="0 0 16 16">
|
||
<path fill-rule="evenodd"
|
||
d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0" />
|
||
</svg>
|
||
{{ $company->name }}
|
||
</button>
|
||
<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>
|
||
@foreach ($complexes as $complex)
|
||
<th>
|
||
{{ $complex->name }}
|
||
<div>
|
||
@php($compPayment = $company->getPaymentable($complex))
|
||
<span class="badge bg-secondary">
|
||
@if ($compPayment->value === null)
|
||
Не установлено
|
||
@elseif($compPayment->value == -1)
|
||
Наследовать
|
||
@else
|
||
{{ $compPayment->value }} %
|
||
@endif
|
||
</span>
|
||
</div>
|
||
</th>
|
||
@endforeach
|
||
</tr>
|
||
</thead>
|
||
<tbody class=" ">
|
||
@foreach ($agents as $agent)
|
||
<tr scope="row">
|
||
<td class="align-middle">
|
||
{{ $agent->user->name }}
|
||
</td>
|
||
@foreach ($complexes as $complex)
|
||
@php($paymentable = $agent->getPaymentable($complex))
|
||
<td>
|
||
@if ($paymentable->value == null)
|
||
<div class="dropdown">
|
||
<button class="btn btn-light btn-sm" type="button" data-bs-toggle="dropdown"
|
||
aria-expanded="false">
|
||
Не установлено
|
||
</button>
|
||
<ul class="dropdown-menu">
|
||
<li>
|
||
<a class="dropdown-item" href="#">
|
||
<input class="form-control form-control-sm" type="text"
|
||
placeholder="Процент вознаграждения" wire:model = "value"
|
||
wire:keydown.enter="setPaymentValueForAgent({{ $agent->id }}, {{ $complex->id }})">
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<hr class="dropdown-divider">
|
||
</li>
|
||
<li><button class="dropdown-item"
|
||
wire:click="setPaymentAsParentForAgent({{ $agent->id }}, {{ $complex->id }})">Наследовать</button>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
@elseif($paymentable->value == -1)
|
||
<div class="dropdown">
|
||
<button class="btn btn-light btn-sm" type="button" data-bs-toggle="dropdown"
|
||
aria-expanded="false">
|
||
Наследовать
|
||
</button>
|
||
<ul class="dropdown-menu">
|
||
<li>
|
||
<a class="dropdown-item" href="#">
|
||
<input class="form-control form-control-sm" type="text"
|
||
placeholder="Процент вознаграждения" wire:model = "value"
|
||
wire:keydown.enter="setPaymentValueForAgent({{ $agent->id }}, {{ $complex->id }})">
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<hr class="dropdown-divider">
|
||
</li>
|
||
<li><button class="dropdown-item"
|
||
wire:click="unsetPaymentForAgent({{ $agent->id }}, {{ $complex->id }})">Без
|
||
вознаграждения</button></li>
|
||
</ul>
|
||
</div>
|
||
@else
|
||
<div class="dropdown">
|
||
<button class="btn btn-light" type="button" data-bs-toggle="dropdown"
|
||
aria-expanded="false">
|
||
{{ $paymentable->value }} %
|
||
</button>
|
||
<ul class="dropdown-menu">
|
||
<li>
|
||
<a class="dropdown-item" href="#">
|
||
<input class="form-control form-control-sm" type="text"
|
||
placeholder="Процент вознаграждения"
|
||
value="{{ $paymentable->value }}" wire:model = "value"
|
||
wire:keydown.enter="setPaymentValueForAgent({{ $agent->id }}, {{ $complex->id }})">
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<hr class="dropdown-divider">
|
||
</li>
|
||
<li><a class="dropdown-item disabled" href="#">Наследовать</a></li>
|
||
<li><button class="dropdown-item"
|
||
wire:click="unsetPaymentForAgent({{ $agent->id }}, {{ $complex->id }})">Без
|
||
вознаграждения</button>
|
||
</li>
|
||
<li><button class="dropdown-item"
|
||
wire:click="setPaymentAsParentForAgent({{ $agent->id }}, {{ $complex->id }})">Наследовать</button>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
@endif
|
||
</td>
|
||
@endforeach
|
||
</tr>
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|