Modify translations & fix detail page for loan orders

This commit is contained in:
2023-11-30 15:11:41 +05:00
parent 2682c02ab0
commit d87e55d905
6 changed files with 212 additions and 19 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Models\Order\Loan; 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\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -38,7 +40,7 @@ class LoanOrder extends Model
'phone_additional', 'phone_additional',
'phone_home', 'phone_home',
'work_region', 'work_region',
'work_province', 'work_province_id',
'work_company', 'work_company',
'work_company_accountant_number', 'work_company_accountant_number',
'work_started_at', 'work_started_at',
@@ -75,4 +77,20 @@ class LoanOrder extends Model
{ {
return $this->belongsTo(LoanType::class); 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');
}
} }

View File

@@ -0,0 +1,169 @@
<?php
namespace App\Nova\Resources\Order\Loan\Concerns;
use App\Nova\Resources\Branch\Branch;
use App\Nova\Resources\System\Location\Province;
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;
use App\Repos\System\Settings\Legal\PassportRepo;
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\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;
use Nurmuhammet\NovaInputmask\NovaInputmask;
class LoanOrderFieldsForDetail
{
/**
* Loan order fields for detail
*/
public static function make(): array
{
return [
ID::make()->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'),
]),
];
}
}

View File

@@ -7,6 +7,7 @@ use App\Models\Order\Loan\LoanOrder as LoanOrderModel;
use App\Models\System\Location\Province; use App\Models\System\Location\Province;
use App\Nova\Resource; use App\Nova\Resource;
use App\Nova\Resources\Order\Loan\Concerns\LoanOrderEvents; 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\Nova\Resources\Order\Loan\Concerns\LoanOrderFieldsForIndex;
use App\Repos\Order\Loan\LoanTypeRepo; use App\Repos\Order\Loan\LoanTypeRepo;
use App\Repos\Order\OrderRepo; use App\Repos\Order\OrderRepo;
@@ -102,6 +103,14 @@ class LoanOrder extends Resource
return LoanOrderFieldsForIndex::make(); return LoanOrderFieldsForIndex::make();
} }
/**
* Get the fields for detail
*/
public function fieldsForDetail(): array
{
return LoanOrderFieldsForDetail::make();
}
/** /**
* Get the fields displayed by the resource. * Get the fields displayed by the resource.
*/ */
@@ -271,7 +280,7 @@ class LoanOrder extends Resource
->rules('required') ->rules('required')
->sortable(), ->sortable(),
Select::make(__('Work province'), 'work_province') Select::make(__('Work province'), 'work_province_id')
->displayUsingLabels() ->displayUsingLabels()
->searchable() ->searchable()
->dependsOn('work_region', NovaRepo::dependsOnRegion('work_region', Province::class)) ->dependsOn('work_region', NovaRepo::dependsOnRegion('work_region', Province::class))
@@ -308,9 +317,6 @@ class LoanOrder extends Resource
->size('w-1/2') ->size('w-1/2')
->rules('required', 'max:2048'), ->rules('required', 'max:2048'),
]), ]),
// $table->foreignId('filled_by')->constrained('users')->restrictOnDelete();
// $table->foreignId('user_id')->constrained('users')->restrictOnDelete();
]; ];
} }

View File

@@ -42,7 +42,7 @@ return new class extends Migration
$table->string('phone_home')->nullable(); $table->string('phone_home')->nullable();
$table->string('work_region')->nullable()->index(); $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')->nullable();
$table->string('work_company_accountant_number')->nullable(); $table->string('work_company_accountant_number')->nullable();
$table->date('work_started_at')->nullable(); $table->date('work_started_at')->nullable();

View File

@@ -197,7 +197,7 @@
"Verify Email Address": "E-poçta salgysyny barlaň", "Verify Email Address": "E-poçta salgysyny barlaň",
"Verify Your Email Address": "E-poçta salgyňyzy barlaň", "Verify Your Email Address": "E-poçta salgyňyzy barlaň",
"Web Server is Down": "Web Serwer ýapyk", "Web Server is Down": "Web Serwer ýapyk",
"Whoops!": "Wah!", "Whoops!": "Sahypa tapylmady!",
"Widow": "Adamsy ýa-da aýaly aradan çykan", "Widow": "Adamsy ýa-da aýaly aradan çykan",
"Work company name": "Işleýän edaranyň/kärhananyň ady", "Work company name": "Işleýän edaranyň/kärhananyň ady",
"Work province": "Işleýän etrabyňyz", "Work province": "Işleýän etrabyňyz",

View File

@@ -99,7 +99,7 @@
"Choose Type": "Görnüşini saýlaň", "Choose Type": "Görnüşini saýlaň",
"Christmas Island": "Ro Christmasdestwo adasy", "Christmas Island": "Ro Christmasdestwo adasy",
"Click to choose": "Saýlamak üçin basyň", "Click to choose": "Saýlamak üçin basyň",
"Close": ".Akyn", "Close": "Ýap",
"Cocos (Keeling) Islands": "Kokos (Keeling) adalary", "Cocos (Keeling) Islands": "Kokos (Keeling) adalary",
"Colombia": "Kolumbiýa", "Colombia": "Kolumbiýa",
"Comoros": "Komorlar", "Comoros": "Komorlar",
@@ -178,7 +178,7 @@
"Germany": "Germaniýa", "Germany": "Germaniýa",
"Ghana": "Gana", "Ghana": "Gana",
"Gibraltar": "Gibraltar", "Gibraltar": "Gibraltar",
"Go Home": "Öýe git", "Go Home": " Baş sahypa geç",
"Greece": "Gresiýa", "Greece": "Gresiýa",
"Greenland": "Grenlandiýa", "Greenland": "Grenlandiýa",
"Grenada": "Grenada", "Grenada": "Grenada",
@@ -234,7 +234,7 @@
"Liberia": "Liberiýa", "Liberia": "Liberiýa",
"Libyan Arab Jamahiriya": "Libya", "Libyan Arab Jamahiriya": "Libya",
"Liechtenstein": "Lihtenşteýn", "Liechtenstein": "Lihtenşteýn",
"Light": "Lightagtylyk", "Light": "Ýagty",
"Lithuania": "Litwa", "Lithuania": "Litwa",
"Load :perPage More": "Moreene :perPage ýükläň", "Load :perPage More": "Moreene :perPage ýükläň",
"Log In": "Giriş", "Log In": "Giriş",
@@ -331,8 +331,8 @@
"Reset Password Notification": "Parol habarnamasyny täzeden düzmek", "Reset Password Notification": "Parol habarnamasyny täzeden düzmek",
"resource": "çeşmesi", "resource": "çeşmesi",
"Resource Row Dropdown": "Çeşmeleriň hatary", "Resource Row Dropdown": "Çeşmeleriň hatary",
"Resources": "Çeşmeler", "Resources": "Resurslar",
"resources": "çeşmeleri", "resources": "resurslar",
"Restore": "Dikelt", "Restore": "Dikelt",
"Restore Resource": "Çeşmäni dikeltmek", "Restore Resource": "Çeşmäni dikeltmek",
"Restore Selected": "Saýlananlary dikelt", "Restore Selected": "Saýlananlary dikelt",
@@ -381,9 +381,9 @@
"Spain": "Ispaniýa", "Spain": "Ispaniýa",
"Sri Lanka": "Şri-Lanka", "Sri Lanka": "Şri-Lanka",
"Standalone Actions": "Özbaşdak hereketler", "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 Impersonating": "Özüňi görkezmekden sakla",
"Stop Polling": "Ses bermegi bes ediň", "Stop Polling": "Synhronizasiýany duzur",
"Sudan": "Sudan", "Sudan": "Sudan",
"Suriname": "Surinam", "Suriname": "Surinam",
"Svalbard And Jan Mayen": "Swalbard we Mayan Maýen", "Svalbard And Jan Mayen": "Swalbard we Mayan Maýen",
@@ -402,7 +402,7 @@
"The :resource was updated!": ":Resource täzelendi!", "The :resource was updated!": ":Resource täzelendi!",
"The action was executed successfully.": "Hereket üstünlikli ýerine ýetirildi.", "The action was executed successfully.": "Hereket üstünlikli ýerine ýetirildi.",
"The file was deleted!": "Faýl öçürildi!", "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 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",
"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", "Virgin Islands, U.S.": "U.S. Virgin Islands",
"Wallis And Futuna": "Wallis we Futuna", "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 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!", "Welcome Back!": "Hoş geldiňiz!",
"Western Sahara": "Günbatar Sahara", "Western Sahara": "Günbatar Sahara",
"Whoops": "Wah", "Whoops": "Sahypa tapylmady",
"Whoops!": "Wah!", "Whoops!": "Sahypa tapylmady!",
"With Trashed": "Arhiwle bilen", "With Trashed": "Arhiwli bilen bile",
"Write": "Writeaz", "Write": "Writeaz",
"Year To Date": "Toyl", "Year To Date": "Toyl",
"Yemen": "Yemenemen", "Yemen": "Yemenemen",