|
|
@@ -38,40 +38,11 @@ export default class ProfileV2 extends Component {
|
|
|
}, true);
|
|
|
}
|
|
|
|
|
|
- removeVehicle(id) {
|
|
|
- Dialog.showDialog({
|
|
|
- title: 'Remove Vehicle',
|
|
|
- message: 'Are you sure you want to remove this vehicle?',
|
|
|
- callback: btn => {
|
|
|
- if (btn == 'ok') {
|
|
|
- Dialog.dismissLoading();
|
|
|
- this.deleteVehicle(id);
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- deleteVehicle(id) {
|
|
|
- Dialog.showProgressDialog();
|
|
|
- apiUser.deleteVehicle({
|
|
|
- vehiclePk: id
|
|
|
- }).then(res => {
|
|
|
- Dialog.dismissLoading();
|
|
|
- toastShort('Delete successfully');
|
|
|
- this.setState({
|
|
|
- refreshId: this.state.refreshId + 1
|
|
|
- })
|
|
|
- }).catch(err => {
|
|
|
- Dialog.dismissLoading();
|
|
|
- toastShort(err);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
deleteAccount() {
|
|
|
Dialog.showDialog({
|
|
|
- title: 'Delete Account',
|
|
|
- message: 'Are you sure you want to delete your account? This operation cannot be revoke.',
|
|
|
- ok: 'CONFIRM',
|
|
|
+ title: $t('profile.deleteAccount'),
|
|
|
+ message: $t('profile.confirmDeleteAccount'),
|
|
|
+ ok: $t('nav.confirm'),
|
|
|
callback: button => {
|
|
|
if (button == Dialog.BUTTON_OK) {
|
|
|
this.deleteMyAccount();
|
|
|
@@ -83,10 +54,12 @@ export default class ProfileV2 extends Component {
|
|
|
deleteMyAccount() {
|
|
|
Dialog.showProgressDialog();
|
|
|
apiUser.deleteAccount().then(res => {
|
|
|
- toastShort('Successfully deleted!')
|
|
|
+ toastShort($t('profile.deleteAccountSuccess'))
|
|
|
Dialog.dismissLoading();
|
|
|
- //startPage(PageList.login);
|
|
|
this.requestLogout();
|
|
|
+ /*setTimeout(() => {
|
|
|
+ startPage(PageList.login);
|
|
|
+ }, 500);*/
|
|
|
}).catch(err => {
|
|
|
Dialog.dismissLoading();
|
|
|
toastShort(err)
|
|
|
@@ -95,10 +68,10 @@ export default class ProfileV2 extends Component {
|
|
|
|
|
|
logout() {
|
|
|
Dialog.showDialog({
|
|
|
- title: 'Sign out',
|
|
|
- message: 'Are you sure you want to sign out?',
|
|
|
+ title: $t('profile.signOut'),
|
|
|
+ message: $t('profile.tipSignOut'),
|
|
|
callback: btn => {
|
|
|
- if (btn == 'ok') {
|
|
|
+ if (btn == Dialog.BUTTON_OK) {
|
|
|
Dialog.showProgressDialog();
|
|
|
setTimeout(() => {
|
|
|
this.requestLogout();
|
|
|
@@ -132,6 +105,7 @@ export default class ProfileV2 extends Component {
|
|
|
<Button
|
|
|
style={styles.cardView}
|
|
|
viewStyle={styles.profileView}
|
|
|
+ android_ripple={ripple}
|
|
|
onClick={() => startPage(PageList.editProfile)}>
|
|
|
{ this.state.userInfo.photoUrl
|
|
|
? <Image
|
|
|
@@ -157,14 +131,14 @@ export default class ProfileV2 extends Component {
|
|
|
{/* Wallet Info */}
|
|
|
<Button
|
|
|
style={styles.cardView}
|
|
|
- viewStyle={styles.profileView}
|
|
|
+ viewStyle={styles.profileItem}
|
|
|
onClick={() => startPage(PageList.wallet)}>
|
|
|
<Image
|
|
|
style={styles.cardIcon}
|
|
|
source={require('../../images/user/card-wallet.png')}/>
|
|
|
<View style={styles.cardInfo}>
|
|
|
- <Text style={styles.cardLabel}>Credits: </Text>
|
|
|
- <Text style={styles.cardPrimary}>{currency}{this.state.userInfo.credit}</Text>
|
|
|
+ <Text style={styles.cardLabel}>{$t('wallet.creditWalletLabel')}</Text>
|
|
|
+ <Text style={styles.cardPrimary}>{currency}{this.state.userInfo.creditStr}</Text>
|
|
|
</View>
|
|
|
<FontAwesome
|
|
|
size={28}
|
|
|
@@ -174,13 +148,13 @@ export default class ProfileV2 extends Component {
|
|
|
{/* Vehicle Info */}
|
|
|
<Button
|
|
|
style={styles.cardView}
|
|
|
- viewStyle={styles.profileView}
|
|
|
+ viewStyle={styles.profileItem}
|
|
|
onClick={() => startPage(PageList.myVehicles)}>
|
|
|
<Image
|
|
|
style={styles.cardIcon}
|
|
|
source={require('../../images/user/card-vehicle.png')}/>
|
|
|
<View style={styles.cardInfo}>
|
|
|
- <Text style={styles.cardLabel}>My Vehicles: </Text>
|
|
|
+ <Text style={styles.cardLabel}>{$t('profile.myVehicles')}</Text>
|
|
|
<Text style={styles.cardPrimary}>{this.state.userInfo.countVehicle}</Text>
|
|
|
</View>
|
|
|
<FontAwesome
|
|
|
@@ -190,7 +164,7 @@ export default class ProfileV2 extends Component {
|
|
|
</Button>
|
|
|
{/* Vehicle List */}
|
|
|
{/* <View style={styles.titleView}>
|
|
|
- <Text style={styles.title}>My Vehicles</Text>
|
|
|
+ <Text style={styles.title}>{$t('profile.myVehicles')}</Text>
|
|
|
<Button
|
|
|
style={{backgroundColor: colorLight}}
|
|
|
borderRadius={3}
|
|
|
@@ -231,13 +205,13 @@ export default class ProfileV2 extends Component {
|
|
|
</View> */}
|
|
|
<Button
|
|
|
style={styles.cardView}
|
|
|
- viewStyle={styles.profileView}
|
|
|
+ viewStyle={styles.profileItem}
|
|
|
onClick={() => startPage(PageList.changePassword, {action: "change"})}>
|
|
|
<Image
|
|
|
style={styles.cardIcon}
|
|
|
source={require('../../images/user/card-account.png')}/>
|
|
|
<View style={styles.cardInfo}>
|
|
|
- <Text style={styles.cardLabel}>Account Security</Text>
|
|
|
+ <Text style={styles.cardLabel}>{$t('route.changePassword')}</Text>
|
|
|
</View>
|
|
|
<FontAwesome
|
|
|
size={28}
|
|
|
@@ -247,23 +221,23 @@ export default class ProfileV2 extends Component {
|
|
|
{/* Notifications */}
|
|
|
<Button
|
|
|
style={styles.cardView}
|
|
|
- viewStyle={styles.profileView}
|
|
|
+ viewStyle={styles.profileItem}
|
|
|
onClick={() => startPage(PageList.settings)}>
|
|
|
<Image
|
|
|
style={styles.cardIcon}
|
|
|
source={require('../../images/user/card-notification.png')}/>
|
|
|
<View style={styles.cardInfo}>
|
|
|
- <Text style={styles.cardLabel}>Notification Settings</Text>
|
|
|
+ <Text style={styles.cardLabel}>{$t('profile.notificationSettings')}</Text>
|
|
|
</View>
|
|
|
<FontAwesome
|
|
|
size={28}
|
|
|
color={textCancel}
|
|
|
name='angle-right'/>
|
|
|
</Button>
|
|
|
- { this.state.userInfo.userType == "Public" &&
|
|
|
+ {/* this.state.userInfo.userType == "Public" &&
|
|
|
<Button
|
|
|
style={styles.cardView}
|
|
|
- viewStyle={styles.profileView}
|
|
|
+ viewStyle={styles.profileItem}
|
|
|
onClick={() => startPage(PageList.registerFleet)}>
|
|
|
<MaterialCommunityIcons
|
|
|
style={styles.cardIcon}
|
|
|
@@ -271,17 +245,17 @@ export default class ProfileV2 extends Component {
|
|
|
size={32}
|
|
|
color="#00638C"/>
|
|
|
<View style={styles.cardInfo}>
|
|
|
- <Text style={styles.cardLabel}>Apply as PHV/Fleet</Text>
|
|
|
+ <Text style={styles.cardLabel}>{$t('profile.apply2Fleet')}</Text>
|
|
|
</View>
|
|
|
<FontAwesome
|
|
|
size={28}
|
|
|
color={textCancel}
|
|
|
name='angle-right'/>
|
|
|
</Button>
|
|
|
- }
|
|
|
+ */}
|
|
|
<Button
|
|
|
style={styles.cardView}
|
|
|
- viewStyle={styles.profileView}
|
|
|
+ viewStyle={styles.profileItem}
|
|
|
onClick={() => this.deleteAccount()}>
|
|
|
<MaterialCommunityIcons
|
|
|
style={styles.cardIcon}
|
|
|
@@ -289,7 +263,7 @@ export default class ProfileV2 extends Component {
|
|
|
size={32}
|
|
|
color="#00638C"/>
|
|
|
<View style={styles.cardInfo}>
|
|
|
- <Text style={styles.cardLabel}>Delete Account</Text>
|
|
|
+ <Text style={styles.cardLabel}>{$t('profile.deleteAccount')}</Text>
|
|
|
</View>
|
|
|
<FontAwesome
|
|
|
size={28}
|
|
|
@@ -304,7 +278,7 @@ export default class ProfileV2 extends Component {
|
|
|
/> */}
|
|
|
<Button
|
|
|
style={styles.deleteButton}
|
|
|
- text="Logout"
|
|
|
+ text={$t('profile.logout')}
|
|
|
textColor={textButton}
|
|
|
onClick={() => this.logout()}
|
|
|
/>
|
|
|
@@ -364,11 +338,18 @@ const styles = StyleSheet.create({
|
|
|
marginLeft: 16,
|
|
|
marginRight: 16,
|
|
|
borderRadius: 10,
|
|
|
+ overflow: 'hidden',
|
|
|
...ElevationObject(5),
|
|
|
alignItems: 'center',
|
|
|
flexDirection: 'row',
|
|
|
backgroundColor: colorLight,
|
|
|
},
|
|
|
+ profileItem: {
|
|
|
+ padding: 16,
|
|
|
+ alignItems: 'center',
|
|
|
+ flexDirection: 'row',
|
|
|
+ justifyContent: 'center',
|
|
|
+ },
|
|
|
cardItem: {
|
|
|
flex: 1,
|
|
|
alignItems: 'center',
|