diff --git a/app/Nova/Resources/Branch/Concerns/BranchNovaRepo.php b/app/Nova/Resources/Branch/Concerns/BranchNovaRepo.php index 82856fb..442bae7 100644 --- a/app/Nova/Resources/Branch/Concerns/BranchNovaRepo.php +++ b/app/Nova/Resources/Branch/Concerns/BranchNovaRepo.php @@ -2,7 +2,7 @@ namespace App\Nova\Resources\Branch\Concerns; -use App\Models\Branch\Branch; +use App\Models\System\Location\Province; use Closure; class BranchNovaRepo @@ -15,7 +15,7 @@ class BranchNovaRepo return function ($field, $request, $formData) use ($attribute) { $field->options( $formData->{$attribute} - ? Branch::where('region', $formData->{$attribute})->pluck('name', 'id') + ? Province::where('region', $formData->{$attribute})->pluck('name', 'id') : [] ); }; diff --git a/app/Nova/Resources/Order/Loan/Concerns/LoanOrderEvents.php b/app/Nova/Resources/Order/Loan/Concerns/LoanOrderEvents.php index bf2a312..f556949 100644 --- a/app/Nova/Resources/Order/Loan/Concerns/LoanOrderEvents.php +++ b/app/Nova/Resources/Order/Loan/Concerns/LoanOrderEvents.php @@ -2,7 +2,6 @@ namespace App\Nova\Resources\Order\Loan\Concerns; -use App\Nova\Resources\Order\Loan\Concerns\LoanOrderNovaRepo; use Illuminate\Database\Eloquent\Model; use Laravel\Nova\Http\Requests\NovaRequest; @@ -10,9 +9,6 @@ trait LoanOrderEvents { /** * Register a callback to be called after the resource is created. - * - * @param \Laravel\Nova\Http\Requests\NovaRequest $request - * @param \Illuminate\Database\Eloquent\Model $model */ public static function afterCreate(NovaRequest $request, Model $model): void { diff --git a/app/Nova/Resources/Order/Loan/Concerns/LoanOrderFieldsForIndex.php b/app/Nova/Resources/Order/Loan/Concerns/LoanOrderFieldsForIndex.php new file mode 100644 index 0000000..0661648 --- /dev/null +++ b/app/Nova/Resources/Order/Loan/Concerns/LoanOrderFieldsForIndex.php @@ -0,0 +1,57 @@ +hide(), + + Text::make(__('ID'), 'unique_id')->sortable(), + + Select::make(__('Loan type'), 'loan_type') + ->displayUsingLabels() + ->options(LoanTypeRepo::values()) + ->sortable(), + + Select::make(__('Region'), 'region') + ->displayUsingLabels() + ->options(RegionRepo::values()) + ->sortable(), + + Select::make(__('Branch'), 'branch_id') + ->displayUsingLabels() + ->options(BranchRepo::values()) + ->sortable(), + + Text::make(__('Name'), 'customer_name'), + + Text::make(__('Surname'), 'customer_surname'), + + Text::make(__('Phone'), 'phone'), + + Badge::make(__('Status'), 'status') + ->map(OrderRepo::statusClasses()) + ->addTypes([ + 'primary' => 'dark:bg-gray-900 bg-gray-600 text-white', + ]) + ->labels(OrderRepo::statusValues()) + ->withIcons() + ->sortable(), + ]; + } +} diff --git a/app/Nova/Resources/Order/Loan/Concerns/LoanOrderNovaRepo.php b/app/Nova/Resources/Order/Loan/Concerns/LoanOrderNovaRepo.php index 589db28..cf422b1 100644 --- a/app/Nova/Resources/Order/Loan/Concerns/LoanOrderNovaRepo.php +++ b/app/Nova/Resources/Order/Loan/Concerns/LoanOrderNovaRepo.php @@ -4,7 +4,6 @@ namespace App\Nova\Resources\Order\Loan\Concerns; use App\Models\Branch\Branch; use App\Repos\Order\OrderRepo; -use Closure; use Illuminate\Database\Eloquent\Model; use Laravel\Nova\Http\Requests\NovaRequest; @@ -13,7 +12,7 @@ class LoanOrderNovaRepo public static function fillUniqueId($request, $model): string { return mb_strtoupper(sprintf( - '%s-%s', + '%s-%s', Branch::find($request->branch_id)->unique_code ?? 'TB', $model->id )) ?? uniqid(); diff --git a/app/Nova/Resources/Order/Loan/LoanOrder.php b/app/Nova/Resources/Order/Loan/LoanOrder.php index bb01c1b..9458603 100644 --- a/app/Nova/Resources/Order/Loan/LoanOrder.php +++ b/app/Nova/Resources/Order/Loan/LoanOrder.php @@ -6,26 +6,20 @@ use App\Models\Order\Loan\LoanOrder as LoanOrderModel; 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\LoanOrderNovaRepo; +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\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 Illuminate\Http\Request; -use Konsulting\NovaTarget\NovaTarget; -use Laravel\Nova\Fields\Badge; use Laravel\Nova\Fields\Date; use Laravel\Nova\Fields\Email; -use Laravel\Nova\Fields\File; -use Laravel\Nova\Fields\Hidden; use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\Image; use Laravel\Nova\Fields\Number; use Laravel\Nova\Fields\Select; -use Laravel\Nova\Fields\Slug; use Laravel\Nova\Fields\Text; use Laravel\Nova\Http\Requests\NovaRequest; use Laravel\Nova\Panel; @@ -55,7 +49,7 @@ class LoanOrder extends Resource * @var array */ public static $search = [ - 'unique_id', 'customer_name', 'customer_surname' + 'unique_id', 'customer_name', 'customer_surname', ]; /** @@ -63,21 +57,21 @@ class LoanOrder extends Resource * * @var bool */ - // public static $polling = true; + public static $polling = true; - // /** - // * The interval at which Nova should poll for new resources. - // * - // * @var int - // */ - // public static $pollingInterval = 120; + /** + * The interval at which Nova should poll for new resources. + * + * @var int + */ + public static $pollingInterval = 120; - // /** - // * Indicates whether to show the polling toggle button inside Nova. - // * - // * @var bool - // */ - // public static $showPollingToggle = true; + /** + * Indicates whether to show the polling toggle button inside Nova. + * + * @var bool + */ + public static $showPollingToggle = true; /** * Get the displayable label of the resource. @@ -100,41 +94,7 @@ class LoanOrder extends Resource */ public function fieldsForIndex(NovaRequest $request): array { - return [ - ID::make()->hide(), - - Text::make(__('ID'), 'unique_id')->sortable(), - - Select::make(__('Loan type'), 'loan_type') - ->displayUsingLabels() - ->options(LoanTypeRepo::values()) - ->sortable(), - - Select::make(__('Region'), 'region') - ->displayUsingLabels() - ->options(RegionRepo::values()) - ->sortable(), - - Select::make(__('Branch'), 'branch_id') - ->displayUsingLabels() - ->options(BranchRepo::values()) - ->sortable(), - - Text::make(__('Name'), 'customer_name'), - - Text::make(__('Surname'), 'customer_surname'), - - Text::make(__('Phone'), 'phone'), - - Badge::make(__('Status'), 'status') - ->map(OrderRepo::statusClasses()) - ->addTypes([ - 'primary' => 'dark:bg-gray-900 bg-gray-600 text-white', - ]) - ->labels(OrderRepo::statusValues()) - ->withIcons() - ->sortable(), - ]; + return LoanOrderFieldsForIndex::make(); } /** @@ -163,7 +123,7 @@ class LoanOrder extends Resource ->default(RegionRepo::default()) ->size('w-1/2') ->rules('required') - ->sortable(), + ->sortable(), Select::make(__('Branch'), 'branch_id') ->displayUsingLabels() @@ -287,8 +247,8 @@ class LoanOrder extends Resource ->displayUsingLabels() ->searchable() ->dependsOn('region', BranchNovaRepo::dependsOnRegion('work_region')) - ->size('w-1/2'), - // ->rules('required'), + ->size('w-1/2') + ->rules('required'), Text::make(__('Position'), 'work_position') ->size('w-1/2') diff --git a/app/Nova/User.php b/app/Nova/User.php index b8aac09..50c2dfb 100644 --- a/app/Nova/User.php +++ b/app/Nova/User.php @@ -4,7 +4,6 @@ namespace App\Nova; use Illuminate\Http\Request; use Illuminate\Validation\Rules; -use Laravel\Nova\Fields\Gravatar; use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\Password; use Laravel\Nova\Fields\Text; diff --git a/app/Repos/Order/Loan/LoanTypeRepo.php b/app/Repos/Order/Loan/LoanTypeRepo.php index 739c1f2..1b2e080 100644 --- a/app/Repos/Order/Loan/LoanTypeRepo.php +++ b/app/Repos/Order/Loan/LoanTypeRepo.php @@ -12,6 +12,6 @@ class LoanTypeRepo */ public static function values(): Collection|array { - return LoanType::pluck('name', 'id'); + return LoanType::where('active', true)->pluck('name', 'id'); } } diff --git a/config/locale-finder.php b/config/locale-finder.php index 2ed336f..1b30604 100644 --- a/config/locale-finder.php +++ b/config/locale-finder.php @@ -1,4 +1,5 @@ [ - "lang_folder" => base_path('lang') + 'paths' => [ + 'lang_folder' => base_path('lang'), ], - + /* |-------------------------------------------------------------------------- | The search options |-------------------------------------------------------------------------- | */ - "search" => [ - + 'search' => [ + /* |-------------------------------------------------------------------------- | The folders the package uses to scan for translation keys |-------------------------------------------------------------------------- | */ - "folders" => [ - base_path("app"), - resource_path("views"), + 'folders' => [ + base_path('app'), + resource_path('views'), ], - + /* |-------------------------------------------------------------------------- | Enter specific files |-------------------------------------------------------------------------- | */ - "files" => [ + 'files' => [ ], - + /* |-------------------------------------------------------------------------- | The folders the package excludes from scanning |-------------------------------------------------------------------------- | */ - "exclude" => [ - "storage", + 'exclude' => [ + 'storage', ], - + /* |-------------------------------------------------------------------------- | The files the package uses to scan for translation keys |-------------------------------------------------------------------------- | */ - "file_extension" => [ + 'file_extension' => [ '*.php', '*.js', - ] + ], ], - + /* |-------------------------------------------------------------------------- | The methods used to translate keys |-------------------------------------------------------------------------- | */ - "translation_methods" => [ + 'translation_methods' => [ '\$t', 'i18n.t', '@lang', diff --git a/database/seeders/ProvinceTableSeeder.php b/database/seeders/ProvinceTableSeeder.php index 7366cb3..0e79c87 100644 --- a/database/seeders/ProvinceTableSeeder.php +++ b/database/seeders/ProvinceTableSeeder.php @@ -3,7 +3,6 @@ namespace Database\Seeders; use App\Models\System\Location\Province; -use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; class ProvinceTableSeeder extends Seeder diff --git a/lang/tk.json b/lang/tk.json index af7fd9c..d222429 100644 --- a/lang/tk.json +++ b/lang/tk.json @@ -14,9 +14,9 @@ "Completed": "Tamamlanan", "Contact data": "Habarlaşmak üçin maglumatlar", "Current Residence": "Häzirki ýaşaýyş ýeri", - "Name": "Adyňyz", + "Name": "Ady", "Patronic name": "Ataňyzyň ady", - "Surname": "Familiýaňyz", + "Surname": "Familiýa", "Dashoguz": "Daşoguz", "Date of birth": "Doglan gün", "Divorced": "Aýrylşan", @@ -61,9 +61,10 @@ "Phone Additional": "Telefon goşmaça", "Position": "Positionerleşişi", "Processing": "Gaýtadan işlemek", - "Province": "Welaýat", - "Provinces": "Welaýatlar", + "Province": "Etrap", + "Provinces": "Etraplar", "Region": "Welaýat", + "Regions": "Welaýatlar", "Registered": "Bellige alyndy", "Residence (passport)": "Ýazgy edilen salgyňyz", "Role": "Rol",