components([ Schemas\Components\Section::make(__('Identificare')) ->columns(3) ->schema([ Forms\Components\TextInput::make('name')->label(__('Nume canal'))->required()->maxLength(120), Forms\Components\TextInput::make('icon')->label(__('Iconiță (emoji)'))->maxLength(8)->placeholder('🔍 / 📘 / 📸'), Forms\Components\ColorPicker::make('color'), ]), Schemas\Components\Section::make(__('Buget & rezultate (luna curentă)')) ->columns(3) ->schema([ Forms\Components\TextInput::make('budget_monthly')->label(__('Buget'))->numeric()->default(0), Forms\Components\TextInput::make('spent_monthly')->label(__('Cheltuit'))->numeric()->default(0), Forms\Components\TextInput::make('revenue')->label(__('Venit generat'))->numeric()->default(0), Forms\Components\TextInput::make('leads_count')->label(__('Lead-uri'))->numeric()->default(0), Forms\Components\TextInput::make('converted_count')->label(__('Convertite'))->numeric()->default(0), Forms\Components\Toggle::make('is_active')->label(__('Activ'))->default(true), ]), Forms\Components\Textarea::make('notes')->label(__('Observații'))->columnSpanFull()->rows(2), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\ColorColumn::make('color')->label(''), Tables\Columns\TextColumn::make('icon')->label('')->width(40), Tables\Columns\TextColumn::make('name')->searchable()->sortable(), Tables\Columns\TextColumn::make('budget_monthly')->label(__('Buget'))->money('MDL')->alignRight(), Tables\Columns\TextColumn::make('spent_monthly')->label(__('Cheltuit'))->money('MDL')->alignRight(), Tables\Columns\TextColumn::make('leads_count')->label(__('Lead-uri'))->alignRight(), Tables\Columns\TextColumn::make('converted_count')->label(__('Convertite'))->alignRight(), Tables\Columns\TextColumn::make('revenue')->label(__('Venit'))->money('MDL')->alignRight()->color('success'), Tables\Columns\TextColumn::make('roi') ->label(__('ROI')) ->state(fn (MarketingChannel $r) => $r->roi) ->formatStateUsing(fn ($s) => $s . '%') ->color(fn ($s) => $s >= 0 ? 'success' : 'danger') ->alignRight(), Tables\Columns\TextColumn::make('cost_per_lead') ->label(__('Cost/lead')) ->state(fn (MarketingChannel $r) => $r->cost_per_lead) ->money('MDL') ->alignRight(), Tables\Columns\IconColumn::make('is_active')->boolean(), ]) ->filters([ Tables\Filters\TernaryFilter::make('is_active')->label(__('Active')), ]) ->actions([ Actions\EditAction::make(), Actions\DeleteAction::make(), ]) ->defaultSort('revenue', 'desc'); } public static function getPages(): array { return [ 'index' => Pages\ListMarketingChannels::route('/'), 'create' => Pages\CreateMarketingChannel::route('/create'), 'edit' => Pages\EditMarketingChannel::route('/{record}/edit'), ]; } }