<%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
  <head>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link
      href="https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap"
      rel="stylesheet"
    />
    <link
      href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
      rel="stylesheet"
    />
    <link
      href="https://fonts.googleapis.com/css2?family=Carme&display=swap"
      rel="stylesheet"
    />
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body class="w-screen h-screen">
    <%@include file="jspf/sidebarJSP.jspf" %>
    <div class="p-4 sm:ml-64">
      <div
        class="p-4 border-2 border-gray-200 border-dashed rounded-lg dark:border-gray-700 mt-14"
      >
        <h1 class="text-black">Planning employes :</h1>
        <h1 class="text-black">Date debut ${startWeek}</h1>
        <h1 class="text-black">Date fin ${endWeek}</h1>

        <div class="relative overflow-x-auto shadow-md sm:rounded-lg">
          <div
            class="flex items-center justify-between flex-column md:flex-row flex-wrap space-y-4 md:space-y-0 py-4 bg-white dark:bg-gray-900"
          >
            <label for="table-search" class="sr-only">Search</label>
            <div class="relative pl-1">
              <div
                class="absolute inset-y-0 rtl:inset-r-0 start-0 flex items-center ps-3 pointer-events-none"
              >
                <svg
                  class="w-4 h-4 text-gray-500 dark:text-gray-400"
                  aria-hidden="true"
                  xmlns="http://www.w3.org/2000/svg"
                  fill="none"
                  viewBox="0 0 20 20"
                >
                  <path
                    stroke="currentColor"
                    stroke-linecap="round"
                    stroke-linejoin="round"
                    stroke-width="2"
                    d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"
                  />
                </svg>
              </div>
              <input
                type="text"
                id="table-search-users"
                class="block pt-2 ps-10 text-sm text-gray-900 border border-gray-300 rounded-lg w-80 bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
                placeholder="Search for users"
              />
            </div>
          </div>
          <table
            class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400"
          >
            <thead
              class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400"
            >
              <tr>
                <th scope="col" class="p-4">
                  <div class="flex items-center">
                    <input
                      id="checkbox-all-search"
                      type="checkbox"
                      class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label for="checkbox-all-search" class="sr-only"
                      >checkbox</label
                    >
                  </div>
                </th>
                <th scope="col" class="px-6 py-3">Salaries</th>
                <th scope="col" class="px-6 py-3">Lundi</th>
                <th scope="col" class="px-6 py-3">Mardi</th>
                <th scope="col" class="px-6 py-3">Mercredi</th>
                <th scope="col" class="px-6 py-3">Jeudi</th>
                <th scope="col" class="px-6 py-3">Vendredi</th>
                <th scope="col" class="px-6 py-3">Modifier</th>
              </tr>
            </thead>
            <tbody>
              <c:forEach items="${users}" var="user">
                <tr
                  class="bg-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600"
                >
                  <td class="w-4 p-4">
                    <div class="flex items-center">
                      <input
                        id="checkbox-table-search-1"
                        type="checkbox"
                        class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                      />
                      <label for="checkbox-table-search-1" class="sr-only"
                        >checkbox</label
                      >
                    </div>
                  </td>
                  <th
                    scope="row"
                    class="flex items-center px-6 py-4 text-gray-900 whitespace-nowrap dark:text-white"
                  >
                    <div class="ps-3">
                      <div class="text-base font-semibold">
                        ${user.nom} ${user.prenom}
                      </div>
                      <div class="font-normal text-gray-500">
                        ${user.nom}.${user.prenom}@gmail.com
                      </div>
                    </div>
                  </th>
                  <td class="px-6 py-4">
                    <div class="flex flex-col">
                      <div class="flex items-center">
                        <c:set var="foundVentil" value="false" />
                        <c:forEach items="${user.ventils}" var="ventil">
                          <c:if test="${ventil.nomJour == 'lundi'}">
                            <c:if test="${ventil.periode == 'AM'}">
                              <c:if test="${ventil.ventil == 1}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 2}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-red-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 0}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:set var="foundVentil" value="true" />
                            </c:if>
                          </c:if>
                        </c:forEach>

                        <c:if test="${not foundVentil}">
                          <div
                            class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                          ></div>
                          <span>AM</span>
                        </c:if>
                      </div>
                      <div class="flex items-center">
                        <c:set var="foundVentil" value="false" />
                        <c:forEach items="${user.ventils}" var="ventil">
                          <c:if test="${ventil.nomJour == 'lundi'}">
                            <c:if test="${ventil.periode == 'PM'}">
                              <c:if test="${ventil.ventil == 1}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 2}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-red-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 0}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:set var="foundVentil" value="true" />
                            </c:if>
                          </c:if>
                        </c:forEach>

                        <c:if test="${not foundVentil}">
                          <div
                            class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                          ></div>
                          <span>PM</span>
                        </c:if>
                      </div>
                    </div>
                  </td>
                  <td class="px-6 py-4">
                    <div class="flex flex-col">
                      <div class="flex items-center">
                        <c:set var="foundVentil" value="false" />
                        <c:forEach items="${user.ventils}" var="ventil">
                          <c:if test="${ventil.nomJour == 'mardi'}">
                            <c:if test="${ventil.periode == 'AM'}">
                              <c:if test="${ventil.ventil == 1}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 2}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-red-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 0}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:set var="foundVentil" value="true" />
                            </c:if>
                          </c:if>
                        </c:forEach>

                        <c:if test="${not foundVentil}">
                          <div
                            class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                          ></div>
                          <span>AM</span>
                        </c:if>
                      </div>
                      <div class="flex items-center">
                        <c:set var="foundVentil" value="false" />
                        <c:forEach items="${user.ventils}" var="ventil">
                          <c:if test="${ventil.nomJour == 'mardi'}">
                            <c:if test="${ventil.periode == 'PM'}">
                              <c:if test="${ventil.ventil == 1}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 2}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-red-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 0}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:set var="foundVentil" value="true" />
                            </c:if>
                          </c:if>
                        </c:forEach>

                        <c:if test="${not foundVentil}">
                          <div
                            class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                          ></div>
                          <span>PM</span>
                        </c:if>
                      </div>
                    </div>
                  </td>
                  <td class="px-6 py-4">
                    <div class="flex flex-col">
                      <div class="flex items-center">
                        <c:set var="foundVentil" value="false" />
                        <c:forEach items="${user.ventils}" var="ventil">
                          <c:if test="${ventil.nomJour == 'mercredi'}">
                            <c:if test="${ventil.periode == 'AM'}">
                              <c:if test="${ventil.ventil == 1}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 2}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-red-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 0}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:set var="foundVentil" value="true" />
                            </c:if>
                          </c:if>
                        </c:forEach>

                        <c:if test="${not foundVentil}">
                          <div
                            class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                          ></div>
                          <span>AM</span>
                        </c:if>
                      </div>
                      <div class="flex items-center">
                        <c:set var="foundVentil" value="false" />
                        <c:forEach items="${user.ventils}" var="ventil">
                          <c:if test="${ventil.nomJour == 'mercredi'}">
                            <c:if test="${ventil.periode == 'PM'}">
                              <c:if test="${ventil.ventil == 1}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 2}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-red-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 0}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:set var="foundVentil" value="true" />
                            </c:if>
                          </c:if>
                        </c:forEach>

                        <c:if test="${not foundVentil}">
                          <div
                            class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                          ></div>
                          <span>PM</span>
                        </c:if>
                      </div>
                    </div>
                  </td>
                  <td class="px-6 py-4">
                    <div class="flex flex-col">
                      <div class="flex items-center">
                        <c:set var="foundVentil" value="false" />
                        <c:forEach items="${user.ventils}" var="ventil">
                          <c:if test="${ventil.nomJour == 'jeudi'}">
                            <c:if test="${ventil.periode == 'AM'}">
                              <c:if test="${ventil.ventil == 1}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 2}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-red-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 0}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                                ></div>
                                <span>AM</span>
                              </c:if>
                              <c:set var="foundVentil" value="true" />
                            </c:if>
                          </c:if>
                        </c:forEach>

                        <c:if test="${not foundVentil}">
                          <div
                            class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                          ></div>
                          <span>AM</span>
                        </c:if>
                      </div>
                      <div class="flex items-center">
                        <c:set var="foundVentil" value="false" />
                        <c:forEach items="${user.ventils}" var="ventil">
                          <c:if test="${ventil.nomJour == 'jeudi'}">
                            <c:if test="${ventil.periode == 'PM'}">
                              <c:if test="${ventil.ventil == 1}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 2}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-red-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 0}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:set var="foundVentil" value="true" />
                            </c:if>
                          </c:if>
                        </c:forEach>

                        <c:if test="${not foundVentil}">
                          <div
                            class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                          ></div>
                          <span>PM</span>
                        </c:if>
                      </div>
                    </div>
                  </td>
                  <td class="px-6 py-4">
                    <div class="flex flex-col">
                      <div class="flex items-center">
                        <c:set var="foundVentil" value="false" />
                        <c:forEach items="${user.ventils}" var="ventil">
                          <c:if test="${ventil.nomJour == 'vendredi'}">
                            <c:if test="${ventil.periode == 'AM'}">
                              <c:if test="${ventil.ventil == 1}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2"
                                ></div>
                                <span>AM</span>
                                <c:set var="foundVentil" value="true" />
                              </c:if>
                              <c:if test="${ventil.ventil == 2}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-red-500 me-2"
                                ></div>
                                <span>AM</span>
                                <c:set var="foundVentil" value="true" />
                              </c:if>
                              <c:if test="${ventil.ventil == 0}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                                ></div>
                                <span>PM</span>
                                <c:set var="foundVentil" value="true" />
                              </c:if>
                            </c:if>
                          </c:if>
                        </c:forEach>

                        <c:if test="${not foundVentil}">
                          <div
                            class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                          ></div>
                          <span>AM</span>
                        </c:if>
                      </div>
                      <div class="flex items-center">
                        <c:set var="foundVentil" value="false" />
                        <c:forEach items="${user.ventils}" var="ventil">
                          <c:if test="${ventil.nomJour == 'vendredi'}">
                            <c:if test="${ventil.periode == 'PM'}">
                              <c:if test="${ventil.ventil == 1}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 2}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-red-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:if test="${ventil.ventil == 0}">
                                <div
                                  class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                                ></div>
                                <span>PM</span>
                              </c:if>
                              <c:set var="foundVentil" value="true" />
                            </c:if>
                          </c:if>
                        </c:forEach>

                        <c:if test="${not foundVentil}">
                          <div
                            class="h-2.5 w-2.5 rounded-full bg-green-500 me-2"
                          ></div>
                          <span>PM</span>
                        </c:if>
                      </div>
                    </div>
                  </td>
                  <td class="px-6 py-4">
                    <a
                      class="text-blue-600 hover:underline"
                      href="ModifyAttendanceServlet?idSalarie=${user.id}&startWeek=${startWeek}&endWeek=${endWeek}"
                      >Modifier</a
                    >
                  </td>
                </tr>
              </c:forEach>
            </tbody>
          </table>
          <div
            class="flex space-x-4 text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400 p-5"
          >
            <div class="flex">
              <div
                class="h-2.5 w-2.5 rounded-full bg-green-500 me-2 my-auto"
              ></div>
              <span>Sur chantier</span>
            </div>
            <div class="flex">
              <div
                class="h-2.5 w-2.5 rounded-full bg-yellow-500 me-2 my-auto"
              ></div>
              <span>Au bureau</span>
            </div>
            <div class="flex">
              <div
                class="h-2.5 w-2.5 rounded-full bg-red-500 me-2 my-auto"
              ></div>
              <span>Absent</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>
