89 lines
4.0 KiB
PHP
89 lines
4.0 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\LoanOrder\Controllers\Resources;
|
|
|
|
use App\Repos\Order\OrderRepo;
|
|
use App\Repos\System\Settings\Legal\EducationRepo;
|
|
use App\Repos\System\Settings\Legal\MarriageRepo;
|
|
use App\Repos\System\Settings\Location\RegionRepo;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
/**
|
|
* @mixin \App\Models\Order\Loan\LoanOrder
|
|
*/
|
|
class LoanOrderShowResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'unique_id' => $this->unique_id,
|
|
'loan_amount' => $this->loan_amount,
|
|
'loan_type' => $this->loanType?->name,
|
|
'region' => RegionRepo::label($this->region),
|
|
'branch' => $this->branch?->name,
|
|
'customer_name' => $this->customer_name,
|
|
'customer_surname' => $this->customer_surname,
|
|
'customer_patronic_name' => $this->customer_patronic_name,
|
|
'passport_address' => $this->passport_address,
|
|
'real_address' => $this->real_address,
|
|
'passport_serie' => $this->passport_serie,
|
|
'passport_id' => $this->passport_id,
|
|
'passport_given_at' => $this->passport_given_at,
|
|
'passport_given_by' => $this->passport_given_by,
|
|
'born_place' => $this->born_place,
|
|
'born_at' => $this->born_at,
|
|
'email' => $this->email,
|
|
'phone' => $this->phone,
|
|
'phone_additional' => $this->phone_additional,
|
|
'phone_home' => $this->phone_home,
|
|
'work_region' => RegionRepo::label($this->work_region),
|
|
'work_province' => $this->workProvince?->name,
|
|
'work_company' => $this->work_company,
|
|
'work_company_accountant_number' => $this->work_company_accountant_number,
|
|
'work_started_at' => $this->work_started_at,
|
|
'work_salary' => $this->work_salary,
|
|
'work_position' => $this->work_position,
|
|
'education' => EducationRepo::values()[$this->education] ?? '-',
|
|
'marriage_status' => MarriageRepo::values()[$this->marriage_status] ?? '-',
|
|
'passport_one' => url(Storage::url($this->passport_one)),
|
|
'passport_two' => url(Storage::url($this->passport_two)),
|
|
'passport_three' => url(Storage::url($this->passport_three)),
|
|
'passport_four' => url(Storage::url($this->passport_four)),
|
|
'card_number' => $this->card_number,
|
|
'card_name' => $this->card_name,
|
|
'card_month' => $this->card_month,
|
|
'card_year' => $this->card_year,
|
|
'guarantor_name' => $this->guarantor_name,
|
|
'guarantor_surname' => $this->guarantor_surname,
|
|
'guarantor_patronic_name' => $this->guarantor_patronic_name,
|
|
'guarantor_card_number' => $this->guarantor_card_number,
|
|
'guarantor_card_name' => $this->guarantor_card_name,
|
|
'guarantor_card_month' => $this->guarantor_card_month,
|
|
'guarantor_card_year' => $this->guarantor_card_year,
|
|
'guarantor_2_name' => $this->guarantor_2_name,
|
|
'guarantor_2_surname' => $this->guarantor_2_surname,
|
|
'guarantor_2_patronic_name' => $this->guarantor_2_patronic_name,
|
|
'guarantor_2_card_number' => $this->guarantor_2_card_number,
|
|
'guarantor_2_card_name' => $this->guarantor_2_card_name,
|
|
'guarantor_2_card_month' => $this->guarantor_2_card_month,
|
|
'guarantor_2_card_year' => $this->guarantor_2_card_year,
|
|
'guarantor_note' => $this->guarantor_note,
|
|
'guarantor_2_note' => $this->guarantor_2_note,
|
|
'satisfiable' => $this->satisfiable,
|
|
|
|
'status' => OrderRepo::statusFormatted($this->status),
|
|
'notes' => $this->notes,
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
];
|
|
}
|
|
}
|