Skip to content
Code-Schnipsel Gruppen Projekte

Revisionen vergleichen

Änderungen werden so angezeigt, als ob die Quellrevision mit der Zielrevision zusammengeführt würde. Erfahre mehr über den Vergleich von Revisionen.

Quelle

Zielprojekt auswählen
No results found

Ziel

Zielprojekt auswählen
  • quiqqer/shipping
1 Ergebnis
Änderungen anzeigen
......@@ -21,18 +21,18 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
'text!package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleUnit.html',
'css!package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule.css'
], function (QUI, QUIControl, ControlUtils, Translator, TranslateUpdater, InputMultiLang, Fields,
ShippingRules, FormUtils, ElementsUtils, QUILocale, Mustache,
template, templateUnit
], function(QUI, QUIControl, ControlUtils, Translator, TranslateUpdater, InputMultiLang, Fields,
ShippingRules, FormUtils, ElementsUtils, QUILocale, Mustache,
template, templateUnit
) {
"use strict";
'use strict';
var lg = 'quiqqer/shipping';
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/shipping/bin/backend/controls/shippingRules/CreateRule',
Type: 'package/quiqqer/shipping/bin/backend/controls/shippingRules/CreateRule',
Binds: [
'$onInject',
......@@ -43,7 +43,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
ruleId: false
},
initialize: function (options) {
initialize: function(options) {
this.parent(options);
this.$DataTitle = null;
......@@ -62,47 +62,50 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
*
* @return {HTMLDivElement}
*/
create: function () {
create: function() {
this.$Elm = this.parent();
this.$Elm.addClass('quiqqer-shipping-rule-edit');
this.$Elm.setStyles({
overflow: 'hidden',
opacity : 0
opacity: 0
});
this.$Elm.set('html', Mustache.render(template, {
generalHeader : QUILocale.get(lg, 'shipping.edit.template.general'),
title : QUILocale.get(lg, 'shipping.edit.template.title'),
workingTitle : QUILocale.get('quiqqer/system', 'workingtitle'),
calculationPriority : QUILocale.get(lg, 'shipping.edit.template.calculationPriority'),
discountTitle : QUILocale.get(lg, 'shipping.edit.template.discount'),
discountDescription : QUILocale.get(lg, 'shipping.edit.template.discount.description'),
discountAbsolute : QUILocale.get(lg, 'shipping.edit.template.discount.absolute'),
discountPercentage : QUILocale.get(lg, 'shipping.edit.template.discount.percentage'),
generalHeader: QUILocale.get(lg, 'shipping.edit.template.general'),
title: QUILocale.get(lg, 'shipping.edit.template.title'),
workingTitle: QUILocale.get('quiqqer/system', 'workingtitle'),
calculationPriority: QUILocale.get(lg, 'shipping.edit.template.calculationPriority'),
discountTitle: QUILocale.get(lg, 'shipping.edit.template.discount'),
discountDescription: QUILocale.get(lg, 'shipping.edit.template.discount.description'),
discountAbsolute: QUILocale.get(lg, 'shipping.edit.template.discount.absolute'),
discountPercentage: QUILocale.get(lg, 'shipping.edit.template.discount.percentage'),
discountPercentageOrder: QUILocale.get(lg, 'shipping.edit.template.discount.percentageOrder'),
statusTitle : QUILocale.get(lg, 'shipping.edit.template.status'),
statusDescription : QUILocale.get(lg, 'shipping.edit.template.status.description'),
noRulesTitle : QUILocale.get(lg, 'shipping.edit.template.noRules'),
noRulesText : QUILocale.get(lg, 'shipping.edit.template.noRules.text'),
unitTitle : QUILocale.get(lg, 'shipping.edit.template.unit'),
unitHeader : QUILocale.get(lg, 'shipping.edit.template.unitTitle'),
usageHeader : QUILocale.get(lg, 'shipping.edit.template.usage'),
usageFrom : QUILocale.get(lg, 'shipping.edit.template.usage.from'),
usageTo : QUILocale.get(lg, 'shipping.edit.template.usage.to'),
usageAmountOf : QUILocale.get(lg, 'shipping.edit.template.shopping.amount.of'),
usageAmountTo : QUILocale.get(lg, 'shipping.edit.template.shopping.amount.to'),
usageValueOf : QUILocale.get(lg, 'shipping.edit.template.purchase.value.of'),
usageValueTo : QUILocale.get(lg, 'shipping.edit.template.purchase.value.to'),
usageAssignmentUser : QUILocale.get(lg, 'shipping.edit.template.assignment.user'),
usageAssignmentProduct : QUILocale.get(lg, 'shipping.edit.template.assignment.product'),
usageAssignmentArea : QUILocale.get(lg, 'shipping.edit.template.assignment.areas'),
statusTitle: QUILocale.get(lg, 'shipping.edit.template.status'),
statusDescription: QUILocale.get(lg, 'shipping.edit.template.status.description'),
noRulesTitle: QUILocale.get(lg, 'shipping.edit.template.noRules'),
noRulesText: QUILocale.get(lg, 'shipping.edit.template.noRules.text'),
unitTitle: QUILocale.get(lg, 'shipping.edit.template.unit'),
unitHeader: QUILocale.get(lg, 'shipping.edit.template.unitTitle'),
usageHeader: QUILocale.get(lg, 'shipping.edit.template.usage'),
usageFrom: QUILocale.get(lg, 'shipping.edit.template.usage.from'),
usageTo: QUILocale.get(lg, 'shipping.edit.template.usage.to'),
usageAmountOf: QUILocale.get(lg, 'shipping.edit.template.shopping.amount.of'),
usageAmountTo: QUILocale.get(lg, 'shipping.edit.template.shopping.amount.to'),
usageValueOf: QUILocale.get(lg, 'shipping.edit.template.purchase.value.of'),
usageValueTo: QUILocale.get(lg, 'shipping.edit.template.purchase.value.to'),
usageAssignmentUser: QUILocale.get(lg, 'shipping.edit.template.assignment.user'),
usageAssignmentProduct: QUILocale.get(lg, 'shipping.edit.template.assignment.product'),
usageAssignmentArea: QUILocale.get(lg, 'shipping.edit.template.assignment.areas'),
usageAssignmentCategory: QUILocale.get(lg, 'shipping.edit.template.assignment.category'),
productHeader : QUILocale.get(lg, 'shipping.edit.template.assignment.product.header'),
usageAssignmentProductOnly : QUILocale.get(lg, 'shipping.edit.template.assignment.product.only'),
usageAssignmentProductOnlyText: QUILocale.get(lg, 'shipping.edit.template.assignment.product.only.text'),
productHeader: QUILocale.get(lg, 'shipping.edit.template.assignment.product.header'),
usageAssignmentProductOnly: QUILocale.get(lg, 'shipping.edit.template.assignment.product.only'),
usageAssignmentProductOnlyText: QUILocale.get(
lg,
'shipping.edit.template.assignment.product.only.text'
),
usageAssignmentProductOnlyDesc: QUILocale.get(lg, 'shipping.edit.template.assignment.product.only.desc')
}));
......@@ -112,13 +115,13 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
/**
* event: on inject
*/
$onInject: function () {
var self = this,
$onInject: function() {
var self = this,
current = QUILocale.getCurrent();
var getOptions = function (field) {
var getOptions = function(field) {
var entries = field.options.entries,
result = [];
result = [];
for (var i in entries) {
if (!entries.hasOwnProperty(i)) {
......@@ -126,7 +129,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
}
result.push({
key : i,
key: i,
title: entries[i].title[current]
});
}
......@@ -134,7 +137,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
return result;
};
ShippingRules.getShippingRuleUnitFields().then(function (unitFields) {
ShippingRules.getShippingRuleUnitFields().then(function(unitFields) {
var i, len, html, field;
var Table = self.getElm().getElement('.unit-table'),
......@@ -148,8 +151,8 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
html = Mustache.render(templateUnit, {
andText: QUILocale.get(lg, 'shipping.edit.template.and'),
options: getOptions(field),
id : field.id,
title : field.title
id: field.id,
title: field.title
});
new Element('tr', {
......@@ -159,9 +162,9 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
Tbody.getElements('select').set('disabled', false);
Tbody.getElements('input').set('disabled', false);
}).then(function () {
}).then(function() {
return ControlUtils.parse(self.getElm());
}).then(function () {
}).then(function() {
ElementsUtils.simulateEvent(
self.getElm().getElement('.usage-table thead .data-table-toggle'),
'click'
......@@ -172,12 +175,12 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
'click'
);
return new Promise(function (resolve) {
return new Promise(function(resolve) {
resolve.delay(500);
});
}).then(function () {
}).then(function() {
return QUI.parse(self.getElm());
}).then(function () {
}).then(function() {
// locale for title and working title
self.$DataTitle = new InputMultiLang().replaces(self.$Elm.getElement('.shipping-title'));
self.$DataWorkingTitle = new InputMultiLang().replaces(self.$Elm.getElement('.shipping-workingTitle'));
......@@ -195,39 +198,28 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
);
self.$UserGroups = QUI.Controls.getById(
self.$Elm
.getElement('[name="user_groups"]')
.getParent('.qui-elements-select')
.get('data-quiid')
self.$Elm.getElement('[name="user_groups"]').getParent('.qui-elements-select').get('data-quiid')
);
self.$Areas = QUI.Controls.getById(
self.$Elm
.getElement('[name="areas"]')
.getParent('.qui-elements-select')
.get('data-quiid')
self.$Elm.getElement('[name="areas"]').getParent('.qui-elements-select').get('data-quiid')
);
self.$Articles = QUI.Controls.getById(
self.$Elm
.getElement('[name="articles"]')
.getParent('.qui-elements-select')
.get('data-quiid')
self.$Elm.getElement('[name="articles"]').getParent('.qui-elements-select').get('data-quiid')
);
self.$Categories = QUI.Controls.getById(
self.$Elm
.getElement('[name="categories"]')
.get('data-quiid')
self.$Elm.getElement('[name="categories"]').get('data-quiid')
);
return new Promise(function (resolve) {
return new Promise(function(resolve) {
require([
'package/quiqqer/shipping/bin/backend/ShippingRules',
'qui/controls/buttons/Switch',
'qui/utils/Form'
], function (ShippingRules, QUISwitch, FormUtils) {
ShippingRules.getRule(self.getAttribute('ruleId')).then(function (rule) {
], function(ShippingRules, QUISwitch, FormUtils) {
ShippingRules.getRule(self.getAttribute('ruleId')).then(function(rule) {
self.$DataTitle.setData(rule.title);
self.$DataWorkingTitle.setData(rule.workingTitle);
......@@ -250,7 +242,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
new QUISwitch({
status: parseInt(rule.active),
name : 'status'
name: 'status'
}).inject(self.getElm().getElement('.field-shipping-rules'));
FormUtils.setDataToForm(rule, self.getElm().getElement('form'));
......@@ -289,14 +281,14 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
});
});
});
}).then(function () {
}).then(function() {
self.getElm().setStyle('overflow', null);
moofx(self.getElm()).animate({
opacity: 1
}, {
duration: 200,
callback: function () {
callback: function() {
self.getElm().setStyle('opacity', null);
self.fireEvent('load', [self]);
}
......@@ -309,7 +301,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
*
* @return {Promise}
*/
update: function () {
update: function() {
if (!this.$DataTitle || !this.$DataWorkingTitle) {
return Promise.reject('Missing DOMNode Elements');
}
......@@ -334,12 +326,12 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule', [
Label = UnitRows[i].getElement('label');
unitData.push({
id : parseInt(Label.get('data-id')),
value : Value.value,
id: parseInt(Label.get('data-id')),
value: Value.value,
value2: Value2.value,
term : Term.value,
term2 : Term2.value,
unit : Unit.value
term: Term.value,
term2: Term2.value,
unit: Unit.value
});
}
......
......@@ -12,13 +12,13 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleWindow',
'package/quiqqer/shipping/bin/backend/controls/shippingRules/Rule',
'Locale'
], function (QUI, QUIConfirm, Rule, QUILocale) {
"use strict";
], function(QUI, QUIConfirm, Rule, QUILocale) {
'use strict';
return new Class({
Extends: QUIConfirm,
Type : 'package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleWindow',
Type: 'package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleWindow',
Binds: [
'$onOpen',
......@@ -27,19 +27,19 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleWindow',
options: {
maxHeight: 800,
maxWidth : 700,
maxWidth: 700,
autoclose: false,
ruleId : false
ruleId: false
},
initialize: function (options) {
initialize: function(options) {
this.parent(options);
this.setAttributes({
title : QUILocale.get('quiqqer/shipping', 'window.shipping.rules.title'),
icon : 'fa fa-edit',
title: QUILocale.get('quiqqer/shipping', 'window.shipping.rules.title'),
icon: 'fa fa-edit',
ok_button: {
text : QUILocale.get('quiqqer/shipping', 'window.shipping.rules.button.update'),
text: QUILocale.get('quiqqer/shipping', 'window.shipping.rules.button.update'),
textimage: 'fa fa-edit'
}
});
......@@ -47,7 +47,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleWindow',
this.$Rule = null;
this.addEvents({
onOpen : this.$onOpen,
onOpen: this.$onOpen,
onSubmit: this.$onSubmit
});
},
......@@ -55,7 +55,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleWindow',
/**
* event: on inject
*/
$onOpen: function () {
$onOpen: function() {
var self = this;
this.Loader.show();
......@@ -64,7 +64,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleWindow',
this.$Rule = new Rule({
ruleId: this.getAttribute('ruleId'),
events: {
onLoad: function () {
onLoad: function() {
self.Loader.hide();
}
}
......@@ -74,13 +74,13 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleWindow',
/**
* event: on submit
*/
$onSubmit: function () {
$onSubmit: function() {
var self = this;
this.fireEvent('updateBegin', [this]);
this.Loader.show();
this.$Rule.update().then(function () {
this.$Rule.update().then(function() {
self.Loader.hide();
self.fireEvent('updateEnd', [self]);
self.close();
......
......@@ -12,15 +12,15 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
'controls/grid/Grid',
'Locale'
], function (QUI, QUIControl, ShippingRules, RuleWindow, ShippingUtils, Grid, QUILocale) {
"use strict";
], function(QUI, QUIControl, ShippingRules, RuleWindow, ShippingUtils, Grid, QUILocale) {
'use strict';
const lg = 'quiqqer/shipping';
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRuleList',
Type: 'package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRuleList',
options: {
multiple: true
......@@ -36,13 +36,13 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
'getSelected'
],
initialize: function (options) {
initialize: function(options) {
this.parent(options);
this.$Grid = null;
this.addEvents({
onInject : this.$onInject,
onInject: this.$onInject,
onDestroy: this.$onDestroy
});
},
......@@ -50,9 +50,9 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
/**
* Resize the element
*/
resize: function () {
const size = this.getElm().getSize();
const width = size.x - 5;
resize: function() {
const size = this.getElm().getSize();
const width = size.x - 5;
const height = size.y;
this.$Grid.setWidth(width);
......@@ -64,113 +64,117 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
*
* @return {HTMLDivElement}
*/
create: function () {
create: function() {
this.$Elm = this.parent();
this.$Elm.addClass('quiqqer-shipping-rule-list');
this.$Elm.setStyles({
height: '100%',
width : '100%'
width: '100%'
});
const Container = new Element('div', {
styles: {
height: '100%',
width : '100%'
width: '100%'
}
}).inject(this.getElm());
const size = Container.getSize(),
width = size.x - 5,
height = size.y;
const size = Container.getSize(),
width = size.x - 5,
height = size.y;
this.$Grid = new Grid(Container, {
height : height,
width : width,
pagination : true,
height: height,
width: width,
pagination: true,
multipleSelection: this.getAttribute('multiple'),
serverSort : true,
buttons : [{
name : 'create',
text : QUILocale.get('quiqqer/core', 'create'),
textimage: 'fa fa-plus',
events : {
onClick: this.$openCreateDialog
}
}, {
name : 'edit',
text : QUILocale.get('quiqqer/system', 'edit'),
textimage: 'fa fa-edit',
disabled : true,
events : {
onClick: this.$openEditDialog
serverSort: true,
buttons: [
{
name: 'create',
text: QUILocale.get('quiqqer/core', 'create'),
textimage: 'fa fa-plus',
events: {
onClick: this.$openCreateDialog
}
}, {
name: 'edit',
text: QUILocale.get('quiqqer/system', 'edit'),
textimage: 'fa fa-edit',
disabled: true,
events: {
onClick: this.$openEditDialog
}
}, {
name: 'delete',
text: QUILocale.get('quiqqer/system', 'delete'),
textimage: 'fa fa-trash',
disabled: true,
events: {
onClick: this.$openDeleteDialog
}
}
}, {
name : 'delete',
text : QUILocale.get('quiqqer/system', 'delete'),
textimage: 'fa fa-trash',
disabled : true,
events : {
onClick: this.$openDeleteDialog
],
columnModel: [
{
header: QUILocale.get('quiqqer/system', 'id'),
dataIndex: 'id',
dataType: 'number',
width: 50
}, {
header: QUILocale.get('quiqqer/system', 'priority'),
dataIndex: 'priority',
dataType: 'number',
width: 50
}, {
header: QUILocale.get('quiqqer/system', 'status'),
dataIndex: 'statusNode',
dataType: 'node',
width: 60
}, {
header: QUILocale.get('quiqqer/system', 'title'),
dataIndex: 'title',
dataType: 'string',
width: 200,
sortable: false
}, {
header: QUILocale.get('quiqqer/system', 'workingtitle'),
dataIndex: 'workingTitle',
dataType: 'string',
width: 200,
sortable: false
}, {
header: QUILocale.get(lg, 'shipping.edit.template.discount'),
dataIndex: 'discount',
dataType: 'number',
width: 100,
className: 'grid-align-right'
}, {
header: QUILocale.get(lg, 'shipping.edit.template.discount.type'),
dataIndex: 'discount_type_text',
dataType: 'string',
width: 200
}, {
header: QUILocale.get(lg, 'shipping.edit.template.discount.type'),
dataIndex: 'discount_type',
dataType: 'string',
hidden: true
}
}],
columnModel : [{
header : QUILocale.get('quiqqer/system', 'id'),
dataIndex: 'id',
dataType : 'number',
width : 50
}, {
header : QUILocale.get('quiqqer/system', 'priority'),
dataIndex: 'priority',
dataType : 'number',
width : 50
}, {
header : QUILocale.get('quiqqer/system', 'status'),
dataIndex: 'statusNode',
dataType : 'node',
width : 60
}, {
header : QUILocale.get('quiqqer/system', 'title'),
dataIndex: 'title',
dataType : 'string',
width : 200,
sortable : false
}, {
header : QUILocale.get('quiqqer/system', 'workingtitle'),
dataIndex: 'workingTitle',
dataType : 'string',
width : 200,
sortable : false
}, {
header : QUILocale.get(lg, 'shipping.edit.template.discount'),
dataIndex: 'discount',
dataType : 'number',
width : 100,
className: 'grid-align-right'
}, {
header : QUILocale.get(lg, 'shipping.edit.template.discount.type'),
dataIndex: 'discount_type_text',
dataType : 'string',
width : 200
}, {
header : QUILocale.get(lg, 'shipping.edit.template.discount.type'),
dataIndex: 'discount_type',
dataType : 'string',
hidden : true
}]
]
});
this.$Grid.addEvents({
onRefresh : this.refresh,
onClick : () => {
let buttons = this.$Grid.getButtons();
onRefresh: this.refresh,
onClick: () => {
let buttons = this.$Grid.getButtons();
let selected = this.$Grid.getSelectedData();
const Edit = buttons.filter(function (Btn) {
const Edit = buttons.filter(function(Btn) {
return Btn.getAttribute('name') === 'edit';
})[0];
buttons.filter(function (Btn) {
buttons.filter(function(Btn) {
return Btn.getAttribute('name') === 'delete';
})[0].enable();
......@@ -191,10 +195,10 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
*
* @return
*/
refresh: function () {
refresh: function() {
this.fireEvent('refreshBegin', this);
ShippingRules.getList(this.$Grid.options).then((result) => {
ShippingRules.getList(this.$Grid.getPaginationData()).then((result) => {
this.fireEvent('refresh', [this, result, result.data]);
result.data = ShippingUtils.parseRulesDataForGrid(result.data);
......@@ -202,11 +206,11 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
let buttons = this.$Grid.getButtons();
buttons.filter(function (Btn) {
buttons.filter(function(Btn) {
return Btn.getAttribute('name') === 'delete';
})[0].disable();
buttons.filter(function (Btn) {
buttons.filter(function(Btn) {
return Btn.getAttribute('name') === 'edit';
})[0].disable();
......@@ -219,7 +223,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
/**
* event: on inject
*/
$onInject: function () {
$onInject: function() {
this.refresh();
ShippingRules.addEvents({
......@@ -232,7 +236,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
/**
* @event on Destroy
*/
$onDestroy: function () {
$onDestroy: function() {
ShippingRules.removeEvents({
onCreate: this.refresh,
onUpdate: this.refresh,
......@@ -245,12 +249,12 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
*
* @return {Array}
*/
getSelected: function () {
getSelected: function() {
if (!this.$Grid) {
return [];
}
return this.$Grid.getSelectedData().map(function (entry) {
return this.$Grid.getSelectedData().map(function(entry) {
return parseInt(entry.id);
});
},
......@@ -258,7 +262,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
/**
* event: open create dialog
*/
$openCreateDialog: function () {
$openCreateDialog: function() {
this.fireEvent('openCreateRuleWindow', [this]);
require([
......@@ -277,11 +281,11 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
/**
* event: open edit dialog
*/
$openEditDialog: function () {
$openEditDialog: function() {
new RuleWindow({
ruleId: this.$Grid.getSelectedData()[0].id,
events: {
onClose : () => {
onClose: () => {
this.refresh();
},
updateEnd: (Win) => {
......@@ -294,18 +298,18 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
/**
* event: open delete dialog
*/
$openDeleteDialog: function () {
$openDeleteDialog: function() {
let selected = this.$Grid.getSelectedData();
if (!selected.length) {
return;
}
let ruleIds = selected.map(function (entry) {
let ruleIds = selected.map(function(entry) {
return entry.id;
});
let idHtml = selected.map(function (entry) {
let idHtml = selected.map(function(entry) {
return '<li>#' + entry.id + ' ' + entry.title + '</li>';
}).join('');
......@@ -313,21 +317,21 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
require(['qui/controls/windows/Confirm'], (QUIConfirm) => {
new QUIConfirm({
icon : 'fa fa-trash',
texticon : 'fa fa-trash',
title : QUILocale.get(lg, 'window.shipping.entry.delete.rule.title'),
text : QUILocale.get(lg, 'window.shipping.entry.delete.rule.text'),
icon: 'fa fa-trash',
texticon: 'fa fa-trash',
title: QUILocale.get(lg, 'window.shipping.entry.delete.rule.title'),
text: QUILocale.get(lg, 'window.shipping.entry.delete.rule.text'),
information: QUILocale.get(lg, 'window.shipping.entry.delete.rule.information', {
ids: idHtml
}),
maxHeight : 350,
maxWidth : 700,
autoclose : true,
ok_button : {
text : QUILocale.get(lg, 'window.shipping.entry.delete.rule.delete'),
maxHeight: 350,
maxWidth: 700,
autoclose: true,
ok_button: {
text: QUILocale.get(lg, 'window.shipping.entry.delete.rule.delete'),
textimage: 'fa fa-trash'
},
events : {
events: {
onSubmit: (Win) => {
Win.Loader.show();
......
......@@ -9,13 +9,13 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
'package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRuleList',
'Locale'
], function (QUI, QUIConfirm, List, QUILocale) {
"use strict";
], function(QUI, QUIConfirm, List, QUILocale) {
'use strict';
return new Class({
Extends: QUIConfirm,
Type : 'package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRuleListWindow',
Type: 'package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRuleListWindow',
Binds: [
'$onOpen',
......@@ -24,15 +24,15 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
options: {
maxHeight: 600,
maxWidth : 600
maxWidth: 600
},
initialize: function (options) {
initialize: function(options) {
this.parent(options);
this.setAttributes({
title: QUILocale.get('quiqqer/shipping', 'window.shipping.rules.title'),
icon : 'fa fa-truck'
icon: 'fa fa-truck'
});
this.addEvents({
......@@ -43,7 +43,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
/**
* event: on inject
*/
$onOpen: function () {
$onOpen: function() {
var self = this;
this.Loader.show();
......@@ -51,15 +51,15 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
this.$List = new List({
events: {
onRefresh: function () {
onRefresh: function() {
self.Loader.hide();
},
onOpenCreateRuleWindow: function () {
onOpenCreateRuleWindow: function() {
self.close();
},
onCloseCreateRuleWindow: function () {
onCloseCreateRuleWindow: function() {
self.open();
self.$List.refresh();
}
......@@ -75,7 +75,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
*
* @method qui/controls/windows/Confirm#submit
*/
submit: function () {
submit: function() {
this.fireEvent('submit', [this, this.$List.getSelected()]);
if (this.getAttribute('autoclose')) {
......
require(['qui/QUI'], function (QUI) {
"use strict";
require(['qui/QUI'], function(QUI) {
'use strict';
function getShippingPrice(shippingId) {
return new Promise(function (resolve) {
require(['Ajax'], function (QUIAjax) {
function getShippingPrice(shippingId)
{
return new Promise(function(resolve) {
require(['Ajax'], function(QUIAjax) {
QUIAjax.get('package_quiqqer_shipping_ajax_backend_articleList_getShippingPriceFactor', resolve, {
'package' : 'quiqqer/shipping',
'package': 'quiqqer/shipping',
shippingId: shippingId
});
});
});
}
QUI.addEvent('quiqqerErpPriceFactorWindow', function (PriceFactorWindow) {
QUI.addEvent('quiqqerErpPriceFactorWindow', function(PriceFactorWindow) {
const Content = PriceFactorWindow.getContent();
const Buttons = Content.getElement('.quiqqer-erp-priceFactors-button');
const ArticleList = PriceFactorWindow.getArticleList();
require(['Locale'], function (QUILocale) {
require(['Locale'], function(QUILocale) {
new Element('button', {
'class': 'qui-button',
html : '<span class="fa fa-truck"></span>',
title : QUILocale.get('quiqqer/shipping', 'add.shipping.priceFactor'),
styles : {
'float' : 'right',
html: '<span class="fa fa-truck"></span>',
title: QUILocale.get('quiqqer/shipping', 'add.shipping.priceFactor'),
styles: {
'float': 'right',
marginRight: '10px'
},
events : {
click: function (e) {
events: {
click: function(e) {
e.stop();
require([
'package/quiqqer/shipping/bin/backend/controls/ShippingWindow'
], function (ShippingWindow) {
], function(ShippingWindow) {
new ShippingWindow({
events: {
onSubmit: function (Instance, value) {
onSubmit: function(Instance, value) {
PriceFactorWindow.Loader.show();
const currency = ArticleList.getAttribute('currency');
const vat = ArticleList.getVat();
let shippingData;
getShippingPrice(value[0].id).then(function (result) {
getShippingPrice(value[0].id).then(function(result) {
shippingData = result;
return PriceFactorWindow.getPriceFactorData(
......@@ -52,20 +53,20 @@ require(['qui/QUI'], function (QUI) {
);
}).then((data) => {
let priceFactor = {
calculation : 2,
calculation: 2,
calculation_basis: 2,
description : shippingData.title,
identifier : "",
index : ArticleList.countPriceFactors(),
nettoSum : data.nettoSum,
description: shippingData.title,
identifier: '',
index: ArticleList.countPriceFactors(),
nettoSum: data.nettoSum,
nettoSumFormatted: data.nettoSumFormatted,
sum : data.sum,
sumFormatted : data.sumFormatted,
title : shippingData.title,
value : data.sum,
valueText : data.valueText,
vat : vat,
visible : 1
sum: data.sum,
sumFormatted: data.sumFormatted,
title: shippingData.title,
value: data.sum,
valueText: data.valueText,
vat: vat,
visible: 1
};
ArticleList.addPriceFactor(priceFactor);
......
......@@ -4,11 +4,11 @@
*/
define('package/quiqqer/shipping/bin/backend/utils/ShippingUtils', [
'Locale',
'Locale'
], function (QUILocale) {
], function(QUILocale) {
"use strict";
'use strict';
return {
......@@ -18,7 +18,7 @@ define('package/quiqqer/shipping/bin/backend/utils/ShippingUtils', [
* @param {Array} rules
* @return {Array}
*/
parseRulesDataForGrid: function (rules) {
parseRulesDataForGrid: function(rules) {
return rules.map((entry) => {
return this.parseRuleDataForGrid(entry);
});
......@@ -30,15 +30,15 @@ define('package/quiqqer/shipping/bin/backend/utils/ShippingUtils', [
* @param {Object} ruleData
* @return {Object}
*/
parseRuleDataForGrid: function (ruleData) {
parseRuleDataForGrid: function(ruleData) {
let current = QUILocale.getCurrent();
ruleData.title = ruleData.title[current];
ruleData.title = ruleData.title[current];
ruleData.workingTitle = ruleData.workingTitle[current];
ruleData.statusNode = new Element('span', {
'class': parseInt(ruleData.active) ? 'fa fa-check' : 'fa fa-close',
styles : {
styles: {
lineHeight: 26
}
});
......@@ -48,16 +48,18 @@ define('package/quiqqer/shipping/bin/backend/utils/ShippingUtils', [
'quiqqer/shipping',
'discount.type.abs'
);
} else if (parseInt(ruleData.discount_type) === 2) {
ruleData.discount_type_text = QUILocale.get(
'quiqqer/shipping',
'discount.type.percentageOrder'
);
} else {
ruleData.discount_type_text = QUILocale.get(
'quiqqer/shipping',
'discount.type.percentage'
);
if (parseInt(ruleData.discount_type) === 2) {
ruleData.discount_type_text = QUILocale.get(
'quiqqer/shipping',
'discount.type.percentageOrder'
);
} else {
ruleData.discount_type_text = QUILocale.get(
'quiqqer/shipping',
'discount.type.percentage'
);
}
}
return ruleData;
......
......@@ -11,19 +11,19 @@ define('package/quiqqer/shipping/bin/frontend/controls/ShippingInfo', [
'qui/controls/Control',
'Locale'
], function (QUI, QUIControl, QUILocale) {
"use strict";
], function(QUI, QUIControl, QUILocale) {
'use strict';
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/shipping/bin/frontend/controls/ShippingInfo',
Type: 'package/quiqqer/shipping/bin/frontend/controls/ShippingInfo',
Binds: [
'showInfo',
'$onImport'
],
initialize: function (options) {
initialize: function(options) {
this.parent(options);
this.addEvents({
......@@ -34,7 +34,7 @@ define('package/quiqqer/shipping/bin/frontend/controls/ShippingInfo', [
/**
* event on import
*/
$onImport: function () {
$onImport: function() {
this.getElm().addEvent('click', this.showInfo);
},
......@@ -43,21 +43,21 @@ define('package/quiqqer/shipping/bin/frontend/controls/ShippingInfo', [
*
* @param event
*/
showInfo: function (event) {
showInfo: function(event) {
event.stop();
require([
'qui/controls/windows/Popup'
], function (QUIPopup) {
], function(QUIPopup) {
new QUIPopup({
'maxWidth' : 700,
'maxWidth': 700,
'maxHeight': 600,
'icon' : 'fa fa-truck',
'title' : QUILocale.get('quiqqer/shipping', 'frontend.shippingInfo.popup.title'),
'content' : QUILocale.get('quiqqer/shipping', 'frontend.shippingInfo.popup.content'),
draggable : false,
resizable : false,
buttons : false
'icon': 'fa fa-truck',
'title': QUILocale.get('quiqqer/shipping', 'frontend.shippingInfo.popup.title'),
'content': QUILocale.get('quiqqer/shipping', 'frontend.shippingInfo.popup.content'),
draggable: false,
resizable: false,
buttons: false
}).open();
});
}
......
......@@ -12,20 +12,20 @@ define('package/quiqqer/shipping/bin/frontend/controls/order/Shipping', [
'qui/QUI',
'qui/controls/Control'
], function (QUI, QUIControl) {
"use strict";
], function(QUI, QUIControl) {
'use strict';
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/shipping/bin/frontend/controls/order/Shipping',
Type: 'package/quiqqer/shipping/bin/frontend/controls/order/Shipping',
Binds: [
'$onImport',
'$onClick'
],
initialize: function (options) {
initialize: function(options) {
this.parent(options);
this.$Input = null;
......@@ -38,7 +38,7 @@ define('package/quiqqer/shipping/bin/frontend/controls/order/Shipping', [
/**
* event: on import
*/
$onImport: function () {
$onImport: function() {
this.getElm().addEvent('click', this.$onClick);
this.$Input = this.getElm().getElement('input');
......@@ -51,15 +51,13 @@ define('package/quiqqer/shipping/bin/frontend/controls/order/Shipping', [
/**
* event: on click
*/
$onClick: function (event) {
$onClick: function(event) {
if (event.target.nodeName !== 'INPUT') {
event.stop();
}
this.getElm()
.getParent('.quiqqer-order-step-shipping-list')
.getElements('.quiqqer-order-step-shipping-list-entry')
.removeClass('selected');
this.getElm().getParent('.quiqqer-order-step-shipping-list').getElements(
'.quiqqer-order-step-shipping-list-entry').removeClass('selected');
this.$Input.checked = true;
this.getElm().addClass('selected');
......