From eca9b22f7dbab5b8a534a3b807b2138df60ea72e Mon Sep 17 00:00:00 2001 From: Ivymaster Date: Thu, 7 May 2026 13:35:50 +0200 Subject: [PATCH] Add tristate filter in Room manager table, add parent room short code in vilesci legacy code --- .../controllers/api/frontend/v1/Ort.php | 5 +- .../components/RoomManager/RoomFormModal.js | 16 +-- .../RoomManager/RoomManagerOverview.js | 63 ++++++++--- .../RoomManager/RoomTypeFormModal.js | 7 +- system/phrasesupdate.php | 100 ++++++++++++++++++ vilesci/stammdaten/raum_uebersicht.php | 2 + 6 files changed, 156 insertions(+), 37 deletions(-) diff --git a/application/controllers/api/frontend/v1/Ort.php b/application/controllers/api/frontend/v1/Ort.php index 7d1329e69..7a4f24acf 100644 --- a/application/controllers/api/frontend/v1/Ort.php +++ b/application/controllers/api/frontend/v1/Ort.php @@ -107,7 +107,7 @@ class Ort extends FHCAPI_Controller } foreach ($searchableBooleanAttributes as $attribute) { - if (isset($filter[$attribute]) && $filter[$attribute] !== '' && $filter[$attribute] === 'true' ) { + if (isset($filter[$attribute]) && $filter[$attribute] !== '') { $queryWhereFragments[] = "public.tbl_ort.$attribute = ?"; $filterData[] = $filter[$attribute] === 'true' ? true : false; } @@ -152,9 +152,8 @@ class Ort extends FHCAPI_Controller $pageCount = ceil($totalItems / $paginationSize); $this->addTabulatorPaginationData($pageCount); } + $this->terminateWithSuccess($queryData); - - exit; } /** diff --git a/public/js/components/RoomManager/RoomFormModal.js b/public/js/components/RoomManager/RoomFormModal.js index 96ff29370..b1eca5145 100644 --- a/public/js/components/RoomManager/RoomFormModal.js +++ b/public/js/components/RoomManager/RoomFormModal.js @@ -132,10 +132,6 @@ export default { if (getLocationsResponse.meta.status === "success") { this.editedRoom = getLocationsResponse.data; } else { - console.error( - "Error fetching room data:", - getLocationsResponse.meta.message, - ); this.$fhcAlert.alertError(this.$p.t("ui", "errorLoadingRoomData")); return; } @@ -255,7 +251,7 @@ export default { if (getRoomsResponse.meta.status === "success") { return getRoomsResponse.data; } else { - console.error("Error fetching rooms:", getRoomsResponse.meta.message); + this.$fhcAlert.alertError(this.$p.t("ui", "errorLoadingRooms")); } return []; @@ -272,10 +268,7 @@ export default { kurzbz: "----------", }); } else { - console.error( - "Error fetching locations:", - getLocationsResponse.meta.message, - ); + this.$fhcAlert.alertError(this.$p.t("ui", "errorLoadingLocations")); } let getAllOrganizationalUnitsResponse = await this.$api.call( @@ -286,9 +279,8 @@ export default { (a, b) => a.bezeichnung.localeCompare(b.bezeichnung), ); } else { - console.error( - "Error fetching organizational units:", - getAllOrganizationalUnitsResponse.meta.message, + this.$fhcAlert.alertError( + this.$p.t("ui", "errorLoadingOrganizationalUnits"), ); } diff --git a/public/js/components/RoomManager/RoomManagerOverview.js b/public/js/components/RoomManager/RoomManagerOverview.js index 0172cbcac..f49f5bb02 100644 --- a/public/js/components/RoomManager/RoomManagerOverview.js +++ b/public/js/components/RoomManager/RoomManagerOverview.js @@ -42,9 +42,9 @@ export default { locationId: null, organizationalUnit: null, buildingComponent: null, - isForTrainingProgram: false, - isReservationNeeded: false, - isActive: false, + isForTrainingProgram: null, + isReservationNeeded: null, + isActive: null, }, locations: [], organizationalUnits: [], @@ -107,9 +107,38 @@ export default { let floorFilter = params?.filter?.find((filter) => filter.field === "stockwerk"); let parentRoomFilter = params?.filter?.find((filter) => filter.field === "pr_ort_kurzbz"); - let isForTrainingProgramValue = this.filterData.isForTrainingProgram ? "true" : isForTrainingProgramFilter?.value ? "true" : "false"; - let reservationNeededValue = this.filterData.isReservationNeeded ? "true" : reservationNeededFilter?.value ? "true" : "false"; - let isActiveValue = this.filterData.isActive ? "true" : isActiveFilter?.value ? "true" : "false"; + let isForTrainingProgramValue = null; + if (this.filterData.isForTrainingProgram === true) { + isForTrainingProgramValue = true; + } else { + if (isForTrainingProgramFilter?.value === true) { + isForTrainingProgramValue = true; + } else if (isForTrainingProgramFilter?.value === false) { + isForTrainingProgramValue = false; + } + } + + let reservationNeededValue = null; + if (this.filterData.isReservationNeeded === true) { + reservationNeededValue = true; + } else { + if (reservationNeededFilter?.value === true) { + reservationNeededValue = true; + } else if (reservationNeededFilter?.value === false) { + reservationNeededValue = false; + } + } + + let isActiveValue = null; + if (this.filterData.isActive === true) { + isActiveValue = true; + } else { + if (isActiveFilter?.value === true) { + isActiveValue = true; + } else if (isActiveFilter?.value === false) { + isActiveValue = false; + } + } return this.$api.call( ApiRoom.getAllRooms({ @@ -192,6 +221,9 @@ export default { title: this.$capitalize(this.$p.t("ui", "lehre")), field: "lehre", headerFilter: true, + headerFilterParams: { + "tristate":true, elementAttributes:{"value":"true"} + }, formatter: "tickCross", hozAlign: "center", formatterParams: { @@ -203,6 +235,9 @@ export default { title: this.$capitalize(this.$p.t("ui", "reservieren")), field: "reservieren", headerFilter: true, + headerFilterParams: { + "tristate":true, elementAttributes:{"value":"true"} + }, formatter: "tickCross", hozAlign: "center", formatterParams: { @@ -214,6 +249,9 @@ export default { title: this.$capitalize(this.$p.t("gruppenmanagement", "aktiv")), field: "aktiv", headerFilter: true, + headerFilterParams: { + "tristate":true, elementAttributes:{"value":"true"} + }, formatter: "tickCross", hozAlign: "center", formatterParams: { @@ -378,13 +416,11 @@ export default { this.$p.t("ui", "roomDeletedSuccessfully"), ); } else { - console.error("Error deleting room:", response.meta.message); this.reloadTableData(); this.$fhcAlert.alertError(this.$p.t("ui", "errorDeletingRoom")); } }) .catch((error) => { - console.error("Error deleting room:", error); this.$fhcAlert.alertError(this.$p.t("ui", "errorDeletingRoom")); }); }, @@ -411,7 +447,6 @@ export default { this.$fhcAlert.alertSuccess(this.$p.t("ui", "successUpdate")); this.reloadTableData(); } else { - console.error("Error updating room:", response.meta.message); this.$fhcAlert.alertError(this.$p.t("ui", "errorUpdatingRoom")); } }, @@ -424,10 +459,7 @@ export default { this.locations = getLocationsResponse.data; this.locations.unshift({ standort_id: null, kurzbz: "----------" }); } else { - console.error( - "Error fetching locations:", - getLocationsResponse.meta.message, - ); + this.$fhcAlert.alertError(this.$p.t("ui", "errorLoadingLocations")); } let getAllOrganizationalUnitsResponse = await this.$api.call( @@ -438,10 +470,7 @@ export default { (a, b) => a.bezeichnung.localeCompare(b.bezeichnung), ); } else { - console.error( - "Error fetching organizational units:", - getAllOrganizationalUnitsResponse.meta.message, - ); + this.$fhcAlert.alertError(this.$p.t("ui", "errorLoadingOrganizationalUnits")); } }, mounted() { diff --git a/public/js/components/RoomManager/RoomTypeFormModal.js b/public/js/components/RoomManager/RoomTypeFormModal.js index 2a86e95a2..1c790557a 100644 --- a/public/js/components/RoomManager/RoomTypeFormModal.js +++ b/public/js/components/RoomManager/RoomTypeFormModal.js @@ -245,10 +245,7 @@ export default { if (getRoomTypesResponse.meta.status === "success") { this.roomTypes = getRoomTypesResponse.data; } else { - console.error( - "Error fetching room types:", - getRoomTypesResponse.meta.message, - ); + this.$fhcAlert.alertError(this.$p.t("ui", "errorLoadingRoomTypes")); } }, }, @@ -276,7 +273,7 @@ export default {
diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 2bd8eaf7a..402bcead4 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -58517,6 +58517,26 @@ I have been informed that I am under no obligation to consent to the transmissio ) ) ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'errorLoadingRooms', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Fehler beim Laden der Räume', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Error loading rooms', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'ui', @@ -58977,6 +58997,86 @@ I have been informed that I am under no obligation to consent to the transmissio ) ) ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'errorLoadingLocations', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Fehler beim Laden der Standorte', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Error loading locations', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'errorLoadingOrganizationalUnits', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Fehler beim Laden der Organisationseinheiten', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Error loading organizational units', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'errorLoadingRoomTypes', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Fehler beim Laden der Raumtypen', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Error loading room types', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'successUpdate', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Änderungen erfolgreich gespeichert', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Changes saved successfully', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), ); diff --git a/vilesci/stammdaten/raum_uebersicht.php b/vilesci/stammdaten/raum_uebersicht.php index 755e43427..41843ebaf 100644 --- a/vilesci/stammdaten/raum_uebersicht.php +++ b/vilesci/stammdaten/raum_uebersicht.php @@ -244,6 +244,7 @@ if (isset($_GET['sendform'])) Aktiv Kosten Stockwerk + Parent Ort Kurzbz '; @@ -287,6 +288,7 @@ if (isset($_GET['sendform'])) $htmlstr .= " ".$twraum->kosten."\n"; $htmlstr .= " ".$twraum->stockwerk."\n"; + $htmlstr .= " ".$twraum->parent_ort_kurzbz."\n"; $htmlstr .= " \n"; }