Compare commits

..

3 commits

Author SHA1 Message Date
Anna-Sara Sélea
0e57494e0b Fix with edit view 2026-08-21 16:44:25 +02:00
Anna-Sara Sélea
4a2ff8e472 Fix with logo in mobile 2026-08-19 07:49:03 +02:00
Anna-Sara Sélea
9d0852560d Fix with translations and favicon 2026-08-19 07:38:46 +02:00
19 changed files with 132 additions and 34 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -29,7 +29,10 @@ class PublicPanelProvider extends PanelProvider
->brandName('vBytes')
->brandLogo(asset('img/logo.png'))
->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()
->navigation(false)
->darkMode(true)
->renderHook(
PanelsRenderHook::TOPBAR_END,

66
lang/sv.json Normal file
View file

@ -0,0 +1,66 @@
{
"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."
}

BIN
public/apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
public/img/favicon-16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
public/img/favicon-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

BIN
public/img/logo-mark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -6,6 +6,11 @@
<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 -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />

View file

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