add other changes
This commit is contained in:
@@ -14,14 +14,23 @@ class BaseAppEnumController extends Controller
|
||||
/**
|
||||
* Base app enums
|
||||
*/
|
||||
public function index()
|
||||
public function index(): array
|
||||
{
|
||||
return [
|
||||
'loan_types' => LoanTypeRepo::onlyGuarantor(),
|
||||
'regions' => RegionRepo::values(),
|
||||
'educations' => EducationRepo::values(),
|
||||
'educations' => $this->educationValues(),
|
||||
'marriage_statuses' => MarriageRepo::values(),
|
||||
'passport_series' => PassportRepo::values(),
|
||||
];
|
||||
}
|
||||
|
||||
public function educationValues(): array
|
||||
{
|
||||
return [
|
||||
EducationRepo::MIDDLE_SCHOOL => __('Middle school'),
|
||||
EducationRepo::UNFINISHED_HIGH_EDUCATION => __('Unfinished high education'),
|
||||
EducationRepo::HIGH_EDUCATION => __('High education'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Nova\Filters\RegionFilter;
|
||||
use App\Nova\Filters\StatusFilter;
|
||||
use App\Nova\Resource;
|
||||
use App\Nova\Resources\Order\Loan\Concerns\LoanOrderFieldsForIndex;
|
||||
use App\Repos\Order\Loan\LoanOrderRepo;
|
||||
use App\Repos\Order\Loan\LoanTypeRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Nova\NovaRepo;
|
||||
@@ -140,7 +141,7 @@ class LoanOrderMobile extends Resource
|
||||
*/
|
||||
public function fieldsForDetail(): array
|
||||
{
|
||||
return LoanOrderMobileFieldsForDetail::make();
|
||||
return LoanOrderMobileFieldsForDetail::make($this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,6 +249,12 @@ class LoanOrderMobile extends Resource
|
||||
Text::make(__('Current Residence'), 'real_address')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'string', new DowranAgaAllowed, 'max:255'),
|
||||
|
||||
Select::make(__('Karz taryhy'), 'satisfiable')
|
||||
->searchable()
|
||||
->displayUsingLabels()
|
||||
->options(LoanOrderRepo::satisfiableValues())
|
||||
->size('w-full'),
|
||||
]),
|
||||
|
||||
new Panel(__('Card'), [
|
||||
@@ -430,6 +437,10 @@ class LoanOrderMobile extends Resource
|
||||
->options(DateHelperRepository::yearsUntil())
|
||||
->size('w-1/2')
|
||||
->rules('required'),
|
||||
|
||||
Text::make(__('Ortaça zähmen haky'), 'guarantor_note')
|
||||
->size('w-full')
|
||||
->canSeeWhen('systemUser', $this),
|
||||
]),
|
||||
|
||||
new Panel('2. '.__('Guarantor'), [
|
||||
@@ -506,6 +517,16 @@ class LoanOrderMobile extends Resource
|
||||
$field->show()->rules('required');
|
||||
}
|
||||
}),
|
||||
|
||||
Text::make(__('Ortaça zähmen haky'), 'guarantor_2_note')
|
||||
->size('w-full')
|
||||
->hide()
|
||||
->canSeeWhen('systemUser', $this)
|
||||
->dependsOn('loan_amount', function ($field, $request, $formData) {
|
||||
if ($formData->loan_amount && floatval($formData->loan_amount) > 20000) {
|
||||
$field->show()->rules('required');
|
||||
}
|
||||
}),
|
||||
]),
|
||||
|
||||
];
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||
use App\Nova\Resources\Branch\Branch;
|
||||
use App\Nova\Resources\System\Location\Province;
|
||||
use App\Nova\User;
|
||||
use App\Repos\Order\Loan\LoanOrderRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Legal\EducationRepo;
|
||||
use App\Repos\System\Settings\Legal\MarriageRepo;
|
||||
@@ -25,7 +26,7 @@ use Nurmuhammet\NovaInputmask\NovaInputmask;
|
||||
|
||||
class LoanOrderMobileFieldsForDetail
|
||||
{
|
||||
public static function make(): array
|
||||
public static function make($resource): array
|
||||
{
|
||||
return [
|
||||
ID::make()->hide(),
|
||||
@@ -69,23 +70,22 @@ class LoanOrderMobileFieldsForDetail
|
||||
|
||||
Select::make(__('Education'), 'education')
|
||||
->displayUsingLabels()
|
||||
->options(EducationRepo::values())
|
||||
->size('w-1/3'),
|
||||
->options(EducationRepo::values()),
|
||||
|
||||
Select::make(__('Marriage status'), 'marriage_status')
|
||||
->displayUsingLabels()
|
||||
->options(MarriageRepo::values())
|
||||
->size('w-1/3'),
|
||||
->options(MarriageRepo::values()),
|
||||
|
||||
Date::make(__('Date of birth'), 'born_at')
|
||||
->size('w-1/3')
|
||||
->toTurkmenFormat(),
|
||||
|
||||
Text::make(__('Residence (passport)'), 'passport_address')
|
||||
->size('w-1/2'),
|
||||
Text::make(__('Residence (passport)'), 'passport_address'),
|
||||
|
||||
Text::make(__('Current Residence'), 'real_address')
|
||||
->size('w-1/2'),
|
||||
Text::make(__('Current Residence'), 'real_address'),
|
||||
|
||||
Select::make(__('Karz taryhy'), 'satisfiable')
|
||||
->displayUsingLabels()
|
||||
->options(LoanOrderRepo::satisfiableValues()),
|
||||
]),
|
||||
|
||||
new Panel(__('Card'), [
|
||||
@@ -197,6 +197,9 @@ class LoanOrderMobileFieldsForDetail
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil()),
|
||||
|
||||
Text::make(__('Ortaça zähmen haky'), 'guarantor_note')
|
||||
->canSeeWhen('systemUser', $resource),
|
||||
]),
|
||||
|
||||
new Panel('2. '.__('Guarantor'), [
|
||||
@@ -216,6 +219,9 @@ class LoanOrderMobileFieldsForDetail
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(DateHelperRepository::yearsUntil()),
|
||||
|
||||
Text::make(__('Ortaça zähmen haky'), 'guarantor_2_note')
|
||||
->canSeeWhen('systemUser', $resource),
|
||||
]),
|
||||
|
||||
];
|
||||
|
||||
@@ -9,6 +9,16 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LoanOrderRepo
|
||||
{
|
||||
public static function satisfiableValues(): array
|
||||
{
|
||||
return [
|
||||
null => '-',
|
||||
'satisfiable' => __('Satisfiable'),
|
||||
'insufficient' => __('Insufficient'),
|
||||
'unknown' => __('Unknown'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* When model is being created
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('loan_orders', function (Blueprint $table) {
|
||||
$table->string('guarantor_note')->nullable();
|
||||
$table->string('guarantor_2_note')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('loan_orders', function (Blueprint $table) {
|
||||
$table->dropColumn('guarantor_note');
|
||||
$table->dropColumn('guarantor_2_note');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('loan_orders', function (Blueprint $table) {
|
||||
$table->string('satisfiable')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('loan_orders', function (Blueprint $table) {
|
||||
$table->dropColumn('satisfiable');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -310,5 +310,8 @@
|
||||
"Guarantor": "Zamun",
|
||||
"Guarantor name": "Zamunyň ady",
|
||||
"Guarantor Surname": "Zamunyň familiýasy",
|
||||
"Guarantor Patronic name": "Zamunyň atasynyň ady"
|
||||
"Guarantor Patronic name": "Zamunyň atasynyň ady",
|
||||
"Satisfiable": "Kanagatlanarly",
|
||||
"Insufficient": "Kanagatlanarsyz",
|
||||
"Unknown": "Näbelli"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user