<%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib prefix="c"
uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page import="java.util.*" %>
<%@ page import="java.text.SimpleDateFormat" %>

<%
    // Définir la date de départ (lundi)
    String startWeekStr = "2024-11-04"; // Format YYYY-MM-DD
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    Calendar calendar = Calendar.getInstance();
    
    // Parse la date de départ
    Date startWeek = sdf.parse(startWeekStr);
    calendar.setTime(startWeek);
    
    // Liste pour stocker les dates de la semaine
    List<String> weekDates = new ArrayList<>();
    
    // Générer les dates de la semaine
    for (int i = 0; i < 7; i++) {
        weekDates.add(sdf.format(calendar.getTime()));
        calendar.add(Calendar.DATE, 1); // Ajouter un jour
    }
%>

<!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 mt-14">
        <div class="flex flex-col">
          <form class="flex flex-col" action="ModifyAttendanceServlet" method="POST">
            <div class="flex space-x-2">
                <h1>Pour les periodes entre :</h1>
                <input type="text" disabled name="startWeek" value="${param.startWeek}" class="w-[90px]">
                et
                <input type="text" disabled name="startWeek" value="${param.endWeek}">
            </div>
            <div class="flex">
                <h1>Pour le salarie avec l'identifiant :</h1>
                <input type="text" disabled name="idSalarie" value="${param.idSalarie}">
            </div>
            <div class="w-full">
              <h1>Lundi <%= weekDates.get(0) %></h1>
              <div class="flex space-x-[5dvw]">
                <div class="relative mb-6">
                  <h1>AM</h1>
                  <div class="flex w-full space-x-[1dvw]">
                    <div
                      class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                    >
                      <input
                        checked
                        id="bordered-radio-1"
                        type="radio"
                        value="1"
                        name="<%= weekDates.get(0) %>_am"
                        class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                      />
                      <label
                        for="bordered-radio-1"
                        class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                        >Au bureau</label
                      >
                    </div>
                    <div
                      class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                    >
                      <input
                        id="bordered-radio-2"
                        type="radio"
                        value="2"
                        name="<%= weekDates.get(0) %>_am"
                        class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                      />
                      <label
                        for="bordered-radio-2"
                        class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                        >Absent</label
                      >
                    </div>
                  </div>
                </div>
                <div class="relative mb-6">
                  <h1>PM</h1>
                  <div class="flex w-full space-x-[1dvw]">
                    <div
                      class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                    >
                      <input
                        checked
                        id="bordered-radio-1"
                        type="radio"
                        value="1"
                        name="<%= weekDates.get(0) %>_pm"
                        class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                      />
                      <label
                        for="bordered-radio-1"
                        class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                        >Au bureau</label
                      >
                    </div>
                    <div
                      class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                    >
                      <input
                        id="bordered-radio-2"
                        type="radio"
                        value="2"
                        name="<%= weekDates.get(0) %>_pm"
                        class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                      />
                      <label
                        for="bordered-radio-2"
                        class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                        >Absent</label
                      >
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="w-full">
            <h1>Mardi <%= weekDates.get(1) %></h1>
            <div class="flex space-x-[5dvw]">
              <div class="relative mb-6">
                <h1>AM</h1>
                <div class="flex w-full space-x-[1dvw]">
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      checked
                      id="bordered-radio-1"
                      type="radio"
                      value="1"
                      name="<%= weekDates.get(1) %>_am"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-1"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Au bureau</label
                    >
                  </div>
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      id="bordered-radio-2"
                      type="radio"
                      value="2"
                      name="<%= weekDates.get(1) %>_am"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-2"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Absent</label
                    >
                  </div>
                </div>
              </div>
              <div class="relative mb-6">
                <h1>PM</h1>
                <div class="flex w-full space-x-[1dvw]">
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      checked
                      id="bordered-radio-1"
                      type="radio"
                      value="1"
                      name="<%= weekDates.get(1) %>_pm"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-1"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Au bureau</label
                    >
                  </div>
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      id="bordered-radio-2"
                      type="radio"
                      value="2"
                      name="<%= weekDates.get(1) %>_pm"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-2"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Absent</label
                    >
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="w-full">
            <h1>Mercredi <%= weekDates.get(2) %></h1>
            <div class="flex space-x-[5dvw]">
              <div class="relative mb-6">
                <h1>AM</h1>
                <div class="flex w-full space-x-[1dvw]">
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      checked
                      id="bordered-radio-1"
                      type="radio"
                      value="1"
                      name="<%= weekDates.get(2) %>_am"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-1"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Au bureau</label
                    >
                  </div>
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      id="bordered-radio-2"
                      type="radio"
                      value="2"
                      name="<%= weekDates.get(2) %>_am"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-2"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Absent</label
                    >
                  </div>
                </div>
              </div>
              <div class="relative mb-6">
                <h1>PM</h1>
                <div class="flex w-full space-x-[1dvw]">
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      checked
                      id="bordered-radio-1"
                      type="radio"
                      value="1"
                      name="<%= weekDates.get(2) %>_pm"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-1"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Au bureau</label
                    >
                  </div>
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      id="bordered-radio-2"
                      type="radio"
                      value="2"
                      name="<%= weekDates.get(2) %>_pm"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-2"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Absent</label
                    >
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="w-full">
            <h1>Jeudi <%= weekDates.get(3) %></h1>
            <div class="flex space-x-[5dvw]">
              <div class="relative mb-6">
                <h1>AM</h1>
                <div class="flex w-full space-x-[1dvw]">
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      checked
                      id="bordered-radio-1"
                      type="radio"
                      value="1"
                      name="<%= weekDates.get(3) %>_am"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-1"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Au bureau</label
                    >
                  </div>
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      id="bordered-radio-2"
                      type="radio"
                      value="2"
                      name="<%= weekDates.get(3) %>_am"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-2"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Absent</label
                    >
                  </div>
                </div>
              </div>
              <div class="relative mb-6">
                <h1>PM</h1>
                <div class="flex w-full space-x-[1dvw]">
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      checked
                      id="bordered-radio-1"
                      type="radio"
                      value="1"
                      name="<%= weekDates.get(3) %>_pm""
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-1"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Au bureau</label
                    >
                  </div>
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      id="bordered-radio-2"
                      type="radio"
                      value="2"
                      name="<%= weekDates.get(3) %>_pm"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-2"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Absent</label
                    >
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="w-full">
            <h1>Vendredi <%= weekDates.get(4) %></h1>
            <div class="flex space-x-[5dvw]">
              <div class="relative mb-6">
                <h1>AM</h1>
                <div class="flex w-full space-x-[1dvw]">
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      checked
                      id="bordered-radio-1"
                      type="radio"
                      value="1"
                      name="<%= weekDates.get(4) %>_am"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-1"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Au bureau</label
                    >
                  </div>
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      id="bordered-radio-2"
                      type="radio"
                      value="2"
                      name="<%= weekDates.get(4) %>_am"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-2"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Absent</label
                    >
                  </div>
                </div>
              </div>
              <div class="relative mb-6">
                <h1>PM</h1>
                <div class="flex w-full space-x-[1dvw]">
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      checked
                      id="bordered-radio-1"
                      type="radio"
                      value="1"
                     name="<%= weekDates.get(4) %>_pm"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-1"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Au bureau</label
                    >
                  </div>
                  <div
                    class="flex items-center ps-4 border border-gray-200 rounded w-[100%]"
                  >
                    <input
                      id="bordered-radio-2"
                      type="radio"
                      value="2"
                      name="<%= weekDates.get(4) %>_pm"
                      class="w-[4dvw] h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
                    />
                    <label
                      for="bordered-radio-2"
                      class="w-full py-4 ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
                      >Absent</label
                    >
                  </div>
                </div>
              </div>
            </div>
          </div>
          <button
                  type="submit"
                  class="relative inline-flex items-center justify-center p-0.5 mb-2 me-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-purple-600 to-blue-500 group-hover:from-purple-600 group-hover:to-blue-500 hover:text-white focus:ring-4 focus:outline-none focus:ring-blue-300"
                >
                  <span
                    class="relative px-5 py-2.5 transition-all ease-in duration-75 bg-white rounded-md group-hover:bg-opacity-0"
                  >
                    Modifier le planning
                  </span>
                </button>
          </form>
        </div>
      </div>
    </div>
  </body>
</html>