add carts

This commit is contained in:
2025-10-23 00:36:45 +05:00
parent ff98b708b5
commit 9e19abb2d9
8 changed files with 284 additions and 553 deletions

View File

@@ -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

View File

@@ -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>

View File

@@ -0,0 +1,116 @@
<?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 ?string $model = Card::class;
protected static ?string $cluster = CardsCluster::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCreditCard;
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('/'),
];
}
}

View 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(),
];
}
}

View File

@@ -11,7 +11,7 @@ class CardsCluster extends Cluster
{
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCreditCard;
protected static ?SubNavigationPosition $subNavigationPosition = SubNavigationPosition::End;
protected static ?SubNavigationPosition $subNavigationPosition = SubNavigationPosition::Top;
public static function getNavigationLabel(): string
{

View File

@@ -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;

View File

@@ -0,0 +1,143 @@
<?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<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',
];
}
}

View File

@@ -659,5 +659,9 @@
"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"
}