schema([ Forms\Components\Section::make('اطلاعات ارز') ->schema([ Forms\Components\TextInput::make('code') ->required() ->maxLength(10) ->unique(ignoreRecord: true) ->label('کد ارز (مثل AED, USD, EUR)'), Forms\Components\TextInput::make('name') ->required() ->maxLength(100) ->label('نام ارز'), Forms\Components\TextInput::make('symbol') ->maxLength(10) ->nullable() ->label('نماد (مثل $, €, د.إ)'), ])->columns(3), Forms\Components\Section::make('نرخ تبدیل') ->schema([ Forms\Components\TextInput::make('rate_to_rial') ->required() ->numeric() ->default(0) ->suffix('ریال') ->label('نرخ نسبت به ریال'), Forms\Components\TextInput::make('rate_to_aed') ->required() ->numeric() ->default(0) ->suffix('درهم') ->label('نرخ نسبت به درهم'), Forms\Components\Toggle::make('is_active') ->default(true) ->label('فعال'), ])->columns(3), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('code') ->searchable() ->sortable() ->badge() ->label('کد'), Tables\Columns\TextColumn::make('name') ->searchable() ->sortable() ->label('نام'), Tables\Columns\TextColumn::make('symbol') ->label('نماد'), Tables\Columns\TextColumn::make('rate_to_rial') ->sortable() ->formatStateUsing(fn ($state) => number_format((float) $state, 0)) ->label('نرخ به ریال'), Tables\Columns\TextColumn::make('rate_to_aed') ->sortable() ->formatStateUsing(fn ($state) => number_format((float) $state, 4)) ->label('نرخ به درهم'), Tables\Columns\IconColumn::make('is_active') ->boolean() ->label('فعال'), ]) ->filters([ Tables\Filters\TernaryFilter::make('is_active') ->label('وضعیت'), ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getPages(): array { return [ 'index' => Pages\ListCurrencies::route('/'), 'create' => Pages\CreateCurrency::route('/create'), 'edit' => Pages\EditCurrency::route('/{record}/edit'), ]; } }