Rene 1 жил өмнө
parent
commit
044e0973d5

+ 50 - 7
templates/main/current_week_shifts.html

@@ -6,6 +6,7 @@
 <html lang="de">
 <head>
     <meta charset="UTF-8">
+    <meta http-equiv="refresh" content="120; URL=/current-week-shifts/" >
     <title>Schichten der aktuellen Woche</title>
     <link rel="icon" href="{% static 'favicon.png' %}">
     {% bootstrap_css %}
@@ -19,6 +20,7 @@
         .shift-none {
             background-color: white !important;
             text-align: center;
+            cursor: pointer;
         }
         .shift-vacation {
             background-color: blue !important;
@@ -53,6 +55,7 @@
         }
         .employee-name {
             text-align: left;
+            font-weight: bold;
             width: 150px; /* Set a fixed width for the employee column */
         }
         .day-name {
@@ -62,6 +65,8 @@
         .table th, .table td {
             vertical-align: middle;
             width: 100px; /* Set a fixed width for all other columns */
+            padding: 4px; /* Reduce padding to decrease row height */
+            line-height: 1.2; /* Adjust line height to decrease row height */
         }
         .custom-heading {
             margin: 0; /* Remove margin to eliminate extra space */
@@ -76,29 +81,62 @@
 <body>
     <div class="buttons-container">
         <a href="?start_date={{ previous_week }}" class="btn btn-primary">Eine Woche zurück</a>
+        <a href="/current-week-shifts/" class="btn btn-primary">Aktuelle Woche</a>
+        <form method="post" action="{% url 'logout' %}" style="display: inline;">
+            {% csrf_token %}
+            <button type="submit" class="btn btn-secondary">Logout</button>
+        </form>
         <a href="?start_date={{ next_week }}" class="btn btn-primary">Eine Woche vorwärts</a>
     </div>
     <div class="container-fluid">
-        <h4 class="custom-heading">Dienstplan für KW {{ calendar_week }} - {{ start_of_week }} bis {{ end_of_week }}</h4>
+        <h4 class="custom-heading">Dienstplan für KW {{ calendar_week }}</h4>
         <div class="table-responsive">
             <table class="table table-bordered table-hover w-100">
                 <thead class="table-dark">
                     <tr>
-                        <th class="employee-name">Employee</th>
+                        <th class="employee-name">Veranstaltungen</th>
                         {% for day, date in days_with_dates %}
                         <th class="day-name">{{ day }} {{ date }}</th>
                         {% endfor %}
                     </tr>
                 </thead>
                 <tbody>
+                    {% for location, events in events_by_location.items %}
+                    <tr>
+                        <td class="employee-name">{{ location.name }}</td>
+                        {% for day, date in days_with_dates %}
+                            {% with event=events|get_item:forloop.counter0 %}
+                                {% if event == None %}
+                                    <td class="shift-none" onclick="window.location.href='{% url 'create_event' %}?date={{ date }}'"></td>
+                                {% else %}
+                                    <td class="shift-none" onclick="window.location.href='{% url 'edit_event' pk=event.id %}'" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-html="true" title="Name: {{ event.name }}<br> Location: {{ event.location }}<br> CVD: {{ event.cvd }}<br> CVT: {{ event.cvt }}">
+                                            {% if event.name %}
+                                                {{ event.name }}
+                                            {% else %}
+                                                F
+                                            {% endif %}
+                                    </td>
+                                {% endif %}
+                            {% endwith %}
+                        {% endfor %}
+                    </tr>
+                    {% endfor %}
+                </tbody>
+                <tbody>
+                    <tr class="table-dark">
+                        <th class="employee-name">Mitarbeiter</th>
+                        {% for day, date in days_with_dates %}
+                        <th class="day-name">{{ day }} {{ date }}</th>
+                        {% endfor %}
+                    </tr>
                     {% for employee, shifts in shifts_by_employee.items %}
                     <tr>
                         <td class="employee-name">{{ employee.name }}</td>
                         {% for day, date in days_with_dates %}
                             {% with shift=shifts|get_item:forloop.counter0 %}
                                 {% if shift == None %}
-                                    <td class="shift-none">
-                                        <a href="{% url 'create_multiple_shifts' %}?date={{ date }}">F</a>
+                                    <td class="shift-none" onclick="window.location.href='{% url 'create_multiple_shifts' %}?date={{ date }}'">
+                                        F
                                     </td>
                                 {% else %}
                                     <td class="
@@ -111,14 +149,12 @@
                                         {% else %}
                                             shift-other
                                         {% endif %}
-                                    ">
-                                        <a href="{% url 'edit_shift' pk=shift.id %}">
+                                    " onclick="window.location.href='{% url 'edit_shift' pk=shift.id %}'">
                                             {% if shift.start and shift.end %}
                                                 {{ shift.start|time:"H:i" }} - {{ shift.end|time:"H:i" }}
                                             {% else %}
                                                 {{ shift.get_shifttype_display }}
                                             {% endif %}
-                                        </a>
                                     </td>
                                 {% endif %}
                             {% endwith %}
@@ -130,5 +166,12 @@
         </div>
     </div>
     {% bootstrap_javascript %}
+    <script>
+        // Initialize all tooltips on the page
+        var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
+        var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
+            return new bootstrap.Tooltip(tooltipTriggerEl)
+        })
+    </script>
 </body>
 </html>