-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1
-- Généré le : mer. 15 avr. 2026 à 07:59
-- Version du serveur : 10.4.32-MariaDB
-- Version de PHP : 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Base de données : `ressources-ms`
--

-- --------------------------------------------------------

--
-- Structure de la table `agents`
--

CREATE TABLE `agents` (
  `id` int(11) NOT NULL,
  `photo` varchar(255) DEFAULT NULL,
  `cnrps` varchar(20) NOT NULL,
  `nom_prenom_ar` varchar(255) NOT NULL,
  `nom_prenom_fr` varchar(255) DEFAULT NULL,
  `cin` varchar(8) DEFAULT NULL,
  `date_naissance` date DEFAULT NULL,
  `lieu_naissance` varchar(255) DEFAULT NULL,
  `sexe` varchar(20) DEFAULT NULL,
  `situation_familiale` varchar(100) DEFAULT NULL,
  `nb_enfants` int(11) DEFAULT 0,
  `niveau_etude` varchar(255) DEFAULT NULL,
  `diplome` varchar(255) DEFAULT NULL,
  `date_recrutement` date DEFAULT NULL,
  `date_titularisation` date DEFAULT NULL,
  `classification` varchar(100) DEFAULT NULL,
  `corps` varchar(100) DEFAULT NULL,
  `grade` varchar(100) DEFAULT NULL,
  `categorie_grade` varchar(100) DEFAULT NULL,
  `date_grade` date DEFAULT NULL,
  `echelon` int(11) DEFAULT NULL,
  `date_echelon` date DEFAULT NULL,
  `unite` varchar(255) DEFAULT NULL,
  `categorie_ouvrier` varchar(100) DEFAULT NULL,
  `situation_administrative` varchar(100) DEFAULT 'مباشر',
  `fonction` varchar(255) DEFAULT NULL,
  `date_fonction` date DEFAULT NULL,
  `notes_admin` text DEFAULT NULL,
  `direction_generale` varchar(255) DEFAULT NULL,
  `direction_sous` varchar(255) DEFAULT NULL,
  `service` varchar(255) DEFAULT NULL,
  `centre_travail` varchar(255) DEFAULT NULL,
  `missions` text DEFAULT NULL,
  `notes_structure` text DEFAULT NULL,
  `adresse` text DEFAULT NULL,
  `gouvernorat` varchar(100) DEFAULT 'تونس',
  `telephone` varchar(20) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `agents`
--

INSERT INTO `agents` (`id`, `photo`, `cnrps`, `nom_prenom_ar`, `nom_prenom_fr`, `cin`, `date_naissance`, `lieu_naissance`, `sexe`, `situation_familiale`, `nb_enfants`, `niveau_etude`, `diplome`, `date_recrutement`, `date_titularisation`, `classification`, `corps`, `grade`, `categorie_grade`, `date_grade`, `echelon`, `date_echelon`, `unite`, `categorie_ouvrier`, `situation_administrative`, `fonction`, `date_fonction`, `notes_admin`, `direction_generale`, `direction_sous`, `service`, `centre_travail`, `missions`, `notes_structure`, `adresse`, `gouvernorat`, `telephone`, `email`) VALUES
(7, 'agent_1776168695.png', '1457891', ' زيد الزيادي ', 'ziedi zeid', '52725', '2026-04-12', 'تونس ', 'ذكر', 'أعزب', 2, 'تكوين مهني', 'yju,juju,', '2026-05-03', '2026-04-26', 'موظف', 'عملة', 'عامل', 'ب', '2026-04-03', 13, '2026-04-04', 'الوحدة الثانية', '8', 'عدم مباشرة', 'رئيس فريق', '2026-05-10', '11111111111111111', 'الكتابة العامة', 'لا توجد', 'مصلحة الأعوان', 'الدائرة البلدية 1', 'eaztgzetgezt', 'فافافقافقا', '4 avenue des narcisses', 'أريانة', '12222222', '25072025lotfi@gmail.com'),
(8, 'agent_1776168673.png', '1457892', ' لطفي البلطاجي ', 'baltagi lotfi ', '52735', '2026-04-12', 'lrvdk ', 'ذكر', 'أعزب', NULL, 'تكوين مهني', 'yju,juju,', '2026-05-03', '2026-04-26', 'موظف', 'عملة', 'عامل', 'ب', '2026-04-03', 13, '2026-04-04', 'الوحدة الثانية', '8', 'عدم مباشرة', 'رئيس فريق', '2026-05-10', '11111111111111111', 'الكتابة العامة', 'لا توجد', 'مصلحة الأعوان', 'الدائرة البلدية 1', 'eaztgzetgezt', 'فافافقافقا', '4 avenue des narcisses', 'أريانة', '12222222', '25072025lotfi@gmail.com');

-- --------------------------------------------------------

--
-- Structure de la table `conges`
--

CREATE TABLE `conges` (
  `id` int(11) NOT NULL,
  `agent_id` int(11) NOT NULL,
  `type_conge` varchar(50) DEFAULT NULL,
  `reference` varchar(100) NOT NULL,
  `source_conge` varchar(255) DEFAULT NULL,
  `date_reference` date NOT NULL,
  `nb_jours` int(11) NOT NULL,
  `date_debut` date NOT NULL,
  `date_fin` date NOT NULL,
  `date_retour` date GENERATED ALWAYS AS (`date_fin` + interval 1 day) VIRTUAL,
  `solde_restant` int(11) DEFAULT 0,
  `cumul_annuel` int(11) DEFAULT 0,
  `type_bloc` varchar(50) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `conges`
--

INSERT INTO `conges` (`id`, `agent_id`, `type_conge`, `reference`, `source_conge`, `date_reference`, `nb_jours`, `date_debut`, `date_fin`, `solde_restant`, `cumul_annuel`, `type_bloc`, `created_at`) VALUES
(1, 7, NULL, '14', NULL, '2026-04-14', 14, '2026-04-14', '2026-04-27', 16, 0, 'annuel', '2026-04-14 15:50:30'),
(2, 7, NULL, '15', NULL, '2026-04-24', 10, '2026-04-30', '2026-05-09', 6, 0, 'annuel', '2026-04-14 15:51:10'),
(3, 7, NULL, '16', NULL, '2026-04-29', 3, '2026-04-16', '2026-04-18', 3, 0, 'annuel', '2026-04-14 15:51:36'),
(4, 7, NULL, '20', NULL, '2026-04-14', 4, '2026-04-19', '2026-04-22', -1, 0, 'annuel', '2026-04-14 15:53:00'),
(5, 8, NULL, '12', NULL, '2026-04-14', 4, '2026-04-14', '2026-04-17', 26, 0, 'annuel', '2026-04-14 19:27:56'),
(6, 8, NULL, '1', NULL, '2026-04-09', 10, '2026-04-19', '2026-04-28', 16, 0, 'annuel', '2026-04-14 19:28:21'),
(7, 7, NULL, '15', NULL, '2026-04-15', 4, '2026-04-24', '2026-04-27', -5, 0, NULL, '2026-04-14 21:37:56'),
(8, 7, NULL, '12', NULL, '2026-04-14', 15, '2026-04-14', '2026-04-28', -20, 0, NULL, '2026-04-14 21:42:28'),
(9, 7, NULL, '12', NULL, '2026-04-08', 3, '2026-04-14', '2026-04-16', -23, 0, 'maladie_ordinaire', '2026-04-14 21:46:57'),
(10, 7, NULL, '15', NULL, '2026-04-14', 5, '2026-04-15', '2026-04-19', -28, 0, 'maladie_ordinaire', '2026-04-14 21:48:53'),
(11, 7, NULL, '1213456', NULL, '2026-04-14', 10, '2026-04-15', '2026-04-24', -38, 0, 'maladie_ordinaire', '2026-04-14 21:49:55'),
(12, 7, NULL, '9999999999999', 'تارت', '2026-04-14', 21, '2026-04-15', '2026-05-05', -38, 89, NULL, '2026-04-14 21:52:33'),
(13, 7, NULL, '9999999999999', 'تارت', '2026-04-16', 9, '2026-04-15', '2026-04-23', -38, 98, NULL, '2026-04-14 21:54:02'),
(14, 8, NULL, '15', 'تارت', '2026-04-14', 4, '2026-04-15', '2026-04-18', 0, 18, 'maladie_ordinaire', '2026-04-14 21:59:51'),
(15, 8, NULL, '9999999999999', 'بقيسهسيهغسهغقس', '2026-04-17', 10, '2026-04-18', '2026-04-27', 0, 28, 'maladie_ordinaire', '2026-04-14 22:00:44'),
(16, 8, NULL, '777777', 'ققغ', '2026-04-05', 6, '2026-04-17', '2026-04-22', 0, 34, 'maladie_ordinaire', '2026-04-14 22:01:49'),
(17, 8, NULL, '8888888888888', '65465465', '2026-04-15', 15, '2026-04-30', '2026-05-14', 0, 49, 'maladie_ordinaire', '2026-04-14 22:02:28');

--
-- Index pour les tables déchargées
--

--
-- Index pour la table `agents`
--
ALTER TABLE `agents`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `cnrps` (`cnrps`),
  ADD UNIQUE KEY `cin` (`cin`);

--
-- Index pour la table `conges`
--
ALTER TABLE `conges`
  ADD PRIMARY KEY (`id`),
  ADD KEY `agent_id` (`agent_id`);

--
-- AUTO_INCREMENT pour les tables déchargées
--

--
-- AUTO_INCREMENT pour la table `agents`
--
ALTER TABLE `agents`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT pour la table `conges`
--
ALTER TABLE `conges`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;

--
-- Contraintes pour les tables déchargées
--

--
-- Contraintes pour la table `conges`
--
ALTER TABLE `conges`
  ADD CONSTRAINT `conges_ibfk_1` FOREIGN KEY (`agent_id`) REFERENCES `agents` (`id`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
