Skip to content

Instantly share code, notes, and snippets.

@khanof89
Created June 22, 2018 09:51
Show Gist options
  • Save khanof89/7e847ca28109c183f928fb96fa719383 to your computer and use it in GitHub Desktop.
Save khanof89/7e847ca28109c183f928fb96fa719383 to your computer and use it in GitHub Desktop.
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