I am currently working on developing a timesheet application that allows users to input the number of hours they work daily. The user data is stored in an object, and I aim to display each user's hours (duration
) in an input field within a table. An image demonstrating the desired data structure can be found here: https://i.sstatic.net/tUHUx.jpg
You can also view a fiddle of the project here: https://jsfiddle.net/h64wafkp/14/
In this database, each user has a one-to-many relationship with another table named "hours". Here is an example of the JSON data structure:
{
"id": 1,
"firstname": "JayZ",
"lastname": "Carter",
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bfd5dec6ffcdd0dcded9dac7ded0d2">[email protected]</a>",
"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
}
]
},
The table itself is a standard HTML table with each day as column headers. My challenge lies in linking each duration
to the corresponding date cell (refer to the above image). Any advice or suggestions would be appreciated.