Archived
1
0
Fork 0

Merge branch 'admin'

This commit is contained in:
Henrik Hautakoski 2022-01-09 14:12:09 +01:00
commit a061c8b713
51 changed files with 1612 additions and 21 deletions

View file

@ -13,7 +13,7 @@ return [
|
*/
'failed' => 'These credentials do not match our records.',
'failed' => 'Invalid username and/or password',
'password' => 'The provided password is incorrect.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',

View file

@ -1,6 +1,9 @@
{
"Name": "Namn",
"Loading": "Laddar",
"Save": "Spara",
"New": "Ny",
"Back": "Tillbaka",
"Somebody" : "Någon",
"Create shareable URL": "Skapa en delbar URL",
"Sharable URL": "Delbar URL",
@ -10,12 +13,42 @@
"Go again?" : "Köra igen?",
"Game over!" : "Spelet slut!",
"Winning rows": "Vinstrader",
"Class": "Klass",
"Classes" : "Klasser",
"Character": "Karaktär",
"Characters" : "Karaktärer",
"Card": "Kort",
"Cards": "Kort",
"singular_somebody" : "Någon",
"plurar_somebody" : "Några",
"plurar_tank": "Tanken",
"plurar_paladin" : "Paladinen"
"plurar_paladin" : "Paladinen",
"Actions": "Åtgärd",
"Create card": "Skapa kort",
"Edit card": "Ändra kort",
"Card was successfully created.": "Kortet har lagts till.",
"Card was successfully updated.": "Kortet har uppdaterats.",
"Card #:id was deleted.": "Kort #:id togs bort.",
"Create character": "Skapa karaktär",
"Edit character": "Ändra karaktär",
"Character was successfully created.": "Karaktären har lagts till.",
"Character was successfully updated.": "Karaktären har uppdaterats.",
"Character #:id was deleted.": "Karaktär #:id togs bort.",
"Create raid": "Skapa raid",
"Edit raid": "Ändra raid",
"Raid was successfully created.": "Raiden har lagts till.",
"Raid was successfully updated.": "Raiden har uppdaterats.",
"Raid #:id was deleted.": "Raid #:id togs bort.",
"Select a character": "Välj en karaktär",
"Select a class": "Välj en klass",
"Select a raid": "Välj en raid",
"Logout": "Logga ut"
}

View file

@ -0,0 +1,18 @@
<?php
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
return [
'failed' => 'Ogiltigt användarnamn ock/eller lösenord',
'password' => 'Lösenordet är felaktigt',
'throttle' => 'För många inloggningsförsök. Var vänlig försök igen om :seconds sekunder.',
];

View file

@ -0,0 +1,17 @@
<?php
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
return [
'next' => 'Nästa &raquo;',
'previous' => '&laquo; Föregående',
];

View file

@ -0,0 +1,20 @@
<?php
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
return [
'reset' => 'Lösenordet har blivit återställt!',
'sent' => 'Lösenordspåminnelse skickad!',
'throttled' => 'Vänligen vänta innan du försöker igen.',
'token' => 'Koden för lösenordsåterställning är ogiltig.',
'user' => 'Det finns ingen användare med den e-postadressen.',
];

View file

@ -0,0 +1,160 @@
<?php
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
return [
'accepted' => ':Attribute måste accepteras.',
'accepted_if' => 'The :attribute must be accepted when :other is :value.',
'active_url' => ':Attribute är inte en giltig webbadress.',
'after' => ':Attribute måste vara ett datum efter :date.',
'after_or_equal' => ':Attribute måste vara ett datum senare eller samma dag som :date.',
'alpha' => ':Attribute får endast innehålla bokstäver.',
'alpha_dash' => ':Attribute får endast innehålla bokstäver, siffror och bindestreck.',
'alpha_num' => ':Attribute får endast innehålla bokstäver och siffror.',
'array' => ':Attribute måste vara en array.',
'attached' => 'Denna :attribute är redan bifogad.',
'before' => ':Attribute måste vara ett datum innan :date.',
'before_or_equal' => ':Attribute måste vara ett datum före eller samma dag som :date.',
'between' => [
'array' => ':Attribute måste innehålla mellan :min - :max objekt.',
'file' => ':Attribute måste vara mellan :min till :max kilobyte stor.',
'numeric' => ':Attribute måste vara en siffra mellan :min och :max.',
'string' => ':Attribute måste innehålla :min till :max tecken.',
],
'boolean' => ':Attribute måste vara sant eller falskt.',
'confirmed' => ':Attribute bekräftelsen matchar inte.',
'current_password' => 'The password is incorrect.',
'date' => ':Attribute är inte ett giltigt datum.',
'date_equals' => ':Attribute måste vara ett datum lika med :date.',
'date_format' => ':Attribute matchar inte formatet :format.',
'declined' => 'The :attribute must be declined.',
'declined_if' => 'The :attribute must be declined when :other is :value.',
'different' => ':Attribute och :other får inte vara lika.',
'digits' => ':Attribute måste vara :digits tecken.',
'digits_between' => ':Attribute måste vara mellan :min och :max tecken.',
'dimensions' => ':Attribute har felaktiga bilddimensioner.',
'distinct' => ':Attribute innehåller fler än en repetition av samma element.',
'email' => ':Attribute måste innehålla en korrekt e-postadress.',
'ends_with' => ':Attribute måste sluta med en av följande: :values.',
'exists' => ':Attribute är ogiltigt.',
'file' => ':Attribute måste vara en fil.',
'filled' => ':Attribute är obligatoriskt.',
'gt' => [
'array' => ':Attribute måste innehålla fler än :value objekt.',
'file' => ':Attribute måste vara större än :value kilobyte stor.',
'numeric' => ':Attribute måste vara större än :value.',
'string' => ':Attribute måste vara längre än :value tecken.',
],
'gte' => [
'array' => ':Attribute måste innehålla lika många eller fler än :value objekt.',
'file' => ':Attribute måste vara lika med eller större än :value kilobyte stor.',
'numeric' => ':Attribute måste vara lika med eller större än :value.',
'string' => ':Attribute måste vara lika med eller längre än :value tecken.',
],
'image' => ':Attribute måste vara en bild.',
'in' => ':Attribute är ogiltigt.',
'in_array' => ':Attribute finns inte i :other.',
'integer' => ':Attribute måste vara en siffra.',
'ip' => ':Attribute måste vara en giltig IP-adress.',
'ipv4' => ':Attribute måste vara en giltig IPv4-adress.',
'ipv6' => ':Attribute måste vara en giltig IPv6-adress.',
'json' => ':Attribute måste vara en giltig JSON-sträng.',
'lt' => [
'array' => ':Attribute måste innehålla färre än :value objekt.',
'file' => ':Attribute måste vara mindre än :value kilobyte stor.',
'numeric' => ':Attribute måste vara mindre än :value.',
'string' => ':Attribute måste vara kortare än :value tecken.',
],
'lte' => [
'array' => ':Attribute måste innehålla lika många eller färre än :value objekt.',
'file' => ':Attribute måste vara lika med eller mindre än :value kilobyte stor.',
'numeric' => ':Attribute måste vara lika med eller mindre än :value.',
'string' => ':Attribute måste vara lika med eller kortare än :value tecken.',
],
'max' => [
'array' => ':Attribute får inte innehålla mer än :max objekt.',
'file' => ':Attribute får max vara :max kilobyte stor.',
'numeric' => ':Attribute får inte vara större än :max.',
'string' => ':Attribute får max innehålla :max tecken.',
],
'mimes' => ':Attribute måste vara en fil av typen: :values.',
'mimetypes' => ':Attribute måste vara en fil av typen: :values.',
'min' => [
'array' => ':Attribute måste innehålla minst :min objekt.',
'file' => ':Attribute måste vara minst :min kilobyte stor.',
'numeric' => ':Attribute måste vara större än :min.',
'string' => ':Attribute måste innehålla minst :min tecken.',
],
'multiple_of' => ':attribute måste vara en multipel av :value',
'not_in' => ':Attribute är ogiltigt.',
'not_regex' => 'Formatet för :attribute är ogiltigt.',
'numeric' => ':Attribute måste vara en siffra.',
'password' => 'Lösenordet är fel.',
'present' => ':Attribute måste finnas med.',
'prohibited' => 'Fältet :attribute är förbjudet.',
'prohibited_if' => ':attribute är förbjudet när :other är :value.',
'prohibited_unless' => ':attribute är förbjudet om inte :other är :values.',
'prohibits' => 'The :attribute field prohibits :other from being present.',
'regex' => ':Attribute har ogiltigt format.',
'relatable' => 'Denna :attribute kanske inte är associerad med den här resursen.',
'required' => ':Attribute är obligatoriskt.',
'required_if' => ':Attribute är obligatoriskt när :other är :value.',
'required_unless' => ':Attribute är obligatoriskt när inte :other finns bland :values.',
'required_with' => ':Attribute är obligatoriskt när :values är ifyllt.',
'required_with_all' => ':Attribute är obligatoriskt när :values är ifyllt.',
'required_without' => ':Attribute är obligatoriskt när :values ej är ifyllt.',
'required_without_all' => ':Attribute är obligatoriskt när ingen av :values är ifyllt.',
'same' => ':Attribute och :other måste vara lika.',
'size' => [
'array' => ':Attribute måste innehålla :size objekt.',
'file' => ':Attribute får endast vara :size kilobyte stor.',
'numeric' => ':Attribute måste vara :size.',
'string' => ':Attribute måste innehålla :size tecken.',
],
'starts_with' => ':Attribute måste börja med en av följande: :values',
'string' => ':Attribute måste vara en sträng.',
'timezone' => ':Attribute måste vara en giltig tidszon.',
'unique' => ':Attribute används redan.',
'uploaded' => ':Attribute kunde inte laddas upp.',
'url' => ':Attribute har ett ogiltigt format.',
'uuid' => ':Attribute måste vara ett giltigt UUID.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
//'attribute-name' => [
// 'rule-name' => 'custom-message',
//],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap our attribute placeholder
| with something more reader friendly such as "E-Mail Address" instead
| of "email". This simply helps us make our message more expressive.
|
*/
'attributes' => [],
];

View file

@ -0,0 +1,20 @@
<x-layout name="admin">
@livewire('datatable', [
'model' => \App\Models\Admin::class,
'default_sort' => 'id',
'columns' => [
'id' => '#',
'username' => 'Username',
'created_at' => 'Created',
'updated_at' => 'Updated',
],
'sort_columns' => [
'id' => 'id',
'username' => 'username',
'created_at' => 'created_at',
'updated_at' => 'updated_at'
]
])
</x-layout>

View file

@ -0,0 +1,25 @@
<x-layout name="admin">
<div class="mb-4">
<x-button href="{{ route('admin.card.create') }}" type="info">{{ __('New') }}</x-button>
</div>
@livewire('datatable', [
'model' => \App\Models\Card::class,
'default_sort' => 'id',
'route_edit' => 'admin.card.edit',
'route_delete' => 'admin.card.delete',
'columns' => [
'id' => '#',
'body' => 'Body',
'subject' => 'Subject',
'subject_type' => 'Subject Type',
'raid.name' => 'Raid',
],
'sort_columns' => [
'id' => 'id',
'body' => 'body',
]
])
</x-layout>

View file

@ -0,0 +1,22 @@
<x-layout name="admin">
<div class="mb-4">
<x-button href="{{ route('admin.character.create') }}" type="info">{{ __('New') }}</x-button>
</div>
@livewire('datatable', [
'model' => \App\Models\Character::class,
'default_sort' => 'id',
'route_edit' => 'admin.character.edit',
'route_delete' => 'admin.character.delete',
'columns' => [
'id' => '#',
'name' => 'Name',
],
'sort_columns' => [
'id' => 'id',
'name' => 'name',
]
])
</x-layout>

View file

@ -0,0 +1,22 @@
<x-layout name="admin">
<div class="mb-4">
<x-button href="{{ route('admin.raid.create') }}" type="info">{{ __('New') }}</x-button>
</div>
@livewire('datatable', [
'model' => \App\Models\Raid::class,
'default_sort' => 'id',
'route_edit' => 'admin.raid.edit',
'route_delete' => 'admin.raid.delete',
'columns' => [
'id' => '#',
'name' => 'Name',
],
'sort_columns' => [
'id' => 'id',
'name' => 'name',
]
])
</x-layout>

View file

@ -0,0 +1,3 @@
<x-layout name="auth">
@livewire('form.login-form')
</x-layout>

View file

@ -1,4 +1,4 @@
@props(['href' => false, 'type' => 'default'])
@props(['href' => false, 'type' => 'default', 'element' => false])
@php
@ -22,6 +22,8 @@ default:
if ($href) {
$element = 'a';
$attributes = $attributes->merge([ 'href' => $href ]);
} else if ($element == 'input') {
$attributes = $attributes->merge([ 'type' => 'submit' ]);
} else {
$element = 'button';
}

View file

@ -0,0 +1 @@
<h2 {!! $attributes->merge(["class" => "text-2xl"]) !!}>{{ $slot }}</h2>

View file

@ -0,0 +1,27 @@
@props(['variant' => 'info', 'delay' => 2000])
@php
switch($variant) {
case 'success':
$variant_classes = 'text-green-800 bg-green-200 border-green-300';
break;
case 'warning':
$variant_classes = 'text-yellow-800 bg-yellow-200 border-yellow-300';
break;
case 'danger':
$variant_classes = 'text-red-800 bg-red-200 border-red-300';
break;
case 'info':
default:
$variant_classes = 'text-blue-800 bg-blue-200 border-blue-300';
}
@endphp
<div x-data="{ show: true }"
x-show="show"
x-init="setTimeout(() => show = false, {{ $delay }})"
{!! $attributes->merge(['class' => "w-full px-4 py-2 rounded border $variant_classes"]) !!}>
{{ $slot }}
</div>

View file

@ -0,0 +1,5 @@
@props(['name', 'column', 'dir'])
@if ($name === $column)
<x-icon name="{{ $dir == 'asc' ? 'heroicon-s-sort-ascending' : 'heroicon-s-sort-descending' }}" {{ $attributes->only('class') }} />
@endif

View file

@ -0,0 +1,32 @@
<div class="space-y-4">
<x-header>{{ __(($this->isNew() ? 'Create' : 'Edit') . ' card') }}</x-header>
<form class="space-y-4" wire:submit.prevent="submit">
<div>
<x-ignite-label for="record.body">{{ __('Body') }}</x-ignite-label>
<x-ignite-input name="record.body" wire:model="record.body" />
</div>
<div class="grid grid-cols-3 space-x-4">
<div>
<x-ignite-label for="record.raid_id">{{ __('Raid') }}</x-ignite-label>
<x-ignite-select name="record.raid_id" wire:model="record.raid_id" :options="$raids" placeholder="{{ __('Select a raid') }}" />
</div>
<div>
<x-ignite-label for="record.character_id">{{ __('Character') }}</x-ignite-label>
<x-ignite-select name="record.character_id" wire:model="record.character_id" :options="$characters" placeholder="{{ __('Select a character') }}" />
</div>
<div>
<x-ignite-label for="record.class">{{ __('Class') }}</x-ignite-label>
<x-ignite-select name="record.class" wire:model="record.class" :options="$classes" placeholder="{{ __('Select a class') }}" />
</div>
</div>
<x-button type="info">{{ __('Save') }}</x-button>
<x-button href="{{ route('admin.card.index') }}" type="warning">{{ __('Back') }}</x-button>
</form>
</div>

View file

@ -0,0 +1,17 @@
<div class="space-y-4">
<x-header>{{ __(($this->isNew() ? 'Create' : 'Edit') . ' character') }}</x-header>
<form class="space-y-4" wire:submit.prevent="submit">
<div>
<x-ignite-label for="record.name">{{ __('Name') }}</x-ignite-label>
<x-ignite-input name="record.name" wire:model="record.name" />
</div>
<x-button type="info">{{ __('Save') }}</x-button>
<x-button href="{{ route('admin.character.index') }}" type="warning">{{ __('Back') }}</x-button>
</form>
</div>

View file

@ -0,0 +1,17 @@
<form class="space-y-4" wire:submit.prevent="submit">
@if (Session::has('message'))
<p class="text-center text-red-400">{{ Session::get('message') }}</p>
@endif
<div>
<x-ignite-label class="sr-only" for="username">Username</x-ignite-label>
<x-ignite-input name="username" wire:model="username" placeholder="Username" class="" />
</div>
<div>
<label class="sr-only" for="password">Password</label>
<x-ignite-input name="password" wire:model="password" type="password" placeholder="Password" />
</div>
<x-button element="input" wire:click="submit" class="w-full" type="info" value="Login" />
</form>

View file

@ -0,0 +1,17 @@
<div class="space-y-4">
<x-header>{{ __(($this->isNew() ? 'Create' : 'Edit') . ' raid') }}</x-header>
<form class="space-y-4" wire:submit.prevent="submit">
<div>
<x-ignite-label for="record.name">{{ __('Name') }}</x-ignite-label>
<x-ignite-input name="record.name" wire:model="record.name" />
</div>
<x-button type="info">{{ __('Save') }}</x-button>
<x-button href="{{ route('admin.raid.index') }}" type="warning">{{ __('Back') }}</x-button>
</form>
</div>

View file

@ -0,0 +1,37 @@
@php
$item_classes = "flex items-center inline-block w-full px-4 py-2 rounded-lg hover:bg-blue-800";
@endphp
<x-layout>
<div class="flex min-h-screen">
<div class="bg-gray-800 w-2/12 px-4 divide-y divide-gray-600">
<ul class="py-4 space-y-2 text-white">
<li><a class="{{ $item_classes }}" href="{{ url('/admin') }}"><x-heroicon-o-user-group class="h-8 mr-2"/> {{ __('Admins') }}</a></li>
</ul>
<ul class="py-4 space-y-2 text-white">
<li><a class="{{ $item_classes }}" href="{{ url('/admin/cards') }}"><x-heroicon-o-collection class="h-8 mr-2"/> {{ __('Cards') }}</a></li>
<li><a class="{{ $item_classes }}" href="{{ url('/admin/characters') }}"><x-heroicon-o-identification class="h-8 mr-2"/> {{ __('Characters') }}</a></li>
<li><a class="{{ $item_classes }}" href="{{ url('/admin/raids') }}"><x-heroicon-o-globe class="h-8 mr-2"/> {{ __('Raids') }}</a></li>
</ul>
<ul class="py-4 space-y-2 text-white">
<x-ignite-form action="{{ url('/admin/logout') }}">
<li>
<a class="{{ $item_classes }}" href="#" onclick="event.preventDefault();this.closest('form').submit();">
<x-heroicon-o-logout class="h-8 mr-2"/> {{ __('Logout') }}
</a>
</li>
</x-ignite-form>
</ul>
</div>
<div class="w-10/12 m-8">
{{ $slot }}
</div>
</div>
</x-layout>

View file

@ -6,11 +6,15 @@
<title>Bingo!</title>
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
@livewireStyles
<script defer src="https://unpkg.com/alpinejs@3.2.4/dist/cdn.min.js"></script>
</head>
<body>
<body class="h-full">
<livewire:alert-container />
{{ $slot }}
@livewireScripts
@igniteScripts
</body>
</html>

View file

@ -0,0 +1,5 @@
<x-layout>
<div class="w-96 mx-auto mt-28 p-4 bg-blue-100 border border-blue-200 rounded">
{{ $slot }}
</div>
</x-layout>

View file

@ -0,0 +1,5 @@
<div class="absolute z-50 top-0 w-full px-4 sm:px-8 space-y-2 mt-2">
@foreach($messages as $message)
<x-notification variant="{{ $message[0] }}">{{ $message[1] }}</x-notification>
@endforeach
</div>

View file

@ -0,0 +1,59 @@
<div>
<table class="table-auto w-full">
<tr class="text-left border-b-2">
@foreach($columns as $key => $name)
<th class="border px-6 py-3 w-24">
@if (isset($sort_columns[$key]))
<div class="flex items-center justify-between cursor-pointer" wire:click="sort('{{ $key }}')">
<span class="hover:underline">{{ __($name) }}</span>
<x-sort-link name="{{ $key }}" :column="$sort" :dir="$dir" class="ml-2 text-gray-600 h-5" />
</div>
@else
{{ $name }}
@endif
</th>
@endforeach
@if($route_delete || $route_edit)
<th class="border px-6 py-3 w-4">{{ __('Actions') }}</th>
@endif
</tr>
<tbody>
@foreach($items as $item)
<tr class="odd:bg-gray-50">
@foreach(array_keys($columns) as $key)
<td class="border px-4 py-2">{{ Arr::get($item, $key) }}</td>
@endforeach
@if ($route_edit || $route_delete)
<td class="border px-4 py-2">
@if($route_edit)
<a href="{{ route($route_edit, [ $item ]) }}">
<x-icon name="heroicon-o-pencil" class="inline-block w-6 text-yellow-500"/>
</a>
@endif
@if($route_delete)
<x-ignite-form class="inline-block" id="dt-delete-{{$_instance->id}}-{{ $item->id }}" method="DELETE" action="{{ route($route_delete, [ $item ]) }}">
<a href="javascript:document.getElementById('dt-delete-{{$_instance->id}}-{{ $item->id }}').submit();">
<x-icon name="heroicon-o-trash" class="inline-block w-6 text-red-500"/>
</a>
</x-ignite-form>
@endif
</td>
@endif
</tr>
@endforeach
</tbody>
</table>
@if ($items->hasPages())
<div class="mt-4">
{{ $items->links() }}
</div>
@endif
</div>