wip
This commit is contained in:
@@ -31,6 +31,7 @@ class Branch extends Model
|
||||
'billing_username',
|
||||
'billing_password',
|
||||
'address',
|
||||
'phone_numbers',
|
||||
'active',
|
||||
];
|
||||
|
||||
|
||||
13
app/Models/Test.php
Normal file
13
app/Models/Test.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Test extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Nova\Resources\Branch;
|
||||
|
||||
use App\Models\Branch\Branch as BranchModel;
|
||||
use App\Nova\Resources\Branch\Concerns\BranchNovaRepo;
|
||||
use App\Repos\System\Nova\NovaRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
@@ -78,7 +78,7 @@ class Branch extends Resource
|
||||
Select::make(__('Province'), 'province_id')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->dependsOn('region', BranchNovaRepo::dependsOnRegion()),
|
||||
->dependsOn('region', NovaRepo::dependsOnRegion('region')),
|
||||
|
||||
Text::make(__('Unique code'), 'unique_code')
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Resources\Branch\Concerns;
|
||||
|
||||
use App\Models\System\Location\Province;
|
||||
use Closure;
|
||||
|
||||
class BranchNovaRepo
|
||||
{
|
||||
/**
|
||||
* Depends on region
|
||||
*/
|
||||
public static function dependsOnRegion(string $attribute = 'region'): Closure
|
||||
{
|
||||
return function ($field, $request, $formData) use ($attribute) {
|
||||
$field->options(
|
||||
$formData->{$attribute}
|
||||
? Province::where('region', $formData->{$attribute})->pluck('name', 'id')
|
||||
: []
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Nova\Resources\Order\Loan\Concerns;
|
||||
|
||||
use App\Repos\Order\Loan\BranchRepo;
|
||||
use App\Repos\Branch\BranchRepo;
|
||||
use App\Repos\Order\Loan\LoanTypeRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
|
||||
namespace App\Nova\Resources\Order\Loan;
|
||||
|
||||
use App\Models\Branch\Branch;
|
||||
use App\Models\Order\Loan\LoanOrder as LoanOrderModel;
|
||||
use App\Models\System\Location\Province;
|
||||
use App\Nova\Resource;
|
||||
use App\Nova\Resources\Branch\Concerns\BranchNovaRepo;
|
||||
use App\Nova\Resources\Order\Loan\Concerns\LoanOrderEvents;
|
||||
use App\Nova\Resources\Order\Loan\Concerns\LoanOrderFieldsForIndex;
|
||||
use App\Repos\Order\Loan\BranchRepo;
|
||||
use App\Repos\Order\Loan\LoanTypeRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Nova\NovaRepo;
|
||||
use App\Repos\System\Settings\Legal\EducationRepo;
|
||||
use App\Repos\System\Settings\Legal\MarriageRepo;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
@@ -105,6 +107,15 @@ class LoanOrder extends Resource
|
||||
return [
|
||||
ID::make()->sortable(),
|
||||
|
||||
Select::make(__('Status'), 'status')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(OrderRepo::statusValues())
|
||||
->default(OrderRepo::defaultStatus())
|
||||
->fullWidth()
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
|
||||
new Panel(__('Loan'), [
|
||||
Select::make(__('Loan type'), 'loan_type')
|
||||
->displayUsingLabels()
|
||||
@@ -128,7 +139,7 @@ class LoanOrder extends Resource
|
||||
Select::make(__('Branch'), 'branch_id')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->dependsOn('region', BranchNovaRepo::dependsOnRegion())
|
||||
->dependsOn('region', NovaRepo::dependsOnRegion('region', Branch::class))
|
||||
->size('w-1/2')
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
@@ -210,12 +221,14 @@ class LoanOrder extends Resource
|
||||
->rules('nullable', 'email'),
|
||||
|
||||
NovaInputmask::make(__('Phone'), 'phone')
|
||||
->phonenumber('TM')
|
||||
->mask('+(\\9\\93)-99-99-99-99')
|
||||
->storeRawValue()
|
||||
->size('w-1/4')
|
||||
->rules('required'),
|
||||
|
||||
NovaInputmask::make(__('Phone Additional'), 'phone_additional')
|
||||
->phonenumber('TM')
|
||||
->mask('+(\\9\\93)-99-99-99-99')
|
||||
->storeRawValue()
|
||||
->size('w-1/4')
|
||||
->rules('nullable'),
|
||||
|
||||
@@ -245,7 +258,7 @@ class LoanOrder extends Resource
|
||||
Select::make(__('Work province'), 'work_province')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->dependsOn('region', BranchNovaRepo::dependsOnRegion('work_region'))
|
||||
->dependsOn('work_region', NovaRepo::dependsOnRegion('work_region', Province::class))
|
||||
->size('w-1/2')
|
||||
->rules('required'),
|
||||
|
||||
@@ -265,26 +278,23 @@ class LoanOrder extends Resource
|
||||
new Panel(__('Passport'), [
|
||||
Image::make(__('Passport (page 1)'), 'passport_one')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'max:2048'),
|
||||
->rules('nullable', 'max:2048'),
|
||||
|
||||
Image::make(__('Passport (page 2-3)'), 'passport_two')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'max:2048'),
|
||||
->rules('nullable', 'max:2048'),
|
||||
|
||||
Image::make(__('Passport (page 8-9)'), 'passport_three')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'max:2048'),
|
||||
->rules('nullable', 'max:2048'),
|
||||
|
||||
Image::make(__('Passport (page 32)'), 'passport_four')
|
||||
->size('w-1/2')
|
||||
->rules('required', 'max:2048'),
|
||||
->rules('nullable', 'max:2048'),
|
||||
]),
|
||||
|
||||
// $table->foreignId('filled_by')->constrained('users')->restrictOnDelete();
|
||||
// $table->foreignId('user_id')->constrained('users')->restrictOnDelete();
|
||||
// $table->string('status')->index();
|
||||
// $table->string('status_reason')->nullable();
|
||||
// $table->string('notes')->nullable();
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ class Province extends Resource
|
||||
->sortable(),
|
||||
|
||||
Text::make(__('Name'), 'name')
|
||||
->translatable()
|
||||
->rules('required', 'string', 'max:255'),
|
||||
|
||||
NovaSwitcher::make(__('Active'), 'active')
|
||||
|
||||
97
app/Nova/Resources/Test.php
Normal file
97
app/Nova/Resources/Test.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Resources;
|
||||
|
||||
use App\Nova\Resource;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Nurmuhammet\NovaInputmask\NovaInputmask;
|
||||
|
||||
class Test extends Resource
|
||||
{
|
||||
/**
|
||||
* The model the resource corresponds to.
|
||||
*
|
||||
* @var class-string<\App\Models\Test>
|
||||
*/
|
||||
public static $model = \App\Models\Test::class;
|
||||
|
||||
/**
|
||||
* The single value that should be used to represent the resource when being displayed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $title = 'id';
|
||||
|
||||
/**
|
||||
* The columns that should be searched.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $search = [
|
||||
'phone',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
{
|
||||
return [
|
||||
ID::make()->sortable(),
|
||||
|
||||
// NovaInputmask::make('Phone', 'phone')
|
||||
// ->mask('+(\\9\\93)-69-99-99-99')
|
||||
// ->storeRawValue(),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function cards(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function filters(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lenses available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function lenses(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actions available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function actions(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use App\Nova\Resources\Order\Loan\LoanType;
|
||||
use App\Nova\Resources\System\Location\Province;
|
||||
use App\Nova\Resources\System\Roles\Permission;
|
||||
use App\Nova\Resources\System\Roles\Role;
|
||||
use App\Nova\Resources\Test;
|
||||
use App\Nova\User;
|
||||
use App\Repos\System\Nova\NovaRepo;
|
||||
use Eolica\NovaLocaleSwitcher\LocaleSwitcher;
|
||||
@@ -103,6 +104,7 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
||||
Nova::mainMenu(function (Request $request) {
|
||||
return [
|
||||
MenuSection::dashboard(Main::class)->icon('chart-bar'),
|
||||
MenuItem::resource(Test::class),
|
||||
|
||||
MenuSection::make(__('Orders'), [
|
||||
MenuItem::resource(LoanOrder::class),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repos\Order\Loan;
|
||||
namespace App\Repos\Branch;
|
||||
|
||||
use App\Models\Branch\Branch;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -9,6 +9,7 @@ class BranchRepo
|
||||
{
|
||||
/**
|
||||
* Model
|
||||
*
|
||||
* @var App\Models\Branch\Branch
|
||||
*/
|
||||
protected $model;
|
||||
@@ -16,7 +17,7 @@ class BranchRepo
|
||||
/**
|
||||
* New Branch Repo
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = Branch::class;
|
||||
$this->query = $this->model::query();
|
||||
@@ -54,6 +55,6 @@ class BranchRepo
|
||||
*/
|
||||
public static function values(): Collection|array
|
||||
{
|
||||
return static::make()->pluck('name', 'id');
|
||||
return static::make()->query()->pluck('name', 'id');
|
||||
}
|
||||
}
|
||||
7
app/Repos/System/Location/ProvinceRepo.php
Normal file
7
app/Repos/System/Location/ProvinceRepo.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repos\System\Location;
|
||||
|
||||
class ProvinceRepo
|
||||
{
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Repos\System\Nova;
|
||||
|
||||
use App\Models\System\Location\Province;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Events\ServingNova;
|
||||
@@ -41,4 +42,19 @@ class NovaRepo
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Depends on region
|
||||
*/
|
||||
public static function dependsOnRegion(string $attribute = 'region', string $model = Province::class): Closure
|
||||
{
|
||||
return function ($field, $request, $formData) use ($attribute, $model) {
|
||||
info($formData->{$attribute});
|
||||
$field->options(
|
||||
$formData->{$attribute}
|
||||
? $model::where('region', $formData->{$attribute})->pluck('name', 'id')
|
||||
: []
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
28
composer.lock
generated
28
composer.lock
generated
@@ -3126,20 +3126,22 @@
|
||||
},
|
||||
{
|
||||
"name": "nurmuhammet/nova-inputmask",
|
||||
"version": "1.0.0",
|
||||
"version": "1.2.20",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nurmuhammet-ali/nova-inputmask.git",
|
||||
"reference": "67e530d1702992e1ce1b5000e8ec45865922efda"
|
||||
"reference": "c3c4b3678c548622dcf9d7056ce05eed34adea7e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nurmuhammet-ali/nova-inputmask/zipball/67e530d1702992e1ce1b5000e8ec45865922efda",
|
||||
"reference": "67e530d1702992e1ce1b5000e8ec45865922efda",
|
||||
"url": "https://api.github.com/repos/nurmuhammet-ali/nova-inputmask/zipball/c3c4b3678c548622dcf9d7056ce05eed34adea7e",
|
||||
"reference": "c3c4b3678c548622dcf9d7056ce05eed34adea7e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.3|^8.0"
|
||||
"laravel/framework": "^8.0|^9.0|^10.0",
|
||||
"laravel/nova": "^4.0",
|
||||
"php": "^7.3|^8.0|^8.1|^8.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -3165,9 +3167,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nurmuhammet-ali/nova-inputmask/issues",
|
||||
"source": "https://github.com/nurmuhammet-ali/nova-inputmask/tree/1.0.0"
|
||||
"source": "https://github.com/nurmuhammet-ali/nova-inputmask/tree/1.2.20"
|
||||
},
|
||||
"time": "2022-11-15T13:21:57+00:00"
|
||||
"time": "2023-11-28T05:37:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "openspout/openspout",
|
||||
@@ -7906,16 +7908,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "10.1.8",
|
||||
"version": "10.1.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||
"reference": "84838eed9ded511f61dc3e8b5944a52d9017b297"
|
||||
"reference": "a56a9ab2f680246adcf3db43f38ddf1765774735"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/84838eed9ded511f61dc3e8b5944a52d9017b297",
|
||||
"reference": "84838eed9ded511f61dc3e8b5944a52d9017b297",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/a56a9ab2f680246adcf3db43f38ddf1765774735",
|
||||
"reference": "a56a9ab2f680246adcf3db43f38ddf1765774735",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -7972,7 +7974,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.8"
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.9"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -7980,7 +7982,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-15T13:31:15+00:00"
|
||||
"time": "2023-11-23T12:23:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
|
||||
@@ -22,6 +22,8 @@ return new class extends Migration
|
||||
|
||||
$table->string('billing_username')->nullable();
|
||||
$table->string('billing_password')->nullable();
|
||||
|
||||
$table->jsonb('phone_numbers')->nullable();
|
||||
$table->boolean('active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
28
database/migrations/2023_11_27_225730_create_test_table.php
Normal file
28
database/migrations/2023_11_27_225730_create_test_table.php
Normal 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::create('tests', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('phone')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('test');
|
||||
}
|
||||
};
|
||||
@@ -51,7 +51,7 @@
|
||||
"Passport (page 8-9)": "Pasport (8-9 sahypa)",
|
||||
"Passport (page 32)": "Pasport (32-nji sahypa)",
|
||||
"Passport date of issue": "Pasport berlen senesi",
|
||||
"Passport given by": "Pasport",
|
||||
"Passport given by": "Kim tarapyndan berildi",
|
||||
"Passport id": "Pasport belgisi",
|
||||
"Passport serie": "Pasport seriýasy",
|
||||
"Pending": "Garaşylýar",
|
||||
@@ -59,8 +59,8 @@
|
||||
"PHD": "PHD",
|
||||
"Phone": "Telefon",
|
||||
"Phone Additional": "Telefon goşmaça",
|
||||
"Position": "Positionerleşişi",
|
||||
"Processing": "Gaýtadan işlemek",
|
||||
"Position": "Wezipe",
|
||||
"Processing": "Işlenilýär",
|
||||
"Province": "Etrap",
|
||||
"Provinces": "Etraplar",
|
||||
"Region": "Welaýat",
|
||||
|
||||
Reference in New Issue
Block a user