I am using Laravel Framework to do this PHP app.
I am parsing an XML from an API and the information I get is structured like this:
projectName
projectJobs
- a list with jobs that I am outputting with a @foreach
into a table (<td>
);
I want to let the user group the jobs as he wishes. I was thinking of doing this:
@foreach($_SESSION['workingProjects'] as $projectName => $projectDetails)
<tr class="success">
<td>{{$projectDetails['givenName']}} <p class="text-muted" style="font-size: 0.7em">( {{ $projectName }} )</p></td>
<td></td>
<td></td>
@foreach($projectDetails['jobs'] as $jobName => $jobUrl)
<tr>
<td>{{$jobName}}</td>
<td>
<select>
<option name="group[1][{{$projectDetails['givenName']}}][{{$jobName}}]" value="1">
1
</option>
<option name="group[2][{{$projectDetails['givenName']}}][{{$jobName}}]" value="2">
2
</option>
<option name="group[3][{{$projectDetails['givenName']}}][{{$jobName}}]" value="3">
3
</option>
<option name="group[4][{{$projectDetails['givenName']}}][{{$jobName}}]" value="4">
4
</option>
<option name="group[5][{{$projectDetails['givenName']}}][{{$jobName}}]" value="5">
5
</option>
</select>
</td>
<td>
<input type="checkbox" name="k1">k1</input>
<input type="checkbox" name="k2">k2</input>
<input type="checkbox" name="k3">k3</input>
<input type="checkbox" name="k4">k4</input>
<input type="checkbox" name="k5">k5</input>
</td>
</tr>
@endforeach
@endforeach
</tbody>
Having more projects, I need to have a list of projectNames
which each have a list of projectJobs
grouped by the select
in 1-5
range.
Example:
PROJECT1 => [ GROUP1 => [ JOB1, JOB2, JOB5 ] GROUP2 => [ JOB3, JOB4 ] ]
;
The problem is that I only get the crsf_token()
posted and I don't think this is the proper way to do it anyway.
Clarification:
I have a list of projects, each project has many jobs, each job needs to be grouped by the user in one of groups. I need to get the user grouping back to the applicaton.
For example User1
has 3 Projects
: P1, P2, P3; each project has it's own Jobs
: J1_1, J1_2, J1_3, J1-4, J1_5, J2_1, J2_2, etc.
I want to enable the user
to group them as he wishes and send that info to me. For example for P1
, the User
groups the jobs like this: Group1
: J1_2, J1_3, Group2
: J1_1, J1_4, Group3
: J1_5