aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/consultation/admin.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-07-05 07:49:31 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-07-05 07:49:31 +0000
commitbf6e51ea0a3cf8b3db77380a369a8b8a05701da9 (patch)
treed857b7998b2a273a6c686e6b69e4654e84c37c5e /app/controllers/consultation/admin.php
parentac2367fc0b96313831011841eced3a2d69444b7b (diff)
convert consultation creator to new data-vue-app mechanism, fixes #4367
Closes #4367 Merge request studip/studip!3167
Diffstat (limited to 'app/controllers/consultation/admin.php')
-rw-r--r--app/controllers/consultation/admin.php44
1 files changed, 36 insertions, 8 deletions
diff --git a/app/controllers/consultation/admin.php b/app/controllers/consultation/admin.php
index 13451d2..3d2be46 100644
--- a/app/controllers/consultation/admin.php
+++ b/app/controllers/consultation/admin.php
@@ -136,28 +136,56 @@ class Consultation_AdminController extends ConsultationController
{
PageLayout::setTitle(_('Neue Terminblöcke anlegen'));
- $this->room = '';
- $this->responsible = false;
- $this->slot_count_threshold = self::SLOT_COUNT_THRESHOLD;
+ $room = '';
+ $responsible = false;
// TODO: inst_default?
if ($this->range instanceof User) {
$rooms = $this->range->institute_memberships->pluck('Raum');
$rooms = array_filter($rooms);
- $this->room = $rooms ? reset($rooms) : '';
+ $room = $rooms ? reset($rooms) : '';
} elseif ($this->range instanceof Course) {
- $this->room = $this->range->ort;
+ $room = $this->range->ort;
$block = new ConsultationBlock();
$block->range = $this->range;
- $this->responsible = $block->getPossibleResponsibilites();
+ $responsible = $block->getPossibleResponsibilites();
} elseif ($this->range instanceof Institute) {
$block = new ConsultationBlock();
$block->range = $this->range;
- $this->responsible = $block->getPossibleResponsibilites();
+ $responsible = $block->getPossibleResponsibilites();
}
- $this->response->add_header('X-No-Buttons', '');
+ $convertResponsibilities = function ($input) {
+ if ($input === false) {
+ return false;
+ }
+
+ foreach ($input as $key => $values) {
+ $input[$key] = array_map(
+ fn($item) => [
+ 'id' => $item->id,
+ 'label' => $item instanceof Statusgruppen ? $item->getName() : $item->getFullName(),
+ ],
+ $values
+ );
+ }
+
+ return $input;
+ };
+
+ $this->render_vue_app(
+ Studip\VueApp::create('ConsultationCreator')
+ ->withProps([
+ 'as-dialog' => Request::isXhr(),
+ 'cancel-url' => $this->indexURL(),
+ 'default-room' => $room,
+ 'range-type' => get_class($this->range),
+ 'slot-count_threshold' => self::SLOT_COUNT_THRESHOLD,
+ 'store-url' => $this->storeURL(),
+ 'with-responsible' => $convertResponsibilities($responsible),
+ ])
+ );
}
public function store_action()