home.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. {% load static %}
  2. {% load custom_tags %}
  3. {% load bootstrap5 %}
  4. <!DOCTYPE html>
  5. <html lang="de">
  6. <head>
  7. <meta charset="UTF-8">
  8. <title>Dienstplan</title>
  9. <link rel="icon" href="{% static 'favicon.png' %}">
  10. {% bootstrap_css %}
  11. <style>
  12. body {
  13. font-family: Tahoma, sans-serif;
  14. margin: 0;
  15. padding: 0;
  16. font-size: 10px; /* Set the base font size */
  17. }
  18. .shift-none {
  19. background-color: white !important;
  20. text-align: center !important;
  21. {% if user.is_authenticated %}
  22. cursor: pointer !important;
  23. {% endif %}
  24. }
  25. .shift-vacation {
  26. background-color: blue !important;
  27. color: white !important;
  28. text-align: center;
  29. }
  30. .shift-sick {
  31. background-color: yellow !important;
  32. text-align: center;
  33. }
  34. .shift-other {
  35. background-color: gray !important;
  36. color: white !important;
  37. text-align: center;
  38. }
  39. .buttons-container {
  40. display: flex;
  41. justify-content: space-between;
  42. padding: 10px;
  43. background-color: #f8f9fa;
  44. border-bottom: 1px solid #dee2e6;
  45. }
  46. .container-fluid {
  47. padding-top: 10px; /* Reduce the padding to remove extra space */
  48. }
  49. a {
  50. color: black;
  51. text-decoration: none;
  52. }
  53. a:hover {
  54. color: black;
  55. }
  56. .employee-name {
  57. text-align: left;
  58. font-weight: bold;
  59. width: 150px; /* Set a fixed width for the employee column */
  60. }
  61. .day-name {
  62. text-align: center;
  63. width: 150px; /* Set a fixed width for the employee column */
  64. }
  65. .table th, .table td {
  66. vertical-align: middle;
  67. width: 100px; /* Set a fixed width for all other columns */
  68. padding: 4px; /* Reduce padding to decrease row height */
  69. line-height: 1.2; /* Adjust line height to decrease row height */
  70. }
  71. .custom-heading {
  72. margin: 0; /* Remove margin to eliminate extra space */
  73. }
  74. @media print {
  75. .btn {
  76. display: none; /* Hide the buttons when printing */
  77. }
  78. }
  79. </style>
  80. </head>
  81. <body>
  82. <div class="container-fluid">
  83. <table class="table">
  84. <tr>
  85. <td><a href="?start_date={{ previous_week }}" class="btn btn-primary text-start">Eine Woche zurück</a></td>
  86. <td><a href="/" class="btn btn-primary">Aktuelle Woche</a></td>
  87. <td><h4 class="custom-heading text-center">Dienstplan für KW {{ calendar_week }}</h4></td>
  88. <td><h4><form method="post" name='nextdate' action="/" style="display: inline;">
  89. {% csrf_token %}
  90. <input type="date" name="nextdate" value="" >
  91. <a href="#" onclick="document.forms[0].submit();return false;">Datum öffnen</a>
  92. </form></h4></td>
  93. <td class="text-end">{% if user.is_authenticated %}
  94. <form method="post" action="{% url 'logout' %}" style="display: inline;">
  95. {% csrf_token %}
  96. <button type="submit" class="btn btn-secondary">Logout</button>
  97. </form>
  98. {% else %}
  99. <a href="/login/" class="btn btn-secondary">Login</a>
  100. {% endif %}</td>
  101. <td class="text-end"><a href="?start_date={{ next_week }}" class="btn btn-primary">Eine Woche vorwärts</a></td>
  102. </tr>
  103. </table>
  104. {% if user.is_authenticated %}
  105. <div class="table-responsive">
  106. <table class="table table-bordered table-striped table-hover w-100">
  107. <thead class="table-dark">
  108. <tr>
  109. <th class="employee-name">Veranstaltungen</th>
  110. {% for day, date in days_with_dates %}
  111. <th class="day-name">{{ day }} {{ date }}</th>
  112. {% endfor %}
  113. </tr>
  114. </thead>
  115. <tbody>
  116. {% for location, events in events_by_location.items %}
  117. <tr>
  118. <td class="employee-name">{{ location.name }}</td>
  119. {% for day, date in days_with_dates %}
  120. {% with event=events|get_item:forloop.counter0 %}
  121. {% if event == None %}
  122. {% if user.is_authenticated %}
  123. <td class="shift-none" onclick="window.location.href='{% url 'create_event' %}?date={{ date }}'">--</td>
  124. {% else %}
  125. <td class="shift-none">--</td>
  126. {% endif %}
  127. {% else %}
  128. <td class="shift-none" {% if user.is_superuser %} onclick="window.location.href='{% url 'edit_event' pk=event.id %}'" {% endif %} data-bs-toggle="tooltip" data-bs-placement="top" data-bs-html="true" title="Name: {{ event.name }}<br> Location: {{ event.location }}<br> Belegung: {{ event.belegung }}<br> PAX: {{ event.pax }}<br> CVD: {{ event.cvd }}<br> CVT: {{ event.cvt }}<br> Info: {{ event.info }}">
  129. {% if event.name %}
  130. {{ event.name }}
  131. {% else %}
  132. F
  133. {% endif %}
  134. </td>
  135. {% endif %}
  136. {% endwith %}
  137. {% endfor %}
  138. </tr>
  139. {% endfor %}
  140. <tr>
  141. <td class="employee-name">Reinigung</td>
  142. {% for day in range_days %}
  143. {% if reinigungs_by_date|default_if_none:None %}
  144. {% if reinigungs_by_date|get_item:day %}
  145. {% with reinigung=reinigungs_by_date|get_item:day %}
  146. <td class="shift-none" {% if user.is_superuser %} onclick="window.location.href='{% url 'edit_reinigung' pk=reinigung.id %}'" {% endif %}>
  147. {{ reinigung.auftrag }}
  148. </td>
  149. {% endwith %}
  150. {% else %}
  151. <td class="shift-none" {% if user.is_superuser %} onclick="window.location.href='{% url 'create_reinigung' %}?date={{ date }}'" {% endif %}>--</td>
  152. {% endif %}
  153. {% else %}
  154. <td class="shift-none" {% if user.is_superuser %} onclick="window.location.href='{% url 'create_reinigung' %}?date={{ date }}'" {% endif %}>--</td>
  155. {% endif %}
  156. {% endfor %}
  157. </tr>
  158. <tr>
  159. <td class="employee-name">Helfer</td>
  160. {% for day in range_days %}
  161. {% if helpers_by_date|default_if_none:None %}
  162. {% if helpers_by_date|get_item:day %}
  163. {% with helper=helpers_by_date|get_item:day %}
  164. <td class="shift-none" {% if user.is_superuser %} onclick="window.location.href='{% url 'edit_helper' pk=helper.id %}'" {% endif %}>
  165. {{ helper.ben }}/{{ helper.best }}
  166. </td>
  167. {% endwith %}
  168. {% else %}
  169. <td class="shift-none" {% if user.is_superuser %} onclick="window.location.href='{% url 'create_helper' %}?date={{ date }}'" {% endif %}>--</td>
  170. {% endif %}
  171. {% else %}
  172. <td class="shift-none" {% if user.is_superuser %} onclick="window.location.href='{% url 'create_helper' %}?date={{ date }}'" {% endif %}>--</td>
  173. {% endif %}
  174. {% endfor %}
  175. </tr>
  176. </tbody>
  177. <tbody>
  178. <tr class="table-dark">
  179. <th class="employee-name">Mitarbeiter</th>
  180. {% for day, date in days_with_dates %}
  181. <th class="day-name">{{ day }} {{ date }}</th>
  182. {% endfor %}
  183. </tr>
  184. {% for employee, shifts in shifts_by_employee.items %}
  185. <tr>
  186. <td class="employee-name">{{ employee.name }}</td>
  187. {% for day, date in days_with_dates %}
  188. {% with shift=shifts|get_item:forloop.counter0 %}
  189. {% if shift == None %}
  190. <td class="shift-none" {% if user.is_superuser %} onclick="window.location.href='{% url 'create_multiple_shifts' %}?date={{ date }}'"{% endif %}>
  191. F
  192. </td>
  193. {% else %}
  194. <td class="
  195. {% if shift.start and shift.end %}
  196. shift-none
  197. {% elif shift.shifttype == 'U' %}
  198. shift-vacation
  199. {% elif shift.shifttype == 'K' %}
  200. shift-sick
  201. {% else %}
  202. shift-other
  203. {% endif %}
  204. "
  205. {% if user.is_superuser %}
  206. onclick="window.location.href='{% url 'edit_shift' pk=shift.id %}'"
  207. {% endif %}
  208. {% if shift.info %}
  209. data-bs-toggle="tooltip" data-bs-placement="top" data-bs-html="true" title="Info: {{ shift.info }}"
  210. {% endif %}
  211. >
  212. {% if shift.start and shift.end %}
  213. {{ shift.start|time:"H:i" }} - {{ shift.end|time:"H:i" }} {% if shift.shifttype != "N" %} {{ shift.shifttype }} {% endif %} {% if shift.info %} ! {% endif %}
  214. {% if shift.shiftchef %}
  215. {{ shift.shiftchef }}
  216. {% endif %}
  217. {% else %}
  218. {{ shift.get_shifttype_display }}
  219. {% endif %}
  220. </td>
  221. {% endif %}
  222. {% endwith %}
  223. {% endfor %}
  224. </tr>
  225. {% endfor %}
  226. </tbody>
  227. </table>
  228. </div>
  229. {% endif %}
  230. </div>
  231. {% bootstrap_javascript %}
  232. <script>
  233. // Initialize all tooltips on the page
  234. var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
  235. var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
  236. return new bootstrap.Tooltip(tooltipTriggerEl)
  237. })
  238. </script>
  239. </body>
  240. </html>