add other changes

This commit is contained in:
2024-09-26 02:50:56 +05:00
parent f3be359202
commit 8e59240edd
7 changed files with 121 additions and 14 deletions

View File

@@ -14,14 +14,23 @@ class BaseAppEnumController extends Controller
/** /**
* Base app enums * Base app enums
*/ */
public function index() public function index(): array
{ {
return [ return [
'loan_types' => LoanTypeRepo::onlyGuarantor(), 'loan_types' => LoanTypeRepo::onlyGuarantor(),
'regions' => RegionRepo::values(), 'regions' => RegionRepo::values(),
'educations' => EducationRepo::values(), 'educations' => $this->educationValues(),
'marriage_statuses' => MarriageRepo::values(), 'marriage_statuses' => MarriageRepo::values(),
'passport_series' => PassportRepo::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'),
];
}
} }

View File

@@ -10,6 +10,7 @@ use App\Nova\Filters\RegionFilter;
use App\Nova\Filters\StatusFilter; use App\Nova\Filters\StatusFilter;
use App\Nova\Resource; use App\Nova\Resource;
use App\Nova\Resources\Order\Loan\Concerns\LoanOrderFieldsForIndex; use App\Nova\Resources\Order\Loan\Concerns\LoanOrderFieldsForIndex;
use App\Repos\Order\Loan\LoanOrderRepo;
use App\Repos\Order\Loan\LoanTypeRepo; use App\Repos\Order\Loan\LoanTypeRepo;
use App\Repos\Order\OrderRepo; use App\Repos\Order\OrderRepo;
use App\Repos\System\Nova\NovaRepo; use App\Repos\System\Nova\NovaRepo;
@@ -140,7 +141,7 @@ class LoanOrderMobile extends Resource
*/ */
public function fieldsForDetail(): array 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') Text::make(__('Current Residence'), 'real_address')
->size('w-1/2') ->size('w-1/2')
->rules('required', 'string', new DowranAgaAllowed, 'max:255'), ->rules('required', 'string', new DowranAgaAllowed, 'max:255'),
Select::make(__('Karz taryhy'), 'satisfiable')
->searchable()
->displayUsingLabels()
->options(LoanOrderRepo::satisfiableValues())
->size('w-full'),
]), ]),
new Panel(__('Card'), [ new Panel(__('Card'), [
@@ -430,6 +437,10 @@ class LoanOrderMobile extends Resource
->options(DateHelperRepository::yearsUntil()) ->options(DateHelperRepository::yearsUntil())
->size('w-1/2') ->size('w-1/2')
->rules('required'), ->rules('required'),
Text::make(__('Ortaça zähmen haky'), 'guarantor_note')
->size('w-full')
->canSeeWhen('systemUser', $this),
]), ]),
new Panel('2. '.__('Guarantor'), [ new Panel('2. '.__('Guarantor'), [
@@ -506,6 +517,16 @@ class LoanOrderMobile extends Resource
$field->show()->rules('required'); $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');
}
}),
]), ]),
]; ];

View File

@@ -6,6 +6,7 @@ use App\Modules\DateHelper\Repositories\DateHelperRepository;
use App\Nova\Resources\Branch\Branch; use App\Nova\Resources\Branch\Branch;
use App\Nova\Resources\System\Location\Province; use App\Nova\Resources\System\Location\Province;
use App\Nova\User; use App\Nova\User;
use App\Repos\Order\Loan\LoanOrderRepo;
use App\Repos\Order\OrderRepo; use App\Repos\Order\OrderRepo;
use App\Repos\System\Settings\Legal\EducationRepo; use App\Repos\System\Settings\Legal\EducationRepo;
use App\Repos\System\Settings\Legal\MarriageRepo; use App\Repos\System\Settings\Legal\MarriageRepo;
@@ -25,7 +26,7 @@ use Nurmuhammet\NovaInputmask\NovaInputmask;
class LoanOrderMobileFieldsForDetail class LoanOrderMobileFieldsForDetail
{ {
public static function make(): array public static function make($resource): array
{ {
return [ return [
ID::make()->hide(), ID::make()->hide(),
@@ -69,23 +70,22 @@ class LoanOrderMobileFieldsForDetail
Select::make(__('Education'), 'education') Select::make(__('Education'), 'education')
->displayUsingLabels() ->displayUsingLabels()
->options(EducationRepo::values()) ->options(EducationRepo::values()),
->size('w-1/3'),
Select::make(__('Marriage status'), 'marriage_status') Select::make(__('Marriage status'), 'marriage_status')
->displayUsingLabels() ->displayUsingLabels()
->options(MarriageRepo::values()) ->options(MarriageRepo::values()),
->size('w-1/3'),
Date::make(__('Date of birth'), 'born_at') Date::make(__('Date of birth'), 'born_at')
->size('w-1/3')
->toTurkmenFormat(), ->toTurkmenFormat(),
Text::make(__('Residence (passport)'), 'passport_address') Text::make(__('Residence (passport)'), 'passport_address'),
->size('w-1/2'),
Text::make(__('Current Residence'), 'real_address') Text::make(__('Current Residence'), 'real_address'),
->size('w-1/2'),
Select::make(__('Karz taryhy'), 'satisfiable')
->displayUsingLabels()
->options(LoanOrderRepo::satisfiableValues()),
]), ]),
new Panel(__('Card'), [ new Panel(__('Card'), [
@@ -197,6 +197,9 @@ class LoanOrderMobileFieldsForDetail
->displayUsingLabels() ->displayUsingLabels()
->searchable() ->searchable()
->options(DateHelperRepository::yearsUntil()), ->options(DateHelperRepository::yearsUntil()),
Text::make(__('Ortaça zähmen haky'), 'guarantor_note')
->canSeeWhen('systemUser', $resource),
]), ]),
new Panel('2. '.__('Guarantor'), [ new Panel('2. '.__('Guarantor'), [
@@ -216,6 +219,9 @@ class LoanOrderMobileFieldsForDetail
->displayUsingLabels() ->displayUsingLabels()
->searchable() ->searchable()
->options(DateHelperRepository::yearsUntil()), ->options(DateHelperRepository::yearsUntil()),
Text::make(__('Ortaça zähmen haky'), 'guarantor_2_note')
->canSeeWhen('systemUser', $resource),
]), ]),
]; ];

View File

@@ -9,6 +9,16 @@ use Illuminate\Database\Eloquent\Model;
class LoanOrderRepo class LoanOrderRepo
{ {
public static function satisfiableValues(): array
{
return [
null => '-',
'satisfiable' => __('Satisfiable'),
'insufficient' => __('Insufficient'),
'unknown' => __('Unknown'),
];
}
/** /**
* When model is being created * When model is being created
*/ */

View File

@@ -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');
});
}
};

View File

@@ -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');
});
}
};

View File

@@ -310,5 +310,8 @@
"Guarantor": "Zamun", "Guarantor": "Zamun",
"Guarantor name": "Zamunyň ady", "Guarantor name": "Zamunyň ady",
"Guarantor Surname": "Zamunyň familiýasy", "Guarantor Surname": "Zamunyň familiýasy",
"Guarantor Patronic name": "Zamunyň atasynyň ady" "Guarantor Patronic name": "Zamunyň atasynyň ady",
"Satisfiable": "Kanagatlanarly",
"Insufficient": "Kanagatlanarsyz",
"Unknown": "Näbelli"
} }