233 lines
8.4 KiB
PHP
233 lines
8.4 KiB
PHP
<?php
|
|
|
|
namespace App\Nova\Resources\Order\Loan;
|
|
|
|
use App\Nova\Forms\NovaForm;
|
|
use App\Nova\Resources\Branch\Branch;
|
|
use App\Nova\Resources\System\Location\Province;
|
|
use App\Nova\User;
|
|
use App\Repos\Order\Loan\LoanOrderRepo;
|
|
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 Laravel\Nova\Fields\Badge;
|
|
use Laravel\Nova\Fields\BelongsTo;
|
|
use Laravel\Nova\Fields\Date;
|
|
use Laravel\Nova\Fields\DateTime;
|
|
use Laravel\Nova\Fields\Email;
|
|
use Laravel\Nova\Fields\ID;
|
|
use Laravel\Nova\Fields\Image;
|
|
use Laravel\Nova\Fields\Number;
|
|
use Laravel\Nova\Fields\Select;
|
|
use Laravel\Nova\Fields\Text;
|
|
use Laravel\Nova\Fields\Trix;
|
|
use Laravel\Nova\Panel;
|
|
use Nurmuhammet\NovaCustomHtml\NovaCustomHtml;
|
|
use Nurmuhammet\NovaInputmask\NovaInputmask;
|
|
|
|
class LoanOrderMobileFieldsForDetail
|
|
{
|
|
/**
|
|
* Fields for detail
|
|
*
|
|
* @return array<int, \Laravel\Nova\Fields\Field|\Laravel\Nova\Panel>
|
|
*/
|
|
public static function make(LoanOrderMobile $resource): array
|
|
{
|
|
return [
|
|
ID::make()->hide(),
|
|
Text::make(__('ID'), 'unique_id'),
|
|
|
|
DateTime::make(__('Created at'), 'created_at')
|
|
->turkmenDateTime(),
|
|
|
|
Badge::make(__('Status'), 'status')
|
|
->map(OrderRepo::statusClasses())
|
|
->addTypes([
|
|
'primary' => 'dark:bg-gray-900 bg-gray-600 text-white',
|
|
])
|
|
->labels(OrderRepo::statusValues())
|
|
->withIcons()
|
|
->icons(OrderRepo::statusIcons()),
|
|
|
|
Trix::make(__('Note'), 'notes')
|
|
->fullWidth()
|
|
->alwaysShow(),
|
|
|
|
BelongsTo::make(__('Created by').': ', 'user', User::class),
|
|
|
|
new Panel(__('Loan'), [
|
|
BelongsTo::make(__('Loan type'), 'loanType', LoanType::class),
|
|
Number::make(__('Amount of loan'), 'loan_amount'),
|
|
]),
|
|
|
|
new Panel(__('Location'), [
|
|
Select::make(__('Region'), 'region')
|
|
->displayUsingLabels()
|
|
->options(RegionRepo::values())
|
|
->size('w-1/2'),
|
|
|
|
BelongsTo::make(__('Branch'), 'branch', Branch::class),
|
|
]),
|
|
|
|
new Panel(__('Personal data'), [
|
|
Text::make(
|
|
__('Full Name'),
|
|
fn ($model) => sprintf('%s %s %s', $model->customer_name, $model->customer_surname, $model->customer_patronic_name)
|
|
),
|
|
|
|
Select::make(__('Education'), 'education')
|
|
->displayUsingLabels()
|
|
->options(EducationRepo::values()),
|
|
|
|
Select::make(__('Marriage status'), 'marriage_status')
|
|
->displayUsingLabels()
|
|
->options(MarriageRepo::values()),
|
|
|
|
Date::make(__('Date of birth'), 'born_at')
|
|
->toTurkmenFormat(),
|
|
|
|
Text::make(__('Residence (passport)'), 'passport_address'),
|
|
|
|
Text::make(__('Current Residence'), 'real_address'),
|
|
|
|
Select::make(__('Karz taryhy'), 'satisfiable')
|
|
->displayUsingLabels()
|
|
->options(LoanOrderRepo::satisfiableValues()),
|
|
]),
|
|
|
|
new Panel(__('Card'), [
|
|
NovaCustomHtml::make(__('Data'), 'card_name')
|
|
->canSeeWhen('systemUser', $resource)
|
|
->html(view('orders.loan.mobile.card-history', [
|
|
'resource' => $resource,
|
|
])->render()),
|
|
]),
|
|
|
|
new Panel(__('Karz taryhy'), [
|
|
NovaCustomHtml::make(__('Karz taryhy'), 'loan_history')
|
|
->canSeeWhen('systemUser', $resource)
|
|
->html(view('orders.loan.mobile.loan-history', [
|
|
'resource' => $resource,
|
|
])->render()),
|
|
]),
|
|
|
|
new Panel(__('Contact data'), [
|
|
Email::make(__('Email'), 'email')
|
|
->size('w-1/4'),
|
|
|
|
NovaInputmask::make(__('Phone'), 'phone')
|
|
->mask('+(\\9\\93)-99-99-99-99')
|
|
->storeRawValue()
|
|
->size('w-1/4'),
|
|
|
|
NovaInputmask::make(__('Phone Additional'), 'phone_additional')
|
|
->mask('+(\\9\\93)-99-99-99-99')
|
|
->storeRawValue()
|
|
->size('w-1/4'),
|
|
|
|
Text::make(__('Home phone'), 'phone_home')
|
|
->size('w-1/4'),
|
|
]),
|
|
|
|
new Panel(__('Job'), [
|
|
Text::make(__('Work company name'), 'work_company')
|
|
->size('w-1/2'),
|
|
|
|
NovaInputmask::make(__('HR department work number'), 'work_company_accountant_number')
|
|
->mask('+(\\9\\93)-9{8}')
|
|
->size('w-1/2'),
|
|
|
|
Select::make(__('Work region'), 'work_region')
|
|
->displayUsingLabels()
|
|
->options(RegionRepo::values())
|
|
->size('w-1/2'),
|
|
|
|
BelongsTo::make(__('Work province'), 'workProvince', Province::class),
|
|
|
|
Text::make(__('Position'), 'work_position')
|
|
->size('w-1/2'),
|
|
|
|
Text::make(__('Salary'), 'work_salary')
|
|
->size('w-1/4'),
|
|
|
|
Date::make(__('Work started at'), 'work_started_at')
|
|
->size('w-1/4')
|
|
->toTurkmenFormat(),
|
|
]),
|
|
|
|
new Panel(__('Passport'), [
|
|
Text::make(__('Passport'), fn ($model) => sprintf(
|
|
'<strong>%s %s, %sý<strong>',
|
|
$model->passport_serie,
|
|
$model->passport_id,
|
|
$model->passport_given_at?->format('d.m.Y')
|
|
))->asHtml(),
|
|
|
|
Text::make(__('Passport given by'), 'passport_given_by')
|
|
->size('w-1/2'),
|
|
|
|
Text::make(__('Born place (passport)'), 'born_place')
|
|
->size('w-1/2'),
|
|
|
|
Image::make(__('Passport (page 1)'), 'passport_one')
|
|
->size('w-1/2'),
|
|
|
|
Image::make(__('Passport (page 2-3)'), 'passport_two')
|
|
->size('w-1/2'),
|
|
|
|
Image::make(__('Passport (page 8-9)'), 'passport_three')
|
|
->size('w-1/2'),
|
|
|
|
Image::make(__('Passport (page 32)'), 'passport_four')
|
|
->size('w-1/2'),
|
|
]),
|
|
|
|
new Panel('1. '.__('Guarantor'), [
|
|
Text::make(__('Guarantor name'), 'guarantor_name'),
|
|
|
|
Text::make(__('Guarantor Surname'), 'guarantor_surname'),
|
|
|
|
Text::make(__('Guarantor Patronic name'), 'guarantor_patronic_name'),
|
|
|
|
Text::make(__('Passport'), fn ($model) => sprintf(
|
|
'<strong>%s %s<strong>',
|
|
$model->guarantor_passport_serie,
|
|
$model->guarantor_passport_id,
|
|
))->asHtml(),
|
|
|
|
Text::make(__('Ortaça zähmet haky'), 'guarantor_note')
|
|
->canSeeWhen('systemUser', $resource),
|
|
|
|
NovaCustomHtml::make(__('Data'), 'card_name')
|
|
->html(view('orders.loan.mobile.card-gurantor-history', [
|
|
'resource' => $resource,
|
|
])->render())
|
|
->fillUsing(NovaForm::fillEmpty()),
|
|
]),
|
|
|
|
new Panel('2. '.__('Guarantor'), [
|
|
Text::make(__('Guarantor name'), 'guarantor_2_name'),
|
|
Text::make(__('Guarantor Surname'), 'guarantor_2_surname'),
|
|
Text::make(__('Guarantor Patronic name'), 'guarantor_2_patronic_name'),
|
|
|
|
Text::make(__('Passport'), fn ($model) => sprintf(
|
|
'<strong>%s %s<strong>',
|
|
$model->guarantor_2_passport_serie,
|
|
$model->guarantor_2_passport_id,
|
|
))->asHtml(),
|
|
|
|
Text::make(__('Ortaça zähmet haky'), 'guarantor_2_note')
|
|
->canSeeWhen('systemUser', $resource),
|
|
|
|
NovaCustomHtml::make(__('Data'), 'card_name')
|
|
->html(view('orders.loan.mobile.card-gurantor-2-history', [
|
|
'resource' => $resource,
|
|
])->render())
|
|
->fillUsing(NovaForm::fillEmpty()),
|
|
]),
|
|
];
|
|
}
|
|
}
|