loan orders
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace App\Nova\Resources\Order\Loan\Concerns;
|
||||
|
||||
use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||
use App\Nova\Resources\Branch\Branch;
|
||||
use App\Nova\Resources\Order\Loan\LoanType;
|
||||
use App\Nova\Resources\System\Location\Province;
|
||||
use App\Nova\User;
|
||||
use App\Repos\Order\Loan\LoanTypeRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Legal\EducationRepo;
|
||||
use App\Repos\System\Settings\Legal\MarriageRepo;
|
||||
@@ -17,6 +19,7 @@ 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\Panel;
|
||||
@@ -51,6 +54,7 @@ class LoanOrderFieldsForDetail
|
||||
|
||||
new Panel(__('Loan'), [
|
||||
BelongsTo::make(__('Loan type'), 'loanType', LoanType::class),
|
||||
Number::make(__('Amount of loan'), 'loan_amount'),
|
||||
]),
|
||||
|
||||
new Panel(__('Location'), [
|
||||
@@ -89,6 +93,22 @@ class LoanOrderFieldsForDetail
|
||||
->size('w-1/2'),
|
||||
]),
|
||||
|
||||
new Panel(__('Card'), [
|
||||
Number::make(__('Card number'), 'card_number'),
|
||||
|
||||
Text::make(__('Name on card'), 'card_name'),
|
||||
|
||||
Select::make(__('Expiration month'), 'card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::monthsAsNumber()),
|
||||
|
||||
Select::make(__('Expiration year'), 'card_year')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil()),
|
||||
]),
|
||||
|
||||
new Panel(__('Contact data'), [
|
||||
Email::make(__('Email'), 'email')
|
||||
->size('w-1/4'),
|
||||
@@ -161,6 +181,47 @@ class LoanOrderFieldsForDetail
|
||||
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'),
|
||||
|
||||
Number::make(__('Card number'), 'guarantor_card_number'),
|
||||
|
||||
Text::make(__('Name on card'), 'guarantor_card_name'),
|
||||
|
||||
Select::make(__('Expiration month'), 'guarantor_card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::monthsAsNumber()),
|
||||
|
||||
Select::make(__('Expiration year'), 'guarantor_card_year')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil()),
|
||||
]),
|
||||
|
||||
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'),
|
||||
|
||||
Number::make(__('Card number'), 'guarantor_2_card_number'),
|
||||
Text::make(__('Name on card'), 'guarantor_2_card_name'),
|
||||
|
||||
Select::make(__('Expiration month'), 'guarantor_2_card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::monthsAsNumber()),
|
||||
|
||||
Select::make(__('Expiration year'), 'guarantor_2_card_year')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil()),
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Nova\Resources\Order\Loan;
|
||||
use App\Models\Branch\Branch;
|
||||
use App\Models\Order\Loan\LoanOrder as LoanOrderModel;
|
||||
use App\Models\System\Location\Province;
|
||||
use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||
use App\Nova\Filters\RegionFilter;
|
||||
use App\Nova\Filters\StatusFilter;
|
||||
use App\Nova\Resource;
|
||||
@@ -176,6 +177,15 @@ class LoanOrder extends Resource
|
||||
->options(LoanTypeRepo::values())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
Number::make(__('Amount of loan'), 'loan_amount')
|
||||
->hide()
|
||||
->fullWidth()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type === LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required', 'integer', 'max:40000');
|
||||
}
|
||||
}),
|
||||
]),
|
||||
|
||||
new Panel(__('Location'), [
|
||||
@@ -241,6 +251,50 @@ class LoanOrder extends Resource
|
||||
->rules('required', 'string', new DowranAgaAllowed, 'max:255'),
|
||||
]),
|
||||
|
||||
new Panel(__('Card'), [
|
||||
Number::make(__('Card number'), 'card_number')
|
||||
->size('w-1/4')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required');
|
||||
}
|
||||
}),
|
||||
|
||||
Text::make(__('Name on card'), 'card_name')
|
||||
->size('w-1/4')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required');
|
||||
}
|
||||
}),
|
||||
|
||||
Select::make(__('Expiration month'), 'card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::monthsAsNumber())
|
||||
->size('w-1/4')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required');
|
||||
}
|
||||
}),
|
||||
|
||||
Select::make(__('Expiration year'), 'card_year')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil())
|
||||
->size('w-1/4')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required');
|
||||
}
|
||||
}),
|
||||
]),
|
||||
|
||||
new Panel(__('Passport'), [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
@@ -359,6 +413,157 @@ class LoanOrder extends Resource
|
||||
->creationRules('required')
|
||||
->updateRules('nullable'),
|
||||
]),
|
||||
|
||||
new Panel(__('1. Guarantor'), [
|
||||
Text::make(__('Guarantor name'), 'guarantor_name')
|
||||
->fullWidth()
|
||||
->size('w-1/3')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required', 'string', 'max:255');
|
||||
}
|
||||
}),
|
||||
|
||||
Text::make(__('Guarantor Surname'), 'guarantor_surname')
|
||||
->fullWidth()
|
||||
->size('w-1/3')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required', 'string', 'max:255');
|
||||
}
|
||||
}),
|
||||
|
||||
Text::make(__('Guarantor Patronic name'), 'guarantor_patronic_name')
|
||||
->fullWidth()
|
||||
->size('w-1/3')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('nullable', 'string', 'max:255');
|
||||
}
|
||||
}),
|
||||
|
||||
Number::make(__('Card number'), 'guarantor_card_number')
|
||||
->size('w-1/2')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required', 'integer', 'digits:16');
|
||||
}
|
||||
}),
|
||||
|
||||
Text::make(__('Name on card'), 'guarantor_card_name')
|
||||
->size('w-1/2')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required', 'string', 'max:255');
|
||||
}
|
||||
}),
|
||||
|
||||
Select::make(__('Expiration month'), 'guarantor_card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::monthsAsNumber())
|
||||
->size('w-1/2')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required');
|
||||
}
|
||||
}),
|
||||
|
||||
Select::make(__('Expiration year'), 'guarantor_card_year')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil())
|
||||
->size('w-1/2')
|
||||
->hide()
|
||||
->dependsOn('loan_type', function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId()) {
|
||||
$field->show()->rules('required');
|
||||
}
|
||||
}),
|
||||
]),
|
||||
|
||||
new Panel(__('2. Guarantor'), [
|
||||
Text::make(__('Guarantor name'), 'guarantor_2_name')
|
||||
->fullWidth()
|
||||
->size('w-1/3')
|
||||
->hide()
|
||||
->dependsOn(['loan_type', 'loan_amount'], function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId() && $formData->loan_amount && floatval($formData->loan_amount) > 20000) {
|
||||
$field->show()->rules('required', 'string', 'max:255');
|
||||
}
|
||||
}),
|
||||
|
||||
Text::make(__('Guarantor Surname'), 'guarantor_2_surname')
|
||||
->fullWidth()
|
||||
->size('w-1/3')
|
||||
->hide()
|
||||
->dependsOn(['loan_type', 'loan_amount'], function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId() && $formData->loan_amount && floatval($formData->loan_amount) > 20000) {
|
||||
$field->show()->rules('required', 'string', 'max:255');
|
||||
}
|
||||
}),
|
||||
|
||||
Text::make(__('Guarantor Patronic name'), 'guarantor_2_patronic_name')
|
||||
->fullWidth()
|
||||
->size('w-1/3')
|
||||
->hide()
|
||||
->dependsOn(['loan_type', 'loan_amount'], function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId() && $formData->loan_amount && floatval($formData->loan_amount) > 20000) {
|
||||
$field->show()->rules('nullable', 'string', 'max:255');
|
||||
}
|
||||
}),
|
||||
|
||||
Number::make(__('Card number'), 'guarantor_2_card_number')
|
||||
->size('w-1/2')
|
||||
->hide()
|
||||
->dependsOn(['loan_type', 'loan_amount'], function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId() && $formData->loan_amount && floatval($formData->loan_amount) > 20000) {
|
||||
$field->show()->rules('nullable', 'string', 'max:255');
|
||||
}
|
||||
}),
|
||||
|
||||
Text::make(__('Name on card'), 'guarantor_2_card_name')
|
||||
->size('w-1/2')
|
||||
->hide()
|
||||
->dependsOn(['loan_type', 'loan_amount'], function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId() && $formData->loan_amount && floatval($formData->loan_amount) > 20000) {
|
||||
$field->show()->rules('required', 'string', 'max:255');
|
||||
}
|
||||
}),
|
||||
|
||||
Select::make(__('Expiration month'), 'guarantor_2_card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::monthsAsNumber())
|
||||
->size('w-1/2')
|
||||
->sortable()
|
||||
->hide()
|
||||
->dependsOn(['loan_type', 'loan_amount'], function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId() && $formData->loan_amount && floatval($formData->loan_amount) > 20000) {
|
||||
$field->show()->rules('required');
|
||||
}
|
||||
}),
|
||||
|
||||
Select::make(__('Expiration year'), 'guarantor_2_card_year')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil())
|
||||
->size('w-1/2')
|
||||
->sortable()
|
||||
->hide()
|
||||
->dependsOn(['loan_type', 'loan_amount'], function ($field, $request, $formData) {
|
||||
if ($formData->loan_type == LoanTypeRepo::loanTypeGuarantorId() && $formData->loan_amount && floatval($formData->loan_amount) > 20000) {
|
||||
$field->show()->rules('required');
|
||||
}
|
||||
}),
|
||||
]),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user