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
6be89811
Commit
6be89811
authored
May 06, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
order detail
parent
f5cf5b1e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
11 deletions
+52
-11
globalActionType.js
redux/globalActionType.js
+2
-1
globalReducer.js
redux/globalReducer.js
+8
-0
Auth.js
view/Auth.js
+3
-3
MenuConfirmation.js
view/MenuConfirmation.js
+12
-4
OrderDetail.js
view/OrderDetail.js
+27
-3
No files found.
redux/globalActionType.js
View file @
6be89811
...
...
@@ -32,7 +32,8 @@ const ActionType = {
SET_TRANS_TYPE
:
'SET_TRANS_TYPE'
,
SET_RECALCULATE
:
'SET_RECALCULATE'
,
SET_ORDER_FINISH
:
'SET_ORDER_FINISH'
,
UPDATE_MENU
:
'UPDATE_MENU'
UPDATE_MENU
:
'UPDATE_MENU'
,
SET_TRANS_ID
:
'SET_TRANS_ID'
}
export
default
ActionType
;
\ No newline at end of file
redux/globalReducer.js
View file @
6be89811
...
...
@@ -75,6 +75,8 @@ const globalState = {
balanceUsed
:
''
,
pointused
:
''
,
trans_id
:
''
}
...
...
@@ -265,6 +267,12 @@ const rootReducer = (state = globalState, action) => {
addressId
:
action
.
data
.
addressId
}
}
case
ActionType
.
SET_TRANS_ID
:
{
return
{
...
state
,
trans_id
:
action
.
data
.
trans_id
}
}
case
ActionType
.
SET_LOGOUT
:
{
return
{
...
state
,
...
...
view/Auth.js
View file @
6be89811
import
*
as
React
from
'react'
;
import
{
createStackNavigator
}
from
'@react-navigation/stack'
;
import
{
createStackNavigator
,
HeaderBackButton
}
from
'@react-navigation/stack'
;
import
{
connect
}
from
'react-redux'
;
import
{
View
,
Text
}
from
'react-native'
;
import
ActionType
from
'../redux/globalActionType'
;
...
...
@@ -125,7 +125,6 @@ class Auth extends React.Component {
}
render
()
{
return
(
<
Stack
.
Navigator
>
{
...
...
@@ -170,7 +169,8 @@ class Auth extends React.Component {
<
Stack
.
Screen
name
=
"Card Info"
component
=
{
CardInfo
}
/
>
<
Stack
.
Screen
name
=
"Shopping Cart"
component
=
{
ShoppingCart
}
/
>
<
Stack
.
Screen
name
=
"Order History"
component
=
{
OrderHistory
}
/
>
<
Stack
.
Screen
name
=
"Order Detail"
component
=
{
OrderDetail
}
/
>
<
Stack
.
Screen
name
=
"Order Detail"
component
=
{
OrderDetail
}
options
=
{({
navigation
,
route
})
=>
({
headerLeft
:
props
=>
<
HeaderBackButton
{...
props
}
onPress
=
{()
=>
navigation
.
navigate
(
'Home'
,{
screen
:
'ORDER'
})}
/>
,
})}
/
>
<
/
>
)
...
...
view/MenuConfirmation.js
View file @
6be89811
...
...
@@ -59,10 +59,15 @@ class MenuConfirmation extends React.Component {
console
.
log
(
'BOOK : '
+
JSON
.
stringify
(
params
))
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/transaction/booking'
,
params
).
then
(
res
=>
{
let
data_order
=
res
.
data
.
data
.
id
this
.
setState
({
spinner
:
false
,
})
let
transIdProps
=
{
trans_id
:
data_order
}
this
.
props
.
setTransId
(
transIdProps
);
Alert
.
alert
(
"Berhasil"
,
"Transaksi sudah berhasil, terimakasih sudah menggunakan excelso untuk ngopi"
,
...
...
@@ -85,10 +90,7 @@ class MenuConfirmation extends React.Component {
orderSuccess
=
()
=>
{
this
.
props
.
setOrderFinish
()
this
.
props
.
navigation
.
navigate
(
'Home'
,
{
screen
:
'ORDER'
,
params
:
{
user
:
'janei'
},
});
this
.
props
.
navigation
.
navigate
(
'Order Detail'
);
// this.props.navigation.reset({
// routes: [{ name: 'Home' }]
// })
...
...
@@ -236,6 +238,12 @@ const mapDispatchToProps = (dispacth) => {
return
{
setOrderFinish
:
()
=>
dispacth
({
type
:
ActionType
.
SET_ORDER_FINISH
}),
setTransId
:
(
transIdProps
)
=>
dispacth
({
type
:
ActionType
.
SET_TRANS_ID
,
data
:
{
trans_id
:
transIdProps
.
trans_id
,
}
})
}
}
...
...
view/OrderDetail.js
View file @
6be89811
import
React
from
'react'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
ScrollView
,
Alert
,
TouchableOpacity
}
from
'react-native'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
ScrollView
,
Alert
,
TouchableOpacity
,
BackHandler
}
from
'react-native'
;
import
{
Card
}
from
'react-native-shadow-cards'
import
{
connect
}
from
'react-redux'
;
import
Axios
from
'axios'
;
import
session
from
'../function/session'
;
class
OrderDetail
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
handleBackButtonClick
=
this
.
handleBackButtonClick
.
bind
(
this
)
this
.
state
=
{
trans_type_display
:
''
,
outlet
:
''
,
...
...
@@ -15,20 +17,34 @@ class OrderDetail extends React.Component {
trans_status_display
:
''
,
transaction_detail
:[],
}
}
componentDidMount
()
{
BackHandler
.
addEventListener
(
'hardwareBackPress'
,
this
.
handleBackButtonClick
);
this
.
getDetailTrans
()
}
componentWillUnmount
()
{
BackHandler
.
removeEventListener
(
'hardwareBackPress'
,
this
.
handleBackButtonClick
);
}
handleBackButtonClick
()
{
this
.
props
.
navigation
.
navigate
(
'Home'
,{
screen
:
'ORDER'
});
return
true
;
}
getDetailTrans
()
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
transaction_id
:
this
.
props
.
route
.
params
.
idTrans
transaction_id
:
this
.
props
.
trans_id
}
console
.
log
(
"PARAMETER : "
+
JSON
.
stringify
(
params
))
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/transaction/detail'
,
params
).
then
(
res
=>
{
let
data
=
res
.
data
// console.log("INI OUTLET "+ data.outlet)
...
...
@@ -43,8 +59,15 @@ class OrderDetail extends React.Component {
})
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
;
const
{
navigation
}
=
this
.
props
let
response
=
error
.
response
.
data
session
(
response
,
navigation
)
Alert
.
alert
(
response
.
msg
);
this
.
setState
({
indicator
:
false
,
})
// let response = error.response.data;
// Alert.alert(response.msg);
})
}
...
...
@@ -110,6 +133,7 @@ const mapStateToProps = (state) => {
return
{
session_id
:
state
.
session_id
,
trans_id
:
state
.
trans_id
}
}
...
...
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