wip
This commit is contained in:
@@ -11,7 +11,7 @@ class CreateCardOrder extends CreateRecord
|
||||
protected static string $resource = CardOrderResource::class;
|
||||
|
||||
/**
|
||||
* @return array<Action | ActionGroup>
|
||||
* @return array<int, \Filament\Actions\Action>
|
||||
*/
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
|
||||
@@ -72,6 +72,9 @@ class LoanOrderMobileResource extends Resource
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Builder<\App\Modules\LoanOrder\Models\LoanOrder>
|
||||
*/
|
||||
public static function getRecordRouteBindingEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getRecordRouteBindingEloquentQuery()
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Loans\Resources\LoanOrderMobiles\Pages;
|
||||
|
||||
use App\Filament\Clusters\Loans\Resources\LoanOrderMobileResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewLoanOrderMobile extends ViewRecord
|
||||
{
|
||||
protected static string $resource = LoanOrderMobileResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -133,20 +133,20 @@ class LoanOrderMobileForm
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->autocomplete(Str::random(10))
|
||||
->default(user()?->first_name),
|
||||
->default(user()->first_name),
|
||||
|
||||
TextInput::make('customer_surname')
|
||||
->label(__('Surname'))
|
||||
->columnSpan(2)
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->default(user()?->last_name),
|
||||
->default(user()->last_name),
|
||||
|
||||
TextInput::make('customer_patronic_name')
|
||||
->label(__('Patronic name'))
|
||||
->columnSpan(2)
|
||||
->maxLength(255)
|
||||
->default(user()?->getOption('patronic_name')),
|
||||
->default(user()->getOption('patronic_name')),
|
||||
|
||||
DatePicker::make('born_at')
|
||||
->displayFormat('d.m.Y')
|
||||
@@ -155,7 +155,7 @@ class LoanOrderMobileForm
|
||||
->columnSpan(2)
|
||||
->required()
|
||||
->beforeOrEqual('today')
|
||||
->default(user()?->getOption('born_at')),
|
||||
->default(user()->getOption('born_at')),
|
||||
|
||||
FusedGroup::make([
|
||||
Select::make('passport_serie')
|
||||
@@ -164,14 +164,14 @@ class LoanOrderMobileForm
|
||||
->native(false)
|
||||
->required()
|
||||
->columnSpan(1)
|
||||
->default(user()?->getOption('passport_serie')),
|
||||
->default(user()->getOption('passport_serie')),
|
||||
|
||||
TextInput::make('passport_id')
|
||||
->label(__('Passport number'))
|
||||
->required()
|
||||
->columnSpan(1)
|
||||
->mask('999999')
|
||||
->default(user()?->getOption('passport_id')),
|
||||
->default(user()->getOption('passport_id')),
|
||||
])
|
||||
->columnSpan(3)
|
||||
->label(__('Passport serie and number'))
|
||||
@@ -185,42 +185,42 @@ class LoanOrderMobileForm
|
||||
->closeOnDateSelection()
|
||||
->beforeOrEqual('today')
|
||||
->required()
|
||||
->default(user()?->getOption('passport_given_at')),
|
||||
->default(user()->getOption('passport_given_at')),
|
||||
|
||||
TextInput::make('born_place')
|
||||
->columnSpan(3)
|
||||
->label(__('Born place (passport)'))
|
||||
->maxLength(255)
|
||||
->required()
|
||||
->default(user()?->getOption('born_place')),
|
||||
->default(user()->getOption('born_place')),
|
||||
|
||||
TextInput::make('passport_given_by')
|
||||
->label(__('Passport given by'))
|
||||
->columnSpan(4)
|
||||
->maxLength(255)
|
||||
->required()
|
||||
->default(user()?->getOption('passport_given_by')),
|
||||
->default(user()->getOption('passport_given_by')),
|
||||
|
||||
TextInput::make('passport_address')
|
||||
->columnSpan(4)
|
||||
->label(__('Proscription for home'))
|
||||
->maxLength(255)
|
||||
->required()
|
||||
->default(user()?->getOption('passport_address')),
|
||||
->default(user()->getOption('passport_address')),
|
||||
|
||||
TextInput::make('real_address')
|
||||
->label(__('Current home address'))
|
||||
->columnSpan(4)
|
||||
->maxLength(255)
|
||||
->required()
|
||||
->default(user()?->getOption('real_address')),
|
||||
->default(user()->getOption('real_address')),
|
||||
|
||||
TextInput::make('email')
|
||||
->label(__('Email'))
|
||||
->email()
|
||||
->maxLength(255)
|
||||
->columnSpan(2)
|
||||
->default(user()?->getOption('email')),
|
||||
->default(user()->getOption('email')),
|
||||
|
||||
TextInput::make('phone')
|
||||
->label(__('Phone'))
|
||||
@@ -231,7 +231,7 @@ class LoanOrderMobileForm
|
||||
new PhoneNumberVerificationRule,
|
||||
])
|
||||
->columnSpan(2)
|
||||
->default(user()?->phone),
|
||||
->default(user()->phone),
|
||||
|
||||
TextInput::make('phone_additional')
|
||||
->label(__('Additional phone'))
|
||||
@@ -453,7 +453,7 @@ class LoanOrderMobileForm
|
||||
Tab::make(__('Guarantor').' 2')
|
||||
->columns(6)
|
||||
->hidden(function (Get $get): bool {
|
||||
$loan_amount = $get('loan_amount');
|
||||
$loan_amount = string($get('loan_amount'));
|
||||
|
||||
return ! ($loan_amount && intval($loan_amount) > 20000);
|
||||
})
|
||||
|
||||
@@ -10,8 +10,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*
|
||||
* @property string unique_id
|
||||
* @property string $unique_id
|
||||
* @property int $user_id
|
||||
* @property int $card_type_id
|
||||
* @property string $card_number
|
||||
@@ -20,18 +19,18 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
* @property string $customer_name
|
||||
* @property string $customer_surname
|
||||
* @property string $customer_patronic_name
|
||||
* @property date $born_at
|
||||
* @property \Illuminate\Support\Carbon $born_at
|
||||
* @property string $phone
|
||||
* @property string $passport_serie
|
||||
* @property string $passport_id
|
||||
* @property text $passport_one
|
||||
* @property text $passport_two
|
||||
* @property text $passport_three
|
||||
* @property text $passport_four
|
||||
* @property string $passport_one
|
||||
* @property string $passport_two
|
||||
* @property string $passport_three
|
||||
* @property string $passport_four
|
||||
* @property string $status
|
||||
* @property null|string $notes
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
*/
|
||||
class CardPinOrder extends Model
|
||||
{
|
||||
|
||||
@@ -8,6 +8,8 @@ class DefaultQueryForResourceIndexRepository
|
||||
{
|
||||
/**
|
||||
* Default filament table query builder
|
||||
*
|
||||
* @param Builder<\Illuminate\Database\Eloquent\Model> $query
|
||||
*/
|
||||
public static function make(Builder $query): void
|
||||
{
|
||||
|
||||
@@ -4,13 +4,17 @@ namespace App\Modules\Loan\Repositories;
|
||||
|
||||
use App\Modules\Loan\Models\Loan;
|
||||
use App\Modules\Makeable;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class LoanRepository
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
public function showRemainingLoan(Loan $record)
|
||||
/**
|
||||
* Show remaining loan
|
||||
*/
|
||||
public function showRemainingLoan(Loan $record): View
|
||||
{
|
||||
$data = $this->fetchCardBalance(
|
||||
passport_serie: user()->passport_serie(),
|
||||
@@ -21,6 +25,9 @@ class LoanRepository
|
||||
return view('module.loan::loan-remaining', compact('data'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch card card balance from abs
|
||||
*/
|
||||
public function fetchCardBalance(string $passport_serie, int|string $passport_id, int|string $account_number): object
|
||||
{
|
||||
$curl = curl_init();
|
||||
|
||||
@@ -57,6 +57,6 @@ trait RoleCheckers
|
||||
*/
|
||||
public function isSystemUser(): bool
|
||||
{
|
||||
return $this->roles->count > 0;
|
||||
return $this->roles->count() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Modules\UserAdjustments\Traits;
|
||||
|
||||
use App\Modules\Branch\Models\Branch;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
/**
|
||||
@@ -61,4 +63,14 @@ trait UserAdjustments
|
||||
{
|
||||
return (string) $this->getOption('passport_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Branches associated with user
|
||||
*
|
||||
* @return BelongsToMany<Branch>
|
||||
*/
|
||||
public function branches(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Branch::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user