Skip to content
Code-Schnipsel Gruppen Projekte
Commit a9a9e859 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

refactor: shipping rules CRUD

Übergeordneter 7e4e5204
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -13,7 +13,7 @@
'package_quiqqer_shipping_ajax_backend_rules_getList',
function () {
$rules = QUI\ERP\Shipping\Rules\Factory::getInstance()->getChildren([
'order' => 'id'
'order' => 'priority DESC'
]);
$result = [];
......
/**
* @module package/quiqqer/shipping/bin/backend/controls/ShippingRules
* @author www.pcsg.de (Henning Leutz)
*
* Shipping Panel
*/
define('package/quiqqer/shipping/bin/backend/controls/ShippingRules', [
'qui/QUI',
'qui/controls/desktop/Panel',
'package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRuleList',
'Locale'
], function (QUI, QUIPanel, ShippingRuleList, QUILocale) {
"use strict";
var lg = 'quiqqer/shipping';
return new Class({
Extends: QUIPanel,
Type : 'package/quiqqer/shipping/bin/backend/controls/ShippingRules',
Binds: [
'$onCreate',
'$onInject'
],
initialize: function (options) {
this.parent(options);
this.setAttributes({
icon : 'fa fa-truck',
title: QUILocale.get(lg, 'menu.erp.shipping.rules.title')
});
this.$List = null;
this.addEvents({
onCreate: this.$onCreate,
onInject: this.$onInject,
onShow : this.$onInject
});
},
/**
* event: on create
*/
$onCreate: function () {
this.$List = new ShippingRuleList().inject(this.getContent());
},
/**
* event: on resize
*/
$onInject: function () {
(function () {
this.$List.resize();
}).delay(200, this);
}
});
});
......@@ -26,7 +26,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleWindow',
],
options: {
maxHeight: 600,
maxHeight: 800,
maxWidth : 600,
autoclose: false,
ruleId : false
......
......@@ -7,11 +7,12 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
'qui/QUI',
'qui/controls/Control',
'package/quiqqer/shipping/bin/backend/ShippingRules',
'package/quiqqer/shipping/bin/backend/controls/shippingRules/RuleWindow',
'package/quiqqer/shipping/bin/backend/utils/ShippingUtils',
'controls/grid/Grid',
'Locale'
], function (QUI, QUIControl, ShippingRules, ShippingUtils, Grid, QUILocale) {
], function (QUI, QUIControl, ShippingRules, RuleWindow, ShippingUtils, Grid, QUILocale) {
"use strict";
var lg = 'quiqqer/shipping';
......@@ -76,9 +77,10 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
}
}).inject(this.getElm());
var size = Container.getSize();
var width = size.x - 5;
var height = size.y;
var self = this,
size = Container.getSize(),
width = size.x - 5,
height = size.y;
this.$Grid = new Grid(Container, {
height : height,
......@@ -121,15 +123,30 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
dataIndex: 'title',
dataType : 'string',
width : 200
}, {
header : QUILocale.get(lg, 'shipping.edit.template.discount'),
dataIndex: 'discount',
dataType : 'number',
width : 100
}, {
header : QUILocale.get(lg, 'shipping.edit.template.discount.type'),
dataIndex: 'discount_type',
dataType : 'string',
width : 100
}]
});
this.$Grid.addEvents({
onRefresh: this.refresh,
onClick : function () {
onRefresh : this.refresh,
onClick : function () {
this.getButtons().filter(function (Btn) {
return Btn.getAttribute('name') === 'delete';
})[0].enable();
},
onDblClick: function () {
new RuleWindow({
ruleId: self.$Grid.getSelectedData()[0].id
}).open();
}
});
......@@ -217,7 +234,7 @@ define('package/quiqqer/shipping/bin/backend/controls/shippingRules/ShippingRule
var idHtml = selected.map(function (entry) {
return '<li>#' + entry.id + ' ' + entry.title + '</li>';
});
}).join('');
idHtml = '<ul>' + idHtml + '</ul>';
......
/**
* @module package/quiqqer/shipping/bin/frontend/controls/order/Shipping
* @author www.pcsg.de (Henning Leutz)
*
*/
/**
* @module
* @author www.pcsg.de (Henning Leutz)
*/
define('package/quiqqer/shipping/bin/frontend/controls/order/Shipping', [
'qui/QUI',
'qui/controls/Control'
], function (QUI, QUIControl) {
"use strict";
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/shipping/bin/frontend/controls/order/Shipping',
initialize: function (options) {
this.parent(options);
this.addEvents({
onInject: this.$onInject,
onImport: this.$onImport
});
},
/**
* event: on inject
*/
$onInject: function () {
console.log('$onInject');
},
/**
* event: on import
*/
$onImport: function () {
console.log('$onImport');
}
});
});
......@@ -23,6 +23,10 @@
<de><![CDATA[Versandarten]]></de>
<en><![CDATA[Shipping]]></en>
</locale>
<locale name="menu.erp.shipping.rules.title">
<de><![CDATA[Versandkostenregeln]]></de>
<en><![CDATA[Shipping rules]]></en>
</locale>
<locale name="permission.quiqqer.shipping._header">
<de><![CDATA[Versandarten]]></de>
......@@ -214,6 +218,10 @@
<de><![CDATA[Auf / Abschlag % (prozentual)]]></de>
<en><![CDATA[Discount % (percentage)]]></en>
</locale>
<locale name="shipping.edit.template.discount.type">
<de><![CDATA[Typ]]></de>
<en><![CDATA[Type]]></en>
</locale>
<locale name="window.delete.title">
<de><![CDATA[Versandart löschen]]></de>
......
......@@ -13,5 +13,12 @@
>
<locale group="quiqqer/shipping" var="menu.erp.shipping.title"/>
</item>
<item parent="/extras/erp/"
name="shipping-rules"
require="package/quiqqer/shipping/bin/backend/controls/ShippingRules"
icon="fa fa-truck"
>
<locale group="quiqqer/shipping" var="menu.erp.shipping.rules.title"/>
</item>
</menu>
......@@ -17,7 +17,7 @@
/>
</div>
<div class="quiqqer-order-step-shipping-list-entry-icon">
<img src="{$Shipping->getIcon()}"/>
<img src="{$Shipping->getIcon()}" alt=""/>
</div>
<div class="quiqqer-order-step-shipping-list-entry-text">
<label for="shipping-{$Shipping->getId()}">
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren