diff --git a/App.js b/App.js
index fa99dea..2a5eb52 100644
--- a/App.js
+++ b/App.js
@@ -90,7 +90,7 @@ class App extends Component {
body: remoteMessage.notification.body,
android: {
channelId,
- smallIcon: 'ic_launcher'
+ smallIcon: 'ic_splash'
},
ios: {
foregroundPresentationOptions: {
@@ -119,8 +119,6 @@ class App extends Component {
if (!apnsToken) {
console.log('Failed to get APNs token after retries');
- // Decide if we want to return here or try anyway.
- // Usually if APNs is missing, getToken will fail.
}
}
@@ -136,10 +134,6 @@ class App extends Component {
store.dispatch(appSetDevice(resultSendDevice.data.device))
}
}
-
- // เพิ่ม notification listeners
- this.setupNotificationListeners();
-
} catch (error) {
console.log('initNotification error:', error);
}
@@ -175,7 +169,6 @@ class App extends Component {
this.initNotification()
} else {
this.setPermission()
- this.setupNotificationListeners()
}
console.log('app state', appState, device)
diff --git a/android/app/release/app-release.apk b/android/app/release/app-release.apk
index 299d1e3..e6b52c8 100644
Binary files a/android/app/release/app-release.apk and b/android/app/release/app-release.apk differ
diff --git a/src/screens/notification/Notification.js b/src/screens/notification/Notification.js
index a3e8f80..450eb95 100644
--- a/src/screens/notification/Notification.js
+++ b/src/screens/notification/Notification.js
@@ -47,11 +47,11 @@ class NotificationScreen extends Component {
getContentId(item) {
let data = item.data;
- let dataJson = JSON.parse(data);
- if(dataJson.id){
+ let dataJson = (data && JSON.parse(data)) || null;
+ if(dataJson && dataJson.id){
return dataJson.id;
}else {
- return null;
+ return item.source_id || null;
}
}
diff --git a/src/screens/repair/RepairHistory.js b/src/screens/repair/RepairHistory.js
index 4b9018f..26ad96b 100644
--- a/src/screens/repair/RepairHistory.js
+++ b/src/screens/repair/RepairHistory.js
@@ -116,7 +116,7 @@ class RepairHistory extends Component {
{item.name}
- #{item.id}
+ #{item.code}
diff --git a/src/screens/repair/RepairHistoryDetail.js b/src/screens/repair/RepairHistoryDetail.js
index 64bbead..f87d721 100644
--- a/src/screens/repair/RepairHistoryDetail.js
+++ b/src/screens/repair/RepairHistoryDetail.js
@@ -121,38 +121,38 @@ export default class RepairHistoryDetail extends Component {
getRepairData(){
this.setState({
isLoading: true
- })
- getRepairById(this.state.project_id, this.state.repair_id)
- .then(res => {
- console.log('repair data -------------> ',res.data.data)
- this.setState({
- repair: res.data.data,
- order_list: res.data.data.services,
- isLoading: false
- })
+ }, () => {
+ getRepairById(this.state.project_id, this.state.repair_id)
+ .then(res => {
+ this.setState({
+ repair: res.data,
+ order_list: res.data.material_list || [],
+ isLoading: false
+ })
- let rating_star = [0, 0, 0, 0, 0];
- for(let i=0; i {
- this.setState({
- isLoading: false
- })
+ this.props.navigation.setParams({statusRepair: res.data.data.status})
+ })
+ .catch(() => {
+ this.setState({
+ isLoading: false
+ })
+ })
})
}
renderItem = (item) => {
return
- {item.name}
- {this.state.repair.status === 'Cancel' ? 0: item.service_fee} {t('baht')}
+ {item.name_th}
+ {this.state.repair.status === 'Cancel' ? 0 : item.total_cost || 0} {t('baht')}
}
@@ -161,14 +161,18 @@ export default class RepairHistoryDetail extends Component {
convertStatus(statusName){
switch(statusName){
case 'Pending':
+ case '1':
return t('request_repair');
case 'InProgress':
+ case '2':
return 'ยืนยันนัด';
case 'NewAppointment':
return t('repair_re_appoint');
case 'Cancel':
+ case '4':
return t('cancel');
case 'Success':
+ case '3':
return t('repair_success');
default:
return t('pending')
@@ -178,15 +182,19 @@ export default class RepairHistoryDetail extends Component {
convertColorStatus(statusName){
switch(statusName){
case 'Pending':
+ case '1':
return '#FF9500';
case 'InProgress':
+ case '2':
// return '#FFCC00'
return '#007AFF';
case 'NewAppointment':
return '#145EB3';
case 'Cancel':
+ case '4':
return '#666666';
case 'Success':
+ case '3':
return '#2C7C0B';
default:
return '#C4C4C4';
@@ -200,7 +208,7 @@ export default class RepairHistoryDetail extends Component {
{t('room')} {this.state.repair && this.state.repair.room_no ? this.state.repair.room_no : ''}
- #{this.state.repair && this.state.repair.id ? this.state.repair.id : ''}
+ #{this.state.repair && this.state.repair.code ? this.state.repair.code : ''}
{this.state.repair && this.state.repair.project_name ? this.state.repair.project_name : '' }
@@ -211,14 +219,13 @@ export default class RepairHistoryDetail extends Component {
{
this.state.repair && this.state.repair.status ?
- this.state.repair.status === 'Pending'
- && (this.state.repair.date === null || this.state.repair.time === null || this.state.repair.date === '' || this.state.repair.time === '')
+ this.state.repair.status === '1' && !this.state.repair.work_date
? กรุณารอการนัดหมายใหม่จากเจ้าหน้าที่
:
{t('date')}
- {this.state.repair && this.state.repair.date ? moment(this.state.repair.date, 'YYYY-MM-DD').format('DD-MM-YYYY') : '' }
- เวลา
- {this.state.repair && this.state.repair.time ? moment(this.state.repair.time, 'HH:mm:ss').format('HH:mm') + ' น.' : '' }
+ {(this.state.repair && this.state.repair.work_date) || '' }
+ {/*เวลา
+ {this.state.repair && this.state.repair.time ? moment(this.state.repair.time, 'HH:mm:ss').format('HH:mm') + ' น.' : '' }*/}
:
}
@@ -226,7 +233,8 @@ export default class RepairHistoryDetail extends Component {
{t('status')}
- {this.state.repair && this.state.repair.status ? this.convertStatus(this.state.repair.status) : ''}
+ {(this.state.repair && this.state.repair.status_name) || ''}
+ {/*{this.state.repair && this.state.repair.status ? this.convertStatus(this.state.repair.status) : ''}*/}
@@ -243,6 +251,11 @@ export default class RepairHistoryDetail extends Component {
pagingEnabled={true}
extraData={this.state}
keyExtractor={this._keyExtractor}
+ ListEmptyComponent={() =>
+
+ ไม่พบรายการข้อมูล
+
+ }
/>
@@ -251,12 +264,19 @@ export default class RepairHistoryDetail extends Component {
{t('estimate_charge')}
- {this.state.repair.status === 'Cancel' ? 0 : this.state.repair && this.state.repair.total ? this.state.repair.total : 0} {t('baht')}
+
+ {
+ this.state.repair.status === 'Cancel'
+ ? 0
+ : this.state.repair && this.state.repair.total_payment_amount
+ ? this.state.repair.total_payment_amount : 0
+ } {t('baht')}
+
{
- this.state.repair.status === 'Success' && this.state.repair.points &&
+ this.state.repair.status === '3' && this.state.repair.points &&
คะแนนการประเมิน
@@ -290,7 +310,7 @@ export default class RepairHistoryDetail extends Component {
}
{
- !this.state.repair.points && this.state.repair.status === 'Success' &&
+ !this.state.repair.points && this.state.repair.status === '3' &&
{
this.props.navigation.navigate('RepairDetail', {