Premier commit

This commit is contained in:
jeremy bayse
2026-02-09 11:27:21 +01:00
commit 89a369964d
114 changed files with 17837 additions and 0 deletions

424
resources/css/app.scss Normal file
View File

@@ -0,0 +1,424 @@
// 1. Define variables first
$body-bg: #1e2531;
$body-color: #aeb4c6;
$headings-color: #fff;
$card-bg: #2c3344;
$card-color: #aeb4c6;
$card-border-width: 0;
$border-color: #3e485e;
$primary: #727cf5;
$success: #0acf97;
$danger: #fa5c7c;
$warning: #ffbc00;
$info: #39afd1;
// 2. Import Bootstrap
@import 'bootstrap/scss/bootstrap';
@import 'bootstrap-icons/font/bootstrap-icons.css';
// 3. Custom Global Styles
body {
background-color: $body-bg;
color: $body-color;
font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
color: $headings-color;
font-weight: 600;
}
a {
color: $primary;
text-decoration: none;
&:hover {
color: darken($primary, 10%);
}
}
.text-muted {
color: #8391a2 !important;
}
.text-white {
color: #fff !important;
}
.bg-light {
background-color: #313a4e !important;
}
.bg-white {
background-color: $card-bg !important;
}
.border {
border-color: $border-color !important;
}
// 4. Component Overrides
.card {
background-color: $card-bg;
box-shadow: 0 0.2rem 1rem rgba(0, 0, 0, 0.15);
border: none;
margin-bottom: 1.5rem;
.card-header {
background-color: transparent;
border-bottom: 1px solid $border-color;
padding: 1.5rem;
h5 {
margin-bottom: 0;
}
}
.card-body {
padding: 1.5rem;
}
}
.list-group-item {
background-color: transparent;
border-color: $border-color;
color: $body-color;
}
.table {
color: #fff; // Force white text for table content
th {
border-color: $border-color;
color: $headings-color;
font-weight: 600;
background-color: transparent; // Ensure header is transparent
border-bottom-width: 1px;
}
td {
border-color: $border-color;
vertical-align: middle;
color: #fff; // Ensure cells are white
}
// Striped rows
&.table-striped>tbody>tr:nth-of-type(odd)>* {
background-color: rgba(255, 255, 255, 0.02);
color: #fff; // Ensure striped rows are white
box-shadow: none; // Remove potential inset shadows
}
// Hover effect
&:hover tbody tr:hover {
background-color: rgba(255, 255, 255, 0.05);
color: $headings-color;
}
// Table Warning Override for Dark Theme
&.table-hover>tbody>tr.table-warning:hover>* {
background-color: rgba($warning, 0.2);
color: #fff;
}
>tbody>tr.table-warning>* {
background-color: rgba($warning, 0.15); // Slightly more visible yellow bg
color: #ffedb8; // Light yellowish white text for readability
box-shadow: none;
}
// NEW: Table Danger (Orange/Red) Override for Deactivated functionality
// User asked for "Orange background with white text" for deactivated items
// We are using `table-warning` which is yellow/orange.
// Let's customize `table-warning` to look more orange-ish if that's what the user wants,
// OR create a specific override if they mean `table-secondary` was the issue.
// The user moved from `table-secondary` (grey) to `table-warning` (yellow/orange) in the blade file.
// So now we need to make sure `table-warning` looks good (Orange background, white text).
// Let's override table-warning specifically to be orange-ish
$orange-custom: #fd7e14;
>tbody>tr.table-warning>* {
background-color: rgba($orange-custom, 0.2) !important; // Orange-ish background
color: #fff !important; // White text
}
&.table-hover>tbody>tr.table-warning:hover>* {
background-color: rgba($orange-custom, 0.3) !important;
color: #fff !important;
}
}
.form-control,
.form-select {
background-color: #313a4e;
border-color: $border-color;
color: $headings-color;
&:focus {
background-color: #364056;
border-color: $primary;
color: $headings-color;
box-shadow: none;
}
&::placeholder {
color: #6c757d;
}
}
// Badges - Force white text for better contrast in dark mode
.badge {
color: #fff !important; // Force white text on all badges
font-weight: 500;
&.bg-light {
background-color: #3e485e !important;
color: #fff !important;
}
&.bg-info {
background-color: $info !important;
color: #fff !important;
}
&.bg-warning {
background-color: $warning !important;
color: #000 !important;
}
}
.text-bg-warning {
color: #000 !important;
background-color: $warning !important;
}
// FORCE badge overrides
.badge.bg-info {
color: #fff !important;
}
.badge.bg-success {
color: #fff !important;
}
$warning-dark: #d9a406;
.badge.bg-warning {
background-color: $warning-dark !important;
color: #fff !important;
}
// 5. Layout Structure (Sidebar + Main)
#app {
display: flex;
flex-direction: row;
min-height: 100vh;
}
.sidebar {
width: 260px;
background-color: #313a44;
flex-shrink: 0;
display: flex;
flex-direction: column;
border-right: 1px solid rgba(255, 255, 255, 0.05);
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 1000;
.sidebar-brand {
height: 70px;
display: flex;
align-items: center;
padding: 0 1.5rem;
font-size: 1.25rem;
font-weight: 700;
color: $primary;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
a {
color: $primary;
}
}
.nav-link {
color: #aeb4c6;
padding: 0.8rem 1.5rem;
display: flex;
align-items: center;
transition: all 0.2s;
border-left: 3px solid transparent;
i {
margin-right: 0.75rem;
font-size: 1.1rem;
}
&:hover,
&.active {
color: #fff;
background-color: rgba(255, 255, 255, 0.03);
border-left-color: $primary;
}
}
.sidebar-heading {
font-size: 0.75rem;
text-transform: uppercase;
color: #6c757d;
padding: 1.5rem 1.5rem 0.5rem;
font-weight: 700;
letter-spacing: 0.05em;
}
}
.main-content {
flex-grow: 1;
margin-left: 260px;
display: flex;
flex-direction: column;
min-height: 100vh;
background-color: $body-bg;
}
.topbar {
height: 70px;
background-color: $card-bg;
border-bottom: 1px solid $border-color;
display: flex;
align-items: center;
padding: 0 2rem;
margin-bottom: 2rem;
box-shadow: 0 0 35px 0 rgba(154, 161, 171, .15);
}
// 6. Timeline Component (Dark Theme Adapted)
.timeline-wrapper {
overflow-x: auto;
padding: 20px 0;
&::-webkit-scrollbar {
height: 6px;
}
&::-webkit-scrollbar-thumb {
background-color: $border-color;
border-radius: 4px;
}
}
.timeline {
display: flex;
justify-content: space-between;
position: relative;
min-width: 800px;
padding: 0 40px;
margin-bottom: 20px;
&::after {
content: '';
position: absolute;
top: 20px;
left: 0;
right: 0;
height: 2px;
background-color: $border-color;
z-index: 1;
}
}
.timeline-item {
position: relative;
z-index: 2;
text-align: center;
flex: 1;
.timeline-dot {
width: 14px;
height: 14px;
background-color: $card-bg;
border: 3px solid $primary;
border-radius: 50%;
margin: 13px auto 15px;
transition: all 0.2s ease;
box-shadow: 0 0 0 3px $body-bg;
}
.timeline-date {
position: absolute;
top: -25px;
left: 50%;
transform: translateX(-50%);
font-size: 0.8rem;
font-weight: 600;
color: $body-color;
white-space: nowrap;
}
.timeline-content {
background: $card-bg;
border: 1px solid $border-color;
border-radius: 6px;
padding: 8px 12px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
display: inline-block;
max-width: 180px;
min-width: 120px;
transition: transform 0.2s;
text-decoration: none;
color: inherit;
&:hover {
transform: translateY(-3px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
border-color: $primary;
text-decoration: none;
color: #fff;
}
h6 {
color: #fff;
font-size: 0.9rem;
margin: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
small {
font-size: 0.75rem;
color: #8391a2;
}
}
&.expired .timeline-dot {
border-color: #6c757d;
}
&.urgent .timeline-dot {
border-color: $danger;
}
&.soon .timeline-dot {
border-color: $warning;
}
&.normal .timeline-dot {
border-color: $success;
}
}

17
resources/js/app.js Normal file
View File

@@ -0,0 +1,17 @@
import './bootstrap';
import '../css/app.scss';
import { createApp } from 'vue';
import * as bootstrap from 'bootstrap'; // Make bootstrap available globally if needed, or just import
window.bootstrap = bootstrap;
import ContractsTable from './components/ContractsTable.vue';
const app = createApp({
components: {
ContractsTable,
}
});
app.mount('#app');

4
resources/js/bootstrap.js vendored Normal file
View File

@@ -0,0 +1,4 @@
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

View File

@@ -0,0 +1,120 @@
<script setup>
import { ref, computed } from 'vue';
const props = defineProps({
initialContracts: {
type: Object, // Laravel Paginate Object
required: true
}
});
const contracts = ref(props.initialContracts.data);
const searchQuery = ref('');
const typeFilter = ref('');
const filteredContracts = computed(() => {
return contracts.value.filter(contract => {
const matchesSearch = contract.name.toLowerCase().includes(searchQuery.value.toLowerCase()) ||
contract.provider.toLowerCase().includes(searchQuery.value.toLowerCase()) ||
(contract.municipality && contract.municipality.name.toLowerCase().includes(searchQuery.value.toLowerCase()));
const matchesType = typeFilter.value ? contract.type === typeFilter.value : true;
return matchesSearch && matchesType;
});
});
const formatDate = (date) => {
return new Date(date).toLocaleDateString('fr-FR');
};
const formatCurrency = (amount, currency) => {
return new Intl.NumberFormat('fr-FR', { style: 'currency', currency: currency }).format(amount);
};
const isExpiringSoon = (dateString) => {
if (!dateString) return false;
const today = new Date();
today.setHours(0, 0, 0, 0);
const date = new Date(dateString);
// Create date 2 months from now
const twoMonthsFromNow = new Date();
twoMonthsFromNow.setMonth(today.getMonth() + 2);
// Check if date is in the future (or today) AND before 2 months from now
// If it's already past, it's expired, not expiring soon (unless we want to highlight overdue too but usually that's red)
// The user asked "arrivant a échéances", implies approaching.
// Let's include today.
return date >= today && date <= twoMonthsFromNow;
};
</script>
<template>
<div class="card shadow-sm border-0">
<div class="card-header border-bottom-0 d-flex justify-content-between align-items-center">
<h5 class="mb-0 text-white">Contrats</h5>
<div class="d-flex gap-2">
<input v-model="searchQuery" type="text" class="form-control form-control-sm" placeholder="Rechercher...">
<select v-model="typeFilter" class="form-select form-select-sm">
<option value="">Tous les types</option>
<option value="microsoft_365">Microsoft 365</option>
<option value="fiber">Fibre</option>
<option value="domain">Domaine</option>
<option value="software">Logiciel</option>
</select>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead>
<tr>
<th>Nom</th>
<th>Commune</th>
<th>Fournisseur</th>
<th>Type</th>
<th>État</th>
<th>Date fin</th>
<th>Montant</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="contract in filteredContracts" :key="contract.id" :class="{ 'table-warning': isExpiringSoon(contract.end_date) && contract.status !== 'expired' }">
<td>
{{ contract.name }}
<i v-if="isExpiringSoon(contract.end_date) && contract.status !== 'expired'" class="bi bi-exclamation-triangle-fill text-warning ms-1" title="Expire dans moins de 2 mois"></i>
</td>
<td>
<span v-if="contract.municipality" class="badge bg-secondary">{{ contract.municipality.name }}</span>
<span v-else class="text-muted small">Global</span>
</td>
<td>{{ contract.provider }}</td>
<td>
<span class="badge bg-info">{{ contract.type }}</span>
</td>
<td>
<span :class="{
'badge bg-success': contract.status === 'active',
'badge bg-warning': contract.status === 'pending',
'badge bg-danger': contract.status === 'expired',
'badge bg-secondary': contract.status === 'draft' || contract.status === 'cancelled'
}">{{ contract.status }}</span>
</td>
<td :class="{ 'fw-bold text-danger': isExpiringSoon(contract.end_date) && contract.status !== 'expired' }">
{{ contract.end_date ? formatDate(contract.end_date) : '-' }}
</td>
<td>{{ contract.amount ? formatCurrency(contract.amount, contract.currency) : '-' }}</td>
<td>
<a :href="`/contracts/${contract.id}`" class="btn btn-sm btn-outline-primary me-1">
Voir
</a>
</td>
</tr>
<tr v-if="filteredContracts.length === 0">
<td colspan="8" class="text-center py-3 text-muted">Aucun contrat trouvé.</td>
</tr>
</tbody>
</table>
</div>
<!-- Simple Pagination links (could be enhanced) -->
</div>
</template>

View File

@@ -0,0 +1,69 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h2 class="mb-4">Gestion des Niveaux de Licence M365</h2>
<div class="row">
<div class="col-md-4">
<div class="card shadow-sm mb-4">
<div class="card-header bg-primary text-white">Ajouter un niveau</div>
<div class="card-body">
<form action="{{ route('admin.license_levels.store') }}" method="POST">
@csrf
<div class="mb-3">
<label class="form-label">Nom du niveau</label>
<input type="text" name="name" class="form-control" placeholder="ex: E1, Business Basic" required>
</div>
<button type="submit" class="btn btn-success w-100">Ajouter</button>
</form>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card shadow-sm">
<div class="card-body">
<table class="table table-hover align-middle">
<thead>
<tr>
<th>Nom</th>
<th>Statut</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach($levels as $level)
<tr class="{{ $level->is_active ? '' : 'table-warning' }}">
<td>{{ $level->name }}</td>
<td>
@if($level->is_active)
<span class="badge bg-success">Actif</span>
@else
<span class="badge bg-secondary">Désactivé</span>
@endif
</td>
<td>
<div class="d-flex gap-2">
<form action="{{ route('admin.license_levels.toggle', $level) }}" method="POST">
@csrf
<button type="submit" class="btn btn-sm {{ $level->is_active ? 'btn-outline-danger' : 'btn-outline-success' }}">
{{ $level->is_active ? 'Désactiver' : 'Activer' }}
</button>
</form>
<form action="{{ route('admin.license_levels.destroy', $level) }}" method="POST" onsubmit="return confirm('Supprimer ce niveau ?');">
@csrf
@method('DELETE')
<button class="btn btn-sm btn-danger"><i class="bi bi-trash"></i></button>
</form>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,52 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>Modifier le lien</h2>
<a href="{{ route('admin.links.index') }}" class="btn btn-secondary">Retour</a>
</div>
<div class="card shadow-sm col-md-8 mx-auto">
<div class="card-body">
<form action="{{ route('admin.links.update', $link) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label class="form-label">Titre</label>
<input type="text" name="title" class="form-control" value="{{ $link->title }}" required>
</div>
<div class="mb-3">
<label class="form-label">URL</label>
<input type="url" name="url" class="form-control" value="{{ $link->url }}" required>
</div>
<div class="mb-3">
<label class="form-label">Icône Bootstrap</label>
<input type="text" name="icon" class="form-control" value="{{ $link->icon }}">
</div>
<div class="mb-3">
<label class="form-label">Couleur</label>
<select name="color" class="form-select">
@foreach(['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark'] as $color)
<option value="{{ $color }}" {{ $link->color == $color ? 'selected' : '' }}>
{{ ucfirst($color) }}
</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label class="form-label">Ordre</label>
<input type="number" name="order" class="form-control" value="{{ $link->order }}">
</div>
<button type="submit" class="btn btn-primary w-100">Mettre à jour</button>
</form>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,103 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h2 class="mb-4">Gestion des Liens Utiles</h2>
<div class="row">
<div class="col-md-4">
<div class="card shadow-sm mb-4">
<div class="card-header bg-primary text-white">Ajouter un lien</div>
<div class="card-body">
<form action="{{ route('admin.links.store') }}" method="POST">
@csrf
<div class="mb-3">
<label class="form-label">Titre</label>
<input type="text" name="title" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label">URL</label>
<input type="url" name="url" class="form-control" placeholder="https://..." required>
</div>
<div class="mb-3">
<label class="form-label">Icône Bootstrap (ex: bi-google)</label>
<input type="text" name="icon" class="form-control" placeholder="bi-link">
</div>
<div class="mb-3">
<label class="form-label">Couleur (Bootstrap Context)</label>
<select name="color" class="form-select">
<option value="primary">Primary (Blue)</option>
<option value="secondary">Secondary (Grey)</option>
<option value="success">Success (Green)</option>
<option value="danger">Danger (Red)</option>
<option value="warning">Warning (Yellow)</option>
<option value="info">Info (Cyan)</option>
<option value="dark">Dark</option>
</select>
</div>
<div class="mb-3">
<label class="form-label">Ordre</label>
<input type="number" name="order" class="form-control" value="0">
</div>
<button type="submit" class="btn btn-success w-100">Ajouter</button>
</form>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card shadow-sm">
<div class="card-body">
<table class="table table-hover align-middle">
<thead>
<tr>
<th>Icône</th>
<th>Titre / URL</th>
<th>Ordre</th>
<th>Statut</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach($links as $link)
<tr class="{{ $link->is_active ? '' : 'table-warning' }}">
<td><i class="bi {{ $link->icon }} text-{{ $link->color }}"></i></td>
<td>
<strong>{{ $link->title }}</strong><br>
<small class="text-muted">{{ $link->url }}</small>
</td>
<td>{{ $link->order }}</td>
<td>
@if($link->is_active)
<span class="badge bg-success">Actif</span>
@else
<span class="badge bg-secondary">Désactivé</span>
@endif
</td>
<td>
<div class="d-flex gap-2">
<a href="{{ route('admin.links.edit', $link) }}" class="btn btn-sm btn-outline-primary">
<i class="bi bi-pencil"></i>
</a>
<form action="{{ route('admin.links.toggle', $link) }}" method="POST">
@csrf
<button type="submit" class="btn btn-sm {{ $link->is_active ? 'btn-outline-danger' : 'btn-outline-success' }}">
{{ $link->is_active ? 'Désactiver' : 'Activer' }}
</button>
</form>
<form action="{{ route('admin.links.destroy', $link) }}" method="POST" onsubmit="return confirm('Supprimer ce lien ?');">
@csrf
@method('DELETE')
<button class="btn btn-sm btn-danger"><i class="bi bi-trash"></i></button>
</form>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,47 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h2 class="mb-4">Gestion des Communes</h2>
<div class="card shadow-sm">
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead>
<tr>
<th>Nom</th>
<th>Code Postal</th>
<th>Statut</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($municipalities as $municipality)
<tr class="{{ $municipality->is_active ? '' : 'table-warning' }}">
<td>{{ $municipality->name }}</td>
<td>{{ $municipality->zip_code }}</td>
<td>
@if($municipality->is_active)
<span class="badge bg-success">Active</span>
@else
<span class="badge bg-secondary">Désactivée</span>
@endif
</td>
<td>
<form action="{{ route('admin.municipalities.toggle', $municipality) }}" method="POST">
@csrf
<button type="submit" class="btn btn-sm {{ $municipality->is_active ? 'btn-outline-danger' : 'btn-outline-success' }}">
{{ $municipality->is_active ? 'Désactiver' : 'Activer' }}
</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,47 @@
@extends('layouts.app')
@section('content')
<div class="row justify-content-center">
<div class="col-md-6 col-lg-4">
<div class="card shadow-lg border-0 rounded-lg mt-5">
<div class="card-header border-0 text-center py-4 bg-primary text-white">
<h3 class="font-weight-light my-2">Connexion</h3>
</div>
<div class="card-body p-4">
<form method="POST" action="{{ route('login') }}">
@csrf
<div class="form-floating mb-3">
<input class="form-control @error('email') is-invalid @enderror" id="inputEmail" type="email" name="email" placeholder="name@example.com" value="{{ old('email') }}" required autofocus />
<label for="inputEmail">Adresse Email</label>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="form-floating mb-3">
<input class="form-control @error('password') is-invalid @enderror" id="inputPassword" type="password" name="password" placeholder="Password" required />
<label for="inputPassword">Mot de passe</label>
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="form-check mb-3">
<input class="form-check-input" id="inputRememberPassword" type="checkbox" name="remember" />
<label class="form-check-label" for="inputRememberPassword">Se souvenir de moi</label>
</div>
<div class="d-flex align-items-center justify-content-between mt-4 mb-0">
<a class="small text-decoration-none" href="#">Mot de passe oublié?</a>
<button type="submit" class="btn btn-primary w-100 ms-3">Se connecter</button>
</div>
</form>
</div>
<div class="card-footer text-center py-3 bg-light border-0">
<div class="small"><a href="{{ route('register') }}" class="text-decoration-none">Pas de compte? S'inscrire!</a></div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,47 @@
@extends('layouts.app')
@section('content')
<div class="row justify-content-center">
<div class="col-md-6 col-lg-5">
<div class="card shadow-lg border-0 rounded-lg mt-5">
<div class="card-header border-0 text-center py-4 bg-success text-white">
<h3 class="font-weight-light my-2">Créer un compte</h3>
<p class="mb-0 small">Nécessite une validation administrateur</p>
</div>
<div class="card-body p-4">
<form method="POST" action="{{ route('register') }}">
@csrf
<div class="form-floating mb-3">
<input class="form-control" id="inputName" type="text" name="name" placeholder="Nom complet" value="{{ old('name') }}" required autofocus />
<label for="inputName">Nom Complet</label>
</div>
<div class="form-floating mb-3">
<input class="form-control" id="inputEmail" type="email" name="email" placeholder="name@example.com" value="{{ old('email') }}" required />
<label for="inputEmail">Adresse Email</label>
</div>
<div class="row mb-3">
<div class="col-md-6">
<div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="inputPassword" type="password" name="password" placeholder="Create a password" required />
<label for="inputPassword">Mot de passe</label>
</div>
</div>
<div class="col-md-6">
<div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="inputPasswordConfirm" type="password" name="password_confirmation" placeholder="Confirm password" required />
<label for="inputPasswordConfirm">Confirmation</label>
</div>
</div>
</div>
<div class="mt-4 mb-0">
<div class="d-grid"><button class="btn btn-success btn-block" type="submit">S'inscrire</button></div>
</div>
</form>
</div>
<div class="card-footer text-center py-3 bg-light border-0">
<div class="small"><a href="{{ route('login') }}" class="text-decoration-none">Déjà inscrit? Aller à la connexion</a></div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,135 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card shadow-sm">
<div class="card-header bg-primary text-white">Nouveau Contrat</div>
<div class="card-body">
<form method="POST" action="{{ route('contracts.store') }}">
@csrf
<div class="mb-3">
<label for="name" class="form-label">Nom du Contrat</label>
<input type="text" class="form-control" id="name" name="name" required placeholder="ex: Maintenance Serveurs">
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="provider" class="form-label">Fournisseur</label>
<input type="text" class="form-control" id="provider" name="provider" required>
</div>
<div class="col-md-6">
<label for="municipality_id" class="form-label">Commune Affectée</label>
<select class="form-select" id="municipality_id" name="municipality_id">
<option value="">Global / Agglomération</option>
@foreach($municipalities as $municipality)
<option value="{{ $municipality->id }}">{{ $municipality->name }} ({{ $municipality->zip_code }})</option>
@endforeach
</select>
</div>
</div>
<div class="mb-3">
<label for="reference" class="form-label">Référence</label>
<input type="text" class="form-control" id="reference" name="reference">
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="start_date" class="form-label">Date Début</label>
<input type="date" class="form-control" id="start_date" name="start_date" required>
</div>
<div class="col-md-6">
<label for="end_date" class="form-label">Date Fin (Optionnel)</label>
<input type="date" class="form-control" id="end_date" name="end_date">
</div>
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="amount" class="form-label">Montant ()</label>
<input type="number" step="0.01" class="form-control" id="amount" name="amount">
</div>
<div class="col-md-6">
<label for="type" class="form-label">Type</label>
<select class="form-select" id="type" name="type" required>
<option value="microsoft_365">Microsoft 365</option>
<option value="fiber">Fibre / Internet</option>
<option value="domain">Nom de Domaine</option>
<option value="software">Logiciel / Licence</option>
<option value="hardware">Matériel</option>
<option value="consulting">Prestation Intellectuelle</option>
<option value="other">Autre</option>
</select>
</div>
</div>
<div id="m365-fields" class="mb-3 p-3 bg-light border rounded" style="display: none;">
<h6>Détails Microsoft 365</h6>
<div class="row">
<div class="col-md-6">
<label class="form-label">Niveau de Licence</label>
<select class="form-select" name="meta[m365_license_level]">
<option value="">Sélectionner...</option>
@foreach($licenseLevels as $level)
<option value="{{ $level->name }}">{{ $level->name }}</option>
@endforeach
</select>
</div>
<div class="col-md-6">
<label class="form-label">Nombre de Licences</label>
<input type="number" class="form-control" name="meta[m365_quantity]" placeholder="ex: 10">
</div>
</div>
</div>
<div class="mb-3">
<label for="notes" class="form-label">Notes</label>
<textarea class="form-control" id="notes" name="notes" rows="3"></textarea>
</div>
<hr>
<h5>Méta-données supplémentaires</h5>
<div id="meta-fields">
<div class="row mb-2">
<div class="col-md-5">
<input type="text" class="form-control" name="meta[key1]" placeholder="Clé (ex: Débit)">
</div>
<div class="col-md-5">
<input type="text" class="form-control" name="meta[value1]" placeholder="Valeur (ex: 1Gbps)">
</div>
</div>
</div>
<div class="d-grid gap-2 mt-4">
<button type="submit" class="btn btn-primary">Créer le Contrat</button>
<a href="{{ route('contracts.index') }}" class="btn btn-link text-muted">Annuler</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const typeSelect = document.getElementById('type');
const m365Fields = document.getElementById('m365-fields');
function toggleFields() {
if (typeSelect.value === 'microsoft_365') {
m365Fields.style.display = 'block';
} else {
m365Fields.style.display = 'none';
}
}
typeSelect.addEventListener('change', toggleFields);
toggleFields(); // Initial check
});
</script>
@endsection

View File

@@ -0,0 +1,127 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card shadow-sm">
<div class="card-header bg-primary text-white">Modifier le Contrat</div>
<div class="card-body">
<form method="POST" action="{{ route('contracts.update', $contract) }}">
@csrf
@method('PUT')
<div class="mb-3">
<label for="name" class="form-label">Nom du Contrat</label>
<input type="text" class="form-control" id="name" name="name" value="{{ old('name', $contract->name) }}" required>
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="provider" class="form-label">Fournisseur</label>
<input type="text" class="form-control" id="provider" name="provider" value="{{ old('provider', $contract->provider) }}" required>
</div>
<div class="col-md-6">
<label for="municipality_id" class="form-label">Commune Affectée</label>
<select class="form-select" id="municipality_id" name="municipality_id">
<option value="">Global / Agglomération</option>
@foreach($municipalities as $municipality)
<option value="{{ $municipality->id }}" {{ (old('municipality_id', $contract->municipality_id) == $municipality->id) ? 'selected' : '' }}>
{{ $municipality->name }} ({{ $municipality->zip_code }})
</option>
@endforeach
</select>
</div>
</div>
<div class="mb-3">
<label for="reference" class="form-label">Référence</label>
<input type="text" class="form-control" id="reference" name="reference" value="{{ old('reference', $contract->reference) }}">
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="start_date" class="form-label">Date Début</label>
<input type="date" class="form-control" id="start_date" name="start_date" value="{{ old('start_date', $contract->start_date->format('Y-m-d')) }}" required>
</div>
<div class="col-md-6">
<label for="end_date" class="form-label">Date Fin (Optionnel)</label>
<input type="date" class="form-control" id="end_date" name="end_date" value="{{ old('end_date', $contract->end_date ? $contract->end_date->format('Y-m-d') : '') }}">
</div>
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="amount" class="form-label">Montant ()</label>
<input type="number" step="0.01" class="form-control" id="amount" name="amount" value="{{ old('amount', $contract->amount) }}">
</div>
<div class="col-md-6">
<label for="status" class="form-label">Statut</label>
<select class="form-select" id="status" name="status" required>
<option value="active" {{ $contract->status == 'active' ? 'selected' : '' }}>Actif</option>
<option value="pending" {{ $contract->status == 'pending' ? 'selected' : '' }}>En attente</option>
<option value="expired" {{ $contract->status == 'expired' ? 'selected' : '' }}>Expiré</option>
<option value="cancelled" {{ $contract->status == 'cancelled' ? 'selected' : '' }}>Annulé</option>
<option value="draft" {{ $contract->status == 'draft' ? 'selected' : '' }}>Brouillon</option>
</select>
</div>
</div>
<div class="mb-3">
<label for="notes" class="form-label">Notes</label>
<textarea class="form-control" id="notes" name="notes" rows="3">{{ old('notes', $contract->notes) }}</textarea>
</div>
<!-- M365 Specifics -->
@if($contract->type === 'microsoft_365')
<div id="m365-fields" class="mb-3 p-3 bg-light border rounded">
<h6>Détails Microsoft 365</h6>
@php
$level = $contract->meta->where('key', 'm365_license_level')->first()?->value;
$qty = $contract->meta->where('key', 'm365_quantity')->first()?->value;
@endphp
<div class="row">
<div class="col-md-6">
<label class="form-label">Niveau de Licence</label>
<select class="form-select" name="meta[m365_license_level]">
<option value="">Sélectionner...</option>
@php
// Fallback if licenseLevels is not passed (though controller should pass it)
$licenseLevels = $licenseLevels ?? \App\Models\LicenseLevel::active()->get();
@endphp
@foreach($licenseLevels as $l)
<option value="{{ $l->name }}" {{ $level == $l->name ? 'selected' : '' }}>{{ $l->name }}</option>
@endforeach
</select>
</div>
<div class="col-md-6">
<label class="form-label">Nombre de Licences</label>
<input type="number" class="form-control" name="meta[m365_quantity]" value="{{ $qty }}" placeholder="ex: 10">
</div>
</div>
</div>
@endif
<!-- Meta Data Handling could be improved here, currently simplistic -->
<div class="d-grid gap-2 mt-4">
<button type="submit" class="btn btn-primary">Mettre à jour</button>
<a href="{{ route('contracts.show', $contract) }}" class="btn btn-link text-muted">Annuler</a>
</div>
</form>
<hr>
@if(auth()->user()->isAdmin())
<form action="{{ route('contracts.destroy', $contract) }}" method="POST" onsubmit="return confirm('Êtes-vous sûr de vouloir supprimer définitivement ce contrat ?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-outline-danger w-100">Supprimer le Contrat</button>
</form>
@endif
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,28 @@
@extends('layouts.app')
@section('title', 'Gestion des Contrats')
@section('content')
<div class="row mb-4">
<div class="col-md-8">
<p class="text-muted">Gérer les contrats de l'agglomération ({{ $contracts->total() }})</p>
</div>
<div class="col-md-4 text-end">
@if(auth()->user()->isManager())
<a href="{{ route('contracts.create') }}" class="btn btn-primary shadow-sm">
<i class="bi bi-plus-lg"></i> Nouveau Contrat
</a>
@endif
</div>
</div>
<div class="contracts-list-section">
<!-- Vue Component -->
<contracts-table :initial-contracts="{{ json_encode($contracts) }}"></contracts-table>
<div class="pagination mt-3 justify-content-center">
{{ $contracts->links() }}
<!-- Note: If using Vue-driven pagination, links() might conflict unless handled properly, but here we just pass initial page -->
</div>
</div>
@endsection

View File

@@ -0,0 +1,136 @@
@extends('layouts.app')
@section('content')
<div class="mb-4">
<a href="{{ route('contracts.index') }}" class="btn btn-outline-secondary">&larr; Retour</a>
</div>
<div class="row">
<div class="col-md-8">
<div class="card shadow-sm mb-4">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h3 class="mb-0">{{ $contract->name }}</h3>
@if(auth()->user()->isManager())
<a href="{{ route('contracts.edit', $contract) }}" class="btn btn-sm btn-outline-primary">Modifier</a>
@endif
</div>
<div class="card-body">
<div class="row mb-3">
<div class="col-md-6">
<strong>Fournisseur:</strong> {{ $contract->provider }}
</div>
<div class="col-md-6">
<strong>Référence:</strong> {{ $contract->reference ?? 'N/A' }}
</div>
</div>
<div class="row mb-3">
<div class="col-md-12">
<strong>Commune:</strong>
@if($contract->municipality)
<span class="badge bg-secondary">{{ $contract->municipality->name }} ({{ $contract->municipality->zip_code }})</span>
@else
<span class="badge bg-light text-dark border">Global / Agglomération</span>
@endif
</div>
</div>
<div class="row mb-3">
<div class="col-md-6">
<strong>Type:</strong> <span class="badge bg-info text-dark">{{ $contract->type }}</span>
</div>
<div class="col-md-6">
<strong>Status:</strong> {{ $contract->status }}
</div>
</div>
<div class="row mb-3">
<div class="col-md-6">
<strong>Date Début:</strong> {{ $contract->start_date->format('d/m/Y') }}
</div>
<div class="col-md-6">
<strong>Date Fin:</strong> {{ $contract->end_date ? $contract->end_date->format('d/m/Y') : 'Indéfinie' }}
</div>
</div>
<div class="mb-3">
<strong>Montant:</strong> {{ number_format($contract->amount, 2) }} {{ $contract->currency }}
</div>
@if($contract->notes)
<div class="mb-3">
<strong>Notes:</strong>
<p class="text-muted">{{ $contract->notes }}</p>
</div>
@endif
</div>
</div>
<!-- Meta Data -->
@if($contract->meta->isNotEmpty())
<div class="card shadow-sm mb-4">
<div class="card-header bg-light">
<h5 class="mb-0">Détails Techniques</h5>
</div>
<ul class="list-group list-group-flush">
@foreach($contract->meta as $meta)
<li class="list-group-item d-flex justify-content-between">
<span>
@if($meta->key == 'm365_license_level')
<i class="bi bi-microsoft me-1"></i> Niveau Licence M365
@elseif($meta->key == 'm365_quantity')
<i class="bi bi-people-fill me-1"></i> Nombre de Licences
@else
{{ $meta->key }}
@endif
</span>
<span class="fw-bold">{{ $meta->value }}</span>
</li>
@endforeach
</ul>
</div>
@endif
</div>
<div class="col-md-4">
<!-- Documents -->
<div class="card shadow-sm mb-4">
<div class="card-header bg-light d-flex justify-content-between align-items-center">
<h5 class="mb-0">Documents</h5>
</div>
<div class="card-body">
@if($contract->documents->isEmpty())
<p class="text-muted small">Aucun document.</p>
@else
<ul class="list-unstyled">
@foreach($contract->documents as $doc)
<li class="mb-2 d-flex justify-content-between align-items-center">
<a href="{{ Storage::url($doc->path) }}" target="_blank" class="text-decoration-none text-truncate" style="max-width: 200px;">
<i class="bi bi-file-earmark-text"></i> {{ $doc->filename }}
</a>
@if(auth()->id() == $doc->uploaded_by || auth()->user()->isManager())
<form action="{{ route('documents.destroy', $doc) }}" method="POST" class="d-inline" onsubmit="return confirm('Supprimer ?')">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm btn-link text-danger p-0"><i class="bi bi-trash"></i></button>
</form>
@endif
</li>
@endforeach
</ul>
@endif
@if(auth()->user()->isManager())
<hr>
<form action="{{ route('documents.store', $contract) }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="mb-2">
<label class="form-label small">Ajouter un document</label>
<input type="file" name="file" class="form-control form-control-sm" required>
</div>
<div class="mb-2">
<input type="text" name="description" placeholder="Description (optionnel)" class="form-control form-control-sm">
</div>
<button type="submit" class="btn btn-sm btn-success w-100">Uploader</button>
</form>
@endif
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,323 @@
@extends('layouts.app')
@section('title', 'Cortex XDR')
@section('content')
<div class="mb-4">
<!-- Configuration Warning (Server-side check) -->
<!-- We can't check config in view easily if controller doesn't pass it,
but we'll handle errors in JS -->
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h5 class="text-muted">Vue d'ensemble de la sécurité</h5>
</div>
<div>
<span class="badge bg-dark border border-secondary p-2" id="api-status-badge">
<span class="spinner-border spinner-border-sm text-secondary me-1" role="status" aria-hidden="true" id="status-spinner"></span>
<span id="api-status-text">Connexion...</span>
</span>
</div>
</div>
<!-- Loader Overlay -->
<div id="loading-overlay" class="text-center py-5">
<div class="spinner-border text-primary" style="width: 3rem; height: 3rem;" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<p class="mt-3 text-muted">Chargement des données Cortex XDR en cours...</p>
<p class="small text-muted">Cela peut prendre quelques secondes (récupération de ~1000 postes).</p>
</div>
<!-- Main Content (Hidden initially) -->
<div id="dashboard-content" class="d-none">
<!-- KPI Cards -->
<div class="row g-4 mb-4">
<!-- Incidents Total -->
<div class="col-md-3">
<div class="card shadow-sm border-0 h-100">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="text-muted mb-0">Total Incidents</h6>
<div class="icon-shape bg-primary bg-opacity-10 text-primary rounded-circle p-2">
<i class="bi bi-bug fs-4"></i>
</div>
</div>
<h2 class="display-6 fw-bold mb-0 text-white" id="incidents-total">-</h2>
</div>
</div>
</div>
<!-- Endpoints Total -->
<div class="col-md-3">
<div class="card shadow-sm border-0 h-100">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="text-muted mb-0">Total Postes</h6>
<div class="icon-shape bg-info bg-opacity-10 text-info rounded-circle p-2">
<i class="bi bi-laptop fs-4"></i>
</div>
</div>
<h2 class="display-6 fw-bold mb-0 text-white" id="endpoints-total">-</h2>
<div class="mt-2 text-muted small">
<i class="bi bi-wifi text-success"></i> <span id="endpoints-connected-sm">-</span> Connectés
</div>
</div>
</div>
</div>
<!-- Critical Incidents -->
<div class="col-md-3">
<div class="card shadow-sm border-0 h-100 position-relative overflow-hidden">
<div class="position-absolute top-0 start-0 w-1 pt-1 h-100 bg-danger"></div>
<div class="card-body ps-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="text-danger mb-0">Critiques</h6>
<i class="bi bi-lightning-charge-fill text-danger fs-4"></i>
</div>
<h2 class="display-6 fw-bold mb-0 text-white" id="incidents-critical">-</h2>
<small class="text-muted">Incidents nécessitant attention immédiate</small>
</div>
</div>
</div>
<!-- High Incidents -->
<div class="col-md-3">
<div class="card shadow-sm border-0 h-100 position-relative overflow-hidden">
<div class="position-absolute top-0 start-0 w-1 pt-1 h-100 bg-warning"></div>
<div class="card-body ps-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="text-warning mb-0">Élevés</h6>
<i class="bi bi-exclamation-circle-fill text-warning fs-4"></i>
</div>
<h2 class="display-6 fw-bold mb-0 text-white" id="incidents-high">-</h2>
<small class="text-muted">Incidents à traiter rapidement</small>
</div>
</div>
</div>
</div>
<!-- Detailed Breakdown Row -->
<div class="row g-4">
<!-- Recent Incidents Table -->
<div class="col-md-8">
<div class="card shadow-sm border-0 h-100">
<div class="card-header border-bottom-0 bg-transparent py-3">
<h5 class="card-title fw-bold text-white mb-0">
<i class="bi bi-clock-history me-2 text-primary"></i>Derniers Incidents
</h5>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead>
<tr>
<th class="ps-4">ID</th>
<th>Observed Hosts</th>
<th>Sévérité</th>
<th>Statut</th>
<th>Date</th>
</tr>
</thead>
<tbody id="incidents-table-body">
<!-- Rows injected by JS -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Endpoints Status -->
<div class="col-md-4">
<div class="card shadow-sm border-0 h-100">
<div class="card-header border-bottom-0 bg-transparent py-3">
<h5 class="card-title fw-bold text-white mb-0">
<i class="bi bi-hdd-network me-2 text-info"></i>État du Parc
</h5>
</div>
<div class="card-body">
<div class="mb-4">
<div class="d-flex justify-content-between mb-1">
<span class="text-white">Connectés</span>
<span class="text-success fw-bold" id="endpoints-connected">-</span>
</div>
<div class="progress" style="height: 6px;">
<div id="progress-connected" class="progress-bar bg-success" role="progressbar" style="width: 0%"></div>
</div>
</div>
<div class="mb-4">
<div class="d-flex justify-content-between mb-1">
<span class="text-white">Déconnectés</span>
<span class="text-secondary fw-bold" id="endpoints-disconnected">-</span>
</div>
<div class="progress" style="height: 6px;">
<div id="progress-disconnected" class="progress-bar bg-secondary" role="progressbar" style="width: 0%"></div>
</div>
</div>
<!-- Endpoint Types Breakdown -->
<div class="mb-4">
<h6 class="text-white small fw-bold mb-2">Répartition par Type</h6>
<div class="d-flex flex-wrap gap-2" id="endpoint-types-container">
<span class="text-muted small">Chargement...</span>
</div>
</div>
<div class="alert alert-dark border-secondary mt-3 mb-0">
<div class="d-flex">
<i class="bi bi-info-circle me-2 text-info"></i>
<div class="small text-muted">
Le parc est majoritairement <strong class="text-white" id="network-status-text">...</strong>.
<span id="disconnected-count-text">0</span> machines n'ont pas communiqué récemment.
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
fetchData();
});
function fetchData() {
fetch("{{ route('cortex.data') }}")
.then(response => {
if (!response.ok) {
throw new Error('Erreur réseau ou configuration');
}
return response.json();
})
.then(data => {
console.log("Cortex Data Received:", data); // Debug
// Hide loader, show content
document.getElementById('loading-overlay').classList.add('d-none');
document.getElementById('dashboard-content').classList.remove('d-none');
// Update Status Badge
const statusText = document.getElementById('api-status-text');
const spinner = document.getElementById('status-spinner');
if (data.mock) {
statusText.innerText = 'Demo Mode';
} else {
statusText.innerText = 'Connecté';
const checkIcon = document.querySelector('.bi-shield-check');
if(checkIcon) checkIcon.classList.remove('d-none');
}
spinner.classList.add('d-none');
// Update Counters safely
document.getElementById('incidents-total').innerText = data.incidents_total || 0;
document.getElementById('endpoints-total').innerText = data.endpoints_total || 0;
document.getElementById('endpoints-connected-sm').innerText = data.endpoints_connected || 0;
document.getElementById('incidents-critical').innerText = data.incidents_critical || 0;
document.getElementById('incidents-high').innerText = data.incidents_high || 0;
// Update Breakdown
document.getElementById('endpoints-connected').innerText = data.endpoints_connected || 0;
document.getElementById('endpoints-disconnected').innerText = data.endpoints_disconnected || 0;
// Progress Bars
const total = (data.endpoints_total && data.endpoints_total > 0) ? data.endpoints_total : 1;
const connPct = ((data.endpoints_connected || 0) / total) * 100;
const discPct = ((data.endpoints_disconnected || 0) / total) * 100;
document.getElementById('progress-connected').style.width = connPct + '%';
document.getElementById('progress-disconnected').style.width = discPct + '%';
// Endpoint Types
const typesContainer = document.getElementById('endpoint-types-container');
typesContainer.innerHTML = '';
if (data.endpoints_types && typeof data.endpoints_types === 'object') {
Object.keys(data.endpoints_types).forEach(type => {
const count = data.endpoints_types[type];
let icon = 'bi-pc-display';
if (type.includes('Server')) icon = 'bi-hdd-rack';
else if (type.includes('Mobile') || type.includes('Phone')) icon = 'bi-phone';
else if (type.includes('Lab') || type.includes('Virtual')) icon = 'bi-box';
typesContainer.innerHTML += `
<div class="d-flex align-items-center bg-dark border border-secondary rounded px-2 py-1">
<i class="bi ${icon} me-2 text-muted"></i>
<span class="text-white small me-2">${type}</span>
<span class="badge bg-secondary rounded-pill">${count}</span>
</div>
`;
});
} else {
typesContainer.innerHTML = '<span class="text-muted small">Aucune donnée de type</span>';
}
// Info Text
// Info Text
document.getElementById('network-status-text').innerText = connPct > 50 ? 'connecté' : 'déconnecté';
document.getElementById('disconnected-count-text').innerText = data.endpoints_disconnected || 0;
// Render Table
const tbody = document.getElementById('incidents-table-body');
let tableContent = '';
if (data.recent_incidents && Array.isArray(data.recent_incidents) && data.recent_incidents.length > 0) {
data.recent_incidents.forEach(incident => {
const sev = (incident.severity || 'unknown').toString().toLowerCase();
let badgeClass = 'light';
if (sev === 'critical') badgeClass = 'danger';
else if (sev === 'high') badgeClass = 'warning';
else if (sev === 'medium') badgeClass = 'info';
else if (sev === 'low') badgeClass = 'secondary';
const dateStr = incident.creation_time ? new Date(incident.creation_time).toLocaleString() : '-';
const link = incident.xdr_url || '#';
const host = (incident.hosts && incident.hosts.length > 0) ? incident.hosts[0] : 'Unknown Host';
const status = incident.status || 'Active';
tableContent += `
<tr>
<td class="ps-4 text-white">#${incident.incident_id || '-'}</td>
<td>
<div class="d-flex align-items-center">
<div class="avatar-sm bg-dark rounded-circle me-2 d-flex justify-content-center align-items-center" style="width:30px;height:30px">
<i class="bi bi-pc-display text-muted small"></i>
</div>
<a href="${link}" target="_blank">${host}</a>
</div>
</td>
<td>
<span class="badge bg-${badgeClass}">${sev.charAt(0).toUpperCase() + sev.slice(1)}</span>
</td>
<td>
<span class="badge bg-dark border border-secondary">${status}</span>
</td>
<td class="text-muted">${dateStr}</td>
</tr>
`;
});
} else {
tableContent = `
<tr>
<td colspan="5" class="text-center py-5 text-muted">
<i class="bi bi-check-circle fs-1 d-block mb-3 text-success opacity-50"></i>
Aucun incident récent à afficher.
</td>
</tr>
`;
}
tbody.innerHTML = tableContent;
}).catch(error => {
console.error(error);
document.getElementById('loading-overlay').innerHTML = `
<div class="alert alert-danger">Erreur de chargement: ${error.message}</div>
<button class="btn btn-outline-light btn-sm mt-2" onclick="location.reload()">Réessayer</button>
`;
});
}
</script>
@endsection

View File

@@ -0,0 +1,208 @@
@extends('layouts.app')
@section('content')
@section('title', 'Tableau de Bord')
@section('content')
<div class="row g-4 mb-4">
<!-- Stats Cards -->
<div class="col-md-3">
<div class="card shadow-sm border-start border-4 border-primary">
<div class="card-body">
<h5 class="card-title text-muted">Nombre de contrats</h5>
<h2 class="display-6">{{ $contractStats['total'] }}</h2>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card shadow-sm border-start border-4 border-success">
<div class="card-body">
<h5 class="card-title text-muted">Actifs</h5>
<h2 class="display-6">{{ $contractStats['active'] }}</h2>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card shadow-sm border-start border-4 border-warning">
<div class="card-body">
<h5 class="card-title text-muted">Expire bientôt</h5>
<h2 class="display-6">{{ $contractStats['expiring_soon'] }}</h2>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card shadow-sm border-start border-4 border-danger">
<div class="card-body">
<h5 class="card-title text-muted">Expirés</h5>
<h2 class="display-6">{{ $contractStats['expired'] }}</h2>
</div>
</div>
</div>
</div>
<div class="row mb-4">
<div class="col-12">
<div class="card shadow-sm border-0">
<div class="card-header border-bottom-0 pt-3 pb-0 d-flex justify-content-between align-items-center">
<h5 class="card-title fw-bold text-white mb-0">
<i class="bi bi-sticky me-2"></i>Bloc-Note
</h5>
<small class="text-muted"></small>
</div>
<div class="card-body">
<form action="{{ route('dashboard.note.update') }}" method="POST">
@csrf
<div class="input-group">
<textarea name="note" class="form-control" rows="3" placeholder="Écrivez un message ici...">{{ $dashboardNote }}</textarea>
<button class="btn btn-warning text-dark" type="submit">Enregistrer</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="row mb-4">
<div class="col-12">
<div class="card shadow-sm border-0">
<div class="card-header border-bottom-0 pt-4 pb-0">
<h5 class="card-title fw-bold text-white mb-0">
<i class="bi bi-calendar-event me-2"></i>Prochaines Expirations
</h5>
<p class="text-muted small mb-0"></p>
</div>
<div class="card-body">
@if($upcomingContracts->isEmpty())
<p class="text-center text-muted py-4">Aucun contrat n'arrive à échéance prochainement.</p>
@else
<div class="timeline-wrapper">
<div class="timeline">
@foreach($upcomingContracts as $contract)
@php
$diffInDays = now()->startOfDay()->diffInDays($contract->end_date->startOfDay(), false);
$statusClass = 'normal';
if ($diffInDays < 0) {
$statusClass = 'expired';
} elseif ($diffInDays < 30) {
$statusClass = 'urgent';
} elseif ($diffInDays < 90) {
$statusClass = 'soon';
}
@endphp
<div class="timeline-item {{ $statusClass }}">
<!-- Date Label -->
<div class="timeline-date">
{{ $contract->end_date->format('d M Y') }}
<br>
<small class="{{ $diffInDays < 0 ? 'text-secondary' : ($diffInDays < 30 ? 'text-danger' : 'text-muted') }}">
@if($diffInDays < 0)
Expiré
@elseif($diffInDays == 0)
Aujourd'hui
@else
J-{{ $diffInDays }}
@endif
</small>
</div>
<!-- Dot on the line -->
<div class="timeline-dot" title="{{ $contract->status }}"></div>
<!-- Content Below -->
<a href="{{ route('contracts.show', $contract) }}" class="timeline-content text-start">
<h6 class="text-truncate" title="{{ $contract->name }}">{{ $contract->name }}</h6>
<small class="d-block text-secondary">{{ $contract->provider }}</small>
<span class="badge rounded-pill bg-light text-dark border mt-1">
{{ number_format($contract->amount, 0, ',', ' ') }} {{ $contract->currency }}
</span>
</a>
</div>
@endforeach
</div>
</div>
@endif
</div>
</div>
</div>
</div>
<div class="row">
<!-- Links Section -->
<div class="col-md-12 mb-4">
<div class="card shadow-sm">
<div class="card-header border-bottom-0">
<h5 class="mb-0 text-white">Ressources</h5>
</div>
<div class="card-body">
<div class="d-flex flex-wrap gap-3">
@forelse($links as $link)
<a href="{{ $link->url }}" target="_blank" class="btn btn-outline-{{ $link->color ?? 'primary' }} d-flex align-items-center gap-2">
@if($link->icon) <i class="bi {{ $link->icon }}"></i> @endif
{{ $link->title }}
</a>
@empty
<p class="text-muted mb-0">Aucun lien configuré.</p>
@endforelse
</div>
</div>
</div>
</div>
</div>
<div class="row">
<!-- Types Chart / Distribution (simplified list here) -->
<div class="col-md-6 mb-4">
<div class="card h-100 shadow-sm">
<div class="card-header border-bottom-0">
<h5 class="mb-0 text-white">Répartition par Type</h5>
</div>
<div class="card-body">
<ul class="list-group list-group-flush">
@foreach($contractStats['by_type'] as $type => $stat)
<li class="list-group-item d-flex justify-content-between align-items-center">
{{ ucfirst(str_replace('_', ' ', $type)) }}
<span class="badge bg-secondary pill">{{ $stat->count }}</span>
</li>
@endforeach
</ul>
</div>
</div>
</div>
<!-- Recent Activity -->
<div class="col-md-6 mb-4">
<div class="card h-100 shadow-sm">
<div class="card-header border-bottom-0">
<h5 class="mb-0 text-white">Dernières Activités (Audit Logs)</h5>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-striped mb-0 small">
<thead>
<tr>
<th>Action</th>
<th>Utilisateur</th>
<th>Temps</th>
</tr>
</thead>
<tbody>
@foreach($recentLogs as $log)
<tr>
<td>
<span class="d-block text-truncate" style="max-width: 150px;" title="{{ $log->description }}">
{{ $log->action }}
</span>
</td>
<td>{{ $log->user->name ?? 'Système' }}</td>
<td>{{ $log->created_at->diffForHumans() }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,15 @@
<h1>Alertes de Contrats</h1>
<p>Les contrats suivants arrivent à échéance dans les 30 jours :</p>
<ul>
@foreach($expiringContracts as $contract)
<li>
<strong>{{ $contract->name }}</strong> ({{ $contract->provider }}) -
Expire le : {{ \Carbon\Carbon::parse($contract->end_date)->format('d/m/Y') }}
<a href="{{ route('contracts.show', $contract->id) }}">Voir</a>
</li>
@endforeach
</ul>
<p>Merci,<br>DSIGEST</p>

View File

@@ -0,0 +1,121 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ config('app.name', 'DSIGEST') }}</title>
@vite(['resources/css/app.scss', 'resources/js/app.js'])
</head>
<body>
<div id="app">
<!-- Sidebar -->
<nav class="sidebar">
<div class="sidebar-brand">
<a class="text-decoration-none" href="{{ route('dashboard') }}">
<i class="bi bi-grid-fill me-2"></i> {{ config('app.name', 'DSIGEST') }}
</a>
</div>
<div class="d-flex flex-column py-3">
<div class="sidebar-heading">Menu</div>
<a class="nav-link {{ request()->routeIs('dashboard') ? 'active' : '' }}" href="{{ route('dashboard') }}">
<i class="bi bi-speedometer2"></i> Dashboard
</a>
<a class="nav-link {{ request()->routeIs('contracts.*') ? 'active' : '' }}" href="{{ route('contracts.index') }}">
<i class="bi bi-file-earmark-text"></i> Contrats
</a>
<a class="nav-link {{ request()->routeIs('municipalities.*') ? 'active' : '' }}" href="{{ route('municipalities.index') }}">
<i class="bi bi-building"></i> Communes
</a>
<a class="nav-link {{ request()->routeIs('cortex.*') ? 'active' : '' }}" href="{{ route('cortex.index') }}">
<i class="bi bi-shield-lock"></i> Cortex XDR
</a>
@auth
@if(auth()->user()->isAdmin())
<div class="sidebar-heading mt-3">Administration</div>
<a class="nav-link {{ request()->routeIs('admin.municipalities.*') ? 'active' : '' }}" href="{{ route('admin.municipalities.index') }}">
<i class="bi bi-gear"></i> Gérer Communes
</a>
<a class="nav-link {{ request()->routeIs('admin.license_levels.*') ? 'active' : '' }}" href="{{ route('admin.license_levels.index') }}">
<i class="bi bi-microsoft"></i> Licences M365
</a>
<a class="nav-link {{ request()->routeIs('admin.users.*') ? 'active' : '' }}" href="{{ route('admin.users.index') }}">
<i class="bi bi-people"></i> Utilisateurs
</a>
<a class="nav-link {{ request()->routeIs('admin.links.*') ? 'active' : '' }}" href="{{ route('admin.links.index') }}">
<i class="bi bi-link-45deg"></i> Gérer Liens
</a>
@endif
@endauth
</div>
</nav>
<!-- Main Content -->
<main class="main-content">
<!-- Topbar -->
<header class="topbar justify-content-between">
<div>
<!-- Breadcrumbs or Title could go here -->
<h4 class="mb-0 text-white">@yield('title', 'Dashboard')</h4>
</div>
<div class="d-flex align-items-center">
@guest
<a class="btn btn-primary btn-sm me-2" href="{{ route('login') }}">Connexion</a>
<a class="btn btn-outline-light btn-sm" href="{{ route('register') }}">Inscription</a>
@else
<div class="dropdown">
<a class="d-flex align-items-center text-white text-decoration-none dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
<i class="bi bi-person-circle fs-4 me-2"></i>
<span>{{ Auth::user()->name }}</span>
</a>
<ul class="dropdown-menu dropdown-menu-end bg-dark border-secondary">
<li>
<form action="{{ route('logout') }}" method="POST">
@csrf
<button type="submit" class="dropdown-item text-light hover-primary">
<i class="bi bi-box-arrow-right me-2"></i> Déconnexion
</button>
</form>
</li>
</ul>
</div>
@endguest
</div>
</header>
<!-- Page Content -->
<div class="container-fluid px-4 pb-4">
@if(session('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ session('success') }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
@endif
@if(session('error'))
<div class="alert alert-danger alert-dismissible fade show" role="alert">
{{ session('error') }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
@endif
@yield('content')
</div>
<!-- Footer -->
<footer class="mt-auto py-3 border-top border-secondary text-center small text-muted">
&copy; {{ date('Y') }} {{ config('app.name', 'DSIGEST') }}. Tous droits réservés.
</footer>
</main>
</div>
</body>
</html>

View File

@@ -0,0 +1,30 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h2 class="mb-4">Communes de l'Agglomération</h2>
<div class="row row-cols-1 row-cols-md-3 g-4">
@foreach($municipalities as $municipality)
<div class="col">
<div class="card h-100 shadow-sm hover-shadow">
<div class="card-body">
<h5 class="card-title">{{ $municipality->name }}</h5>
<p class="card-text text-muted">{{ $municipality->zip_code }}</p>
</div>
<div class="card-footer bg-white border-top-0">
<a href="{{ route('municipalities.show', $municipality) }}" class="btn btn-primary w-100">Voir la fiche</a>
</div>
</div>
</div>
@endforeach
</div>
</div>
<style>
.hover-shadow:hover {
box-shadow: 0 .5rem 1rem rgba(0,0,0,.15)!important;
transition: box-shadow 0.3s ease-in-out;
}
</style>
@endsection

View File

@@ -0,0 +1,90 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="mb-4 d-flex justify-content-between align-items-center">
<div>
<h2 class="mb-0">{{ $municipality->name }} <span class="text-muted fs-4">({{ $municipality->zip_code }})</span></h2>
<p class="text-muted">Fiche de synthèse</p>
</div>
<a href="{{ route('municipalities.index') }}" class="btn btn-outline-secondary">
<i class="bi bi-arrow-left"></i> Retour
</a>
</div>
<!-- M365 Statistics Card -->
<div class="card shadow-sm mb-5 border-primary">
<div class="card-header bg-primary text-white d-flex align-items-center">
<i class="bi bi-microsoft fs-4 me-2"></i>
<h5 class="mb-0">Licences Microsoft 365</h5>
</div>
<div class="card-body">
<div class="row text-center">
@foreach($m365Stats as $level => $count)
@if($count > 0)
<div class="col-md-2 mb-3">
<div class="p-3 border rounded bg-light">
<div class="text-muted small text-uppercase fw-bold mb-1">{{ $level }}</div>
<div class="fs-2 fw-bold text-primary">{{ $count }}</div>
<div class="small text-muted">Licences</div>
</div>
</div>
@endif
@endforeach
</div>
@if(array_sum($m365Stats) == 0)
<p class="text-center text-muted my-3">Aucune licence Microsoft 365 associée pour le moment.</p>
@endif
</div>
</div>
<!-- All Contracts List -->
<h4 class="mb-3">Liste des contrats</h4>
@if($contracts->isEmpty())
<div class="alert alert-info">
Aucun contrat associé à cette commune.
</div>
@else
<div class="card shadow-sm">
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="table-light">
<tr>
<th>Nom</th>
<th>Fournisseur</th>
<th>Type</th>
<th>État</th>
<th>Date fin</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($contracts as $contract)
<tr>
<td>{{ $contract->name }}</td>
<td>{{ $contract->provider }}</td>
<td><span class="badge bg-secondary">{{ $contract->type }}</span></td>
<td>
@if($contract->status == 'active')
<span class="badge bg-success">Actif</span>
@elseif($contract->status == 'expired')
<span class="badge bg-danger">Expiré</span>
@else
<span class="badge bg-warning text-dark">{{ $contract->status }}</span>
@endif
</td>
<td>{{ $contract->end_date ? $contract->end_date->format('d/m/Y') : '-' }}</td>
<td>
<a href="{{ route('contracts.show', $contract) }}" class="btn btn-sm btn-outline-primary">Voir</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
</div>
@endsection

File diff suppressed because one or more lines are too long