Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
clone_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
clone_excelso
Commits
4dfd8979
Commit
4dfd8979
authored
Jun 22, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delivery address (tambah fungsi hapus alamat)
parent
fa14074c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
29 deletions
+69
-29
DeliveryAddrees.js
view/DeliveryAddrees.js
+69
-29
No files found.
view/DeliveryAddrees.js
View file @
4dfd8979
...
...
@@ -2,10 +2,10 @@ import React from 'react';
import
{
View
,
Text
,
StyleSheet
,
Button
,
FlatList
,
Alert
,
TextInput
,
Image
,
ScrollView
,
ActivityIndicator
}
from
'react-native'
;
import
{
TouchableOpacity
}
from
'react-native-gesture-handler'
;
import
{
connect
}
from
'react-redux'
;
import
{
CheckBox
,
Icon
}
from
'react-native-elements'
;
import
{
CheckBox
}
from
'react-native-elements'
;
import
Axios
from
'axios'
;
import
ActionType
from
'../redux/globalActionType'
;
import
{
MaterialCommunityIcons
,
Ionicons
}
from
'@expo/vector-icons'
;
import
{
MaterialCommunityIcons
,
Ionicons
,
EvilIcons
}
from
'@expo/vector-icons'
;
import
MyStatusBar
from
'./MyStatusBar'
;
import
i18n
from
'i18n-js'
;
...
...
@@ -26,8 +26,17 @@ class DeliveryAddrees extends React.Component {
}
componentDidMount
()
{
this
.
_unsubscribe
=
this
.
props
.
navigation
.
addListener
(
'focus'
,
()
=>
{
this
.
setState
({
indicator
:
true
})
this
.
getAddreess
()
});
this
.
getAddreess
()
// console.log("INI ADDRESS ID : " + this.props.addressId)
}
componentWillUnmount
()
{
this
.
_unsubscribe
();
}
onChangeAddress
=
data
=>
{
...
...
@@ -39,8 +48,6 @@ class DeliveryAddrees extends React.Component {
let
params
=
{
session_id
:
this
.
props
.
session_id
,
}
// console.log(params)
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/member/get_address'
,
params
).
then
(
res
=>
{
const
dataAlamat
=
res
.
data
.
data
;
console
.
log
(
"INI DATA :"
+
JSON
.
stringify
(
dataAlamat
))
...
...
@@ -218,13 +225,42 @@ class DeliveryAddrees extends React.Component {
}
deleteAddress
(
id
)
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
address_id
:
id
,
}
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/member/delete_address'
,
params
).
then
(
res
=>
{
this
.
componentDidMount
()
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
;
Alert
.
alert
(
''
,
response
.
msg
)
})
}
handleDeleteAddress
(
id
)
{
Alert
.
alert
(
""
,
"Apakah Anda ingin menghapus Alamat ? "
,
[
{
text
:
"Tidak"
,
onPress
:
()
=>
console
.
log
(
"Cancel Pressed"
),
style
:
"cancel"
},
{
text
:
"Ya"
,
onPress
:
()
=>
this
.
deleteAddress
(
id
)
}
],
{
cancelable
:
false
}
);
}
renderItem
=
({
item
})
=>
{
return
(
<
View
style
=
{
styles
.
list_addrees
}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
onSave
(
item
.
address
,
item
.
id
,
item
.
name
)}
>
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'row'
,
margin
:
5
,
}}
>
<
View
style
=
{{
flex
:
1
,
justifyContent
:
'center'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
flex
:
1
}}
>
<
View
style
=
{{
flex
:
3
}}
>
<
TouchableOpacity
style
=
{{
flex
:
1
,
flexDirection
:
'row'
,
margin
:
5
}}
onPress
=
{()
=>
this
.
onSave
(
item
.
address
,
item
.
id
,
item
.
name
)}
>
<
View
style
=
{{
flex
:
1.5
,
justifyContent
:
'center'
}}
>
<
View
>
<
CheckBox
checkedIcon
=
'dot-circle-o'
...
...
@@ -237,7 +273,6 @@ class DeliveryAddrees extends React.Component {
<
View
>
<
Text
style
=
{{
textAlign
:
'center'
,
color
:
'#ccb46c'
,
fontFamily
:
'Gotham-Light'
,
marginRight
:
20
}}
>
{
i18n
.
t
(
'selectaddress'
)}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
flex
:
3
,
justifyContent
:
'center'
}}
>
<
View
>
...
...
@@ -245,11 +280,17 @@ class DeliveryAddrees extends React.Component {
<
/View
>
<
Text
style
=
{{
fontFamily
:
'Gotham-Light'
,
color
:
'#838383'
,
fontSize
:
15
}}
>
{
item
.
address
}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{{
flex
:
0.5
}}
>
<
TouchableOpacity
style
=
{{
flex
:
1
,
flexDirection
:
'row'
,
margin
:
5
}}
onPress
=
{()
=>
this
.
handleDeleteAddress
(
item
.
id
)}
>
<
View
style
=
{{
justifyContent
:
'center'
}}
>
<
EvilIcons
name
=
"trash"
size
=
{
40
}
color
=
"black"
/>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
);
}
render
()
{
...
...
@@ -279,7 +320,6 @@ class DeliveryAddrees extends React.Component {
<
Text
style
=
{{
fontFamily
:
'Gotham-Black'
,
textAlign
:
'center'
,
color
:
'white'
,
fontSize
:
16
}}
>
{
i18n
.
t
(
'addaddress'
)}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
listAddress
}
>
{
this
.
state
.
indicator
==
true
?
(
...
...
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