Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit 2901f18e erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: company ID (UID) (only show for switzerland)

Related: pcsg/buero#479
Übergeordneter 50756d31
No related branches found
No related tags found
2 Merge Requests!38fix: company ID (UID) (only show for switzerland),!33Update 'next-3.x' with latest changes from 'main'
Pipeline #12225 bestanden mit Phase
in 3 Minuten und 13 Sekunden
......@@ -71,25 +71,27 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
this.$Container.setStyle('display', null);
const Inner = this.$Container.getElement('.inner');
return new Promise(() => {
return new Promise((resolve) => {
moofx(this.$Container).animate({
height: Inner.offsetHeight
}, {
callback: () => {
this.$Container.setStyle('height', null);
resolve();
}
});
});
},
$hideAddressContainer: function() {
return new Promise(() => {
return new Promise((resolve) => {
moofx(this.$Container).animate({
height: 0
}, {
callback: () => {
this.$Container.setStyle('height', 0);
this.$Container.setStyle('display', null);
resolve();
}
});
});
......
......@@ -19,6 +19,7 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
this.parent(options);
this.$labels = [];
this.$Countries = null;
this.addEvents({
onImport: this.$onImport
......@@ -32,16 +33,42 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
const VatId = this.getElm().getElement('.quiqqer-order-customerData-edit-vatId');
const chUID = this.getElm().getElement('.quiqqer-order-customerData-edit-chUID');
if (Company) {
this.$labels.push(Company);
}
VatId.setStyle('display', null);
chUID.setStyle('display', 'none');
if (VatId) {
this.$labels.push(VatId);
// country change
const CountryNode = this.getElm().getElement('[name="country"]');
if (CountryNode) {
new Promise((resolve) => {
if (CountryNode.get('data-quiid')) {
resolve(QUI.Controls.getById(CountryNode.get('data-quiid')));
return;
}
let checkInterval = setInterval(() => {
if (CountryNode.get('data-quiid')) {
clearInterval(checkInterval);
resolve(QUI.Controls.getById(CountryNode.get('data-quiid')));
}
}, 10);
}).then((QUICountries) => {
this.$Countries = QUICountries;
this.$Countries.addEvent('change', () => {
if (this.$Countries.getValue() === 'CH') {
chUID.setStyle('display', null);
VatId.setStyle('display', 'none');
} else {
chUID.setStyle('display', 'none');
VatId.setStyle('display', null);
}
});
});
}
if (chUID) {
this.$labels.push(chUID);
if (Company) {
this.$labels.push(Company);
}
if (BusinessType) {
......@@ -71,19 +98,24 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
},
$hideB2B: function() {
this.$labels.forEach((Label) => {
const VatId = this.getElm().getElement('.quiqqer-order-customerData-edit-vatId');
const chUID = this.getElm().getElement('.quiqqer-order-customerData-edit-chUID');
const labels = this.$labels.concat([VatId, chUID]);
labels.forEach((Label) => {
Label.setStyle('position', 'relative');
Label.setStyle('overflow', 'hidden');
});
moofx(this.$labels).animate({
moofx(labels).animate({
height: 0,
opacity: 0,
margin: 0,
padding: 0
}, {
callback: () => {
this.$labels.forEach((Label) => {
labels.forEach((Label) => {
Label.setStyle('display', 'none');
});
}
......@@ -91,7 +123,11 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
},
$showB2B: function() {
this.$labels.forEach((Label) => {
const VatId = this.getElm().getElement('.quiqqer-order-customerData-edit-vatId');
const chUID = this.getElm().getElement('.quiqqer-order-customerData-edit-chUID');
const labels = this.$labels.concat([VatId, chUID]);
labels.forEach((Label) => {
Label.setStyle('position', 'relative');
Label.setStyle('opacity', 0);
Label.setStyle('display', null);
......@@ -102,6 +138,12 @@ define('package/quiqqer/order-simple-checkout/bin/frontend/controls/SimpleChecko
moofx(Label).animate({
opacity: 1,
height: Label.getScrollSize().y
}, {
callback: () => {
if (this.$Countries) {
this.$Countries.fireEvent('change');
}
}
});
});
}
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren