Compare commits

..

No commits in common. "0e57494e0b889d8ee95408bb469bd9a22511b423" and "8f3986c8c2b6192fde3dff514b7638cc09a86ba6" have entirely different histories.

19 changed files with 34 additions and 132 deletions

View file

@ -51,17 +51,14 @@ class Reserve extends BasePage implements HasTable
protected string $view = 'filament.pages.reserve'; protected string $view = 'filament.pages.reserve';
public function getTitle(): string protected static ?string $title = 'Reservera spel';
{
return __('Reserve games');
}
public static function table(Table $table): Table public static function table(Table $table): Table
{ {
return $table return $table
->query( Item::where('can_be_loaned', true)->whereIn('type', ["game", "literature"])) ->query( Item::where('can_be_loaned', true)->whereIn('type', ["game", "literature"]))
->emptyStateHeading(__('No results')) ->emptyStateHeading('Inga resultat')
->searchable(true) ->searchable(true)
->columns([ ->columns([
Grid::make() Grid::make()
@ -70,11 +67,11 @@ class Reserve extends BasePage implements HasTable
Stack::make([ Stack::make([
TextColumn::make('reserved') TextColumn::make('reserved')
->weight(FontWeight::Bold) ->weight(FontWeight::Bold)
->formatStateUsing(fn (string $state): string => $state ? __('On loan') : __('Available')) ->formatStateUsing(fn (string $state): string => $state ? 'Utlånad' : 'Tillgänglig')
->color(fn($record) => $record->reserved ? 'danger' : 'success' ) ->color(fn($record) => $record->reserved ? 'danger' : 'success' )
->badge(), ->badge(),
ImageColumn::make('image') ImageColumn::make('image')
->label(__('Image')) ->label('Bild')
->disk('public') ->disk('public')
->size('100%') ->size('100%')
->extraImgAttributes([ ->extraImgAttributes([
@ -83,29 +80,29 @@ class Reserve extends BasePage implements HasTable
]), ]),
//->visibility('private'), //->visibility('private'),
TextColumn::make('desc') TextColumn::make('desc')
->label(__('Description')) ->label('Beskrivning')
->sortable() ->sortable()
->searchable() ->searchable()
->weight(FontWeight::Bold) ->weight(FontWeight::Bold)
->size(TextSize::Large), ->size(TextSize::Large),
Stack::make([ Stack::make([
TextColumn::make('players') TextColumn::make('players')
->label(__('Players')) ->label('Antal spelare')
->default(__('No information')) ->default('Ingen uppgift')
->sortable() ->sortable()
->prefix(__('Players') . ': '), ->prefix('Spelare: '),
//->suffix(' st'), //->suffix(' st'),
TextColumn::make('play_time') TextColumn::make('play_time')
->label(__('Play time')) ->label('Speltid')
->sortable() ->sortable()
->default(__('No information')) ->default('Ingen uppgift')
->prefix(__('Play time (min)') . ': '), ->prefix('Speltid (min): '),
//->suffix(' min'), //->suffix(' min'),
TextColumn::make('age') TextColumn::make('age')
->label(__('Age')) ->label('Ålder')
->sortable() ->sortable()
->default(__('No information')) ->default('Ingen uppgift')
->prefix(__('Age') . ': ') ->prefix('Ålder: ')
//->suffix(' år'), //->suffix(' år'),
]) ])
->extraAttributes(['class' => 'reserve-card-meta']) ->extraAttributes(['class' => 'reserve-card-meta'])
@ -132,7 +129,7 @@ class Reserve extends BasePage implements HasTable
Filter::make('filters') Filter::make('filters')
->form([ ->form([
Select::make('type') Select::make('type')
->label(__('Type')) ->label('Typ')
->live() ->live()
->options([ ->options([
'game' => __('Game'), 'game' => __('Game'),
@ -140,13 +137,13 @@ class Reserve extends BasePage implements HasTable
]), ]),
Select::make('category_id') Select::make('category_id')
->multiple() ->multiple()
->label(__('Category literature')) ->label('Kategorier Litteratur')
->options(Category::all()->whereIn('type', 'literature')->pluck('name', 'id')) ->options(Category::all()->whereIn('type', 'literature')->pluck('name', 'id'))
->hidden(fn ($get): string => $get('type') == 'game' || $get('type') == ''), ->hidden(fn ($get): string => $get('type') == 'game' || $get('type') == ''),
Select::make('category_id') Select::make('category_id')
->multiple() ->multiple()
->label(__('Category games')) ->label('Kategorier Spel')
->options(Category::all()->whereIn('type', 'game')->pluck('name', 'id')) ->options(Category::all()->whereIn('type', 'game')->pluck('name', 'id'))
->hidden(fn ($get): string => $get('type') == 'literature' || $get('type') == ''), ->hidden(fn ($get): string => $get('type') == 'literature' || $get('type') == ''),
]) ])
@ -167,30 +164,30 @@ class Reserve extends BasePage implements HasTable
]) ])
->columnSpan(2), ->columnSpan(2),
Filter::make('reserved') Filter::make('reserved')
->label(__('Available')) ->label('Tillgänglig')
->query(fn (Builder $query): Builder => $query->where('reserved', false)) ->query(fn (Builder $query): Builder => $query->where('reserved', false))
->columnSpanFull() ->columnSpanFull()
->toggle() ->toggle()
],layout: FiltersLayout::AboveContent) ],layout: FiltersLayout::AboveContent)
->actions([ ->actions([
Action::make('reserve') Action::make('reserve')
->label(__('Reserve')) ->label('Reservera')
->button() ->button()
->color('primary') ->color('primary')
->form([ ->form([
TextInput::make('username') TextInput::make('username')
->label(__('Name')) ->label('Namn')
->required(), ->required(),
TextInput::make('email') TextInput::make('email')
->label(__('Email')) ->label('Email')
->email() ->email()
->required(), ->required(),
TextInput::make('phone') TextInput::make('phone')
->label(__('Phone')) ->label('Telefonnummer')
->tel() ->tel()
->required(), ->required(),
Checkbox::make('gdpr') Checkbox::make('gdpr')
->label(__('By checking this box you agree that we store your email address and phone number.')) ->label('Genom att checka i denna rutan godkänner du att vi lagrar din mailadress och telefonnummer.')
->accepted(), ->accepted(),
]) ])
->action(function (array $data, Item $record): void { ->action(function (array $data, Item $record): void {
@ -207,8 +204,8 @@ class Reserve extends BasePage implements HasTable
Mail::to(env('MAIL_TO_ADDRESS')) Mail::to(env('MAIL_TO_ADDRESS'))
->send(new ReservationCreated($reservation)); ->send(new ReservationCreated($reservation));
Notification::make() Notification::make()
->title(__('The game is reserved!')) ->title('Spelet är reserverat!')
->body(__('A confirmation email has been sent to the address you provided. Read it for more information about collecting the game.')) ->body('Ett bekräftelsemail har skickats till emailadressen du uppgav. Läs det för mer info om utlämning av spelet.')
->success() ->success()
->seconds(10) ->seconds(10)
->send(); ->send();

View file

@ -341,7 +341,7 @@ class ItemResource extends Resource
->tel() ->tel()
->required(), ->required(),
Checkbox::make('gdpr') Checkbox::make('gdpr')
->label(__('By checking this box you agree that we store your email address and phone number.')) ->label('Genom att checka i denna rutan godkänner du att vi lagrar din mailadress och telefonnummer.')
->accepted(), ->accepted(),
]) ])
->action(function (array $data, Item $record): void { ->action(function (array $data, Item $record): void {

View file

@ -9,11 +9,12 @@ use App\Models\Item;
use Filament\Forms; use Filament\Forms;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Resources\Get;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Schemas\Components\Section; use Filament\Forms\Components\Section;
use Filament\Forms\Components\Radio; use Filament\Forms\Components\Radio;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle; use Filament\Forms\Components\Toggle;
@ -65,13 +66,11 @@ class ReserveditemResource extends Resource
->required(), ->required(),
TextInput::make('email') TextInput::make('email')
->label('Email') ->label('Email')
->translateLabel()
->default(null) ->default(null)
->email() ->email()
->required(), ->required(),
TextInput::make('phone') TextInput::make('phone')
->label('Phone') ->label('Phone')
->translateLabel()
->default(null) ->default(null)
->tel() ->tel()
->required(), ->required(),
@ -105,12 +104,10 @@ class ReserveditemResource extends Resource
->icon('heroicon-m-user'), ->icon('heroicon-m-user'),
TextColumn::make('email') TextColumn::make('email')
->label('Email') ->label('Email')
->translateLabel()
->sortable() ->sortable()
->icon('heroicon-m-envelope'), ->icon('heroicon-m-envelope'),
TextColumn::make('phone') TextColumn::make('phone')
->label('Phone') ->label('Phone')
->translateLabel()
->sortable() ->sortable()
->icon('heroicon-m-phone'), ->icon('heroicon-m-phone'),
TextColumn::make('reserved_date') TextColumn::make('reserved_date')

View file

@ -13,9 +13,8 @@ use Filament\Tables;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Schemas\Components\Section; use Filament\Forms\Components\Section;
use Filament\Forms\Components\Radio; use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle; use Filament\Forms\Components\Toggle;
use Filament\Support\Enums\IconPosition; use Filament\Support\Enums\IconPosition;
@ -42,7 +41,6 @@ class ReserveditemResourceUser extends Resource
->schema([ ->schema([
Select::make('item_id') Select::make('item_id')
->label('Choose an item to reserve') ->label('Choose an item to reserve')
->translateLabel()
->relationship( ->relationship(
name: 'item', name: 'item',
titleAttribute: 'desc', titleAttribute: 'desc',
@ -64,27 +62,21 @@ class ReserveditemResourceUser extends Resource
->columns([ ->columns([
TextColumn::make('items.desc') TextColumn::make('items.desc')
->label('Name') ->label('Name')
->translateLabel()
->sortable(), ->sortable(),
TextColumn::make('username') TextColumn::make('username')
->label('User') ->label('User')
->translateLabel()
->sortable(), ->sortable(),
TextColumn::make('reserved_date') TextColumn::make('reserved_date')
->label('Reserved date') ->label('Reserved date')
->translateLabel()
->sortable(), ->sortable(),
TextColumn::make('delivered_date') TextColumn::make('delivered_date')
->label('Delivery date') ->label('Delivery date')
->translateLabel()
->sortable(), ->sortable(),
TextColumn::make('return_date') TextColumn::make('return_date')
->label('Return date') ->label('Return date')
->translateLabel()
->sortable(), ->sortable(),
TextColumn::make('returned_date') TextColumn::make('returned_date')
->label('Returned') ->label('Returned')
->translateLabel()
->sortable(), ->sortable(),
]) ])
->filters([ ->filters([

View file

@ -12,7 +12,7 @@ use Filament\Tables;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Schemas\Components\Section; use Filament\Forms\Components\Section;
use Filament\Forms\Components\Radio; use Filament\Forms\Components\Radio;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle; use Filament\Forms\Components\Toggle;

View file

@ -4,6 +4,7 @@ namespace App\Filament\Widgets;
use Filament\Widgets\StatsOverviewWidget as BaseWidget; use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat; use Filament\Widgets\StatsOverviewWidget\Stat;
use Filament\Widgets\StatsOverviewWidget\Card;
use App\Models\User; use App\Models\User;
use App\Models\Item; use App\Models\Item;
use App\Models\Reserveditem; use App\Models\Reserveditem;
@ -31,7 +32,7 @@ class AdminWidget extends BaseWidget
} }
return [ return [
//Stat::make(__('Total number of users'), User::count() ), //Card::make(__('Total number of users'), User::count() ),
Stat::make(__('Total amount of games'), Item::where('type', 'game')->count() ), Stat::make(__('Total amount of games'), Item::where('type', 'game')->count() ),
Stat::make(__('Total amount of items'), Item::where('type', 'item')->count() ), Stat::make(__('Total amount of items'), Item::where('type', 'item')->count() ),
Stat::make(__('Total amount of literature'), Item::where('type', 'literature')->count() ), Stat::make(__('Total amount of literature'), Item::where('type', 'literature')->count() ),

View file

@ -27,7 +27,6 @@ class AdminPanelProvider extends PanelProvider
->id('admin') ->id('admin')
->path('/') ->path('/')
->login() ->login()
->favicon(asset('img/favicon-32.png') . '?v=2')
->colors([ ->colors([
'primary' => Color::hex('#0080bb'), 'primary' => Color::hex('#0080bb'),
]) ])

View file

@ -29,10 +29,7 @@ class PublicPanelProvider extends PanelProvider
->brandName('vBytes') ->brandName('vBytes')
->brandLogo(asset('img/logo.png')) ->brandLogo(asset('img/logo.png'))
->brandLogoHeight('2rem') ->brandLogoHeight('2rem')
// ?v= tvingar webbläsare att hämta om ikonen; höj siffran vid byte
->favicon(asset('img/favicon-32.png') . '?v=2')
->topNavigation() ->topNavigation()
->navigation(false)
->darkMode(true) ->darkMode(true)
->renderHook( ->renderHook(
PanelsRenderHook::TOPBAR_END, PanelsRenderHook::TOPBAR_END,

View file

@ -1,66 +0,0 @@
{
"A confirmation email has been sent to the address you provided. Read it for more information about collecting the game.": "Ett bekräftelsemail har skickats till emailadressen du uppgav. Läs det för mer info om utlämning av spelet.",
"Acquisition date": "Inköpsdatum",
"Age": "Ålder",
"Available": "Tillgänglig",
"By checking this box you agree that we store your email address and phone number.": "Genom att checka i denna rutan godkänner du att vi lagrar din mailadress och telefonnummer.",
"Can be loaned": "Kan lånas",
"Categories": "Kategorier",
"Category": "Kategori",
"Category games": "Kategorier Spel",
"Category id": "Kategori",
"Category items": "Kategorier Prylar",
"Category literature": "Kategorier Litteratur",
"Choose an item to reserve": "Välj en post att reservera",
"Cost": "Pris",
"Create new": "Skapa ny",
"Delivered": "Utlämnad",
"Delivered date": "Utlämningsdatum",
"Delivery date": "Utlämningsdatum",
"Desc": "Beskrivning",
"Description": "Beskrivning",
"Email": "Email",
"Game": "Spel",
"Image": "Bild",
"Inventory": "Inventarie",
"Is admin": "Administratör",
"Item": "Pryl",
"Item id": "Post",
"Literature": "Litteratur",
"Loanable": "Kan lånas",
"More info": "Mer info",
"Most reserved game": "Mest reserverade spel",
"Name": "Namn",
"No information": "Ingen uppgift",
"No results": "Inga resultat",
"On loan": "Utlånad",
"Password": "Lösenord",
"Phone": "Telefonnummer",
"Play time": "Speltid",
"Play time (min)": "Speltid (min)",
"Players": "Spelare",
"Price": "Pris",
"Quantity": "Antal",
"Reservation": "Reservation",
"Reservation date": "Reservationsdatum",
"Reservations": "Reservationer",
"Reservations at the moment": "Aktuella reservationer",
"Reservations over time": "Reservationer över tid",
"Reserve": "Reservera",
"Reserve games": "Reservera spel",
"Reserved": "Reserverad",
"Reserved date": "Reservationsdatum",
"Return date": "Återlämningsdatum",
"Returned": "Återlämnad",
"Returned date": "Återlämnad datum",
"The game is reserved!": "Spelet är reserverat!",
"Total amount of games": "Antal spel",
"Total amount of items": "Antal prylar",
"Total amount of literature": "Antal litteratur",
"Total number of users": "Antal användare",
"Type": "Typ",
"User": "Användare",
"Username": "Namn",
"Users": "Användare",
"Welcome! Here you can reserve games that you would like to borrow.": "Välkommen! Här kan du reservera spel som du gärna vill låna."
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -6,11 +6,6 @@
<title inertia>{{ config('app.name', 'Laravel') }}</title> <title inertia>{{ config('app.name', 'Laravel') }}</title>
<link rel="icon" href="{{ asset('favicon.ico') }}?v=2" sizes="any">
<link rel="icon" type="image/png" sizes="32x32" href="{{ asset('img/favicon-32.png') }}?v=2">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('img/favicon-16.png') }}?v=2">
<link rel="apple-touch-icon" href="{{ asset('img/apple-touch-icon.png') }}?v=2">
<!-- Fonts --> <!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net"> <link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" /> <link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />

View file

@ -23,20 +23,10 @@
.reserve-card-meta > * + * { .reserve-card-meta > * + * {
margin-top: 0 !important; margin-top: 0 !important;
} }
.fi-topbar-start {
display: flex;
}
@media (width < 64rem) {
.fi-topbar-start .fi-logo {
margin-inline-start: 0;
}
}
</style> </style>
<p class="text-sm text-gray-500 dark:text-gray-400 -mt-4"> <p class="text-sm text-gray-500 dark:text-gray-400 -mt-4">
{{ __('Welcome! Here you can reserve games that you would like to borrow.') }} Välkommen! Här kan du reservera spel som du gärna vill låna.
</p> </p>
{{ $this->table }} {{ $this->table }}