I'm trying to build a timesheet application where users can enter the amount of hours they are working each day. I'm storing the data about each user in an object and I wish to populate an input field in a table with each respective hour (duration). To illustrate how I want to store the data, I added an image: https://i.sstatic.net/tUHUx.jpg
And also a fiddle: https://jsfiddle.net/h64wafkp/14/
Basically, each user in the database has a one-to-many relationship with another table called "hours", so the data structure looks as such:
{
"id": 1,
"firstname": "JayZ",
"lastname": "Carter",
"email": "[email protected]",
"hours": [
{
"id": 226,
"user_id": 1,
"date": "2018-12-05",
"duration": 140
},
{
"id": 1,
"user_id": 1,
"date": "2018-12-02",
"duration": 13
},
{
"id": 2,
"user_id": 1,
"date": "2018-12-03",
"duration": 13
}
]
},
Then there's the table itself which is just a regular html table with each respective day as column headers. My issue is how to bind each duration to each respective date cell (see image above). Any suggestions?
bind.