Compare commits
11 Commits
736e3bef18
...
e19372eed1
| Author | SHA1 | Date | |
|---|---|---|---|
| e19372eed1 | |||
| 58725db7ea | |||
| aff57eb574 | |||
| 47c81932fd | |||
| 02d94e193e | |||
| 02188c46fd | |||
| 1c9e9c3bed | |||
| 9e19abb2d9 | |||
| ff98b708b5 | |||
| d8c340028c | |||
| 85df3ec412 |
@@ -1,275 +0,0 @@
|
||||
### DB architecture guidelines
|
||||
|
||||
#### Overview
|
||||
|
||||
...
|
||||
|
||||
#### Core Concepts
|
||||
|
||||
- ....
|
||||
|
||||
#### User table
|
||||
- # Model App\Models\User
|
||||
- # Migrations database/migrations/0001_01_01_000000_create_users_table.php
|
||||
- # Seeder database/seeders/UsersTableSeeder.php
|
||||
...
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- username
|
||||
- first_name
|
||||
- last_name
|
||||
- phone
|
||||
- phone_verified_at
|
||||
- locale
|
||||
- password_must_be_changed
|
||||
- options
|
||||
- email_verified_at
|
||||
- remember_token
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- username (unique)
|
||||
- phone (unique)
|
||||
- email (unique)
|
||||
- email_verified_at
|
||||
- remember_token
|
||||
|
||||
##### Relations
|
||||
- roles (Role model)
|
||||
|
||||
|
||||
|
||||
#### Branch table
|
||||
- # Model App\Modules\Branch\Models\Branch
|
||||
- # Migrations app/Modules/Branch/Database/Migrations/2025_10_09_190439_create_branches_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- unique_code
|
||||
- name (json)
|
||||
- address (json)
|
||||
- region (string)[in: ag, mr, ah, ak, dz, bn, lb]
|
||||
- province_id
|
||||
- phone_numbers (json)
|
||||
- billing_username
|
||||
- billing_password
|
||||
- billing_swift_username
|
||||
- billing_swift_password
|
||||
- billing_visa_master_username
|
||||
- billing_visa_master_password
|
||||
- billing_sber_username
|
||||
- billing_sber_password
|
||||
- active
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- unique_code (unique)
|
||||
- region
|
||||
|
||||
##### Relations
|
||||
- province (Province model)
|
||||
- users (User model)
|
||||
|
||||
#### Province table
|
||||
- # Model App\Modules\Province\Models\Province
|
||||
- # Migrations app/Modules/Province/Database/Migrations/2025_10_09_185951_create_provinces_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- region
|
||||
- name (json)
|
||||
- active
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- None
|
||||
|
||||
##### Relations
|
||||
- None
|
||||
|
||||
#### LoanOrderRequiredDocs table
|
||||
- # Model App\Modules\LoanOrder\Models\LoanOrderRequiredDocs
|
||||
- # Migrations app/Modules/LoanOrder/Database/Migrations/2025_10_09_211513_create_loan_order_required_docs_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- name (text)
|
||||
- value (text)
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- None
|
||||
|
||||
##### Relations
|
||||
- loanOrders (LoanOrder model)
|
||||
|
||||
#### LoanType table
|
||||
- # Model App\Modules\LoanOrder\Models\LoanType
|
||||
- # Migrations app/Modules/LoanOrder/Database/Migrations/2025_10_09_183412_create_loan_types_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- name (json)
|
||||
- tax
|
||||
- maturity
|
||||
- notes
|
||||
- active
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- None
|
||||
|
||||
##### Relations
|
||||
- None
|
||||
|
||||
#### LoanOrder table
|
||||
- # Model App\Modules\LoanOrder\Models\LoanOrder
|
||||
- # Migrations app/Modules/LoanOrder/Database/Migrations/2025_10_09_220443_create_loan_orders_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- unique_id
|
||||
- source
|
||||
- user_id
|
||||
- loan_type
|
||||
- region
|
||||
- branch_id
|
||||
- customer_name
|
||||
- customer_surname
|
||||
- customer_patronic_name
|
||||
- passport_address
|
||||
- real_address
|
||||
- passport_serie
|
||||
- passport_id
|
||||
- passport_given_at
|
||||
- passport_given_by
|
||||
- born_place
|
||||
- born_at
|
||||
- email
|
||||
- phone
|
||||
- phone_additional
|
||||
- phone_home
|
||||
- work_region
|
||||
- work_province_id
|
||||
- work_company
|
||||
- work_company_accountant_number
|
||||
- work_started_at
|
||||
- work_salary
|
||||
- work_position
|
||||
- education
|
||||
- marriage_status
|
||||
- passport_one (text)
|
||||
- passport_two (text)
|
||||
- passport_three (text)
|
||||
- passport_four (text)
|
||||
- loan_amount
|
||||
- card_number
|
||||
- card_name
|
||||
- card_month
|
||||
- card_year
|
||||
- guarantor_name
|
||||
- guarantor_surname
|
||||
- guarantor_patronic_name
|
||||
- guarantor_passport_serie
|
||||
- guarantor_passport_id
|
||||
- guarantor_card_number
|
||||
- guarantor_card_name
|
||||
- guarantor_card_month
|
||||
- guarantor_card_year
|
||||
- guarantor_note
|
||||
- guarantor_2_name
|
||||
- guarantor_2_surname
|
||||
- guarantor_2_patronic_name
|
||||
- guarantor_2_passport_serie
|
||||
- guarantor_2_passport_id
|
||||
- guarantor_2_card_number
|
||||
- guarantor_2_card_name
|
||||
- guarantor_2_card_month
|
||||
- guarantor_2_card_year
|
||||
- guarantor_2_note
|
||||
- loan_card_number
|
||||
- loan_card_name
|
||||
- loan_card_month
|
||||
- loan_card_year
|
||||
- loan_order_required_doc_id
|
||||
- status
|
||||
- satisfiable
|
||||
- notes (text)
|
||||
- created_at
|
||||
- updated_at
|
||||
- deleted_at
|
||||
|
||||
##### Indexes
|
||||
- unique_id (unique)
|
||||
- source
|
||||
- customer_name
|
||||
- customer_surname
|
||||
- passport_serie
|
||||
- passport_id
|
||||
- phone
|
||||
- work_region
|
||||
- loan_amount
|
||||
|
||||
##### Relations
|
||||
- loanType (LoanType model)
|
||||
- branch (Branch model)
|
||||
- workProvince (Province model)
|
||||
- user (User model)
|
||||
- requiredDocs (LoanOrderRequiredDocs model)
|
||||
|
||||
#### OtpVerification table
|
||||
- # Model App\Modules\OtpVerification\Models\OtpVerification
|
||||
- # Migrations app/Modules/OtpVerification/Database/Migrations/2025_09_22_164249_create_otp_verifications_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- username
|
||||
- code
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- None
|
||||
|
||||
##### Relations
|
||||
- None
|
||||
|
||||
#### AuthEvent table
|
||||
- # Model App\Modules\BaseAuth\Models\AuthEvent
|
||||
- # Migrations app/Modules/BaseAuth/Database/Migrations/2025_10_07_181725_create_auth_events_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- name
|
||||
- request_method
|
||||
- ip
|
||||
- user_agent
|
||||
- target_url
|
||||
- options (json)
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- name
|
||||
- request_method
|
||||
- ip
|
||||
- user_agent
|
||||
- target_url
|
||||
|
||||
##### Relations
|
||||
- None
|
||||
|
||||
|
||||
@@ -643,279 +643,4 @@ Use the global helper functions to interact with modules throughout the applicat
|
||||
```php
|
||||
$path = modules_path('Invoice/Database'); // app/Modules/Invoice/Database
|
||||
```
|
||||
|
||||
|
||||
=== .ai/db-architecture rules ===
|
||||
|
||||
### DB architecture guidelines
|
||||
|
||||
#### Overview
|
||||
|
||||
...
|
||||
|
||||
#### Core Concepts
|
||||
|
||||
- ....
|
||||
|
||||
#### User table
|
||||
- # Model App\Models\User
|
||||
- # Migrations database/migrations/0001_01_01_000000_create_users_table.php
|
||||
- # Seeder database/seeders/UsersTableSeeder.php
|
||||
...
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- username
|
||||
- first_name
|
||||
- last_name
|
||||
- phone
|
||||
- phone_verified_at
|
||||
- locale
|
||||
- password_must_be_changed
|
||||
- options
|
||||
- email_verified_at
|
||||
- remember_token
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- username (unique)
|
||||
- phone (unique)
|
||||
- email (unique)
|
||||
- email_verified_at
|
||||
- remember_token
|
||||
|
||||
##### Relations
|
||||
- roles (Role model)
|
||||
|
||||
#### Branch table
|
||||
- # Model App\Modules\Branch\Models\Branch
|
||||
- # Migrations app/Modules/Branch/Database/Migrations/2025_10_09_190439_create_branches_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- unique_code
|
||||
- name (json)
|
||||
- address (json)
|
||||
- region (string)[in: ag, mr, ah, ak, dz, bn, lb]
|
||||
- province_id
|
||||
- phone_numbers (json)
|
||||
- billing_username
|
||||
- billing_password
|
||||
- billing_swift_username
|
||||
- billing_swift_password
|
||||
- billing_visa_master_username
|
||||
- billing_visa_master_password
|
||||
- billing_sber_username
|
||||
- billing_sber_password
|
||||
- active
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- unique_code (unique)
|
||||
- region
|
||||
|
||||
##### Relations
|
||||
- province (Province model)
|
||||
- users (User model)
|
||||
|
||||
#### Province table
|
||||
- # Model App\Modules\Province\Models\Province
|
||||
- # Migrations app/Modules/Province/Database/Migrations/2025_10_09_185951_create_provinces_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- region
|
||||
- name (json)
|
||||
- active
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- None
|
||||
|
||||
##### Relations
|
||||
- None
|
||||
|
||||
#### LoanOrderRequiredDocs table
|
||||
- # Model App\Modules\LoanOrder\Models\LoanOrderRequiredDocs
|
||||
- # Migrations app/Modules/LoanOrder/Database/Migrations/2025_10_09_211513_create_loan_order_required_docs_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- name (text)
|
||||
- value (text)
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- None
|
||||
|
||||
##### Relations
|
||||
- loanOrders (LoanOrder model)
|
||||
|
||||
#### LoanType table
|
||||
- # Model App\Modules\LoanOrder\Models\LoanType
|
||||
- # Migrations app/Modules/LoanOrder/Database/Migrations/2025_10_09_183412_create_loan_types_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- name (json)
|
||||
- tax
|
||||
- maturity
|
||||
- notes
|
||||
- active
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- None
|
||||
|
||||
##### Relations
|
||||
- None
|
||||
|
||||
#### LoanOrder table
|
||||
- # Model App\Modules\LoanOrder\Models\LoanOrder
|
||||
- # Migrations app/Modules/LoanOrder/Database/Migrations/2025_10_09_220443_create_loan_orders_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- unique_id
|
||||
- source
|
||||
- user_id
|
||||
- loan_type
|
||||
- region
|
||||
- branch_id
|
||||
- customer_name
|
||||
- customer_surname
|
||||
- customer_patronic_name
|
||||
- passport_address
|
||||
- real_address
|
||||
- passport_serie
|
||||
- passport_id
|
||||
- passport_given_at
|
||||
- passport_given_by
|
||||
- born_place
|
||||
- born_at
|
||||
- email
|
||||
- phone
|
||||
- phone_additional
|
||||
- phone_home
|
||||
- work_region
|
||||
- work_province_id
|
||||
- work_company
|
||||
- work_company_accountant_number
|
||||
- work_started_at
|
||||
- work_salary
|
||||
- work_position
|
||||
- education
|
||||
- marriage_status
|
||||
- passport_one (text)
|
||||
- passport_two (text)
|
||||
- passport_three (text)
|
||||
- passport_four (text)
|
||||
- loan_amount
|
||||
- card_number
|
||||
- card_name
|
||||
- card_month
|
||||
- card_year
|
||||
- guarantor_name
|
||||
- guarantor_surname
|
||||
- guarantor_patronic_name
|
||||
- guarantor_passport_serie
|
||||
- guarantor_passport_id
|
||||
- guarantor_card_number
|
||||
- guarantor_card_name
|
||||
- guarantor_card_month
|
||||
- guarantor_card_year
|
||||
- guarantor_note
|
||||
- guarantor_2_name
|
||||
- guarantor_2_surname
|
||||
- guarantor_2_patronic_name
|
||||
- guarantor_2_passport_serie
|
||||
- guarantor_2_passport_id
|
||||
- guarantor_2_card_number
|
||||
- guarantor_2_card_name
|
||||
- guarantor_2_card_month
|
||||
- guarantor_2_card_year
|
||||
- guarantor_2_note
|
||||
- loan_card_number
|
||||
- loan_card_name
|
||||
- loan_card_month
|
||||
- loan_card_year
|
||||
- loan_order_required_doc_id
|
||||
- status
|
||||
- satisfiable
|
||||
- notes (text)
|
||||
- created_at
|
||||
- updated_at
|
||||
- deleted_at
|
||||
|
||||
##### Indexes
|
||||
- unique_id (unique)
|
||||
- source
|
||||
- customer_name
|
||||
- customer_surname
|
||||
- passport_serie
|
||||
- passport_id
|
||||
- phone
|
||||
- work_region
|
||||
- loan_amount
|
||||
|
||||
##### Relations
|
||||
- loanType (LoanType model)
|
||||
- branch (Branch model)
|
||||
- workProvince (Province model)
|
||||
- user (User model)
|
||||
- requiredDocs (LoanOrderRequiredDocs model)
|
||||
|
||||
#### OtpVerification table
|
||||
- # Model App\Modules\OtpVerification\Models\OtpVerification
|
||||
- # Migrations app/Modules/OtpVerification/Database/Migrations/2025_09_22_164249_create_otp_verifications_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- username
|
||||
- code
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- None
|
||||
|
||||
##### Relations
|
||||
- None
|
||||
|
||||
#### AuthEvent table
|
||||
- # Model App\Modules\BaseAuth\Models\AuthEvent
|
||||
- # Migrations app/Modules/BaseAuth/Database/Migrations/2025_10_07_181725_create_auth_events_table.php
|
||||
- # Seeder Not found
|
||||
|
||||
##### Structure
|
||||
- id
|
||||
- name
|
||||
- request_method
|
||||
- ip
|
||||
- user_agent
|
||||
- target_url
|
||||
- options (json)
|
||||
- created_at
|
||||
- updated_at
|
||||
|
||||
##### Indexes
|
||||
- name
|
||||
- request_method
|
||||
- ip
|
||||
- user_agent
|
||||
- target_url
|
||||
|
||||
##### Relations
|
||||
- None
|
||||
</laravel-boost-guidelines>
|
||||
|
||||
85
app/Filament/Clusters/Cards/CardOrders/CardOrderResource.php
Normal file
85
app/Filament/Clusters/Cards/CardOrders/CardOrderResource.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Cards\CardOrders;
|
||||
|
||||
use App\Filament\Clusters\Cards\CardOrders\Pages\CreateCardOrder;
|
||||
use App\Filament\Clusters\Cards\CardOrders\Pages\EditCardOrder;
|
||||
use App\Filament\Clusters\Cards\CardOrders\Pages\ListCardOrders;
|
||||
use App\Filament\Clusters\Cards\CardOrders\Schemas\CardOrderForm;
|
||||
use App\Filament\Clusters\Cards\CardOrders\Tables\CardOrdersTable;
|
||||
use App\Filament\Clusters\Cards\CardsCluster;
|
||||
use App\Modules\CardOrder\Models\CardOrder;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class CardOrderResource extends Resource
|
||||
{
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static ?string $model = CardOrder::class;
|
||||
|
||||
protected static ?string $cluster = CardsCluster::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentPlus;
|
||||
|
||||
protected static string|BackedEnum|null $activeNavigationIcon = Heroicon::DocumentPlus;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'unique_id';
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('New card order');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('Card order');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('Card orders');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return CardOrderForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return CardOrdersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListCardOrders::route('/'),
|
||||
'create' => CreateCardOrder::route('/create'),
|
||||
'edit' => EditCardOrder::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Builder<\App\Modules\CardOrder\Models\CardOrder>
|
||||
*/
|
||||
public static function getRecordRouteBindingEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getRecordRouteBindingEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Cards\CardOrders\Pages;
|
||||
|
||||
use App\Filament\Clusters\Cards\CardOrders\CardOrderResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCardOrder extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CardOrderResource::class;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Cards\CardOrders\Pages;
|
||||
|
||||
use App\Filament\Clusters\Cards\CardOrders\CardOrderResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\ForceDeleteAction;
|
||||
use Filament\Actions\RestoreAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCardOrder extends EditRecord
|
||||
{
|
||||
protected static string $resource = CardOrderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
ForceDeleteAction::make(),
|
||||
RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Cards\CardOrders\Pages;
|
||||
|
||||
use App\Filament\Clusters\Cards\CardOrders\CardOrderResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListCardOrders extends ListRecords
|
||||
{
|
||||
protected static string $resource = CardOrderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
267
app/Filament/Clusters/Cards/CardOrders/Schemas/CardOrderForm.php
Normal file
267
app/Filament/Clusters/Cards/CardOrders/Schemas/CardOrderForm.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Cards\CardOrders\Schemas;
|
||||
|
||||
use App\Modules\Country\Repositories\CountryRepository;
|
||||
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
||||
use App\Modules\PhoneNumberVerification\Rules\PhoneNumberVerificationRule;
|
||||
use App\Modules\Region\Repositories\RegionRepository;
|
||||
use App\Modules\TurkmenPassport\Repositories\TurkmenPassportRepository;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Fieldset;
|
||||
use Filament\Schemas\Components\FusedGroup;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Wizard;
|
||||
use Filament\Schemas\Components\Wizard\Step;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CardOrderForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Hidden::make('user_id')->default(Auth::id()),
|
||||
|
||||
Section::make(__('New loan order'))
|
||||
->columnSpan(4)
|
||||
->columns(4)
|
||||
->components([
|
||||
Select::make('status')
|
||||
->label(__('Status'))
|
||||
->options(OrderStatusRepository::statusValues())
|
||||
->default(OrderStatusRepository::defaultStatus())
|
||||
->native(false)
|
||||
->required()
|
||||
->columnSpan(2),
|
||||
|
||||
Toggle::make('paid')
|
||||
->label(__('Paid'))
|
||||
->inline(false)
|
||||
->required(),
|
||||
|
||||
RichEditor::make('notes')
|
||||
->label(__('Bellik'))
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
|
||||
Wizard::make([
|
||||
Step::make(__('Loan & Bank'))
|
||||
->schema([
|
||||
Fieldset::make(__('Loan type and amount'))
|
||||
->schema([
|
||||
Select::make('card_state_id')
|
||||
->relationship('cardState', 'name')
|
||||
->label(__('Card state'))
|
||||
->native(false)
|
||||
->required(),
|
||||
|
||||
Select::make('card_type_id')
|
||||
->relationship('cardType', 'name')
|
||||
->label(__('Card type'))
|
||||
->native(false)
|
||||
->required(),
|
||||
]),
|
||||
|
||||
Fieldset::make(__('Location'))
|
||||
->schema([
|
||||
Select::make('region')
|
||||
->label(__('Region'))
|
||||
->options(RegionRepository::values())
|
||||
->live()
|
||||
->afterStateUpdated(fn (callable $set) => $set('branch_id', null))
|
||||
->required(),
|
||||
|
||||
Select::make('branch_id')
|
||||
->label(__('Branch'))
|
||||
->relationship('branch', 'name', function ($query, callable $get) {
|
||||
$region = $get('region');
|
||||
if ($region) {
|
||||
$query->where('region', $region);
|
||||
}
|
||||
})
|
||||
->required(),
|
||||
]),
|
||||
]),
|
||||
Step::make(__('Personal information'))
|
||||
->columns(8)
|
||||
->schema([
|
||||
TextInput::make('customer_name')
|
||||
->label(__('Name'))
|
||||
->columnSpan(2)
|
||||
->default(user()->first_name)
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autocomplete(Str::random(10)),
|
||||
|
||||
TextInput::make('customer_surname')
|
||||
->label(__('Surname'))
|
||||
->columnSpan(2)
|
||||
->default(user()->last_name)
|
||||
->required()
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('customer_patronic_name')
|
||||
->label(__('Patronic name'))
|
||||
->columnSpan(2)
|
||||
->default(user()->getOption('patronic_name'))
|
||||
->maxLength(255),
|
||||
|
||||
DatePicker::make('born_at')
|
||||
->displayFormat('d.m.Y')
|
||||
->label(__('Birth date'))
|
||||
->native(false)
|
||||
->columnSpan(2)
|
||||
->default(user()->getOption('born_at'))
|
||||
->required()
|
||||
->beforeOrEqual('today'),
|
||||
|
||||
FusedGroup::make([
|
||||
Select::make('passport_serie')
|
||||
->label(__('Passport serie'))
|
||||
->options(TurkmenPassportRepository::values())
|
||||
->native(false)
|
||||
->required()
|
||||
->default(user()->getOption('passport_serie'))
|
||||
->columnSpan(1),
|
||||
|
||||
TextInput::make('passport_id')
|
||||
->label(__('Passport number'))
|
||||
->required()
|
||||
->columnSpan(1)
|
||||
->default(user()->getOption('passport_id'))
|
||||
->mask('999999'),
|
||||
])
|
||||
->columnSpan(3)
|
||||
->label(__('Passport serie and number'))
|
||||
->columns(2),
|
||||
|
||||
DatePicker::make('passport_given_at')
|
||||
->label(__('Passport given date'))
|
||||
->columnSpan(2)
|
||||
->displayFormat('d.m.Y')
|
||||
->native(false)
|
||||
->closeOnDateSelection()
|
||||
->default(user()->getOption('passport_given_at'))
|
||||
->beforeOrEqual('today')
|
||||
->required(),
|
||||
|
||||
TextInput::make('born_place')
|
||||
->columnSpan(3)
|
||||
->label(__('Born place (passport)'))
|
||||
->default(user()->getOption('born_place'))
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
|
||||
TextInput::make('passport_given_by')
|
||||
->label(__('Passport given by'))
|
||||
->columnSpan(4)
|
||||
->default(user()->getOption('passport_given_by'))
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
|
||||
TextInput::make('passport_address')
|
||||
->columnSpan(4)
|
||||
->label(__('Proscription for home'))
|
||||
->default(user()->getOption('passport_address'))
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
|
||||
TextInput::make('real_address')
|
||||
->label(__('Current home address'))
|
||||
->columnSpan(4)
|
||||
->default(user()->getOption('real_address'))
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
|
||||
TextInput::make('phone')
|
||||
->label(__('Phone'))
|
||||
->required()
|
||||
->mask('99 99 99 99')
|
||||
->prefix('+993')
|
||||
->default(user()->phone)
|
||||
->rules([
|
||||
new PhoneNumberVerificationRule,
|
||||
])
|
||||
->columnSpan(2),
|
||||
|
||||
TextInput::make('phone_additional')
|
||||
->label(__('Additional phone'))
|
||||
->mask('99 99 99 99')
|
||||
->prefix('+993')
|
||||
->default(user()->getOption('phone_additional'))
|
||||
->rules([
|
||||
new PhoneNumberVerificationRule,
|
||||
])
|
||||
->columnSpan(2),
|
||||
|
||||
TextInput::make('job_location')
|
||||
->label(__('Work location and your position'))
|
||||
->columnSpan(6)
|
||||
->required(),
|
||||
|
||||
Select::make('citizenship')
|
||||
->label(__('Citizenship'))
|
||||
->options(CountryRepository::values())
|
||||
->default('TM')
|
||||
->columnSpan(2)
|
||||
->required(),
|
||||
]),
|
||||
Step::make(__('Pasport files'))
|
||||
->columns(4)
|
||||
->schema([
|
||||
FileUpload::make('passport_one')
|
||||
->label(__('Passport (page 1)'))
|
||||
->image()
|
||||
->maxSize(4096)
|
||||
->required()
|
||||
->columnSpan(2),
|
||||
|
||||
FileUpload::make('passport_two')
|
||||
->label(__('Passport (page 2-3)'))
|
||||
->image()
|
||||
->maxSize(4096)
|
||||
->required()
|
||||
->columnSpan(2),
|
||||
|
||||
FileUpload::make('passport_three')
|
||||
->label(__('Passport (page 8-9)'))
|
||||
->image()
|
||||
->maxSize(4096)
|
||||
->required()
|
||||
->columnSpan(2),
|
||||
|
||||
FileUpload::make('passport_four')
|
||||
->label(__('Passport (page 32)'))
|
||||
->image()
|
||||
->maxSize(4096)
|
||||
->required()
|
||||
->columnSpan(2),
|
||||
])->columnSpan(4),
|
||||
])->columnSpanFull(),
|
||||
|
||||
// Textarea::make('passport_one')
|
||||
// ->required()
|
||||
// ->columnSpanFull(),
|
||||
// Textarea::make('passport_two')
|
||||
// ->required()
|
||||
// ->columnSpanFull(),
|
||||
// Textarea::make('passport_three')
|
||||
// ->required()
|
||||
// ->columnSpanFull(),
|
||||
// Textarea::make('passport_four')
|
||||
// ->required()
|
||||
// ->columnSpanFull(),
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Cards\CardOrders\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\ForceDeleteBulkAction;
|
||||
use Filament\Actions\RestoreBulkAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\TrashedFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CardOrdersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('unique_id')
|
||||
->searchable(),
|
||||
TextColumn::make('cardState.name')
|
||||
->searchable(),
|
||||
TextColumn::make('cardType.name')
|
||||
->searchable(),
|
||||
TextColumn::make('region')
|
||||
->searchable(),
|
||||
TextColumn::make('branch.name')
|
||||
->searchable(),
|
||||
TextColumn::make('customer_name')
|
||||
->searchable(),
|
||||
TextColumn::make('customer_surname')
|
||||
->searchable(),
|
||||
TextColumn::make('customer_patronic_name')
|
||||
->searchable(),
|
||||
TextColumn::make('born_at')
|
||||
->date()
|
||||
->sortable(),
|
||||
TextColumn::make('old_surname')
|
||||
->searchable(),
|
||||
TextColumn::make('citizenship')
|
||||
->searchable(),
|
||||
TextColumn::make('passport_serie')
|
||||
->searchable(),
|
||||
TextColumn::make('passport_id')
|
||||
->searchable(),
|
||||
TextColumn::make('passport_given_at')
|
||||
->date()
|
||||
->sortable(),
|
||||
TextColumn::make('passport_given_by')
|
||||
->searchable(),
|
||||
TextColumn::make('born_place')
|
||||
->searchable(),
|
||||
TextColumn::make('job_location')
|
||||
->searchable(),
|
||||
TextColumn::make('passport_address')
|
||||
->searchable(),
|
||||
TextColumn::make('real_address')
|
||||
->searchable(),
|
||||
TextColumn::make('phone')
|
||||
->searchable(),
|
||||
TextColumn::make('phone_additional')
|
||||
->searchable(),
|
||||
TextColumn::make('status')
|
||||
->searchable(),
|
||||
TextColumn::make('user.name')
|
||||
->searchable(),
|
||||
IconColumn::make('paid')
|
||||
->boolean(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
TrashedFilter::make(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
ForceDeleteBulkAction::make(),
|
||||
RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
133
app/Filament/Clusters/Cards/Cards/CardResource.php
Normal file
133
app/Filament/Clusters/Cards/Cards/CardResource.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Cards\Cards;
|
||||
|
||||
use App\Filament\Clusters\Cards\Cards\Pages\ManageCards;
|
||||
use App\Filament\Clusters\Cards\CardsCluster;
|
||||
use App\Modules\AppHelpers\Repositories\DateHelper;
|
||||
use App\Modules\Card\Models\Card;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CardResource extends Resource
|
||||
{
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static ?string $model = Card::class;
|
||||
|
||||
protected static ?string $cluster = CardsCluster::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCreditCard;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('My cards');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('Card');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('Cards');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->columns(3)
|
||||
->components([
|
||||
Hidden::make('user_id')
|
||||
->default(fn () => user()->id),
|
||||
|
||||
TextInput::make('number')
|
||||
->label(__('Card number'))
|
||||
->mask('9999 9999 9999 9999')
|
||||
->columnSpan('1')
|
||||
->required(),
|
||||
|
||||
Select::make('month')
|
||||
->label(__('Card month'))
|
||||
->options(DateHelper::staticNumberMonths())
|
||||
->native(false)
|
||||
->columnSpan('1')
|
||||
->required(),
|
||||
|
||||
Select::make('year')
|
||||
->label(__('Card year'))
|
||||
->options(DateHelper::staticNumberYears())
|
||||
->native(false)
|
||||
->columnSpan('1')
|
||||
->required(),
|
||||
|
||||
TextInput::make('name')
|
||||
->label(__('Card name'))
|
||||
->maxLength(255)
|
||||
->columnSpanFull()
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('number')
|
||||
->label(__('Card number'))
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('name')
|
||||
->label(__('Card name'))
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('month')
|
||||
->label(__('Card month'))
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('year')
|
||||
->label(__('Card year'))
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageCards::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Clusters/Cards/Cards/Pages/ManageCards.php
Normal file
19
app/Filament/Clusters/Cards/Cards/Pages/ManageCards.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Cards\Cards\Pages;
|
||||
|
||||
use App\Filament\Clusters\Cards\Cards\CardResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageCards extends ManageRecords
|
||||
{
|
||||
protected static string $resource = CardResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
20
app/Filament/Clusters/Cards/CardsCluster.php
Normal file
20
app/Filament/Clusters/Cards/CardsCluster.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Cards;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Clusters\Cluster;
|
||||
use Filament\Pages\Enums\SubNavigationPosition;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class CardsCluster extends Cluster
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCreditCard;
|
||||
|
||||
protected static ?SubNavigationPosition $subNavigationPosition = SubNavigationPosition::Top;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('Cards');
|
||||
}
|
||||
}
|
||||
@@ -34,12 +34,12 @@ class LoanResource extends Resource
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('Karz');
|
||||
return __('Loan');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('Karzlar');
|
||||
return __('Loans');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
|
||||
@@ -10,7 +10,6 @@ use Filament\Support\Icons\Heroicon;
|
||||
class LoansCluster extends Cluster
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBanknotes;
|
||||
// protected static string|BackedEnum|null $activeNavigationIcon = Heroicon::Banknotes;
|
||||
|
||||
protected static ?SubNavigationPosition $subNavigationPosition = SubNavigationPosition::Top;
|
||||
|
||||
|
||||
132
app/Filament/Clusters/Settings/CardStates/CardStateResource.php
Normal file
132
app/Filament/Clusters/Settings/CardStates/CardStateResource.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\CardStates;
|
||||
|
||||
use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
|
||||
use App\Filament\Clusters\Settings\CardStates\Pages\ManageCardStates;
|
||||
use App\Filament\Clusters\Settings\SettingsCluster;
|
||||
use App\Modules\CardOrder\Models\CardState;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CardStateResource extends Resource
|
||||
{
|
||||
protected static ?string $model = CardState::class;
|
||||
|
||||
protected static ?string $cluster = SettingsCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedClipboardDocumentList;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('Cards');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('Card state');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('Card states');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->columns(2)
|
||||
->components([
|
||||
TranslatableTabs::make('nam')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label(__('Card state'))
|
||||
->columnSpan(1)
|
||||
->required(),
|
||||
]),
|
||||
|
||||
Section::make(__('General'))
|
||||
->columns(6)
|
||||
->schema([
|
||||
TextInput::make('price')
|
||||
->label(__('Price'))
|
||||
->columnSpan(4)
|
||||
->required(),
|
||||
|
||||
Toggle::make('active')
|
||||
->label(__('Active'))
|
||||
->default(true)
|
||||
->inline(false)
|
||||
->columnSpan(2)
|
||||
->required(),
|
||||
|
||||
TextInput::make('notes')
|
||||
->label(__('Notes'))
|
||||
->columnSpanFull()
|
||||
->default(null),
|
||||
]),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('price')
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('notes'),
|
||||
|
||||
IconColumn::make('active')
|
||||
->boolean(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageCardStates::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\CardStates\Pages;
|
||||
|
||||
use App\Filament\Clusters\Settings\CardStates\CardStateResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageCardStates extends ManageRecords
|
||||
{
|
||||
protected static string $resource = CardStateResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
130
app/Filament/Clusters/Settings/CardTypes/CardTypeResource.php
Normal file
130
app/Filament/Clusters/Settings/CardTypes/CardTypeResource.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\CardTypes;
|
||||
|
||||
use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
|
||||
use App\Filament\Clusters\Settings\CardTypes\Pages\ManageCardTypes;
|
||||
use App\Filament\Clusters\Settings\SettingsCluster;
|
||||
use App\Modules\CardOrder\Models\CardType;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CardTypeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = CardType::class;
|
||||
|
||||
protected static ?string $cluster = SettingsCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedSwatch;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('Cards');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('Card type');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('Card types');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TranslatableTabs::make('name')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label(__('Card state'))
|
||||
->columnSpan(1)
|
||||
->required(),
|
||||
]),
|
||||
|
||||
Section::make(__('General'))
|
||||
->columns(6)
|
||||
->schema([
|
||||
TextInput::make('price')
|
||||
->label(__('Price'))
|
||||
->columnSpan(4)
|
||||
->required(),
|
||||
|
||||
Toggle::make('active')
|
||||
->label(__('Active'))
|
||||
->default(true)
|
||||
->inline(false)
|
||||
->columnSpan(2)
|
||||
->required(),
|
||||
|
||||
TextInput::make('notes')
|
||||
->label(__('Notes'))
|
||||
->columnSpanFull()
|
||||
->default(null),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('price')
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('notes'),
|
||||
|
||||
IconColumn::make('active')
|
||||
->boolean(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageCardTypes::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\CardTypes\Pages;
|
||||
|
||||
use App\Filament\Clusters\Settings\CardTypes\CardTypeResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageCardTypes extends ManageRecords
|
||||
{
|
||||
protected static string $resource = CardTypeResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ function logDB(): void
|
||||
*/
|
||||
function user(): User
|
||||
{
|
||||
abort_unless(Auth::check(), 'not-authenticated');
|
||||
abort_unless(Auth::check(), 401, 'Unauthorized');
|
||||
|
||||
/** @var \App\Models\User */
|
||||
$user = Auth::user();
|
||||
|
||||
@@ -29,7 +29,10 @@ class EnsureProfileIsFilled
|
||||
$profilePageClass = EditProfilePage::class; // <-- !! IMPORTANT: Change to your page
|
||||
$profilePageUrl = $profilePageClass::getUrl();
|
||||
|
||||
$panelId = filament()->getCurrentPanel()->getId();
|
||||
/** @var \Filament\Panel */
|
||||
$panel = filament()->getCurrentPanel();
|
||||
|
||||
$panelId = $panel->getId();
|
||||
$logoutRouteName = "filament.{$panelId}.auth.logout";
|
||||
|
||||
// 4. Check for 'safe' conditions
|
||||
|
||||
@@ -23,13 +23,14 @@ class UserPassportFields extends Component implements HasForms
|
||||
use HasSort;
|
||||
use InteractsWithForms;
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
public ?array $data = [];
|
||||
|
||||
protected static int $sort = 10;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->form->fill();
|
||||
$this->form->fill(); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
@@ -160,7 +161,7 @@ class UserPassportFields extends Component implements HasForms
|
||||
{
|
||||
try {
|
||||
/** @var array{first_name: string, last_name: string, patronic_name: null|string, born_at: string, phone: string, email: string, passport_serie: string, passport_id: string, passport_given_at: string, born_place: string, passport_given_by: string, passport_address: string, real_address: string} */
|
||||
$data = $this->form->getState();
|
||||
$data = $this->form->getState(); // @phpstan-ignore-line
|
||||
|
||||
user()->update([
|
||||
'first_name' => $data['first_name'],
|
||||
|
||||
142
app/Modules/AppHelpers/Repositories/DateHelper.php
Normal file
142
app/Modules/AppHelpers/Repositories/DateHelper.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\AppHelpers\Repositories;
|
||||
|
||||
class DateHelper
|
||||
{
|
||||
/**
|
||||
* Month as number
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public static function monthsAsNumber(): array
|
||||
{
|
||||
$month = [];
|
||||
|
||||
for ($m = 1; $m <= 12; $m++) {
|
||||
$month[] = str_pad(strval($m), 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
return $month;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static numbers for months
|
||||
*
|
||||
* @return array<int|string, string>
|
||||
*/
|
||||
public static function staticNumberMonths(): array
|
||||
{
|
||||
return [
|
||||
'01' => '01',
|
||||
'02' => '02',
|
||||
'03' => '03',
|
||||
'04' => '04',
|
||||
'05' => '05',
|
||||
'06' => '06',
|
||||
'07' => '07',
|
||||
'08' => '08',
|
||||
'09' => '09',
|
||||
'10' => '10',
|
||||
'11' => '11',
|
||||
'12' => '12',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Years until
|
||||
*
|
||||
* @param int|int $max
|
||||
* @return array<string|int, string|int>
|
||||
*/
|
||||
public static function yearsUntil(int $max = 50): array
|
||||
{
|
||||
$years = [];
|
||||
|
||||
$currentData = 2024;
|
||||
|
||||
for ($i = 0; $i <= $max; $i++) {
|
||||
$years[] = intval($currentData) + $i;
|
||||
}
|
||||
|
||||
return $years;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static numbers for years
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public static function staticNumberYears(): array
|
||||
{
|
||||
return [
|
||||
'2024' => '2024',
|
||||
'2025' => '2025',
|
||||
'2026' => '2026',
|
||||
'2027' => '2027',
|
||||
'2028' => '2028',
|
||||
'2029' => '2029',
|
||||
'2030' => '2030',
|
||||
'2031' => '2031',
|
||||
'2032' => '2032',
|
||||
'2033' => '2033',
|
||||
'2034' => '2034',
|
||||
'2035' => '2035',
|
||||
'2036' => '2036',
|
||||
'2037' => '2037',
|
||||
'2038' => '2038',
|
||||
'2039' => '2039',
|
||||
'2040' => '2040',
|
||||
'2041' => '2041',
|
||||
'2042' => '2042',
|
||||
'2043' => '2043',
|
||||
'2044' => '2044',
|
||||
'2045' => '2045',
|
||||
'2046' => '2046',
|
||||
'2047' => '2047',
|
||||
'2048' => '2048',
|
||||
'2049' => '2049',
|
||||
'2050' => '2050',
|
||||
'2051' => '2051',
|
||||
'2052' => '2052',
|
||||
'2053' => '2053',
|
||||
'2054' => '2054',
|
||||
'2055' => '2055',
|
||||
'2056' => '2056',
|
||||
'2057' => '2057',
|
||||
'2058' => '2058',
|
||||
'2059' => '2059',
|
||||
'2060' => '2060',
|
||||
'2061' => '2061',
|
||||
'2062' => '2062',
|
||||
'2063' => '2063',
|
||||
'2064' => '2064',
|
||||
'2065' => '2065',
|
||||
'2066' => '2066',
|
||||
'2067' => '2067',
|
||||
'2068' => '2068',
|
||||
'2069' => '2069',
|
||||
'2070' => '2070',
|
||||
'2071' => '2071',
|
||||
'2072' => '2072',
|
||||
'2073' => '2073',
|
||||
'2074' => '2074',
|
||||
'2075' => '2075',
|
||||
'2076' => '2076',
|
||||
'2077' => '2077',
|
||||
'2078' => '2078',
|
||||
'2079' => '2079',
|
||||
'2080' => '2080',
|
||||
'2081' => '2081',
|
||||
'2082' => '2082',
|
||||
'2083' => '2083',
|
||||
'2084' => '2084',
|
||||
'2085' => '2085',
|
||||
'2086' => '2086',
|
||||
'2087' => '2087',
|
||||
'2088' => '2088',
|
||||
'2089' => '2089',
|
||||
'2090' => '2090',
|
||||
];
|
||||
}
|
||||
}
|
||||
64
app/Modules/Card/CardModule.php
Normal file
64
app/Modules/Card/CardModule.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Card;
|
||||
|
||||
use App\Modules\Makeable;
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class CardModule implements ModuleContract
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
/**
|
||||
* Module is enabled
|
||||
*/
|
||||
protected bool $enabled = true;
|
||||
|
||||
/**
|
||||
* Check if is module enabled
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable module
|
||||
*/
|
||||
public function disable(): void
|
||||
{
|
||||
$this->enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable module
|
||||
*/
|
||||
public function enable(): void
|
||||
{
|
||||
$this->enabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module has a filament resource
|
||||
*/
|
||||
public function hasFilamentResource(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module composer requirements
|
||||
*/
|
||||
public function getComposerRequirements(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module composer suggestions
|
||||
*/
|
||||
public function getComposerSuggestions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
49
app/Modules/Card/Controllers/CardController.php
Normal file
49
app/Modules/Card/Controllers/CardController.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Card\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('cards', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
|
||||
|
||||
$table->string('number')->index();
|
||||
$table->string('name')->index();
|
||||
$table->string('month');
|
||||
$table->string('year');
|
||||
|
||||
$table->string('type')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cards');
|
||||
}
|
||||
};
|
||||
36
app/Modules/Card/Models/Card.php
Normal file
36
app/Modules/Card/Models/Card.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Card\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $number
|
||||
* @property string $name
|
||||
* @property string $month
|
||||
* @property string $year
|
||||
* @property string|null $type
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
*/
|
||||
class Card extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected $table = 'cards';
|
||||
|
||||
/**
|
||||
* Get the user that owns the card.
|
||||
*
|
||||
* @return BelongsTo<User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
5
app/Modules/Card/Repositories/CardRepository.php
Normal file
5
app/Modules/Card/Repositories/CardRepository.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Card\Repositories;
|
||||
|
||||
class CardRepository {}
|
||||
72
app/Modules/CardOrder/CardOrderModule.php
Normal file
72
app/Modules/CardOrder/CardOrderModule.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\CardOrder;
|
||||
|
||||
use App\Modules\Core\ModulePackage;
|
||||
use App\Modules\Core\ModulePackageType;
|
||||
use App\Modules\Makeable;
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class CardOrderModule implements ModuleContract
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
/**
|
||||
* Module is enabled
|
||||
*/
|
||||
protected bool $enabled = true;
|
||||
|
||||
/**
|
||||
* Check if is module enabled
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable module
|
||||
*/
|
||||
public function disable(): void
|
||||
{
|
||||
$this->enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable module
|
||||
*/
|
||||
public function enable(): void
|
||||
{
|
||||
$this->enabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module has a filament resource
|
||||
*/
|
||||
public function hasFilamentResource(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module composer requirements
|
||||
*/
|
||||
public function getComposerRequirements(): array
|
||||
{
|
||||
return [
|
||||
new ModulePackage(
|
||||
type: ModulePackageType::MODULE,
|
||||
name: 'Branch',
|
||||
message: 'This module is used for branches.',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module composer suggestions
|
||||
*/
|
||||
public function getComposerSuggestions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
49
app/Modules/CardOrder/Controllers/CardOrderController.php
Normal file
49
app/Modules/CardOrder/Controllers/CardOrderController.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\CardOrder\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CardOrderController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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('card_states', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->json('name');
|
||||
$table->string('price')->nullable();
|
||||
$table->string('notes')->nullable();
|
||||
$table->boolean('active')->default(true);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('card_states');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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('card_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->json('name');
|
||||
$table->string('price')->nullable();
|
||||
$table->string('notes')->nullable();
|
||||
$table->boolean('active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('card_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
||||
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('card_orders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('unique_id')->nullable()->unique();
|
||||
|
||||
$table->foreignId('card_state_id')->constrained('card_states')->restrictOnDelete();
|
||||
$table->foreignId('card_type_id')->constrained('card_types')->restrictOnDelete();
|
||||
|
||||
$table->string('region', 2)->index();
|
||||
$table->foreignId('branch_id')->constrained('branches')->restrictOnDelete();
|
||||
|
||||
$table->string('customer_name')->index();
|
||||
$table->string('customer_surname')->index();
|
||||
$table->string('customer_patronic_name')->nullable();
|
||||
$table->date('born_at')->nullable();
|
||||
$table->string('old_surname')->nullable();
|
||||
|
||||
$table->string('citizenship');
|
||||
$table->string('passport_serie')->index();
|
||||
$table->string('passport_id')->index();
|
||||
$table->date('passport_given_at');
|
||||
$table->string('passport_given_by');
|
||||
$table->string('born_place');
|
||||
|
||||
$table->string('job_location')->nullable();
|
||||
|
||||
$table->string('passport_address')->nullable();
|
||||
$table->string('real_address')->nullable();
|
||||
|
||||
$table->string('phone')->nullable()->index();
|
||||
$table->string('phone_additional')->nullable()->index();
|
||||
|
||||
$table->string('status')->nullable()->default(OrderStatusRepository::defaultStatus())->index();
|
||||
|
||||
$table->text('passport_one');
|
||||
$table->text('passport_two');
|
||||
$table->text('passport_three');
|
||||
$table->text('passport_four');
|
||||
|
||||
$table->text('notes')->nullable();
|
||||
|
||||
$table->foreignId('user_id')->constrained('users')->restrictOnDelete();
|
||||
|
||||
$table->boolean('paid')->default(false);
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('card_orders');
|
||||
}
|
||||
};
|
||||
114
app/Modules/CardOrder/Models/CardOrder.php
Normal file
114
app/Modules/CardOrder/Models/CardOrder.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\CardOrder\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Modules\Branch\Interfaces\BelongsToBranch;
|
||||
use App\Modules\Branch\Models\Branch;
|
||||
use App\Modules\LoanOrder\Repositories\LoanOrderRepository;
|
||||
use App\Modules\OrderStatus\Interfaces\HasStatus;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property null|string $unique_id
|
||||
* @property int $card_state_id
|
||||
* @property int $card_type_id
|
||||
* @property string $region
|
||||
* @property int $branch_id
|
||||
* @property string $customer_name
|
||||
* @property string $customer_surname
|
||||
* @property null|string $customer_patronic_name
|
||||
* @property \Illuminate\Support\Carbon $born_at
|
||||
* @property null|string $old_surname
|
||||
* @property string $citizenship
|
||||
* @property string $passport_serie
|
||||
* @property string $passport_id
|
||||
* @property \Illuminate\Support\Carbon $passport_given_at
|
||||
* @property string $passport_given_by
|
||||
* @property string $born_place
|
||||
* @property null|string $job_location
|
||||
* @property null|string $passport_address
|
||||
* @property null|string $real_address
|
||||
* @property null|string $phone
|
||||
* @property null|string $phone_additional
|
||||
* @property null|string $status
|
||||
* @property string $passport_one
|
||||
* @property string $passport_two
|
||||
* @property string $passport_three
|
||||
* @property string $passport_four
|
||||
* @property null|string $notes
|
||||
* @property int $user_id
|
||||
* @property null|\Illuminate\Support\Carbon $created_at
|
||||
* @property null|\Illuminate\Support\Carbon $updated_at
|
||||
* @property null|\Illuminate\Support\Carbon $deleted_at
|
||||
* @property bool $paid
|
||||
*/
|
||||
class CardOrder extends Model implements BelongsToBranch, HasStatus
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'born_at' => 'date',
|
||||
'passport_given_at' => 'date',
|
||||
'paid' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* @return BelongsTo<User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Card state
|
||||
*
|
||||
* @return BelongsTo<CardState, $this>
|
||||
*/
|
||||
public function cardState(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CardState::class, 'card_state_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Card type
|
||||
*
|
||||
* @return BelongsTo<CardType, $this>
|
||||
*/
|
||||
public function cardType(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CardType::class, 'card_type_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Branch
|
||||
*
|
||||
* @return BelongsTo<Branch, $this>
|
||||
*/
|
||||
public function branch(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Branch::class, 'branch_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* "boot" method for model
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(LoanOrderRepository::creating());
|
||||
static::created(LoanOrderRepository::created());
|
||||
}
|
||||
}
|
||||
27
app/Modules/CardOrder/Models/CardState.php
Normal file
27
app/Modules/CardOrder/Models/CardState.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\CardOrder\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string|null $price
|
||||
* @property string|null $notes
|
||||
* @property bool $active
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
*/
|
||||
class CardState extends Model
|
||||
{
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* Translatable fields
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
public $translatable = ['name'];
|
||||
}
|
||||
27
app/Modules/CardOrder/Models/CardType.php
Normal file
27
app/Modules/CardOrder/Models/CardType.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\CardOrder\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string|null $price
|
||||
* @property string|null $notes
|
||||
* @property bool $active
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
*/
|
||||
class CardType extends Model
|
||||
{
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* Translatable fields
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
public $translatable = ['name'];
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\CardOrder\Repositories;
|
||||
|
||||
class CardOrderRepository {}
|
||||
@@ -5,16 +5,15 @@ namespace App\Modules\Loan\Models;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $passport_serie
|
||||
* @property int $passport_id
|
||||
* @property int $ account_number
|
||||
* @property Date|null $created_at
|
||||
* @property Date|null $updated_at
|
||||
* @property int $account_number
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
*/
|
||||
class Loan extends Model
|
||||
{
|
||||
@@ -24,7 +23,7 @@ class Loan extends Model
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* @return BelongsTo<User::class>
|
||||
* @return BelongsTo<User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace App\Modules\UserAdjustments\Traits;
|
||||
* @property string $locale [default: tk]
|
||||
* @property bool $password_must_be_changed [default: false]
|
||||
* @property bool $must_fill_profile [default: false]
|
||||
* @property null|array $options
|
||||
* @property null|array<string, int|string|null> $options
|
||||
*/
|
||||
trait UserAdjustments
|
||||
{
|
||||
|
||||
10
lang/tk.json
10
lang/tk.json
@@ -522,6 +522,7 @@
|
||||
"Created by": "Sargyt eden",
|
||||
"Updated by": "Üýtgeden",
|
||||
"Passport files": "Pasport faýýlar",
|
||||
"New card order": "Täze kart sargyt",
|
||||
"Card order": "Kart sargyt",
|
||||
"Card orders": "Kart sargytlary",
|
||||
"Reason for issuing the card": "Kartyň çykarylmagynyň sebäbi",
|
||||
@@ -659,5 +660,12 @@
|
||||
"Profile updated": "Profile üýtgedildi",
|
||||
"Profile Information": "Profil maglumatlary",
|
||||
"Fill your account profile information": "Hasabyňyzyň profil maglumatyny dolduryň",
|
||||
"My loans": "Karzlarym"
|
||||
"My loans": "Karzlarym",
|
||||
"My cards": "Kartlarym",
|
||||
"Card name": "Kartdaky at",
|
||||
"Card month": "Kart aýy",
|
||||
"Card year": "Kart ýyl",
|
||||
"Cards": "Kartlar",
|
||||
"Loans": "Karzlar",
|
||||
"Loan": "Karz"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user