confirmer updated
This commit is contained in:
parent
9fa55fed78
commit
b789a97c47
@ -60,7 +60,7 @@ public function confirm(Deal $deal, Request $request)
|
||||
return $deal->id;
|
||||
}
|
||||
|
||||
public function update_contract(Deal $deal, Request $request)
|
||||
public function updateContract(Deal $deal, Request $request)
|
||||
{
|
||||
$contract = new ContractApiController;
|
||||
$contract($deal, $request);
|
||||
|
||||
@ -30,6 +30,7 @@ public function __invoke(Request $request)
|
||||
'secret' => bin2hex(random_bytes(16)),
|
||||
'status' => 'new'
|
||||
]);
|
||||
|
||||
$data = $request->only('name', 'email', 'inn', 'legal_address', 'secret', 'status', 'type', 'phone');
|
||||
$company = Company::create($data);
|
||||
if (!$company)
|
||||
@ -44,7 +45,7 @@ public function __invoke(Request $request)
|
||||
if (!$sender = $companyConfirmByBitrix->send())
|
||||
{
|
||||
$company->delete();
|
||||
return back()->withErrors(['msg' => 'Company creation error'])->withInput();
|
||||
return back()->withErrors(['msg' => 'Error with bitrix sender'])->withInput();
|
||||
}
|
||||
return view('company.created');
|
||||
}
|
||||
|
||||
78
app/Livewire/ContractsTable.php
Normal file
78
app/Livewire/ContractsTable.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
use Livewire\WithoutUrlPagination;
|
||||
|
||||
use App\Models\Agent\Agent;
|
||||
use App\Models\Company\CompanyAdmin;
|
||||
use App\Models\Deal\Deal;
|
||||
|
||||
use App\Models\Deal\DealStatus;
|
||||
|
||||
class ContractsTable extends Component
|
||||
{
|
||||
use WithPagination, WithoutUrlPagination;
|
||||
|
||||
public $status;
|
||||
public $count;
|
||||
public $mode;//short || full
|
||||
|
||||
public function mount($status = null, $count = 10, $mode = 'full')
|
||||
{
|
||||
$this->status = $status;
|
||||
$this->count = $count;
|
||||
$this->mode = $mode;
|
||||
}
|
||||
|
||||
public function getContracts()
|
||||
{
|
||||
$deals = false;
|
||||
$user = auth()->user();
|
||||
if ($agent = Agent::where('user_id', $user->id)->first())
|
||||
{
|
||||
$deals = Deal::where('agent_id', $agent->id);
|
||||
}
|
||||
elseif ($admin = CompanyAdmin::where('user_id', $user->id)->first())
|
||||
{
|
||||
$deals = Deal::whereIn('agent_id', function ($query) use ($admin)
|
||||
{
|
||||
$query->select('id');
|
||||
$query->from('agents');
|
||||
$query->where('company_id', $admin->company_id);
|
||||
});
|
||||
}
|
||||
return $deals;
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
$deals = $this->getDeals();
|
||||
if ($this->status && $this->status == DealStatus::UNIQUE)
|
||||
{
|
||||
$deals = $deals
|
||||
->whereIn('status', [DealStatus::UNIQUE])
|
||||
->orderBy('id', 'desc')->paginate($this->count, ['*'], 'unique_clients');
|
||||
}
|
||||
elseif ($this->status && $this->status == DealStatus::NOT_UNIQUE)
|
||||
{
|
||||
$deals = $deals
|
||||
->whereIn('status', [DealStatus::MODERATION, DealStatus::NEW , DealStatus::NOT_UNIQUE])
|
||||
->orderBy('id', 'desc')->paginate($this->count, ['*'], 'not_unique_clients');
|
||||
}
|
||||
else
|
||||
{
|
||||
$deals = $deals->orderBy('id', 'desc')->paginate($this->count, ['*'], 'all_clients');
|
||||
}
|
||||
;
|
||||
|
||||
return view(
|
||||
'livewire.clients-table',
|
||||
[
|
||||
'deals' => $deals,
|
||||
'statuses' => DealStatus::class
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,7 @@ class SendCompany
|
||||
|
||||
public function __construct($id, array $data)
|
||||
{
|
||||
$this->ID = $id;
|
||||
$this->ID = env('BITRIX_CODE_PREFIX', '') . $id;
|
||||
$data = array_change_key_case($data, CASE_UPPER);
|
||||
$finalData = $this->castConstants($data);
|
||||
$this->data = $finalData;
|
||||
@ -55,7 +55,7 @@ public function send()
|
||||
$data = [
|
||||
'IBLOCK_TYPE_ID' => $this->IBLOCK_TYPE_ID,
|
||||
'IBLOCK_ID' => $this->IBLOCK_ID,
|
||||
'ELEMENT_CODE' => 'local' . $this->ID,
|
||||
'ELEMENT_CODE' => $this->ID,
|
||||
'FIELDS' => $this->data
|
||||
];
|
||||
$sender = new BitrixSender($this->URL, $data);
|
||||
|
||||
@ -51,7 +51,6 @@
|
||||
/*
|
||||
* Header
|
||||
*/
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
@ -59,21 +58,23 @@
|
||||
<body class="d-flex align-items-center py-4 bg-body-tertiary h-100">
|
||||
<div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column">
|
||||
<header class="mb-auto">
|
||||
<h3 class="float-md-start mb-0">
|
||||
<img class=""
|
||||
data-original="{{ url('/images/logo.svg') }}" alt=""
|
||||
imgfield="tn_img_1702578351550" src="{{ url('/images/logo.svg') }}" width="100">
|
||||
</h3>
|
||||
<div class="justify-content-center float-md-end">
|
||||
<div>
|
||||
<span class="fw-bold py-1 px-0 fs-3 text-secondary" aria-current="page" href="#">8-800-222-06-10</span>
|
||||
<h3 class="float-md-start mb-0">
|
||||
<img class="" data-original="{{ url('/images/logo.svg') }}" alt=""
|
||||
imgfield="tn_img_1702578351550" src="{{ url('/images/logo.svg') }}" width="100">
|
||||
</h3>
|
||||
<div class="justify-content-center float-md-end">
|
||||
<div>
|
||||
<span class="fw-bold py-1 px-0 fs-3 text-secondary" aria-current="page"
|
||||
href="#">8-800-222-06-10</span>
|
||||
<div>Звонок по РФ бесплатный</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<main class="px-3">
|
||||
|
||||
@yield('content')
|
||||
@foreach ($errors->all() as $error)
|
||||
{{ $error }}
|
||||
@endforeach
|
||||
@yield('content')
|
||||
</main>
|
||||
<footer class="mt-auto">
|
||||
<div class="container">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user