I have a data structure like this :-
WorkHistory{
List<Jobs> jobs;
}
Jobs{
List<String> workDoneSentences;
}
Basically, I am trying to collect all past jobs where a person has worked and the work that he hsa done there. So it is a list of list structure. I would like to know how can we handle this in UI for Thymeleaf/Spring mvc.
I am trying to create UI as shown in the images. There is a table to enter data. To enter workDoneSentence i would like to open another modal. And the list of sentences should be bound to correct job index.
Work Done opens the modal to take input the list of work done sentences.
The html code that I have for this as follows :-
<tbody>
<tr id='addr_work0' th:each="workRow, rowStat : *{workHistoryDetails.allWorkHistoryData}">
<td th:text="${rowStat.index + 1}"></td>
<td><input type="text" name='work_name0'
placeholder='Company Name' class="form-control" th:field="*{workHistoryDetails.allWorkHistoryData[__${rowStat.index}__].companyName}"/></td>
<td><input type="text" name='work_city0'
placeholder='Company city' class="form-control" th:field="*{workHistoryDetails.allWorkHistoryData[__${rowStat.index}__].city}"/></td>
<td><input type="text" name='work_title0'
placeholder='Job Title' class="form-control" th:field="*{workHistoryDetails.allWorkHistoryData[__${rowStat.index}__].jobTitle}"/></td>
<td><input name="is_current0" type="checkbox"
value="" class="form-control" style="text-align: center;" th:field="*{workHistoryDetails.allWorkHistoryData[__${rowStat.index}__].currentJob}">
</td>
<td><input type="text" name='work_start0'
placeholder='Start Date' class="form-control" th:field="*{workHistoryDetails.allWorkHistoryData[__${rowStat.index}__].startDate}"/></td>
<td><input type="text" name='work_end0'
placeholder='End Date' class="form-control" th:field="*{workHistoryDetails.allWorkHistoryData[__${rowStat.index}__].endDate}"/></td>
<td><a class="btn btn-primary btn-md" id="work_done0"
name="work_done0">Work done</a></td>
</tr>
<tr id='addr_work1'></tr>
</tbody>
I am not sure how I can link the workDone input. Please suggest. Thanks!