wip
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Filament\Clusters\Loans\Loans\Tables;
|
namespace App\Filament\Clusters\Loans\Loans\Tables;
|
||||||
|
|
||||||
use App\Modules\DefaultQueryForResourceIndex\Repositories\DefaultQueryForResourceIndexRepository;
|
|
||||||
use App\Modules\Loan\Filaments\Actions\ShowLoanRemainingAction;
|
use App\Modules\Loan\Filaments\Actions\ShowLoanRemainingAction;
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Filament\Clusters\Loans\Resources\LoanPaidOffLetters\Schemas;
|
namespace App\Filament\Clusters\Loans\Resources\LoanPaidOffLetters\Schemas;
|
||||||
|
|
||||||
|
use App\Modules\FilamentPermission\Repositories\FilamentPermissionRepository;
|
||||||
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
use App\Modules\OrderStatus\Repositories\OrderStatusRepository;
|
||||||
use App\Modules\PhoneNumberVerification\Rules\PhoneNumberVerificationRule;
|
use App\Modules\PhoneNumberVerification\Rules\PhoneNumberVerificationRule;
|
||||||
use App\Modules\Region\Repositories\RegionRepository;
|
use App\Modules\Region\Repositories\RegionRepository;
|
||||||
@@ -23,26 +24,10 @@ class LoanPaidOffLetterForm
|
|||||||
public static function configure(Schema $schema): Schema
|
public static function configure(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
return $schema
|
return $schema
|
||||||
|
->columns(6)
|
||||||
->components([
|
->components([
|
||||||
Hidden::make('user_id')->default(Auth::id()),
|
Hidden::make('user_id')->default(Auth::id()),
|
||||||
|
|
||||||
Section::make(__('New loan paid off letter'))
|
|
||||||
->columnSpan(4)
|
|
||||||
->columns(4)
|
|
||||||
->components([
|
|
||||||
Select::make('status')
|
|
||||||
->label(__('Status'))
|
|
||||||
->options(OrderStatusRepository::statusValues())
|
|
||||||
->default(OrderStatusRepository::defaultStatus())
|
|
||||||
->native(false)
|
|
||||||
->required()
|
|
||||||
->columnSpanFull(),
|
|
||||||
|
|
||||||
RichEditor::make('notes')
|
|
||||||
->label(__('Bellik'))
|
|
||||||
->columnSpanFull(),
|
|
||||||
]),
|
|
||||||
|
|
||||||
Section::make(__('New loan paid off letter'))
|
Section::make(__('New loan paid off letter'))
|
||||||
->columnSpan(4)
|
->columnSpan(4)
|
||||||
->columns(6)
|
->columns(6)
|
||||||
@@ -161,14 +146,41 @@ class LoanPaidOffLetterForm
|
|||||||
->required()
|
->required()
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->columnSpan(6),
|
->columnSpan(6),
|
||||||
|
]),
|
||||||
|
|
||||||
|
Section::make(__('By operator'))
|
||||||
|
->columnSpan(2)
|
||||||
|
->disabled(fn (string $context): bool => FilamentPermissionRepository::forClients())
|
||||||
|
->hidden(fn (string $context) => FilamentPermissionRepository::defaultSystemInput($context))
|
||||||
|
->components([
|
||||||
|
Select::make('status')
|
||||||
|
->label(__('Status'))
|
||||||
|
->options(OrderStatusRepository::statusValues())
|
||||||
|
->default(OrderStatusRepository::defaultStatus())
|
||||||
|
->native(false)
|
||||||
|
->required()
|
||||||
|
->columnSpanFull(),
|
||||||
|
|
||||||
|
RichEditor::make('notes')
|
||||||
|
->label(__('Bellik'))
|
||||||
|
->toolbarButtons([
|
||||||
|
'h2',
|
||||||
|
'italic',
|
||||||
|
'orderedList',
|
||||||
|
'bold',
|
||||||
|
'strike',
|
||||||
|
'underline',
|
||||||
|
])
|
||||||
|
->columnSpanFull(),
|
||||||
|
|
||||||
FileUpload::make('loan_file')
|
FileUpload::make('loan_file')
|
||||||
->label(__('Loan paid off letter file'))
|
->label(__('Loan paid off letter file'))
|
||||||
->columnSpan(2)
|
->columnSpanFull()
|
||||||
->maxSize(4096)
|
->maxSize(4096)
|
||||||
->columnSpan(2),
|
->columnSpan(2)
|
||||||
|
->downloadable()
|
||||||
|
->previewable(false),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,17 @@ namespace App\Modules\FilamentPermission\Repositories;
|
|||||||
|
|
||||||
class FilamentPermissionRepository
|
class FilamentPermissionRepository
|
||||||
{
|
{
|
||||||
|
public static function hiddenOnCreate(string $context): bool
|
||||||
|
{
|
||||||
|
return $context === 'create';
|
||||||
|
}
|
||||||
|
|
||||||
public static function forClients(): bool
|
public static function forClients(): bool
|
||||||
{
|
{
|
||||||
return ! user()->isSystemUser();
|
return ! user()->isSystemUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function defaultSystemInput(string $context)
|
public static function defaultSystemInput(string $context): bool
|
||||||
{
|
{
|
||||||
if (user()->isSystemUser()) {
|
if (user()->isSystemUser()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -154,20 +154,11 @@ class LoanOrder extends Model implements BelongsToBranch, HasStatus
|
|||||||
/**
|
/**
|
||||||
* "boot" method for model
|
* "boot" method for model
|
||||||
*/
|
*/
|
||||||
protected static function boot()
|
protected static function boot(): void
|
||||||
{
|
{
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
static::creating(LoanOrderRepository::creating());
|
static::creating(LoanOrderRepository::creating());
|
||||||
static::created(LoanOrderRepository::created());
|
static::created(LoanOrderRepository::created());
|
||||||
// static::updated(function (LoanOrder $model) {
|
|
||||||
// if ($model->notes && $model->wasChanged('notes')) {
|
|
||||||
// Alert::create([
|
|
||||||
// 'user_id' => $model->user_id,
|
|
||||||
// 'name' => 'Duýdyryş',
|
|
||||||
// 'value' => $model->notes,
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,10 @@
|
|||||||
namespace App\Modules\LoanPaidOffLetter\Models;
|
namespace App\Modules\LoanPaidOffLetter\Models;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Modules\Branch\Interfaces\BelongsToBranch;
|
||||||
use App\Modules\Branch\Models\Branch;
|
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\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
@@ -30,7 +33,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
* @property \Illuminate\Support\Carbon $created_at
|
* @property \Illuminate\Support\Carbon $created_at
|
||||||
* @property \Illuminate\Support\Carbon $updated_at
|
* @property \Illuminate\Support\Carbon $updated_at
|
||||||
*/
|
*/
|
||||||
class LoanPaidOffLetter extends Model
|
class LoanPaidOffLetter extends Model implements BelongsToBranch, HasStatus
|
||||||
{
|
{
|
||||||
protected $table = 'loan_paid_off_letters';
|
protected $table = 'loan_paid_off_letters';
|
||||||
|
|
||||||
@@ -58,4 +61,15 @@ class LoanPaidOffLetter extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(Branch::class);
|
return $this->belongsTo(Branch::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "boot" method for model
|
||||||
|
*/
|
||||||
|
protected static function boot(): void
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::creating(LoanOrderRepository::creating());
|
||||||
|
static::created(LoanOrderRepository::created());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -694,5 +694,6 @@
|
|||||||
"PHD": "Ylymlaryň doktory",
|
"PHD": "Ylymlaryň doktory",
|
||||||
"Married": "Öýlenen/Durmuşa çykan",
|
"Married": "Öýlenen/Durmuşa çykan",
|
||||||
"Divorced": "Aýrylşan",
|
"Divorced": "Aýrylşan",
|
||||||
"Single": "Öýlenmedik/Durmuşa çykmadyk"
|
"Single": "Öýlenmedik/Durmuşa çykmadyk",
|
||||||
|
"By operator": "Operatordan"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user