import React, {Component} from 'react'; import { StyleSheet, Text, Image, View, Alert, TouchableOpacity } from 'react-native'; import { Container, Header, Content, Left, Body, Right, Title, Button as Btn, Icon, Card, CardItem, Col, Footer, Row } from 'native-base'; import { api_url, img_url, reject_order,font_title,font_description } from '../config/Constants'; import * as colors from '../assets/css/Colors'; import {captureScreen} from 'react-native-view-shot'; import { Loader } from '../components/GeneralComponents'; import { Divider, Button } from 'react-native-elements'; import axios from 'axios'; import ViewShot from "react-native-view-shot"; import { connect } from 'react-redux'; import { serviceActionPending, serviceActionError, serviceActionSuccess } from '../actions/ViewPrescriptionActions'; import ImageView from 'react-native-image-view'; import back from "../assets/icons/back1.png"; import download from "../assets/icons/download.png"; import rx from "../assets/icons/rx.jpg"; class ViewPrescription extends Component { constructor(props) { super(props) this.handleBackButtonClick = this.handleBackButtonClick.bind(this); this.reject_order = this.reject_order.bind(this); this.state = { data:this.props.route.params.data, image:[], isImageViewVisible:false, imageURI:'', dataExist:false } } componentDidMount(){ // this.refs.viewShot.capture().then(uri => { // console.log("do something with ", uri); // }); } handleBackButtonClick= () => { this.props.navigation.goBack(null); } accept_order = () => { this.props.navigation.navigate('Payment',{ from : 'prescription', prescription_id:this.state.data.id, prescription_total:this.state.data.total }); } takeScreenShot = () => { // To capture Screenshot captureScreen({ // Either png or jpg (or webm Android Only), Defaults: png format: 'jpg', // Quality 0.0 - 1.0 (only available for jpg) quality: 0.8, }).then( //callback function to get the result URL of the screnshot (uri) => { this.setState({imageUri:uri}); console.log(uri) alert(uri); // setSavedImagePath(uri); // setImageURI(uri); }, (error) => console.error('Oops, Something Went Wrong', error), ); }; reject_order = async () => { this.props.serviceActionPending(); await axios({ method: 'post', url: api_url + reject_order, data:{ prescription_id : this.state.data.id } }) .then(async response => { await this.props.serviceActionSuccess(response.data) if(response.data.status == 1){ Alert.alert( "Rejected", "This prescription successfully rejected.", [ { text: "OK", onPress: () => this.props.navigation.goBack(null) } ], { cancelable: false } ); }else{ alert(response.data.message); } }) .catch(error => { this.props.serviceActionError(error); }); } onCapture = uri => { console.log("do something with ", uri); } view_image = (data) =>{ let image = [ { source: { uri: img_url + data, }, title: 'Prescription Image', width: 806, height: 720 } ] this.setState({ image : image, isImageViewVisible : true }); } close_popup = () =>{ this.setState({ isImageViewVisible : false }); } render() { const { isLoding, error, data, message, status } = this.props return ( {/* */} {/* */} View Prescription this.close_popup() } /> Dr {this.state.data.doctor.name} {"\n"} {/* {this.state.data.doctor.qualification} */} {this.state.data.doctor.qualification} {this.state.data.doctor.description} {this.state.data.doctor.email} {/* {this.state.data.images.map((row, index) => ( this.view_image(row) }> ))} */} {this.state.data.customer_notes && Your Notes {this.state.data.customer_notes} } Patient Detail {global.name} Problem title {this.state.data.booking.title}, Problem description {this.state.data.booking.description} {/* ...The Scroll View Content Goes Here... */} {this.state.data.status != 1 && Prescription Medicine {this.state.data.medicines.map((row, index) => ( {row.name} Take for {row.days} days {/* {global.currency}{row.price} */} ))} {/* Subtotal {global.currency}{this.state.data.sub_total} Delivery Charge {global.currency}{this.state.data.delivery_charge} Tax */} {/* {global.currency}{this.state.data.tax} */} {/* */} {/* Total */} {/* {global.currency}{this.state.data.total} */} {/* */} } {this.state.data.status == 9 &&
} {/*
*/}
); } } function mapStateToProps(state){ return{ isLoding : state.view_prescription.isLoding, error : state.view_prescription.error, data : state.view_prescription.data, message : state.view_prescription.message, status : state.view_prescription.status, }; } const mapDispatchToProps = (dispatch) => ({ serviceActionPending: () => dispatch(serviceActionPending()), serviceActionError: (error) => dispatch(serviceActionError(error)), serviceActionSuccess: (data) => dispatch(serviceActionSuccess(data)) }); export default connect(mapStateToProps,mapDispatchToProps)(ViewPrescription); const styles = StyleSheet.create({ view_style1:{ margin:10,flexDirection:'row',justifyContent:'space-between'}, view_style2:{width:100, justifyContent:'center'}, view_style3:{color:colors.theme_fg_two, fontSize:30}, view_style4:{ margin:5 }, view_style5:{ fontSize:25, color:colors.theme_fg_two, fontFamily: font_title,marginLeft:12}, view_style6:{margin:5}, view_style7:{ fontFamily:font_title, color:'grey' }, view_style8:{ width: 100, height: 70, alignSelf:'center', borderColor: colors.theme_bg_three, borderWidth: 1 }, view_style9:{ fontFamily:font_title, color:colors.theme_fg_two }, view_style10:{fontFamily:font_description}, view_style11:{ fontFamily:font_title, color:colors.theme_fg_two,fontSize:20, }, view_style12:{ paddingLeft:20, paddingRight:20, paddingBottom:10 }, view_style13:{fontFamily:font_description}, view_style14:{fontFamily:font_description}, view_style15:{ fontFamily:font_title, color:colors.theme_fg_two }, view_style16:{ width:40 }, view_style17:{fontFamily:font_title,width:100}, view_style18:{ width:'70%' }, view_style19:{fontFamily:font_description,width:'100%',paddingHorizontal:12}, view_style20:{ width:80 }, view_style21:{fontFamily:font_description}, view_style22:{ backgroundColor: colors.theme_fg_two, width:'90%', alignSelf:'center' }, view_style23:{ marginLeft:20, marginRight:20, marginTop:10 }, view_style24:{fontFamily:font_title}, view_style25:{ width:80 }, view_style26:{fontFamily:font_description}, view_style27:{ backgroundColor: colors.theme_fg_two, width:'90%', alignSelf:'center' }, view_style28:{fontFamily:font_title}, view_style29:{ width:80 }, view_style30:{fontFamily:font_description}, view_style31:{ backgroundColor: colors.theme_fg_two, width:'90%', alignSelf:'center' }, view_style32:{fontFamily:font_title}, view_style33:{ width:80 }, view_style34:{fontFamily:font_description}, view_style35:{ marginBottom:20 }, view_style36:{ marginLeft:20, marginRight:20, marginTop:10 }, view_style37:{ backgroundColor: colors.theme_fg_two, width:'90%', alignSelf:'center' }, view_style38:{fontFamily:font_title}, view_style39:{ width:80 }, view_style40:{fontFamily:font_title }, view_style41:{ marginBottom:20 }, view_style42:{backgroundColor:'transparent'}, view_style43:{ padding:10 }, view_style44:{ backgroundColor:colors.red ,fontFamily:font_title}, view_style45:{ width:10 }, view_style46:{ backgroundColor:colors.theme_fg,fontFamily:font_title }, header: { justifyContent: "flex-start", height: "10%", backgroundColor: colors.theme_bg, borderBottomLeftRadius: 45, borderBottomRightRadius: 45, shadowOffset: { width: 0, height: 15 }, shadowColor: colors.theme_bg, shadowOpacity: 0.1, shadowRadius: 8, elevation: 10, }, header_card: { alignItems: "center", borderRadius: 15, justifyContent: "center", }, header_card_item: { borderTopLeftRadius: 15, borderTopRightRadius: 15, borderBottomLeftRadius: 15, borderBottomRightRadius: 15, shadowOffset: { width: 0, height: 15 }, shadowColor: colors.theme_bg, shadowOpacity: 0.1, shadowRadius: 8, elevation: 10, }, icon:{ color:colors.theme_fg_two }, header_body: { flex: 3, justifyContent: 'center' }, title:{ alignSelf:'center', color:colors.theme_fg_two, alignSelf:'center', fontSize:16, fontFamily:font_title }, footer_container:{ width:'100%', backgroundColor:colors.theme_bg }, btn_cart:{ color:colors.theme_fg_three, fontWeight:'bold', backgroundColor:colors.theme_bg } });