From c71b0276069d92df2124c63c3622822aa92bc1d1 Mon Sep 17 00:00:00 2001 From: Henning Leutz <leutz@pcsg.de> Date: Tue, 20 Sep 2022 14:02:16 +0200 Subject: [PATCH] feat: quiqqer/erp#78 --- .../controls/articles/ArticleSummary.css | 13 +++++ .../controls/articles/ArticleSummary.js | 52 +++++++++++++++++-- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/bin/backend/controls/articles/ArticleSummary.css b/bin/backend/controls/articles/ArticleSummary.css index 59fcfb4..fa4b256 100644 --- a/bin/backend/controls/articles/ArticleSummary.css +++ b/bin/backend/controls/articles/ArticleSummary.css @@ -45,3 +45,16 @@ .quiqqer-erp-backend-temporaryErp-summary-total-title { width: calc(100% - 800px); } + +.quiqqer-erp-backend-temporaryErp-priceFactors { + background: #fff; + border: 1px solid #DEDEDE; + bottom: 80px; + box-shadow: 0 4px 8px 0 rgb(0 0 0 / 12%), 0 2px 4px 0 rgb(0 0 0 / 8%); + display: none; + height: 90px; + position: absolute; + right: 10px; + width: 400px; + z-index: 1000; +} diff --git a/bin/backend/controls/articles/ArticleSummary.js b/bin/backend/controls/articles/ArticleSummary.js index 14bce3f..25f5adc 100644 --- a/bin/backend/controls/articles/ArticleSummary.js +++ b/bin/backend/controls/articles/ArticleSummary.js @@ -37,7 +37,9 @@ define('package/quiqqer/erp/bin/backend/controls/articles/ArticleSummary', [ Binds: [ '$onInject', '$refreshArticleSelect', - 'openSummary' + 'openSummary', + 'showPriceFactors', + 'hidePriceFactors' ], initialize: function (options) { @@ -45,6 +47,8 @@ define('package/quiqqer/erp/bin/backend/controls/articles/ArticleSummary', [ this.$NettoSum = null; this.$BruttoSum = null; + this.$PriceFactors = null; + this.$PFFX = null; this.addEvents({ onInject: this.$onInject @@ -69,10 +73,16 @@ define('package/quiqqer/erp/bin/backend/controls/articles/ArticleSummary', [ labelGross : QUILocale.get(lg, 'article.summary.tpl.labelGross'), labelSums : QUILocale.get(lg, 'article.summary.tpl.labelSums'), labelVat : QUILocale.get(lg, 'article.summary.tpl.labelVat'), - }) + }), + events : { + mouseenter: this.showPriceFactors, + mouseleave: this.hidePriceFactors + } }); this.$Elm.addEvent('click', this.openSummary); + this.$PriceFactors = new Element('div.quiqqer-erp-backend-temporaryErp-priceFactors').inject(this.$Elm); + this.$PFFX = moofx(this.$PriceFactors); this.$NettoSum = this.$Elm.getElement( '.quiqqer-erp-backend-temporaryErp-summary-total .netto-value' @@ -235,7 +245,6 @@ define('package/quiqqer/erp/bin/backend/controls/articles/ArticleSummary', [ let calc = calculated.calculations; this.getCurrencyFormatter().then((Formatter) => { - if (this.getAttribute('showPosSummary')) { if (!(ArticleInstance instanceof Article)) { ArticleInstance = List.getSelectedArticle(); @@ -295,6 +304,43 @@ define('package/quiqqer/erp/bin/backend/controls/articles/ArticleSummary', [ this.$VAT.set('html', vatText); } }); + }, + + showPriceFactors: function () { + const ArticleList = this.getAttribute('List'); + + let priceFactors = ArticleList.getPriceFactors(); + let html = '<ul>'; + + for (let i = 0, len = priceFactors.length; i < len; i++) { + html = html + '<li>' + priceFactors[i].title + ' (<b>' + priceFactors[i].valueText + '</b>)</li>'; + } + + html = html + '</ul>'; + + this.$PriceFactors.set('html', html); + this.$PriceFactors.setStyle('opacity', 0); + this.$PriceFactors.setStyle('display', 'block'); + this.$PriceFactors.setStyle('bottom', 70); + + this.$PFFX.animate({ + bottom : 80, + opacity: 1 + }, { + duration: 300 + }); + }, + + hidePriceFactors: function () { + this.$PFFX.animate({ + bottom : 70, + opacity: 0 + }, { + duration: 300, + callback: () => { + this.$PriceFactors.setStyle('display', 'none'); + } + }); } }); }); -- GitLab