Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
new_excelso
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Prasetya Saputra
new_excelso
Commits
923faaa6
Commit
923faaa6
authored
Apr 28, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cek
parent
c5203ecc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
116 deletions
+15
-116
MenuSelection.js
view/MenuSelection.js
+1
-13
ShoppingCart.js
view/ShoppingCart.js
+14
-103
No files found.
view/MenuSelection.js
View file @
923faaa6
...
@@ -132,6 +132,7 @@ class MenuSelection extends React.Component {
...
@@ -132,6 +132,7 @@ class MenuSelection extends React.Component {
const
listMenu
=
[...
this
.
state
.
listMenu
]
const
listMenu
=
[...
this
.
state
.
listMenu
]
listMenu
[
index
].
qty
=
quantity
listMenu
[
index
].
qty
=
quantity
console
.
log
(
"HASIL : "
+
listMenu
[
index
].
qty
)
this
.
setState
({
this
.
setState
({
listMenu
listMenu
})
})
...
@@ -156,7 +157,6 @@ class MenuSelection extends React.Component {
...
@@ -156,7 +157,6 @@ class MenuSelection extends React.Component {
handleMin
(
item
,
index
)
{
handleMin
(
item
,
index
)
{
const
list_order_item
=
this
.
props
.
order_item
;
const
list_order_item
=
this
.
props
.
order_item
;
let
is_xist
=
list_order_item
.
find
(
row
=>
row
.
id
==
item
.
id
)
let
is_xist
=
list_order_item
.
find
(
row
=>
row
.
id
==
item
.
id
)
if
(
is_xist
)
{
if
(
is_xist
)
{
if
(
is_xist
.
quantity
!=
0
)
{
if
(
is_xist
.
quantity
!=
0
)
{
...
@@ -171,7 +171,6 @@ class MenuSelection extends React.Component {
...
@@ -171,7 +171,6 @@ class MenuSelection extends React.Component {
let
quantity
=
0
let
quantity
=
0
for
(
let
i
=
0
;
i
<
list_order_item
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
list_order_item
.
length
;
i
++
)
{
const
row
=
list_order_item
[
i
];
const
row
=
list_order_item
[
i
];
const
qty
=
list_order_item
[
i
];
if
(
row
.
id
==
item
.
id
)
{
if
(
row
.
id
==
item
.
id
)
{
quantity
=
row
.
quantity
quantity
=
row
.
quantity
}
}
...
@@ -183,10 +182,6 @@ class MenuSelection extends React.Component {
...
@@ -183,10 +182,6 @@ class MenuSelection extends React.Component {
}
}
}
}
}
}
// this.clearNegatif(item,index)
// ini buat update list menu
}
}
render
()
{
render
()
{
...
@@ -263,13 +258,6 @@ const mapStateToProps = (state) => {
...
@@ -263,13 +258,6 @@ const mapStateToProps = (state) => {
quantity
:
state
.
quantity
,
quantity
:
state
.
quantity
,
address
:
state
.
address
,
address
:
state
.
address
,
// qty: state.qty,
// totalOrder: state.totalOrder,
// totalQty: state.totalQty,
// orders: state.orders,
// cart_shop: state.cart_shop,
}
}
}
}
...
...
view/ShoppingCart.js
View file @
923faaa6
...
@@ -81,6 +81,17 @@ class ShoppingCart extends React.Component {
...
@@ -81,6 +81,17 @@ class ShoppingCart extends React.Component {
}
}
}
}
}
else
if
(
is_xist
.
quantity
===
0
){
const
order_item
=
{
id
:
item
.
id
,
name
:
item
.
name
,
price
:
item
.
price
,
}
this
.
props
.
reduceQuantityItem
(
order_item
)
}
}
}
}
}
}
...
@@ -100,6 +111,7 @@ class ShoppingCart extends React.Component {
...
@@ -100,6 +111,7 @@ class ShoppingCart extends React.Component {
const
list_order_item
=
this
.
props
.
order_item
;
const
list_order_item
=
this
.
props
.
order_item
;
let
is_xist
=
list_order_item
.
find
(
row
=>
row
.
id
==
item
.
id
)
let
is_xist
=
list_order_item
.
find
(
row
=>
row
.
id
==
item
.
id
)
console
.
log
(
"INI YA : "
+
is_xist
)
let
quantity
=
0
let
quantity
=
0
if
(
is_xist
)
{
if
(
is_xist
)
{
...
@@ -144,122 +156,23 @@ class ShoppingCart extends React.Component {
...
@@ -144,122 +156,23 @@ class ShoppingCart extends React.Component {
pointsused
:
this
.
state
.
kasproPoint
pointsused
:
this
.
state
.
kasproPoint
})
})
}
}
}
}
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
getBalance
()
this
.
getBalance
()
this
.
getRate
()
this
.
getRate
()
}
}
// getMenuList() {
// let params = {
// outlet_id: "dec1abbb-95d0-46ae-a6cd-2bf306590f15"
// }
// Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/menu/get_list', params).then(res => {
// let data = res.data.data
// this.setState({
// listCategory: data.category,
// listMenu: data.menu
// })
// let last_category = ''
// let list_menu = []
// for (let i = 0; i < data.menu.length; i++) {
// const row = data.menu[i];
// // cari sudah ada belum di redux
// let is_xist = this.props.order_item.find(item => row.id == item.id)
// if (is_xist) {
// row['qty'] = is_xist.quantity
// } else {
// row['qty'] = 0
// }
// if (last_category != row.category.name) {
// let category = {
// "id": row.category.id,
// "name": row.category.name,
// "code": "CATEGORY"
// }
// list_menu.push(category)
// list_menu.push(row)
// last_category = row.category.name
// } else {
// list_menu.push(row)
// }
// }
// this.setState({
// listMenu: list_menu
// })
// })
// }
getRate
()
{
getRate
()
{
if
(
this
.
props
.
outlet_id
===
''
)
{
let
params
=
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
outlet_id
:
'0cb81ffe0c8242bea42d39c9b92ccaac'
,
address_id
:
this
.
props
.
addressId
,
order_item
:
this
.
props
.
order_item
}
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/delivery/rate'
,
params
).
then
(
res
=>
{
console
.
log
(
"INI LHO CUY : "
+
JSON
.
stringify
(
res
.
data
.
data
.
destination
.
address
))
this
.
setState
({
grabtype
:
res
.
data
.
data
.
quotes
[
0
].
service
.
type
,
grabamount
:
res
.
data
.
data
.
quotes
[
0
].
amount
,
grabpickup
:
res
.
data
.
data
.
quotes
[
0
].
estimatedTimeline
.
pickup
,
grabdropoff
:
res
.
data
.
data
.
quotes
[
0
].
estimatedTimeline
.
dropoff
,
grabdestination
:
res
.
data
.
data
.
destination
.
address
,
})
let
setGrabProps
=
{
grabtype
:
this
.
state
.
grabtype
,
grabamount
:
this
.
state
.
grabamount
,
grabpickup
:
this
.
state
.
grabpickup
,
grabdropoff
:
this
.
state
.
grabdropoff
,
grabdestination
:
this
.
state
.
grabdestination
,
}
this
.
props
.
setGrab
(
setGrabProps
);
let
setOrdersProps
=
{
balanceUsed
:
this
.
state
.
balanceused
,
pointused
:
this
.
state
.
pointsused
,
}
this
.
props
.
setOrder
(
setOrdersProps
);
}).
catch
(
error
=>
{
console
.
log
(
'ini error '
+
error
)
})
}
else
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
session_id
:
this
.
props
.
session_id
,
outlet_id
:
this
.
props
.
outlet_id
,
outlet_id
:
this
.
props
.
outlet_id
,
address_id
:
this
.
props
.
addressId
,
address_id
:
this
.
props
.
addressId
,
order_item
:
this
.
props
.
order_item
order_item
:
this
.
props
.
order_item
}
}
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/delivery/rate'
,
params
).
then
(
res
=>
{
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/delivery/rate'
,
params
).
then
(
res
=>
{
console
.
log
(
"INI LHO CUY : "
+
JSON
.
stringify
(
res
.
data
.
data
.
destination
.
address
))
console
.
log
(
"INI LHO CUY : "
+
JSON
.
stringify
(
res
.
data
.
data
.
destination
.
address
))
...
@@ -292,8 +205,6 @@ class ShoppingCart extends React.Component {
...
@@ -292,8 +205,6 @@ class ShoppingCart extends React.Component {
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'ini error '
+
error
)
console
.
log
(
'ini error '
+
error
)
})
})
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment