From 761e3fb3fd035e8910cb5cf78de4b1ca39e15847 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?=
 <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de>
Date: Wed, 26 Feb 2025 22:43:51 +0100
Subject: [PATCH] Scheduler: Show room name instead of id in modal for direct
 slot creation

This implements #241
---
 AKScheduling/forms.py                                     | 3 ++-
 AKScheduling/templates/admin/AKScheduling/scheduling.html | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/AKScheduling/forms.py b/AKScheduling/forms.py
index 47a19f78..5eff1fca 100644
--- a/AKScheduling/forms.py
+++ b/AKScheduling/forms.py
@@ -24,7 +24,8 @@ class AKAddSlotForm(forms.Form):
     start = forms.CharField(label=_("Start"), disabled=True)
     end = forms.CharField(label=_("End"), disabled=True)
     duration = forms.CharField(label=_("Duration"), disabled=True)
-    room = forms.IntegerField(label=_("Room"), disabled=True)
+    room = forms.IntegerField(label=_("Room"), disabled=True, widget=forms.HiddenInput())
+    room_name = forms.CharField(label=_("Room"), disabled=True)
 
     def __init__(self, event):
         super().__init__()
diff --git a/AKScheduling/templates/admin/AKScheduling/scheduling.html b/AKScheduling/templates/admin/AKScheduling/scheduling.html
index 8d592aec..437043cd 100644
--- a/AKScheduling/templates/admin/AKScheduling/scheduling.html
+++ b/AKScheduling/templates/admin/AKScheduling/scheduling.html
@@ -157,6 +157,7 @@
                     $('#id_start').val(info.startStr);
                     $('#id_end').val(info.endStr);
                     $('#id_room').val(info.resource._resource.id);
+                    $('#id_room_name').val(info.resource._resource.title);
                     $('#id_duration').val(Math.abs(info.end-info.start)/1000/60/60);
                     $('#id_ak').val("");
                     $('#newAKSlotModal').modal('show');
-- 
GitLab