mardi 22 mai 2018

Create table from different expiry

I have to create a table with the deadlines that occur during the year. I have a list of deadlines, with a title, term_status, tipo_id. The_id type refers to the type_scalence table (id, name, value (to Add for repeat), operation (carbon: addYear, AddMonth), created_at. I would like to insert an X in the cell taken into consideration based on the type of expiry. The first x is made based on the term_status of the expiry, extrapolating the number of the month. But I do not know how to repeat the deadline depending on the type. Some advice?

ScadenzaController

    public function pAttivita()
{
    $scadenze = DB::table('scadenze')
        ->distinct('processo_id')
        ->get();

    return view('scadenze.piano_attivita',compact('scadenze'));
}

piano_attivita.blade.php

@section('content')
<table class="table table-bordered">
    <thead>
    <tr>
        <th scope="col">Attività</th>
        <th scope="col">Gennaio</th>
        <th scope="col">Febbraio</th>
        <th scope="col">Marzo</th>
        <th scope="col">Aprile</th>
        <th scope="col">Maggio</th>
        <th scope="col">Giugno</th>
        <th scope="col">Luglio</th>
        <th scope="col">Agosto</th>
        <th scope="col">Settembre</th>
        <th scope="col">Ottobre</th>
        <th scope="col">Novembre</th>
        <th scope="col">Dicembre</th>
    </tr>
    </thead>
    <tbody>

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

            <tr>
                <th scope="row"></th>
                @for ($i = 1; $i < 12; $i++)
                    @if( $mese == $i)
                        <td></td>
                    @else
                        @if($mese + $meseAdd == $i)
                            <td></td>
                        @elseif($mese + $meseAdd > $i)
                            <td></td>
                        @endif
                    @endif
                @endfor
            </tr>
        @endforeach

    </tbody>
</table>@stop



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ICvbRi
via IFTTT

Aucun commentaire:

Enregistrer un commentaire