Explorar el Código

prima nota rimosse colonne con tipo mancante

FabioFratini hace 10 meses
padre
commit
03bed0501e
Se han modificado 2 ficheros con 31 adiciones y 7 borrados
  1. 1 1
      app/Http/Livewire/Record.php
  2. 30 6
      resources/views/livewire/records.blade.php

+ 1 - 1
app/Http/Livewire/Record.php

@@ -47,7 +47,7 @@ class Record extends Component
 
         $this->members = \App\Models\Member::select(['id', 'first_name', 'last_name', 'fiscal_code'])->orderBy('last_name')->orderBy('first_name')->get();
 
-        $this->payments = \App\Models\PaymentMethod::select('id', 'name')->where('enabled', true)->where('money', false)->get();
+        $this->payments = \App\Models\PaymentMethod::select('id', 'name','type')->where('enabled', true)->where('money', false)->get();
 
     }
 

+ 30 - 6
resources/views/livewire/records.blade.php

@@ -89,8 +89,17 @@
                     <th scope="col" style="border-left:3px solid white;"></th>
                     <th scope="col" style="border-left:3px solid white;"></th>
                     @foreach($payments as $p)
-                        <th scope="col" style="text-align:right; border-left:3px solid white;">Entrate</th>
-                        <th scope="col" style="text-align:right">Uscite</th>
+                        @if($p->type == 'ALL')
+                            <th scope="col" style="text-align:right; border-left:3px solid white;">Entrate</th>
+                            <th scope="col" style="text-align:right">Uscite</th>
+                        @elseif($p->type == 'IN')
+                            <th scope="col" style="text-align:right; border-left:3px solid white;">Entrate</th>
+                            <th scope="col" style="text-align:right;"></th>
+
+                        @elseif($p->type == 'OUT')
+                            <th style="border-left:3px solid white;"></th>
+                            <th scope="col" style="text-align:center;">Uscite</th>
+                        @endif
                     @endforeach
                 </tr>
             </thead>
@@ -145,11 +154,26 @@
                     <td><b>Totale</b></td>
                     @foreach($payments as $p)
                         @if(isset($totals[$p->name]))
-                            <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice($totals[$p->name]["IN"])}}</b></span></td>
-                            <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice($totals[$p->name]["OUT"])}}</b></span></td>
+                            @if($p->type == 'ALL')
+                                <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["IN"] : 0)}}</b></span></td>
+                                <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["OUT"] : 0)}}</b></span></td>
+                            @elseif($p->type == 'IN')
+                                <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["IN"] : 0)}}</b></span></td>
+                            @elseif($p->type == 'OUT')
+                                <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["OUT"] : 0)}}</b></span></td>
+                            @endif
                         @else
-                            <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(0)}}</b></span></td>
-                            <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(0)}}</b></span></td>
+                            @if($p->type == 'ALL')
+                                <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["IN"] : 0)}}</b></span></td>
+                                <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["OUT"] : 0)}}</b></span></td>
+                            @elseif($p->type == 'IN')
+                                <td style="text-align:right"><span class="tablesaw-cell-content primary" style="color:green; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["IN"] : 0)}}</b></span></td>
+                                <td style="text-align:right"></td>
+                            @elseif($p->type == 'OUT')
+                                <td style="text-align:right"></td>
+                                <td style="text-align:center"><span class="tablesaw-cell-content primary" style="color:red; font-size:18px;"><b>{{formatPrice(isset($totals[$p->name]) ? $totals[$p->name]["OUT"] : 0)}}</b></span></td>
+
+                            @endif
                         @endif
                     @endforeach
                 </tr>