ClassRemovedRow.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <div
  3. class="w-full rounded-lg drop-shadow-lg text-xs xl:text-base mb-5"
  4. :class="
  5. hasAlternativeChosen
  6. ? 'bg-sky-200 dark:bg-sky-700'
  7. : 'bg-white dark:bg-gray-600'
  8. "
  9. >
  10. <div
  11. class="flex flex-row gap-4 justify-between items-center m-2 py-3 mr-10"
  12. >
  13. <button
  14. class="action-button flex-none"
  15. :title="isOpen ? 'Schliessen' : 'Öffnen'"
  16. @click="isOpen = !isOpen"
  17. >
  18. <font-awesome-icon
  19. v-if="isOpen"
  20. icon="fa-solid fa-chevron-down"
  21. />
  22. <font-awesome-icon
  23. v-else
  24. icon="fa-solid fa-chevron-right"
  25. />
  26. </button>
  27. <span class="font-bold">{{ taughtClass.name }}</span>
  28. <span class="">{{ taughtClass.executionTime }}</span>
  29. <span class="">{{ taughtClass.class }}</span>
  30. <span class="hidden md:inline-block">{{
  31. taughtClass.teachers.join(", ")
  32. }}</span>
  33. <span class="hidden md:inline-block">{{
  34. taughtClass.rooms.join(", ")
  35. }}</span>
  36. <span class="">
  37. <TeachingTypeIcon :teaching-type="taughtClass.teaching_type" />
  38. </span>
  39. </div>
  40. <hr
  41. v-if="isOpen"
  42. class="-mt-2"
  43. >
  44. <div
  45. v-if="isOpen"
  46. class="bg-white dark:bg-gray-800 w-full rounded-b-lg"
  47. >
  48. <table
  49. v-if="alternatives.length > 0"
  50. class="w-full upgrade-module-table"
  51. >
  52. <thead>
  53. <tr>
  54. <td class="pl-5">
  55. Modul
  56. </td>
  57. <td>Durchführung</td>
  58. <td>Klasse</td>
  59. <td class="hidden md:table-cell">
  60. Dozent
  61. </td>
  62. <td class="hidden md:table-cell">
  63. Raum
  64. </td>
  65. <td>Art</td>
  66. <td class="hidden md:table-cell">
  67. MSP
  68. </td>
  69. <td class="w-24" />
  70. </tr>
  71. </thead>
  72. <tbody>
  73. <ClassRow
  74. v-for="(alt, idx) in alternatives"
  75. :key="alt.id"
  76. :cls="alt"
  77. :apply-row-class="idx == 0"
  78. />
  79. </tbody>
  80. </table>
  81. <div
  82. v-else
  83. class="w-full flex justify-center py-5 text-gray-800 dark:text-gray-300"
  84. >
  85. <span>Leider gibt es keine Alternativen!</span>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <script lang="ts">
  91. import { PropType } from "vue";
  92. import { TaughtClass } from "../../types";
  93. import ClassRow from "../general/ClassRow.vue";
  94. import { useClassesStore } from "../../stores/classes";
  95. import { usePlanningStore } from "../../stores/planning";
  96. import TeachingTypeIcon from "./TeachingTypeIcon.vue";
  97. export default {
  98. name: "ClassRemovedRow",
  99. components: { ClassRow, TeachingTypeIcon },
  100. props: {
  101. taughtClass: {
  102. required: true,
  103. type: Object as PropType<TaughtClass>,
  104. },
  105. },
  106. data() {
  107. return {
  108. isOpen: false,
  109. };
  110. },
  111. computed: {
  112. alternatives(): TaughtClass[] {
  113. const classesStore = useClassesStore();
  114. return classesStore.allClasses.filter(
  115. (cls) => cls.name == this.taughtClass.name,
  116. );
  117. },
  118. hasAlternativeChosen(): boolean {
  119. const alternatives = this.alternatives;
  120. const planningStore = usePlanningStore();
  121. return planningStore.chosen.some((el) => {
  122. return alternatives.some((al) => el.id == al.id);
  123. });
  124. },
  125. },
  126. };
  127. </script>
  128. <style>
  129. .upgrade-module-table thead td {
  130. @apply border-b border-gray-700 h-8 text-gray-500 font-bold;
  131. }
  132. .upgrade-module-table thead tr {
  133. @apply hover:bg-inherit;
  134. }
  135. .upgrade-module-table tbody td {
  136. @apply border-0 h-12 cursor-pointer;
  137. }
  138. .upgrade-module-table tbody .row:last-child {
  139. @apply border-b-0;
  140. }
  141. .upgrade-module-table .class-name {
  142. @apply pl-5;
  143. }
  144. .upgrade-module-table tr {
  145. @apply hover:bg-gray-900 border-0;
  146. }
  147. </style>
  148. <style scoped>
  149. .action-button {
  150. @apply h-5
  151. text-xs
  152. md:h-7
  153. md:text-base
  154. mx-0.5
  155. md:mx-1
  156. block
  157. hover:bg-gray-400
  158. active:bg-gray-500
  159. disabled:bg-gray-100
  160. disabled:text-gray-400
  161. dark:hover:bg-gray-800
  162. dark:active:bg-gray-900
  163. dark:disabled:bg-gray-800
  164. dark:disabled:text-gray-600
  165. disabled:pointer-events-none
  166. aspect-square
  167. rounded
  168. transition-all
  169. duration-200;
  170. }
  171. </style>