Skip to content

Commit

Permalink
feat: add link produto modal infolist
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelBlum committed Jul 26, 2024
1 parent b206ae7 commit cfc703a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
18 changes: 13 additions & 5 deletions app/Filament/App/FreezerApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Filament\Forms\Components\PtbrMoney;
use App\Filament\Resources\OrderResource;
use App\Filament\Resources\ProductResource;
use App\Models\Order;
use App\Models\Product;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Hidden;
Expand Down Expand Up @@ -126,11 +127,21 @@ public function table(Table $table): Table
Stack::make([
ImageColumn::make('image')
->height('100%')
->width('100%'),
->width('100%')
->action(
ViewAction::make()->label('')
->infolist(fn(Infolist $infolist) => ProductResource::infolist($infolist))
->form(fn(Form $form) => ProductResource::form($form))->icon('heroicon-m-eye')->tooltip('Ver mais'),
),
Stack::make([
TextColumn::make('name')
->weight(FontWeight::ExtraBold)
->alignCenter()->size(200),
->alignCenter()->size(200)
->action(
ViewAction::make()->label('')
->infolist(fn(Infolist $infolist) => ProductResource::infolist($infolist))
->form(fn(Form $form) => ProductResource::form($form))->icon('heroicon-m-eye')->tooltip('Ver mais'),
),
]),

Split::make([
Expand Down Expand Up @@ -170,9 +181,6 @@ public function table(Table $table): Table
->icon('heroicon-m-plus-circle')
->color(Color::Teal)
->url(fn(Product $record): string => '#' . urlencode($record->url)),
ViewAction::make()->label('')
->infolist(fn(Infolist $infolist) => ProductResource::infolist($infolist))
->form(fn(Form $form) => ProductResource::form($form))->icon('heroicon-m-eye')->tooltip('Ver mais'),
ActionGroup::make([
EditAction::make()->form(fn(Form $form) => ProductResource::form($form)),
DeleteAction::make(),
Expand Down
15 changes: 15 additions & 0 deletions app/Filament/Resources/ProductResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@

use App\Filament\Forms\Components\PtbrMoney;
use App\Filament\Resources\ProductResource\Pages;
use App\Models\Blog\Link;
use App\Models\Product;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Infolists\Components\ColorEntry;
use Filament\Infolists\Components\ImageEntry;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
Expand Down Expand Up @@ -65,6 +70,16 @@ public static function form(Form $form): Form
]);
}

public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
TextEntry::make('name'),
TextEntry::make('sale_price'),
ImageEntry::make('image'),
]);
}

public static function table(Table $table): Table
{
return $table
Expand Down

0 comments on commit cfc703a

Please sign in to comment.