Created
October 11, 2017 08:35
-
-
Save Kamill90/f8642cba5e5889f4ef7f489598c193ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... dependecies | |
//query | |
const fetchDoctor = require('./fetchDoctor'); | |
const fetchVisits = require('./fetchVisits'); | |
class DoctorPage extends Component { | |
constructor(props){ | |
super(props); | |
let daylist = {}; | |
var today = new Date(); | |
var year = today.getFullYear(); var month = today.getMonth(); var date = today.getDate(); | |
for(var i=0; i<30; i++){ | |
let defaultDate = new Date(year, month, date + i); | |
let dateKey = `${defaultDate.getDate()}.${defaultDate.getMonth()}.${defaultDate.getFullYear()}`; | |
daylist[dateKey] = { | |
"fullDateString":defaultDate, | |
}; | |
} | |
this.state={ | |
DayList: daylist | |
}; | |
}; | |
render(){ | |
if(this.props.data.loading){ | |
return( | |
<div> | |
loading | |
</div> | |
) | |
} | |
else { | |
console.log(this.state); | |
let DoctorData = this.props.data.doctorByAdmin; | |
return( | |
<div> | |
{/* //add accessibility */} | |
<ul> | |
{this.ListOFCombinedDaysAndData()} | |
</ul> | |
</div> | |
)} | |
} | |
}; | |
export default compose( | |
graphql(query,{ | |
name:"fetchVisits", | |
options:(props) => { | |
return {variables: { | |
Visit: props.params.Visitid | |
}} | |
} | |
}), | |
graphql(fetchDoctors,{ | |
name: "fetchDoctors", | |
options:(props) => { | |
return {variables: { | |
DoctorId: props.params.id | |
}} | |
} | |
}) | |
)(DoctorPage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment