From 5efbea54687c84d497d86e250c5010f5f4c30661 Mon Sep 17 00:00:00 2001 From: Michael Danielczok <michael@pcsg.de> Date: Tue, 25 Feb 2025 15:35:47 +0100 Subject: [PATCH 1/3] fix: move original price styling to the Basket Control Related: quiqqer/order#179 --- src/QUI/ERP/Order/Controls/Basket/Basket.css | 5 +++++ src/QUI/ERP/Order/Controls/Basket/Basket.php | 2 ++ src/QUI/ERP/Order/Controls/OrderProcess/Basket.css | 7 ------- 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 src/QUI/ERP/Order/Controls/Basket/Basket.css diff --git a/src/QUI/ERP/Order/Controls/Basket/Basket.css b/src/QUI/ERP/Order/Controls/Basket/Basket.css new file mode 100644 index 00000000..6749d027 --- /dev/null +++ b/src/QUI/ERP/Order/Controls/Basket/Basket.css @@ -0,0 +1,5 @@ +:where(.quiqqer-order-basket-articles .offer-original-price) { + display: block; + font-size: 0.875rem; + text-decoration: line-through; +} \ No newline at end of file diff --git a/src/QUI/ERP/Order/Controls/Basket/Basket.php b/src/QUI/ERP/Order/Controls/Basket/Basket.php index 3c9122bd..068165bf 100644 --- a/src/QUI/ERP/Order/Controls/Basket/Basket.php +++ b/src/QUI/ERP/Order/Controls/Basket/Basket.php @@ -49,6 +49,8 @@ public function __construct(array $attributes = []) parent::__construct($attributes); + $this->addCSSFile(dirname(__FILE__) . '/Basket.css'); + $this->setAttributes([ 'data-qui' => 'package/quiqqer/order/bin/frontend/controls/basket/Basket' ]); diff --git a/src/QUI/ERP/Order/Controls/OrderProcess/Basket.css b/src/QUI/ERP/Order/Controls/OrderProcess/Basket.css index 54eb6937..3788086c 100644 --- a/src/QUI/ERP/Order/Controls/OrderProcess/Basket.css +++ b/src/QUI/ERP/Order/Controls/OrderProcess/Basket.css @@ -17,10 +17,3 @@ .quiqqer-order-btn-submit:hover { background: #538018; } - -.offer-original-price { - clear: both; - display: block; - font-size: 80%; - text-decoration: line-through; -} -- GitLab From be2a05bb6a99ba070b29a3819069c014f128b5df Mon Sep 17 00:00:00 2001 From: Henning <leutz@pcsg.de> Date: Wed, 26 Feb 2025 09:48:41 +0100 Subject: [PATCH 2/3] fix: set user to article list at setCustomer() This commit refactors the formatting and structure of the reversal method for improved readability. Additionally, it removes an unnecessary exception in the 'setCustomer' method. This commit also fixes the customer user settings in various methods in the order class. Now, whenever a customer is set or removed, the related articles will correctly update their user status. --- src/QUI/ERP/Order/AbstractOrder.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/QUI/ERP/Order/AbstractOrder.php b/src/QUI/ERP/Order/AbstractOrder.php index e5e45d5d..18b8003c 100644 --- a/src/QUI/ERP/Order/AbstractOrder.php +++ b/src/QUI/ERP/Order/AbstractOrder.php @@ -474,8 +474,10 @@ protected function setDataBaseData(array $data): void * @param QUI\Interfaces\Users\User|null $PermissionUser * @return ErpEntityInterface|null */ - public function reversal(string $reason = '', null | QUI\Interfaces\Users\User $PermissionUser = null): ?ErpEntityInterface - { + public function reversal( + string $reason = '', + null | QUI\Interfaces\Users\User $PermissionUser = null + ): ?ErpEntityInterface { $this->delete($PermissionUser); return null; } @@ -1167,7 +1169,6 @@ public function setCurrency(QUI\ERP\Currency\Currency $Currency): void * Set a customer to the order * * @param array|User|QUI\Interfaces\Users\User $User - * @throws Exception * @throws QUI\Exception * @throws ExceptionStack */ @@ -1264,6 +1265,7 @@ public function setCustomer(QUI\Interfaces\Users\User | array | User $User): voi QUI::getEvents()->fireEvent('onQuiqqerOrderCustomerChange', [$this]); } + $this->Articles?->setUser($this->Customer); return; } @@ -1277,6 +1279,7 @@ public function setCustomer(QUI\Interfaces\Users\User | array | User $User): voi QUI::getEvents()->fireEvent('onQuiqqerOrderCustomerChange', [$this]); } + $this->Articles?->setUser($this->Customer); return; } @@ -1293,6 +1296,8 @@ public function setCustomer(QUI\Interfaces\Users\User | array | User $User): voi if ($this->customerId !== $oldCustomerId) { QUI::getEvents()->fireEvent('onQuiqqerOrderCustomerChange', [$this]); } + + $this->Articles?->setUser($this->Customer); } } @@ -1303,6 +1308,7 @@ public function removeCustomer(): void { $this->Customer = null; $this->customerId = 0; + $this->Articles->setUser(null); try { QUI::getEvents()->fireEvent('onQuiqqerOrderCustomerChange', [$this]); -- GitLab From 1983d5a2c6142d96c1f6abe577b91b94cdf48410 Mon Sep 17 00:00:00 2001 From: Michael Danielczok <michael@pcsg.de> Date: Wed, 26 Feb 2025 10:33:13 +0100 Subject: [PATCH 3/3] fix: improve basket if the basket is empty Related: quiqqer/template-cologne#115 --- locale.xml | 4 +- src/QUI/ERP/Order/Controls/Basket/Basket.css | 157 ++++++++++++++++++ src/QUI/ERP/Order/Controls/Basket/Basket.html | 16 +- src/QUI/ERP/Order/Controls/Basket/Basket.php | 2 + 4 files changed, 175 insertions(+), 4 deletions(-) diff --git a/locale.xml b/locale.xml index 1d2c6178..27e67eb2 100644 --- a/locale.xml +++ b/locale.xml @@ -250,8 +250,8 @@ <en><![CDATA[Copy from order #[orderId]]]></en> </locale> <locale name="message.basket.is.empty"> - <de><![CDATA[Ihr Warenkorb enthält keine Produkte.]]></de> - <en><![CDATA[There are no products in your shopping cart.]]></en> + <de><![CDATA[Ihr Warenkorb enthält keine Produkte]]></de> + <en><![CDATA[There are no products in your shopping cart]]></en> </locale> <locale name="control.basket.buttonAdd.text"> diff --git a/src/QUI/ERP/Order/Controls/Basket/Basket.css b/src/QUI/ERP/Order/Controls/Basket/Basket.css index 6749d027..2d8de539 100644 --- a/src/QUI/ERP/Order/Controls/Basket/Basket.css +++ b/src/QUI/ERP/Order/Controls/Basket/Basket.css @@ -1,5 +1,162 @@ +.quiqqer-order-controls-basket { + --_min-Height: var(--min-Height, 30dvh); + --_decorative-element-height: var(--decorative-element-height, 1rem); + --_decorative-element-width: var(--decorative-element-width, 0.25rem); + --_decorative-element-rotation: var(--decorative-element-rotation, 35deg); + + min-height: var(--_min-Height); +} + :where(.quiqqer-order-basket-articles .offer-original-price) { display: block; font-size: 0.875rem; text-decoration: line-through; +} + +:where(.quiqqer-order-controls-basket .quiqqer-order-basket-isEmpty) { + text-align: center; + min-height: var(--_min-Height); + display: flex; + flex-direction: column; + justify-content: center; +} + +:where(.quiqqer-order-controls-basket .quiqqer-order-basket-isEmpty__iconContainer) { + font-size: 5rem; + opacity: 0.5; +} + +:where(.quiqqer-order-controls-basket .quiqqer-order-basket-isEmpty__text) { + max-width: 40ch; + margin-inline: auto; + margin-top: 1rem; + font-size: 1.25rem; + + opacity: 0; + animation-name: fadeIn; + animation-duration: 0.3s; + animation-delay: 0.25s; + animation-fill-mode: forwards; + animation-timing-function: ease; +} + +:where(.quiqqer-order-controls-basket .quiqqer-order-basket-isEmpty__icon) { + opacity: 0; + animation-name: fadeInIcon; + animation-duration: 0.3s; + animation-fill-mode: forwards; + animation-delay: 0.35s; + animation-timing-function: ease; +} + +:where(.quiqqer-order-controls-basket .decorative-element) { + text-align: center; + display: flex; + justify-content: center; + align-items: end; + gap: 0.5rem; +} + +:where(.quiqqer-order-controls-basket .decorative-element__line) { + display: inline-block; + width: var(--_decorative-element-width); + height: var(--_decorative-element-height); + background: currentColor; + flex-shrink: 0; + border-radius: 0.25rem; + opacity: 0; + + animation-name: fadeInWithSlideDecorationEls; + animation-duration: 0.3s; + animation-fill-mode: forwards; + animation-timing-function: ease; +} + +:where(.quiqqer-order-controls-basket .decorative-element__line--1) { + --transform-start: translateY(5px) rotate(calc(var(--_decorative-element-rotation) * -1)) scaleY(0); + --transform-end: translateY(0) rotate(calc(var(--_decorative-element-rotation) * -1)) scaleY(1); + + transform-origin: bottom left; + transform: var(--transform-start); + animation-delay: 0.5s; +} + +:where(.quiqqer-order-controls-basket .decorative-element__line--2) { + --transform-start: translateY(5px) scaleY(0); + --transform-end: translateY(0) scaleY(1); + + transform-origin: bottom center; + height: calc(var(--_decorative-element-height) * 1.35); + transform: var(--transform-start); + animation-delay: 0.45s; +} + +:where(.quiqqer-order-controls-basket .decorative-element__line--3) { + --transform-start: translateY(5px) rotate(var(--_decorative-element-rotation)) scaleY(0); + --transform-end: translateY(0) rotate(var(--_decorative-element-rotation)) scaleY(1); + + transform-origin: bottom right; + transform: var(--transform-start); + animation-delay: 0.55s; +} + +/* state: loading */ +:where(.quiqqer-order-basket-isLoading) { + min-height: var(--_min-Height); + display: flex; + align-items: center; + justify-content: center; + font-size: 4rem; + opacity: 0.5; +} + +/* keyframes */ +@keyframes fadeIn { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} + +@keyframes fadeInIcon { + from { + opacity: 0; + transform: translateY(10px) scale(0.95); + } + + to { + opacity: 1; + transform: translateY(0) scale(1); + } +} + +@keyframes fadeInWithSlideDecorationEls { + from { + opacity: 0; + transform: var(--transform-start); + } + + to { + opacity: 0.75; + transform: var(--transform-end); + } +} + +/* disable animation */ +@media (prefers-reduced-motion: reduce) { + .animation { + animation: none; + } + + .decorative-element__line.animation { + opacity: 0.75; + transform: var(--transform-end) + } + + .quiqqer-order-basket-isEmpty__text.animation { + opacity: 1; + } } \ No newline at end of file diff --git a/src/QUI/ERP/Order/Controls/Basket/Basket.html b/src/QUI/ERP/Order/Controls/Basket/Basket.html index c5233fbb..aaadc8d2 100644 --- a/src/QUI/ERP/Order/Controls/Basket/Basket.html +++ b/src/QUI/ERP/Order/Controls/Basket/Basket.html @@ -227,11 +227,23 @@ {elseif $this->isGuest() && $this->isLoading()} <div class="quiqqer-order-basket-isLoading"> - <span class="fa fa-spinner fa-spin"></span> + <div class="quiqqer-order-basket-isLoading__inner"> + <span class="fa fa-circle-notch fa-spin"></span> + </div> </div> {else} <div class="quiqqer-order-basket-isEmpty"> - {locale group="quiqqer/order" var="message.basket.is.empty"} + <div class="quiqqer-order-basket-isEmpty__iconContainer"> + <div class="decorative-element"> + <div class="decorative-element__line decorative-element__line--1 animation"></div> + <div class="decorative-element__line decorative-element__line--2 animation"></div> + <div class="decorative-element__line decorative-element__line--3 animation"></div> + </div> + <i class="fa-solid fa-cart-shopping quiqqer-order-basket-isEmpty__icon animation"></i> + </div> + <div class="quiqqer-order-basket-isEmpty__text animation"> + {locale group="quiqqer/order" var="message.basket.is.empty"} + </div> </div> {/if} diff --git a/src/QUI/ERP/Order/Controls/Basket/Basket.php b/src/QUI/ERP/Order/Controls/Basket/Basket.php index 068165bf..50df09a5 100644 --- a/src/QUI/ERP/Order/Controls/Basket/Basket.php +++ b/src/QUI/ERP/Order/Controls/Basket/Basket.php @@ -51,6 +51,8 @@ public function __construct(array $attributes = []) $this->addCSSFile(dirname(__FILE__) . '/Basket.css'); + $this->addCSSClass('quiqqer-order-controls-basket'); + $this->setAttributes([ 'data-qui' => 'package/quiqqer/order/bin/frontend/controls/basket/Basket' ]); -- GitLab