From bed5b205d224db5d9c5e62ea287e9ddcb7eafde4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Patrick=20M=C3=BCller?= <p.mueller@pcsg.de>
Date: Tue, 9 Jul 2024 12:28:36 +0200
Subject: [PATCH] feat: js events; refactor: locale

---
 bin/frontend/controls/SimpleCheckoutWindow.js               | 5 +++++
 locale.xml                                                  | 6 ++++++
 src/QUI/ERP/Order/SimpleCheckout/Steps/CheckoutPayment.html | 2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/bin/frontend/controls/SimpleCheckoutWindow.js b/bin/frontend/controls/SimpleCheckoutWindow.js
index 505b8c8..f85abb1 100644
--- a/bin/frontend/controls/SimpleCheckoutWindow.js
+++ b/bin/frontend/controls/SimpleCheckoutWindow.js
@@ -1,3 +1,7 @@
+/**
+ * @event onCancel [this] - Fires if the users cancels the order process
+ * @event onCloseOrderSuccessful [this] - Fires if the user closes the checkout window after a successful order
+ */
 define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleCheckoutWindow', [
 
     'qui/QUI',
@@ -69,6 +73,7 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
                 html   : QUILocale.get('quiqqer/order-simple-checkout', 'SimpleCheckoutWindow.btn.cancel'),
                 events : {
                     click: () => {
+                        this.fireEvent('cancel', [this]);
                         this.close();
                     }
                 }
diff --git a/locale.xml b/locale.xml
index 20ea6fd..d52f272 100644
--- a/locale.xml
+++ b/locale.xml
@@ -67,6 +67,12 @@
             <en><![CDATA[Use a different billing address]]></en>
         </locale>
 
+        lCheckoutPayment.enter_address_to_show_payment_options
+        <locale name="CheckoutPayment.enter_address_to_show_payment_options">
+            <de><![CDATA[Bitte geben Sie Ihre Adresse an, um verfügbare Zahlungsmethoden angezeigt zu bekommen.]]></de>
+            <en><![CDATA[Please enter your address to view available payment methods.]]></en>
+        </locale>
+
     </groups>
 
     <groups name="quiqqer/order-simple-checkout" datatype="js">
diff --git a/src/QUI/ERP/Order/SimpleCheckout/Steps/CheckoutPayment.html b/src/QUI/ERP/Order/SimpleCheckout/Steps/CheckoutPayment.html
index be217b6..c50fdfb 100644
--- a/src/QUI/ERP/Order/SimpleCheckout/Steps/CheckoutPayment.html
+++ b/src/QUI/ERP/Order/SimpleCheckout/Steps/CheckoutPayment.html
@@ -1,6 +1,6 @@
 {if !isset($Payment)}
     <div class="order-simple-checkout-payment--info">
-        Enter your delivery address to view available payment methods.
+        {locale group="quiqqer/order-simple-checkout" var="CheckoutPayment.enter_address_to_show_payment_options"}
     </div>
 {else}
     {$Payment->create()}
-- 
GitLab