diff --git a/app/Models/Order/Loan/LoanOrder.php b/app/Models/Order/Loan/LoanOrder.php index 1c4cfa8..7e8da6a 100644 --- a/app/Models/Order/Loan/LoanOrder.php +++ b/app/Models/Order/Loan/LoanOrder.php @@ -2,6 +2,8 @@ namespace App\Models\Order\Loan; +use App\Models\Branch\Branch; +use App\Models\System\Location\Province; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -38,7 +40,7 @@ class LoanOrder extends Model 'phone_additional', 'phone_home', 'work_region', - 'work_province', + 'work_province_id', 'work_company', 'work_company_accountant_number', 'work_started_at', @@ -75,4 +77,20 @@ class LoanOrder extends Model { return $this->belongsTo(LoanType::class); } + + /** + * Branch + */ + public function branch(): BelongsTo + { + return $this->belongsTo(Branch::class); + } + + /** + * Work province + */ + public function workProvince(): BelongsTo + { + return $this->belongsTo(Province::class, 'province_id'); + } } diff --git a/app/Nova/Resources/Order/Loan/Concerns/LoanOrderFieldsForDetail.php b/app/Nova/Resources/Order/Loan/Concerns/LoanOrderFieldsForDetail.php new file mode 100644 index 0000000..27d1c18 --- /dev/null +++ b/app/Nova/Resources/Order/Loan/Concerns/LoanOrderFieldsForDetail.php @@ -0,0 +1,169 @@ +sortable(), + + 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()), + + new Panel(__('Loan'), [ + Select::make(__('Loan type'), 'loan_type') + ->displayUsingLabels() + ->fullWidth() + ->options(LoanTypeRepo::values()), + ]), + + 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(__('Name'), 'customer_name') + ->size('w-1/3'), + + Text::make(__('Surname'), 'customer_surname') + ->size('w-1/3'), + + Text::make(__('Patronic name'), 'customer_patronic_name') + ->size('w-1/3'), + + Select::make(__('Education'), 'education') + ->displayUsingLabels() + ->options(EducationRepo::values()) + ->size('w-1/3'), + + Select::make(__('Marriage status'), 'marriage_status') + ->displayUsingLabels() + ->options(MarriageRepo::values()) + ->size('w-1/3'), + + Date::make(__('Date of birth'), 'born_at') + ->size('w-1/3'), + + Text::make(__('Residence (passport)'), 'passport_address') + ->size('w-1/2'), + + Text::make(__('Current Residence'), 'real_address') + ->size('w-1/2'), + ]), + + new Panel(__('Passport'), [ + Select::make(__('Passport serie'), 'passport_serie') + ->displayUsingLabels() + ->options(PassportRepo::values()) + ->size('w-1/3'), + + Number::make(__('Passport id'), 'passport_id') + ->size('w-1/3'), + + Date::make(__('Passport date of issue'), 'passport_given_at') + ->size('w-1/3'), + + Text::make(__('Passport given by'), 'passport_given_by') + ->size('w-1/2'), + + Text::make(__('Born place (passport)'), 'born_place') + ->size('w-1/2'), + ]), + + 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'), + + NovaInputmask::make(__('Home phone'), 'phone_home') + ->mask('+(\\9\\93)-9{8}') + ->storeRawValue() + ->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'), + ]), + + new Panel(__('Passport'), [ + 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'), + ]), + ]; + } +} diff --git a/app/Nova/Resources/Order/Loan/LoanOrder.php b/app/Nova/Resources/Order/Loan/LoanOrder.php index 231985e..ee18659 100644 --- a/app/Nova/Resources/Order/Loan/LoanOrder.php +++ b/app/Nova/Resources/Order/Loan/LoanOrder.php @@ -7,6 +7,7 @@ use App\Models\Order\Loan\LoanOrder as LoanOrderModel; use App\Models\System\Location\Province; use App\Nova\Resource; use App\Nova\Resources\Order\Loan\Concerns\LoanOrderEvents; +use App\Nova\Resources\Order\Loan\Concerns\LoanOrderFieldsForDetail; use App\Nova\Resources\Order\Loan\Concerns\LoanOrderFieldsForIndex; use App\Repos\Order\Loan\LoanTypeRepo; use App\Repos\Order\OrderRepo; @@ -102,6 +103,14 @@ class LoanOrder extends Resource return LoanOrderFieldsForIndex::make(); } + /** + * Get the fields for detail + */ + public function fieldsForDetail(): array + { + return LoanOrderFieldsForDetail::make(); + } + /** * Get the fields displayed by the resource. */ @@ -271,7 +280,7 @@ class LoanOrder extends Resource ->rules('required') ->sortable(), - Select::make(__('Work province'), 'work_province') + Select::make(__('Work province'), 'work_province_id') ->displayUsingLabels() ->searchable() ->dependsOn('work_region', NovaRepo::dependsOnRegion('work_region', Province::class)) @@ -308,9 +317,6 @@ class LoanOrder extends Resource ->size('w-1/2') ->rules('required', 'max:2048'), ]), - - // $table->foreignId('filled_by')->constrained('users')->restrictOnDelete(); - // $table->foreignId('user_id')->constrained('users')->restrictOnDelete(); ]; } diff --git a/database/migrations/2023_11_23_162920_create_loan_orders_table.php b/database/migrations/2023_11_23_162920_create_loan_orders_table.php index 239c348..5531b8f 100644 --- a/database/migrations/2023_11_23_162920_create_loan_orders_table.php +++ b/database/migrations/2023_11_23_162920_create_loan_orders_table.php @@ -42,7 +42,7 @@ return new class extends Migration $table->string('phone_home')->nullable(); $table->string('work_region')->nullable()->index(); - $table->string('work_province')->nullable(); + $table->foreignId('work_province_id')->nullable()->constrained('provinces')->restrictOnDelete(); $table->string('work_company')->nullable(); $table->string('work_company_accountant_number')->nullable(); $table->date('work_started_at')->nullable(); diff --git a/lang/tk.json b/lang/tk.json index c2c2c9b..46435c6 100644 --- a/lang/tk.json +++ b/lang/tk.json @@ -197,7 +197,7 @@ "Verify Email Address": "E-poçta salgysyny barlaň", "Verify Your Email Address": "E-poçta salgyňyzy barlaň", "Web Server is Down": "Web Serwer ýapyk", - "Whoops!": "Wah!", + "Whoops!": "Sahypa tapylmady!", "Widow": "Adamsy ýa-da aýaly aradan çykan", "Work company name": "Işleýän edaranyň/kärhananyň ady", "Work province": "Işleýän etrabyňyz", diff --git a/lang/vendor/nova/tk.json b/lang/vendor/nova/tk.json index aeea283..c88c2c3 100644 --- a/lang/vendor/nova/tk.json +++ b/lang/vendor/nova/tk.json @@ -99,7 +99,7 @@ "Choose Type": "Görnüşini saýlaň", "Christmas Island": "Ro Christmasdestwo adasy", "Click to choose": "Saýlamak üçin basyň", - "Close": ".Akyn", + "Close": "Ýap", "Cocos (Keeling) Islands": "Kokos (Keeling) adalary", "Colombia": "Kolumbiýa", "Comoros": "Komorlar", @@ -178,7 +178,7 @@ "Germany": "Germaniýa", "Ghana": "Gana", "Gibraltar": "Gibraltar", - "Go Home": "Öýe git", + "Go Home": " Baş sahypa geç", "Greece": "Gresiýa", "Greenland": "Grenlandiýa", "Grenada": "Grenada", @@ -234,7 +234,7 @@ "Liberia": "Liberiýa", "Libyan Arab Jamahiriya": "Libya", "Liechtenstein": "Lihtenşteýn", - "Light": "Lightagtylyk", + "Light": "Ýagty", "Lithuania": "Litwa", "Load :perPage More": "Moreene :perPage ýükläň", "Log In": "Giriş", @@ -331,8 +331,8 @@ "Reset Password Notification": "Parol habarnamasyny täzeden düzmek", "resource": "çeşmesi", "Resource Row Dropdown": "Çeşmeleriň hatary", - "Resources": "Çeşmeler", - "resources": "çeşmeleri", + "Resources": "Resurslar", + "resources": "resurslar", "Restore": "Dikelt", "Restore Resource": "Çeşmäni dikeltmek", "Restore Selected": "Saýlananlary dikelt", @@ -381,9 +381,9 @@ "Spain": "Ispaniýa", "Sri Lanka": "Şri-Lanka", "Standalone Actions": "Özbaşdak hereketler", - "Start Polling": "Ses berişlige başlaň", + "Start Polling": "Synhronizasiýany başlat", "Stop Impersonating": "Özüňi görkezmekden sakla", - "Stop Polling": "Ses bermegi bes ediň", + "Stop Polling": "Synhronizasiýany duzur", "Sudan": "Sudan", "Suriname": "Surinam", "Svalbard And Jan Mayen": "Swalbard we Mayan Maýen", @@ -402,7 +402,7 @@ "The :resource was updated!": ":Resource täzelendi!", "The action was executed successfully.": "Hereket üstünlikli ýerine ýetirildi.", "The file was deleted!": "Faýl öçürildi!", - "The government won't let us show you what's behind these doors": "Hökümet size bu gapylaryň aňyrsynda nämeleriň bardygyny görkezmäge ýol bermez", + "The government won't let us show you what's behind these doors": "Rugsat ýok", "The HasOne relationship has already been filled.": "HasOne gatnaşyklary eýýäm dolduryldy.", "The image could not be loaded": "Suraty ýükläp bolmady", "The image could not be loaded.": "Suraty ýükläp bolmady", @@ -457,12 +457,12 @@ "Virgin Islands, U.S.": "U.S. Virgin Islands", "Wallis And Futuna": "Wallis we Futuna", "We have emailed your password reset link!": "Parolyňyzy täzeden düzmek baglanyşygyna e-poçta iberdik!", - "We're lost in space. The page you were trying to view does not exist.": "Biz kosmosda ýitdik. Görjek bolýan sahypaňyz ýok.", + "We're lost in space. The page you were trying to view does not exist.": "Görjek bolýan sahypaňyz ýok.", "Welcome Back!": "Hoş geldiňiz!", "Western Sahara": "Günbatar Sahara", - "Whoops": "Wah", - "Whoops!": "Wah!", - "With Trashed": "Arhiwle bilen", + "Whoops": "Sahypa tapylmady", + "Whoops!": "Sahypa tapylmady!", + "With Trashed": "Arhiwli bilen bile", "Write": "Writeaz", "Year To Date": "Toyl", "Yemen": "Yemenemen",