hr impletented
This commit is contained in:
parent
2c5eb1634a
commit
2d2d1e3322
@ -156,6 +156,7 @@ public function storeRole(Request $request)
|
|||||||
$role = Role::create([
|
$role = Role::create([
|
||||||
'name' => $request->name,
|
'name' => $request->name,
|
||||||
'description' => $request->description,
|
'description' => $request->description,
|
||||||
|
'can_manage_onboarding' => $request->boolean('can_manage_onboarding'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($request->has('apps')) {
|
if ($request->has('apps')) {
|
||||||
@ -182,6 +183,7 @@ public function updateRole(Request $request, $id)
|
|||||||
$role->update([
|
$role->update([
|
||||||
'name' => $request->name,
|
'name' => $request->name,
|
||||||
'description' => $request->description,
|
'description' => $request->description,
|
||||||
|
'can_manage_onboarding' => $request->boolean('can_manage_onboarding'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$role->apps()->sync($request->apps ?? []);
|
$role->apps()->sync($request->apps ?? []);
|
||||||
@ -292,6 +294,18 @@ public function updateDefaultRole(Request $request)
|
|||||||
return redirect()->route('admin.dashboard')->with('success', 'Default role for new users updated successfully.');
|
return redirect()->route('admin.dashboard')->with('success', 'Default role for new users updated successfully.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the Onboarding & Offboarding module status globally.
|
||||||
|
*/
|
||||||
|
public function updateOnboardingToggle(Request $request)
|
||||||
|
{
|
||||||
|
$enabled = $request->boolean('onboarding_enabled') ? '1' : '0';
|
||||||
|
\App\Models\Setting::set('onboarding_enabled', $enabled);
|
||||||
|
|
||||||
|
$msg = $enabled === '1' ? 'Onboarding & Offboarding module enabled.' : 'Onboarding & Offboarding module disabled.';
|
||||||
|
return redirect()->route('admin.dashboard')->with('success', $msg);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle the admin privilege of a user.
|
* Toggle the admin privilege of a user.
|
||||||
*/
|
*/
|
||||||
|
|||||||
254
app/Http/Controllers/OnboardingController.php
Normal file
254
app/Http/Controllers/OnboardingController.php
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\App;
|
||||||
|
use App\Models\Onboarding;
|
||||||
|
use App\Models\Role;
|
||||||
|
use App\Models\Setting;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\UserAppOverride;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class OnboardingController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the Onboarding & Offboarding Dashboard.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if (!$user->canManageOnboarding()) {
|
||||||
|
return redirect()->route('dashboard')->with('error', 'Access denied. You do not have permission to access Onboarding & Offboarding.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$onboardings = Onboarding::with(['user', 'creator', 'offboarder'])
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$activeUsers = User::with(['roles', 'overrides.app'])
|
||||||
|
->where('id', '!=', Auth::id())
|
||||||
|
->orderBy('name', 'asc')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$apps = App::orderBy('name', 'asc')->get();
|
||||||
|
$roles = Role::where('name', '!=', 'Admin')->orderBy('name', 'asc')->get();
|
||||||
|
|
||||||
|
$stats = [
|
||||||
|
'preboarding_count' => $onboardings->where('status', 'preboarding')->count(),
|
||||||
|
'active_interns_count' => $onboardings->where('type', 'intern')->where('status', 'active')->count(),
|
||||||
|
'offboarded_count' => $onboardings->where('status', 'offboarded')->count(),
|
||||||
|
'total_managed' => $onboardings->count(),
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('onboarding.index', compact('onboardings', 'activeUsers', 'apps', 'roles', 'stats'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a new onboarding candidate or intern profile.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user->canManageOnboarding()) {
|
||||||
|
return redirect()->route('dashboard')->with('error', 'Access denied.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'email' => 'required|email|max:255',
|
||||||
|
'type' => 'required|string|in:intern,candidate,employee',
|
||||||
|
'join_date' => 'nullable|date',
|
||||||
|
'department' => 'nullable|string|max:255',
|
||||||
|
'assigned_roles' => 'nullable|array',
|
||||||
|
'assigned_apps' => 'nullable|array',
|
||||||
|
'notes' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$defaultChecklist = [
|
||||||
|
'document_verified' => false,
|
||||||
|
'email_created' => false,
|
||||||
|
'laptop_assigned' => false,
|
||||||
|
'sso_bundle_granted' => false,
|
||||||
|
'welcome_briefing' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
Onboarding::create([
|
||||||
|
'name' => $request->name,
|
||||||
|
'email' => strtolower(trim($request->email)),
|
||||||
|
'type' => $request->type,
|
||||||
|
'status' => 'preboarding',
|
||||||
|
'join_date' => $request->join_date,
|
||||||
|
'department' => $request->department,
|
||||||
|
'assigned_roles' => $request->assigned_roles ?? [],
|
||||||
|
'assigned_apps' => $request->assigned_apps ?? [],
|
||||||
|
'checklist' => $defaultChecklist,
|
||||||
|
'notes' => $request->notes,
|
||||||
|
'created_by' => Auth::id(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('onboarding.index')->with('success', 'Onboarding profile for ' . $request->name . ' created successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activate Day-1 Candidate / Intern account & provision SSO access.
|
||||||
|
*/
|
||||||
|
public function activate($id)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user->canManageOnboarding()) {
|
||||||
|
return redirect()->route('dashboard')->with('error', 'Access denied.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$onboarding = Onboarding::findOrFail($id);
|
||||||
|
|
||||||
|
// Check if user account already exists by email
|
||||||
|
$existingUser = User::where('email', $onboarding->email)->first();
|
||||||
|
|
||||||
|
if (!$existingUser) {
|
||||||
|
// Create user account with randomized initial password
|
||||||
|
$existingUser = User::create([
|
||||||
|
'name' => $onboarding->name,
|
||||||
|
'email' => $onboarding->email,
|
||||||
|
'password' => Hash::make(Str::random(16)),
|
||||||
|
'role' => 'user',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach assigned roles if any
|
||||||
|
if (!empty($onboarding->assigned_roles)) {
|
||||||
|
$existingUser->roles()->syncWithoutDetaching($onboarding->assigned_roles);
|
||||||
|
} else {
|
||||||
|
// Default role fallback
|
||||||
|
$defaultRoleName = Setting::get('default_role', 'Developer');
|
||||||
|
$defaultRole = Role::firstOrCreate(['name' => $defaultRoleName]);
|
||||||
|
$existingUser->roles()->syncWithoutDetaching([$defaultRole->id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach pre-approved service overrides
|
||||||
|
if (!empty($onboarding->assigned_apps)) {
|
||||||
|
foreach ($onboarding->assigned_apps as $appId) {
|
||||||
|
UserAppOverride::firstOrCreate([
|
||||||
|
'user_id' => $existingUser->id,
|
||||||
|
'app_id' => $appId,
|
||||||
|
'type' => 'allow',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update onboarding record
|
||||||
|
$checklist = $onboarding->checklist ?? [];
|
||||||
|
$checklist['sso_bundle_granted'] = true;
|
||||||
|
|
||||||
|
$onboarding->update([
|
||||||
|
'user_id' => $existingUser->id,
|
||||||
|
'status' => 'active',
|
||||||
|
'checklist' => $checklist,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('onboarding.index')->with('success', 'Account activated for ' . $onboarding->name . '. SSO access provisioned!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1-Click Offboard: Instantly block account, revoke SSO apps, & log offboarding.
|
||||||
|
*/
|
||||||
|
public function offboard(Request $request, $id)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user->canManageOnboarding()) {
|
||||||
|
return redirect()->route('dashboard')->with('error', 'Access denied.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$onboarding = Onboarding::find($id);
|
||||||
|
|
||||||
|
if ($onboarding && $onboarding->user_id) {
|
||||||
|
$targetUser = User::find($onboarding->user_id);
|
||||||
|
} else {
|
||||||
|
// Try to find user directly if $id is user_id
|
||||||
|
$targetUser = User::find($id);
|
||||||
|
if ($targetUser) {
|
||||||
|
$onboarding = Onboarding::firstOrCreate([
|
||||||
|
'user_id' => $targetUser->id,
|
||||||
|
], [
|
||||||
|
'name' => $targetUser->name,
|
||||||
|
'email' => $targetUser->email,
|
||||||
|
'type' => 'employee',
|
||||||
|
'created_by' => Auth::id(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$targetUser) {
|
||||||
|
return redirect()->route('onboarding.index')->with('error', 'Target user account not found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent offboarding self or admins
|
||||||
|
if ($targetUser->id === Auth::id() || $targetUser->isAdmin()) {
|
||||||
|
return redirect()->route('onboarding.index')->with('error', 'Security alert: You cannot offboard administrator accounts.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. Block user account
|
||||||
|
$targetUser->update(['is_blocked' => true]);
|
||||||
|
|
||||||
|
// 2. Clear active overrides / grants
|
||||||
|
$targetUser->overrides()->delete();
|
||||||
|
|
||||||
|
// 3. Update onboarding record
|
||||||
|
$checklist = $onboarding->checklist ?? [];
|
||||||
|
$checklist['exit_revocation_completed'] = true;
|
||||||
|
|
||||||
|
$onboarding->update([
|
||||||
|
'status' => 'offboarded',
|
||||||
|
'exit_date' => now(),
|
||||||
|
'offboarded_by' => Auth::id(),
|
||||||
|
'offboarded_at' => now(),
|
||||||
|
'checklist' => $checklist,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('onboarding.index')->with('success', '1-Click Offboarding completed for ' . $targetUser->name . '. Account blocked & SSO access revoked!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update checklist item for an onboarding / offboarding profile.
|
||||||
|
*/
|
||||||
|
public function updateChecklist(Request $request, $id)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user->canManageOnboarding()) {
|
||||||
|
return response()->json(['error' => 'Access denied'], 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$onboarding = Onboarding::findOrFail($id);
|
||||||
|
$checklist = $onboarding->checklist ?? [];
|
||||||
|
|
||||||
|
$key = $request->input('key');
|
||||||
|
$val = $request->boolean('val');
|
||||||
|
|
||||||
|
if ($key) {
|
||||||
|
$checklist[$key] = $val;
|
||||||
|
$onboarding->update(['checklist' => $checklist]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['success' => true, 'checklist' => $checklist]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an onboarding profile.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (!$user->canManageOnboarding()) {
|
||||||
|
return redirect()->route('dashboard')->with('error', 'Access denied.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$onboarding = Onboarding::findOrFail($id);
|
||||||
|
$onboarding->delete();
|
||||||
|
|
||||||
|
return redirect()->route('onboarding.index')->with('success', 'Onboarding record removed successfully.');
|
||||||
|
}
|
||||||
|
}
|
||||||
53
app/Models/Onboarding.php
Normal file
53
app/Models/Onboarding.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Onboarding extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'name',
|
||||||
|
'email',
|
||||||
|
'type',
|
||||||
|
'status',
|
||||||
|
'join_date',
|
||||||
|
'exit_date',
|
||||||
|
'department',
|
||||||
|
'assigned_roles',
|
||||||
|
'assigned_apps',
|
||||||
|
'checklist',
|
||||||
|
'notes',
|
||||||
|
'created_by',
|
||||||
|
'offboarded_by',
|
||||||
|
'offboarded_at',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'join_date' => 'date',
|
||||||
|
'exit_date' => 'date',
|
||||||
|
'offboarded_at' => 'datetime',
|
||||||
|
'assigned_roles' => 'array',
|
||||||
|
'assigned_apps' => 'array',
|
||||||
|
'checklist' => 'array',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function creator()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'created_by');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offboarder()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'offboarded_by');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,13 +4,21 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
||||||
|
|
||||||
#[Fillable(['name', 'description'])]
|
|
||||||
class Role extends Model
|
class Role extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'description',
|
||||||
|
'can_manage_onboarding',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'can_manage_onboarding' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the users assigned to this role.
|
* Get the users assigned to this role.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -122,6 +122,32 @@ public function authorizedApps()
|
|||||||
return App::whereIn('id', $finalAppIds)->orderBy('name', 'asc')->get();
|
return App::whereIn('id', $finalAppIds)->orderBy('name', 'asc')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if user is authorized to manage Onboarding & Offboarding.
|
||||||
|
*/
|
||||||
|
public function canManageOnboarding(): bool
|
||||||
|
{
|
||||||
|
// 1. Module must be enabled in system settings
|
||||||
|
if (\App\Models\Setting::get('onboarding_enabled', '1') !== '1') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Admins always have access
|
||||||
|
if ($this->isAdmin()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. User with 'hr' role or any role having can_manage_onboarding = true
|
||||||
|
if (strtolower($this->role) === 'hr') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->roles()->where(function ($q) {
|
||||||
|
$q->whereRaw('LOWER(name) LIKE ?', ['%hr%'])
|
||||||
|
->orWhere('can_manage_onboarding', true);
|
||||||
|
})->exists();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the attributes that should be cast.
|
* Get the attributes that should be cast.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('onboardings', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('user_id')->nullable()->constrained('users')->onDelete('set null');
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('email');
|
||||||
|
$table->string('type')->default('intern'); // intern, candidate, employee
|
||||||
|
$table->string('status')->default('preboarding'); // preboarding, active, offboarding, offboarded
|
||||||
|
$table->date('join_date')->nullable();
|
||||||
|
$table->date('exit_date')->nullable();
|
||||||
|
$table->string('department')->nullable();
|
||||||
|
$table->json('assigned_roles')->nullable();
|
||||||
|
$table->json('assigned_apps')->nullable();
|
||||||
|
$table->json('checklist')->nullable();
|
||||||
|
$table->text('notes')->nullable();
|
||||||
|
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
|
||||||
|
$table->foreignId('offboarded_by')->nullable()->constrained('users')->onDelete('set null');
|
||||||
|
$table->timestamp('offboarded_at')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('onboardings');
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
|
$table->boolean('can_manage_onboarding')->default(false)->after('description');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('can_manage_onboarding');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
BIN
public/Screenshot_12.png
Normal file
BIN
public/Screenshot_12.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 168 KiB |
BIN
public/Screenshot_33.png
Normal file
BIN
public/Screenshot_33.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
@ -280,6 +280,7 @@
|
|||||||
gap: 30px;
|
gap: 30px;
|
||||||
margin-bottom: 50px;
|
margin-bottom: 50px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
align-items: start;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -812,6 +813,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="nav-actions">
|
<div class="nav-actions">
|
||||||
<!-- Allow Admin to view the User portal dashboard -->
|
<!-- Allow Admin to view the User portal dashboard -->
|
||||||
|
<a href="{{ route('onboarding.index') }}" class="btn-nav" style="border-color: #818cf8; color: #818cf8; text-decoration: none;">
|
||||||
|
🚀 Onboarding Hub
|
||||||
|
</a>
|
||||||
<a href="{{ route('dashboard') }}" class="btn-nav">
|
<a href="{{ route('dashboard') }}" class="btn-nav">
|
||||||
User Dashboard
|
User Dashboard
|
||||||
</a>
|
</a>
|
||||||
@ -1087,7 +1091,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Registered Apps List -->
|
<!-- Registered Apps List -->
|
||||||
<div class="table-responsive" style="max-height: 480px; overflow-y: auto;">
|
<div class="table-responsive" style="max-height: 380px; overflow-y: auto;">
|
||||||
<table class="users-table" style="font-size:0.8rem;">
|
<table class="users-table" style="font-size:0.8rem;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -1149,7 +1153,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Default Role Configuration Form (compact inline) -->
|
<!-- Default Role Configuration Form (compact inline) -->
|
||||||
<form action="{{ route('admin.settings.default-role') }}" method="POST" style="margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);">
|
<form action="{{ route('admin.settings.default-role') }}" method="POST" style="margin-bottom: 16px; padding-bottom: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);">
|
||||||
@csrf
|
@csrf
|
||||||
<div style="margin-bottom: 0;">
|
<div style="margin-bottom: 0;">
|
||||||
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Default Role for New Users</label>
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Default Role for New Users</label>
|
||||||
@ -1166,8 +1170,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<!-- Onboarding & Offboarding Module Master Toggle -->
|
||||||
|
<form action="{{ route('admin.settings.onboarding-toggle') }}" method="POST" style="margin-bottom: 20px; padding: 12px 14px; background: rgba(99, 102, 241, 0.08); border: 1px solid rgba(99, 102, 241, 0.25); border-radius: 12px;">
|
||||||
|
@csrf
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
|
<div>
|
||||||
|
<div style="font-size: 0.8rem; color: #ffffff; font-weight: 600;">🚀 Onboarding & Offboarding Module</div>
|
||||||
|
<div style="font-size: 0.7rem; color: var(--text-muted);">Enable/disable candidate provisioning & 1-click revocation</div>
|
||||||
|
</div>
|
||||||
|
<label style="display: inline-flex; align-items: center; gap: 6px; cursor: pointer;">
|
||||||
|
<input type="checkbox" name="onboarding_enabled" value="1" onchange="this.form.submit()" {{ \App\Models\Setting::get('onboarding_enabled', '1') === '1' ? 'checked' : '' }} style="accent-color: #10b981; width: 18px; height: 18px;">
|
||||||
|
<span style="font-size: 0.75rem; font-weight: 700; color: {{ \App\Models\Setting::get('onboarding_enabled', '1') === '1' ? '#34d399' : '#fca5a5' }};">
|
||||||
|
{{ \App\Models\Setting::get('onboarding_enabled', '1') === '1' ? 'ENABLED' : 'DISABLED' }}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<!-- Registered Roles List -->
|
<!-- Registered Roles List -->
|
||||||
<div class="table-responsive" style="max-height: 480px; overflow-y: auto;">
|
<div class="table-responsive" style="max-height: 380px; overflow-y: auto;">
|
||||||
<table class="users-table" style="font-size:0.8rem;">
|
<table class="users-table" style="font-size:0.8rem;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -1198,7 +1219,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td style="text-align: right; white-space: nowrap;">
|
<td style="text-align: right; white-space: nowrap;">
|
||||||
<div style="display: inline-flex; gap: 6px; justify-content: flex-end; align-items: center;">
|
<div style="display: inline-flex; gap: 6px; justify-content: flex-end; align-items: center;">
|
||||||
<button class="action-btn action-btn-edit" onclick="openEditRoleModal({{ $role->id }}, '{{ addslashes($role->name) }}', '{{ addslashes($role->description) }}', {{ json_encode($role->apps->pluck('id')) }})" title="Edit Role">
|
<button class="action-btn action-btn-edit" onclick="openEditRoleModal({{ $role->id }}, '{{ addslashes($role->name) }}', '{{ addslashes($role->description) }}', {{ json_encode($role->apps->pluck('id')) }}, {{ $role->can_manage_onboarding ? 'true' : 'false' }})" title="Edit Role">
|
||||||
<svg viewBox="0 0 24 24" style="width: 14px; height: 14px; fill: currentColor;">
|
<svg viewBox="0 0 24 24" style="width: 14px; height: 14px; fill: currentColor;">
|
||||||
<path d="M14.06,9L15,9.94L5.92,19H5V18.06L14.06,9M17.66,3C17.41,3 17.15,3.1 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18.17,3.09 17.92,3 17.66,3M14.06,6.19L3,17.25V21H6.75L17.81,9.94L14.06,6.19Z" />
|
<path d="M14.06,9L15,9.94L5.92,19H5V18.06L14.06,9M17.66,3C17.41,3 17.15,3.1 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18.17,3.09 17.92,3 17.66,3M14.06,6.19L3,17.25V21H6.75L17.81,9.94L14.06,6.19Z" />
|
||||||
</svg>
|
</svg>
|
||||||
@ -1299,7 +1320,7 @@
|
|||||||
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Role Description</label>
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Role Description</label>
|
||||||
<input type="text" name="description" placeholder="Description of this role..." class="form-input" style="width:100%; padding:10px; background:rgba(255,255,255,0.03); border:1px solid var(--card-border); border-radius:8px; color:white;">
|
<input type="text" name="description" placeholder="Description of this role..." class="form-input" style="width:100%; padding:10px; background:rgba(255,255,255,0.03); border:1px solid var(--card-border); border-radius:8px; color:white;">
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom: 20px;">
|
<div style="margin-bottom: 16px;">
|
||||||
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Assign Services Access</label>
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Assign Services Access</label>
|
||||||
<select name="apps[]" id="create-role-apps-select" multiple="multiple" class="form-input select2-multiple" style="width: 100%;">
|
<select name="apps[]" id="create-role-apps-select" multiple="multiple" class="form-input select2-multiple" style="width: 100%;">
|
||||||
@foreach($apps as $app)
|
@foreach($apps as $app)
|
||||||
@ -1307,6 +1328,12 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="margin-bottom: 20px; background: rgba(99,102,241,0.08); padding: 10px 14px; border-radius: 8px; border: 1px solid rgba(99,102,241,0.25);">
|
||||||
|
<label style="display:flex; align-items:center; gap:8px; font-size:0.75rem; color:white; cursor:pointer; font-weight:600;">
|
||||||
|
<input type="checkbox" name="can_manage_onboarding" value="1" style="accent-color:#6366f1; width:16px; height:16px;">
|
||||||
|
🚀 Grant Permission: Manage Onboarding & Offboarding
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn-cancel" onclick="closeModal('create-role-modal')">Cancel</button>
|
<button type="button" class="btn-cancel" onclick="closeModal('create-role-modal')">Cancel</button>
|
||||||
<button type="submit" class="action-btn" style="background-color: var(--accent-primary); color: white; border-color: transparent; font-weight:600; padding:8px 16px; border-radius:8px; cursor:pointer;">+ Create Role</button>
|
<button type="submit" class="action-btn" style="background-color: var(--accent-primary); color: white; border-color: transparent; font-weight:600; padding:8px 16px; border-radius:8px; cursor:pointer;">+ Create Role</button>
|
||||||
@ -1381,7 +1408,7 @@
|
|||||||
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Description</label>
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Description</label>
|
||||||
<input type="text" id="edit-role-description" name="description" class="form-input" style="width:100%; padding:10px; background:rgba(255,255,255,0.03); border:1px solid var(--card-border); border-radius:8px; color:white;">
|
<input type="text" id="edit-role-description" name="description" class="form-input" style="width:100%; padding:10px; background:rgba(255,255,255,0.03); border:1px solid var(--card-border); border-radius:8px; color:white;">
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom: 20px;">
|
<div style="margin-bottom: 16px;">
|
||||||
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Services Access</label>
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Services Access</label>
|
||||||
<select name="apps[]" id="edit-role-apps-select" multiple="multiple" class="form-input select2-multiple" style="width: 100%;">
|
<select name="apps[]" id="edit-role-apps-select" multiple="multiple" class="form-input select2-multiple" style="width: 100%;">
|
||||||
@foreach($apps as $app)
|
@foreach($apps as $app)
|
||||||
@ -1389,6 +1416,12 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="margin-bottom: 20px; background: rgba(99,102,241,0.08); padding: 10px 14px; border-radius: 8px; border: 1px solid rgba(99,102,241,0.25);">
|
||||||
|
<label style="display:flex; align-items:center; gap:8px; font-size:0.75rem; color:white; cursor:pointer; font-weight:600;">
|
||||||
|
<input type="checkbox" name="can_manage_onboarding" id="edit-role-onboarding" value="1" style="accent-color:#6366f1; width:16px; height:16px;">
|
||||||
|
🚀 Grant Permission: Manage Onboarding & Offboarding
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn-cancel" onclick="closeModal('edit-role-modal')">Cancel</button>
|
<button type="button" class="btn-cancel" onclick="closeModal('edit-role-modal')">Cancel</button>
|
||||||
<button type="submit" class="action-btn" style="background-color:var(--accent-primary); color:white; border-color:transparent; font-weight:600; padding:8px 16px; border-radius:8px; cursor:pointer;">Save Changes</button>
|
<button type="submit" class="action-btn" style="background-color:var(--accent-primary); color:white; border-color:transparent; font-weight:600; padding:8px 16px; border-radius:8px; cursor:pointer;">Save Changes</button>
|
||||||
@ -1535,12 +1568,14 @@ function closeModal(modalId) {
|
|||||||
document.getElementById(modalId).classList.remove('active');
|
document.getElementById(modalId).classList.remove('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
function openEditRoleModal(id, name, description, appIds) {
|
function openEditRoleModal(id, name, description, appIds, canManageOnboarding) {
|
||||||
const form = document.getElementById('edit-role-form');
|
const form = document.getElementById('edit-role-form');
|
||||||
form.action = "{{ route('admin.roles.update', ':id') }}".replace(':id', id);
|
form.action = "{{ route('admin.roles.update', ':id') }}".replace(':id', id);
|
||||||
|
|
||||||
document.getElementById('edit-role-name').value = name;
|
document.getElementById('edit-role-name').value = name;
|
||||||
document.getElementById('edit-role-description').value = description || '';
|
document.getElementById('edit-role-description').value = description || '';
|
||||||
|
const onbCheckbox = document.getElementById('edit-role-onboarding');
|
||||||
|
if (onbCheckbox) onbCheckbox.checked = !!canManageOnboarding;
|
||||||
|
|
||||||
// Set select values and trigger Select2 update
|
// Set select values and trigger Select2 update
|
||||||
$('#edit-role-apps-select').val(appIds).trigger('change');
|
$('#edit-role-apps-select').val(appIds).trigger('change');
|
||||||
|
|||||||
@ -873,6 +873,12 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@if($user->canManageOnboarding())
|
||||||
|
<a href="{{ route('onboarding.index') }}" class="nav-action-btn" style="background: rgba(99,102,241,0.15); color: #818cf8; border-color: rgba(99,102,241,0.3); text-decoration: none;" title="Onboarding & Offboarding Hub">
|
||||||
|
🚀 Onboarding Hub
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if($user->role === 'admin')
|
@if($user->role === 'admin')
|
||||||
<a href="{{ route('admin.dashboard') }}" class="nav-action-btn admin" title="Admin Panel">
|
<a href="{{ route('admin.dashboard') }}" class="nav-action-btn admin" title="Admin Panel">
|
||||||
Go to Admin Dashboard
|
Go to Admin Dashboard
|
||||||
|
|||||||
771
resources/views/onboarding/index.blade.php
Normal file
771
resources/views/onboarding/index.blade.php
Normal file
@ -0,0 +1,771 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Onboarding & Offboarding Portal | SingleLogin</title>
|
||||||
|
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- jQuery & Select2 CDN -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--bg-color: #0b0f19;
|
||||||
|
--card-bg: rgba(15, 23, 42, 0.65);
|
||||||
|
--card-border: rgba(255, 255, 255, 0.22);
|
||||||
|
--accent-primary: #6366f1;
|
||||||
|
--accent-secondary: #0078d4;
|
||||||
|
--text-main: #ffffff;
|
||||||
|
--text-muted: #d1d5db;
|
||||||
|
--success-color: #10b981;
|
||||||
|
--error-color: #ef4444;
|
||||||
|
--info-color: #06b6d4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modern Custom Scrollbars */
|
||||||
|
html, body, *, ::-webkit-scrollbar {
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: rgba(255, 255, 255, 0.4) rgba(15, 23, 42, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background: rgba(15, 23, 42, 0.35);
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background: rgba(255, 255, 255, 0.4);
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.85);
|
||||||
|
box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Instrument Sans', sans-serif;
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
color: var(--text-main);
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow-x: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ambient Glowing Background Effects */
|
||||||
|
body::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: -10%;
|
||||||
|
left: -10%;
|
||||||
|
width: 50%;
|
||||||
|
height: 50%;
|
||||||
|
background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
|
||||||
|
z-index: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
bottom: -10%;
|
||||||
|
right: -10%;
|
||||||
|
width: 50%;
|
||||||
|
height: 50%;
|
||||||
|
background: radial-gradient(circle, rgba(0, 120, 212, 0.15) 0%, rgba(0,0,0,0) 70%);
|
||||||
|
z-index: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Navbar Header */
|
||||||
|
.navbar {
|
||||||
|
height: 70px;
|
||||||
|
background: rgba(15, 23, 42, 0.8);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
-webkit-backdrop-filter: blur(16px);
|
||||||
|
border-bottom: 1px solid var(--card-border);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 4%;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-logo {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
font-family: 'Outfit', sans-serif;
|
||||||
|
font-size: 1.15rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-nav {
|
||||||
|
color: #e5e7eb;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
|
transition: all 0.25s ease;
|
||||||
|
background: rgba(255, 255, 255, 0.03);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-nav:hover {
|
||||||
|
color: var(--text-main);
|
||||||
|
border-color: rgba(255, 255, 255, 0.3);
|
||||||
|
background-color: rgba(255, 255, 255, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stats Cards */
|
||||||
|
.ob-stat-card {
|
||||||
|
background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%);
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
box-shadow: 0 8px 32px rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ob-tab-btn {
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--text-muted);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ob-tab-btn.active {
|
||||||
|
background: var(--accent-primary);
|
||||||
|
color: white;
|
||||||
|
border-color: var(--accent-primary);
|
||||||
|
box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ob-card {
|
||||||
|
background: var(--card-bg);
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 28px;
|
||||||
|
backdrop-filter: blur(20px);
|
||||||
|
-webkit-backdrop-filter: blur(20px);
|
||||||
|
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Table Styling */
|
||||||
|
.table-responsive {
|
||||||
|
overflow-x: auto;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.users-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.users-table th {
|
||||||
|
padding: 12px 16px;
|
||||||
|
border-bottom: 1px solid var(--card-border);
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.users-table td {
|
||||||
|
padding: 14px 16px;
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.users-table tr:last-child td {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 9999px;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-btn {
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
|
background: rgba(255,255,255,0.05);
|
||||||
|
color: white;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-btn:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-btn-delete {
|
||||||
|
color: #ef4444;
|
||||||
|
border-color: rgba(239, 68, 68, 0.3);
|
||||||
|
background: rgba(239, 68, 68, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-btn-delete:hover {
|
||||||
|
background: rgba(239, 68, 68, 0.25);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checklist-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--text-muted);
|
||||||
|
margin-bottom: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checklist-item input[type="checkbox"] {
|
||||||
|
accent-color: #10b981;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal Backdrop & Overlay */
|
||||||
|
.admin-modal {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: rgba(11, 15, 25, 0.85);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 1000;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-modal.active {
|
||||||
|
opacity: 1;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-modal-content {
|
||||||
|
background-color: #151b2c;
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
|
border-radius: 20px;
|
||||||
|
width: 90%;
|
||||||
|
max-width: 550px;
|
||||||
|
padding: 28px;
|
||||||
|
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
|
||||||
|
transform: scale(0.95);
|
||||||
|
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-modal.active .admin-modal-content {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-title {
|
||||||
|
font-family: 'Outfit', sans-serif;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: 1.5rem;
|
||||||
|
cursor: pointer;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close:hover {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 12px;
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
|
border-radius: 8px;
|
||||||
|
color: white;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
outline: none;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input:focus {
|
||||||
|
border-color: var(--accent-primary);
|
||||||
|
box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel {
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: transparent;
|
||||||
|
border: 1px solid var(--card-border);
|
||||||
|
color: var(--text-muted);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel:hover {
|
||||||
|
color: white;
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- Top Navbar -->
|
||||||
|
<header class="navbar">
|
||||||
|
<div class="nav-logo">
|
||||||
|
<div style="width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #6366f1 0%, #0078d4 100%); display: flex; align-items: center; justify-content: center;">
|
||||||
|
<svg viewBox="0 0 24 24" style="width: 20px; height: 20px; fill: white;">
|
||||||
|
<path d="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4M11,7V11H7V13H11V17H13V13H17V11H13V7H11Z"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>Onboarding & Offboarding Hub</div>
|
||||||
|
<div style="font-size: 0.7rem; color: var(--text-muted); font-weight: 400;">Candidate Provisioning & Access Revocation</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="nav-actions">
|
||||||
|
@if(Auth::user()->isAdmin())
|
||||||
|
<a href="{{ route('admin.dashboard') }}" class="btn-nav" style="border-color: #818cf8; color: #818cf8;">Control Panel</a>
|
||||||
|
@endif
|
||||||
|
<a href="{{ route('dashboard') }}" class="btn-nav">User Portal</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main style="max-width: 1400px; width: 100%; margin: 30px auto; padding: 0 4%; flex: 1; z-index: 10;">
|
||||||
|
@if(session('success'))
|
||||||
|
<div style="margin-bottom: 24px; background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #34d399; padding: 12px 20px; border-radius: 12px; font-size: 0.9rem;">
|
||||||
|
{{ session('success') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@if(session('error'))
|
||||||
|
<div style="margin-bottom: 24px; background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; padding: 12px 20px; border-radius: 12px; font-size: 0.9rem;">
|
||||||
|
{{ session('error') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<!-- Stats Grid -->
|
||||||
|
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 30px;">
|
||||||
|
<div class="ob-stat-card">
|
||||||
|
<div style="width: 44px; height: 44px; border-radius: 12px; background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3); display: flex; align-items: center; justify-content: center; color: #818cf8; font-weight: 700; font-size: 1.1rem;">
|
||||||
|
{{ $stats['preboarding_count'] }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div style="font-size: 0.75rem; color: var(--text-muted);">Preboarding Candidates</div>
|
||||||
|
<div style="font-size: 1.05rem; font-weight: 700; color: white;">Pending Day-1</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ob-stat-card">
|
||||||
|
<div style="width: 44px; height: 44px; border-radius: 12px; background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); display: flex; align-items: center; justify-content: center; color: #34d399; font-weight: 700; font-size: 1.1rem;">
|
||||||
|
{{ $stats['active_interns_count'] }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div style="font-size: 0.75rem; color: var(--text-muted);">Active Interns</div>
|
||||||
|
<div style="font-size: 1.05rem; font-weight: 700; color: white;">SSO Provisioned</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ob-stat-card">
|
||||||
|
<div style="width: 44px; height: 44px; border-radius: 12px; background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); display: flex; align-items: center; justify-content: center; color: #fca5a5; font-weight: 700; font-size: 1.1rem;">
|
||||||
|
{{ $stats['offboarded_count'] }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div style="font-size: 0.75rem; color: var(--text-muted);">Offboarded History</div>
|
||||||
|
<div style="font-size: 1.05rem; font-weight: 700; color: white;">Access Revoked</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ob-stat-card">
|
||||||
|
<div style="width: 44px; height: 44px; border-radius: 12px; background: rgba(6,182,212,0.15); border: 1px solid rgba(6,182,212,0.3); display: flex; align-items: center; justify-content: center; color: #22d3ee; font-weight: 700; font-size: 1.1rem;">
|
||||||
|
{{ $stats['total_managed'] }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div style="font-size: 0.75rem; color: var(--text-muted);">Total Lifecycle Profiles</div>
|
||||||
|
<div style="font-size: 1.05rem; font-weight: 700; color: white;">Managed</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Navigation Tabs & Primary Action -->
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 16px;">
|
||||||
|
<div style="display: flex; gap: 8px; background: rgba(255,255,255,0.03); padding: 4px; border-radius: 12px; border: 1px solid var(--card-border);">
|
||||||
|
<button class="ob-tab-btn active" onclick="switchObTab('tab-onboarding', this)">
|
||||||
|
🚀 Onboarding Candidates & Interns
|
||||||
|
</button>
|
||||||
|
<button class="ob-tab-btn" onclick="switchObTab('tab-offboarding', this)">
|
||||||
|
🛡️ 1-Click Offboarding & Revocation
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button onclick="document.getElementById('add-candidate-modal').classList.add('active')" class="btn-nav" style="background-color: var(--accent-primary); color: white; border-color: var(--accent-primary); font-weight: 600; padding: 10px 18px; cursor: pointer;">
|
||||||
|
+ Add Onboarding Candidate / Intern
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TAB 1: ONBOARDING CANDIDATES & INTERNS -->
|
||||||
|
<div id="tab-onboarding" class="ob-card">
|
||||||
|
<h3 style="font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 700; color: white; margin-top: 0; margin-bottom: 16px;">
|
||||||
|
Active Candidate & Intern Onboarding Pipeline
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="users-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Candidate / Intern</th>
|
||||||
|
<th>Type & Department</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Pre-Approved Services</th>
|
||||||
|
<th>Onboarding Checklist</th>
|
||||||
|
<th style="text-align: right;">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@forelse($onboardings->where('status', '!=', 'offboarded') as $ob)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<strong style="color: white; font-size: 0.9rem;">{{ $ob->name }}</strong>
|
||||||
|
<div style="font-size: 0.75rem; color: var(--text-muted);">{{ $ob->email }}</div>
|
||||||
|
@if($ob->join_date)
|
||||||
|
<div style="font-size: 0.7rem; color: #38bdf8; margin-top: 2px;">Join Date: {{ $ob->join_date->format('Y-m-d') }}</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="badge" style="background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.3); text-transform: uppercase;">
|
||||||
|
{{ $ob->type }}
|
||||||
|
</span>
|
||||||
|
<div style="font-size: 0.75rem; color: var(--text-muted); margin-top: 4px;">{{ $ob->department ?? 'General' }}</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@if($ob->status === 'active')
|
||||||
|
<span class="badge" style="background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3);">
|
||||||
|
Active Day-1
|
||||||
|
</span>
|
||||||
|
@else
|
||||||
|
<span class="badge" style="background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3);">
|
||||||
|
Preboarding
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div style="display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px;">
|
||||||
|
@if(!empty($ob->assigned_apps))
|
||||||
|
@foreach($apps->whereIn('id', $ob->assigned_apps) as $a)
|
||||||
|
<span class="badge" style="background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.15); font-size: 0.65rem;">
|
||||||
|
{{ $a->name }}
|
||||||
|
</span>
|
||||||
|
@endforeach
|
||||||
|
@else
|
||||||
|
<span style="font-size: 0.75rem; color: var(--text-muted);">Default Roles</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@php $chk = $ob->checklist ?? []; @endphp
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 2px;">
|
||||||
|
<label class="checklist-item">
|
||||||
|
<input type="checkbox" onchange="toggleChecklist({{ $ob->id }}, 'document_verified', this.checked)" {{ !empty($chk['document_verified']) ? 'checked' : '' }}>
|
||||||
|
Document Verified
|
||||||
|
</label>
|
||||||
|
<label class="checklist-item">
|
||||||
|
<input type="checkbox" onchange="toggleChecklist({{ $ob->id }}, 'email_created', this.checked)" {{ !empty($chk['email_created']) ? 'checked' : '' }}>
|
||||||
|
Email Account Set
|
||||||
|
</label>
|
||||||
|
<label class="checklist-item">
|
||||||
|
<input type="checkbox" onchange="toggleChecklist({{ $ob->id }}, 'sso_bundle_granted', this.checked)" {{ !empty($chk['sso_bundle_granted']) ? 'checked' : '' }}>
|
||||||
|
SSO Granted
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td style="text-align: right; white-space: nowrap;">
|
||||||
|
@if($ob->status !== 'active')
|
||||||
|
<form action="{{ route('onboarding.activate', $ob->id) }}" method="POST" style="display: inline;">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="action-btn" style="color: #10b981; border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.08); margin-right: 4px;">
|
||||||
|
Activate & Provision SSO
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<form action="{{ route('onboarding.destroy', $ob->id) }}" method="POST" onsubmit="return confirm('Remove onboarding profile?')" style="display: inline;">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="action-btn action-btn-delete">Delete</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" style="text-align: center; color: var(--text-muted); padding: 30px;">
|
||||||
|
No active onboarding candidates or interns. Click "+ Add Onboarding Candidate" above to create one.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TAB 2: 1-CLICK OFFBOARDING & REVOCATION -->
|
||||||
|
<div id="tab-offboarding" class="ob-card" style="display: none;">
|
||||||
|
<h3 style="font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 700; color: white; margin-top: 0; margin-bottom: 16px;">
|
||||||
|
1-Click Offboarding & Instant Access Revocation
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 24px; background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); border-radius: 14px; padding: 16px; font-size: 0.8rem; color: #fca5a5;">
|
||||||
|
<strong>🛡️ Offboarding Protocol:</strong> Clicking "1-Click Offboard" instantly blocks the user account, terminates Microsoft OAuth sessions, and revokes all active SSO service apps.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 style="font-size: 0.95rem; color: white; margin-bottom: 12px;">Active System Users (Initiate Exit)</h4>
|
||||||
|
<div class="table-responsive" style="margin-bottom: 30px;">
|
||||||
|
<table class="users-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>User Account</th>
|
||||||
|
<th>Assigned Roles</th>
|
||||||
|
<th>Account Status</th>
|
||||||
|
<th style="text-align: right;">Offboarding Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($activeUsers as $u)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<strong style="color: white;">{{ $u->name }}</strong>
|
||||||
|
<div style="font-size: 0.75rem; color: var(--text-muted);">{{ $u->email }}</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div style="display: flex; flex-wrap: wrap; gap: 4px;">
|
||||||
|
@foreach($u->roles as $r)
|
||||||
|
<span class="badge" style="background: rgba(99,102,241,0.1); color: #818cf8; font-size: 0.65rem;">{{ $r->name }}</span>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@if($u->is_blocked)
|
||||||
|
<span class="badge" style="background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3);">Blocked / Offboarded</span>
|
||||||
|
@else
|
||||||
|
<span class="badge" style="background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.25);">Active Access</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td style="text-align: right;">
|
||||||
|
@if(!$u->is_blocked)
|
||||||
|
<form action="{{ route('onboarding.offboard', $u->id) }}" method="POST" onsubmit="return confirm('WARNING: Are you sure you want to 1-Click Offboard {{ addslashes($u->name) }}? This will instantly block their account and terminate all SSO service access.')" style="display: inline;">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="action-btn action-btn-delete" style="font-weight: 700; padding: 6px 14px;">
|
||||||
|
🛡️ 1-Click Offboard & Revoke
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
<span style="font-size: 0.75rem; color: var(--text-muted);">Account Already Revoked</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 style="font-size: 0.95rem; color: white; margin-bottom: 12px;">Offboarded Audit Log & Compliance History</h4>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="users-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Offboarded Entity</th>
|
||||||
|
<th>Exit Timestamp</th>
|
||||||
|
<th>Authorized By</th>
|
||||||
|
<th>Revocation Status</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@forelse($onboardings->where('status', 'offboarded') as $off)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<strong style="color: white;">{{ $off->name }}</strong>
|
||||||
|
<div style="font-size: 0.7rem; color: var(--text-muted);">{{ $off->email }}</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span style="color: var(--text-muted);">{{ $off->offboarded_at ? $off->offboarded_at->format('Y-m-d H:i') : 'N/A' }}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span style="color: #38bdf8;">{{ $off->offboarder->name ?? 'Admin / HR System' }}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="badge" style="background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3);">
|
||||||
|
Account Blocked & SSO Access Terminated
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="4" style="text-align: center; color: var(--text-muted); padding: 20px;">
|
||||||
|
No offboarding records in audit log.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- Modal: Add Candidate / Intern -->
|
||||||
|
<div id="add-candidate-modal" class="admin-modal">
|
||||||
|
<div class="admin-modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-title">Onboard New Candidate / Intern</h3>
|
||||||
|
<button class="modal-close" onclick="document.getElementById('add-candidate-modal').classList.remove('active')">×</button>
|
||||||
|
</div>
|
||||||
|
<form action="{{ route('onboarding.store') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px;">
|
||||||
|
<div>
|
||||||
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:4px; font-weight:500;">Full Name <span style="color:#ef4444;">*</span></label>
|
||||||
|
<input type="text" name="name" required placeholder="e.g. Alex Morgan" class="form-input">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:4px; font-weight:500;">Email Address <span style="color:#ef4444;">*</span></label>
|
||||||
|
<input type="email" name="email" required placeholder="alex@company.com" class="form-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px;">
|
||||||
|
<div>
|
||||||
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:4px; font-weight:500;">Position Type <span style="color:#ef4444;">*</span></label>
|
||||||
|
<select name="type" required class="form-input" style="background: #151b2c;">
|
||||||
|
<option value="intern">Intern</option>
|
||||||
|
<option value="candidate">Candidate</option>
|
||||||
|
<option value="employee">Full-time Employee</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:4px; font-weight:500;">Department</label>
|
||||||
|
<input type="text" name="department" placeholder="e.g. Engineering, HR" class="form-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 14px;">
|
||||||
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:4px; font-weight:500;">Target Join Date</label>
|
||||||
|
<input type="date" name="join_date" class="form-input" style="color-scheme: dark;">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 14px;">
|
||||||
|
<label style="display:block; font-size:0.75rem; color:var(--text-muted); margin-bottom:6px; font-weight:500;">Pre-Approved Services Access (SSO Bundle)</label>
|
||||||
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 140px; overflow-y: auto; background: rgba(0,0,0,0.3); padding: 12px; border-radius: 8px; border: 1px solid var(--card-border);">
|
||||||
|
@foreach($apps as $app)
|
||||||
|
<label style="display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: white; cursor: pointer;">
|
||||||
|
<input type="checkbox" name="assigned_apps[]" value="{{ $app->id }}" style="accent-color: #6366f1; width: 14px; height: 14px;">
|
||||||
|
{{ $app->name }}
|
||||||
|
</label>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn-cancel" onclick="document.getElementById('add-candidate-modal').classList.remove('active')">Cancel</button>
|
||||||
|
<button type="submit" class="btn-nav" style="background-color: var(--accent-primary); color: white; border-color: transparent; font-weight: 600;">Create Profile</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function switchObTab(tabId, btn) {
|
||||||
|
document.querySelectorAll('.ob-card').forEach(c => c.style.display = 'none');
|
||||||
|
document.querySelectorAll('.ob-tab-btn').forEach(b => b.classList.remove('active'));
|
||||||
|
|
||||||
|
document.getElementById(tabId).style.display = 'block';
|
||||||
|
btn.classList.add('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleChecklist(id, key, val) {
|
||||||
|
fetch(`{{ route('onboarding.checklist', ':id') }}`.replace(':id', id), {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ key: key, val: val })
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -3,6 +3,7 @@
|
|||||||
use App\Http\Controllers\AdminController;
|
use App\Http\Controllers\AdminController;
|
||||||
use App\Http\Controllers\DashboardController;
|
use App\Http\Controllers\DashboardController;
|
||||||
use App\Http\Controllers\LoginController;
|
use App\Http\Controllers\LoginController;
|
||||||
|
use App\Http\Controllers\OnboardingController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
// Authentication & Portal landing
|
// Authentication & Portal landing
|
||||||
@ -37,6 +38,14 @@
|
|||||||
Route::post('/dashboard/personal-apps', [DashboardController::class, 'storePersonalApp'])->name('dashboard.personal-apps.store');
|
Route::post('/dashboard/personal-apps', [DashboardController::class, 'storePersonalApp'])->name('dashboard.personal-apps.store');
|
||||||
Route::post('/dashboard/personal-apps/{id}/update', [DashboardController::class, 'updatePersonalApp'])->name('dashboard.personal-apps.update');
|
Route::post('/dashboard/personal-apps/{id}/update', [DashboardController::class, 'updatePersonalApp'])->name('dashboard.personal-apps.update');
|
||||||
Route::delete('/dashboard/personal-apps/{id}', [DashboardController::class, 'destroyPersonalApp'])->name('dashboard.personal-apps.destroy');
|
Route::delete('/dashboard/personal-apps/{id}', [DashboardController::class, 'destroyPersonalApp'])->name('dashboard.personal-apps.destroy');
|
||||||
|
|
||||||
|
// Onboarding & Offboarding Management Routes (accessible by Admin, HR, or authorized roles)
|
||||||
|
Route::get('/onboarding', [OnboardingController::class, 'index'])->name('onboarding.index');
|
||||||
|
Route::post('/onboarding', [OnboardingController::class, 'store'])->name('onboarding.store');
|
||||||
|
Route::post('/onboarding/{id}/activate', [OnboardingController::class, 'activate'])->name('onboarding.activate');
|
||||||
|
Route::post('/onboarding/{id}/offboard', [OnboardingController::class, 'offboard'])->name('onboarding.offboard');
|
||||||
|
Route::post('/onboarding/{id}/checklist', [OnboardingController::class, 'updateChecklist'])->name('onboarding.checklist');
|
||||||
|
Route::delete('/onboarding/{id}', [OnboardingController::class, 'destroy'])->name('onboarding.destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Admin Control Panel (requires admin role)
|
// Admin Control Panel (requires admin role)
|
||||||
@ -54,6 +63,7 @@
|
|||||||
Route::post('/roles/{id}/update', [AdminController::class, 'updateRole'])->name('admin.roles.update');
|
Route::post('/roles/{id}/update', [AdminController::class, 'updateRole'])->name('admin.roles.update');
|
||||||
Route::delete('/roles/{id}', [AdminController::class, 'destroyRole'])->name('admin.roles.destroy');
|
Route::delete('/roles/{id}', [AdminController::class, 'destroyRole'])->name('admin.roles.destroy');
|
||||||
Route::post('/settings/default-role', [AdminController::class, 'updateDefaultRole'])->name('admin.settings.default-role');
|
Route::post('/settings/default-role', [AdminController::class, 'updateDefaultRole'])->name('admin.settings.default-role');
|
||||||
|
Route::post('/settings/onboarding-toggle', [AdminController::class, 'updateOnboardingToggle'])->name('admin.settings.onboarding-toggle');
|
||||||
|
|
||||||
// User Roles & Overrides
|
// User Roles & Overrides
|
||||||
Route::post('/users/{id}/roles', [AdminController::class, 'updateUserRoles'])->name('admin.users.roles.update');
|
Route::post('/users/{id}/roles', [AdminController::class, 'updateUserRoles'])->name('admin.users.roles.update');
|
||||||
|
|||||||
148
tests/Feature/OnboardingAndOffboardingTest.php
Normal file
148
tests/Feature/OnboardingAndOffboardingTest.php
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Models\App;
|
||||||
|
use App\Models\Onboarding;
|
||||||
|
use App\Models\Role;
|
||||||
|
use App\Models\Setting;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class OnboardingAndOffboardingTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->withoutMiddleware();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_admin_can_toggle_onboarding_module_on_and_off(): void
|
||||||
|
{
|
||||||
|
$admin = User::create([
|
||||||
|
'name' => 'Admin User',
|
||||||
|
'email' => 'admin@company.com',
|
||||||
|
'role' => 'admin',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->actingAs($admin)
|
||||||
|
->post(route('admin.settings.onboarding-toggle'), [
|
||||||
|
'onboarding_enabled' => '0',
|
||||||
|
])
|
||||||
|
->assertRedirect(route('admin.dashboard'));
|
||||||
|
|
||||||
|
$this->assertEquals('0', Setting::get('onboarding_enabled'));
|
||||||
|
|
||||||
|
$this->actingAs($admin)
|
||||||
|
->post(route('admin.settings.onboarding-toggle'), [
|
||||||
|
'onboarding_enabled' => '1',
|
||||||
|
])
|
||||||
|
->assertRedirect(route('admin.dashboard'));
|
||||||
|
|
||||||
|
$this->assertEquals('1', Setting::get('onboarding_enabled'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_hr_role_or_authorized_user_can_create_candidate_onboarding(): void
|
||||||
|
{
|
||||||
|
$hrRole = Role::create([
|
||||||
|
'name' => 'HR Manager',
|
||||||
|
'can_manage_onboarding' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$hrUser = User::create([
|
||||||
|
'name' => 'Jane HR',
|
||||||
|
'email' => 'hr@company.com',
|
||||||
|
'role' => 'user',
|
||||||
|
]);
|
||||||
|
$hrUser->roles()->attach($hrRole->id);
|
||||||
|
|
||||||
|
$app = App::create([
|
||||||
|
'name' => 'Convex CRM',
|
||||||
|
'url' => 'https://convexcrm.com',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->actingAs($hrUser)
|
||||||
|
->post(route('onboarding.store'), [
|
||||||
|
'name' => 'Alex Intern',
|
||||||
|
'email' => 'alex.intern@company.com',
|
||||||
|
'type' => 'intern',
|
||||||
|
'department' => 'Engineering',
|
||||||
|
'assigned_apps' => [$app->id],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response->assertRedirect(route('onboarding.index'));
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('onboardings', [
|
||||||
|
'name' => 'Alex Intern',
|
||||||
|
'email' => 'alex.intern@company.com',
|
||||||
|
'type' => 'intern',
|
||||||
|
'status' => 'preboarding',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_day_1_activation_provisions_account_and_sso_access(): void
|
||||||
|
{
|
||||||
|
$admin = User::create([
|
||||||
|
'name' => 'System Admin',
|
||||||
|
'email' => 'sysadmin@company.com',
|
||||||
|
'role' => 'admin',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$app = App::create([
|
||||||
|
'name' => 'GitLab',
|
||||||
|
'url' => 'https://gitlab.com',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$ob = Onboarding::create([
|
||||||
|
'name' => 'David Candidate',
|
||||||
|
'email' => 'david@company.com',
|
||||||
|
'type' => 'candidate',
|
||||||
|
'status' => 'preboarding',
|
||||||
|
'assigned_apps' => [$app->id],
|
||||||
|
'created_by' => $admin->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->actingAs($admin)
|
||||||
|
->post(route('onboarding.activate', $ob->id))
|
||||||
|
->assertRedirect(route('onboarding.index'));
|
||||||
|
|
||||||
|
$ob->refresh();
|
||||||
|
$this->assertEquals('active', $ob->status);
|
||||||
|
$this->assertNotNull($ob->user_id);
|
||||||
|
|
||||||
|
$activatedUser = User::find($ob->user_id);
|
||||||
|
$this->assertEquals('david@company.com', $activatedUser->email);
|
||||||
|
$this->assertTrue($activatedUser->authorizedApps()->pluck('id')->contains($app->id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_1_click_offboarding_blocks_account_and_revokes_access(): void
|
||||||
|
{
|
||||||
|
$admin = User::create([
|
||||||
|
'name' => 'System Admin',
|
||||||
|
'email' => 'sysadmin@company.com',
|
||||||
|
'role' => 'admin',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$employee = User::create([
|
||||||
|
'name' => 'John Leaver',
|
||||||
|
'email' => 'john.leaver@company.com',
|
||||||
|
'role' => 'user',
|
||||||
|
'is_blocked' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->actingAs($admin)
|
||||||
|
->post(route('onboarding.offboard', $employee->id))
|
||||||
|
->assertRedirect(route('onboarding.index'));
|
||||||
|
|
||||||
|
$employee->refresh();
|
||||||
|
$this->assertTrue((bool) $employee->is_blocked);
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('onboardings', [
|
||||||
|
'user_id' => $employee->id,
|
||||||
|
'status' => 'offboarded',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user