diff --git a/app/Http/Controllers/PokemonController.php b/app/Http/Controllers/PokemonController.php index 0deb518..96be273 100644 --- a/app/Http/Controllers/PokemonController.php +++ b/app/Http/Controllers/PokemonController.php @@ -12,41 +12,41 @@ public function index(Request $request): \Illuminate\Contracts\View\View|\Illumi { $query = Pokemon::query(); - if (isset($request->namefilter) && !empty($request->namefilter)) { - $query->where('name', 'LIKE', '%' . $request->namefilter . '%'); + if (!empty($request->name)) { + $query->where('name', 'LIKE', '%' . $request->name . '%'); } - if (isset($request->type1filter) && !empty($request->type1filter) && isset($request->type2filter) && !empty($request->type2filter)) { - if ($request->type2filter == "None") { + if (!empty($request->type1) && !empty($request->type2)) { + if ($request->type2 == "None") { $query->where(function ($q) use ($request) { - $q->where('type1_id', $request->type1filter) + $q->where('type1_id', $request->type1) ->whereNull('type2_id'); }); } else { $query->where(function ($q) use ($request) { $q->where(function ($q2) use ($request) { - $q2->where('type1_id', $request->type1filter) - ->where('type2_id', $request->type2filter); + $q2->where('type1_id', $request->type1) + ->where('type2_id', $request->type2); })->orWhere(function ($q2) use ($request) { - $q2->where('type1_id', $request->type2filter) - ->where('type2_id', $request->type1filter); + $q2->where('type1_id', $request->type2) + ->where('type2_id', $request->type1); }); }); } } else { - if (isset($request->type1filter) && !empty($request->type1filter)) { + if (!empty($request->type1filter)) { $query->where(function ($q) use ($request) { - $q->where('type1_id', $request->type1filter) - ->orWhere('type2_id', $request->type1filter); + $q->where('type1_id', $request->type1) + ->orWhere('type2_id', $request->type1); }); } - if (isset($request->type2filter) && !empty($request->type2filter)) { - if ($request->type2filter == "None") { + if (!empty($request->type2)) { + if ($request->type2 == "None") { $query->where('type2_id', null); } else { $query->where(function ($q) use ($request) { - $q->where('type2_id', $request->type2filter) - ->orWhere('type1_id', $request->type2filter); + $q->where('type2_id', $request->type2) + ->orWhere('type1_id', $request->type2); }); } } diff --git a/app/Http/Requests/RegisterRequest.php b/app/Http/Requests/RegisterRequest.php index 6c72d81..4c3b121 100755 --- a/app/Http/Requests/RegisterRequest.php +++ b/app/Http/Requests/RegisterRequest.php @@ -22,7 +22,7 @@ public function authorize(): bool public function rules(): array { return [ - 'name' => 'required|string|max:50', + 'name' => 'required|string|max:30', 'email' => 'required|email|unique:users,email', 'password' => 'required|min:8|confirmed', ]; diff --git a/app/Http/Requests/TeamRequest.php b/app/Http/Requests/TeamRequest.php index 7f1a2fb..9c51dc4 100755 --- a/app/Http/Requests/TeamRequest.php +++ b/app/Http/Requests/TeamRequest.php @@ -14,7 +14,7 @@ public function authorize(): bool public function rules(): array { return [ - 'name' => 'required|min:5|max:255', + 'name' => 'required|min:5|max:40', 'selected_pokemons.*' => 'exists:pokemons,id', ]; } @@ -24,7 +24,7 @@ public function messages(): array return [ 'name.required' => 'The team name is required!', 'name.min' => 'The team name must be at least 5 characters!', - 'name.max' => 'The team name may not be greater than 30 characters!', + 'name.max' => 'The team name may not be greater than 40 characters!', 'selected_pokemons.max' => 'You can only select up to 6 Pokémon for a team!', 'selected_pokemons.*.exists' => 'Some of the selected Pokemon are not valid.', ]; diff --git a/resources/css/app.css b/resources/css/app.css index b2d790f..34d36ef 100755 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -12,3 +12,106 @@ flex-shrink: 0; } +.btn-primary { + background-color: #3B4CCA; + border-color: #2A3E90; + color: #FFF; + border-radius: 5px; +} +.btn-primary:hover { + background-color: #2A3E90; + border-color: #1F2E68; + color: #FFF; +} +.btn-primary:focus, .btn-primary:active { + background-color: #1F2E68; + border-color: #162052; + color: #FFF; +} + +.btn-info { + background-color: #78C850; + border-color: #5E9640; + color: #FFF; + border-radius: 5px; +} +.btn-info:hover { + background-color: #5E9640; + border-color: #467235; + color: #FFF; +} +.btn-info:focus, .btn-info:active { + background-color: #467235; + border-color: #365527; + color: #FFF; +} + +.btn-danger { + background-color: #D23B3B; + border-color: #A32D2D; + color: #FFF; + border-radius: 5px; +} +.btn-danger:hover { + background-color: #A32D2D; + border-color: #7A2323; + color: #FFF; +} +.btn-danger:focus, .btn-danger:active { + background-color: #7A2323; + border-color: #5A1A1A; + color: #FFF; +} + +.btn-warning { + background-color: #E2C32A; + border-color: #B59D20; + color: #FFF; + border-radius: 5px; +} +.btn-warning:hover { + background-color: #B59D20; + border-color: #8E7919; + color: #FFF; +} +.btn-warning:focus, .btn-warning:active { + background-color: #8E7919; + border-color: #6A5E13; + color: #FFF; +} + +.btn-success { + background-color: #6890F0; + border-color: #5270C0; + color: #FFF; + border-radius: 5px; +} +.btn-success:hover { + background-color: #5270C0; + border-color: #3E558F; + color: #FFF; +} +.btn-success:focus, .btn-success:active { + background-color: #3E558F; + border-color: #2D406B; + color: #FFF; +} + +.btn-secondary { + background-color: #A8A878; + border-color: #7D7D5C; + color: #FFF; + border-radius: 5px; +} +.btn-secondary:hover { + background-color: #7D7D5C; + border-color: #5C5C45; + color: #FFF; +} +.btn-secondary:focus, .btn-secondary:active { + background-color: #5C5C45; + border-color: #454534; + color: #FFF; +} + + diff --git a/resources/js/initializePokemonSelection.js b/resources/js/initializePokemonSelection.js index 2bff812..9c34ae8 100755 --- a/resources/js/initializePokemonSelection.js +++ b/resources/js/initializePokemonSelection.js @@ -26,7 +26,7 @@ export function initializePokemonSelection(slotSelector, addPokemonBtnSelector, function updateCardVisuals() { document.querySelectorAll('.pokemon-card').forEach(card => { - card.classList.remove('selected-green', 'selected-blue'); + card.classList.remove('selected-green', 'selected-yellow'); const pokemonId = card.querySelector('.add-pokemon-btn').dataset.pokemonId; const addButton = card.querySelector('.add-pokemon-btn'); @@ -48,7 +48,7 @@ export function initializePokemonSelection(slotSelector, addPokemonBtnSelector, } function updateCardIfSelectedOnAnotherSlot(card, addButton) { - card.classList.add('selected-blue'); + card.classList.add('selected-yellow'); addButton.classList.remove('btn-danger'); addButton.classList.add('btn-success'); addButton.innerHTML = ''; diff --git a/resources/views/layout/app.blade.php b/resources/views/layout/app.blade.php index 6e51b89..9abb1d5 100755 --- a/resources/views/layout/app.blade.php +++ b/resources/views/layout/app.blade.php @@ -13,49 +13,49 @@ @vite(['resources/css/app.css', 'resources/js/app.js']) -
-