From ce42235972d401c4d9e890a7668a31d702c51d2b Mon Sep 17 00:00:00 2001
From: Hangzhi Yu <hangzhi@protonmail.com>
Date: Sat, 19 Oct 2024 22:23:39 +0200
Subject: [PATCH] Use subject chip select field

---
 .../chronos/frontend/components/amendLesson.graphql |  2 ++
 .../components/substitutions/SubstitutionCard.vue   | 13 +++++--------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/aleksis/apps/chronos/frontend/components/amendLesson.graphql b/aleksis/apps/chronos/frontend/components/amendLesson.graphql
index 79b44b37..7978f944 100644
--- a/aleksis/apps/chronos/frontend/components/amendLesson.graphql
+++ b/aleksis/apps/chronos/frontend/components/amendLesson.graphql
@@ -2,6 +2,8 @@ query gqlSubjects {
   amendableSubjects: subjects {
     id
     name
+    colourFg
+    colourBg
   }
 }
 
diff --git a/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue b/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue
index 618ee11a..f520df33 100644
--- a/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue
+++ b/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue
@@ -1,9 +1,9 @@
 <script setup>
 import SubstitutionInformation from "./SubstitutionInformation.vue";
 import TeacherField from "aleksis.apps.cursus/components/TeacherField.vue";
-import SubjectField from "aleksis.apps.cursus/components/SubjectField.vue";
+import SubjectChipSelectField from "aleksis.apps.cursus/components/SubjectChipSelectField.vue";
 
-import { gqlRooms } from "../amendLesson.graphql";
+import { gqlRooms, gqlSubjects } from "../amendLesson.graphql";
 
 import createOrPatchMixin from "aleksis.core/mixins/createOrPatchMixin.js";
 import deleteMixin from "aleksis.core/mixins/deleteMixin.js";
@@ -23,14 +23,10 @@ import deleteMixin from "aleksis.core/mixins/deleteMixin.js";
 
       <v-spacer />
 
-      <subject-field
-        :enable-create="false"
-        dense
-        outlined
-        hide-details
+      <subject-chip-select-field
         :value="subject"
         :disabled="loading"
-        :label="$t('chronos.substitutions.overview.subject.label')"
+        :items="amendableSubjects"
         @input="subjectInput"
       />
 
@@ -396,6 +392,7 @@ export default {
   },
   apollo: {
     amendableRooms: gqlRooms,
+    amendableSubjects: gqlSubjects,
   },
 };
 </script>
-- 
GitLab