feat: Initialize core application structure including authentication, role-based dashboards, service task management, and integration workflows.
This commit is contained in:
50
app/Http/Controllers/OffboardingController.php
Normal file
50
app/Http/Controllers/OffboardingController.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Agent;
|
||||
use App\Models\IntegrationRequest;
|
||||
use App\Models\IntegrationTemplate;
|
||||
use App\Services\IntegrationService;
|
||||
use App\Enums\IntegrationStatus;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class OffboardingController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return Inertia::render('Offboarding/Index', [
|
||||
'active_agents' => Agent::where('integration_status', IntegrationStatus::Completed)->get(),
|
||||
'current_offboardings' => IntegrationRequest::where('type', 'offboarding')
|
||||
->with(['agent', 'template'])
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function create(Agent $agent)
|
||||
{
|
||||
return Inertia::render('Offboarding/Create', [
|
||||
'agent' => $agent,
|
||||
'templates' => IntegrationTemplate::where('is_active', true)->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request, IntegrationService $service)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'agent_id' => 'required|exists:agents,id',
|
||||
'template_id' => 'nullable|exists:integration_templates,id',
|
||||
'departure_date' => 'required|date',
|
||||
]);
|
||||
|
||||
$integration = $service->createProcess([
|
||||
'agent_id' => $validated['agent_id'],
|
||||
'template_id' => $validated['template_id'],
|
||||
'type' => 'offboarding',
|
||||
'departure_date' => $validated['departure_date'],
|
||||
]);
|
||||
|
||||
return redirect()->route('integrations.show', $integration);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user