orderiom-api-package 0.4.115 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/modules/order.js +56 -0
package/package.json
CHANGED
package/src/modules/order.js
CHANGED
|
@@ -202,6 +202,49 @@ const actions = {
|
|
|
202
202
|
if (basketProduct) basketProduct.changingQuantity = false;
|
|
203
203
|
});
|
|
204
204
|
},
|
|
205
|
+
addMultipleItemsToBasket({ dispatch, rootState }, data) {
|
|
206
|
+
let basketId = undefined;
|
|
207
|
+
try {
|
|
208
|
+
basketId = calculateBasketIdParameter(data ? data.restaurantId : undefined);
|
|
209
|
+
} catch (e) {
|
|
210
|
+
console.error(e);
|
|
211
|
+
return { type: "error", msg: "Basket not found" };
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
data.items.map(item => {
|
|
215
|
+
item.basketProduct = !item.basketProductId
|
|
216
|
+
? null
|
|
217
|
+
: rootState.orderiomApiPackage.product.ShoppingCart.find(f => f.basketProductId === item.basketProductId);
|
|
218
|
+
if (item.basketProduct) item.basketProduct.changingQuantity = true;
|
|
219
|
+
|
|
220
|
+
item.quantity = parseInt(item.quantity);
|
|
221
|
+
item.quantity = !item.quantity || item.quantity < 1 ? 1 : item.quantity;
|
|
222
|
+
|
|
223
|
+
item.basketProductId = item.basketProductId ? item.basketProductId : undefined;
|
|
224
|
+
item.attributeItems = item.attributeItems && item.attributeItems.length ? item.attributeItems : undefined;
|
|
225
|
+
item.productAttributeItems = item.productAttributeItems && item.productAttributeItems.length
|
|
226
|
+
? item.productAttributeItems
|
|
227
|
+
: undefined;
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
$http
|
|
231
|
+
.post("api/basket/add-multiple", {
|
|
232
|
+
restaurantId: data.restaurantId,
|
|
233
|
+
basketId,
|
|
234
|
+
items: data.items
|
|
235
|
+
})
|
|
236
|
+
.then(async () => {
|
|
237
|
+
return await dispatch("shoppingCartUpdateCallback", {
|
|
238
|
+
restaurantId: data.restaurantId,
|
|
239
|
+
});
|
|
240
|
+
})
|
|
241
|
+
.catch(commonErrorCallback())
|
|
242
|
+
.finally(() => {
|
|
243
|
+
data.items.map(item => {
|
|
244
|
+
if (item.basketProduct) item.basketProduct.changingQuantity = false;
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
},
|
|
205
248
|
removeFromBasket({ dispatch, rootState }, data) {
|
|
206
249
|
const basketProduct =
|
|
207
250
|
rootState.orderiomApiPackage.product.ShoppingCart.find(
|
|
@@ -1029,6 +1072,19 @@ const actions = {
|
|
|
1029
1072
|
})
|
|
1030
1073
|
.catch(commonErrorCallback());
|
|
1031
1074
|
},
|
|
1075
|
+
getKessenExternalOrder({ commit }, { restaurantId, tablePaymentId, tableName }) {
|
|
1076
|
+
commit("setExternalTableOrders", {});
|
|
1077
|
+
return $http
|
|
1078
|
+
.post("api/table-payments/kassenmeister/create", {
|
|
1079
|
+
restaurantId,
|
|
1080
|
+
tablePaymentId,
|
|
1081
|
+
tableName,
|
|
1082
|
+
})
|
|
1083
|
+
.then((res) => {
|
|
1084
|
+
commit("setExternalTableOrders", res.data.data);
|
|
1085
|
+
})
|
|
1086
|
+
.catch(commonErrorCallback());
|
|
1087
|
+
},
|
|
1032
1088
|
broadcastTablePaymentEvent({ commit }, { tablePaymentId, basketItems, action, socketId}) {
|
|
1033
1089
|
$http.interceptors.request.use((config) => {
|
|
1034
1090
|
// we need to send this header so we don't receive events
|