Ajout des nouveaux dossiers et fichiers, nettoyage des fichiers générés ensuite les nouveaux fichiers consiste à avoir la page de connexion et le dashboard

This commit is contained in:
2025-07-01 16:58:39 +02:00
parent fb719d95d7
commit 9f2669ec90
62 changed files with 19665 additions and 391 deletions

View File

@@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Mvc;
namespace BackendConnexion.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class AuthController : ControllerBase
{
[HttpPost("login")]
public IActionResult Login([FromBody] LoginModel model)
{
if (model.Email == "oimer@ensup.eu" && model.Password == "123456")
{
return Ok(new { token = "fake-jwt-token" });
}
return Unauthorized("Identifiants invalides");
}
}
public class LoginModel
{
public string Email { get; set; }
public string Password { get; set; }
}
}

View File

@@ -1,4 +0,0 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

View File

@@ -1,23 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
//
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("GestionConge")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6427e138814075879328043b3a21ceab77f7e4e4")]
[assembly: System.Reflection.AssemblyProductAttribute("GestionConge")]
[assembly: System.Reflection.AssemblyTitleAttribute("GestionConge")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Généré par la classe MSBuild WriteCodeFragment.

View File

@@ -1 +0,0 @@
64526a8a6f318db23e89b64316a089815a720708d5065bc7aacd33ff87e25289

View File

@@ -1,57 +0,0 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb = true
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = GestionConge
build_property.RootNamespace = GestionConge
build_property.ProjectDir = C:\Users\oimer\source\repos\GestionDemandeCongeV1\GestionConge\GestionConge\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.RazorLangVersion = 8.0
build_property.SupportLocalizedComponentNames =
build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = C:\Users\oimer\source\repos\GestionDemandeCongeV1\GestionConge\GestionConge
build_property._RazorSourceGeneratorDebug =
build_property.EffectiveAnalysisLevelStyle = 8.0
build_property.EnableCodeStyleSeverity =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/App.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xBcHAucmF6b3I=
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Pages/Counter.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xQYWdlc1xDb3VudGVyLnJhem9y
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Pages/Error.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xQYWdlc1xFcnJvci5yYXpvcg==
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Pages/Home.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xQYWdlc1xIb21lLnJhem9y
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Pages/Weather.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xQYWdlc1xXZWF0aGVyLnJhem9y
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Routes.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xSb3V0ZXMucmF6b3I=
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/_Imports.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xfSW1wb3J0cy5yYXpvcg==
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Layout/MainLayout.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xMYXlvdXRcTWFpbkxheW91dC5yYXpvcg==
build_metadata.AdditionalFiles.CssScope = b-96lz4cijzc
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Layout/NavMenu.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xMYXlvdXRcTmF2TWVudS5yYXpvcg==
build_metadata.AdditionalFiles.CssScope = b-37chbunwjv

View File

@@ -1,17 +0,0 @@
// <auto-generated/>
global using global::Microsoft.AspNetCore.Builder;
global using global::Microsoft.AspNetCore.Hosting;
global using global::Microsoft.AspNetCore.Http;
global using global::Microsoft.AspNetCore.Routing;
global using global::Microsoft.Extensions.Configuration;
global using global::Microsoft.Extensions.DependencyInjection;
global using global::Microsoft.Extensions.Hosting;
global using global::Microsoft.Extensions.Logging;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Net.Http.Json;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@@ -1 +0,0 @@
{"GlobalPropertiesHash":"U6ORIj+RIs0nPs4KHvP+7jJVJfOXGSbn6vtgfCMBwfA=","FingerprintPatternsHash":"gq3WsqcKBUGTSNle7RKKyXRIwh7M8ccEqOqYvIzoM04=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["\u002BmTmpskT7mF7xLbr7rw4Xq3b8rQ\u002BYSNUTiMUx\u002B6X5gQ=","5m9GKB9/mHnF91fRCS6gMrg/Tl5lCFXzog2vugjZCTc=","u5VLs3PoaHfbFihwunvYAWFJNMbzlQMLvnTKpNO04v0=","hUHxNi\u002BECMBjOmsWje5O0pGA1BFHmRzlbHTLpggV0dQ=","gRHL4Hsos20sSjrZsaCdG463E9VTOPe0\u002B4ybPSXXm8c=","Iquw6KtpLeWuj23wUGJfu0PamM8uIbS6OPD341Jhv9o=","yGHzbfQymQCy73UP6zodeEwCbSnkrxEgcj/OCLBl23c=","u0DhxQaZWLd5As4sFnyutGnvDa1FqbDeQ4qzG2d5OB0=","d7iXfJTkrSdxKNP4\u002B9cZN5ek\u002BQP5P4dSj91AXRu8oOc=","ZfiGz2KMeRn\u002BLNyazEWozgeFV9JLTYEFSXGJEcIoK6U=","rblfrhKFL/3M3xOSdp/VAP9OA7TPN8I1XJK/xwkKLgU=","dpRanhXsG4UBG53/4LPcQf7mvWihJRg6K5Gqzauah4g=","MSW5r6OJhOgbW\u002BM\u002BRyDyKXJggul5B2pT7oEYCvE1ARs=","C92Eo2ZUfjtSzkdQJfcwaWN7Lhn7daG\u002BDdYD2D7hcVM=","RUl\u002Baq8sirXoEeR7ykiwFhtk2foEYAKl7QUdw/joiGg=","Rdxhef12jBjpWPnvRiNN9O\u002BKNbTr7oMhA2eSkugcfXw=","QTB4OsZe\u002BS9IQhQ4HdEzCTo21pKDm/gairRWCq4ldso="],"CachedAssets":{"\u002BmTmpskT7mF7xLbr7rw4Xq3b8rQ\u002BYSNUTiMUx\u002B6X5gQ=":{"Identity":"C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\wwwroot\\app.css","SourceId":"GestionConge","SourceType":"Discovered","ContentRoot":"C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\wwwroot\\","BasePath":"_content/GestionConge","RelativePath":"app#[.{fingerprint}]?.css","AssetKind":"All","AssetMode":"All","AssetRole":"Primary","AssetMergeBehavior":null,"AssetMergeSource":"","RelatedAsset":null,"AssetTraitName":null,"AssetTraitValue":null,"Fingerprint":"da95v2qkru","Integrity":"u9qEka1auR7E3rd3/8/j8hkQdSOYj9bRJ4nYiFDR1sE=","CopyToOutputDirectory":"Never","CopyToPublishDirectory":"PreserveNewest","OriginalItemSpec":"wwwroot\\app.css","FileLength":2591,"LastWriteTime":"2025-06-26T07:45:07.334324+00:00"},"5m9GKB9/mHnF91fRCS6gMrg/Tl5lCFXzog2vugjZCTc=":{"Identity":"C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\wwwroot\\bootstrap\\bootstrap.min.css","SourceId":"GestionConge","SourceType":"Discovered","ContentRoot":"C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\wwwroot\\","BasePath":"_content/GestionConge","RelativePath":"bootstrap/bootstrap.min#[.{fingerprint}]?.css","AssetKind":"All","AssetMode":"All","AssetRole":"Primary","AssetMergeBehavior":null,"AssetMergeSource":"","RelatedAsset":null,"AssetTraitName":null,"AssetTraitValue":null,"Fingerprint":"bpk8xqwxhs","Integrity":"z8OR40MowJ8GgK6P89Y\u002BhiJK5\u002BcclzFHzLhFQLL92bg=","CopyToOutputDirectory":"Never","CopyToPublishDirectory":"PreserveNewest","OriginalItemSpec":"wwwroot\\bootstrap\\bootstrap.min.css","FileLength":162720,"LastWriteTime":"2025-06-26T07:45:07.471813+00:00"},"u5VLs3PoaHfbFihwunvYAWFJNMbzlQMLvnTKpNO04v0=":{"Identity":"C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\wwwroot\\bootstrap\\bootstrap.min.css.map","SourceId":"GestionConge","SourceType":"Discovered","ContentRoot":"C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\wwwroot\\","BasePath":"_content/GestionConge","RelativePath":"bootstrap/bootstrap.min.css#[.{fingerprint}]?.map","AssetKind":"All","AssetMode":"All","AssetRole":"Primary","AssetMergeBehavior":null,"AssetMergeSource":"","RelatedAsset":null,"AssetTraitName":null,"AssetTraitValue":null,"Fingerprint":"8inm30yfxf","Integrity":"gBwg2tmA0Ci2u54gMF1jNCVku6vznarkLS6D76htNNQ=","CopyToOutputDirectory":"Never","CopyToPublishDirectory":"PreserveNewest","OriginalItemSpec":"wwwroot\\bootstrap\\bootstrap.min.css.map","FileLength":449111,"LastWriteTime":"2025-06-26T07:45:07.4728143+00:00"},"hUHxNi\u002BECMBjOmsWje5O0pGA1BFHmRzlbHTLpggV0dQ=":{"Identity":"C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\wwwroot\\favicon.png","SourceId":"GestionConge","SourceType":"Discovered","ContentRoot":"C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\wwwroot\\","BasePath":"_content/GestionConge","RelativePath":"favicon#[.{fingerprint}]?.png","AssetKind":"All","AssetMode":"All","AssetRole":"Primary","AssetMergeBehavior":null,"AssetMergeSource":"","RelatedAsset":null,"AssetTraitName":null,"AssetTraitValue":null,"Fingerprint":"ifv42okdf2","Integrity":"4mWsDy3aHl36ZbGt8zByK7Pvd4kRUoNgTYzRnwmPHwg=","CopyToOutputDirectory":"Never","CopyToPublishDirectory":"PreserveNewest","OriginalItemSpec":"wwwroot\\favicon.png","FileLength":1148,"LastWriteTime":"2025-06-26T07:45:07.334324+00:00"}},"CachedCopyCandidates":{}}

View File

@@ -1,77 +0,0 @@
{
"format": 1,
"restore": {
"C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\GestionConge.csproj": {}
},
"projects": {
"C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\GestionConge.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\GestionConge.csproj",
"projectName": "GestionConge",
"projectPath": "C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\GestionConge.csproj",
"packagesPath": "C:\\Users\\oimer\\.nuget\\packages\\",
"outputPath": "C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\oimer\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.300"
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.AspNetCore.App": {
"privateAssets": "none"
},
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.301/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\oimer\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\oimer\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
</Project>

View File

@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@@ -1,4 +0,0 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

View File

@@ -1,23 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
//
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("GestionConge")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6427e138814075879328043b3a21ceab77f7e4e4")]
[assembly: System.Reflection.AssemblyProductAttribute("GestionConge")]
[assembly: System.Reflection.AssemblyTitleAttribute("GestionConge")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Généré par la classe MSBuild WriteCodeFragment.

View File

@@ -1 +0,0 @@
f7688ad8bdaa1c6254c57988ee354211cc5d82082acb1ecc3747d9bf4d070a2d

View File

@@ -1,57 +0,0 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb = true
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = GestionConge
build_property.RootNamespace = GestionConge
build_property.ProjectDir = C:\Users\oimer\source\repos\GestionDemandeCongeV1\GestionConge\GestionConge\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.RazorLangVersion = 8.0
build_property.SupportLocalizedComponentNames =
build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = C:\Users\oimer\source\repos\GestionDemandeCongeV1\GestionConge\GestionConge
build_property._RazorSourceGeneratorDebug =
build_property.EffectiveAnalysisLevelStyle = 8.0
build_property.EnableCodeStyleSeverity =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/App.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xBcHAucmF6b3I=
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Pages/Counter.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xQYWdlc1xDb3VudGVyLnJhem9y
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Pages/Error.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xQYWdlc1xFcnJvci5yYXpvcg==
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Pages/Home.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xQYWdlc1xIb21lLnJhem9y
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Pages/Weather.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xQYWdlc1xXZWF0aGVyLnJhem9y
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Routes.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xSb3V0ZXMucmF6b3I=
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/_Imports.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xfSW1wb3J0cy5yYXpvcg==
build_metadata.AdditionalFiles.CssScope =
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Layout/MainLayout.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xMYXlvdXRcTWFpbkxheW91dC5yYXpvcg==
build_metadata.AdditionalFiles.CssScope = b-96lz4cijzc
[C:/Users/oimer/source/repos/GestionDemandeCongeV1/GestionConge/GestionConge/Components/Layout/NavMenu.razor]
build_metadata.AdditionalFiles.TargetPath = Q29tcG9uZW50c1xMYXlvdXRcTmF2TWVudS5yYXpvcg==
build_metadata.AdditionalFiles.CssScope = b-37chbunwjv

View File

@@ -1,17 +0,0 @@
// <auto-generated/>
global using global::Microsoft.AspNetCore.Builder;
global using global::Microsoft.AspNetCore.Hosting;
global using global::Microsoft.AspNetCore.Http;
global using global::Microsoft.AspNetCore.Routing;
global using global::Microsoft.Extensions.Configuration;
global using global::Microsoft.Extensions.DependencyInjection;
global using global::Microsoft.Extensions.Hosting;
global using global::Microsoft.Extensions.Logging;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Net.Http.Json;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@@ -1,83 +0,0 @@
{
"version": 3,
"targets": {
"net8.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net8.0": []
},
"packageFolders": {
"C:\\Users\\oimer\\.nuget\\packages\\": {},
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\GestionConge.csproj",
"projectName": "GestionConge",
"projectPath": "C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\GestionConge.csproj",
"packagesPath": "C:\\Users\\oimer\\.nuget\\packages\\",
"outputPath": "C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\oimer\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.300"
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.AspNetCore.App": {
"privateAssets": "none"
},
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.301/PortableRuntimeIdentifierGraph.json"
}
}
}
}

View File

@@ -1,8 +0,0 @@
{
"version": 2,
"dgSpecHash": "WdBMKLr1mj4=",
"success": true,
"projectFilePath": "C:\\Users\\oimer\\source\\repos\\GestionConge\\GestionConge\\GestionConge.csproj",
"expectedPackageFiles": [],
"logs": []
}

157
api/getLeaveCounters.php Normal file
View File

@@ -0,0 +1,157 @@
<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, OPTIONS");
header("Access-Control-Allow-Headers: Content-Type");
// Gère la requête OPTIONS (pré-vol CORS)
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
http_response_code(200);
exit();
}
header("Content-Type: application/json");
$host = "192.168.0.4";
$dbname = "DemandeConge";
$username = "wpuser";
$password = "-2b/)ru5/Bi8P[7_";
// Crée une nouvelle connexion à la base de données
$conn = new mysqli($host, $username, $password, $dbname);
// Vérifie la connexion
if ($conn->connect_error) {
// En cas d'erreur de connexion, renvoie un JSON d'échec
echo json_encode(["success" => false, "message" => "Erreur de connexion à la base de données : " . $conn->connect_error]);
exit();
}
// Récupère l'ID utilisateur depuis les paramètres de requête GET
$userId = $_GET['user_id'] ?? null;
if ($userId === null) {
echo json_encode(["success" => false, "message" => "ID utilisateur manquant."]);
exit();
}
$currentYear = date('Y'); // Année actuelle pour CompteurConges
$currentDate = date('Y-m-d'); // Date actuelle pour les filtres de demandes
// Variables pour les soldes disponibles
$cpSolde = 0;
$rttSolde = 0;
$absSolde = 0; // Solde pour 'Congé maladie'
// Variables pour les demandes en cours/validées
$rttInProcess = 0;
$absenteism = 0;
$queryCPSolde = "SELECT cc.Solde FROM CompteurConges cc
JOIN TypeConge tc ON cc.TypeCongeId = tc.Id
WHERE cc.EmployeeId = ? AND tc.Nom = 'Congé payé' AND cc.Annee = ?";
$stmtCPSolde = $conn->prepare($queryCPSolde);
if ($stmtCPSolde === false) {
error_log("Erreur de préparation de la requête CP Solde : " . $conn->error);
} else {
$stmtCPSolde->bind_param("ii", $userId, $currentYear);
$stmtCPSolde->execute();
$resultCPSolde = $stmtCPSolde->get_result();
if ($rowCPSolde = $resultCPSolde->fetch_assoc()) {
$cpSolde = $rowCPSolde['Solde'];
}
$stmtCPSolde->close();
}
$queryRTTSolde = "SELECT cc.Solde FROM CompteurConges cc
JOIN TypeConge tc ON cc.TypeCongeId = tc.Id
WHERE cc.EmployeeId = ? AND tc.Nom = 'RTT' AND cc.Annee = ?";
$stmtRTTSolde = $conn->prepare($queryRTTSolde);
if ($stmtRTTSolde === false) {
error_log("Erreur de préparation de la requête RTT Solde : " . $conn->error);
} else {
$stmtRTTSolde->bind_param("ii", $userId, $currentYear);
$stmtRTTSolde->execute();
$resultRTTSolde = $stmtRTTSolde->get_result();
if ($rowRTTSolde = $resultRTTSolde->fetch_assoc()) {
$rttSolde = $rowRTTSolde['Solde'];
}
$stmtRTTSolde->close();
}
$queryABSSolde = "SELECT cc.Solde FROM CompteurConges cc
JOIN TypeConge tc ON cc.TypeCongeId = tc.Id
WHERE cc.EmployeeId = ? AND tc.Nom = 'Congé maladie' AND cc.Annee = ?";
$stmtABSSolde = $conn->prepare($queryABSSolde);
if ($stmtABSSolde === false) {
error_log("Erreur de préparation de la requête ABS Solde : " . $conn->error);
} else {
$stmtABSSolde->bind_param("ii", $userId, $currentYear);
$stmtABSSolde->execute();
$resultABSSolde = $stmtABSSolde->get_result();
if ($rowABSSolde = $resultABSSolde->fetch_assoc()) {
$absSolde = $rowABSSolde['Solde'];
}
$stmtABSSolde->close();
}
// --- Calcul des RTT en cours (somme des jours DATEDIFF à partir de DemandeConge) ---
$queryRTTInProcess = "SELECT SUM(DATEDIFF(dc.DateFin, dc.DateDebut) + 1) AS total_rtt_en_cours FROM DemandeConge dc
JOIN TypeConge tc ON dc.TypeCongeId = tc.Id
WHERE dc.EmployeeId = ?
AND tc.Nom = 'RTT'
AND dc.Statut IN ('En attente', 'Validée')
AND dc.DateFin >= ?";
$stmtRTTInProcess = $conn->prepare($queryRTTInProcess);
if ($stmtRTTInProcess === false) {
error_log("Erreur de préparation de la requête RTT en cours : " . $conn->error);
} else {
$stmtRTTInProcess->bind_param("is", $userId, $currentDate);
$stmtRTTInProcess->execute();
$resultRTTInProcess = $stmtRTTInProcess->get_result();
if ($rowRTTInProcess = $resultRTTInProcess->fetch_assoc()) {
$rttInProcess = $rowRTTInProcess['total_rtt_en_cours'] ?? 0;
}
$stmtRTTInProcess->close();
}
// --- Calcul des jours d'absence (ABS) (somme des jours DATEDIFF à partir de DemandeConge) ---
$queryABSInProcess = "SELECT SUM(DATEDIFF(dc.DateFin, dc.DateDebut) + 1) AS total_abs FROM DemandeConge dc
JOIN TypeConge tc ON dc.TypeCongeId = tc.Id
WHERE dc.EmployeeId = ?
AND tc.Nom = 'Congé maladie'
AND dc.Statut = 'Validée'";
$stmtABSInProcess = $conn->prepare($queryABSInProcess);
if ($stmtABSInProcess === false) {
error_log("Erreur de préparation de la requête ABS en cours : " . $conn->error);
} else {
$stmtABSInProcess->bind_param("i", $userId);
$stmtABSInProcess->execute();
$resultABSInProcess = $stmtABSInProcess->get_result();
if ($rowABSInProcess = $resultABSInProcess->fetch_assoc()) {
$absenteism = $rowABSInProcess['total_abs'] ?? 0;
}
$stmtABSInProcess->close();
}
// Renvoie les compteurs sous format JSON
echo json_encode([
"success" => true,
"message" => "Compteurs récupérés avec succès.",
"counters" => [
"availableCP" => (int)$cpSolde,
"availableRTT" => (int)$rttSolde,
"availableABS" => (int)$absSolde,
"rttInProcess" => (int)$rttInProcess,
"absenteism" => (int)$absenteism
]
]);
$conn->close();
?>

73
api/login.php Normal file
View File

@@ -0,0 +1,73 @@
<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST, OPTIONS");
header("Access-Control-Allow-Headers: Content-Type");
// Gère la requête OPTIONS (pré-vol CORS)
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
http_response_code(200);
exit();
}
header("Content-Type: application/json");
$host = "192.168.0.4";
$dbname = "DemandeConge";
$username = "wpuser";
$password = "-2b/)ru5/Bi8P[7_";
// Crée une nouvelle connexion à la base de données
$conn = new mysqli($host, $username, $password, $dbname);
// Vérifie la connexion
if ($conn->connect_error) {
// En cas d'erreur de connexion, renvoie un JSON d'échec
die(json_encode(["success" => false, "message" => "Erreur de connexion à la base de données : " . $conn->connect_error]));
}
// Récupère les données JSON envoyées via la requête POST
$data = json_decode(file_get_contents('php://input'), true);
$email = $data['email'] ?? '';
$mot_de_passe = $data['mot_de_passe'] ?? '';
$query = "SELECT ID, Prenom, Nom, Email FROM Users WHERE Email = ? AND MDP = ?";
$stmt = $conn->prepare($query);
// Vérifie si la préparation de la requête a réussi
if ($stmt === false) {
die(json_encode(["success" => false, "message" => "Erreur de préparation de la requête : " . $conn->error]));
}
// Lie les paramètres (ss = string, string pour email et mot_de_passe)
$stmt->bind_param("ss", $email, $mot_de_passe);
$stmt->execute();
// Récupère le résultat de la requête
$result = $stmt->get_result();
// Vérifie si un utilisateur correspondant a été trouvé
if ($result->num_rows === 1) {
// Récupère la ligne de l'utilisateur sous forme de tableau associatif
$user = $result->fetch_assoc();
// Renvoie une réponse JSON de succès avec les données de l'utilisateur
echo json_encode([
"success" => true,
"message" => "Connexion réussie.",
"user" => [
"id" => $user['ID'],
"prenom" => $user['Prenom'],
"nom" => $user['Nom'],
"email" => $user['Email']
]
]);
} else {
// Renvoie une réponse JSON d'échec si les identifiants sont incorrects
echo json_encode(["success" => false, "message" => "Identifiants incorrects."]);
}
// Ferme la connexion à la base de données
$stmt->close();
$conn->close();
?>

148
api/submitLeaveRequest.php Normal file
View File

@@ -0,0 +1,148 @@
<?php
// Active l'affichage des erreurs pour le dev
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST, OPTIONS");
header("Access-Control-Allow-Headers: Content-Type");
// Gère le pré-vol CORS
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
http_response_code(200);
exit();
}
header("Content-Type: application/json");
// --- Paramètres de connexion ---
$host = "192.168.0.4";
$dbname = "DemandeConge";
$username = "wpuser";
$password = "-2b/)ru5/Bi8P[7_";
// Connexion
$conn = new mysqli($host, $username, $password, $dbname);
if ($conn->connect_error) {
echo json_encode([
"success" => false,
"message" => "Erreur de connexion DB : " . $conn->connect_error
]);
exit();
}
// Lecture du JSON envoyé
$input = file_get_contents('php://input');
$data = json_decode($input, true);
if (!isset(
$data['EmployeeId'],
$data['TypeConge'],
$data['DateDebut'],
$data['DateFin'],
$data['NumDays']
)) {
echo json_encode([
"success" => false,
"message" => "Données manquantes pour la demande de congé."
]);
exit();
}
// Récupération des champs
$employeeId = (int) $data['EmployeeId'];
$typeCongeNom= $data['TypeConge'];
$dateDebut = $data['DateDebut'];
$dateFin = $data['DateFin'];
$commentaire = $data['Commentaire'] ?? '';
$numDays = (int) $data['NumDays'];
$statut = 'En attente';
$validateur = null;
$currentDate= date('Y-m-d'); // date complète pour DateDemande
// Mapping frontend → DB
switch ($typeCongeNom) {
case 'CP': $dbTypeCongeName = 'Congé payé'; break;
case 'RTT': $dbTypeCongeName = 'RTT'; break;
case 'ABS': $dbTypeCongeName = 'Congé maladie'; break;
default:
echo json_encode([
"success" => false,
"message" => "Type de congé inconnu."
]);
$conn->close();
exit();
}
// Récupération de l'ID du type de congé
$stmt = $conn->prepare("SELECT Id FROM TypeConge WHERE Nom = ?");
$stmt->bind_param("s", $dbTypeCongeName);
$stmt->execute();
$res = $stmt->get_result();
if ($row = $res->fetch_assoc()) {
$typeCongeId = (int) $row['Id'];
} else {
echo json_encode([
"success" => false,
"message" => "Type de congé non trouvé en DB : $dbTypeCongeName"
]);
$stmt->close();
$conn->close();
exit();
}
$stmt->close();
// Requête d'insertion avec DateDemande explicitement dans l'insert
$query = "
INSERT INTO DemandeConge
(EmployeeId, DateDebut, DateFin, TypeCongeId, Statut, DateDemande, Commentaire, Validateur)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?)
";
// Préparation de la requête
$stmt = $conn->prepare($query);
if (!$stmt) {
error_log("Erreur prepare insert : " . $conn->error);
echo json_encode([
"success" => false,
"message" => "Erreur interne lors de la préparation de la requête."
]);
$conn->close();
exit();
}
// Pour la colonne Validateur, on passe '' si null
$validParam = $validateur ?? '';
// Bind des paramètres (types : i=integer, s=string)
$stmt->bind_param(
"ississss",
$employeeId, // i
$dateDebut, // s
$dateFin, // s
$typeCongeId, // i
$statut, // s
$currentDate, // s - DateDemande
$commentaire, // s
$validParam // s
);
// Exécution
if ($stmt->execute()) {
echo json_encode([
"success" => true,
"message" => "Demande de congé soumise avec succès."
]);
} else {
error_log("Erreur execute insert : " . $stmt->error);
echo json_encode([
"success" => false,
"message" => "Erreur lors de l'enregistrement : " . $stmt->error
]);
}
$stmt->close();
$conn->close();

14
api/test_db.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
$host = "192.168.0.4";
$dbname = "DemandeConge";
$username = "wpuser";
$password = "-2b/)ru5/Bi8P[7_";
$conn = new mysqli($host, $username, $password, $dbname);
if ($conn->connect_error) {
die("❌ Connexion échouée : " . $conn->connect_error);
}
echo "✅ Connexion réussie à la base de données !";
?>

23
client-connexion/.gitignore vendored Normal file
View File

@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@@ -0,0 +1,70 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

17627
client-connexion/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,41 @@
{
"name": "client-connexion",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.10.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.30.1",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Mes Congés</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

View File

@@ -0,0 +1,2 @@
<link href="https://fonts.googleapis.com/css2?family=Ribeye&display=swap" rel="stylesheet">

View File

@@ -0,0 +1,38 @@
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

View File

@@ -0,0 +1,43 @@
import React from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import LoginPage from './pages/LoginPage';
// Correction ici : 'Dashboard' devient 'DashboardPage' pour correspondre au nom du fichier
import DashboardPage from './pages/Dashboard';
import { AuthProvider, useAuth } from './context/AuthContext'; // Importez AuthProvider et useAuth
// Composant pour protéger les routes nécessitant une authentification
const PrivateRoute = ({ children }) => {
const { user } = useAuth(); // Récupère l'utilisateur depuis le contexte d'authentification
// Si l'utilisateur est connecté, affiche les enfants (le composant de la route)
// Sinon, redirige vers la page de connexion
return user ? children : <Navigate to="/" />;
};
function App() {
return (
// Enveloppez toute l'application (ou au moins le Router) avec AuthProvider
<AuthProvider>
<Router>
<Routes>
{/* Route pour la page de connexion */}
<Route path="/" element={<LoginPage />} />
{/* Route pour le tableau de bord (protégée) */}
{/* Le composant PrivateRoute s'assure que seul un utilisateur connecté peut y accéder */}
<Route
path="/dashboard"
element={
<PrivateRoute>
<DashboardPage /> {/* Utilise le nom correct du composant */}
</PrivateRoute>
}
/>
{/* Vous pouvez ajouter d'autres routes publiques ou protégées ici */}
</Routes>
</Router>
</AuthProvider>
);
}
export default App;

View File

@@ -0,0 +1,8 @@
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@@ -0,0 +1,20 @@
.app-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20px;
border-bottom: 1px solid #eee;
margin-bottom: 30px;
}
.header-title {
font-family: 'Ribeye', cursive;
font-size: 2.2em;
color: #333;
margin: 0;
}
.ensup-logo {
height: 60px;
width: auto;
}

View File

@@ -0,0 +1,12 @@
import React from 'react';
import './Header.css';
export default function Header() {
return (
<header className="app-header">
<h1 className="header-title">Mes Cong&eacute;s</h1>
<img src="/Assets/Logo.png" alt="ENSUP Business School Logo" className="ensup-logo" />
</header>
);
}

View File

@@ -0,0 +1,49 @@
.leave-counters-section {
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #eee;
}
.counters-grid {
display: flex; /* Utilise flexbox pour aligner les compteurs */
justify-content: space-around; /* Espace les éléments uniformément */
align-items: flex-end; /* Aligne les éléments en bas (pour "Période en cours") */
gap: 20px; /* Espace entre les compteurs */
}
.counter-item {
display: flex;
flex-direction: column;
align-items: center;
background-color: #f0f0f0;
padding: 15px 25px;
border-radius: 10px;
min-width: 100px;
}
.counter-item.period-in-progress {
background-color: #d1e7dd;
position: relative;
padding-top: 35px;
}
.period-label {
position: absolute;
top: 5px;
font-size: 0.8em;
font-weight: bold;
color: #5a467e;
}
.counter-value {
font-size: 2.2em;
font-weight: bold;
color: #7b5ca8;
margin-bottom: 5px;
}
.counter-label {
font-size: 1em;
font-weight: 600;
color: #555;
}

View File

@@ -0,0 +1,47 @@
import React from 'react';
import './LeaveCounters.css';
export default function LeaveCounters({ availableCP, rttInProcess, absenteism, isLoading, error }) {
if (isLoading) {
return (
<div className="leave-counters-section">
<h2 className="section-title">Mes Compteurs absences et congés</h2>
<div className="counters-grid">
<p>Chargement des compteurs...</p>
</div>
</div>
);
}
if (error) {
return (
<div className="leave-counters-section">
<h2 className="section-title">Mes Compteurs absences et congés</h2>
<div className="counters-grid">
<p className="error-message">Erreur : {error}</p>
</div>
</div>
);
}
return (
<div className="leave-counters-section">
<h2 className="section-title">Mes Compteurs absences et congés</h2>
<div className="counters-grid">
<div className="counter-item">
<span className="counter-value">{availableCP}</span>
<span className="counter-label">CP</span>
</div>
<div className="counter-item period-in-progress">
<span className="period-label">Période en cours</span>
<span className="counter-value">{rttInProcess}</span>
<span className="counter-label">RTT</span>
</div>
<div className="counter-item">
<span className="counter-value">{absenteism}</span>
<span className="counter-label">ABS</span>
</div>
</div>
</div>
);
}

View File

@@ -0,0 +1,131 @@
.my-calendar-section {
margin-bottom: 30px;
}
.calendar-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
font-size: 1.2em;
font-weight: bold;
color: #555;
}
.calendar-nav {
cursor: pointer;
font-size: 1.5em;
padding: 0 10px;
user-select: none;
}
.calendar-nav:hover {
color: #7b5ca8;
}
.calendar-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 5px;
text-align: center;
}
.calendar-weekday {
font-weight: bold;
color: #7b5ca8;
padding: 8px 0;
font-size: 0.9em;
}
.calendar-day {
padding: 10px 5px;
border-radius: 5px;
background-color: #f0f0f0;
min-height: 50px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 0.9em;
/* --- IMPORTANT : Rendre cliquable visuellement --- */
cursor: pointer; /* Le curseur change pour indiquer que c'est cliquable */
transition: background-color 0.2s ease; /* Animation fluide au survol */
}
.calendar-day.empty {
background-color: transparent;
visibility: hidden;
cursor: default; /* Les jours vides ne sont pas cliquables */
}
.calendar-day:not(.empty):hover { /* Applique le style de survol seulement aux jours non-vides */
background-color: #e6e6fa; /* Légère couleur au survol */
box-shadow: 0 0 5px rgba(123, 92, 168, 0.3); /* Légère ombre */
}
.calendar-day:not(.empty):active { /* Style quand le bouton est pressé */
background-color: #d1c1eb;
}
.calendar-day.special-day {
background-color: #a7d9ef;
font-weight: bold;
color: #333;
border: 1px solid #7b5ca8;
}
.special-day-label {
font-size: 0.7em;
color: #444;
margin-top: 3px;
line-height: 1.2;
}
.calendar-day.today {
background-color: #ffe0b2;
border: 2px solid #ff9800;
font-weight: bold;
color: #333;
}
.calendar-day.past-day {
background-color: #e0e0e0;
color: #999;
cursor: not-allowed;
pointer-events: none;
opacity: 0.7;
}
.calendar-day.past-day:hover {
background-color: #e0e0e0;
box-shadow: none;
}
.calendar-nav.disabled {
color: #ccc;
cursor: not-allowed;
opacity: 0.5;
}
.calendar-nav.disabled:hover {
color: #ccc;
}
.calendar-day.selected-range {
background-color: #a7d9ef;
border: 2px solid #007bff;
color: #333;
font-weight: bold;
}
.calendar-day.selected-range.today {
background-color: #90caf9;
border-color: #1976d2;
}

View File

@@ -0,0 +1,179 @@
import React, { useState, useEffect } from 'react';
import './MyCalendar.css';
export default function MyCalendar({ onDaySelect, selectedDateRange, onClearSelection }) {
// Initialiser le calendrier à la date actuelle par défaut si aucune date n'est en cours
const [currentDate, setCurrentDate] = useState(new Date());
const today = new Date();
today.setHours(0, 0, 0, 0);
const [publicHolidays, setPublicHolidays] = useState({});
const weekdays = ['D', 'L', 'Ma', 'Me', 'J', 'V', 'S'];
const monthNames = [
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin",
"Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
];
const year = currentDate.getFullYear();
const month = currentDate.getMonth();
useEffect(() => {
const fetchPublicHolidays = async (yearToFetch) => {
try {
const response = await fetch(`https://calendrier.api.gouv.fr/jours-feries/metropole/${yearToFetch}.json`);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
setPublicHolidays(data);
} catch (error) {
console.error("Erreur lors de la récupération des jours fériés :", error);
setPublicHolidays({});
}
};
fetchPublicHolidays(year);
}, [year]);
const isPublicHoliday = (day) => {
if (day === null) return false;
const dateString = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
return publicHolidays.hasOwnProperty(dateString);
};
const firstDayOfMonth = new Date(year, month, 1).getDay();
const daysInMonth = new Date(year, month + 1, 0).getDate();
const calendarDays = [];
for (let i = 0; i < firstDayOfMonth; i++) {
calendarDays.push(null);
}
for (let i = 1; i <= daysInMonth; i++) {
calendarDays.push(i);
}
const handlePrevMonth = () => {
setCurrentDate(prevDate => {
const newDate = new Date(prevDate);
newDate.setMonth(newDate.getMonth() - 1);
// Empêche de revenir avant le mois actuel si aujourd'hui est dans ce mois
if (newDate.getFullYear() < today.getFullYear() || (newDate.getFullYear() === today.getFullYear() && newDate.getMonth() < today.getMonth())) {
return prevDate; // Reste sur le mois actuel
}
return newDate;
});
if (onClearSelection) onClearSelection();
};
const handleNextMonth = () => {
setCurrentDate(prevDate => {
const newDate = new Date(prevDate);
newDate.setMonth(newDate.getMonth() + 1);
return newDate;
});
if (onClearSelection) onClearSelection();
};
const isPastDay = (day) => {
if (day === null) return false;
const currentDay = new Date(year, month, day);
currentDay.setHours(0, 0, 0, 0);
if (year < today.getFullYear()) return true;
if (year === today.getFullYear() && month < today.getMonth()) return true;
if (year === today.getFullYear() && month === today.getMonth() && day < today.getDate()) {
return true;
}
return false;
};
const isToday = (day) => {
if (day === null) return false;
return day === today.getDate() && month === today.getMonth() && year === today.getFullYear();
};
const handleDayClick = (day) => {
if (day === null || isPastDay(day)) return;
const clickedDate = new Date(year, month, day);
if (onDaySelect) {
onDaySelect(clickedDate);
}
};
const isDayInSelectedRange = (day) => {
if (day === null || selectedDateRange.length === 0) return false;
const currentDayDate = new Date(year, month, day);
currentDayDate.setHours(0, 0, 0, 0);
const start = selectedDateRange[0] instanceof Date ? new Date(selectedDateRange[0].getFullYear(), selectedDateRange[0].getMonth(), selectedDateRange[0].getDate()) : null;
const end = selectedDateRange[1] instanceof Date ? new Date(selectedDateRange[1].getFullYear(), selectedDateRange[1].getMonth(), selectedDateRange[1].getDate()) : null;
if (start) start.setHours(0, 0, 0, 0);
if (end) end.setHours(0, 0, 0, 0);
if (selectedDateRange.length === 1) {
return start && currentDayDate.getTime() === start.getTime();
} else if (selectedDateRange.length === 2) {
return start && end && currentDayDate.getTime() >= start.getTime() && currentDayDate.getTime() <= end.getTime();
}
return false;
};
return (
<div className="my-calendar-section">
<h2 className="section-title">Mon calendrier</h2>
<div className="calendar-header">
<span
className={`calendar-nav ${year < today.getFullYear() || (year === today.getFullYear() && month <= today.getMonth()) ? 'disabled' : ''}`}
onClick={year < today.getFullYear() || (year === today.getFullYear() && month <= today.getMonth()) ? null : handlePrevMonth}
>
&lt;
</span>
<span className="calendar-month-year">
{monthNames[month]} {year}
</span>
<span className="calendar-nav" onClick={handleNextMonth}>&gt;</span>
</div>
<div className="calendar-grid">
{weekdays.map((day, index) => (
<div key={index} className="calendar-weekday">{day}</div>
))}
{calendarDays.map((day, index) => {
const holidayInfo = isPublicHoliday(day) ? publicHolidays[`${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`] : '';
const past = isPastDay(day);
const todayClass = isToday(day);
const isInRange = isDayInSelectedRange(day);
return (
<div
key={index}
className={`calendar-day
${day === null ? 'empty' : ''}
${holidayInfo ? 'public-holiday' : ''}
${past ? 'past-day' : ''} {/* Ajout de la classe pour les jours passés */}
${todayClass ? 'today' : ''} {/* Ajout de la classe pour aujourd'hui */}
${isInRange ? 'selected-range' : ''}
`}
onClick={past ? null : () => handleDayClick(day)}
>
{day}
{holidayInfo && <div className="holiday-label">{holidayInfo}</div>}
</div>
);
})}
</div>
</div>
);
}

View File

@@ -0,0 +1,40 @@
.new-leave-request-form {
width: 100%;
max-width: 400px;
background-color: #e0f2f7;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
margin-top: 20px;
position: relative;
}
.close-button {
position: absolute;
top: 10px;
right: 10px;
background: none;
border: none;
font-size: 2em;
color: #777;
cursor: pointer;
line-height: 1;
padding: 5px;
transition: color 0.2s ease;
}
.close-button:hover {
color: #333;
}
.form-title {
font-size: 1.8em;
font-weight: bold;
color: #333;
margin-bottom: 25px;
text-align: center;
}

View File

@@ -0,0 +1,235 @@
import React, { useState, useEffect } from 'react';
import './NewLeaveRequestForm.css';
export default function NewLeaveRequestForm({ startDate, endDate, onClose, availableLeaveCounters, userId }) {
const [leaveType, setLeaveType] = useState('CP');
const [formStartDate, setFormStartDate] = useState('');
const [formEndDate, setFormEndDate] = useState('');
const [comment, setComment] = useState('');
const [numDays, setNumDays] = useState('');
const [error, setError] = useState('');
const formatLocalDateToYYYYMMDD = (dateObject) => {
if (!dateObject) return '';
const year = dateObject.getFullYear();
const month = (dateObject.getMonth() + 1).toString().padStart(2, '0');
const day = dateObject.getDate().toString().padStart(2, '0');
return `${year}-${month}-${day}`;
};
useEffect(() => {
if (startDate) {
setFormStartDate(formatLocalDateToYYYYMMDD(startDate));
}
if (endDate) {
setFormEndDate(formatLocalDateToYYYYMMDD(endDate));
} else if (startDate) {
setFormEndDate(formatLocalDateToYYYYMMDD(startDate));
}
}, [startDate, endDate]);
useEffect(() => {
if (formStartDate && formEndDate) {
const start = new Date(formStartDate);
const end = new Date(formEndDate);
if (end < start) {
setError("La date de fin ne peut pas être antérieure à la date de début.");
setNumDays('');
return;
}
let totalWorkingDays = 0;
let currentDate = new Date(start);
while (currentDate <= end) {
const dayOfWeek = currentDate.getDay();
if (dayOfWeek !== 0 && dayOfWeek !== 6) {
totalWorkingDays++;
}
currentDate.setDate(currentDate.getDate() + 1);
}
setNumDays(totalWorkingDays);
setError('');
} else {
setNumDays('');
setError('');
}
}, [formStartDate, formEndDate]);
const handleSubmit = async (e) => {
e.preventDefault();
setError('');
if (!formStartDate || !formEndDate) {
setError("Veuillez sélectionner les dates de début et de fin.");
return;
}
const start = new Date(formStartDate);
const end = new Date(formEndDate);
if (end < start) {
setError("La date de fin ne peut pas être antérieure à la date de début.");
return;
}
if (isNaN(numDays) || numDays <= 0) {
setError("Le nombre de jours demandés doit être un nombre positif.");
return;
}
let hasEnoughDays = true;
let errorMessage = '';
switch (leaveType) {
case 'CP':
if (numDays > availableLeaveCounters.availableCP) {
hasEnoughDays = false;
errorMessage = `Vous n'avez pas assez de jours de Congé Payé. Il vous reste ${availableLeaveCounters.availableCP} jours.`;
}
break;
case 'RTT':
if (numDays > availableLeaveCounters.availableRTT) {
hasEnoughDays = false;
errorMessage = `Vous n'avez pas assez de jours de RTT. Il vous reste ${availableLeaveCounters.availableRTT} jours.`;
}
break;
case 'ABS':
if (numDays > availableLeaveCounters.availableABS) {
hasEnoughDays = false;
errorMessage = `Vous n'avez pas assez de jours d'Absence (Maladie). Il vous reste ${availableLeaveCounters.availableABS} jours.`;
}
break;
default:
errorMessage = "Type de congé inconnu.";
hasEnoughDays = false;
}
if (!hasEnoughDays) {
setError(errorMessage);
return;
}
const payload = {
EmployeeId: userId,
TypeConge: leaveType,
DateDebut: formStartDate,
DateFin: formEndDate,
Commentaire: comment,
NumDays: numDays
};
console.log("Payload envoyé au backend :", payload);
try {
const response = await fetch('http://localhost/GestionDemandeCongeV1/api/submitLeaveRequest.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
});
const text = await response.text();
console.log('Réponse brute du serveur :', text);
try {
const data = JSON.parse(text);
if (data.success) {
alert('Demande de congé soumise avec succès et en attente de validation par le manager !');
setLeaveType('CP');
setFormStartDate('');
setFormEndDate('');
setComment('');
setNumDays('');
if (onClose) {
onClose();
}
} else {
setError(data.message || "Erreur lors de la soumission de la demande.");
}
} catch (jsonError) {
console.error("Réponse invalide (pas du JSON) :", text);
setError("Réponse du serveur invalide. Consulte la console pour plus de détails.");
}
} catch (error) {
console.error('Erreur réseau ou du serveur lors de la soumission:', error);
setError("Erreur de connexion au serveur. Veuillez vérifier que le serveur est démarré.");
}
};
return (
<div className="new-leave-request-form">
<button className="close-button" onClick={onClose}>&times;</button>
<h2 className="form-title">Nouvelle demande de congé</h2>
<form onSubmit={handleSubmit}>
<div className="form-group">
<label htmlFor="leaveType">Type de congés</label>
<select
id="leaveType"
value={leaveType}
onChange={(e) => setLeaveType(e.target.value)}
>
<option value="CP">CP</option>
<option value="RTT">RTT</option>
<option value="ABS">ABS</option>
</select>
</div>
<div className="form-group date-group">
<div>
<label htmlFor="formStartDate">Date de début</label>
<input
type="date"
id="formStartDate"
value={formStartDate}
onChange={(e) => setFormStartDate(e.target.value)}
required
/>
</div>
<div>
<label htmlFor="formEndDate">Date de fin</label>
<input
type="date"
id="formEndDate"
value={formEndDate}
onChange={(e) => setFormEndDate(e.target.value)}
required
/>
</div>
</div>
{error && <p className="error-message">{error}</p>}
<div className="form-group">
<label htmlFor="comment">Commentaire</label>
<textarea
id="comment"
rows="4"
value={comment}
onChange={(e) => setComment(e.target.value)}
></textarea>
</div>
<div className="form-group num-days-group">
<label htmlFor="numDays">Nombre de jours demandés</label>
<input
type="number"
id="numDays"
value={numDays}
readOnly
disabled={!formStartDate || !formEndDate}
/>
</div>
<button type="submit" className="validate-button">Valider</button>
</form>
</div>
);
}

View File

@@ -0,0 +1,17 @@
.welcome-section {
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 1px solid #eee;
}
.welcome-greeting {
font-size: 1.8em;
font-weight: bold;
color: #333;
margin-bottom: 5px;
}
.welcome-message {
font-size: 1em;
color: #666;
}

View File

@@ -0,0 +1,18 @@
import React from 'react';
import './WelcomeSections.css';
import { useAuth } from '../context/AuthContext';
export default function WelcomeSection() {
const { user } = useAuth();
const displayPrenom = user ? user.prenom : "Cher";
const displayNom = user ? user.nom : "Utilisateur";
return (
<div className="welcome-section">
<p className="welcome-greeting">Bonjour {displayPrenom} {displayNom}</p>
<p className="welcome-message">Bienvenue sur votre espace de gestion de congés</p>
</div>
);
}

View File

@@ -0,0 +1,57 @@
import React, { createContext, useState, useContext, useEffect } from 'react';
// 1. Crée le contexte d'authentification
export const AuthContext = createContext(null);
// 2. Crée un composant fournisseur d'authentification
export const AuthProvider = ({ children }) => {
// État pour stocker les informations de l'utilisateur (null si non connecté)
// En production, vous voudriez vérifier localStorage pour un token/utilisateur ici
const [user, setUser] = useState(null);
// Simulation de connexion/déconnexion
// En réalité, cette fonction ferait un appel API à votre backend
const login = (userData) => {
// Sauvegarder l'utilisateur dans le state
setUser(userData);
// Optionnel: sauvegarder les infos de l'utilisateur (ou un token) dans localStorage
// pour maintenir la session après un rafraîchissement de page
localStorage.setItem('user', JSON.stringify(userData));
};
const logout = () => {
setUser(null);
// Nettoyer localStorage
localStorage.removeItem('user');
};
// Charger l'utilisateur depuis localStorage au démarrage de l'application
useEffect(() => {
const storedUser = localStorage.getItem('user');
if (storedUser) {
setUser(JSON.parse(storedUser));
}
}, []); // Le tableau vide assure que cela ne s'exécute qu'une seule fois au montage
// La valeur qui sera fournie à tous les consommateurs du contexte
const authContextValue = {
user, // L'objet utilisateur (ex: { name: "Ouijdane IMER", email: "..." })
login, // Fonction pour connecter un utilisateur
logout, // Fonction pour déconnecter un utilisateur
};
return (
<AuthContext.Provider value={authContextValue}>
{children}
</AuthContext.Provider>
);
};
// Hook personnalisé pour faciliter l'utilisation du contexte dans les composants
export const useAuth = () => {
const context = useContext(AuthContext);
if (context === undefined) {
throw new Error('useAuth must be used within an AuthProvider');
}
return context;
};

View File

@@ -0,0 +1,17 @@
const handleLogin = async (e) => {
e.preventDefault();
try {
const response = await axios.post('http://localhost:XXXX/api/Auth/login', {
email,
password,
});
console.log("Login successful:", response.data);
navigate('/dashboard');
} catch (err) {
if (err.response && err.response.status === 401) {
alert("Identifiants invalides.");
} else {
console.error("Erreur de connexion:", err);
alert("Erreur de connexion au serveur.");
}
}

View File

@@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

View File

@@ -0,0 +1,17 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,85 @@
/* Styling for the main layout of the dashboard page */
.dashboard-page-container {
display: flex;
min-height: 100vh;
font-family: 'Caladea', serif;
}
.dashboard-left-column {
flex: 2;
display: flex;
flex-direction: column;
padding: 20px 40px;
background-color: #fff;
}
/* Style pour le panneau de bienvenue quand le formulaire n'est pas affiché */
.welcome-right-panel {
display: flex;
flex-direction: column;
justify-content: center; /* Centre le contenu verticalement */
align-items: center; /* Centre le contenu horizontalement */
text-align: center;
padding: 20px;
background-color: #e0f2f7; /* Couleur de fond de la colonne droite */
}
.panel-title {
font-size: 1.8em;
color: #333;
margin-bottom: 15px;
}
.welcome-right-panel p {
font-size: 1.1em;
color: #666;
max-width: 300px; /* Limite la largeur du texte */
}
/* Style pour le formulaire quand il est affiché (peut être une superposition) */
.dashboard-right-column.form-overlay {
flex: 1; /* Prend sa place normale si c'est une colonne */
background-color: #e0f2f7;
padding: 20px 30px;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
/* Si vous voulez un vrai modal par-dessus tout, vous devrez changer le positionnement ici */
/* Par exemple, pour un overlay : */
/*
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5); // Fond semi-transparent
z-index: 1000;
justify-content: center;
align-items: center;
*/
}
/* Styles pour les titres des sections de la colonne gauche */
.section-title {
font-size: 1.5em;
font-weight: bold;
margin-top: 30px;
margin-bottom: 20px;
color: #333;
}
@media (max-width: 992px) {
.dashboard-page-container {
flex-direction: column;
}
.dashboard-left-column,
.dashboard-right-column {
flex: none;
width: 100%;
padding: 20px;
}
}

View File

@@ -0,0 +1,175 @@
import React, { useEffect, useState } from 'react';
import Header from '../components/Header';
import WelcomeSection from '../components/WelcomeSections';
import MyCalendar from '../components/MyCalendar';
import NewLeaveRequestForm from '../components/NewLeaveRequestForm';
import LeaveCounters from '../components/LeaveCounters';
import '../pages/Dashboard.css';
import { useAuth } from '../context/AuthContext';
export default function DashboardPage() {
const { user } = useAuth();
const [showLeaveForm, setShowLeaveForm] = useState(false);
const [selectedDateRange, setSelectedDateRange] = useState([]);
// Initialisation sécurisée avec des valeurs par défaut
const [availableCounters, setAvailableCounters] = useState({
availableCP: 0,
rttInProcess: 0,
absenteism: 0,
availableRTT: 0,
availableABS: 0
});
const [isLoadingCounters, setIsLoadingCounters] = useState(true);
const [countersError, setCountersError] = useState(null);
const fetchCounters = async () => {
setIsLoadingCounters(true);
setCountersError(null);
const userId = user?.id;
if (!userId) {
console.error("DashboardPage: User ID is not available for fetching counters.");
setCountersError("ID utilisateur non disponible. Impossible de charger les soldes.");
setIsLoadingCounters(false);
return;
}
try {
console.log("DashboardPage: Début de la récupération des compteurs pour userId:", userId);
const response = await fetch(`http://localhost/GestionDemandeCongeV1/api/getLeaveCounters.php?user_id=${userId}`);
if (!response.ok) {
throw new Error(`Erreur HTTP: ${response.status} - ${response.statusText}`);
}
const data = await response.json();
console.log("DashboardPage: Données reçues du backend pour compteurs:", data);
if (data.success && data.counters) {
setAvailableCounters({
availableCP: data.counters.availableCP ?? 0,
rttInProcess: data.counters.rttInProcess ?? 0,
absenteism: data.counters.absenteism ?? 0,
availableRTT: data.counters.availableRTT ?? 0,
availableABS: data.counters.availableABS ?? 0,
});
} else {
setCountersError(data.message || "Erreur inconnue lors de la récupération des compteurs.");
setAvailableCounters({
availableCP: 0,
rttInProcess: 0,
absenteism: 0,
availableRTT: 0,
availableABS: 0
});
}
} catch (error) {
console.error("DashboardPage: Erreur réseau ou du serveur lors de la récupération des compteurs:", error);
setCountersError("Impossible de se connecter au serveur pour charger les soldes de congés.");
setAvailableCounters({
availableCP: 0,
rttInProcess: 0,
absenteism: 0,
availableRTT: 0,
availableABS: 0
});
} finally {
setIsLoadingCounters(false);
}
};
useEffect(() => {
fetchCounters();
}, [user]);
const handleDaySelect = (date) => {
if (selectedDateRange.length === 0) {
setSelectedDateRange([date]);
} else if (selectedDateRange.length === 1) {
let start = selectedDateRange[0];
let end = date;
if (start.getTime() > end.getTime()) {
[start, end] = [end, start];
}
setSelectedDateRange([start, end]);
setShowLeaveForm(true);
} else {
setSelectedDateRange([date]);
setShowLeaveForm(false);
}
};
const handleClearSelection = () => {
setSelectedDateRange([]);
setShowLeaveForm(false);
};
const handleCloseForm = () => {
setShowLeaveForm(false);
setSelectedDateRange([]);
fetchCounters(); // Refresh counters
};
return (
<div className="dashboard-page-container">
<div className="dashboard-left-column">
<Header />
<WelcomeSection />
<MyCalendar
onDaySelect={handleDaySelect}
selectedDateRange={selectedDateRange}
onClearSelection={handleClearSelection}
/>
<LeaveCounters
availableCP={availableCounters.availableCP}
rttInProcess={availableCounters.rttInProcess}
absenteism={availableCounters.availableABS}
isLoading={isLoadingCounters}
error={countersError}
/>
<div style={{ padding: '10px', borderTop: '1px solid #eee', marginTop: '20px' }}>
<h3>Soldes de Congés (vérification):</h3>
{isLoadingCounters ? (
<p>Chargement des soldes...</p>
) : countersError ? (
<p style={{ color: 'red' }}>Erreur: {countersError}</p>
) : (
<ul>
<li>CP: {availableCounters.availableCP} jours</li>
<li>RTT: {availableCounters.availableRTT} jours</li>
<li>ABS: {availableCounters.availableABS} jours</li>
</ul>
)}
</div>
</div>
{showLeaveForm ? (
<div className="dashboard-right-column form-overlay">
{!isLoadingCounters ? (
<NewLeaveRequestForm
startDate={selectedDateRange[0]}
endDate={selectedDateRange[1]}
onClose={handleCloseForm}
availableLeaveCounters={availableCounters}
userId={user?.id}
/>
) : (
<p>Veuillez patienter pendant le chargement des soldes de congés pour afficher la demande.</p>
)}
</div>
) : (
<div className="dashboard-right-column welcome-right-panel">
<h2 className="panel-title">Bienvenue sur votre espace congés !</h2>
<p>Cliquez sur un jour du calendrier pour commencer une demande de congé. Sélectionnez une deuxième date pour définir une plage.</p>
</div>
)}
</div>
);
}

View File

@@ -0,0 +1,98 @@
@font-face {
font-family: 'Caladea';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('https://mypenpot.ensup-adm.net/internal/gfonts/font/caladea/v7/kJEzBugZ7AAjhybUvRh9-g.woff2') format('woff2');
}
html, body {
margin: 0;
padding: 0;
height: 100%;
font-family: 'Caladea', serif;
background-color: #fff;
}
.login-container {
display: flex;
height: 100vh;
font-family: 'Caladea', serif;
}
/* Partie image à gauche */
.image-side {
flex: 1;
background-image: url('/public/Assets/ImageEnsup.png');
background-size: cover;
background-position: center;
}
/* Partie formulaire à droite */
.form-side {
flex: 1;
padding: 60px 50px;
background-color: #f8f9fa;
display: flex;
flex-direction: column;
justify-content: center;
}
/* Titre */
h1 {
font-family: 'Ribeye', cursive;
margin-bottom: 40px;
font-weight: bold;
color: #333;
}
/* Labels */
form label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: #555;
}
/* Inputs */
form input {
width: 55%;
padding: 10px 15px;
margin-bottom: 20px;
font-size: 16px;
font-family: 'Caladea', serif;
border: 1px solid #7b5ca8;
border-radius: 9px;
background-color: #f4f0fa;
transition: border-color 0.3s, background-color 0.3s;
}
form input:focus {
border-color: #5a467e;
background-color: #ebe6fa;
outline: none;
}
/* Bouton */
form button {
width: 212px;
height: 39px;
background: #7b5ca8;
border: 1px solid #7b5ca8;
border-radius: 18px;
color: #fff;
font-family: 'Caladea', serif;
font-weight: 700;
font-size: 18px;
cursor: pointer;
transition: background-color 0.3s;
} form button:hover {
background-color: #5a467e; /* violet foncé au hover */
}

View File

@@ -0,0 +1,85 @@
import React, { useState } from 'react';
import axios from 'axios';
import './LoginPage.css';
import { useNavigate } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
export default function LoginPage() {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const navigate = useNavigate();
const { login } = useAuth();
const handleLogin = async (e) => {
e.preventDefault();
try {
const response = await axios.post('http://localhost/GestionDemandeCongeV1/api/login.php', {
email,
mot_de_passe: password,
});
if (response.data.success) {
// IMPORTANT : Adaptez ceci en fonction de ce que votre API PHP renvoie exactement
const userData = {
id: response.data.user.id || null,
// Supposons que votre API renvoie 'prenom' et 'nom'
prenom: response.data.user.prenom || 'Utilisateur', // Prénom
nom: response.data.user.nom || '', // Nom
email: response.data.user.email || email,
// Vous pouvez toujours garder un champ 'fullName' si utile ailleurs
fullName: (response.data.user.prenom && response.data.user.nom)
? `${response.data.user.prenom} ${response.data.user.nom}`
: (response.data.user.prenom || email)
};
login(userData); // Passe l'objet utilisateur structuré au contexte
navigate('/dashboard');
} else {
alert(`Erreur de connexion : ${response.data.message || 'identifiants invalides'}`);
}
} catch (err) {
console.error("Erreur de connexion :", err);
if (err.response) {
alert(`Erreur du serveur : ${err.response.data.message || 'Problème de connexion'}`);
} else if (err.request) {
alert("Erreur réseau : Le serveur ne répond pas. Vérifiez votre connexion.");
} else {
alert("Erreur inattendue lors de la connexion.");
}
}
};
return (
<div className="login-container">
<div className="image-side">
<img src="/PageAccueil_Calendrier.png" alt="Logo de l'application" className="login-image" />
</div>
<div className="form-side">
<h1>Mes Congés</h1>
<form onSubmit={handleLogin}>
<label htmlFor="email">Email</label>
<input
type="email"
id="email"
value={email}
onChange={e => setEmail(e.target.value)}
required
/>
<label htmlFor="password">Mot de passe</label>
<div className="password-wrapper">
<input
type="password"
id="password"
value={password}
onChange={e => setPassword(e.target.value)}
required
/>
</div>
<button type="submit">Se connecter</button>
</form>
</div>
</div>
);
}

View File

@@ -0,0 +1,13 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

View File

@@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

10
package.json Normal file
View File

@@ -0,0 +1,10 @@
{
"dependencies": {
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@mui/material": "^7.1.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.6.3"
}
}