SHARE
TWEET

Untitled

a guest Jun 17th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. constructor(props) {
  2.     super(props);
  3.     this.state = {
  4.         appointments: []
  5.     }
  6. }
  7.  
  8. loadConstruction(id) {
  9.     // axios.get('/construction/' + id)
  10.     //   .then( construction => {
  11.     //     this.setState({ construction: construction.data })
  12.     //   })
  13.     //   .catch( error => {
  14.     //     console.log('error: ', error);
  15.     //   })
  16.  
  17.     console.log(id);
  18.  
  19.     const APIFETCH = '/appointment-medical-records/' + id;
  20.     const FULLPATH = `${API.domain}${API.admin_path}${APIFETCH}`
  21.     const token = localStorage.getItem('token');
  22.     fetch(FULLPATH, {
  23.         method: "get",
  24.         headers: new Headers({
  25.             'Authorization': `Bearer ${token}`,
  26.             'Content-Type': 'application/json'
  27.         }),
  28.     }).then(response => response.json()).then(res => this.setState({ appointments: res.data }))
  29.         .catch(error => {
  30.             console.log('error: ', error);
  31.         });
  32.  
  33.  
  34. }
  35.  
  36.  
  37. componentDidMount() {
  38.  
  39.  
  40.     const id = this.props.match.params.id;
  41.     this.loadConstruction(id);
  42.  
  43.     console.log(this.props);
  44.  
  45. }
  46.  
  47. render() {
  48.  
  49.     const {
  50.         appointments = [],
  51.         record = []
  52.     } = this.state;
  53.  
  54.     let appointmentsArr = appointments.map((appointment) => {
  55.         return (
  56.             {
  57.                 id: appointment.id,
  58.  
  59.             }
  60.         )
  61.     });
  62.     return (
  63.  
  64.         <List filters={<ReportListFilter />}  {...this.props} bulkActionButtons={false} actions={null} pagination={null} >
  65.  
  66.             <Datagrid rowClick="edit">
  67.                 <TextField label="Id" source="id" sortable={false} />
  68.                 <TextField label="Type" source="record_type.name" sortable={false} />
  69.                 <TextField label="Hospital" source="hospital.name" sortable={false} />
  70.                 {/*<TextField label="Doctor" source="doctor.user_profile.full_name" />*/}
  71.                 <TextField label="Uploaded By" source="patient.user_profile.full_name" sortable={false} />
  72.                 {/* <BooleanField label="Is Approved ?" source="is_approved" /> */}
  73.                 <ChipField source="approval_status" sortable={false} />
  74.  
  75.                 {/* <CreateRelatedCommentButton /> */}
  76.                 <ArrayField source="tags">
  77.                     <SingleFieldList>
  78.                         <TextField source="tags.name" />
  79.                     </SingleFieldList>
  80.                 </ArrayField>
  81.  
  82.                 <TextField label="Purpose" source="appointment.purpose" sortable={false} />
  83.  
  84.  
  85.                 {/* <FileField label="Medical Reports" source="documents" src="record_full_path" title="View" options={{ multiple: true }}/> */}
  86.  
  87.  
  88.  
  89.  
  90.                 {/* <FileField  label="Medical Reports" source="documents.record_full_path" title="desc" sortable={false} /> */}
  91.  
  92.  
  93.                 <ShowButton />
  94.             </Datagrid>
  95.         </List>
  96.  
  97.  
  98.     );
  99. }
  100.      
  101. <SimpleShowLayout>
  102.  
  103.             <ImageField source="documents" src="record_full_path"  />
  104.  
  105.             </SimpleShowLayout>
  106.  
  107.  
  108. </Show>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top