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

feat: artikel wieder bestellen

Übergeordneter 706825b8
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
define('package/quiqqer/order/bin/frontend/controls/frontendusers/Article', [
'qui/QUI',
'qui/controls/Control',
'Ajax',
'package/quiqqer/order/bin/frontend/Basket'
], function (QUI, QUIControl, QUIAjax, Basket) {
"use strict";
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/order/bin/frontend/controls/frontendusers/Article',
Binds: [
'$addArticleToBasket'
],
initialize: function (options) {
this.parent(options);
this.$ReBuyButton = null;
this.addEvents({
onImport: this.$onImport
});
},
/**
* event: on import
*/
$onImport: function () {
var Elm = this.getElm();
this.$ReBuyButton = Elm.getElement(
'.quiqqer-order-profile-orders-order-articles-rebuy'
);
if (this.$ReBuyButton) {
this.$ReBuyButton.addEvent('click', this.$addArticleToBasket);
this.$ReBuyButton.set('disabled', false);
}
},
/**
* add article to the basket
*/
$addArticleToBasket: function (event) {
if (typeof event.stop !== 'undefined') {
event.stop();
}
if (!this.$ReBuyButton) {
return;
}
var self = this,
oldText = this.$ReBuyButton.get('html');
this.$ReBuyButton.set({
disabled: true,
styles : {
width: this.$ReBuyButton.getSize().x
}
});
this.$ReBuyButton.set('html', '<span class="fa fa-spinner fa-spin"></span>');
this.getProductByProductNo(
this.$ReBuyButton.get('data-articleno')
).then(function (product) {
return Basket.addProduct(product.id);
}).then(function () {
self.$ReBuyButton.set({
html : oldText,
disabled: false,
styles : {
width: null
}
});
});
},
/**
* Return the product id
*
* @param {String} productNo
*/
getProductByProductNo: function (productNo) {
return new Promise(function (resolve, reject) {
QUIAjax.get('package_quiqqer_products_ajax_products_frontend_getProductByProductNo', resolve, {
'package': 'quiqqer/products',
onError : reject,
productNo: productNo
});
});
}
});
});
\ No newline at end of file
<div class="quiqqer-order-profile-orders-order-articles-article">
<div class="quiqqer-order-profile-orders-order-articles-article"
data-qui="package/quiqqer/order/bin/frontend/controls/frontendusers/Article"
>
<div class="quiqqer-order-profile-orders-order-articles-image">
{if !empty($Image)}
{image image=$Image width="200" height=200}
......@@ -24,5 +26,21 @@
{$Article->getPrice()->getDisplayPrice()}
</div>
{if !empty($Product)}
<noscript>
<style>
.quiqqer-order-profile-orders-order-articles-rebuy {
display: none
}
</style>
</noscript>
<button class="quiqqer-order-profile-orders-order-articles-rebuy"
data-articleno="{$Article->getArticleNo()}"
disabled
>
Nochmal kaufen
</button>
{/if}
<div class="quiqqer-order-profile-orders-order-articles-buttons"></div>
</div>
......@@ -68,9 +68,6 @@ public function renderOrder(QUI\ERP\Order\Order $Order)
$Articles->calc();
/* @var $Article QUI\ERP\Accounting\Article */
//$Article->getSum();
$Engine->assign(array(
'this' => $this,
'Order' => $Order,
......
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