diff --git a/bin/controls/search/Search.html b/bin/controls/search/Search.html index 6be17e34b73046eb58ea9b5d2cd3b1171b7bde96..8d3b9336f5702c2d14569cb1ff608a221137f6e6 100644 --- a/bin/controls/search/Search.html +++ b/bin/controls/search/Search.html @@ -3,7 +3,7 @@ <thead> <tr> <th colspan="2"> - Rabatt + {{header}} </th> </tr> </thead> @@ -13,7 +13,7 @@ <td> <label class="field-container"> <span class="field-container-item"> - ID + {{id}} </span> <input type="text" name="id" class="field-container-field"/> @@ -24,7 +24,7 @@ <td> <label class="field-container"> <span class="field-container-item"> - Rabatt + {{title}} </span> <input type="text" name="discount" class="field-container-field"/> @@ -45,7 +45,7 @@ <thead> <tr> <th colspan="2"> - Nutzung definieren + {{usageHeader}} </th> </tr> </thead> @@ -56,20 +56,18 @@ <label class="field-container"> <span class="field-container-item"> <span class="fa fa-calendar"></span> - Nutzbar von + {{usageFrom}} </span> - <input type="datetime" name="date_from" - class="field-container-field"/> + <input type="datetime" name="date_from" class="field-container-field"/> </label> </td> <td> <label class="field-container"> <span class="field-container-item"> <span class="fa fa-calendar"></span> - Nutzbar bis + {{usageTo}} </span> - <input type="datetime" name="date_until" - class="field-container-field"/> + <input type="datetime" name="date_until" class="field-container-field"/> </label> </td> </tr> @@ -77,19 +75,17 @@ <td> <label class="field-container"> <span class="field-container-item"> - Einkaufsmenge von + {{usageAmountOf}} </span> - <input type="number" min="0" name="purchase_quantity_from" - class="field-container-field"/> + <input type="number" min="0" name="purchase_quantity_from" class="field-container-field"/> </label> </td> <td> <label class="field-container"> <span class="field-container-item"> - Einkaufsmenge bis + {{usageAmountTo}} </span> - <input type="number" min="0" name="purchase_quantity_until" - class="field-container-field"/> + <input type="number" min="0" name="purchase_quantity_until" class="field-container-field"/> </label> </td> </tr> @@ -98,20 +94,18 @@ <label class="field-container"> <span class="field-container-item"> <span class="fa fa-money"></span> - Einkaufswert von + {{usageValueOf}} </span> - <input type="number" min="0" name="purchase_value_from" - class="field-container-field"/> + <input type="number" min="0" name="purchase_value_from" class="field-container-field"/> </label> </td> <td> <label class="field-container"> <span class="field-container-item"> <span class="fa fa-money"></span> - Einkaufswert bis + {{usageValueTo}} </span> - <input type="number" min="0" name="purchase_value_until" - class="field-container-field"/> + <input type="number" min="0" name="purchase_value_until" class="field-container-field"/> </label> </td> </tr> diff --git a/bin/controls/search/Search.js b/bin/controls/search/Search.js index 82250e093ac2276889c742a3c24c96e34b1c9060..361de944a384a0d39fd8e9efae034b09206dfdba 100644 --- a/bin/controls/search/Search.js +++ b/bin/controls/search/Search.js @@ -12,13 +12,16 @@ define('package/quiqqer/discount/bin/controls/search/Search', [ 'qui/controls/buttons/Button', 'qui/utils/Form', 'package/quiqqer/discount/bin/classes/Handler', + 'Locale', + 'Mustache', 'text!package/quiqqer/discount/bin/controls/search/Search.html' -], function (QUI, QUIControl, QUIButton, QUIFormUtils, Handler, template) { +], function (QUI, QUIControl, QUIButton, QUIFormUtils, Handler, QUILocale, Mustache, template) { "use strict"; var Discounts = new Handler(); + var lg = 'quiqqer/discount'; return new Class({ Extends: QUIControl, @@ -45,7 +48,27 @@ define('package/quiqqer/discount/bin/controls/search/Search', [ create: function () { var Elm = this.parent(); - Elm.set('html', template); + Elm.set('html', Mustache.render(template, { + header : QUILocale.get(lg, 'control.search.title'), + id : QUILocale.get(lg, 'control.edit.template.id'), + title : QUILocale.get(lg, 'control.edit.template.title'), + discount : QUILocale.get(lg, 'control.edit.template.discount'), + usageHeader : QUILocale.get(lg, 'control.edit.template.usage'), + usageVat : QUILocale.get(lg, 'control.edit.template.vat'), + usageVatDesc : QUILocale.get(lg, 'control.edit.template.vatDesc'), + usageFrom : QUILocale.get(lg, 'control.edit.template.usage.from'), + usageTo : QUILocale.get(lg, 'control.edit.template.usage.to'), + usageAmountOf : QUILocale.get(lg, 'control.edit.template.shopping.amount.of'), + usageAmountTo : QUILocale.get(lg, 'control.edit.template.shopping.amount.to'), + usageValueOf : QUILocale.get(lg, 'control.edit.template.purchase.value.of'), + usageValueTo : QUILocale.get(lg, 'control.edit.template.purchase.value.to'), + usageAssignment : QUILocale.get(lg, 'control.edit.template.assignment'), + usageAssignmentAreas : QUILocale.get(lg, 'control.edit.template.areas'), + usageLastSumDiscount : QUILocale.get(lg, 'control.edit.template.usageLastSumDiscount'), + usageLastSumDiscountDesc : QUILocale.get(lg, 'control.edit.template.usageLastSumDiscountDesc'), + usageLastProductDiscount : QUILocale.get(lg, 'control.edit.template.usageLastProductDiscount'), + usageLastProductDiscountDesc: QUILocale.get(lg, 'control.edit.template.usageLastProductDiscountDesc') + })); Elm.setStyles({ 'float': 'left', diff --git a/bin/controls/search/Window.js b/bin/controls/search/Window.js index 473969b42e0cd5048bddb856aef1994cb344485f..13694e7495c2fb824e0c4b115698d87d18c5deb6 100644 --- a/bin/controls/search/Window.js +++ b/bin/controls/search/Window.js @@ -31,7 +31,7 @@ define('package/quiqqer/discount/bin/controls/search/Window', [ maxHeight: 600, maxWidth : 800, icon : 'fa fa-percent', - title : 'Rabattsuche', // #locale + title : QUILocale.get(lg, 'window.discount.search.title'), autoclose: false, cancel_button: { @@ -73,7 +73,11 @@ define('package/quiqqer/discount/bin/controls/search/Window', [ Content.addClass('discount-search'); this.$SearchContainer = new Element('div', { - 'class': 'discount-search-searchContainer' + 'class': 'discount-search-searchContainer', + style : { + display: 'none', + opacity: 0 + } }).inject(Content); this.$ResultContainer = new Element('div', { @@ -91,7 +95,6 @@ define('package/quiqqer/discount/bin/controls/search/Window', [ this.$ButtonCancel = this.getButton('cancel'); this.$ButtonSubmit.removeEvents('click'); - this.$ButtonSubmit.addEvent('click', function () { self.showResults(); }); @@ -100,7 +103,6 @@ define('package/quiqqer/discount/bin/controls/search/Window', [ 'package/quiqqer/discount/bin/controls/search/Search', 'package/quiqqer/discount/bin/controls/search/Result' ], function (Search, Result) { - self.$Search = new Search({ events: { onLoaded: function () { @@ -122,6 +124,7 @@ define('package/quiqqer/discount/bin/controls/search/Window', [ }).inject(self.$ResultContainer); self.$Result.resize(); + self.showResults(); }); }, @@ -133,10 +136,7 @@ define('package/quiqqer/discount/bin/controls/search/Window', [ return; } - this.fireEvent( - 'submit', - [this, this.$Result.getSelected()] - ); + this.fireEvent('submit', [this, this.$Result.getSelected()]); if (this.getAttribute('autoclose')) { this.close(); @@ -159,7 +159,6 @@ define('package/quiqqer/discount/bin/controls/search/Window', [ }, { duration: 200, callback: function () { - self.$ResultContainer.setStyle('display', 'none'); self.$SC_FX.animate({ @@ -214,7 +213,6 @@ define('package/quiqqer/discount/bin/controls/search/Window', [ }, { duration: 200, callback: function () { - self.$SearchContainer.setStyle('display', 'none'); self.$ResultContainer.setStyles({ diff --git a/locale.xml b/locale.xml index ed686a835b6d2cea715077062c8dc963fb5dfdbd..63970673def7e7ce39f29d3c6ad4dc5ed02c8782 100644 --- a/locale.xml +++ b/locale.xml @@ -374,6 +374,15 @@ Automatic: This discount is automatically added to an order if the conditions ap <en><![CDATA[Add automatically]]></en> </locale> + <locale name="window.discount.search.title"> + <de><![CDATA[Rabattsuche]]></de> + <en><![CDATA[Discount search]]></en> + </locale> + <locale name="control.search.title"> + <de><![CDATA[Rabatt]]></de> + <en><![CDATA[Discount]]></en> + </locale> + </groups> </locales>