- Devis: CRUD complet, génération PDF (dompdf), paramètres (DevisSetting) - BesoinInformatique: CRUD complet avec gestion matériels/licences - Migrations pour les 3 nouvelles tables - Navigation mise à jour dans AuthenticatedLayout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
91 lines
3.1 KiB
PHP
91 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\BesoinInformatique;
|
|
use Illuminate\Http\Request;
|
|
|
|
use Inertia\Inertia;
|
|
|
|
class BesoinInformatiqueController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$besoins = BesoinInformatique::latest()->get();
|
|
return Inertia::render('BesoinsInformatiques/Index', [
|
|
'besoins' => $besoins
|
|
]);
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
return Inertia::render('BesoinsInformatiques/Create');
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$validated = $request->validate([
|
|
'collectivite' => 'nullable|string|max:255',
|
|
'nom_referent' => 'nullable|string|max:255',
|
|
'descriptif_projet' => 'nullable|string',
|
|
'materiels_support' => 'nullable|array',
|
|
'licences_bureautique' => 'nullable|array',
|
|
'equipements_reseaux' => 'nullable|string',
|
|
'cablage_reseau' => 'nullable|string',
|
|
'telephonie_ip' => 'nullable|string',
|
|
'nouveau_batiment' => 'nullable|string',
|
|
'logiciels_metiers' => 'nullable|string',
|
|
'licences_projets' => 'nullable|array',
|
|
'date_validation' => 'nullable|date',
|
|
'validation_dgs' => 'nullable|string|max:255',
|
|
]);
|
|
|
|
BesoinInformatique::create($validated);
|
|
|
|
return redirect()->route('besoins-informatiques.index')->with('success', 'Besoin informatique créé avec succès.');
|
|
}
|
|
|
|
public function show(BesoinInformatique $besoinInformatique)
|
|
{
|
|
return Inertia::render('BesoinsInformatiques/Show', [
|
|
'besoin' => $besoinInformatique
|
|
]);
|
|
}
|
|
|
|
public function edit(BesoinInformatique $besoinInformatique)
|
|
{
|
|
return Inertia::render('BesoinsInformatiques/Edit', [
|
|
'besoin' => $besoinInformatique
|
|
]);
|
|
}
|
|
|
|
public function update(Request $request, BesoinInformatique $besoinInformatique)
|
|
{
|
|
$validated = $request->validate([
|
|
'collectivite' => 'nullable|string|max:255',
|
|
'nom_referent' => 'nullable|string|max:255',
|
|
'descriptif_projet' => 'nullable|string',
|
|
'materiels_support' => 'nullable|array',
|
|
'licences_bureautique' => 'nullable|array',
|
|
'equipements_reseaux' => 'nullable|string',
|
|
'cablage_reseau' => 'nullable|string',
|
|
'telephonie_ip' => 'nullable|string',
|
|
'nouveau_batiment' => 'nullable|string',
|
|
'logiciels_metiers' => 'nullable|string',
|
|
'licences_projets' => 'nullable|array',
|
|
'date_validation' => 'nullable|date',
|
|
'validation_dgs' => 'nullable|string|max:255',
|
|
]);
|
|
|
|
$besoinInformatique->update($validated);
|
|
|
|
return redirect()->route('besoins-informatiques.index')->with('success', 'Besoin informatique mis à jour avec succès.');
|
|
}
|
|
|
|
public function destroy(BesoinInformatique $besoinInformatique)
|
|
{
|
|
$besoinInformatique->delete();
|
|
return redirect()->route('besoins-informatiques.index')->with('success', 'Besoin informatique supprimé avec succès.');
|
|
}
|
|
}
|