Created
June 22, 2018 09:51
-
-
Save khanof89/7e847ca28109c183f928fb96fa719383 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
componentWillMount = () => { | |
if (!this.props.params.facilityId) return false; | |
this.props.dispatch(getAvailability(this.props.params.facilityId)); | |
}; | |
inputFieldOnChangeHandler = (event) => { | |
const identifier = event.target.getAttribute('data-id'); | |
if (event.target.value !== '') { | |
this.props.dispatch(updateAvailability(event.target.value, this.props.params.facilityId, identifier)); | |
this.props.dispatch(getAvailability(this.props.params.facilityId)); | |
} | |
}; | |
const table = (props) => { | |
return ( | |
<table className="customeTable tableInventory"> | |
<TableHead/> | |
<tbody className="admin-list-table-body"> | |
{props.dayNames.map((index, value) => { | |
return (<tr className="rowClickable" key={value}> | |
<th className="table_head" | |
key={value}>{moment().format('YYYY-MM-DD') === index ? 'Today' : moment(index).format('dddd')}</th> | |
{[...Array(24).keys()].map((i) => { | |
return (<td className="tableCells" key={i}> | |
<input type="text" className="inputBox" onBlur={props.textInput} data-id={index + '_' + i} placeholder={(props.availabilities && props.availabilities[index]) ? props.availabilities[index][i] : '0'}/> | |
</td>); | |
})} | |
</tr>); | |
})} | |
</tbody> | |
</table> | |
); | |
}; | |
export default table; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment