diff --git a/application/controllers/api/frontend/v1/Ort.php b/application/controllers/api/frontend/v1/Ort.php index f1d3ddbef..a6a3b3404 100644 --- a/application/controllers/api/frontend/v1/Ort.php +++ b/application/controllers/api/frontend/v1/Ort.php @@ -51,6 +51,15 @@ class Ort extends FHCAPI_Controller */ public function getRooms() { + $this->load->library('form_validation'); + $this->form_validation->set_data($_GET); + $this->form_validation->set_rules('datum','Datum','required'); + $this->form_validation->set_rules('von','Uhrzeit Von','required|regex_match[/^[0-9]{2}:[0-9]{2}$/]'); + $this->form_validation->set_rules('bis','Uhrzeit Bis','required|regex_match[/^[0-9]{2}:[0-9]{2}$/]'); + if($this->form_validation->run() == FALSE) { + $this->terminateWithValidationErrors($this->form_validation->error_array()); + } + $datum = $this->input->get('datum', TRUE); $von = $this->input->get('von', TRUE); $bis = $this->input->get('bis', TRUE); diff --git a/public/js/components/Cis/Raumsuche/Raumsuche.js b/public/js/components/Cis/Raumsuche/Raumsuche.js index b5f00aafc..a86c3825b 100644 --- a/public/js/components/Cis/Raumsuche/Raumsuche.js +++ b/public/js/components/Cis/Raumsuche/Raumsuche.js @@ -91,7 +91,9 @@ export default { + '/CisVue/Cms/content/' + room.content_id }, getTimeString(time) { - return `${time.hours}:${time.minutes}:00` + const hours = String(time.hours).padStart(2, '0'); + const minutes = String(time.minutes).padStart(2, '0'); + return `${hours}:${minutes}` }, setupData(data){ const d = data.map(room => { @@ -119,7 +121,7 @@ export default { }) }, loadRooms() { - this.$fhcApi.factory.ort.getRooms(this.datum, this.getTimeString(this.von), this.getTimeString(this.bis), this.selectedType?.raumtyp_kurzbz ?? '', this.anzahl) + this.$fhcApi.factory.ort.getRooms(this.datum.toISOString(), this.getTimeString(this.von), this.getTimeString(this.bis), this.selectedType?.raumtyp_kurzbz ?? '', this.anzahl) .then(res => { if(res?.data?.retval) this.setupData(res.data.retval) }) @@ -179,7 +181,7 @@ export default {