summaryrefslogtreecommitdiff
path: root/src/core/utils
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-06-27 09:07:22 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-06-27 09:07:22 +0700
commit84ae09f61f05f212ec098da1fd4ed14960119527 (patch)
treeace07ea0aad2730fa91abefc32490f0a3b855310 /src/core/utils
parent88be517479704ee6b40334e0cabcfc86b824419b (diff)
promotion detail
Diffstat (limited to 'src/core/utils')
-rw-r--r--src/core/utils/cart.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/utils/cart.js b/src/core/utils/cart.js
index 6575f6d0..eb411dd3 100644
--- a/src/core/utils/cart.js
+++ b/src/core/utils/cart.js
@@ -30,12 +30,17 @@ const setCart = (cart) => {
return false
}
-const addCart = async (product_id, qty, selected) => {
+const addCart = async (product_id, qty, selected, programLineId = null) => {
const data = {
'product_id' : product_id,
'qty' : qty,
'selected' : selected,
}
+ if(programLineId){
+ data += {
+ 'program_line_id' : programLineId,
+ }
+ }
const id = getAuth()?.id
const cartAdd = await odooApi(
'POST',
@@ -89,12 +94,12 @@ const getItemCart = ({ productId }) => {
* @param {boolean} [options.selected=false] - The new selected status of the product in the cart. Default is `false`.
* @returns {boolean} - Returns `true`.
*/
-const updateItemCart = ({ productId, quantity, selected = false }) => {
+const updateItemCart = ({ productId, quantity, selected = false , programLineId}) => {
let cart = getCart()
quantity = parseInt(quantity)
cart[productId] = { productId, quantity, selected }
setCart(cart)
- addCart(productId, quantity, selected)
+ addCart(productId, quantity, selected, programLineId)
return true
}