lundi 30 mai 2016

Displaying array data within table

I am trying to display some data within a table. I have the following headers

<thead>
    <tr>
        <th>Lead ID</th>
        <th>Category</th>
        <th>Client Name</th>
        <th>Quote ID</th>
        <th>Amount</th>
        <th>Amount Tax</th>
        <th>Amount inc Tax</th>
        <th>Cost</th>
        <th>Cost Tax</th>
        <th>Cost inc Tax</th>
    </tr>
</thead>

In terms of the data I am passing my view, it looks like the following

[6] => Array
(

    [leadData] => Array
        (
            [LeadID] => 1266283
            [Client] => Test Client
            [Category] => Lead
        )
    [quoteDataIssued] => Array
        (
            [QuoteID] => Q12459
            [Amount] => 1500.00
            [AmountTax] => 300.00
            [AmountIncludingTax] => 1800.00
            [EstimatedCost] => 0.00
            [EstimatedCostTax] => 0.00
            [EstimatedCostIncludingTax] => 0.00
        )

    [quoteDataIssued] => Array
        (
            [QuoteID] => Q12458
            [Amount] => 0.00
            [AmountTax] => 0.00
            [AmountIncludingTax] => 0.00
            [EstimatedCost] => 0.00
            [EstimatedCostTax] => 0.00
            [EstimatedCostIncludingTax] => 0.00
        )

)

The code I am currently using to display this data is like so

@foreach($forecastArray as $array)
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
    </tr>
@endforeach

Now the problem with the above code is that it can only handle one quote. In the data example I have shown, you can see that this one has 2 quotes. If there are more than one quote, then the additional quotes should display on the next tr.

Is there any way this can be achieved? I was thinking about a foreach within the tr to loop the number of quoteDataIssued, but would this require an inner table? (cant do a nested tr)

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire