Benjamin Roth authored on10/07/2024 14:51:05
Showing2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,53 @@
1
+{% extends "@ContaoCore/Backend/be_page.html.twig" %}
2
+{% block headline %}
3
+    <span>Weinanlieferung</span> <span>Slot-Assistent</span>
4
+{% endblock %}
5
+
6
+{% block error %}
7
+{% endblock %}
8
+
9
+{% block main %}
10
+    <div id="tl_buttons">
11
+        <a href="#" class="header_back" title="" accesskey="b" onclick="Backend.getScrollOffset()">Zurück</a>
12
+    </div>
13
+    <form id="tl_slot_assistant" class="tl_form tl_edit_form" method="post" enctype="application/x-www-form-urlencoded">
14
+        <div class="tl_formbody_edit">
15
+            <input type="hidden" name="FORM_SUBMIT" value="tl_layout">
16
+            <input type="hidden" name="REQUEST_TOKEN" value="dd0600ab990eb28184c9a627397.uq_Gg98WMc-tghIXqTXLwGEz0QHSmuXeWcILJpNHlzQ._Myc6e1UY4Dq-yYu6HuHjT5pvEyaqqmHPIw9btodoAfJ3pzRunpSnf7pcQ">
17
+            <input type="hidden" name="VERSION_NUMBER" value="3">
18
+            <input type="hidden" name="FORM_FIELDS[]" value="{title_legend},name;{header_legend},rows,[rows],headerHeight,footerHeight,[EOF];{column_legend},cols;{sections_legend:hide},sections;{image_legend:hide},lightboxSize,defaultImageDensities;{style_legend},framework,stylesheet,external,loadingOrder,combineScripts,addEuFGridCss;{feed_legend},newsfeeds,calendarfeeds;{modules_legend},modules;{script_legend},scripts,analytics,externalJs,script;{jquery_legend:hide},addJQuery;{mootools_legend:hide},addMooTools;{static_legend:hide},static;{expert_legend:hide},template,minifyMarkup,viewport,titleTag,cssClass,onload,head">
19
+
20
+            <fieldset id="pal_base_legend" class="tl_tbox">
21
+                <legend onclick="AjaxRequest.toggleFieldset(this,'base_legend','tl_layout')">Grundeinstellung</legend>
22
+                <div class="w50 widget">
23
+                    <h3><label><span class="invisible">Pflichtfeld </span>Zeitslot-Typ<span class="mandatory">*</span></label></h3>
24
+                    <select name="slotType" id="ctrl_slotType" class="tl_select" onfocus="Backend.getScrollOffset()">
25
+                        <option value="" selected="">-</option>
26
+                        <option value="annahmestelle_1">Annahmestelle 1 (30 Behälter/h)</option>
27
+                        <option value="annahmestelle_4">Annahmestelle 4 (30 Behälter/h)</option>
28
+                    </select>
29
+                    <p class="tl_help tl_tip" title="">Legen Sie hier den Zeitslot-Typ/Annahmestelle fest.</p>
30
+                </div>
31
+                <div class="w50 widget">
32
+                    <h3><label for="ctrl_buffer"><span class="invisible">Pflichtfeld </span>Pufferzeit in min.<span class="mandatory">*</span></label></h3>
33
+                    <input type="text" name="buffer" id="ctrl_buffer" class="tl_text" value="0" required="" maxlength="3" onfocus="Backend.getScrollOffset()">
34
+                    <p class="tl_help tl_tip" title="">Die Pufferzeit zwischen den Slots.</p>
35
+                </div>
36
+            </fieldset>
37
+
38
+            <fieldset id="pal_time_legend" class="tl_tbox">
39
+                <legend onclick="AjaxRequest.toggleFieldset(this,'time_legend','tl_layout')">Zeitraum</legend>
40
+                {% for field in fields %}
41
+                    {{ field|raw }}
42
+                {% endfor %}
43
+
44
+
45
+
46
+        </div>
47
+        <div class="tl_formbody_submit">
48
+            <div class="tl_submit_container">
49
+                <button type="submit" name="save" id="save" class="tl_submit" accesskey="s">Ausführen</button>
50
+            </div>
51
+        </div>
52
+    </form>
53
+{% endblock %}
0 54
new file mode 100644
... ...
@@ -0,0 +1,84 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of contao-weinanlieferung-bundle.
7
+ *
8
+ * (c) vonRotenberg
9
+ *
10
+ * @license commercial
11
+ */
12
+
13
+namespace vonRotenberg\WeinanlieferungBundle\Controller\Backend;
14
+
15
+use Contao\CoreBundle\Controller\AbstractController;
16
+use Contao\CoreBundle\Csrf\ContaoCsrfTokenManager;
17
+use Contao\Date;
18
+use Contao\Environment;
19
+use Contao\FrontendUser;
20
+use Contao\Input;
21
+use Contao\StringUtil;
22
+use Contao\System;
23
+use Contao\TextField;
24
+use Doctrine\DBAL\Connection;
25
+use Symfony\Component\HttpFoundation\RequestStack;
26
+use Symfony\Component\HttpFoundation\Response;
27
+use Symfony\Component\Routing\Annotation\Route;
28
+use Twig\Environment as TwigEnvironment;
29
+use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungLeseartModel;
30
+use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungRebsorteModel;
31
+use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungReservationModel;
32
+use vonRotenberg\WeinanlieferungBundle\Model\WeinanlieferungSlotsModel;
33
+
34
+/**
35
+ * @Route("%contao.backend.route_prefix%/weinanlieferung/slotassistant", name=self::class, defaults={"_scope" = "backend"})
36
+ */
37
+class WeinanlieferungSlotAssistantController extends AbstractController
38
+{
39
+    private $twig;
40
+    private $tokenManager;
41
+    private $request;
42
+    private $db;
43
+
44
+    public function __construct(TwigEnvironment $twig, ContaoCsrfTokenManager $tokenManager, RequestStack $requestStack, Connection $db)
45
+    {
46
+        $this->twig = $twig;
47
+        $this->tokenManager = $tokenManager;
48
+        $this->request = $requestStack->getCurrentRequest();
49
+        $this->db = $db;
50
+
51
+        $container = System::getContainer();
52
+        $objSession = $container->get('session');
53
+
54
+
55
+        $strKey = Input::get('popup') ? 'popupReferer' : 'referer';
56
+        $strRefererId = $this->request->attributes->get('_contao_referer_id');
57
+
58
+        $session = $objSession->get($strKey);
59
+        $session[$strRefererId]['current'] = substr(Environment::get('requestUri'), \strlen(Environment::get('path')) + 1);
60
+        $objSession->set($strKey, $session);
61
+    }
62
+    public function __invoke(): Response
63
+    {
64
+        $GLOBALS['TL_CSS']['cirrus'] = 'bundles/vonrotenbergweinanlieferung/css/backend.css|static';
65
+        $arrData = [
66
+            'request_token' => $this->tokenManager->getDefaultTokenValue(),
67
+            'ref' => $this->request->attributes->get('_contao_referer_id')
68
+        ];
69
+        System::loadLanguageFile('default');
70
+
71
+        $blah = new TextField();
72
+
73
+        $blah->name = 'text';
74
+
75
+        $arrData['fields'][] = $blah->parse();
76
+
77
+        return new Response(
78
+            $this->twig->render(
79
+                '@Contao_VonrotenbergWeinanlieferungBundle/be_wa_slotassistant.html.twig',
80
+                $arrData
81
+            )
82
+        );
83
+    }
84
+}