From 4cfa4955f4f77dea40cb0e92fb9b57e6216fd5cb Mon Sep 17 00:00:00 2001 From: adisposkofh Date: Thu, 22 Oct 2026 08:36:36 +0200 Subject: [PATCH] added date input in room reservation creation --- .../api/frontend/v1/calendar/RoomPlan.php | 2 +- application/libraries/StundenplanLib.php | 5 ++- .../Cis/Renderer/Slot/roomModalContent.js | 29 ++++++++++++-- system/phrasesupdate.php | 40 +++++++++++++++++++ 4 files changed, 69 insertions(+), 7 deletions(-) diff --git a/application/controllers/api/frontend/v1/calendar/RoomPlan.php b/application/controllers/api/frontend/v1/calendar/RoomPlan.php index 522478f35..fd67e43d6 100644 --- a/application/controllers/api/frontend/v1/calendar/RoomPlan.php +++ b/application/controllers/api/frontend/v1/calendar/RoomPlan.php @@ -92,7 +92,7 @@ class RoomPlan extends FHCAPI_Controller $result = $this->stundenplanlib->addReservation($start, $end, $title, $beschreibung, $ort_kurzbz, $lektoren, $studiengang_kz, $semester, $verband, $gruppe, $spezialgruppe); if (isError($result)) - $this->terminateWithError($result); + $this->terminateWithError(getError($result)); $this->terminateWithSuccess($result); } diff --git a/application/libraries/StundenplanLib.php b/application/libraries/StundenplanLib.php index 4cfefc634..6c2f4fb79 100644 --- a/application/libraries/StundenplanLib.php +++ b/application/libraries/StundenplanLib.php @@ -528,6 +528,7 @@ class StundenplanLib $this->_ci->load->model('ressource/stundenplandev_model', 'StundenplandevModel'); $this->_ci->load->model('ressource/stundenplan_model', 'StundenplanModel'); $this->_ci->load->library('PermissionLib'); + $this->_ci->load->library('PhrasesLib', ['LvPlan']); $startTime = new DateTime($start); $endTime = new DateTime($end); @@ -558,7 +559,7 @@ class StundenplanLib if ((hasData($stundenplandev_belegung) || hasData($stundenplan_belegung)) && !$this->_ci->permissionlib->isBerechtigt('lehre/reservierungAdvanced')) - return error ('lvplan/bereitsReserviert'); + return error($this->_ci->phraseslib->t('LvPlan', 'bereitsReserviert')); $this->_ci->ReservierungModel->addSelect('stunde'); $reservation_hours = $this->_ci->ReservierungModel->loadWhere(array('datum' => $startTime->format('Y-m-d'), 'ort_kurzbz' => $ort_kurzbz)); @@ -571,7 +572,7 @@ class StundenplanLib if (!empty(array_intersect($stunden, $reservation_hours)) && !$this->_ci->permissionlib->isBerechtigt('lehre/reservierungAdvanced')) - return error("lvplan/bereitsReserviert"); + return error($this->_ci->phraseslib->t('LvPlan', 'bereitsReserviert')); if (!empty($lektoren)) diff --git a/public/js/components/Cis/Renderer/Slot/roomModalContent.js b/public/js/components/Cis/Renderer/Slot/roomModalContent.js index 87c457f4b..618b81c89 100644 --- a/public/js/components/Cis/Renderer/Slot/roomModalContent.js +++ b/public/js/components/Cis/Renderer/Slot/roomModalContent.js @@ -29,6 +29,7 @@ export default { selectedGruppe: null, selectedLektoren: [], nestedGroupOptions: {}, + selectedDate: null, }; }, computed: { @@ -84,6 +85,10 @@ export default { ?.setZone?.(this.timezone) ?.toFormat?.("HH:mm:ss"); + this.selectedDate = newEvent.start + .startOf("day") + .toISO() + .slice(0, 10); this.selectedStart = this.timeGrid.find((t) => t.start === startTime)?.start || this.timeGrid[0]?.start; @@ -92,16 +97,20 @@ export default { this.timeGrid.at(-1)?.end; }, saveEvent() { + const date = this.selectedDate + ? luxon.DateTime.fromFormat(this.selectedDate, "yyyy-MM-dd") + : this.event.start.startOf("day"); const [startHour, startMinute] = this.selectedStart .split(":") .map(Number); const [endHour, endMinute] = this.selectedEnd .split(":") .map(Number); - const selectedStart = this.event.start - .startOf("day") - .set({ hour: startHour, minute: startMinute }); - const selectedEnd = this.event.start + const selectedStart = date.set({ + hour: startHour, + minute: startMinute, + }); + const selectedEnd = date .startOf("day") .set({ hour: endHour, minute: endMinute }); @@ -197,6 +206,18 @@ export default { {{ slot.end }} + +
'core', + 'category' => 'LvPlan', + 'phrase' => 'bereitsReserviert', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Bereits reserviert!', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Already reserved!', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), // LvPlan Phrasen ende //ProfilUpdate Phrasen start array( @@ -55880,6 +55900,26 @@ and represent the current state of research on the topic. The prescribed citatio ) ) ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'date', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Datum', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Date', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'ui',