import React,{Component} from 'react' import { TouchableOpacity, TextInput, StyleSheet, View, ScrollView, Alert, Image, ImageBackground, FlatList } from 'react-native' import Icon from "../../components/Icon"; import { CustomButton } from '../../components/CustomButton'; import { Button, Card, Body, Badge, ListItem, Left, Right,CheckBox, } from 'native-base' import { BackgroundImage } from '../../components/BackgroundImage' import Text from '../../components/Text'; import LinearGradient from 'react-native-linear-gradient'; import Color from '../../color'; import GetWidthHeightDevice from '../../components/GetWidthHeightDevice' import { t } from '../../utils/i18n' import moment from 'moment'; export default class RepairSuccess extends Component { constructor(props) { super(props) this.state = { repair:{}, room:'', project:'', order_list:[ { title: 'น้ำรั่ว', price: '200' }, { title: 'เปลี่ยนก๊อกน้ำ', price: '150' }, { title: 'ไฟฟ้าช๊อต', price: '500' }, ] } this.convertStatus = this.convertStatus.bind(this) this.convertColorStatus = this.convertColorStatus.bind(this) } componentDidMount = () => { const { navigation } = this.props const repair_state = navigation.getParam('repair', 'NO-DATA') this.setState({ repair: repair_state, }) }; renderItem = ({item}) => { return {item.name} {item.service_fee} {t('baht')} } _keyExtractor = (item, index) => 'order_'+index convertStatus(statusName){ switch(statusName){ case 'Pending': return t('request_repair') case 'InProgress': return 'ซ่อมแซม' case 'NewAppointment': return 'นัดหมายใหม่' case 'Cancel': return t('cancel') case 'Success': return 'สำเร็จ' default: return t('pending') } } convertColorStatus(statusName){ switch(statusName){ case 'Pending': return '#FF9500' case 'InProgress': return '#FFCC00' case 'NewAppointment': return '#145EB3' case 'Cancel': return '#FF2D55' case 'Success': return '#2C7C0B' default: return '#C4C4C4' } } render() { return ( {t('request_sent')} {t('room')} {this.state.repair.room_no} #{this.state.repair.id} {this.state.repair.project_name} {t('make_appoint')} {t('date')} { moment(this.state.repair.date).format('DD-MM-YYYY') } เวลา {this.state.repair.time == null ? '' : this.state.repair.time.slice(0,-3) + ' น.' } {t('status')} {this.convertStatus(this.state.repair.status)} {t('information')} {t('estimate_charge')} {this.state.repair.total} {t('baht')} {this.props.navigation.popToTop()}} title={t('back_home')} /> {/* {t('request_sent')} {t('room')} {this.state.repair.room_no} #{this.state.repair.id} {this.state.repair.project_name} {t('make_appoint')} {t('date')} { moment(this.state.repair.date).format('DD-MM-YYYY') } เวลา {this.state.repair.time == null ? '' : this.state.repair.time.slice(0,-3) + ' น.' } {t('status')} {this.convertStatus(this.state.repair.status)} {t('information')} {t('estimate_charge')} {this.state.repair.total} {t('baht')} {this.props.navigation.popToTop()}} title={t('back_home')} /> */} ) } } const styles = { textTitle:{ fontSize: 14, color: Color.green_title, marginBottom: 10 }, button_style: { backgroundColor: '#269A21', height: 40, borderRadius: 5, justifyContent:'center', } }