Skip to content

Commit

Permalink
last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ysoyloco committed Dec 22, 2024
1 parent 1e43f87 commit 2f70a03
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 32 deletions.
48 changes: 17 additions & 31 deletions app/Filament/Resources/InvoiceResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,48 +35,34 @@ public static function table(Table $table): Table
->label('Data wpłynięcia')
->dateTime('d.m.Y H:i')
->sortable(),


TextColumn::make('user.name')
->label('Imię i nazwisko')
->visible(fn() => auth()->user()->isAdmin()),

TextColumn::make('user.email')
->label('Email')
->visible(fn() => auth()->user()->isAdmin()),

TextColumn::make('amount')
->label('Kwota')
->money('pln')
->sortable(),

TextColumn::make('status')
->label('Status')
->badge()
->formatStateUsing(fn (string $state): string => match ($state) {
'booked' => 'Zaksięgowane',
'cancelled' => 'Anulowane',
'processing' => 'W trakcie przetwarzania',
})
->color(fn (string $state): string => match ($state) {
'booked' => 'success',
'cancelled' => 'danger',
'processing' => 'warning',
}),

])
->actions([
Tables\Actions\EditAction::make()
->label('Edytuj'),
Tables\Actions\DeleteAction::make()
->label('Usuń'),
Action::make('downloadInvoice')
->label('Pobierz fakturę')
->icon('heroicon-o-document-arrow-down')
->action(function (Invoice $record) {
$pdf = \PDF::loadView('invoices.invoice', ['invoice' => $record]);
return response()->streamDownload(function () use ($pdf) {
echo $pdf->output();
}, "faktura_{$record->id}.pdf");
$pdf = PDF::loadView('invoices.invoice', ['invoice' => $record]);
return response()->streamDownload(
fn () => print($pdf->output()),
"faktura_{$record->id}.pdf"
);
}),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make()
->label('Usuń zaznaczone'),
]),
]);
}

]); }

public static function getPages(): array
{
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"require-dev": {
"fakerphp/faker": "^1.23",
"jn-jairo/laravel-ngrok": "^3.0",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
Expand Down
68 changes: 67 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions config/ngrok.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return [
'token' => '2Lv35tcnADsYjMclammQpF6gUq2_2WtDH2kLjQxfqaPpMikHb',
'region' => 'eu',
'tunnels' => [
'app' => [
'addr' => 'tmpanel.dvl.to:80',
'proto' => 'http',
'host_header' => 'tmpanel.dvl.to',
],
],
];
Binary file added ngrok.zip
Binary file not shown.

0 comments on commit 2f70a03

Please sign in to comment.