refactor: clean up code by removing unused imports and improving formatting across multiple files
This commit is contained in:
parent
0023309a8f
commit
eba21d3d3a
@ -4,7 +4,6 @@
|
||||
|
||||
enum Role: string
|
||||
{
|
||||
|
||||
case DEVELOPER = 'developer';
|
||||
case OWNER = 'owner';
|
||||
case ADMIN_TOKO = 'admin-toko';
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin\HR;
|
||||
|
||||
use App\Concerns\HasRoleChecks;
|
||||
use App\Enums\Role;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Admin\HR\EmployeeRequest;
|
||||
use App\Http\Requests\PaginatedRequest;
|
||||
@ -14,6 +16,8 @@
|
||||
|
||||
class EmployeeController extends Controller
|
||||
{
|
||||
use HasRoleChecks;
|
||||
|
||||
public function __construct(
|
||||
private EmployeeService $service,
|
||||
private RoleService $roleService,
|
||||
@ -27,7 +31,7 @@ public function index(PaginatedRequest $request): Response
|
||||
filters: $request->only(['employment_status', 'is_active', 'gender']),
|
||||
),
|
||||
'filters' => $request->only(['employment_status', 'is_active', 'gender']),
|
||||
'canViewAll' => $this->service->canViewAll(),
|
||||
'canViewAll' => self::hasAnyRole([Role::DEVELOPER, Role::OWNER, Role::DIREKTUR, Role::ADMIN_TOKO]),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -35,7 +39,7 @@ public function create(): Response
|
||||
{
|
||||
return Inertia::render('admin/hr/employee/create', [
|
||||
'roles' => $this->roleService->getForEmployee(),
|
||||
'canViewAll' => $this->service->canViewAll(),
|
||||
'canViewAll' => self::hasAnyRole([Role::DEVELOPER, Role::OWNER, Role::DIREKTUR, Role::ADMIN_TOKO]),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -55,7 +59,7 @@ public function edit(User $user): Response
|
||||
return Inertia::render('admin/hr/employee/edit', [
|
||||
'employee' => $user,
|
||||
'roles' => $this->roleService->getForEmployee(),
|
||||
'canViewAll' => $this->service->canViewAll(),
|
||||
'canViewAll' => self::hasAnyRole([Role::DEVELOPER, Role::OWNER, Role::DIREKTUR, Role::ADMIN_TOKO]),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Admin\Manage\TransactionRequest;
|
||||
use App\Http\Requests\PaginatedRequest;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Order;
|
||||
use App\Models\User;
|
||||
use App\Services\Admin\Manage\TransactionService;
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
use App\Enums\PriceType;
|
||||
use App\Enums\ProductStockQuality;
|
||||
use App\Enums\Role;
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductVariant;
|
||||
use App\Models\Restock;
|
||||
use App\Models\RestockItem;
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
use App\Models\Customer;
|
||||
use App\Models\Order;
|
||||
use App\Models\OrderItem;
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductVariant;
|
||||
use App\Models\User;
|
||||
use App\Services\Concerns\HasStockAdjustment;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user