From 1125020d6f296ea68e63117c59240b202327dce8 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Wed, 27 Jan 2021 09:36:29 +0000 Subject: [PATCH] Add ShiftSchedule entity and routes. #534 --- config/acl.yaml | 8 ++ config/menu.yaml | 4 + config/routes/shift_schedule.yaml | 33 ++++++ src/Controller/ShiftScheduleController.php | 5 + src/Entity/ShiftSchedule.php | 129 +++++++++++++++++++++ 5 files changed, 179 insertions(+) create mode 100644 config/routes/shift_schedule.yaml create mode 100644 src/Controller/ShiftScheduleController.php create mode 100644 src/Entity/ShiftSchedule.php diff --git a/config/acl.yaml b/config/acl.yaml index d39b6be3..71a4918a 100644 --- a/config/acl.yaml +++ b/config/acl.yaml @@ -430,6 +430,14 @@ access_keys: label: Menu - id: analytics.forecast label: Forecasting + - id: shift_schedule.list + label: List + - id: shift_schedule.add + label: Add + - id: shift_schedule.update + label: Update + - id: shift_schedule.delete + label: Delete - id: sap_battery label: SAP Battery Access diff --git a/config/menu.yaml b/config/menu.yaml index d90ba3da..67b41bbc 100644 --- a/config/menu.yaml +++ b/config/menu.yaml @@ -216,3 +216,7 @@ main_menu: acl: analytics.forecast label: Forecasting parent: analytics + - id: shift_schedule_list + acl: shift_schedule.list + label: Shift Schedule + parent: analytics diff --git a/config/routes/shift_schedule.yaml b/config/routes/shift_schedule.yaml new file mode 100644 index 00000000..4b1a2d95 --- /dev/null +++ b/config/routes/shift_schedule.yaml @@ -0,0 +1,33 @@ +shift_schedule_list: + path: /shift_schedules + controller: App\Controller\ShiftScheduleController::index + +shift_schedule_rows: + path: /shift_schedules/rows + controller: App\Controller\ShiftScheduleController::rows + methods: [POST] + +shift_schedule_create: + path: /shift_schedules/create + controller: App\Controller\ShiftScheduleController::addForm + methods: [GET] + +shift_schedule_create_submit: + path: /shift_schedules/create + controller: App\Controller\ShiftScheduleController::addSubmit + methods: [POST] + +shift_schedule_update: + path: /shift_schedules/{id} + controller: App\Controller\ShiftScheduleController::updateForm + methods: [GET] + +shift_schedule_update_submit: + path: /shift_schedules/{id} + controller: App\Controller\ShiftScheduleController::updateSubmit + methods: [POST] + +shift_schedule_delete: + path: /shift_schedules/{id} + controller: App\Controller\ShiftScheduleController::destroy + methods: [DELETE] diff --git a/src/Controller/ShiftScheduleController.php b/src/Controller/ShiftScheduleController.php new file mode 100644 index 00000000..b4172ce2 --- /dev/null +++ b/src/Controller/ShiftScheduleController.php @@ -0,0 +1,5 @@ +hour_shifts = []; + } + + public function getID() + { + return $this->id; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + return $this; + } + + public function getStartTime() + { + return $this->start_time; + } + + public function setStartTime($start_time) + { + $this->start_time = $start_time; + return $this; + } + + public function getEndTime() + { + return $this->end_time; + } + + public function setEndTime($end_time) + { + $this->end_time = $end_time; + return $this; + } + + public function getNumberOfHours() + { + return $this->number_of_hours; + } + + public function setNumberOfHours($number_of_hours) + { + $this->number_of_hours = $number_of_hours; + return $this; + } + + public function addHourShift($id, $value) + { + $this->hour_shifts[$id] = $value; + return $this; + } + + public function getHourShiftsiById($id) + { + // return null if we don't have it + if (!isset($this->hour_shifts[$id])) + return null; + + return $this->hour_shifts[$id]; + } + + public function getHourShifts() + { + return $this->hour_shifts; + } +}