wip
This commit is contained in:
34
app/Modules/DateHelper/Repositories/DateHelperRepository.php
Normal file
34
app/Modules/DateHelper/Repositories/DateHelperRepository.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\DateHelper\Repositories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Modules\DateHelper\Models\DateHelper;
|
||||
|
||||
class DateHelperRepository
|
||||
{
|
||||
public static function monthsAsNumber(): array
|
||||
{
|
||||
$month = [];
|
||||
|
||||
for($m = 1;$m <= 12; $m++) {
|
||||
$month[] = str_pad($m, 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
return $month;
|
||||
}
|
||||
|
||||
public static function yearsUntil(int $max = 50): array
|
||||
{
|
||||
$years = [];
|
||||
|
||||
$currentData = date('Y');
|
||||
|
||||
for ($i = 0; $i <= $max; $i++) {
|
||||
$years[] = intval($currentData) + $i;
|
||||
}
|
||||
|
||||
return $years;
|
||||
}
|
||||
}
|
||||
@@ -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,38 @@ class LoanOrder extends Resource
|
||||
->options(LoanTypeRepo::values())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
Number::make(__('Amount of loan'), 'loan_amount')
|
||||
->fullWidth()
|
||||
->rules('required', 'integer', 'max:40000'),
|
||||
]),
|
||||
|
||||
new Panel(__('Card'), [
|
||||
NovaInputmask::make(__('Card number'), 'card_number')
|
||||
->mask('9999 9999 9999 9999')
|
||||
->storeRawValue()
|
||||
->size('w-1/2')
|
||||
->rules('required', 'integer'),
|
||||
|
||||
Text::make(__('Card name'), 'card_name')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
Select::make(__('Expiration Month'), 'card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::monthsAsNumber())
|
||||
->size('w-1/2')
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
Select::make(__('Expiration year'), 'card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil())
|
||||
->size('w-1/2')
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
]),
|
||||
|
||||
new Panel(__('Location'), [
|
||||
@@ -359,6 +392,86 @@ class LoanOrder extends Resource
|
||||
->creationRules('required')
|
||||
->updateRules('nullable'),
|
||||
]),
|
||||
|
||||
new Panel(__('1. Guarantor'), [
|
||||
Text::make(__('Guarantor name'), 'guarantor_name')
|
||||
->fullWidth()
|
||||
->size('w-1/3'),
|
||||
|
||||
Text::make(__('Guarantor Surname'), 'guarantor_surname')
|
||||
->fullWidth()
|
||||
->size('w-1/3'),
|
||||
|
||||
Text::make(__('Guarantor Patronic name'), 'guarantor_patronic_name')
|
||||
->fullWidth()
|
||||
->size('w-1/3'),
|
||||
|
||||
NovaInputmask::make(__('Card number'), 'card_number')
|
||||
->mask('9999 9999 9999 9999')
|
||||
->storeRawValue()
|
||||
->size('w-1/2')
|
||||
->rules('required', 'integer'),
|
||||
|
||||
Text::make(__('Card name'), 'card_name')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
Select::make(__('Expiration Month'), 'card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::monthsAsNumber())
|
||||
->size('w-1/2')
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
Select::make(__('Expiration year'), 'card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil())
|
||||
->size('w-1/2')
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
]),
|
||||
|
||||
new Panel(__('2. Guarantor'), [
|
||||
Text::make(__('Guarantor name'), 'guarantor_name')
|
||||
->fullWidth()
|
||||
->size('w-1/3'),
|
||||
|
||||
Text::make(__('Guarantor Surname'), 'guarantor_surname')
|
||||
->fullWidth()
|
||||
->size('w-1/3'),
|
||||
|
||||
Text::make(__('Guarantor Patronic name'), 'guarantor_patronic_name')
|
||||
->fullWidth()
|
||||
->size('w-1/3'),
|
||||
|
||||
NovaInputmask::make(__('Card number'), 'card_number')
|
||||
->mask('9999 9999 9999 9999')
|
||||
->storeRawValue()
|
||||
->size('w-1/2')
|
||||
->rules('required', 'integer'),
|
||||
|
||||
Text::make(__('Card name'), 'card_name')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
Select::make(__('Expiration Month'), 'card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::monthsAsNumber())
|
||||
->size('w-1/2')
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
Select::make(__('Expiration year'), 'card_month')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil())
|
||||
->size('w-1/2')
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
4
resources/css/vendor/nova/css/additional.css
vendored
4
resources/css/vendor/nova/css/additional.css
vendored
@@ -30,7 +30,7 @@ dialog a {
|
||||
/*}*/
|
||||
|
||||
|
||||
/*button[dusk="update-and-continue-editing-button"],
|
||||
button[dusk="update-and-continue-editing-button"],
|
||||
button[dusk="create-and-add-another-button"] {
|
||||
display: none;
|
||||
}*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user