1
0
Fork 0

Compare commits

...

108 commits

Author SHA1 Message Date
d079cb3934 Update README.md 2026-04-19 06:43:55 +02:00
aeecf0d395 add sail 2026-02-25 15:17:54 +01:00
4f104fe4f9 npm: update laravel mix as it fails with openssl on node >= 17 2026-02-25 15:10:51 +01:00
eef96841d6 composer: update packages. 2023-09-14 12:51:42 +02:00
93beb11442 package-lock.json: fix name 2023-09-14 11:27:59 +02:00
836f1e83ac resources/lang/se.json: Adding missing translations 2023-09-14 11:27:06 +02:00
f3ace72ad6 resources/views/item/show.blade.php: show some more info about the item. 2023-09-14 11:26:20 +02:00
23197cd6e2 app/Http/Middleware/Locale.php: EncryptCookies::handle() did not like $request to be type hinted. 2023-09-14 11:19:39 +02:00
76982af72d tests/Feature/ProfessionImport/BasicTest.php: Fixing an test error that compared reagents in wrong order. 2022-11-17 22:43:53 +01:00
7ddb89069d Merge branch 'description' 2022-11-17 22:33:47 +01:00
8ec20f02e4 resources/views/recipe/show.blade.php: Show description 2022-11-17 22:14:24 +01:00
389a22ff38 app/Jobs/ImportProfession.php: Import description. 2022-11-17 22:14:24 +01:00
b06cf18f51 app/Models/Recipe.php: Add description to fillable array. 2022-11-17 22:14:24 +01:00
3b5b2e3b09 Migration: 2021_07_08_134818_add_description_column_to_recipes_table.php 2022-11-17 22:14:23 +01:00
034fb36560 resources/lang/se.json: fix capital letter for "Import Profession" translation and add "Import profession". 2021-09-01 15:25:38 +02:00
e2cbab0e76 resources/views/profile/index.blade.php: Add link to profession import. 2021-09-01 15:24:50 +02:00
cb04ba9fcc app/Http/Requests/CharacterProfessionImportRequest.php: Rename to ProfessionImportRequest 2021-09-01 15:22:30 +02:00
2c50a372eb view: refactor profession import form to an component. 2021-09-01 15:20:30 +02:00
3692fcc485 Adding Profession Import (without specified character) 2021-09-01 15:17:00 +02:00
aa2b27bc50 tests/Feature/ProfessionImport/BasicTest.php: Add missing test data. 2021-08-29 18:31:58 +02:00
529e6bdda4 resources/views/character/profession/create.blade.php: minor fixes. 2021-08-29 14:46:36 +02:00
f6fd635078 app/Http/Requests/CharacterProfessionRequest.php: Rename to CharacterProfessionImportRequest 2021-08-29 11:50:57 +02:00
08c60a6842 app/Jobs/ImportProfession.php: Fixing Exception class used incorrectly.
"Exception" class used without "use Exception;" results in php trying to find an "App\Jobs\Exception" class (which there is none of)
2021-08-28 17:47:05 +02:00
8eda7a315c app/Jobs/ImportProfession.php: make $character variable optional and require $user. 2021-08-28 17:42:29 +02:00
f82f7c3571 app/Jobs/ImportProfession.php: Typo fix. 2021-08-28 16:57:59 +02:00
8cfa7f34d5 resources/views/layouts/app.blade.php: add flex and spacing to page_links div. 2021-08-28 15:14:22 +02:00
3e77520b29 resources/views/user/show.blade.php: Refactor to "characters" relationship as it sorts main characters first. 2021-08-28 15:08:22 +02:00
df08af6f7d app/Models/User.php: do not reuse "characters" relationship to define "alt_characters" relationship, use a regular hasMany() 2021-08-28 15:06:30 +02:00
77e8792edc app/Models/User.php: sort main characters first for "characters" relationship. 2021-08-28 15:04:32 +02:00
3f7d29ce79 tailwind.config.js: remove status color classes. 2021-08-11 19:52:27 +02:00
601d91465e resources/views/components/form/inputs/*: Use "red" instead of "danger" for color classes. 2021-08-11 19:52:09 +02:00
e8343b7a1b resources/views/components/alert.blade.php: set css classes explicitly, otherwise PurgeCSS don't know that we need them. 2021-08-11 19:51:29 +02:00
f11b996ebf app/View/Components/Notifications.php: minor fix. don't need $cssClasses array.
e
2021-08-11 19:50:24 +02:00
c1b67af42d tailwind.config.js: do not purge class colors. 2021-08-11 19:29:10 +02:00
c14166f682 app/Models/User.php: Add character_id to $fillable 2021-08-10 13:01:16 +02:00
e2e6f2b91b update npm 2021-08-10 13:00:18 +02:00
557655daf9 update composer 2021-08-10 13:00:05 +02:00
f8c910880b resources/images/logo.png: lower resolution abit 2021-08-10 12:59:49 +02:00
56dda59c61 resources/views/partials/navigation.blade.php: show logo 2021-08-09 19:02:42 +02:00
b703ceb0c9 Adding resources/images/logo.png 2021-08-09 19:02:31 +02:00
0c3922c697 resources/views/auth/login.blade.php: Use divider component. 2021-08-03 20:45:10 +02:00
a8f5b2464a Adding resources/views/components/divider.blade.php 2021-08-03 20:44:51 +02:00
6325109e80 Merge branch 'lang' 2021-08-01 11:19:10 +02:00
11da8c3811 resources/views/auth/login.blade.php: set text color for the divider. 2021-07-31 14:34:05 +02:00
528178a3ee Adding Swedish language 2021-07-31 14:24:50 +02:00
bc544a7991 resources/views/recipe/show.blade.php: rename heading from "Created item" to "Crafted item". 2021-07-31 14:16:11 +02:00
fe7d275caf app/Http/Livewire/Recipes.php: translate the placeholder value in the profession option array. 2021-07-31 14:15:35 +02:00
531da903ae views: add translations to some strings. 2021-07-31 14:11:42 +02:00
f5252052ff resources/views/partials/navigation.blade.php: add language links. 2021-07-30 13:35:22 +02:00
40b9cabff1 icons: adding se/en flags. 2021-07-30 13:32:36 +02:00
64eef7cd60 routes/web.php: setup "set locale" route. 2021-07-30 13:32:36 +02:00
4b56c803a5 Adding app/Http/Controllers/LocaleSessionController.php 2021-07-30 13:32:36 +02:00
e4fd735acb Adding config/lang.php 2021-07-30 13:32:36 +02:00
7a06097ae7 Adding app/Http/Middleware/Locale.php 2021-07-30 13:32:36 +02:00
14c41b79d3 resources/views/partials/navigation.blade.php: tweaking flex items-center abit. 2021-07-30 13:32:22 +02:00
d2dc8d5ea4 resources/views/partials/navigation.blade.php: link to item page. 2021-07-30 12:31:47 +02:00
ac7e64c75c Adding Item Page 2021-07-30 12:31:31 +02:00
868d49af23 .env.example: minor fixes. 2021-07-25 10:34:59 +02:00
614ddefa20 phpunit.xml: set dedicated test database. 2021-07-25 10:34:39 +02:00
6f7c65fab3 app/Models/Item.php: add reagent_for relationship. 2021-07-23 17:08:49 +02:00
f9d44de6cb Form: adding checkbox component. 2021-07-23 17:00:07 +02:00
01b1b06541 resources/views/components/form/inputs/*: fixing styles that where reset because of tailwind forms. 2021-07-23 16:59:06 +02:00
c7b2ba2660 tailwind.config.js: include forms plugin. 2021-07-23 16:56:48 +02:00
9ca47e55ce npm: add tailwindcss/forms 2021-07-23 16:56:29 +02:00
d3eccc596f app/Models/Item.php: change recipe relationship from belongsTo to hasMany. 2021-07-23 13:33:10 +02:00
7df1e8345d app/Models/Item.php: add getRouteKeyName() 2021-07-23 13:27:18 +02:00
3b71b0358b resources/views/livewire/recipes.blade.php: move recipe link to a component. 2021-07-23 13:25:13 +02:00
4628ce85ac app/Models/Character.php: Clear main character relationship if a main character is deleted. 2021-07-22 18:56:16 +02:00
23b5103b12 tests/Feature/CharacterDestroyTest.php: test that deleting a main character sets character_id to null on the user object. 2021-07-22 18:55:40 +02:00
f3314d106a app/Http/Controllers/ProfileController.php: in update() do not create hash for empty password. 2021-07-22 18:54:39 +02:00
099115d613 tests/Feature/ProfileTest.php: test that user can not set an empty password hash. 2021-07-22 18:53:31 +02:00
52f565f04b app/Http/Controllers/ProfileController.php: in update() use Model::fill()
This is more generic as one only needs to add validated fields to Request object. and they will be saved automatically.
2021-07-22 18:50:13 +02:00
dccd04fe7e resources/views/profile/edit.blade.php: Add main character to form. 2021-07-22 18:27:41 +02:00
0fef5c77d0 app/Http/Controllers/ProfileController.php: Save character_id on update. 2021-07-22 18:27:20 +02:00
15808597c2 app/Http/Requests/UserRequest.php: Add character_id 2021-07-22 18:26:51 +02:00
8f79cc295c resources/views/components/form/inputs/select.blade.php: Show error. 2021-07-22 18:26:29 +02:00
7ba4ab30c1 resources/views/components/form/inputs/select.blade.php: Set selected attribute. 2021-07-22 18:26:12 +02:00
acce1c21b8 resources/views/components/form/inputs/select.blade.php: Set name attribute. 2021-07-22 18:26:12 +02:00
a179010914 resources/views/character/show.blade.php: Show user. 2021-07-22 18:03:15 +02:00
2f215d0b82 Add user page. 2021-07-21 18:57:10 +02:00
ecc35c6fe6 resources/views/components/character-card.blade.php: add option to show elite frame. 2021-07-21 18:56:41 +02:00
6287695f81 tailwind.config.js: Add scales 2021-07-21 18:55:57 +02:00
bf23433524 Adding resources/images/elite_frame.png 2021-07-21 18:54:20 +02:00
52bd1012a5 app/Models/Character.php: Add isMain() 2021-07-21 18:15:44 +02:00
5211463513 Database Seeding: seed main_character relationship on user. 2021-07-21 17:53:27 +02:00
b73a8438d4 app/Models/User.php: Adding main_character relationship 2021-07-21 17:52:30 +02:00
e2fe666fc7 Migration: 2021_07_21_173416_add_character_id_to_users_table.php 2021-07-21 17:49:10 +02:00
b76a997948 Refactor UserController to ProfileController. 2021-07-20 15:38:57 +02:00
5117907a4d app/View/Components/Icon.php: rename view script 2021-07-20 15:24:42 +02:00
e4363c078a app/View/Components: minor fixes. 2021-07-20 15:21:40 +02:00
766da19bb5 resources/images/races: fixing capital letters. 2021-07-18 18:02:14 +02:00
6377c39782 remove resources/views/components/profession-icon.blade.php 2021-07-18 17:48:01 +02:00
2ad80a0a68 resources/views/components/character-card.blade.php: show race text along with class. 2021-07-18 17:47:36 +02:00
e5fa65a839 resources/views/character/profession/show.blade.php: link character name in title back to character page. 2021-07-18 17:47:36 +02:00
fa64f54255 resources/views/character/profession/show.blade.php: show race. 2021-07-18 17:47:36 +02:00
1dd9a5418e resources/views/character/show.blade.php: show race. 2021-07-18 17:47:36 +02:00
c662816c33 Adding app/View/Components/RaceIcon.php 2021-07-18 17:47:36 +02:00
f84a0579f2 Adding race icons :) 2021-07-18 17:30:28 +02:00
3179e59daf resources/views/partials/navigation.blade.php: Adding admin link. 2021-07-15 15:40:01 +02:00
bd21a64191 Adding user handling pages for admins. 2021-07-15 15:39:25 +02:00
c53a4155f4 app/Providers/AuthServiceProvider.php: adding "administrate" gate. 2021-07-15 15:37:34 +02:00
d8917e118b app/Http/Controllers/Auth/OAuthController.php: check trashed records before trying to login via oauth. 2021-07-13 18:47:24 +02:00
de19260f35 tests/Feature/CharacterDestroyTest.php: fix test to account for softdeletes. 2021-07-13 18:37:26 +02:00
f09fea4f08 app/Models/User.php: Also delete characters when deleting the user. 2021-07-13 18:33:19 +02:00
866b374070 app/Http/Livewire/Form/CharacterForm.php: Do not include deleted rows in unique name validation. 2021-07-13 18:32:17 +02:00
c806f54ea2 app/Models/Character.php: Add soft deletes. 2021-07-13 18:25:31 +02:00
94a4d3994f app/Models/User.php: Add soft deletes. 2021-07-13 18:25:09 +02:00
52daa3b68f app/Models/User.php: adding getRoleAttribute() 2021-07-13 18:01:49 +02:00
120 changed files with 10184 additions and 10609 deletions

View file

@ -1,4 +1,3 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
@ -8,11 +7,11 @@ LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
DB_USERNAME=sail
DB_PASSWORD=password
BROADCAST_DRIVER=log
CACHE_DRIVER=file
@ -50,6 +49,6 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
DISCORD_CLIENT_ID =
DISCORD_CLIENT_SECRET =
DISCORD_REDIRECT_URI =
DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=
DISCORD_REDIRECT_URI=

View file

@ -1,62 +1,77 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
# Heritage WoW
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
Heritage WoW is a Laravel application for managing World of Warcraft characters and profession data.
It supports importing profession exports, browsing recipes/items, and account login with username/password or Discord OAuth.
## About Laravel
## Features
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Character pages with owned professions and recipes
- Profession import pipeline (queued job) for sync/update
- Recipe and item listing pages
- Local authentication and Discord OAuth login
- Admin-only user management routes
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
## Stack
Laravel is accessible, powerful, and provides tools required for large, robust applications.
- PHP/Laravel: Laravel 8
- Frontend: Blade + Tailwind CSS + Alpine.js
- Build tooling: Laravel Mix
- Database: MySQL (default in `.env.example`)
## Learning Laravel
## Local Setup
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
1. Install dependencies:
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
```bash
composer install
npm install
```
## Laravel Sponsors
2. Configure environment:
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
```bash
cp .env.example .env
php artisan key:generate
```
### Premium Partners
3. Update database and OAuth values in `.env` (minimum: DB_*).
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
4. Run migrations and seeders:
## Contributing
```bash
php artisan migrate --seed
```
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
5. Start the app and asset pipeline:
## Code of Conduct
```bash
php artisan serve
npm run dev
```
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
6. If using an async queue connection for imports, run a worker:
## Security Vulnerabilities
```bash
php artisan queue:work
```
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## Useful Commands
- Run tests: `php artisan test`
- Build production assets: `npm run prod`
- Create a user: `php artisan user:create <username> <password>`
- Create an admin user: `php artisan user:create <username> <password> --admin`
## OAuth (Discord)
To enable Discord login, set these variables in `.env`:
- `DISCORD_CLIENT_ID`
- `DISCORD_CLIENT_SECRET`
- `DISCORD_REDIRECT_URI`
The callback route is `/oauth/discord/callback`.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
This project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View file

@ -0,0 +1,38 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\User;
use App\Http\Requests\Admin\UserRequest;
use App\Http\Controllers\Controller;
class UserController extends Controller
{
public function index()
{
return view('admin.user.index');
}
public function create()
{
return view('admin.user.form');
}
public function edit(User $user)
{
return view('admin.user.form', [
'model' => $user
]);
}
/**
* Delete user.
*/
public function destroy(User $user)
{
$user->delete();
return redirect()->route('admin.users.index')
->with(['success' => "<strong>{$user->username}</strong> was deleted!"]);
}
}

View file

@ -30,6 +30,12 @@ class OAuthController extends Controller
{
$oauth = Socialite::driver($driver)->stateless()->user();
// Check that account is not deleted before trying to find/create user and login.
if (User::onlyTrashed()->where("{$driver}_id", $oauth->getId())->first()) {
return redirect('/')
->with(['error' => "Account suspended."]);
}
$user = User::firstOrCreate([ "{$driver}_id" => $oauth->getId() ], [
'username' => $oauth->getNickname()
]);

View file

@ -6,7 +6,7 @@ use App\Models\Character;
use App\Models\Profession;
use App\Models\Recipe;
use App\Models\CharacterProfession;
use App\Http\Requests\CharacterProfessionRequest;
use App\Http\Requests\ProfessionImportRequest;
use App\Jobs\ImportProfession;
class CharacterProfessionController extends Controller
@ -32,7 +32,7 @@ class CharacterProfessionController extends Controller
]);
}
public function store(Character $character, CharacterProfessionRequest $request)
public function store(Character $character, ProfessionImportRequest $request)
{
$this->authorize('import_profession', $character);
@ -41,7 +41,7 @@ class CharacterProfessionController extends Controller
$data = json_decode($request->input('data'));
try {
ImportProfession::dispatch($character, $data);
ImportProfession::dispatch($data, $request->user(), $character);
} catch(\App\ProfessionImport\Exception $e) {
return redirect()->back()->with('error', $e->getMessage());
}

View file

@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers;
use App\Models\Item;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class ItemController extends Controller
{
/**
* List all recipies
*/
public function index()
{
return view('item.index');
}
/**
* Show a recipe
*/
public function show(Item $item)
{
return view('item.show', compact('item'));
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class LocaleSessionController extends Controller
{
/**
* Set locale
*/
public function store(Request $request, $locale)
{
if (array_key_exists($locale, config('lang'))) {
$request->session()->put('locale', $locale);
}
return redirect()->back();
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\ProfessionImportRequest;
use App\Jobs\ImportProfession;
class ProfessionController extends Controller
{
public function create()
{
return view('profession.create');
}
public function store(ProfessionImportRequest $request)
{
$request->validated();
$data = json_decode($request->input('data'));
try {
ImportProfession::dispatch($data, $request->user());
} catch(\App\ProfessionImport\Exception $e) {
return redirect()->back()->with('error', $e->getMessage());
}
return redirect()->back()->with('success', 'Profession imported!');
}
}

View file

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Http\Request;
use App\Http\Requests\UserRequest;
class ProfileController extends Controller
{
public function index(Request $request)
{
return view('profile.index', [
'user' => Auth::user(),
]);
}
public function edit(Request $request)
{
return view('profile.edit', [
'user' => Auth::user(),
]);
}
public function update(UserRequest $request)
{
$data = collect($request->validated());
$user = $request->user();
$user->fill($data->except('password')->toArray());
if (strlen($data['password'])) {
$user->password = Hash::make($data['password']);
}
$user->save();
return redirect()->route('profile.index')
->with('success', 'Your account was updated!');
}
}

View file

@ -2,37 +2,17 @@
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Requests\UserRequest;
class UserController extends Controller
{
public function index(Request $request)
/**
* Show user page
*/
public function show(User $user)
{
return view('user.index', [
'user' => Auth::user(),
]);
}
public function edit(Request $request)
{
return view('user.edit', [
'user' => Auth::user(),
]);
}
public function update(UserRequest $request)
{
$data = $request->validated();
$user = $request->user();
$user->username = $data['username'];
$user->password = Hash::make($data['password']);
$user->save();
return redirect()->route('user.index')
->with('success', 'Your account was updated!');
return view('user.show', compact('user'));
}
}

View file

@ -33,6 +33,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\App\Http\Middleware\Locale::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,

View file

@ -0,0 +1,44 @@
<?php
namespace App\Http\Livewire;
use App\Models\User;
use Livewire\Component;
class AdminUserTable extends Component
{
use Traits\WithPagination;
protected $queryString = [
'username' => ['except' => ''],
'role' => ['except' => '']
];
/**
* Filter by username
*/
public $username;
/**
* Filter by role
*/
public $role;
public function render()
{
$query = User::query()->orderBy('username');
if (strlen($this->username) >= 3) {
$query->where('username', 'LIKE', '%' . $this->username . '%');
}
if (in_array($this->role, ['user','admin'])) {
$query->where('role', $this->role);
}
return view('livewire.admin-user-table', [
'users' => $query->paginate($this->perPage)
]);
}
}

View file

@ -0,0 +1,83 @@
<?php
namespace App\Http\Livewire\Form\Admin;
use App\Models\User;
use Livewire\Component;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\Hash;
class UserForm extends Component
{
use AuthorizesRequests;
/**
* User object.
*/
public User $user;
/**
* Password field
*/
public $password;
/**
* Password confirmation field.
*/
public $password_confirmation;
/**
* Initialize the component.
*/
public function mount(User $user)
{
$this->user = $user;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'user.username' => ['required', 'min:4', Rule::unique('users', 'username')->ignore($this->user) ],
'user.role' => 'required|in:user,admin',
'password' => ($this->user->exists ? 'nullable' : 'required') . '|min:8|confirmed',
];
}
public function updated($property)
{
$this->validateOnly($property);
}
/**
* Save the user
*/
public function save()
{
$this->authorize('administrate');
$this->validate();
if ($this->password) {
$this->user->password = Hash::make($this->password);
}
$this->user->save();
// Livewire redirect() does not have "with" method.
// so we call session()->flash() directly instead.
session()->flash('success', "<strong>{$this->user->username}</strong> was "
. ($this->user->exists ? "updated!" : "created!"));
return redirect()->route('admin.users.index');
}
public function render()
{
return view('livewire.form.admin.user');
}
}

View file

@ -45,7 +45,7 @@ class CharacterForm extends Component
public function rules()
{
return [
'character.name' => [ 'required', 'min:4', Rule::unique('characters', 'name')->ignore($this->character) ],
'character.name' => [ 'required', 'min:4', Rule::unique('characters', 'name')->ignore($this->character)->whereNotNull('deleted_at') ],
'character.level' => [ 'required', 'integer', 'min:1', 'max:70' ],
'character.gender' => [ 'required', 'in:M,F' ],
'character.race' => [ 'required', 'in:' . $this->races->keys()->join(',') ],
@ -109,7 +109,7 @@ class CharacterForm extends Component
// Livewire redirect() does not have "with" method.
// so we call session()->flash() directly instead.
session()->flash('success', "<strong>{$this->character->name}</strong> was {$action}!");
return redirect()->route('user.index');
return redirect()->route('profile.index');
}
public function render()

View file

@ -0,0 +1,43 @@
<?php
namespace App\Http\Livewire;
use App\Models\Item;
use Livewire\Component;
class Items extends Component
{
use Traits\WithPagination;
protected $queryString = [
'name' => ['except' => ''],
'reagent_for' => ['except' => false],
];
/**
* Filter by name
*/
public string $name = '';
public $reagent_for = false;
public function render()
{
$query = Item::query()
->with(['reagent_for']);
if ($this->reagent_for) {
$query->has('reagent_for');
}
// Filter by name
if (strlen($this->name) >= 3) {
$query->where('name', 'LIKE', '%' . $this->name . '%');
}
return view('livewire.items', [
'items' => $query->paginate($this->perPage)
]);
}
}

View file

@ -46,7 +46,7 @@ class Recipes extends Component
return [Str::lower($item['name']) => $item['name']];
});
$this->profession_options = collect(['' => '-- Profession --'])
$this->profession_options = collect(['' => '-- ' . __('Profession') . ' --'])
->merge($options)
->toArray();
}

View file

@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
use Closure;
class Locale extends Middleware
{
/**
* Handle an incoming request.
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (session()->has('locale')) {
app()->setlocale(session()->get('locale'));
}
return $next($request);
}
}

View file

@ -4,7 +4,7 @@ namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CharacterProfessionRequest extends FormRequest
class ProfessionImportRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.

View file

@ -36,8 +36,12 @@ class UserRequest extends FormRequest
*/
public function rules()
{
$user = auth()->user();
$character_ids = $user->characters->pluck('id');
return [
'username' => [ 'required', 'min:4', Rule::unique('users')->ignore(auth()->user()) ],
'character_id' => 'nullable|in:' . $character_ids->join(','),
'current_password' => 'nullable|required_with:password|current_password',
'password' => 'nullable|min:8|confirmed',
];

View file

@ -2,6 +2,7 @@
namespace App\Jobs;
use App\Models\User;
use App\Models\Character;
use App\Models\Profession;
use App\Models\CharacterProfession;
@ -21,6 +22,8 @@ use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\DB;
use Exception;
class ImportProfession implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
@ -40,12 +43,22 @@ class ImportProfession implements ShouldQueue
*
* @return void
*/
public function __construct(Character $character, $data)
public function __construct($data, User $user, ?Character $character = null)
{
// Validate character name first.
if ($character->name !== $data->player) {
$message = sprintf('Wrong character: %s expected %s', $data->player, $character->name);
throw new InvalidCharacterException($message);
if ($character) {
if ($character->name !== $data->player) {
$message = sprintf('Wrong character: %s expected %s', $data->player, $character->name);
throw new InvalidCharacterException($message);
}
} else {
$character = Character::where('name', $data->player)
->where('user_id', $user->id)->first();
if (!$character) {
$message = sprintf('Could not find character "%s"', $data->player);
throw new InvalidCharacterException($message);
}
}
// Validate profession
@ -152,7 +165,7 @@ class ImportProfession implements ShouldQueue
// names for reagents. so we skip those.
// 2021-07-08: Also skip items without id.
if (!isset($item->name) || !isset($items->id)) {
if (!isset($item->name) || !isset($item->id)) {
return [];
}
@ -189,7 +202,8 @@ class ImportProfession implements ShouldQueue
$recipe = $profession->recipes()->create([
'item_id' => $crafted ? $crafted->id : null,
'spell_id' => $spell->id,
'category_id' => $category->id
'category_id' => $category->id,
'description' => isset($data->description) ? $data->description : null
]);
}
// Existing record.
@ -203,6 +217,10 @@ class ImportProfession implements ShouldQueue
if (!$recipe->spell) {
$recipe->spell()->associate($spell);
}
if ($recipe->description === NULL && isset($data->description)) {
$recipe->description = $data->description;
}
}
// Insert/Update Reagents

View file

@ -4,11 +4,12 @@ namespace App\Models;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
class Character extends Model
{
use HasFactory;
use HasFactory, SoftDeletes;
public $timestamps = false;
@ -25,6 +26,20 @@ class Character extends Model
'class'
];
public static function boot()
{
parent::boot();
static::deleted(function($character) {
// Unset main character.
if ($character->isMain()) {
$character->user->main_character()->dissociate();
$character->user->save();
}
});
}
/**
* Get the route key for the model.
*
@ -66,6 +81,14 @@ class Character extends Model
return $this->belongsTo(User::class);
}
/**
* Check if this character is the user's main character
*/
public function isMain()
{
return $this->user->character_id == $this->id;
}
/**
* Retrieve the character's professions.
*/

View file

@ -32,9 +32,28 @@ class Item extends Model
});
}
public function recipe()
/**
* Get the route key for the model.
*
* @return string
*/
public function getRouteKeyName()
{
return $this->belongsTo(Recipe::class, 'id');
return 'slug';
}
public function recipes()
{
return $this->hasMany(Recipe::class);
}
/**
* Get recipes that this item is reagent for.
*/
public function reagent_for()
{
return $this->belongsToMany(Recipe::class, 'reagents')
->withPivot('quantity');
}
public function getQuantityAttribute()

View file

@ -34,7 +34,8 @@ class Recipe extends Model
'profession_id',
'category_id',
'item_id',
'spell_id'
'spell_id',
'description'
];
/**

View file

@ -4,12 +4,13 @@ namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use HasFactory, Notifiable;
use HasFactory, Notifiable, SoftDeletes;
/**
* The attributes that are mass assignable.
@ -20,7 +21,8 @@ class User extends Authenticatable
'discord_id',
'username',
'password',
'role'
'role',
'character_id'
];
/**
@ -42,8 +44,46 @@ class User extends Authenticatable
'email_verified_at' => 'datetime',
];
protected static function boot()
{
parent::boot();
static::deleted(function ($user) {
$user->characters()->delete();
});
}
public function main_character()
{
return $this->belongsTo(Character::class, 'character_id');
}
public function alt_characters()
{
$relation = $this->hasMany(Character::class);
if ($this->character_id) {
$relation->where('id', '!=', $this->character_id);
}
return $relation;
}
public function characters()
{
return $this->hasMany(Character::class);
$relation = $this->hasMany(Character::class);
// sort main character first if set.
if ($this->character_id) {
$relation->orderByRaw('id = ' . $this->character_id . ' DESC');
}
return $relation;
}
public function getRoleAttribute()
{
if (!$this->attributes['role']) {
return 'user';
}
return $this->attributes['role'];
}
}

View file

@ -2,6 +2,7 @@
namespace App\Providers;
use App\Models\User;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
@ -25,5 +26,9 @@ class AuthServiceProvider extends ServiceProvider
public function boot()
{
$this->registerPolicies();
Gate::define('administrate', function(User $user) {
return $user->role === 'admin';
});
}
}

View file

@ -13,6 +13,7 @@ class BladeServiceProvider extends ServiceProvider
'input-password' => \App\View\Components\Form\Password::class,
'textarea' => \App\View\Components\Form\Textarea::class,
'select' => \App\View\Components\Form\Select::class,
'checkbox' => \App\View\Components\Form\Checkbox::class,
];
/**

View file

@ -6,5 +6,5 @@ use Illuminate\View\Component;
class ClassIcon extends Icon
{
protected $prefix = 'classes';
protected string $prefix = 'classes';
}

View file

@ -0,0 +1,21 @@
<?php
namespace App\View\Components\Form;
class Checkbox extends Input
{
public function __construct($name, ?string $id = null, ?string $value = null, bool $disabled = false)
{
parent::__construct($name, $id, 'checkbox', $value, $disabled);
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.form.inputs.checkbox');
}
}

View file

@ -8,9 +8,15 @@ use Illuminate\View\Component;
abstract class Icon extends Component
{
protected $prefix = '';
/**
* Path prefix.
*/
protected string $prefix = '';
public $url;
/**
* Image url.
*/
public string $url;
/**
* Create a new component instance.
@ -19,7 +25,11 @@ abstract class Icon extends Component
*/
public function __construct(string $name)
{
$file = sprintf('%s/%s.jpg', $this->prefix, Str::lower($name));
$file = Str::of($name)->lower()->append('.jpg');
if (strlen($this->prefix)) {
$file = collect([$this->prefix, $file])->join('/');
}
$this->url = Storage::disk('images')->url($file);
}
@ -30,6 +40,6 @@ abstract class Icon extends Component
*/
public function render()
{
return view('components.class-icon');
return view('components.image-icon');
}
}

View file

@ -21,16 +21,6 @@ class Notifications extends Component
*/
public string $position = 'center';
/**
* Type and css class mapping.
*/
protected $cssClasses = [
'info' => 'info',
'success' => 'success',
'warning' => 'warning',
'error' => 'danger'
];
/**
* Get the view / contents that represent the component.
*
@ -43,8 +33,7 @@ class Notifications extends Component
foreach($this->types as $type) {
if (Session::has($type)) {
$class = $this->cssClasses[$type];
$messages[$class] = Session::get($type);
$messages[$type] = Session::get($type);
}
}

View file

@ -4,5 +4,5 @@ namespace App\View\Components;
class ProfessionIcon extends Icon
{
protected $prefix = 'professions';
protected string $prefix = 'professions';
}

View file

@ -0,0 +1,24 @@
<?php
namespace App\View\Components;
use App\Models\Character;
use Illuminate\Support\Str;
class RaceIcon extends Icon
{
protected string $prefix = 'races';
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(Character $character)
{
$race = Str::of($character->race)->lower()->replace(' ', '');
$name = sprintf("%s_%s", $race, $character->gender);
parent::__construct($name);
}
}

3487
composer.lock generated

File diff suppressed because it is too large Load diff

17
config/lang.php Normal file
View file

@ -0,0 +1,17 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Language configuration
|--------------------------------------------------------------------------
|
| Define available languages as locale (key), name (value) pairs.
|
*/
'en' => 'English',
'se' => 'Svenska',
];

View file

@ -0,0 +1,20 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDescriptionColumnToRecipesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('recipes', function (Blueprint $table) {
$table->text('description')->nullable();
});
}
}

View file

@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSoftdeleteToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->dropUnique(['username']);
$table->dropUnique(['discord_id']);
$table->softDeletes();
});
}
}

View file

@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSoftdeleteToCharactersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('characters', function (Blueprint $table) {
$table->dropUnique(['name']);
$table->softDeletes();
});
}
}

View file

@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCharacterIdToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->foreignId('character_id')
->after('discord_id')
->nullable()
->constrained();
});
}
}

View file

@ -16,7 +16,6 @@ class DatabaseSeeder extends Seeder
$this->call(ProductionSeeders\ProfessionsTableSeeder::class);
$this->call(DevelopmentSeeders\UserTableSeeder::class);
$this->call(DevelopmentSeeders\CharacterTableSeeder::class);
$this->call(DevelopmentSeeders\ItemTableSeeder::class);
$this->call(DevelopmentSeeders\RecipeCategoryTableSeeder::class);
$this->call(DevelopmentSeeders\RecipeTableSeeder::class);

View file

@ -1,27 +0,0 @@
<?php
namespace Database\Seeders\DevelopmentSeeders;
use Illuminate\Database\Seeder;
use App\Models\Profession;
use App\Models\Character;
use App\Models\CharacterProfession;
class CharacterTableSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
for($i = 0; $i < 50; $i++) {
Character::factory()
->hasRandomExistingProfessions(2)
->create();
}
}
}

View file

@ -5,6 +5,7 @@ namespace Database\Seeders\DevelopmentSeeders;
use Illuminate\Database\Seeder;
use App\Models\User;
use App\Models\Character;
class UserTableSeeder extends Seeder
{
@ -19,5 +20,17 @@ class UserTableSeeder extends Seeder
'username' => 'admin',
'role' => 'admin',
]);
$users = User::factory()->count(50)
->has(Character::factory()
->hasRandomExistingProfessions(2)
->count(3))
->create();
foreach($users as $user) {
$character = $user->characters->random();
$user->main_character()->associate($character);
$user->push();
}
}
}

56
docker-compose.yml Normal file
View file

@ -0,0 +1,56 @@
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.2
dockerfile: Dockerfile
image: sail-8.2/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
environment:
WWWUSER: '${WWWUSER:-1000}'
WWWGROUP: '${WWWGROUP:-1000}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
IGNITION_LOCAL_SITES_PATH: '${PWD}'
volumes:
- '.:/var/www/html:z'
networks:
- sail
depends_on:
- mysql
mysql:
image: 'heritage/mysql:8.0'
build:
context: './docker/mysql'
dockerfile: Dockerfile
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'sail-mysql:/var/lib/mysql'
networks:
- sail
healthcheck:
test:
- CMD
- mysqladmin
- ping
- '-p${DB_PASSWORD}'
retries: 3
timeout: 5s
networks:
sail:
driver: bridge
volumes:
sail-mysql:
driver: local

4
docker/mysql/Dockerfile Normal file
View file

@ -0,0 +1,4 @@
FROM mysql/mysql-server:8.0
COPY create-testing-database.sh /docker-entrypoint-initdb.d/10-create-testing-database.sh
RUN chmod +x /docker-entrypoint-initdb.d/10-create-testing-database.sh
RUN chown -R mysql:mysql /docker-entrypoint-initdb.d

View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
mysql --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL
CREATE DATABASE IF NOT EXISTS testing;
GRANT ALL PRIVILEGES ON \`testing%\`.* TO '$MYSQL_USER'@'%';
EOSQL

14783
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -10,9 +10,10 @@
"production": "mix --production"
},
"devDependencies": {
"@tailwindcss/forms": "^0.3.3",
"autoprefixer": "^10.2.5",
"axios": "^0.21",
"laravel-mix": "^6.0.6",
"laravel-mix": "^6.0.49",
"lodash": "^4.17.19",
"postcss": "^8.2.14",
"tailwindcss": "^2.1.2"

View file

@ -21,8 +21,7 @@
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<!-- <server name="DB_CONNECTION" value="sqlite"/> -->
<!-- <server name="DB_DATABASE" value=":memory:"/> -->
<server name="DB_DATABASE" value="testing"/>
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>

View file

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 480">
<path fill="#012169" d="M0 0h640v480H0z"/>
<path fill="#FFF" d="M75 0l244 181L562 0h78v62L400 241l240 178v61h-80L320 301 81 480H0v-60l239-178L0 64V0h75z"/>
<path fill="#C8102E" d="M424 281l216 159v40L369 281h55zm-184 20l6 35L54 480H0l240-179zM640 0v3L391 191l2-44L590 0h50zM0 0l239 176h-60L0 42V0z"/>
<path fill="#FFF" d="M241 0v480h160V0H241zM0 160v160h640V160H0z"/>
<path fill="#C8102E" d="M0 193v96h640v-96H0zM273 0v480h96V0h-96z"/>
</svg>

After

Width:  |  Height:  |  Size: 516 B

View file

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 480">
<path fill="#066aa7" d="M0 0h640v480H0z"/>
<path fill="#fecc00" d="M0 192h640v96H0z"/>
<path fill="#fecc00" d="M176 0h96v480h-96z"/>
</svg>

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

BIN
resources/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

44
resources/lang/se.json Normal file
View file

@ -0,0 +1,44 @@
{
"Add character": "Lägg till karaktär",
"Character": "Karaktär",
"Characters": "Karaktärer",
"Class": "Klass",
"Crafted item": "Tillverkat föremål",
"Crafter": "Hantverkare",
"Crafters": "Hantverkare",
"Create": "Skapa",
"Created by": "Skapad av",
"Download this": "Ladda ner detta",
"Gender": "Kön",
"Import Profession": "Importera Yrke",
"Import profession": "Importera yrke",
"Import string": "Import sträng",
"Import": "Importera",
"Important": "Viktigt",
"Item": "Föremål",
"Items": "Föremål",
"Login": "Logga in",
"Logout": "Logga ut",
"Name": "Namn",
"None": "Ingen",
"Only reagents": "Bara reagenser",
"Owner": "Ägare",
"Password": "Lösenord",
"Profession": "Yrke",
"Professions": "Yrken",
"Race": "Ras",
"Reagent for": "Reagens för",
"Reagents": "Reagenser",
"Recipe": "Recept",
"Recipes": "Recept",
"Roster": "Medlemmar",
"Save": "Spara",
"Showing": "Visar",
"User": "Användare",
"Username": "Användarnamn",
"of": "av",
"or": "eller",
"results": "resultat",
"to": "till",
"to generate the import string": "för att generera import strängen"
}

View file

@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| 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.
|
*/
'failed' => 'Dessa uppgifter stämmer inte överens med vårt register.',
'password' => 'Lösenordet var inte korrekt',
'throttle' => 'För många inloggningsförsök. Var vänlig försök igen om :seconds sekunder.',
];

View file

@ -0,0 +1,19 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| 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.
|
*/
'previous' => '&laquo; Föregående',
'next' => 'Nästa &raquo;',
];

View file

@ -0,0 +1,164 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| 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.
|
*/
'accepted' => ':Attribute måste accepteras.',
'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.',
'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.',
'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' => [
'username' => 'användarnamn',
'password' => 'lösenord',
'name' => 'namn',
'race' => 'ras',
'class' => 'klass',
],
];

View file

@ -0,0 +1,11 @@
<x-layout name="app">
<x-slot name="title">{{ __('Admin') }} - {{ __('Users') }} - {{ __(isset($model) ? 'Edit' : 'New') }}</x-slot>
@if (isset($model))
<livewire:form.admin.user-form :user="$model" />
@else
<livewire:form.admin.user-form />
@endif
</x-layout>

View file

@ -0,0 +1,13 @@
<x-layout name="app">
<x-slot name="title">{{ __('Admin') }} - {{ __('Users') }}</x-slot>
<x-slot name="page_links">
<x-button element="a" class="flex items-center" href="{{ route('admin.users.create') }}">
{{ __('New') }}
</x-button>
</x-slot>
<livewire:admin-user-table />
</x-layout>

View file

@ -1,19 +1,15 @@
<x-layout name="auth">
<h1 class="text-gray-500 text-3xl text-center mb-4">Login</h1>
<h1 class="text-gray-500 text-3xl text-center mb-4">{{ __('Login') }}</h1>
<x-form action="{{ route('auth.login.store') }}">
<x-input name="username" placeholder="{{ __('Username') }}" class="mb-2"/>
<x-input-password placeholder="{{ __('Password') }}" class="mb-2" />
<x-button element="input" type="submit" name="submit" value="Login" class="w-full" />
<x-button element="input" type="submit" name="submit" value="{{ __('Login') }}" class="w-full" />
</x-form>
@if (config('services.discord.client_id'))
<div class="flex items-center justify-between my-4">
<div class="bg-gray-200 h-px w-full"></div>
<div class="mx-4">OR</div>
<div class="bg-gray-200 h-px w-full"></div>
</div>
<x-divider>{{ __('or') }}</x-divider>
<x-button element="a" href="{{ route('oauth.create', ['driver' => 'discord'])}}" class="text-center w-full">
<x-icon name="discord-text-white" class="mx-auto h-8" />

View file

@ -9,19 +9,8 @@
</div>
</x-slot>
<div class="mx-auto max-w-sm p-4">
<p>Download this <x-link href="https://www.curseforge.com/wow/addons/professions-exporter" target="_blank">exporter addon</x-link>
<x-form action="{{ route('character.profession.store', [ 'character' => $character->slug ]) }}">
<div class="mb-2">
<x-form.label for="data">{{ __('Import string') }}</x-form.label>
<x-textarea class="h-64" name="data" />
</div>
<div class="mt-2">
<x-button element="input" type="submit" value="{{ __('Import') }}" />
</div>
</x-form>
<div class="p-4">
<x-profession-import-form route="{{ route('character.profession.store', [ 'character' => $character->slug ]) }}" />
</div>
</x-layout>

View file

@ -3,8 +3,14 @@
<x-slot name="title">
<div class="flex">
{{ __('Character') }} -
<x-class-icon class="w-8 h-8 mx-2" :name="$ch_prof->character->class" />
{{ $ch_prof->character->level }} {{ $ch_prof->character->name }}
<div class="flex mx-2 space-x-1">
<x-race-icon class="w-8 h-8" :character="$ch_prof->character" />
<x-class-icon class="w-8 h-8" :name="$ch_prof->character->class" />
</div>
<a href="{{ route('character.show', ['character' => $ch_prof->character ]) }}">
{{ $ch_prof->character->level }} {{ $ch_prof->character->name }}
</a>
</div>
</x-slot>

View file

@ -3,7 +3,10 @@
<x-slot name="title">
<div class="flex">
{{ __('Character') }} -
<x-class-icon class="w-8 h-8 mx-2" :name="$character->class" />
<div class="flex mx-2 space-x-1">
<x-race-icon class="w-8 h-8" :character="$character" />
<x-class-icon class="w-8 h-8" :name="$character->class" />
</div>
{{ $character->level }} {{ $character->name }}
</div>
</x-slot>
@ -19,7 +22,15 @@
<div class="p-4">
<x-section-heading>
<h2 class="text-3xl">Professions</h2>
<h2 class="text-3xl">{{ __('Owner') }}</h2>
</x-section-heading>
<x-link href="{{ route('user.show', [ 'user' => $character->user ])}}">
{{ $character->user->username }}
</x-link>
<x-section-heading>
<h2 class="text-3xl">{{ __('Professions') }}</h2>
<div>
@can('import_profession', $character)
<x-button element="a" class="flex items-center" href="{{ route('character.profession.create', [ 'character' => $character->slug ]) }}">

View file

@ -1,5 +1,36 @@
@props(['type', 'message'])
<div class="px-4 py-2 rounded border text-{{ $type }}-800 bg-{{ $type }}-200 border-{{ $type }}-300">
@php
switch($type) {
case 'info':
$border = 'border-blue-300';
$text = 'text-blue-800';
$bg = 'bg-blue-200';
break;
case 'success':
$border = 'border-green-300';
$text = 'text-green-800';
$bg = 'bg-green-200';
break;
case 'warning':
$border = 'border-yellow-300';
$text = 'text-yellow-800';
$bg = 'bg-yellow-200';
break;
case 'error':
$border = 'border-red-300';
$text = 'text-red-800';
$bg = 'bg-red-200';
break;
default:
$border = 'border-gray-300';
$text = 'text-gray-800';
$bg = 'bg-gray-200';
}
@endphp
<div class="px-4 py-2 rounded border {{ $bg }} {{ $text }} {{ $border }}">
{!! $message !!}
</div>

View file

@ -1,9 +1,16 @@
@props(['character', 'destroy' => false])
@props(['character', 'destroy' => false, 'frame' => false ])
<div class="rounded p-2 bg-class-{{ $character->class }}">
<div class="flex justify-between">
<div class="flex items-center">
@if ($frame)
<div class="w-8 h-8">
<x-class-icon :name="$character->class" />
<img class="transform -translate-x-2 -translate-y-6 scale-200" src="{{ url('images/elite_frame.png') }}" />
</div>
@else
<x-class-icon class="w-8 h-8" :name="$character->class" />
@endif
<a href="{{ route('character.show', ['character' => $character ]) }}" class="text-2xl ml-2">{{ $character->level }} {{ $character->name }}</a>
</div>
@ -17,7 +24,10 @@
</div>
<div class="flex justify-between">
<p>{{ Str::ucfirst($character->class) }}</p>
<p>
{{ __(Str::ucfirst($character->race)) }}
{{ __(Str::ucfirst($character->class)) }}
</p>
<div class="flex gap-1">
@foreach($character->professions as $ch_prof)

View file

@ -0,0 +1,9 @@
@if (strlen($slot) > 0)
<div class="flex items-center justify-between my-4">
<div class="bg-gray-200 h-px w-full"></div>
<div class="text-gray-400 mx-4 uppercase">{{ $slot }}</div>
<div class="bg-gray-200 h-px w-full"></div>
</div>
@else
<div class="bg-gray-200 h-px w-full my-6"></div>
@endif

View file

@ -0,0 +1,7 @@
<input type="checkbox" name="{{ $name }}" value="{{ $value }}"
{{ $attributes->merge(['class' => ($errors->has($name) ? 'border-red-400 text-red-400 ' : '') . 'border border-gray-200 rounded p-2 focus:ring-1']) }} {{ $disabled }} />
@error($name)
<p class="ml-2 text-red-400 text-sm">{{ $message }}</p>
@enderror

View file

@ -1,7 +1,7 @@
<input type="{{ $type }}" name="{{ $name }}" value="{{ $value }}"
{{ $attributes->merge(['class' => ($errors->has($name) ? 'border-danger-400 ' : '') . 'w-full border rounded px-2 py-1 focus:ring-2']) }} {{ $disabled }} />
{{ $attributes->merge(['class' => ($errors->has($name) ? 'border-red-400 ' : '') . 'w-full border border-gray-200 rounded px-2 py-1 focus:ring-1']) }} {{ $disabled }} />
@error($name)
<p class="ml-2 text-danger-400 text-sm">{{ $message }}</p>
<p class="ml-2 text-red-400 text-sm">{{ $message }}</p>
@enderror

View file

@ -1,9 +1,13 @@
<select {!! $attributes->merge(['class' => 'w-full border rounded p-1 focus:ring-2']) !!}>
<select name="{{ $name }}" {!! $attributes->merge(['class' => 'w-full border border-gray-200 rounded p-1 focus:ring-1']) !!}>
@forelse($options as $key => $option)
<option value="{{ $key }}">
<option value="{{ $key }}" @if($key == $value)selected @endif>
{{ $option }}
</option>
@empty
{!! $slot !!}
@endforelse
</select>
@error($name)
<p class="ml-2 text-red-400 text-sm">{{ $message }}</p>
@enderror

View file

@ -1,6 +1,6 @@
<textarea name="{{ $name }}"
{{ $attributes->merge(['class' => ($errors->has($name) ? 'border-red-400 ' : '') . 'w-full border rounded px-2 py-1 focus:ring-2']) }} {{ $disabled }}>{{ $value }}</textarea>
{{ $attributes->merge(['class' => ($errors->has($name) ? 'border-red-400 ' : '') . 'w-full border border-gray-200 rounded px-2 py-1 focus:ring-1']) }} {{ $disabled }}>{{ $value }}</textarea>
@error($name)
<p class="ml-2 text-red-400 text-sm">{{ $message }}</p>

View file

@ -1,3 +0,0 @@
<div>
<!-- The only way to do great work is to love what you do. - Steve Jobs -->
</div>

View file

@ -0,0 +1,17 @@
<p class="text-center">
<strong>{{ __("Important") }}!</strong>
{{ __('Download this') }}
<x-link href="https://www.curseforge.com/wow/addons/professions-exporter" target="_blank">{{ __('addon') }}</x-link>
{{ __('to generate the import string') }}
</p>
<x-form action="{{ $route }}">
<div class="mb-2">
<x-form.label for="data">{{ __('Import string') }}</x-form.label>
<x-textarea class="h-64" name="data" />
</div>
<div class="mt-2">
<x-button element="input" type="submit" value="{{ __('Import') }}" />
</div>
</x-form>

View file

@ -0,0 +1,13 @@
@props(['recipe'])
@php
if ($recipe->spell) {
$id = $recipe->spell->id;
$type = 'spell';
} else {
$id = $recipe->craft->external_id;
$type = 'item';
}
@endphp
<x-wowhead-link :type="$type" :wh-id="$id" href="{{ route('recipe.show', [ 'recipe' => $recipe ]) }}">
{{ $recipe->name }}
</x-wowhead-link>

View file

@ -0,0 +1,8 @@
<x-layout name="app">
<x-slot name="title">{{ __('Items') }}</x-slot>
<div class="p-4">
<livewire:items />
</div>
</x-layout>

View file

@ -0,0 +1,45 @@
<x-layout name="app">
<x-slot name="title">{{ __('Item') }} - {{ $item->name }}</x-slot>
<div class="p-4">
<div class="mb-4">
<x-wowhead-link wh-id="{{ $item->external_id }}">{{ $item->name }}</x-wowhead-link>
</div>
@if (count($item->recipes) > 0)
<div class="mb-4">
<x-section-heading>
<h2 class="text-3xl">{{ __('Created by') }}</h2>
</x-section-heading>
<ul class="px-4 space-y-2">
@foreach($item->recipes as $recipe)
<li>
@if ($recipe->spell_id)
<x-wowhead-link type="spell" wh-id="{{ $recipe->spell_id }}" href="{{ route('recipe.show', [ 'recipe' => $recipe ]) }}">{{ $recipe->name }}</x-wowhead-link>
@else
{{ $recipe->name }}
@endif
</li>
@endforeach
</li>
</div>
@endif
@if (count($item->reagent_for) > 0)
<div class="mb-4">
<x-section-heading>
<h2 class="text-3xl">{{ __('Reagent for') }}</h2>
</x-section-heading>
<ul class="px-4 space-y-2">
@foreach($item->reagent_for as $recipe)
<li><x-recipe-link :recipe="$recipe" /></li>
@endforeach
</ul>
</div>
@endif
</div>
</x-layout>

View file

@ -12,7 +12,7 @@
</div>
@if (isset($page_links))
<div>
<div class="flex space-x-2">
{{ $page_links }}
</div>
@endif

View file

@ -0,0 +1,42 @@
<div class="p-4">
<table class="w-full">
<tr>
<th><x-input wire:model="username" name="username" placeholder="Username" /></th>
<th><x-select wire:model="role" name="role" :options="['' => '-- Role --', 'user' => 'User', 'admin' => 'Admin']" /></th>
</tr>
<tr class="border-b-2">
<th class="py-2 text-left">Username</th>
<th class="py-2 w-24">Role</th>
<th class="py-2 w-44">Created</th>
<th class="py-2 w-44">Updated</th>
<th class="py-2 w-6">&nbsp;</th>
</tr>
@foreach($users as $user)
<tr class="border-b hover:bg-gray-100">
<td class="px-2 py-1">
<x-link href="{{ route('admin.users.edit', [ 'user' => $user ]) }}">
{{ $user->username }}
</x-link>
</td>
<td class="px-2 py-1 text-center">{{ $user->role }}</td>
<td class="px-2 py-1">{{ $user->created_at }}</td>
<td class="px-2 py-1">{{ $user->updated_at }}</td>
<td>
<x-form :action="route('admin.users.destroy', [ 'user' => $user ])" method="DELETE">
<a href="#" onclick="this.closest('form').submit();return false;">
<x-icon name="cross" class="h-6 h-6 text-danger-400 hover:text-danger-600" />
</a>
</x-form>
</td>
</tr>
@endforeach
</table>
<div class="mt-4">
{{ $users->links() }}
</div>
</div>

View file

@ -0,0 +1,27 @@
<x-form class="p-4" wire:submit.prevent="save">
<div>
<x-form.label for="username">{{ __('Username') }}</x-form.label>
<x-input wire:model="user.username" name="user.username" label="username" />
</div>
<div>
<x-form.label for="role">{{ __('Role') }}</x-form.label>
<x-select wire:model="user.role" name="role" :options="['user' => 'User', 'admin' => 'Admin']" />
</div>
<div class="mb-2">
<x-form.label for="password">{{ __('Password') }}</x-form.label>
<x-input-password wire:model="password" name="password" />
</div>
<div class="mb-2">
<x-form.label for="password_confirmation">{{ __('Confirm Password') }}</x-form.label>
<x-input-password wire:model="password_confirmation" name="password_confirmation" />
</div>
<div class="mt-2">
<x-button element="input" type="submit" value="{{ $user->id ? 'Save' : 'Create' }}" />
</div>
</x-form>

View file

@ -32,7 +32,7 @@
</div>
<div class="mt-2">
<x-button element="input" type="submit" value="{{$this->character->exists ? 'Save' : 'Create' }}" />
<x-button element="input" type="submit" value="{{ __($this->character->exists ? 'Save' : 'Create') }}" />
</div>
</x-form>

View file

@ -0,0 +1,55 @@
<div>
<div class="grid grid-cols-2 gap-4 mb-2">
<x-input wire:model="name" name="name" placeholder="{{ __('Name') }}" />
<div class="flex items-center">
<label for="reagent_for" class="mr-2">{{ __('Only reagents') }}</label>
<x-checkbox wire:model="reagent_for" name="reagent_for" />
</div>
</div>
@if ($items->count())
<table class="w-full whitespace-nowrap">
<thead>
<tr tabindex="0" class="focus:outline-none w-full text-sm leading-none text-gray-800">
<th class="text-left w-1/4 px-3 py-4">{{ __('Name') }}</th>
<th class="text-left w-3/4 px-3 py-4">{{ __('Reagent for') }}</th>
</tr>
</thead>
<tbody class="w-full">
@foreach($items as $item)
<tr class="focus:outline-none text-sm leading-none text-gray-800 bg-white hover:bg-gray-100 border-b border-t border-gray-100">
<td class="px-3 py-4">
<x-wowhead-link type="item" :wh-id="$item->external_id" href="{{ route('item.show', [ 'item' => $item ]) }}">
{{ $item->name }}
</x-wowhead-link>
</td>
<td class="px-3 py-4">
@if ($item->reagent_for && $item->reagent_for->count() > 0)
<ul class="flex flex-wrap items-center gap-2">
@foreach($item->reagent_for->take(15) as $recipe)
<li>
<x-recipe-link :recipe="$recipe" />
</li>
@endforeach
@if ($item->reagent_for->count() > 15)
<li>and <strong>{{ $item->reagent_for->count() - 15 }}</strong> more</li>
@endif
</ul>
@else
<span class="text-gray-400">{{ __('None') }}</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="mt-4">
{{ $items->links() }}
</div>
@else
<x-empty-result>No items found</x-empty-result>
@endif
</div>

View file

@ -1,8 +1,8 @@
<div>
<div class="grid grid-cols-3 gap-4 mb-2">
<x-input wire:model="name" name="name" placeholder="Recipe" />
<x-input wire:model="crafter" name="crafter" placeholder="Crafter" />
<x-input wire:model="name" name="name" placeholder="{{ __('Recipe') }}" />
<x-input wire:model="crafter" name="crafter" placeholder="{{ __('Crafter') }}" />
<x-select wire:model="profession" name="profession" :options="$profession_options" />
</div>
@ -10,27 +10,16 @@
<table class="w-full whitespace-nowrap">
<thead>
<tr tabindex="0" class="focus:outline-none w-full text-sm leading-none text-gray-800">
<th class="text-left px-3 py-4">Recipe</th>
<th class="text-left px-3 py-4">Profession</th>
<th class="text-left px-3 py-4">Crafters</th>
<th class="text-left px-3 py-4">{{ __('Recipe') }}</th>
<th class="text-left px-3 py-4">{{ __('Profession') }}</th>
<th class="text-left px-3 py-4">{{ __('Crafters') }}</th>
</tr>
</thead>
<tbody class="w-full">
@foreach($recipes as $recipe)
<tr class="focus:outline-none text-sm leading-none text-gray-800 bg-white hover:bg-gray-100 border-b border-t border-gray-100">
<td class="px-3 py-4">
@php
if ($recipe->spell) {
$id = $recipe->spell->id;
$type = 'spell';
} else {
$id = $recipe->craft->external_id;
$type = 'item';
}
@endphp
<x-wowhead-link :type="$type" :wh-id="$id" href="{{ route('recipe.show', [ 'recipe' => $recipe ]) }}">
{{ $recipe->name }}
</x-wowhead-link>
<x-recipe-link :recipe="$recipe" />
</td>
<td class="px-3 py-4">
<div class="flex items-center">

Some files were not shown because too many files have changed in this diff Show more