feat: updates

This commit is contained in:
JP
2024-08-11 20:03:49 +08:00
parent 140e821e0c
commit 52431a2c61
45 changed files with 1152 additions and 287 deletions

View File

@@ -3,15 +3,16 @@
namespace App\Filament\Resources;
use App\Filament\Resources\BranchResource\Pages;
use App\Filament\Resources\BranchResource\RelationManagers;
use App\Filament\Resources\BranchResource\RelationManagers\BalancesRelationManager;
use App\Models\Branch;
use Filament\Forms;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Support\RawJs;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Validation\Rules\Unique;
class BranchResource extends Resource
{
@@ -19,14 +20,34 @@ class BranchResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static bool $shouldRegisterNavigation = false;
public static function form(Form $form): Form
{
return $form
->schema([
//
Select::make('client_id')->relationship('client', 'id')
->getOptionLabelFromRecordUsing(fn ($record) => $record->company)
->disabled()
->columnSpan(2),
TextInput::make('code')->required()
->unique(
'branches',
'code',
ignoreRecord: true,
modifyRuleUsing: fn (Unique $rule) => $rule->where('client_id', app(static::getModel())->id)
),
TextInput::make('series')->label('Current Series')
->required()
->numeric()
->integer()
->maxLength(6)
->minLength(1)
->mask(RawJs::make(<<<'JS'
'999999'
JS)),
]);
}
@@ -52,7 +73,8 @@ class BranchResource extends Resource
public static function getRelations(): array
{
return [
//
// AccountsRelationManager::make(),
BalancesRelationManager::make(),
];
}