gestion-utilisateurs.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <!DOCTYPE html>
  2. <html lang="fr">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Admin - Gestion des droits d'accès - RH</title>
  7. <!-- Tailwind CSS CDN -->
  8. <script src="https://cdn.tailwindcss.com"></script>
  9. <style>
  10. /* Style pour les onglets actifs Preline */
  11. button[role="tab"].active,
  12. button[role="tab"][aria-selected="true"] {
  13. background-color: white !important;
  14. color: rgb(31, 41, 55) !important; /* text-gray-800 */
  15. }
  16. @media (prefers-color-scheme: dark) {
  17. button[role="tab"].active,
  18. button[role="tab"][aria-selected="true"] {
  19. background-color: rgb(38, 38, 38) !important; /* dark:bg-neutral-800 */
  20. color: white !important;
  21. }
  22. }
  23. </style>
  24. </head>
  25. <body class="bg-gray-50 dark:bg-neutral-900">
  26. <?php
  27. $skip_default_content = true;
  28. include 'menu.php';
  29. ?>
  30. <!-- Content -->
  31. <div class="pt-12 lg:pt-16 lg:ps-64">
  32. <div class="min-h-screen p-4 md:p-8">
  33. <!-- Scrollspy container for menu.php compatibility -->
  34. <div id="scrollspy" class="hidden"></div>
  35. <!-- Page Header -->
  36. <div class="mb-6">
  37. <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
  38. <!-- Title -->
  39. <div>
  40. <h1 class="text-2xl font-semibold text-gray-800 dark:text-white">Admin - Gestion des droits d'accès - RH</h1>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- End Page Header -->
  45. <!-- Access Selection Section -->
  46. <div class="mb-8">
  47. <div class="bg-white border border-gray-200 rounded-xl shadow-sm p-6 dark:bg-neutral-800 dark:border-neutral-700">
  48. <div class="flex flex-col sm:flex-row items-center justify-center gap-4">
  49. <label for="access-select" class="text-base font-semibold text-gray-800 dark:text-neutral-200 whitespace-nowrap">
  50. Accès à
  51. </label>
  52. <div class="hs-dropdown relative inline-flex">
  53. <button id="hs-dropdown-access" type="button" class="hs-dropdown-toggle py-3 px-6 inline-flex items-center gap-x-3 text-base font-medium rounded-lg border-2 border-gray-300 bg-white text-gray-800 shadow-sm hover:bg-gray-50 hover:border-blue-500 focus:outline-hidden focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-600 dark:text-white dark:hover:bg-neutral-700 dark:hover:border-blue-500 transition-colors min-w-[200px] justify-between" aria-expanded="false">
  54. <span id="selected-site" class="font-semibold">Site</span>
  55. <svg class="hs-dropdown-open:rotate-180 size-5 text-gray-600 dark:text-neutral-400 transition-transform" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  56. <path d="m6 9 6 6 6-6"/>
  57. </svg>
  58. </button>
  59. <div class="hs-dropdown-menu transition-[opacity,margin] duration hs-dropdown-open:opacity-100 opacity-0 hidden min-w-[200px] bg-white shadow-lg rounded-lg p-2 mt-2 dark:bg-neutral-800 dark:border dark:border-neutral-700 z-10" role="menu" aria-labelledby="hs-dropdown-access">
  60. <a class="flex items-center gap-x-3.5 py-3 px-4 rounded-lg text-sm font-medium text-gray-800 hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-300 transition-colors" href="#" role="menuitem">
  61. Admin RH
  62. </a>
  63. <a class="flex items-center gap-x-3.5 py-3 px-4 rounded-lg text-sm font-medium text-gray-800 hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-300 transition-colors" href="#" role="menuitem">
  64. Admin IT
  65. </a>
  66. <a class="flex items-center gap-x-3.5 py-3 px-4 rounded-lg text-sm font-medium text-gray-800 hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-300 transition-colors" href="#" role="menuitem">
  67. Dashboard IT
  68. </a>
  69. <a class="flex items-center gap-x-3.5 py-3 px-4 rounded-lg text-sm font-medium text-gray-800 hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-300 transition-colors" href="#" role="menuitem">
  70. Dashboard RH
  71. </a>
  72. <a class="flex items-center gap-x-3.5 py-3 px-4 rounded-lg text-sm font-medium text-gray-800 hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-300 transition-colors" href="#" role="menuitem">
  73. Auto 33
  74. </a>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <!-- End Access Selection Section -->
  81. <!-- Table Section -->
  82. <div class="flex flex-col">
  83. <div class="-m-1.5 overflow-x-auto">
  84. <div class="p-1.5 min-w-full inline-block align-middle">
  85. <div class="bg-white border border-gray-200 rounded-xl shadow-2xs overflow-hidden dark:bg-neutral-900 dark:border-neutral-700">
  86. <!-- Table -->
  87. <table class="min-w-full divide-y divide-gray-200 dark:divide-neutral-700">
  88. <thead class="bg-gray-50 dark:bg-neutral-900">
  89. <tr>
  90. <th scope="col" class="px-6 py-3 text-start">
  91. <div class="flex items-center gap-x-2">
  92. <span class="text-xs font-semibold uppercase text-gray-800 dark:text-neutral-200">
  93. Collaborateur
  94. </span>
  95. <svg class="size-3 text-gray-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  96. <path d="m6 9 6 6 6-6"/>
  97. </svg>
  98. </div>
  99. </th>
  100. <th scope="col" class="px-6 py-3 text-start">
  101. <div class="flex items-center gap-x-2">
  102. <span class="text-xs font-semibold uppercase text-gray-800 dark:text-neutral-200">
  103. Site
  104. </span>
  105. </div>
  106. </th>
  107. <th scope="col" class="px-6 py-3 text-start">
  108. <div class="flex items-center gap-x-2">
  109. <span class="text-xs font-semibold uppercase text-gray-800 dark:text-neutral-200">
  110. Rôle/Groupes utilisateurs
  111. </span>
  112. </div>
  113. </th>
  114. <th scope="col" class="px-6 py-3 text-start">
  115. <div class="flex items-center gap-x-2">
  116. <span class="text-xs font-semibold uppercase text-gray-800 dark:text-neutral-200">
  117. Notification mails
  118. </span>
  119. </div>
  120. </th>
  121. <th scope="col" class="px-6 py-3 text-start">
  122. <div class="flex items-center gap-x-2">
  123. <span class="text-xs font-semibold uppercase text-gray-800 dark:text-neutral-200">
  124. Actions
  125. </span>
  126. </div>
  127. </th>
  128. </tr>
  129. </thead>
  130. <tbody class="divide-y divide-gray-200 dark:divide-neutral-700">
  131. <!-- Ligne 1 - Fond blanc -->
  132. <tr class="bg-white dark:bg-neutral-800">
  133. <td class="size-px whitespace-nowrap">
  134. <div class="px-6 py-3">
  135. <span class="text-sm font-medium text-gray-800 dark:text-neutral-200">Jean Dupont</span>
  136. </div>
  137. </td>
  138. <td class="size-px whitespace-nowrap">
  139. <div class="px-6 py-3">
  140. <span class="text-sm text-gray-600 dark:text-neutral-400">Auto33</span>
  141. </div>
  142. </td>
  143. <td class="size-px whitespace-nowrap">
  144. <div class="px-6 py-3">
  145. <span class="py-1 px-2 inline-flex items-center gap-x-1 text-xs font-medium bg-purple-100 text-purple-800 rounded-full dark:bg-purple-500/10 dark:text-purple-500">
  146. Comptable
  147. </span>
  148. </div>
  149. </td>
  150. <td class="size-px whitespace-nowrap">
  151. <div class="px-6 py-3">
  152. <input type="checkbox" class="shrink-0 mt-0.5 border-gray-200 rounded text-blue-600 focus:ring-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800" checked>
  153. </div>
  154. </td>
  155. <td class="size-px whitespace-nowrap">
  156. <div class="px-6 py-3">
  157. <div class="flex items-center gap-x-2">
  158. <button type="button" class="hs-tooltip-toggle inline-flex items-center justify-center size-7 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700" title="Modifier">
  159. <svg class="size-4 text-gray-600 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  160. <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
  161. <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
  162. </svg>
  163. </button>
  164. <button type="button" class="hs-tooltip-toggle inline-flex items-center justify-center size-7 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700" title="Supprimer">
  165. <svg class="size-4 text-gray-600 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  166. <path d="M3 6h18"/>
  167. <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/>
  168. <path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>
  169. </svg>
  170. </button>
  171. </div>
  172. </div>
  173. </td>
  174. </tr>
  175. <!-- Ligne 2 - Fond grisé alterné -->
  176. <tr class="dark:bg-green-900/20" style="background-color: rgba(245, 248, 246, 0.45);">
  177. <td class="size-px whitespace-nowrap">
  178. <div class="px-6 py-3">
  179. <span class="text-sm font-medium text-gray-800 dark:text-neutral-200">Marie Martin</span>
  180. </div>
  181. </td>
  182. <td class="size-px whitespace-nowrap">
  183. <div class="px-6 py-3">
  184. <span class="text-sm text-gray-600 dark:text-neutral-400">Admin RH</span>
  185. </div>
  186. </td>
  187. <td class="size-px whitespace-nowrap">
  188. <div class="px-6 py-3">
  189. <span class="py-1 px-2 inline-flex items-center gap-x-1 text-xs font-medium bg-blue-100 text-blue-800 rounded-full dark:bg-blue-500/10 dark:text-blue-500">
  190. Administrateur
  191. </span>
  192. </div>
  193. </td>
  194. <td class="size-px whitespace-nowrap">
  195. <div class="px-6 py-3">
  196. <input type="checkbox" class="shrink-0 mt-0.5 border-gray-200 rounded text-blue-600 focus:ring-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800">
  197. </div>
  198. </td>
  199. <td class="size-px whitespace-nowrap">
  200. <div class="px-6 py-3">
  201. <div class="flex items-center gap-x-2">
  202. <button type="button" class="hs-tooltip-toggle inline-flex items-center justify-center size-7 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700" title="Modifier">
  203. <svg class="size-4 text-gray-600 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  204. <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
  205. <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
  206. </svg>
  207. </button>
  208. <button type="button" class="hs-tooltip-toggle inline-flex items-center justify-center size-7 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700" title="Supprimer">
  209. <svg class="size-4 text-gray-600 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  210. <path d="M3 6h18"/>
  211. <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/>
  212. <path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>
  213. </svg>
  214. </button>
  215. </div>
  216. </div>
  217. </td>
  218. </tr>
  219. <!-- Ligne 3 - Fond blanc -->
  220. <tr class="bg-white dark:bg-neutral-800">
  221. <td class="size-px whitespace-nowrap">
  222. <div class="px-6 py-3">
  223. <span class="text-sm font-medium text-gray-800 dark:text-neutral-200">Pierre Durand</span>
  224. </div>
  225. </td>
  226. <td class="size-px whitespace-nowrap">
  227. <div class="px-6 py-3">
  228. <span class="text-sm text-gray-600 dark:text-neutral-400">Dashboard RH</span>
  229. </div>
  230. </td>
  231. <td class="size-px whitespace-nowrap">
  232. <div class="px-6 py-3">
  233. <span class="py-1 px-2 inline-flex items-center gap-x-1 text-xs font-medium bg-green-100 text-green-800 rounded-full dark:bg-green-500/10 dark:text-green-500">
  234. RH
  235. </span>
  236. </div>
  237. </td>
  238. <td class="size-px whitespace-nowrap">
  239. <div class="px-6 py-3">
  240. <input type="checkbox" class="shrink-0 mt-0.5 border-gray-200 rounded text-blue-600 focus:ring-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800" checked>
  241. </div>
  242. </td>
  243. <td class="size-px whitespace-nowrap">
  244. <div class="px-6 py-3">
  245. <div class="flex items-center gap-x-2">
  246. <button type="button" class="hs-tooltip-toggle inline-flex items-center justify-center size-7 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700" title="Modifier">
  247. <svg class="size-4 text-gray-600 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  248. <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
  249. <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
  250. </svg>
  251. </button>
  252. <button type="button" class="hs-tooltip-toggle inline-flex items-center justify-center size-7 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700" title="Supprimer">
  253. <svg class="size-4 text-gray-600 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  254. <path d="M3 6h18"/>
  255. <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/>
  256. <path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>
  257. </svg>
  258. </button>
  259. </div>
  260. </div>
  261. </td>
  262. </tr>
  263. <!-- Ligne 4 - Fond grisé alterné -->
  264. <tr class="dark:bg-green-900/20" style="background-color: rgba(245, 248, 246, 0.45);">
  265. <td class="size-px whitespace-nowrap">
  266. <div class="px-6 py-3">
  267. <span class="text-sm font-medium text-gray-800 dark:text-neutral-200">Sophie Bernard</span>
  268. </div>
  269. </td>
  270. <td class="size-px whitespace-nowrap">
  271. <div class="px-6 py-3">
  272. <span class="text-sm text-gray-600 dark:text-neutral-400">Auto33</span>
  273. </div>
  274. </td>
  275. <td class="size-px whitespace-nowrap">
  276. <div class="px-6 py-3">
  277. <span class="py-1 px-2 inline-flex items-center gap-x-1 text-xs font-medium bg-orange-100 text-orange-800 rounded-full dark:bg-orange-500/10 dark:text-orange-500">
  278. Directeur
  279. </span>
  280. </div>
  281. </td>
  282. <td class="size-px whitespace-nowrap">
  283. <div class="px-6 py-3">
  284. <input type="checkbox" class="shrink-0 mt-0.5 border-gray-200 rounded text-blue-600 focus:ring-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800">
  285. </div>
  286. </td>
  287. <td class="size-px whitespace-nowrap">
  288. <div class="px-6 py-3">
  289. <div class="flex items-center gap-x-2">
  290. <button type="button" class="hs-tooltip-toggle inline-flex items-center justify-center size-7 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700" title="Modifier">
  291. <svg class="size-4 text-gray-600 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  292. <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
  293. <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
  294. </svg>
  295. </button>
  296. <button type="button" class="hs-tooltip-toggle inline-flex items-center justify-center size-7 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700" title="Supprimer">
  297. <svg class="size-4 text-gray-600 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  298. <path d="M3 6h18"/>
  299. <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/>
  300. <path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>
  301. </svg>
  302. </button>
  303. </div>
  304. </div>
  305. </td>
  306. </tr>
  307. </tbody>
  308. </table>
  309. <!-- End Table -->
  310. <!-- Add User Button -->
  311. <div class="px-6 py-4 border-t border-gray-200 dark:border-neutral-700">
  312. <div class="flex justify-center">
  313. <button type="button" id="btn-add-user" class="py-2 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-hidden focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none dark:focus:outline-hidden dark:focus:ring-1 dark:focus:ring-neutral-700" data-hs-overlay="#modal-ajouter-utilisateur">
  314. <span id="btn-add-user-text">Ajouter un utilisateur [[auto 33]]</span>
  315. </button>
  316. </div>
  317. </div>
  318. <!-- End Add User Button -->
  319. </div>
  320. </div>
  321. </div>
  322. </div>
  323. <!-- End Table Section -->
  324. </div>
  325. </div>
  326. <!-- End Content -->
  327. <!-- Modal Ajouter Utilisateur -->
  328. <div id="modal-ajouter-utilisateur" class="hs-overlay hidden size-full fixed top-0 start-0 z-[80] overflow-x-hidden overflow-y-auto pointer-events-none">
  329. <div class="hs-overlay-open:mt-7 hs-overlay-open:opacity-100 hs-overlay-open:duration-500 mt-0 opacity-0 ease-out transition-all sm:max-w-lg sm:w-full m-3 sm:mx-auto min-h-[calc(100%-3.5rem)] flex items-center">
  330. <div class="w-full flex flex-col bg-white border shadow-sm rounded-xl pointer-events-auto dark:bg-neutral-800 dark:border-neutral-700 dark:shadow-neutral-700/70">
  331. <!-- Header -->
  332. <div class="flex justify-between items-center py-4 px-6 border-b border-gray-200 dark:border-neutral-700">
  333. <h3 class="text-xl font-semibold text-gray-800 dark:text-white">
  334. Ajouter un utilisateur
  335. </h3>
  336. <button type="button" class="flex justify-center items-center size-8 text-sm font-semibold rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 hover:text-gray-800 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-white transition-colors" data-hs-overlay="#modal-ajouter-utilisateur">
  337. <span class="sr-only">Fermer</span>
  338. <svg class="flex-shrink-0 size-4" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  339. <path d="m18 6-12 12"/>
  340. <path d="m6 6 12 12"/>
  341. </svg>
  342. </button>
  343. </div>
  344. <!-- End Header -->
  345. <!-- Body -->
  346. <div class="p-6 overflow-y-auto max-h-[calc(100vh-200px)]">
  347. <form class="space-y-5">
  348. <div>
  349. <label for="collaborateur" class="block text-sm font-medium text-gray-700 dark:text-neutral-300 mb-2">
  350. Collaborateur
  351. </label>
  352. <input
  353. type="text"
  354. id="collaborateur"
  355. name="collaborateur"
  356. class="py-2.5 px-4 block w-full border-gray-200 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400 dark:placeholder-neutral-500 dark:focus:ring-neutral-600 transition-colors"
  357. placeholder="Rechercher un collaborateur..."
  358. >
  359. </div>
  360. <div>
  361. <label for="site" class="block text-sm font-medium text-gray-700 dark:text-neutral-300 mb-2">
  362. Site
  363. </label>
  364. <select
  365. id="site"
  366. name="site"
  367. class="py-2.5 px-4 block w-full border-gray-200 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400 dark:focus:ring-neutral-600 transition-colors"
  368. >
  369. <option value="auto33">Auto 33</option>
  370. <option value="admin-rh">Admin RH</option>
  371. <option value="admin-it">Admin IT</option>
  372. <option value="dashboard-it">Dashboard IT</option>
  373. <option value="dashboard-rh">Dashboard RH</option>
  374. </select>
  375. </div>
  376. <div>
  377. <label for="role" class="block text-sm font-medium text-gray-700 dark:text-neutral-300 mb-2">
  378. Rôle / Groupes utilisateurs
  379. </label>
  380. <select
  381. id="role"
  382. name="role"
  383. class="py-2.5 px-4 block w-full border-gray-200 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400 dark:focus:ring-neutral-600 transition-colors"
  384. >
  385. <option value="">Sélectionner un rôle</option>
  386. <option value="comptable">Comptable</option>
  387. <option value="directeur">Directeur</option>
  388. <option value="admin">Administrateur</option>
  389. <option value="rh">RH</option>
  390. </select>
  391. </div>
  392. <div class="pt-2">
  393. <label class="flex items-center gap-3 cursor-pointer">
  394. <input
  395. type="checkbox"
  396. id="notification-mails"
  397. name="notification-mails"
  398. class="shrink-0 size-4 border-gray-200 rounded text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-0 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800 transition-colors"
  399. >
  400. <span class="text-sm text-gray-700 dark:text-neutral-300 font-medium">
  401. Notification mails
  402. </span>
  403. </label>
  404. <p class="mt-1 text-xs text-gray-500 dark:text-neutral-400 ms-7">
  405. L'utilisateur recevra des notifications par email
  406. </p>
  407. </div>
  408. </form>
  409. </div>
  410. <!-- End Body -->
  411. <!-- Footer -->
  412. <div class="flex justify-end items-center gap-x-3 py-4 px-6 border-t border-gray-200 dark:border-neutral-700 bg-gray-50 dark:bg-neutral-900/50">
  413. <button
  414. type="button"
  415. class="py-2.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 transition-colors"
  416. data-hs-overlay="#modal-ajouter-utilisateur"
  417. >
  418. Annuler
  419. </button>
  420. <button
  421. type="button"
  422. class="py-2.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-hidden focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none dark:focus:outline-hidden dark:focus:ring-1 dark:focus:ring-neutral-700 transition-colors"
  423. >
  424. Ajouter
  425. </button>
  426. </div>
  427. <!-- End Footer -->
  428. </div>
  429. </div>
  430. </div>
  431. <!-- End Modal Ajouter Utilisateur -->
  432. <!-- Preline UI - Chargé à la fin du body pour une initialisation correcte -->
  433. <script src="https://cdn.jsdelivr.net/npm/preline@2.1.0/dist/preline.js"></script>
  434. <!-- Script pour le dropdown de notifications -->
  435. <script>
  436. // Gérer le dropdown de notifications
  437. document.addEventListener('DOMContentLoaded', function() {
  438. const notificationButton = document.getElementById('hs-notification-dropdown');
  439. const notificationMenu = document.getElementById('notification-dropdown-menu');
  440. if (notificationButton && notificationMenu) {
  441. function updateDropdownPosition() {
  442. const buttonRect = notificationButton.getBoundingClientRect();
  443. notificationMenu.style.top = (buttonRect.bottom + 8) + 'px';
  444. notificationMenu.style.right = (window.innerWidth - buttonRect.right) + 'px';
  445. notificationMenu.style.maxWidth = '400px';
  446. }
  447. notificationButton.addEventListener('click', function(e) {
  448. e.stopPropagation();
  449. const isExpanded = notificationButton.getAttribute('aria-expanded') === 'true';
  450. const newExpanded = !isExpanded;
  451. notificationButton.setAttribute('aria-expanded', newExpanded);
  452. if (newExpanded) {
  453. updateDropdownPosition();
  454. notificationMenu.classList.remove('opacity-0', 'invisible', 'translate-y-2');
  455. notificationMenu.classList.add('opacity-100', 'visible', 'translate-y-0');
  456. } else {
  457. notificationMenu.classList.remove('opacity-100', 'visible', 'translate-y-0');
  458. notificationMenu.classList.add('opacity-0', 'invisible', 'translate-y-2');
  459. }
  460. });
  461. document.addEventListener('click', function(e) {
  462. if (!notificationButton.contains(e.target) && !notificationMenu.contains(e.target)) {
  463. notificationMenu.classList.remove('opacity-100', 'visible', 'translate-y-0');
  464. notificationMenu.classList.add('opacity-0', 'invisible', 'translate-y-2');
  465. notificationButton.setAttribute('aria-expanded', 'false');
  466. }
  467. });
  468. window.addEventListener('resize', function() {
  469. if (notificationButton.getAttribute('aria-expanded') === 'true') {
  470. updateDropdownPosition();
  471. }
  472. });
  473. }
  474. });
  475. </script>
  476. <!-- Script pour gérer le changement de site dans le dropdown et la modal -->
  477. <script>
  478. document.addEventListener('DOMContentLoaded', function() {
  479. // Fonctions de gestion de la modal
  480. const modal = document.getElementById('modal-ajouter-utilisateur');
  481. const modalButton = document.getElementById('btn-add-user');
  482. const modalInner = modal ? modal.querySelector('div[class*="hs-overlay-open"]') : null;
  483. function openModal() {
  484. if (modal && modalInner) {
  485. modal.classList.remove('hidden');
  486. document.body.style.overflow = 'hidden';
  487. // Forcer les classes d'animation
  488. setTimeout(() => {
  489. modalInner.classList.add('mt-7', 'opacity-100');
  490. }, 10);
  491. }
  492. }
  493. function closeModal() {
  494. if (modal && modalInner) {
  495. modalInner.classList.remove('mt-7', 'opacity-100');
  496. setTimeout(() => {
  497. modal.classList.add('hidden');
  498. document.body.style.overflow = '';
  499. }, 300);
  500. }
  501. }
  502. // Ouvrir la modal au clic sur le bouton
  503. if (modalButton) {
  504. modalButton.addEventListener('click', function(e) {
  505. e.preventDefault();
  506. e.stopPropagation();
  507. openModal();
  508. });
  509. }
  510. // Fermer la modal avec les boutons de fermeture
  511. const closeButtons = modal ? modal.querySelectorAll('[data-hs-overlay="#modal-ajouter-utilisateur"]') : [];
  512. closeButtons.forEach(btn => {
  513. if (btn.id !== 'btn-add-user') { // Ne pas ajouter l'écouteur au bouton d'ouverture
  514. btn.addEventListener('click', function(e) {
  515. e.preventDefault();
  516. closeModal();
  517. });
  518. }
  519. });
  520. // Fermer la modal en cliquant à l'extérieur
  521. if (modal) {
  522. modal.addEventListener('click', function(e) {
  523. if (e.target === modal) {
  524. closeModal();
  525. }
  526. });
  527. }
  528. // Fermer avec la touche Échap
  529. document.addEventListener('keydown', function(e) {
  530. if (e.key === 'Escape' && modal && !modal.classList.contains('hidden')) {
  531. closeModal();
  532. }
  533. });
  534. // Attendre que Preline soit chargé pour le dropdown
  535. setTimeout(function() {
  536. // Gérer le changement de site dans le dropdown
  537. const dropdownButton = document.getElementById('hs-dropdown-access');
  538. const dropdownContainer = dropdownButton?.closest('.hs-dropdown');
  539. const dropdownMenu = dropdownContainer?.querySelector('.hs-dropdown-menu');
  540. const dropdownItems = dropdownMenu?.querySelectorAll('a');
  541. const selectedSiteSpan = document.getElementById('selected-site');
  542. const addButtonText = document.getElementById('btn-add-user-text');
  543. // Valeur par défaut
  544. let selectedSite = 'auto 33';
  545. if (dropdownItems && dropdownItems.length > 0) {
  546. dropdownItems.forEach(item => {
  547. item.addEventListener('click', function(e) {
  548. e.preventDefault();
  549. const selectedText = this.textContent.trim();
  550. selectedSite = selectedText.toLowerCase();
  551. // Mettre à jour le texte du bouton dropdown
  552. if (selectedSiteSpan) {
  553. selectedSiteSpan.textContent = selectedText;
  554. }
  555. // Mettre à jour le texte du bouton "Ajouter un utilisateur"
  556. if (addButtonText) {
  557. addButtonText.textContent = `Ajouter un utilisateur [[${selectedText}]]`;
  558. }
  559. // Mettre à jour le select dans la modal
  560. const siteSelect = document.getElementById('site');
  561. if (siteSelect) {
  562. const optionMap = {
  563. 'admin rh': 'admin-rh',
  564. 'admin it': 'admin-it',
  565. 'dashboard it': 'dashboard-it',
  566. 'dashboard rh': 'dashboard-rh',
  567. 'auto 33': 'auto33'
  568. };
  569. siteSelect.value = optionMap[selectedSite] || 'auto33';
  570. }
  571. });
  572. });
  573. }
  574. }, 200);
  575. });
  576. </script>
  577. </body>
  578. </html>