Commit 4e013512 authored by Afid's avatar Afid

confirm dialog ketika mau dikosongkan

parent 4a565ff6
......@@ -123,37 +123,51 @@ class ShoppingCart extends React.Component {
price: item.price,
}
this.props.reduceQuantityItem(order_item)
for (let i = 0; i < list_order_item.length; i++) {
const row = list_order_item[i];
if (row.id == item.id) {
quantity = row.quantity
}
}
if (is_xist.quantity == 0) {
Alert.alert("Apakah anda ingin menghapus pesanan?");
const order_item = {
id: item.id,
name: item.name,
price: item.price,
note: item.note,
image: item.image,
description: item.description,
quantity: item.quantity
}
this.props.removeFromChart(order_item)
if (is_xist.quantity == 1) {
Alert.alert(
"Delete item",
"Are you sure want to delete item?",
[
{
text: 'Cancel',
onPress: () => console.log('Cancel Delete Item'),
style: 'cancel',
},
{
text: 'Delete Item', onPress: () => {
this.props.reduceQuantityItem(order_item)
if (is_xist.quantity == 0) {
const order_item = {
id: item.id,
name: item.name,
price: item.price,
note: item.note,
image: item.image,
description: item.description,
quantity: item.quantity
}
this.props.removeFromChart(order_item)
}
}
},
],
{ cancelable: false },
)
} else {
this.props.reduceQuantityItem(order_item)
}
}
}
}
deleteItem() {
}
handleAdd(item, index) {
const order_item = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment