Skip to content

Commit

Permalink
add user_id table products
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelBlum committed Jul 27, 2024
1 parent cfc703a commit a4c7d2c
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions app/Filament/App/FreezerApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
use Filament\Support\Enums\MaxWidth;
use Filament\Tables\Actions\Action;
use Filament\Tables\Actions\ActionGroup;
use Filament\Tables\Actions\AttachAction;
use Filament\Tables\Actions\CreateAction;
use Filament\Tables\Actions\DeleteAction;
use Filament\Tables\Actions\EditAction;
use Filament\Tables\Actions\ViewAction;
Expand All @@ -40,6 +42,8 @@
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Table;
use Filament\Pages\Dashboard as BaseDashboard;
use Illuminate\Support\Facades\Auth;


class FreezerApp extends BaseDashboard implements HasTable, HasForms
{
Expand Down Expand Up @@ -91,6 +95,9 @@ public function form(Form $form): Form
->disableOptionsWhenSelectedInSiblingRepeaterItems()
->columnSpan(3),

Hidden::make('user_id')
->dehydrateStateUsing(fn($state) => Auth::id()),

TextInput::make('quantity')
->label('Quantidade')
->numeric()
Expand Down Expand Up @@ -121,7 +128,7 @@ public function form(Form $form): Form

public function table(Table $table): Table
{
return $table
return OrderResource::table($table)
->query(Product::query())//where('in_stock', '>', 0)
->columns([
Stack::make([
Expand All @@ -145,7 +152,8 @@ public function table(Table $table): Table
]),

Split::make([
TextColumn::make('sale_price')->prefix('R$ ')->size(90)->alignCenter(),
TextColumn::make('sale_price')
->prefix('R$ ')->size(90)->alignCenter(),

])
])->space(1),
Expand All @@ -156,6 +164,14 @@ public function table(Table $table): Table
// TextColumn::make('cost_price')->prefix('R$ '),
// ]),
//])->collapsible(),
])->headerActions([
// ...
Action::make('shopping-cart')
->label(' Finalizar comprar')
->button()
->icon('heroicon-m-plus-circle')
->color(Color::Cyan),

])
->contentGrid([
'sm' => 1,
Expand Down

0 comments on commit a4c7d2c

Please sign in to comment.