обновлена таблица вознаграждений в админке

This commit is contained in:
Thekindbull 2025-04-25 10:26:13 +08:00
parent d2ceee50f5
commit 7fddfd54c7
9 changed files with 476 additions and 319 deletions

View File

@ -37,7 +37,8 @@ protected function rules()
'agent' => ['required', 'integer'], 'agent' => ['required', 'integer'],
'client.firstName' => ['required', 'string', 'max:255'], 'client.firstName' => ['required', 'string', 'max:255'],
'client.secondName' => ['required', 'string', 'max:255'], 'client.secondName' => ['required', 'string', 'max:255'],
'client.phone' => ['required', 'string', 'regex:/\(?([0-9]{3})\)([-]{1})([0-9]{3})([-]{1})([0-9]{4})/i'] //'client.phone' => ['required', 'string', 'regex:/^(\+7)([0-9]{3})([-]{1})([0-9]{3})([-]{1})([0-9]{4})/i']
'client.phone' => ['required', 'string', 'regex:/^\+7 \d{3} \d{3}-\d{2}-\d{2}$/']
]; ];
} }
public function mount() public function mount()
@ -71,26 +72,22 @@ public function updated($propertyName)
{ {
//$this->dispatch('phone-updated', ['newPhone' => 111]); //$this->dispatch('phone-updated', ['newPhone' => 111]);
//$this->js("checkPhoneFormat('123')"); //$this->js("checkPhoneFormat('123')");
$phone = preg_replace('/[^0-9]/', "", $this->client['phone']); $phone = preg_replace('/[^0-9\+]+/', "", $this->client['phone']);
if (strlen($phone) == 10) if (strlen($this->client['phone']) <= 2)
{ {
$sArea = substr($phone, 0, 3); $this->client['phone'] = "+7";
$sPrefix = substr($phone, 3, 3); }
$sNumber = substr($phone, 6, 4); elseif (strlen($phone) <= 12)
$phone = "(" . $sArea . ")-" . $sPrefix . "-" . $sNumber; {
$code = substr($phone, 0, 2);
$sArea = substr($phone, 2, 3);
$sPrefix = substr($phone, 5, 3);
$sNumber1 = substr($phone, 8, 2);
$sNumber2 = substr($phone, 10, 2);
$phone = $code . " " . $sArea . " " . $sPrefix . "-" . $sNumber1 . "-" . $sNumber2;
$this->client['phone'] = $phone; $this->client['phone'] = $phone;
} }
elseif (strlen($this->client['phone']) == 1)
{
if ($this->client['phone'] == "8" || $this->client['phone'] == "7" || $this->client['phone'] == "+")
{
$this->client['phone'] = null;
}
else
{
$this->client['phone'] = $phone;
}
}
else else
{ {
$this->client['phone'] = $phone; $this->client['phone'] = $phone;

View File

@ -31,17 +31,11 @@ public function index(Request $request)
'filter' => $request->filter 'filter' => $request->filter
]); ]);
} }
public function edit(City $city)
{
return view('admin::companies.edit', [
'city' => $city,
]);
}
public function update(Request $request, City $city) public function update(Request $request, City $city)
{ {
$city->update($request->only('name')); $city->update($request->only('name'));
return to_route('admin.companies'); return back();
} }
public function create(Request $request) public function create(Request $request)

View File

@ -8,7 +8,7 @@
use App\Models\Agent\Agent; use App\Models\Agent\Agent;
class Payments extends Component class Payments extends Component
{ {
public $value; public $newValue;
public $companyId; public $companyId;
public function mount() public function mount()
{ {
@ -27,8 +27,8 @@ public function back()
public function setPaymentValueForCompany(Company $company, Complex $complex) public function setPaymentValueForCompany(Company $company, Complex $complex)
{ {
$company->setPayment($complex, $this->value); $company->setPayment($complex, $this->newValue);
$this->value = null; $this->newValue = null;
} }
public function unsetPaymentForCompany(Company $company, Complex $complex) public function unsetPaymentForCompany(Company $company, Complex $complex)
@ -38,14 +38,14 @@ public function unsetPaymentForCompany(Company $company, Complex $complex)
public function setPaymentValueForAgent(Agent $agent, Complex $complex) public function setPaymentValueForAgent(Agent $agent, Complex $complex)
{ {
$agent->setPayment($complex, $this->value); $agent->setPayment($complex, $this->newValue);
$this->value = null; $this->newValue = null;
} }
public function setPaymentAsParentForAgent(Agent $agent, Complex $complex) public function setPaymentAsParentForAgent(Agent $agent, Complex $complex)
{ {
$agent->setAsParentPayment($complex); $agent->setAsParentPayment($complex);
$this->value = null; $this->newValue = null;
} }
public function unsetPaymentForAgent(Agent $agent, Complex $complex) public function unsetPaymentForAgent(Agent $agent, Complex $complex)
@ -53,6 +53,21 @@ public function unsetPaymentForAgent(Agent $agent, Complex $complex)
$agent->unsetPayment($complex); $agent->unsetPayment($complex);
} }
public function setPaymentForAllAgentOfCompany(Company $company, Complex $complex)
{
$compPayment = $company->getPaymentable($complex);
$compPayment = $compPayment->value;
if ($compPayment == null || $compPayment == -1)
{
return false;
}
$agents = Agent::where('company_id', $company->id)->get();
foreach ($agents as $agent)
{
$agent->setPayment($complex, $compPayment);
}
}
public function render() public function render()
{ {
if ($this->companyId) if ($this->companyId)

View File

@ -28,7 +28,7 @@
Route::post('/admin/companies/{company}/delete', [Modules\Admin\Http\Controllers\AdminUsersController::class, 'update'])->name('admin.companies.delete'); Route::post('/admin/companies/{company}/delete', [Modules\Admin\Http\Controllers\AdminUsersController::class, 'update'])->name('admin.companies.delete');
Route::get('/admin/cities', [Modules\Admin\Http\Controllers\AdminCitiesController::class, 'index'])->name('admin.cities'); Route::get('/admin/cities', [Modules\Admin\Http\Controllers\AdminCitiesController::class, 'index'])->name('admin.cities');
Route::get('/admin/cities/{city}/edit', [Modules\Admin\Http\Controllers\AdminCitiesController::class, 'edit'])->name('admin.cities.edit'); Route::post('/admin/cities/{city}/update', [Modules\Admin\Http\Controllers\AdminCitiesController::class, 'update'])->name('admin.cities.update');
Route::post('/admin/cities/create', [Modules\Admin\Http\Controllers\AdminCitiesController::class, 'create'])->name('admin.cities.create'); Route::post('/admin/cities/create', [Modules\Admin\Http\Controllers\AdminCitiesController::class, 'create'])->name('admin.cities.create');
Route::post('/admin/cities/{city}/delete', [Modules\Admin\Http\Controllers\AdminCitiesController::class, 'delete'])->name('admin.cities.delete'); Route::post('/admin/cities/{city}/delete', [Modules\Admin\Http\Controllers\AdminCitiesController::class, 'delete'])->name('admin.cities.delete');
Route::post('/admin/cities/{city}/restore', [Modules\Admin\Http\Controllers\AdminCitiesController::class, 'restore'])->withTrashed()->name('admin.cities.restore'); Route::post('/admin/cities/{city}/restore', [Modules\Admin\Http\Controllers\AdminCitiesController::class, 'restore'])->withTrashed()->name('admin.cities.restore');

View File

@ -1,6 +1,11 @@
@php($title = 'Города') @php($title = 'Города')
@extends('layouts.admin') @extends('layouts.admin')
@section('content') @section('content')
<style>
.collapsing {
transition: none !important;
}
</style>
<div class="d-flex mb-3"> <div class="d-flex mb-3">
<form class="p-2 border rounded-3 border-1 bg-white" method="GET" action="{{ route('admin.cities') }}"> <form class="p-2 border rounded-3 border-1 bg-white" method="GET" action="{{ route('admin.cities') }}">
<input type="radio" class="btn-check" name="filter" value="all" id="option_all" autocomplete="off" <input type="radio" class="btn-check" name="filter" value="all" id="option_all" autocomplete="off"
@ -36,7 +41,19 @@
@foreach ($cities as $city) @foreach ($cities as $city)
<tr scope="row" class="@if ($city->trashed()) bg-secondary @endif"> <tr scope="row" class="@if ($city->trashed()) bg-secondary @endif">
<td class="align-middle"> <td class="align-middle">
<div class="collapse show" data-bs-toggle="collapse"
data-bs-target="#collapseName{{ $city->id }}" id="collapseName{{ $city->id }}">
{{ $city->name }} {{ $city->name }}
</div>
<div class="collapse" id="collapseName{{ $city->id }}">
<form action="{{ route('admin.cities.update', ['city' => $city]) }}" method="post">
@csrf
<input class="form-control form-control-lg w-100" name="name" type="text"
value="{{ $city->name }}" placeholder="Название города"
aria-label="default input example">
<input type="submit" hidden />
</form>
</div>
</td> </td>
<td> <td>
{{ $city->created_at ? $city->created_at->diffForHumans() : '' }} {{ $city->created_at ? $city->created_at->diffForHumans() : '' }}
@ -59,9 +76,12 @@
<button class="dropdown-item" type="submit">Восстановить</button> <button class="dropdown-item" type="submit">Восстановить</button>
</form> </form>
@else @else
<a class="dropdown-item" <button class="dropdown-item" type="button" data-bs-toggle="collapse"
href="{{ route('admin.cities.edit', ['city' => $city]) }}">Редактировать</a> data-bs-target="#collapseName{{ $city->id }}">
<form method="post" action="{{ route('admin.cities.delete', ['city' => $city]) }}"> Редактировать
</button>
<form method="post"
action="{{ route('admin.cities.delete', ['city' => $city]) }}">
@csrf @csrf
<button class="dropdown-item" type="submit">Удалить</button> <button class="dropdown-item" type="submit">Удалить</button>
</form> </form>

View File

@ -1,24 +1,31 @@
<div> <div>
<button wire:click="back" class="btn border-0 icon-link icon-link-hover fs-5 mb-3 text-decoration-none text-primary" <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="#"> 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" <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
viewBox="0 0 16 16"> class="bi bi-chevron-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" <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" /> 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> </svg>
{{ $company->name }} {{ $company->name }}
</button> </button>
<div class="fs-5 bg-light p-0 m-0 border border-1 rounded-4 py-3"> <div class="fs-5 bg-light p-0 m-0 border border-1 rounded-4 py-3">
<table class="table m-0"> <table class="table m-0 table-striped-columns">
<thead> <thead>
<tr scope="col"> <tr scope="col">
<th>Агент</th> <th>Агент</th>
@foreach ($complexes as $complex) @foreach ($complexes as $complex)
<th> <th>
{{ $complex->name }} {{ $complex->name }}
<div>
{{ $complex->city->name }}
</div>
<div> <div>
@php($compPayment = $company->getPaymentable($complex)) @php($compPayment = $company->getPaymentable($complex))
<span class="badge bg-secondary"> <div class="dropdown">
<a class="btn bg-secondary-subtle btn-sm text-truncate" href="#"
role="button" data-bs-toggle="dropdown" aria-expanded="false">
@if ($compPayment->value === null) @if ($compPayment->value === null)
Не установлено Не установлено
@elseif($compPayment->value == -1) @elseif($compPayment->value == -1)
@ -26,7 +33,44 @@
@else @else
{{ $compPayment->value }} % {{ $compPayment->value }} %
@endif @endif
<i class="bi bi-three-dots-vertical"></i>
</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item " href="#">
<span class="badge text-dark">Введите размер вознаграждения:
</span> </span>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">
<svg xmlns="http://www.w3.org/2000/svg" width="20"
height="20" fill="currentColor" class="bi bi-percent"
viewBox="0 0 16 16">
<path
d="M13.442 2.558a.625.625 0 0 1 0 .884l-10 10a.625.625 0 1 1-.884-.884l10-10a.625.625 0 0 1 .884 0M4.5 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5m7 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5" />
</svg>
</span>
<input class="form-control" type="text"
placeholder="Вознаграждение"
value="{{ $compPayment->value }}"
wire:model.lazy = "newValue"
wire:keydown.enter="setPaymentValueForCompany({{ $company->id }}, {{ $complex->id }})">
</div>
</a>
</li>
@if ($compPayment->value)
<li>
<hr class="dropdown-divider">
</li>
<li>
<button class="dropdown-item"
wire:click="setPaymentForAllAgentOfCompany({{ $company->id }}, {{ $complex->id }})">Установить
{{ $compPayment->value }}
% для всех агентов</button>
</li>
@endif
</ul>
</div>
</div> </div>
</th> </th>
@endforeach @endforeach
@ -43,16 +87,30 @@
<td> <td>
@if ($paymentable->value == null) @if ($paymentable->value == null)
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-light btn-sm" type="button" data-bs-toggle="dropdown" <button class="btn btn-light" type="button" data-bs-toggle="dropdown"
aria-expanded="false"> aria-expanded="false">
Не установлено Не установлено
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a class="dropdown-item " href="#"> <a class="dropdown-item " href="#">
<input class="form-control form-control-sm" type="text" <span class="badge text-dark">Введите размер вознаграждения:
placeholder="Процент вознаграждения" wire:model = "value" </span>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">
<svg xmlns="http://www.w3.org/2000/svg" width="20"
height="20" fill="currentColor"
class="bi bi-percent" viewBox="0 0 16 16">
<path
d="M13.442 2.558a.625.625 0 0 1 0 .884l-10 10a.625.625 0 1 1-.884-.884l10-10a.625.625 0 0 1 .884 0M4.5 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5m7 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5" />
</svg>
</span>
<input class="form-control" type="text"
placeholder="Вознаграждение"
value="{{ $paymentable->value }}"
wire:model = "newValue"
wire:keydown.enter="setPaymentValueForAgent({{ $agent->id }}, {{ $complex->id }})"> wire:keydown.enter="setPaymentValueForAgent({{ $agent->id }}, {{ $complex->id }})">
</div>
</a> </a>
</li> </li>
<li> <li>
@ -65,16 +123,30 @@
</div> </div>
@elseif($paymentable->value == -1) @elseif($paymentable->value == -1)
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-light btn-sm" type="button" data-bs-toggle="dropdown" <button class="btn btn-light" type="button" data-bs-toggle="dropdown"
aria-expanded="false"> aria-expanded="false">
Наследовать Наследовать
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a class="dropdown-item " href="#"> <a class="dropdown-item " href="#">
<input class="form-control form-control-sm" type="text" <span class="badge text-dark">Введите размер вознаграждения:
placeholder="Процент вознаграждения" wire:model = "value" </span>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">
<svg xmlns="http://www.w3.org/2000/svg" width="20"
height="20" fill="currentColor"
class="bi bi-percent" viewBox="0 0 16 16">
<path
d="M13.442 2.558a.625.625 0 0 1 0 .884l-10 10a.625.625 0 1 1-.884-.884l10-10a.625.625 0 0 1 .884 0M4.5 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5m7 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5" />
</svg>
</span>
<input class="form-control" type="text"
placeholder="Вознаграждение"
value="{{ $paymentable->value }}"
wire:model = "newValue"
wire:keydown.enter="setPaymentValueForAgent({{ $agent->id }}, {{ $complex->id }})"> wire:keydown.enter="setPaymentValueForAgent({{ $agent->id }}, {{ $complex->id }})">
</div>
</a> </a>
</li> </li>
<li> <li>
@ -94,16 +166,28 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a class="dropdown-item " href="#"> <a class="dropdown-item " href="#">
<input class="form-control form-control-sm" type="text" <span class="badge text-dark">Введите размер вознаграждения:
placeholder="Процент вознаграждения" </span>
value="{{ $paymentable->value }}" wire:model = "value" <div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">
<svg xmlns="http://www.w3.org/2000/svg" width="20"
height="20" fill="currentColor"
class="bi bi-percent" viewBox="0 0 16 16">
<path
d="M13.442 2.558a.625.625 0 0 1 0 .884l-10 10a.625.625 0 1 1-.884-.884l10-10a.625.625 0 0 1 .884 0M4.5 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5m7 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5" />
</svg>
</span>
<input class="form-control" type="text"
placeholder="Вознаграждение"
value="{{ $paymentable->value }}"
wire:model = "newValue"
wire:keydown.enter="setPaymentValueForAgent({{ $agent->id }}, {{ $complex->id }})"> wire:keydown.enter="setPaymentValueForAgent({{ $agent->id }}, {{ $complex->id }})">
</div>
</a> </a>
</li> </li>
<li> <li>
<hr class="dropdown-divider"> <hr class="dropdown-divider">
</li> </li>
<li><a class="dropdown-item disabled" href="#">Наследовать</a></li>
<li><button class="dropdown-item" <li><button class="dropdown-item"
wire:click="unsetPaymentForAgent({{ $agent->id }}, {{ $complex->id }})">Без wire:click="unsetPaymentForAgent({{ $agent->id }}, {{ $complex->id }})">Без
вознаграждения</button> вознаграждения</button>
@ -122,3 +206,4 @@
</table> </table>
</div> </div>
</div> </div>
</div>

View File

@ -1,52 +1,89 @@
<div class="fs-5 bg-light p-0 m-0 border border-1 rounded-4 py-3"> <div class="fs-5 bg-light p-0 m-0 border border-1 rounded-4 py-3">
<table class="table m-0"> <div>
<table class="table m-0 table-striped-columns ">
<thead> <thead>
<tr scope="col"> <tr scope="col">
<th>Компания</th> <th>Компания</th>
@foreach ($complexes as $complex) @foreach ($complexes as $complex)
<th>{{ $complex->name }} <th>{{ $complex->name }}
<div>
{{ $complex->city->name }}
</div>
</th> </th>
@endforeach @endforeach
<th></th>
</tr> </tr>
</thead> </thead>
<tbody class=" "> <tbody class=" ">
@foreach ($companies as $company) @foreach ($companies as $company)
<tr scope="row"> <tr scope="row">
<td class="align-middle"> <td class="">
<a class="text-dark icon-link icon-link-hover text-decoration-none" href="#"
wire:click="setCompany({{ $company->id }})">
{{ $company->name }} {{ $company->name }}
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-chevron-right" viewBox="0 0 16 16">
<path fill-rule="evenodd"
d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708" />
</svg>
</a>
</td> </td>
@foreach ($complexes as $complex) @foreach ($complexes as $complex)
@php($paymentable = $company->getPaymentable($complex)) @php($paymentable = $company->getPaymentable($complex))
<td> <td class="align-middle">
@if ($paymentable->value == null) @if ($paymentable->value == null)
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-light btn-sm" type="button" data-bs-toggle="dropdown" <button class="btn btn-light" type="button" data-bs-toggle="dropdown"
aria-expanded="false"> aria-expanded="false">
Не установлено Не установлено
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a class="dropdown-item " href="#"> <a class="dropdown-item " href="#">
<input class="form-control form-control-sm" type="text" <span class="badge text-dark">Введите размер вознаграждения:
placeholder="Процент вознаграждения" wire:model = "value" </span>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">
<svg xmlns="http://www.w3.org/2000/svg" width="20"
height="20" fill="currentColor" class="bi bi-percent"
viewBox="0 0 16 16">
<path
d="M13.442 2.558a.625.625 0 0 1 0 .884l-10 10a.625.625 0 1 1-.884-.884l10-10a.625.625 0 0 1 .884 0M4.5 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5m7 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5" />
</svg>
</span>
<input class="form-control" type="text"
placeholder="Вознаграждение"
value="{{ $paymentable->value }}" wire:model = "newValue"
wire:keydown.enter="setPaymentValueForCompany({{ $company->id }}, {{ $complex->id }})"> wire:keydown.enter="setPaymentValueForCompany({{ $company->id }}, {{ $complex->id }})">
</div>
</a> </a>
</li> </li>
</ul> </ul>
</div> </div>
@elseif($paymentable->value == -1) @elseif($paymentable->value == -1)
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-light btn-sm" type="button" data-bs-toggle="dropdown" <button class="btn btn-light" type="button" data-bs-toggle="dropdown"
aria-expanded="false"> aria-expanded="false">
Наследовать Наследовать
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a class="dropdown-item " href="#"> <a class="dropdown-item " href="#">
<input class="form-control form-control-sm" type="text" <span class="badge text-dark">Введите размер вознаграждения:
placeholder="Процент вознаграждения" wire:model = "value" </span>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">
<svg xmlns="http://www.w3.org/2000/svg" width="20"
height="20" fill="currentColor" class="bi bi-percent"
viewBox="0 0 16 16">
<path
d="M13.442 2.558a.625.625 0 0 1 0 .884l-10 10a.625.625 0 1 1-.884-.884l10-10a.625.625 0 0 1 .884 0M4.5 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5m7 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5" />
</svg>
</span>
<input class="form-control" type="text"
placeholder="Вознаграждение"
value="{{ $paymentable->value }}" wire:model = "newValue"
wire:keydown.enter="setPaymentValueForCompany({{ $company->id }}, {{ $complex->id }})"> wire:keydown.enter="setPaymentValueForCompany({{ $company->id }}, {{ $complex->id }})">
</div>
</a> </a>
</li> </li>
<li> <li>
@ -66,10 +103,23 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a class="dropdown-item " href="#"> <a class="dropdown-item " href="#">
<input class="form-control form-control-sm" type="text" <span class="badge text-dark">Введите размер вознаграждения:
placeholder="Процент вознаграждения" </span>
value="{{ $paymentable->value }}" wire:model = "value" <div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">
<svg xmlns="http://www.w3.org/2000/svg" width="20"
height="20" fill="currentColor" class="bi bi-percent"
viewBox="0 0 16 16">
<path
d="M13.442 2.558a.625.625 0 0 1 0 .884l-10 10a.625.625 0 1 1-.884-.884l10-10a.625.625 0 0 1 .884 0M4.5 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5m7 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5" />
</svg>
</span>
<input class="form-control" type="text"
placeholder="Вознаграждение"
value="{{ $paymentable->value }}"
wire:model.lazy = "newValue"
wire:keydown.enter="setPaymentValueForCompany({{ $company->id }}, {{ $complex->id }})"> wire:keydown.enter="setPaymentValueForCompany({{ $company->id }}, {{ $complex->id }})">
</div>
</a> </a>
</li> </li>
<li> <li>
@ -85,13 +135,10 @@
@endif @endif
</td> </td>
@endforeach @endforeach
<td>
<button class="btn btn-light" wire:click="setCompany({{ $company->id }})">
<i class="bi bi-chevron-right"></i>
</button>
</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div> </div>
</div>

View File

@ -6,7 +6,7 @@
use App\Models\Complex; use App\Models\Complex;
trait Paymentable trait Paymentable
{ {
private $defaultValue = null; // -1 || null private $defaultValue = -1; // -1 || null
protected static function boot() protected static function boot()
{ {
parent::boot(); parent::boot();
@ -15,11 +15,6 @@ protected static function boot()
{ {
}); });
static::deleted(function ($item)
{
});
} }
private function getClassName() private function getClassName()

View File

@ -5,6 +5,10 @@ .bg-primary {
border-color: #ce4711 !important; border-color: #ce4711 !important;
} }
label {
color: rgba(var(--bs-body-color-rgb), .65);
}
.btn-secondary, .btn-secondary,
.btn-secondary:disabled { .btn-secondary:disabled {
color: white; color: white;