jeudi 24 mai 2018

Show activity plan

I have to print all the activities that have to be done during the year. Each activity has a different expiration, monthly, quarterly, half-yearly, yearly ... The problem was created when I initialize the variable $ numero_init. If $ numero_init = 1 the deadlines are correctly placed in the table but those that exceed $ i = 12 are added with additional columns in the table. If instead of $ i = $ month the activities are inserted correctly but at the end the last two are inserted in the wrong position and I do not understand why. Tips?

PianoAttivita.blade.php

            @foreach($scadenze as $scadenza)
            @php
                $mese = (int)date_create($scadenza->termine_stimato)->format('m');
                $valore = (int)\App\TipologiaScadenza::find($scadenza->tipologia_id)->valore;
                $numero_init = $mese;
                $numero_iter = (int)12 + $mese;
            @endphp

            <tr>
                <th scope="row"></th>

                @for ($i = $numero_init; $i < $numero_iter; $i++)
                    @if( $mese == $i)
                        <td><i class="fa fa-check" style="color:green;" aria-hidden="true"></i></td>
                        @php $mese = $mese + $valore; @endphp
                    @else
                        <td></td>
                    @endif
                @endfor
            </tr>
        @endforeach



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire