diff --git a/app/Models/Branch/Branch.php b/app/Models/Branch/Branch.php index 484939e..f31fce8 100644 --- a/app/Models/Branch/Branch.php +++ b/app/Models/Branch/Branch.php @@ -31,6 +31,7 @@ class Branch extends Model 'billing_username', 'billing_password', 'address', + 'phone_numbers', 'active', ]; diff --git a/app/Models/Test.php b/app/Models/Test.php new file mode 100644 index 0000000..f0e7f90 --- /dev/null +++ b/app/Models/Test.php @@ -0,0 +1,13 @@ +displayUsingLabels() ->searchable() - ->dependsOn('region', BranchNovaRepo::dependsOnRegion()), + ->dependsOn('region', NovaRepo::dependsOnRegion('region')), Text::make(__('Unique code'), 'unique_code') ->rules('required', 'string', 'max:255'), diff --git a/app/Nova/Resources/Branch/Concerns/BranchNovaRepo.php b/app/Nova/Resources/Branch/Concerns/BranchNovaRepo.php deleted file mode 100644 index 442bae7..0000000 --- a/app/Nova/Resources/Branch/Concerns/BranchNovaRepo.php +++ /dev/null @@ -1,23 +0,0 @@ -options( - $formData->{$attribute} - ? Province::where('region', $formData->{$attribute})->pluck('name', 'id') - : [] - ); - }; - } -} diff --git a/app/Nova/Resources/Order/Loan/Concerns/LoanOrderFieldsForIndex.php b/app/Nova/Resources/Order/Loan/Concerns/LoanOrderFieldsForIndex.php index 0661648..ec1d5df 100644 --- a/app/Nova/Resources/Order/Loan/Concerns/LoanOrderFieldsForIndex.php +++ b/app/Nova/Resources/Order/Loan/Concerns/LoanOrderFieldsForIndex.php @@ -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; diff --git a/app/Nova/Resources/Order/Loan/LoanOrder.php b/app/Nova/Resources/Order/Loan/LoanOrder.php index 8c84298..6165454 100644 --- a/app/Nova/Resources/Order/Loan/LoanOrder.php +++ b/app/Nova/Resources/Order/Loan/LoanOrder.php @@ -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(); ]; } diff --git a/app/Nova/Resources/System/Location/Province.php b/app/Nova/Resources/System/Location/Province.php index 3e12bea..c1f248d 100644 --- a/app/Nova/Resources/System/Location/Province.php +++ b/app/Nova/Resources/System/Location/Province.php @@ -70,6 +70,7 @@ class Province extends Resource ->sortable(), Text::make(__('Name'), 'name') + ->translatable() ->rules('required', 'string', 'max:255'), NovaSwitcher::make(__('Active'), 'active') diff --git a/app/Nova/Resources/Test.php b/app/Nova/Resources/Test.php new file mode 100644 index 0000000..9b7567c --- /dev/null +++ b/app/Nova/Resources/Test.php @@ -0,0 +1,97 @@ + + */ + 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 []; + } +} diff --git a/app/Providers/NovaServiceProvider.php b/app/Providers/NovaServiceProvider.php index c052580..df9768d 100644 --- a/app/Providers/NovaServiceProvider.php +++ b/app/Providers/NovaServiceProvider.php @@ -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), diff --git a/app/Repos/Order/Loan/BranchRepo.php b/app/Repos/Branch/BranchRepo.php similarity index 86% rename from app/Repos/Order/Loan/BranchRepo.php rename to app/Repos/Branch/BranchRepo.php index 70ef4cd..3db2d64 100644 --- a/app/Repos/Order/Loan/BranchRepo.php +++ b/app/Repos/Branch/BranchRepo.php @@ -1,6 +1,6 @@ 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'); } } diff --git a/app/Repos/System/Location/ProvinceRepo.php b/app/Repos/System/Location/ProvinceRepo.php new file mode 100644 index 0000000..fb9382d --- /dev/null +++ b/app/Repos/System/Location/ProvinceRepo.php @@ -0,0 +1,7 @@ +{$attribute}); + $field->options( + $formData->{$attribute} + ? $model::where('region', $formData->{$attribute})->pluck('name', 'id') + : [] + ); + }; + } } diff --git a/composer.lock b/composer.lock index d67bf10..72507b8 100644 --- a/composer.lock +++ b/composer.lock @@ -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", diff --git a/database/migrations/2023_11_23_143517_create_branches_table.php b/database/migrations/2023_11_23_143517_create_branches_table.php index 128bea4..bb2f334 100644 --- a/database/migrations/2023_11_23_143517_create_branches_table.php +++ b/database/migrations/2023_11_23_143517_create_branches_table.php @@ -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(); }); diff --git a/database/migrations/2023_11_27_225730_create_test_table.php b/database/migrations/2023_11_27_225730_create_test_table.php new file mode 100644 index 0000000..2353766 --- /dev/null +++ b/database/migrations/2023_11_27_225730_create_test_table.php @@ -0,0 +1,28 @@ +id(); + $table->string('phone')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('test'); + } +}; diff --git a/lang/tk.json b/lang/tk.json index d222429..08b9be1 100644 --- a/lang/tk.json +++ b/lang/tk.json @@ -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",