Skip to content

Commit

Permalink
refactor: react routes design (#144)
Browse files Browse the repository at this point in the history
This pull request includes several changes to the `Admin` module,
focusing on adding new controllers, updating UI components, and
enhancing internationalization support. The most important changes
include the addition of new controllers for various models, updates to
the UI to improve consistency, and enhancements to the
internationalization files for better language support.

### New Controllers:
* Added `ContractController`, `ElementTypeController`,
`ResourceController`, `ResourceTypeController`, `TaskTypeController`,
`TreeTypeController`, `UserController`, and `WorkOrderController` to
handle CRUD operations for their respective models.
[[1]](diffhunk://#diff-1e061618882f9d3b18f9b45dee03bbf0ecbbf7f4c613a9e2c8893bb1e7fe9424R1-R14)
[[2]](diffhunk://#diff-f9b86806613dff11b8d56326122b3dd2fb059354b9e9a0fc4f26d5a8f450a865R1-R14)
[[3]](diffhunk://#diff-334d1e8423419dc152752c034a27f61b5f6f1da517a288b02b4523c5d89a003fR1-R14)
[[4]](diffhunk://#diff-2160a8032c69b4611658240bab7758780a7e87a6fc5e540155dbf03bb4befd73R1-R14)
[[5]](diffhunk://#diff-9886859edf07506d4c800e60da96fa7810ab10d48fa7d7205fe3c3edb94faffeR1-R14)
[[6]](diffhunk://#diff-754db81f3ccdaa787e6903661bd639c8f73f0a06c2fc0ca7a9f485a9f526820eR1-R14)
[[7]](diffhunk://#diff-91717f892c3b69ecebbab89bb0c9c2f97f60b0402a1a3408c66cced5d7392992R1-R14)
[[8]](diffhunk://#diff-5d3065dcb9a75c4acff12da45465892530a81fab1cb44f4281e382676b54c2aeR1-R14)
* Added an empty `StatsController` for future use.

### UI Updates:
* Changed background color from `bg-gray-50` to `bg-white` in various
components for a cleaner look.
[[1]](diffhunk://#diff-7fb19f47106a33f9ed65736f3f9188556afa1d4b7a058cf8e6db2b68ac301684L58-R58)
[[2]](diffhunk://#diff-7fb19f47106a33f9ed65736f3f9188556afa1d4b7a058cf8e6db2b68ac301684L72-R72)
[[3]](diffhunk://#diff-89083fe4ece8df2f9ffedb8582934127cd09dae00aa22e3332f5f80a8dc3ec55L10-R10)
* Updated `AdminLayout` to use internationalized titles and improved the
layout structure for better usability.
[[1]](diffhunk://#diff-61d6d3d7ff0a74287a381aae865e43ee4ea65fcc701ad84509ef3600b32bf456L16-R30)
[[2]](diffhunk://#diff-61d6d3d7ff0a74287a381aae865e43ee4ea65fcc701ad84509ef3600b32bf456L39)
[[3]](diffhunk://#diff-61d6d3d7ff0a74287a381aae865e43ee4ea65fcc701ad84509ef3600b32bf456R79-R111)

### Internationalization Enhancements:
* Added new menu and page titles to `ca.json`, `en.json`, and `es.json`
files to support additional languages and better structure.
[[1]](diffhunk://#diff-3822e87aba8184976f5aaf0175f134591a0a92a8e8637f20c19f249a71167a85R27-R44)
[[2]](diffhunk://#diff-3822e87aba8184976f5aaf0175f134591a0a92a8e8637f20c19f249a71167a85R53)
[[3]](diffhunk://#diff-3822e87aba8184976f5aaf0175f134591a0a92a8e8637f20c19f249a71167a85R66-R92)
[[4]](diffhunk://#diff-75fa9e3a78347c6cd6a747ef879348f248881628a32d8926eba7a5036998bba3R27-R44)
[[5]](diffhunk://#diff-75fa9e3a78347c6cd6a747ef879348f248881628a32d8926eba7a5036998bba3R53)
[[6]](diffhunk://#diff-75fa9e3a78347c6cd6a747ef879348f248881628a32d8926eba7a5036998bba3R66-R92)
[[7]](diffhunk://#diff-db19a2b522ebee2953f9c96329f0090c6e63dc155903585c7b618220ad3998a6R27-R44)
[[8]](diffhunk://#diff-db19a2b522ebee2953f9c96329f0090c6e63dc155903585c7b618220ad3998a6L58-R92)

### Dependency Update:
* Added `chart.js` to `package.json` dependencies for future charting
capabilities.

### TypeScript Declaration:
* Added a TypeScript module declaration for `.png` files to support
image imports.
  • Loading branch information
0x1026 authored Feb 19, 2025
2 parents 2e848e9 + 4101da9 commit a3c616d
Show file tree
Hide file tree
Showing 46 changed files with 4,003 additions and 7,965 deletions.
14 changes: 14 additions & 0 deletions app/Http/Controllers/Api/Admin/ContractController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;
use App\Models\Contract;

class ContractController extends Controller
{
public function index()
{
return Contract::all();
}
}
14 changes: 14 additions & 0 deletions app/Http/Controllers/Api/Admin/ElementTypeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;
use App\Models\ElementType;

class ElementTypeController extends Controller
{
public function index()
{
return ElementType::all();
}
}
14 changes: 14 additions & 0 deletions app/Http/Controllers/Api/Admin/ResourceController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;
use App\Models\Resource;

class ResourceController extends Controller
{
public function index()
{
return Resource::all();
}
}
14 changes: 14 additions & 0 deletions app/Http/Controllers/Api/Admin/ResourceTypeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;
use App\Models\ResourceType;

class ResourceTypeController extends Controller
{
public function index()
{
return ResourceType::all();
}
}
10 changes: 10 additions & 0 deletions app/Http/Controllers/Api/Admin/StatsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;

class StatsController extends Controller
{
//
}
14 changes: 14 additions & 0 deletions app/Http/Controllers/Api/Admin/TaskTypeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;
use App\Models\TaskType;

class TaskTypeController extends Controller
{
public function index()
{
return TaskType::all();
}
}
14 changes: 14 additions & 0 deletions app/Http/Controllers/Api/Admin/TreeTypeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;
use App\Models\TreeType;

class TreeTypeController extends Controller
{
public function index()
{
return TreeType::all();
}
}
14 changes: 14 additions & 0 deletions app/Http/Controllers/Api/Admin/UserController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;
use App\Models\User;

class UserController extends Controller
{
public function index()
{
return User::all();
}
}
14 changes: 14 additions & 0 deletions app/Http/Controllers/Api/Admin/WorkOrderController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;
use App\Models\WorkOrder;

class WorkOrderController extends Controller
{
public function index()
{
return WorkOrder::all();
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function login(Request $request): JsonResponse
$user = User::where('email', $request->email)->first();

if (! $user || ! Hash::check($request->password, $user->password)) {
return response()->json(['error' => 'Unauthorized'], 401);
return response()->json(['message' => __('auth.failed')], 401);
}

$token = $user->createToken('accessToken')->plainTextToken;
Expand Down
28 changes: 10 additions & 18 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";
import pluginPrettier from "eslint-plugin-prettier";
import configPrettier from "eslint-config-prettier";
// @ts-check

/** @type {import('eslint').Linter.Config[]} */
export default [
{settings: {react: {version: "detect"}, "import/resolver": { "typescript": {} }}},
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
pluginPrettier,
configPrettier,
{ rules: { "prettier/prettier": "error" } },
];
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-config-prettier';

export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended,
prettier,
);
Loading

0 comments on commit a3c616d

Please sign in to comment.