wip on laon orders
This commit is contained in:
@@ -10,12 +10,12 @@ class BranchNovaRepo
|
||||
/**
|
||||
* Depends on region
|
||||
*/
|
||||
public static function dependsOnRegion(): Closure
|
||||
public static function dependsOnRegion(string $attribute = 'region'): Closure
|
||||
{
|
||||
return function ($field, $request, $formData) {
|
||||
return function ($field, $request, $formData) use ($attribute) {
|
||||
$field->options(
|
||||
$formData->region
|
||||
? Branch::where('region', $formData->region)->pluck('name', 'id')
|
||||
$formData->{$attribute}
|
||||
? Branch::where('region', $formData->{$attribute})->pluck('name', 'id')
|
||||
: []
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Resources\Order\Loan\Concerns;
|
||||
|
||||
class LoanOrderNovaRepo
|
||||
{
|
||||
}
|
||||
@@ -4,14 +4,22 @@ namespace App\Nova\Resources\Order\Loan;
|
||||
|
||||
use App\Models\Order\Loan\LoanOrder as LoanOrderModel;
|
||||
use App\Nova\Resource;
|
||||
use App\Nova\Resources\Branch\Concerns\BranchNovaRepo;
|
||||
use App\Repos\Order\Loan\BranchRepo;
|
||||
use App\Repos\Order\Loan\LoanTypeRepo;
|
||||
use App\Repos\System\Settings\Legal\EducationRepo;
|
||||
use App\Repos\System\Settings\Legal\MarriageRepo;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\Date;
|
||||
use Laravel\Nova\Fields\Email;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Number;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Nurmuhammet\NovaInputmask\NovaInputmask;
|
||||
|
||||
class LoanOrder extends Resource
|
||||
{
|
||||
@@ -76,6 +84,7 @@ class LoanOrder extends Resource
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(BranchRepo::values())
|
||||
->dependsOn('region', BranchNovaRepo::dependsOnRegion())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
@@ -95,31 +104,93 @@ class LoanOrder extends Resource
|
||||
Text::make(__('Customer patronic name'), 'customer_patronic_name')
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
// $table->string('passport_address');
|
||||
// $table->string('real_address');
|
||||
// $table->string('passport_serie')->index();
|
||||
// $table->integer('passport_id')->index();
|
||||
// $table->date('passport_given_at');
|
||||
// $table->string('passport_given_by');
|
||||
// $table->string('born_place');
|
||||
// $table->date('born_at');
|
||||
// $table->string('email')->nullable()->index();
|
||||
// $table->string('phone')->index();
|
||||
// $table->string('phone_additional')->nullable();
|
||||
// $table->string('phone_home')->nullable();
|
||||
// $table->string('work_region')->nullable()->index();
|
||||
// $table->string('work_province')->nullable();
|
||||
// $table->string('work_company')->nullable();
|
||||
// $table->string('work_company_accountant_number')->nullable();
|
||||
// $table->date('work_started_at')->nullable();
|
||||
// $table->string('work_salary')->nullable();
|
||||
// $table->string('work_position')->nullable();
|
||||
// $table->string('education');
|
||||
// $table->string('marriage_status');
|
||||
Text::make(__('Residence (passport)'), 'passport_address')
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
Text::make(__('Current Residence'), 'real_address')
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(PassportRepo::values())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
Number::make(__('Passport id'), 'passport_id')
|
||||
->rules('required'),
|
||||
|
||||
Date::make(__('Passport date of issue'), 'passport_given_at')
|
||||
->rules('required'),
|
||||
|
||||
Text::make(__('Passport given by'), 'passport_given_by')
|
||||
->rules('required'),
|
||||
|
||||
Text::make(__('Born place (passport)'), 'born_place')
|
||||
->rules('required'),
|
||||
|
||||
Date::make(__('Date of birth'), 'born_at')
|
||||
->rules('required'),
|
||||
|
||||
Email::make(__('Email'), 'email')
|
||||
->rules('nullable', 'email'),
|
||||
|
||||
NovaInputmask::make(__('Phone'), 'phone')
|
||||
->phonenumber('TM')
|
||||
->rules('required'),
|
||||
|
||||
NovaInputmask::make(__('Phone Additional'), 'phone_additional')
|
||||
->phonenumber('TM')
|
||||
->rules('required'),
|
||||
|
||||
NovaInputmask::make(__('Home phone'), 'phone_home')
|
||||
->rules('required'),
|
||||
|
||||
Select::make(__('Work region'), 'work_region')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(RegionRepo::values())
|
||||
->default(RegionRepo::default())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
Select::make(__('Work province'), 'work_province')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->dependsOn('region', BranchNovaRepo::dependsOnRegion('work_region')),
|
||||
|
||||
Text::make(__('Work company name'), 'work_company')
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
NovaInputmask::make(__('HR department work number'), 'work_company_accountant_number'),
|
||||
|
||||
Date::make(__('Work started at'), 'work_started_at')
|
||||
->rules('required'),
|
||||
|
||||
Text::make(__('Salary'), 'work_salary')
|
||||
->rules('required'),
|
||||
Text::make(__('Position'), 'work_position')
|
||||
->rules('required'),
|
||||
|
||||
Select::make(__('Education'), 'education')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(EducationRepo::values())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
Select::make(__('Marriage status'), 'marriage_status')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(MarriageRepo::values())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
// $table->text('passport_one');
|
||||
// $table->text('passport_two');
|
||||
// $table->text('passport_three');
|
||||
// $table->text('passport_four');
|
||||
|
||||
// $table->foreignId('filled_by')->constrained('users')->restrictOnDelete();
|
||||
// $table->foreignId('user_id')->constrained('users')->restrictOnDelete();
|
||||
// $table->string('status')->index();
|
||||
|
||||
@@ -103,7 +103,7 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
||||
return [
|
||||
MenuSection::dashboard(Main::class)->icon('chart-bar'),
|
||||
|
||||
MenuSection::make(__('System'), [
|
||||
MenuSection::make(__('Orders'), [
|
||||
MenuItem::resource(LoanOrder::class),
|
||||
])->icon('collection')->collapsable(),
|
||||
|
||||
|
||||
36
app/Repos/System/Settings/Legal/EducationRepo.php
Normal file
36
app/Repos/System/Settings/Legal/EducationRepo.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repos\System\Settings\Legal;
|
||||
|
||||
class EducationRepo
|
||||
{
|
||||
public const SCHOOL_DROP_OUT = 'school_drop_out';
|
||||
|
||||
public const SCHOOL = 'school';
|
||||
|
||||
public const MIDDLE_SCHOOL = 'middle_school';
|
||||
|
||||
public const UNFINISHED_HIGH_EDUCATION = 'Unfinished_high_education';
|
||||
|
||||
public const HIGH_EDUCATION = 'high_education';
|
||||
|
||||
public const MASTERS = 'masters';
|
||||
|
||||
public const PHD = 'phd';
|
||||
|
||||
/**
|
||||
* Education statuses
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
return [
|
||||
self::SCHOOL_DROP_OUT => __('School drop out'),
|
||||
self::SCHOOL => __('School'),
|
||||
self::MIDDLE_SCHOOL => __('Middle school'),
|
||||
self::UNFINISHED_HIGH_EDUCATION => __('Unfinished high education'),
|
||||
self::HIGH_EDUCATION => __('High education'),
|
||||
self::MASTERS => __('Masters'),
|
||||
self::PHD => __('PHD'),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Repos/System/Settings/Legal/MarriageRepo.php
Normal file
30
app/Repos/System/Settings/Legal/MarriageRepo.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repos\System\Settings\Legal;
|
||||
|
||||
class MarriageRepo
|
||||
{
|
||||
public const MARRIED = 'married';
|
||||
|
||||
public const LEGAL_MARRIAGE = 'legal_marriage';
|
||||
|
||||
public const DIVORCED = 'divorced';
|
||||
|
||||
public const WIDOW = 'WIDOW';
|
||||
|
||||
public const SINGLE = 'single';
|
||||
|
||||
/**
|
||||
* Marriage values
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
return [
|
||||
self::MARRIED => __('Married'),
|
||||
self::LEGAL_MARRIAGE => __('Legal Marriage'),
|
||||
self::DIVORCED => __('Divorced'),
|
||||
self::WIDOW => __('Widow'),
|
||||
self::SINGLE => __('Single'),
|
||||
];
|
||||
}
|
||||
}
|
||||
48
app/Repos/System/Settings/Legal/PassportRepo.php
Normal file
48
app/Repos/System/Settings/Legal/PassportRepo.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repos\System\Settings\Legal;
|
||||
|
||||
class PassportRepo
|
||||
{
|
||||
const I_AS = 'I-AS';
|
||||
|
||||
const I_MR = 'I-MR';
|
||||
|
||||
const II_MR = 'II-MR';
|
||||
|
||||
const I_AH = 'I-AH';
|
||||
|
||||
const II_AH = 'II-AH';
|
||||
|
||||
const I_LB = 'I-LB';
|
||||
|
||||
const II_LB = 'II-LB';
|
||||
|
||||
const I_BN = 'I-BN';
|
||||
|
||||
const II_BN = 'II-BN';
|
||||
|
||||
const I_DZ = 'I-DZ';
|
||||
|
||||
const II_DZ = 'II-DZ';
|
||||
|
||||
/**
|
||||
* Passport values
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
return [
|
||||
self::I_AS => self::I_AS,
|
||||
self::I_MR => self::I_MR,
|
||||
self::II_MR => self::II_MR,
|
||||
self::I_AH => self::I_AH,
|
||||
self::II_AH => self::II_AH,
|
||||
self::I_LB => self::I_LB,
|
||||
self::II_LB => self::II_LB,
|
||||
self::I_BN => self::I_BN,
|
||||
self::II_BN => self::II_BN,
|
||||
self::I_DZ => self::I_DZ,
|
||||
self::II_DZ => self::II_DZ,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
"laravel/nova": "*",
|
||||
"laravel/sanctum": "^3.3",
|
||||
"laravel/tinker": "^2.8",
|
||||
"nurmuhammet/nova-inputmask": "^1.0",
|
||||
"outl1ne/nova-translatable": "^2.2",
|
||||
"spatie/laravel-permission": "^6.1",
|
||||
"spatie/laravel-translatable": "^6.5",
|
||||
|
||||
47
composer.lock
generated
47
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6ea0c2232f3e82763aa4a583ef25fece",
|
||||
"content-hash": "77a24bc6798fc44d2104306518b27e22",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@@ -3078,6 +3078,51 @@
|
||||
],
|
||||
"time": "2023-02-08T01:06:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nurmuhammet/nova-inputmask",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nurmuhammet-ali/nova-inputmask.git",
|
||||
"reference": "67e530d1702992e1ce1b5000e8ec45865922efda"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nurmuhammet-ali/nova-inputmask/zipball/67e530d1702992e1ce1b5000e8ec45865922efda",
|
||||
"reference": "67e530d1702992e1ce1b5000e8ec45865922efda",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.3|^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Nurmuhammet\\NovaInputmask\\FieldServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Nurmuhammet\\NovaInputmask\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "A Laravel Nova field.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"nova"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nurmuhammet-ali/nova-inputmask/issues",
|
||||
"source": "https://github.com/nurmuhammet-ali/nova-inputmask/tree/1.0.0"
|
||||
},
|
||||
"time": "2022-11-15T13:21:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "openspout/openspout",
|
||||
"version": "v4.22.0",
|
||||
|
||||
Reference in New Issue
Block a user