install
This commit is contained in:
93
app/Filament/Clusters/Loans/LoanOrders/LoanOrderResource.php
Normal file
93
app/Filament/Clusters/Loans/LoanOrders/LoanOrderResource.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\LoanOrders;
|
||||
|
||||
use App\Filament\Clusters\Loans\LoanOrders\Pages\CreateLoanOrder;
|
||||
use App\Filament\Clusters\Loans\LoanOrders\Pages\EditLoanOrder;
|
||||
use App\Filament\Clusters\Loans\LoanOrders\Pages\ListLoanOrders;
|
||||
use App\Filament\Clusters\Loans\LoanOrders\Pages\ViewLoanOrder;
|
||||
use App\Filament\Clusters\Loans\LoanOrders\Schemas\LoanOrderForm;
|
||||
use App\Filament\Clusters\Loans\LoanOrders\Schemas\LoanOrderInfolist;
|
||||
use App\Filament\Clusters\Loans\LoanOrders\Tables\LoanOrdersTable;
|
||||
use App\Filament\Clusters\Loans\LoansCluster;
|
||||
use App\Modules\LoanOrder\Models\LoanOrder;
|
||||
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 LoanOrderResource extends Resource
|
||||
{
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static ?string $model = LoanOrder::class;
|
||||
|
||||
protected static ?string $cluster = LoansCluster::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 loan order');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('module.loan-order::loan-order.loan_order');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('module.loan-order::loan-order.loan_orders');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return LoanOrderForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return LoanOrderInfolist::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return LoanOrdersTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListLoanOrders::route('/'),
|
||||
'create' => CreateLoanOrder::route('/create'),
|
||||
'view' => ViewLoanOrder::route('/{record}'),
|
||||
'edit' => EditLoanOrder::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Builder<LoanOrder>
|
||||
*/
|
||||
public static function getRecordRouteBindingEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getRecordRouteBindingEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\LoanOrders\Pages;
|
||||
|
||||
use App\Filament\Clusters\Loans\LoanOrders\LoanOrderResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateLoanOrder extends CreateRecord
|
||||
{
|
||||
protected static string $resource = LoanOrderResource::class;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\LoanOrders\Pages;
|
||||
|
||||
use App\Filament\Clusters\Loans\LoanOrders\LoanOrderResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\ForceDeleteAction;
|
||||
use Filament\Actions\RestoreAction;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditLoanOrder extends EditRecord
|
||||
{
|
||||
protected static string $resource = LoanOrderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
ViewAction::make(),
|
||||
DeleteAction::make(),
|
||||
ForceDeleteAction::make(),
|
||||
RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\LoanOrders\Pages;
|
||||
|
||||
use App\Filament\Clusters\Loans\LoanOrders\LoanOrderResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListLoanOrders extends ListRecords
|
||||
{
|
||||
protected static string $resource = LoanOrderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\LoanOrders\Pages;
|
||||
|
||||
use App\Filament\Clusters\Loans\LoanOrders\LoanOrderResource;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewLoanOrder extends ViewRecord
|
||||
{
|
||||
protected static string $resource = LoanOrderResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
333
app/Filament/Clusters/Loans/LoanOrders/Schemas/LoanOrderForm.php
Normal file
333
app/Filament/Clusters/Loans/LoanOrders/Schemas/LoanOrderForm.php
Normal file
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\LoanOrders\Schemas;
|
||||
|
||||
use App\Modules\LoanOrder\Models\LoanOrderRequiredDocs;
|
||||
use App\Modules\LoanOrder\Repositories\LoanOrderRepository;
|
||||
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
||||
use App\Modules\PersonStates\Repositories\EducationRepository;
|
||||
use App\Modules\PersonStates\Repositories\MarriageRepository;
|
||||
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\TextInput;
|
||||
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 LoanOrderForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->columns(4)
|
||||
->components([
|
||||
Hidden::make('source')->default('web'),
|
||||
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),
|
||||
|
||||
Select::make('satisfiable')
|
||||
->label(__('Loan history'))
|
||||
->options(LoanOrderRepository::satisfiableValues())
|
||||
->native(false)
|
||||
->columnSpan(2),
|
||||
|
||||
Select::make('loan_order_required_doc_id')
|
||||
->label(__('Required documents'))
|
||||
->relationship('requiredDocs', 'name')
|
||||
->searchable()
|
||||
->native(false)
|
||||
->preload()
|
||||
->live()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
if ($state) {
|
||||
/** @var null|LoanOrderRequiredDocs */
|
||||
$requiredDoc = LoanOrderRequiredDocs::find($state);
|
||||
|
||||
if ($requiredDoc) {
|
||||
$set('notes', $requiredDoc->value);
|
||||
}
|
||||
}
|
||||
})
|
||||
->columnSpanFull(),
|
||||
|
||||
RichEditor::make('notes')
|
||||
->label(__('Bellik'))
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
|
||||
Wizard::make([
|
||||
Step::make(__('Loan & Bank'))
|
||||
->schema([
|
||||
Fieldset::make(__('Loan type and amount'))
|
||||
->schema([
|
||||
Select::make('loan_type')
|
||||
->label(__('Loan type'))
|
||||
->relationship('loanType', 'name')
|
||||
->required(),
|
||||
|
||||
TextInput::make('loan_amount')
|
||||
->label(__('Loan amount'))
|
||||
->numeric()
|
||||
->required()
|
||||
->minValue(1)
|
||||
->maxValue(40000)
|
||||
->suffix('TMT')
|
||||
->belowContent(__('Max is 40 000 TMT')),
|
||||
]),
|
||||
|
||||
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)
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autocomplete(Str::random(10)),
|
||||
|
||||
TextInput::make('customer_surname')
|
||||
->label(__('Surname'))
|
||||
->columnSpan(2)
|
||||
->required()
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('customer_patronic_name')
|
||||
->label(__('Patronic name'))
|
||||
->columnSpan(2)
|
||||
->maxLength(255),
|
||||
|
||||
DatePicker::make('born_at')
|
||||
->displayFormat('d.m.Y')
|
||||
->label(__('Birth date'))
|
||||
->native(false)
|
||||
->columnSpan(2)
|
||||
->required()
|
||||
->beforeOrEqual('today'),
|
||||
|
||||
FusedGroup::make([
|
||||
Select::make('passport_serie')
|
||||
->label(__('Passport serie'))
|
||||
->options(TurkmenPassportRepository::values())
|
||||
->native(false)
|
||||
->required()
|
||||
->columnSpan(1),
|
||||
|
||||
TextInput::make('passport_id')
|
||||
->label(__('Passport number'))
|
||||
->required()
|
||||
->columnSpan(1)
|
||||
->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()
|
||||
->beforeOrEqual('today')
|
||||
->required(),
|
||||
|
||||
TextInput::make('born_place')
|
||||
->columnSpan(3)
|
||||
->label(__('Born place (passport)'))
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
|
||||
TextInput::make('passport_given_by')
|
||||
->label(__('Passport given by'))
|
||||
->columnSpan(4)
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
|
||||
TextInput::make('passport_address')
|
||||
->columnSpan(4)
|
||||
->label(__('Proscription for home'))
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
|
||||
TextInput::make('real_address')
|
||||
->label(__('Current home address'))
|
||||
->columnSpan(4)
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
|
||||
TextInput::make('email')
|
||||
->label(__('Email'))
|
||||
->email()
|
||||
->maxLength(255)
|
||||
->columnSpan(2),
|
||||
|
||||
TextInput::make('phone')
|
||||
->label(__('Phone'))
|
||||
->required()
|
||||
->mask('99 99 99 99')
|
||||
->prefix('+993')
|
||||
->rules([
|
||||
new PhoneNumberVerificationRule,
|
||||
])
|
||||
->columnSpan(2),
|
||||
|
||||
TextInput::make('phone_additional')
|
||||
->label(__('Additional phone'))
|
||||
->mask('99 99 99 99')
|
||||
->prefix('+993')
|
||||
->rules([
|
||||
new PhoneNumberVerificationRule,
|
||||
])
|
||||
->columnSpan(2),
|
||||
|
||||
TextInput::make('phone_home')
|
||||
->label(__('Home phone'))
|
||||
->numeric()
|
||||
->prefix('+993')
|
||||
->columnSpan(2),
|
||||
|
||||
Select::make('education')
|
||||
->columnSpan(2)
|
||||
->label(__('Education'))
|
||||
->options(EducationRepository::values())
|
||||
->native(false)
|
||||
->required(),
|
||||
|
||||
Select::make('marriage_status')
|
||||
->columnSpan(2)
|
||||
->label(__('Marital status'))
|
||||
->options(MarriageRepository::values())
|
||||
->native(false)
|
||||
->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),
|
||||
Step::make(__('Work'))
|
||||
->columns(4)
|
||||
->schema([
|
||||
Select::make('work_region')
|
||||
->label(__('Work region'))
|
||||
->options(RegionRepository::values())
|
||||
->columnSpan(1)
|
||||
->live()
|
||||
->afterStateUpdated(fn (callable $set) => $set('branch_id', null))
|
||||
->required(),
|
||||
|
||||
Select::make('work_province_id')
|
||||
->label(__('Work province'))
|
||||
->relationship('workProvince', 'name', function ($query, callable $get) {
|
||||
$region = $get('work_region');
|
||||
if ($region) {
|
||||
$query->where('region', $region);
|
||||
}
|
||||
})
|
||||
->columnSpan(1)
|
||||
->required(),
|
||||
|
||||
TextInput::make('work_company')
|
||||
->label(__('Work company name'))
|
||||
->maxLength(255)
|
||||
->required()
|
||||
->columnSpan(2),
|
||||
|
||||
TextInput::make('work_company_accountant_number')
|
||||
->label(__('HR number'))
|
||||
->prefix('+993')
|
||||
->numeric()
|
||||
->required()
|
||||
->columnSpan(1),
|
||||
|
||||
TextInput::make('work_position')
|
||||
->label(__('Work position'))
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->columnSpan(1),
|
||||
|
||||
TextInput::make('work_salary')
|
||||
->label(__('Salary'))
|
||||
->numeric()
|
||||
->required()
|
||||
->columnSpan(1),
|
||||
|
||||
DatePicker::make('work_started_at')
|
||||
->label(__('Work started at'))
|
||||
->displayFormat('d.m.Y')
|
||||
->beforeOrEqual('today')
|
||||
->required()
|
||||
->columnSpan(1),
|
||||
]),
|
||||
])->columnSpan(4),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\LoanOrders\Schemas;
|
||||
|
||||
use App\Modules\LoanOrder\Models\LoanOrder;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class LoanOrderInfolist
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextEntry::make('unique_id')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('source')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('user.name')
|
||||
->label('User')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('loan_type')
|
||||
->numeric(),
|
||||
TextEntry::make('region'),
|
||||
TextEntry::make('branch.name')
|
||||
->label('Branch'),
|
||||
TextEntry::make('customer_name'),
|
||||
TextEntry::make('customer_surname'),
|
||||
TextEntry::make('customer_patronic_name')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('passport_address'),
|
||||
TextEntry::make('real_address'),
|
||||
TextEntry::make('passport_serie'),
|
||||
TextEntry::make('passport_id'),
|
||||
TextEntry::make('passport_given_at')
|
||||
->date(),
|
||||
TextEntry::make('passport_given_by'),
|
||||
TextEntry::make('born_place'),
|
||||
TextEntry::make('born_at')
|
||||
->date(),
|
||||
TextEntry::make('email')
|
||||
->label('Email address')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('phone'),
|
||||
TextEntry::make('phone_additional')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('phone_home')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('work_region')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('workProvince.name')
|
||||
->label('Work province')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('work_company')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('work_company_accountant_number')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('work_started_at')
|
||||
->date()
|
||||
->placeholder('-'),
|
||||
TextEntry::make('work_salary')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('work_position')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('education'),
|
||||
TextEntry::make('marriage_status'),
|
||||
TextEntry::make('passport_one')
|
||||
->columnSpanFull(),
|
||||
TextEntry::make('passport_two')
|
||||
->columnSpanFull(),
|
||||
TextEntry::make('passport_three')
|
||||
->columnSpanFull(),
|
||||
TextEntry::make('passport_four')
|
||||
->columnSpanFull(),
|
||||
TextEntry::make('loan_amount')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('card_number')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('card_name')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('card_month')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('card_year')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_name')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_surname')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_patronic_name')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_passport_serie')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_passport_id')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_card_number')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_card_name')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_card_month')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_card_year')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_note')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_2_name')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_2_surname')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_2_patronic_name')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_2_passport_serie')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_2_passport_id')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_2_card_number')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_2_card_name')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_2_card_month')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_2_card_year')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('guarantor_2_note')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('loan_card_number')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('loan_card_name')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('loan_card_month')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('loan_card_year')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('loan_order_required_doc_id')
|
||||
->numeric()
|
||||
->placeholder('-'),
|
||||
TextEntry::make('status')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('satisfiable')
|
||||
->placeholder('-'),
|
||||
TextEntry::make('notes')
|
||||
->placeholder('-')
|
||||
->columnSpanFull(),
|
||||
TextEntry::make('created_at')
|
||||
->dateTime()
|
||||
->placeholder('-'),
|
||||
TextEntry::make('updated_at')
|
||||
->dateTime()
|
||||
->placeholder('-'),
|
||||
TextEntry::make('deleted_at')
|
||||
->dateTime()
|
||||
->visible(fn (LoanOrder $record): bool => $record->trashed()),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\LoanOrders\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\ForceDeleteBulkAction;
|
||||
use Filament\Actions\RestoreBulkAction;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\TrashedFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class LoanOrdersTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('id')
|
||||
->label('ID')
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('loanType.name')
|
||||
->label('Тип кредита')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('region')
|
||||
->label('Регион')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('branch.name')
|
||||
->label('Филиал')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('customer_name')
|
||||
->label('Имя клиента')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('customer_surname')
|
||||
->label('Фамилия клиента')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('phone')
|
||||
->label('Телефон')
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('status')
|
||||
->label('Статус')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->label('Дата создания')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(),
|
||||
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
TrashedFilter::make(),
|
||||
])
|
||||
->recordActions([
|
||||
ViewAction::make(),
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
ForceDeleteBulkAction::make(),
|
||||
RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
68
app/Filament/Clusters/Loans/Loans/LoanResource.php
Normal file
68
app/Filament/Clusters/Loans/Loans/LoanResource.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\Loans;
|
||||
|
||||
use App\Filament\Clusters\Loans\Loans\Pages\ListLoans;
|
||||
use App\Filament\Clusters\Loans\Loans\Schemas\LoanForm;
|
||||
use App\Filament\Clusters\Loans\Loans\Tables\LoansTable;
|
||||
use App\Filament\Clusters\Loans\LoansCluster;
|
||||
use App\Modules\Loan\Models\Loan;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class LoanResource extends Resource
|
||||
{
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static ?string $model = Loan::class;
|
||||
|
||||
protected static ?string $cluster = LoansCluster::class;
|
||||
|
||||
public static function getNavigationIcon(): string|BackedEnum|Htmlable|null
|
||||
{
|
||||
return Heroicon::OutlinedBanknotes;
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('My loans');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('Karz');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('Karzlar');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return LoanForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return LoansTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListLoans::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Clusters/Loans/Loans/Pages/ListLoans.php
Normal file
19
app/Filament/Clusters/Loans/Loans/Pages/ListLoans.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\Loans\Pages;
|
||||
|
||||
use App\Filament\Clusters\Loans\Loans\LoanResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListLoans extends ListRecords
|
||||
{
|
||||
protected static string $resource = LoanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Filament/Clusters/Loans/Loans/Schemas/LoanForm.php
Normal file
30
app/Filament/Clusters/Loans/Loans/Schemas/LoanForm.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\Loans\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class LoanForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Hidden::make('user_id')
|
||||
->default(user()->id),
|
||||
|
||||
Hidden::make('passport_serie')
|
||||
->default(user()->getOption('passport_serie')),
|
||||
|
||||
Hidden::make('passport_id')
|
||||
->default(user()->getOption('passport_id')),
|
||||
|
||||
TextInput::make('account_number')
|
||||
->required()
|
||||
->string()
|
||||
->maxLength(23),
|
||||
]);
|
||||
}
|
||||
}
|
||||
42
app/Filament/Clusters/Loans/Loans/Tables/LoansTable.php
Normal file
42
app/Filament/Clusters/Loans/Loans/Tables/LoansTable.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\Loans\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class LoansTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('account_number')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
21
app/Filament/Clusters/Loans/LoansCluster.php
Normal file
21
app/Filament/Clusters/Loans/LoansCluster.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Clusters\Cluster;
|
||||
use Filament\Pages\Enums\SubNavigationPosition;
|
||||
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;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('module.loan-order::loan-order.loans');
|
||||
}
|
||||
}
|
||||
57
app/Filament/Clusters/Settings/Branches/BranchResource.php
Normal file
57
app/Filament/Clusters/Settings/Branches/BranchResource.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Branches;
|
||||
|
||||
use App\Filament\Clusters\Settings\Branches\Pages\ManageBranches;
|
||||
use App\Filament\Clusters\Settings\Branches\Schemas\BranchForm;
|
||||
use App\Filament\Clusters\Settings\Branches\Tables\BranchesTable;
|
||||
use App\Filament\Clusters\Settings\SettingsCluster;
|
||||
use App\Modules\Branch\Models\Branch;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BranchResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Branch::class;
|
||||
|
||||
protected static ?string $cluster = SettingsCluster::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBuildingOffice2;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('Branches and provinces');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('module.branch::base.branch');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('module.branch::base.branches');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return BranchForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return BranchesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageBranches::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Branches\Pages;
|
||||
|
||||
use App\Filament\Clusters\Settings\Branches\BranchResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageBranches extends ManageRecords
|
||||
{
|
||||
protected static string $resource = BranchResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
134
app/Filament/Clusters/Settings/Branches/Schemas/BranchForm.php
Normal file
134
app/Filament/Clusters/Settings/Branches/Schemas/BranchForm.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Branches\Schemas;
|
||||
|
||||
use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
|
||||
use App\Modules\Province\Models\Province;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class BranchForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make(__('General Information'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
TextInput::make('unique_code')
|
||||
->label(__('Unique code'))
|
||||
->maxLength(255)
|
||||
->unique(ignoreRecord: true)
|
||||
->required(),
|
||||
|
||||
Select::make('region')
|
||||
->label(__('Region'))
|
||||
->options(fn () => regions())
|
||||
->required()
|
||||
->native(false)
|
||||
->searchable()
|
||||
->live()
|
||||
->afterStateUpdated(fn ($state, callable $set) => $set('province_id', null)),
|
||||
|
||||
Select::make('province_id')
|
||||
->label(__('Province'))
|
||||
->relationship('province', 'name')
|
||||
->options(function (callable $get) {
|
||||
$region = $get('region');
|
||||
if (! $region) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Province::query()
|
||||
->where('region', $region)
|
||||
->where('active', true)
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->searchable()
|
||||
->native(false)
|
||||
->disabled(fn (callable $get): bool => ! $get('region'))
|
||||
->columnSpanFull(),
|
||||
|
||||
Toggle::make('active')
|
||||
->label(__('Active'))
|
||||
->default(true)
|
||||
->required(),
|
||||
|
||||
Repeater::make('phone_numbers')
|
||||
->label(__('Phone numbers'))
|
||||
->simple(
|
||||
TextInput::make('phone')
|
||||
->label(__('Phone Number'))
|
||||
->prefix('+993')
|
||||
->numeric()
|
||||
)
|
||||
->addActionLabel(__('Add phone number'))
|
||||
->defaultItems(0)
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
|
||||
TranslatableTabs::make()
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label(__('Name'))
|
||||
->required()
|
||||
->maxLength(255),
|
||||
|
||||
Textarea::make('address')
|
||||
->label(__('Address'))
|
||||
->rows(3),
|
||||
|
||||
]),
|
||||
|
||||
Section::make(__('Billing Credentials'))
|
||||
->collapsed()
|
||||
->collapsible()
|
||||
->columns(2)
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
TextInput::make('billing_username')
|
||||
->label(__('Billing Username'))
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('billing_password')
|
||||
->label(__('Billing Password'))
|
||||
->password()
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('billing_swift_username')
|
||||
->label(__('Billing SWIFT Username'))
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('billing_swift_password')
|
||||
->label(__('Billing SWIFT Password'))
|
||||
->password()
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('billing_visa_master_username')
|
||||
->label(__('Billing Visa/Master Username'))
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('billing_visa_master_password')
|
||||
->label(__('Billing Visa/Master Password'))
|
||||
->password()
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('billing_sber_username')
|
||||
->label(__('Billing Sber Username'))
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('billing_sber_password')
|
||||
->label(__('Billing Sber Password'))
|
||||
->password()
|
||||
->maxLength(255),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Branches\Tables;
|
||||
|
||||
use App\Modules\Region\Repositories\RegionRepository;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BranchesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('unique_code')
|
||||
->label(__('Unique code'))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('name')
|
||||
->label(__('Name'))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('region')
|
||||
->label(__('Region'))
|
||||
->formatStateUsing(fn (string $state): string => RegionRepository::label($state))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('province.name')
|
||||
->label(__('Province'))
|
||||
->searchable()
|
||||
->sortable()
|
||||
->toggleable(),
|
||||
|
||||
IconColumn::make('active')
|
||||
->label(__('Active'))
|
||||
->boolean()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->label(__('Created At'))
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
|
||||
TextColumn::make('updated_at')
|
||||
->label(__('Updated At'))
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('region')
|
||||
->label(__('Region'))
|
||||
->options(fn () => regions())
|
||||
->native(false),
|
||||
|
||||
TernaryFilter::make('active')
|
||||
->label(__('Active'))
|
||||
->boolean()
|
||||
->trueLabel(__('Active only'))
|
||||
->falseLabel(__('Inactive only'))
|
||||
->native(false),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\LoanOrderRequiredDocs;
|
||||
|
||||
use App\Filament\Clusters\Settings\LoanOrderRequiredDocs\Pages\ManageLoanOrderRequiredDocs;
|
||||
use App\Filament\Clusters\Settings\LoanOrderRequiredDocs\Schemas\LoanOrderRequiredDocsForm;
|
||||
use App\Filament\Clusters\Settings\LoanOrderRequiredDocs\Tables\LoanOrderRequiredDocsTable;
|
||||
use App\Filament\Clusters\Settings\SettingsCluster;
|
||||
use App\Modules\LoanOrder\Models\LoanOrderRequiredDocs;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class LoanOrderRequiredDocsResource extends Resource
|
||||
{
|
||||
protected static ?string $model = LoanOrderRequiredDocs::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 __('module.loan-order::loan-order.loans');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('module.loan-order::loan-order.loan_order_required_docs');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('module.loan-order::loan-order.loan_order_required_docs');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return LoanOrderRequiredDocsForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return LoanOrderRequiredDocsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageLoanOrderRequiredDocs::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\LoanOrderRequiredDocs\Pages;
|
||||
|
||||
use App\Filament\Clusters\Settings\LoanOrderRequiredDocs\LoanOrderRequiredDocsResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageLoanOrderRequiredDocs extends ManageRecords
|
||||
{
|
||||
protected static string $resource = LoanOrderRequiredDocsResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\LoanOrderRequiredDocs\Schemas;
|
||||
|
||||
use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class LoanOrderRequiredDocsForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TranslatableTabs::make('anyLabel')
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label(__('Name'))
|
||||
->required()
|
||||
->maxLength(255),
|
||||
|
||||
RichEditor::make('value')
|
||||
->label(__('Value'))
|
||||
->required()
|
||||
->maxLength(255),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\LoanOrderRequiredDocs\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class LoanOrderRequiredDocsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->label(__('Name'))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->label(__('Created At'))
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
|
||||
TextColumn::make('updated_at')
|
||||
->label(__('Updated At'))
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\LoanTypes;
|
||||
|
||||
use App\Filament\Clusters\Settings\LoanTypes\Pages\ListLoanTypes;
|
||||
use App\Filament\Clusters\Settings\LoanTypes\Schemas\LoanTypeForm;
|
||||
use App\Filament\Clusters\Settings\LoanTypes\Schemas\LoanTypeInfolist;
|
||||
use App\Filament\Clusters\Settings\LoanTypes\Tables\LoanTypesTable;
|
||||
use App\Filament\Clusters\Settings\SettingsCluster;
|
||||
use App\Modules\LoanOrder\Models\LoanType;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class LoanTypeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = LoanType::class;
|
||||
|
||||
protected static ?string $cluster = SettingsCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBanknotes;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('module.loan-order::loan-order.loans');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('module.loan-order::loan-type.loan_type');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('module.loan-order::loan-type.loan_type');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return LoanTypeForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return LoanTypeInfolist::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return LoanTypesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListLoanTypes::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\LoanTypes\Pages;
|
||||
|
||||
use App\Filament\Clusters\Settings\LoanTypes\LoanTypeResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListLoanTypes extends ListRecords
|
||||
{
|
||||
protected static string $resource = LoanTypeResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\LoanTypes\Schemas;
|
||||
|
||||
use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class LoanTypeForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TranslatableTabs::make()
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label(__('Name'))
|
||||
->required()
|
||||
->maxLength(255),
|
||||
|
||||
Textarea::make('notes')
|
||||
->label(__('Notes'))
|
||||
->rows(3),
|
||||
]),
|
||||
|
||||
Section::make()
|
||||
->columns(2)
|
||||
->schema([
|
||||
TextInput::make('tax')
|
||||
->label(__('Tax'))
|
||||
->numeric()
|
||||
->suffix('%')
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('maturity')
|
||||
->label(__('Loan term'))
|
||||
->maxLength(255),
|
||||
|
||||
Toggle::make('active')
|
||||
->label(__('Active'))
|
||||
->default(true)
|
||||
->required(),
|
||||
]),
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\LoanTypes\Schemas;
|
||||
|
||||
use Filament\Infolists\Components\IconEntry;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class LoanTypeInfolist
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make(__('Loan Type Information'))
|
||||
->columns(2)
|
||||
->components([
|
||||
TextEntry::make('name')
|
||||
->label(__('Name')),
|
||||
|
||||
TextEntry::make('tax')
|
||||
->label(__('Tax'))
|
||||
->suffix('%')
|
||||
->default('—'),
|
||||
|
||||
TextEntry::make('maturity')
|
||||
->label(__('Loan term'))
|
||||
->default('—'),
|
||||
|
||||
IconEntry::make('active')
|
||||
->label(__('Active'))
|
||||
->boolean(),
|
||||
|
||||
TextEntry::make('notes')
|
||||
->label(__('Notes'))
|
||||
->columnSpanFull()
|
||||
->default('—'),
|
||||
|
||||
TextEntry::make('created_at')
|
||||
->label(__('Created At'))
|
||||
->dateTime(),
|
||||
|
||||
TextEntry::make('updated_at')
|
||||
->label(__('Updated At'))
|
||||
->dateTime(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\LoanTypes\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class LoanTypesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->label(__('Name'))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('tax')
|
||||
->label(__('Tax'))
|
||||
->suffix('%')
|
||||
->sortable()
|
||||
->default('—'),
|
||||
|
||||
TextColumn::make('maturity')
|
||||
->label(__('Loan term'))
|
||||
->sortable()
|
||||
->default('—'),
|
||||
|
||||
IconColumn::make('active')
|
||||
->label(__('Active'))
|
||||
->boolean()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->label(__('Created At'))
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
|
||||
TextColumn::make('updated_at')
|
||||
->label(__('Updated At'))
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
TernaryFilter::make('active')
|
||||
->label(__('Active'))
|
||||
->boolean()
|
||||
->trueLabel(__('Active only'))
|
||||
->falseLabel(__('Inactive only'))
|
||||
->native(false),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Provinces\Pages;
|
||||
|
||||
use App\Filament\Clusters\Settings\Provinces\ProvinceResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageProvinces extends ManageRecords
|
||||
{
|
||||
protected static string $resource = ProvinceResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Provinces;
|
||||
|
||||
use App\Filament\Clusters\Settings\Provinces\Pages\ManageProvinces;
|
||||
use App\Filament\Clusters\Settings\Provinces\Schemas\ProvinceForm;
|
||||
use App\Filament\Clusters\Settings\Provinces\Tables\ProvincesTable;
|
||||
use App\Filament\Clusters\Settings\SettingsCluster;
|
||||
use App\Modules\Province\Models\Province;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ProvinceResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Province::class;
|
||||
|
||||
protected static ?string $cluster = SettingsCluster::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedMapPin;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('Branches and provinces');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('module.province::base.Province');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('module.province::base.Provinces');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ProvinceForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return ProvincesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageProvinces::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Provinces\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ProvinceForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('region')
|
||||
->label(__('Region'))
|
||||
->options(fn () => regions())
|
||||
->required()
|
||||
->native(false)
|
||||
->searchable(),
|
||||
|
||||
TextInput::make('name')
|
||||
->label(__('Name'))
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->translatableTabs(),
|
||||
|
||||
Toggle::make('active')
|
||||
->label(__('Active'))
|
||||
->default(true)
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Provinces\Tables;
|
||||
|
||||
use App\Modules\Region\Repositories\RegionRepository;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ProvincesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->label(__('Name'))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('region')
|
||||
->label(__('Region'))
|
||||
->formatStateUsing(fn (string $state): string => RegionRepository::label($state))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
IconColumn::make('active')
|
||||
->label(__('Active'))
|
||||
->boolean()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->label(__('Created At'))
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
|
||||
TextColumn::make('updated_at')
|
||||
->label(__('Updated At'))
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('region')
|
||||
->label(__('Region'))
|
||||
->options(fn () => regions())
|
||||
->native(false),
|
||||
|
||||
TernaryFilter::make('active')
|
||||
->label(__('Active'))
|
||||
->boolean()
|
||||
->trueLabel(__('Active only'))
|
||||
->falseLabel(__('Inactive only'))
|
||||
->native(false),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
20
app/Filament/Clusters/Settings/SettingsCluster.php
Normal file
20
app/Filament/Clusters/Settings/SettingsCluster.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Clusters\Cluster;
|
||||
use Filament\Pages\Enums\SubNavigationPosition;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class SettingsCluster extends Cluster
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCog8Tooth;
|
||||
|
||||
protected static ?SubNavigationPosition $subNavigationPosition = SubNavigationPosition::End;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('Settings');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user