From ff57b1f22f3176c2037ecf8da4bab4dd8085a3b5 Mon Sep 17 00:00:00 2001 From: Sergey Saranchuk Date: Fri, 12 Feb 2021 15:44:25 +0200 Subject: [PATCH] BP-650,BP-651 PayPerEmail improvements (autofill) #1 Name Prefix. --- .../create/billingmethod/payperemail.phtml | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/view/adminhtml/templates/sales/order/create/billingmethod/payperemail.phtml b/view/adminhtml/templates/sales/order/create/billingmethod/payperemail.phtml index 16da35ee7..6f835ae73 100644 --- a/view/adminhtml/templates/sales/order/create/billingmethod/payperemail.phtml +++ b/view/adminhtml/templates/sales/order/create/billingmethod/payperemail.phtml @@ -101,5 +101,24 @@ ) { document.getElementById(item[1]).value = document.getElementById(item[0]).value; } - }) + }); + + [ + ['order-billing_address_prefix', 'buckaroo_magento2_payperemail_genderSelect'] + ].forEach(function (item) { + if ( + document.getElementById(item[1]) && + document.getElementById(item[0]) && (document.getElementById(item[0]).value.length > 0) + ) { + document.getElementById(item[1]).value = 1; + if(['mrs.','mrs','ms.','ms','mevr.','mevr','mw.','mw'].includes(document.getElementById(item[0]).value.toLowerCase())){ + document.getElementById(item[1]).value = 2; + } + } + }); + + document.getElementById("email").addEventListener("change", function(){ + document.getElementById("buckaroo_magento2_payperemail_Email").value = document.getElementById("email").value; + }); + \ No newline at end of file