Kaynağa Gözat

Merge branch 'risptistino' into fabio_develop

FabioFratini 10 ay önce
ebeveyn
işleme
b3c24a88f3

+ 9 - 136
app/Http/Livewire/CourseList.php

@@ -3,8 +3,6 @@
 namespace App\Http\Livewire;
 
 use Livewire\Component;
-use App\Models\MemberCourse;
-use Illuminate\Support\Facades\Log;
 
 use PhpOffice\PhpSpreadsheet\Spreadsheet;
 use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
@@ -94,7 +92,6 @@ class CourseList extends Component
         $this->emit('load-data-table');
     }
 
-    
 
     public function render()
     {
@@ -429,22 +426,22 @@ class CourseList extends Component
                         {
                             if (session()->get('sort_value', 0) == 0)
                             {
-                                $sort_value = 1;                                
+                                $sort_value = 1;
                             }
                             if (session()->get('sort_value', 0) == 1)
                             {
-                                $sort_value = 2;                                
+                                $sort_value = 2;
                             }
                             if (session()->get('sort_value', 0) == 2)
                             {
-                                $sort_value = 3;                                
+                                $sort_value = 3;
                             }
                             if (session()->get('sort_value', 0) == 3)
                             {
-                                $sort_value = 0;                                
+                                $sort_value = 0;
                             }
                             session()->put('sort_value', $sort_value);
-                            
+
                         }
                         session()->put('sort_order', $d);
                     }
@@ -458,7 +455,7 @@ class CourseList extends Component
                 }
 
             }
-        }  
+        }
 
         //print $sort_value;
 
@@ -704,13 +701,11 @@ class CourseList extends Component
             $this->totSExcel[] = array('green' => (isset($totalIsc["Y"]) ? formatPrice($totalIsc["Y"]) : 0), 'orange' => (isset($totalIsc["N"]) ? formatPrice($totalIsc["N"]) : 0), 'yellow' => 0);
 
         }
-        
         $this->totS[] = $str;
 
         $str = "";
         foreach($totals as $z => $t)
         {
-            
             if ($z == 1) $xx = 5;
             if ($z == 2) $xx = 6;
             if ($z == 3) $xx = 7;
@@ -733,7 +728,6 @@ class CourseList extends Component
             }
 
             $this->totSExcel[$xx] = $aaa;
-            
             $this->totS[$xx] = $str;
             //$js .= $xx . "§" . $str . "_";
 
@@ -767,12 +761,10 @@ class CourseList extends Component
 
         $this->recordsNoPaginate = [];
         $this->recordsNoPaginate = $datas;
-        
         //if (isset($_GET["start"]))
         $datas = array_slice($datas, $this->start, $this->pageLength);
 
         $this->pages = ceil($this->totalRecords / $this->pageLength);
-        
         $this->records = [];
         $this->records = $datas;
 
@@ -851,123 +843,10 @@ class CourseList extends Component
         }
 
         $c = \App\Models\Course::findOrFail($course_id);
-        $m = MemberCourse::findOrFail($id);
+        $m = \App\Models\MemberCourse::findOrFail($id);
         return redirect()->to('/in?new=1&memberId=' . $member_id . (sizeof($newMonths) > 0 ? '&causalId=' . $c->causal_id : '') . '&subCausalId=' . $c->sub_causal_id . '&createSubscription=' . ($subscription ? 1 : 0) . (sizeof($newMonths) > 0 ? '&months=' . implode("|", $newMonths) : '') . (sizeof($newMonths) > 0 ? '&price=' . $m->price : '') . '&subscription_price=' . $m->subscription_price . "&courseId=" . $id);
 
     }
-    public function suspendPayment($course_id, $month, $member_id, $id, $subscription)
-    {
-
-        $monthMap = [
-            1 => 9,  // September
-            2 => 10, // October
-            3 => 11, // November
-            4 => 12, // December
-            5 => 1,  // January
-            6 => 2,  // February
-            7 => 3,  // March
-            8 => 4,  // April
-            9 => 5,  // May
-            10 => 6, // June
-            11 => 7, // July
-            12 => 8  // August
-        ];
-
-        $dbMonth = isset($monthMap[$month]) ? $monthMap[$month] : $month;
-
-
-        $memberCourse = MemberCourse::where('id', $id)
-            ->where('member_id', $member_id)
-            ->where('course_id', $course_id)
-            ->first();
-
-
-        if (!$memberCourse) {
-            return response()->json(['error' => 'Non Trovato'], 404);
-        }
-
-        $monthsData = json_decode($memberCourse->months, true);
-        if (!is_array($monthsData)) {
-            return response()->json(['error' => 'Invalid months data format'], 400);
-        }
-
-        $monthUpdated = false;
-        foreach ($monthsData as &$monthData) {
-            if ($monthData['m'] == $dbMonth) {
-                $monthData['status'] = 2;
-                $monthUpdated = true;
-            }
-        }
-
-        if (!$monthUpdated) {
-            return response()->json(['error' => 'Month not found in data'], 404);
-        }
-
-        $memberCourse->months = json_encode($monthsData);
-        $memberCourse->save();
-        session()->flash('success', 'Payment suspended successfully');
-        return redirect()->to('/course_list');
-    }
-
-    public function resumePayment($course_id, $month, $member_id, $id, $subscription)
-    {
-        Log::info('resumePayment');
-        log::info($course_id);
-        log::info($month);
-        log::info($member_id);
-        log::info($id);
-
-        $monthMap = [
-            1 => 9,  // September
-            2 => 10, // October
-            3 => 11, // November
-            4 => 12, // December
-            5 => 1,  // January
-            6 => 2,  // February
-            7 => 3,  // March
-            8 => 4,  // April
-            9 => 5,  // May
-            10 => 6, // June
-            11 => 7, // July
-            12 => 8  // August
-        ];
-
-        $dbMonth = isset($monthMap[$month]) ? $monthMap[$month] : $month;
-
-
-        $memberCourse = MemberCourse::where('id', $id)
-            ->where('member_id', $member_id)
-            ->where('course_id', $course_id)
-            ->first();
-
-        if (!$memberCourse) {
-            return response()->json(['error' => 'Non Trovato'], 404);
-        }
-
-        $monthsData = json_decode($memberCourse->months, true);
-        Log::info('data mese',$monthsData);
-        if (!is_array($monthsData)) {
-            return response()->json(['error' => 'Invalid months data format'], 400);
-        }
-
-        $monthUpdated = false;
-        foreach ($monthsData as &$monthData) {
-            if ($monthData['m'] == $dbMonth) {
-                $monthData['status'] = "";
-                $monthUpdated = true;
-            }
-        }
-        Log::info($monthUpdated);
-
-        if (!$monthUpdated) {
-            return response()->json(['error' => 'Month not found in data'], 404);
-        }
-
-        $memberCourse->months = json_encode($monthsData);
-        $memberCourse->save();
-        session()->flash('success', 'Payment resumed successfully');
-        return redirect()->to('/course_list');
-    }
     /*
     public function newPayment()
     {
@@ -997,7 +876,6 @@ class CourseList extends Component
     {
 
         $letters = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
-       
         $spreadsheet = new Spreadsheet();
         $activeWorksheet = $spreadsheet->getActiveSheet();
 
@@ -1026,7 +904,6 @@ class CourseList extends Component
             $activeWorksheet->setCellValue('A' . $count, $record["column_19"]);
             $activeWorksheet->setCellValue('B' . $count, $record["column_0"]);
             $activeWorksheet->setCellValue('C' . $count, $record["column_1"]);
-            
             list($color, $value) = explode("§", $record["column_2"]);
             $activeWorksheet->setCellValue('D' . $count, $value);
             $c = '#FFFFFF';
@@ -1035,7 +912,6 @@ class CourseList extends Component
             if($color == 1)
                 $c = '00ff00';
 
-                
             $activeWorksheet->getStyle('D' . $count . ':D' . $count)
                 ->getFill()
                 ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)
@@ -1045,7 +921,6 @@ class CourseList extends Component
             for($ii=3; $ii<=14; $ii++)
             {
                 list($color, $value) = explode("§", $record["column_" . $ii]);
-                
                 $c = 'FFFFFF';
                 if($color == 'orange')
                     $c = 'ffa500';
@@ -1072,7 +947,6 @@ class CourseList extends Component
                     $cells->setBackground($c);
                     //$cells->setAlignment('center');
                 });*/
-                
             }
 
             $activeWorksheet->getStyle("A1:P1")->getFont()->setBold( true );
@@ -1084,7 +958,6 @@ class CourseList extends Component
         $activeWorksheet->setCellValue('A' . (1 + $count), '');
         $activeWorksheet->setCellValue('B' . (1 + $count), '');
         $activeWorksheet->setCellValue('C' . (1 + $count), '');
-        
         for($x=0; $x<=sizeof($this->totSExcel); $x++)
         {
 
@@ -1114,8 +987,8 @@ class CourseList extends Component
                 $activeWorksheet->getStyle($letters[$x + 3] . (3 + $count) . ':' . $letters[$x + 3] . (3 + $count))
                         ->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_WHITE);;
             }
-            
-        }        
+
+        }
 
         $writer = new Xlsx($spreadsheet);
         $writer->save($path = storage_path('pagamento_corsi_' . date("YmdHis") . '.xlsx'));

+ 36 - 0
database/migrations/2025_03_07_173000_ass_fields_to_create_course_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('courses', function (Blueprint $table) {
+            $table->json('when')->nullable();
+            $table->json('prices')->nullable();
+            $table->enum('type', ['standard', 'custom']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('courses', function (Blueprint $table) {
+            $table->dropColumn('when');
+            $table->dropColumn('prices');
+            $table->dropColumn('type');
+        });
+    }
+};

+ 160 - 56
resources/views/livewire/course_list.blade.php

@@ -8,7 +8,38 @@
 
     </header>
 
-    <div class="showFilter" style="display:none"  wire:ignore.self>
+
+    <div class="row" style="margin-top: 10px; margin-bottom:10px;">
+        <div class="col-md-4">
+            <div class="col-md ">
+                <div class="dt-buttons btn-group flex-wrap">
+                    <div class="btn-group">
+                        <button class="btn btn-secondary buttons-collection" wire:click="export()" style="color:black !important">ESPORTA</button>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="col-md-4">
+            <div class="row">
+                <div class="col-md-4" style="text-align:right">Visualizza</div>
+                <div class="col-md-4">
+                    <select name="tablesaw-350_length" aria-controls="tablesaw-350" class="form-select form-select-sm" id="dt-length-0" wire:model="pageLength">
+                        <option value="10">10</option>
+                        <option value="25">25</option>
+                        <option value="50">50</option>
+                        <option value="100">100</option>
+                        <option value="100000">Tutti</option>
+                    </select>
+                </div>
+                <div class="col-md-3">elementi</div>
+            </div>
+        </div>
+        <div class="col-md-4" style="text-align:right">
+            <a href="#" class="showHideFilter btn--ui" ><i class="fa-solid fa-sliders"></i></a><br>
+        </div>
+    </div>
+
+    <div class="showFilter" style="display:none; margin-top:10px;"  wire:ignore.self>
         <hr size="1">
         <div class="row g-3">
             <div class="col-md-2">
@@ -43,7 +74,7 @@
                         <b>Corso</b>
                     </div>
                     <div class="col-12" >
-                        <select class="form-select filterCourse" multiple="multiple">
+                        <select class="form-select filterCourse" multiple="multiple" wire:model="filterCourse">
                             @foreach($courses as $c)
                                 <option value="{{$c}}">{{$c}}
                             @endforeach
@@ -57,7 +88,7 @@
                         <b>Livello</b>
                     </div>
                     <div class="col-12">
-                        <select class="form-select filterLevel"  multiple="multiple">
+                        <select class="form-select filterLevel"  multiple="multiple" wire:model="filterLevel">
                             @foreach($course_levels as $c)
                                 <option value="{{$c->id}}">{{$c->name}}
                             @endforeach
@@ -71,7 +102,7 @@
                         <b>Frequenza</b>
                     </div>
                     <div class="col-12">
-                        <select class="form-select filterFrequency" multiple="multiple">
+                        <select class="form-select filterFrequency" multiple="multiple" wire:model="filterFrequency">
                             @foreach($course_frequencies as $c)
                                 <option value="{{$c->id}}">{{$c->name}}
                             @endforeach
@@ -85,7 +116,7 @@
                         <b>Tipologia</b>
                     </div>
                     <div class="col-12">
-                        <select class="form-select filterType"  multiple="multiple">
+                        <select class="form-select filterType"  multiple="multiple" wire:model="filterType">
                             @foreach($course_types as $c)
                                 <option value="{{$c->id}}">{{$c->name}}
                             @endforeach
@@ -99,7 +130,7 @@
                         <b>Durata</b>
                     </div>
                     <div class="col-12">
-                        <select class="form-select filterDuration"  multiple="multiple">
+                        <select class="form-select filterDuration"  multiple="multiple" wire:model="filterDuration">
                             @foreach($course_durations as $c)
                                 <option value="{{$c->id}}">{{$c->name}}
                             @endforeach
@@ -112,7 +143,7 @@
         <div class="row g-3" style="margin-top:20px;">
             <div class="col-md-12" style="text-align:right">
                 <button class="btn--ui_outline light" onclick="reset()">CANCELLA</button>
-                <button class="btn--ui" onclick="loadDataTable()">FILTRA</button>
+                <button class="btn--ui" wire:click="search()">FILTRA</button>
             </div>
         </div>
         <hr size="1">
@@ -124,7 +155,7 @@
         </div>
     </div>
 
-    <section id="resume-table" class="scrollTable">
+    <section id="resume-table" class="scrollTable" style="margin-top:10px;">
         <div class="compare--chart_wrapper d-none"></div>
 
 
@@ -132,23 +163,69 @@
                 <thead>
                     <tr>
                         <th scope="col" class="sticky-col-header first-zero"></th>
-                        <th scope="col" class="sticky-col-header first-col" style="background-color:#f6f8fa !important">Corso</th>
-                        <th scope="col" class="sticky-col-header second-col">Cognome</th>
-                        <th scope="col" class="sticky-col-header third-col">Nome</th>
-                        <th scope="col">Iscrizione</th>
-                        @foreach($months as $m)
-                            <th scope="col">&nbsp;&nbsp;&nbsp;&nbsp;{{$m}}</th>
+                        <th scope="col" class="sticky-col-header first-col" >Corso</th>
+                        <th scope="col" class="sticky-col-header second-col"><a wire:click="setSort(2)" style="cursor:pointer">Cognome</a></th>
+                        <th scope="col" class="sticky-col-header third-col"><a wire:click="setSort(3)" style="cursor:pointer">Nome</a></th>
+                        <th scope="col"><a wire:click="setSort(4)" style="cursor:pointer">Iscrizione</a></th>
+                        @foreach($months as $idx => $m)
+                            <th scope="col"><a wire:click="setSort({{$idx + 5}})" style="cursor:pointer">&nbsp;&nbsp;&nbsp;&nbsp;{{$m}}</a></th>
                         @endforeach
                     </tr>
                 </thead>
                 <tbody id="checkall-target">
 
+                    @foreach($records as $idx => $record)
+                        <tr>
+                            <td class="sticky-col-header first-zero">{{$record["column_18"]}}</td>
+                            <td class="sticky-col-header first-col">{{$record["column_19"]}}</td>
+                            <td class="sticky-col-header second-col">{{$record["column_0"]}}</td>
+                            <td class="sticky-col-header third-col">{{$record["column_1"]}}</td>
+                            <td>
+                                @php
+                                list($color, $value) = explode("§", $record["column_2"]);
+                                @endphp
+                                @if($color == 0)
+                                    <a style="width:100%;float:right; text-align:right; display:block;{{$color == 1 ? '' : 'cursor:pointer;'}}" class="{{$color == 1 ? 'green' : 'orange'}} sub_{{$record["column_16"]}}" onclick="setSubscription('{{$record["column_15"]}}', '{{$record["column_17"]}}', '{{$record["column_16"]}}')" style="cursor: pointer;"><small>{{$value}}</small></a>
+                                @else
+                                    <a style="width:100%;float:right; text-align:right; display:block;" class="{{$color == 1 ? 'green' : 'orange'}}"><small>{{$value}}</small></a>
+                                @endif
+                            </td>
+                            @for($ii=3; $ii<=14; $ii++)
+                                @php
+                                list($color, $value, $diff) = explode("§", $record["column_" . $ii]);
+                                @endphp
+                                <td>
+
+                                    @if ($color == 'orange')
+                                        <a style="{{$diff == 'X' ? 'background-color:#d9ad86' : ''}};width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="{{$color}} lnk_{{$record["column_16"]}}" id="lnk_{{$record["column_15"]}}_{{$ii - 2}}_{{$record["column_17"]}}" onclick="setPayMonth('{{$record["column_15"]}}', {{$ii - 2}}, '{{$record["column_17"]}}', '{{$record["column_16"]}}')" style="cursor: pointer;"><small>{{$value}}</small></a>
+                                    @else
+                                        @if ($color != 'wgrey')
+                                            <a style="width:100%;float:right; text-align:right; display:block;" class="{{$color}}"><small>{{$value}}</small></a>
+                                        @endif
+                                    @endif
+
+                                </td>
+                            @endfor
+
+                        </tr>
+                    @endforeach
 
                 </tbody>
                 <tfoot id="checkall-target">
                     <tr>
                         <th class="sticky-col-header first-zero"></th>
                         <th class="sticky-col-header first-col"></th>
+                        <th class="sticky-col-header second-col"></th>
+                        <th class="sticky-col-header third-col"></th>
+                        @foreach($totS as $yyy)
+                            @if (isset($yyy))
+                                <th style="padding-left:5px !important;padding-right:5px !important;">{!!$yyy!!}</th>
+                            @else
+                                <th style="padding-left:5px !important;padding-right:5px !important;">aa</th>
+                            @endif
+                        @endforeach
+
+                        <!--<th style="padding-left:5px !important;padding-right:5px !important;"></th>
                         <th style="padding-left:5px !important;padding-right:5px !important;"></th>
                         <th style="padding-left:5px !important;padding-right:5px !important;"></th>
                         <th style="padding-left:5px !important;padding-right:5px !important;"></th>
@@ -162,12 +239,41 @@
                         <th style="padding-left:5px !important;padding-right:5px !important;"></th>
                         <th style="padding-left:5px !important;padding-right:5px !important;"></th>
                         <th style="padding-left:5px !important;padding-right:5px !important;"></th>
-                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
-                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>-->
                     </tr>
                 </tfoot>
             </table>
 
+            <div class="row">
+                <div class="col-md-6">
+                    Vista da {{(($currentPage - 1) * $pageLength) + 1}} a {{$currentPage * $pageLength}} di {{$totalRecords}} elementi
+                </div>
+                <div class="col-md-6" style="text-align:right">
+                        <ul class="pagination" style="margin:0px !important;float:right">
+                            @if($pages < 10)
+                                @for($p=1; $p<=$pages;$p++)
+                                    <li class="page-item {{$p == $currentPage ? 'active' : ''}}"><a class="page-link" wire:click="setPage({{$p}})" href="#">{{$p}}</a></li>
+                                @endfor
+                            @else
+                                <li class="page-item {{1 == $currentPage ? 'active' : ''}}"><a class="page-link" wire:click="setPage(1)" href="#">1</a></li>
+                                @if($currentPage > 4)
+                                    <li class="page-item "><a class="page-link" href="#">...</a></li>
+                                @endif
+                                @for($p=2; $p<=$pages - 1;$p++)
+                                    @if($p > $currentPage - 3 && $p < $currentPage + 3)
+                                        <li class="page-item {{$p == $currentPage ? 'active' : ''}}"><a class="page-link" wire:click="setPage({{$p}})" href="#">{{$p}}</a></li>
+                                    @endif
+                                @endfor
+                                @if($currentPage < ($pages - 3))
+                                    <li class="page-item "><a class="page-link" href="#">...</a></li>
+                                @endif
+                                <li class="page-item {{$pages == $currentPage ? 'active' : ''}}"><a class="page-link" wire:click="setPage({{$pages}})" href="#">{{$pages}}</a></li>
+                            @endif
+                        </ul>
+
+                </div>
+            </div>
+
 
 
 
@@ -183,14 +289,20 @@
     <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
     <style>
 
+        @media (min-width: 992px) {
+            .sidebar--ui ~ div.col {
+                max-height: 100vh;
+            }
+        }
+
     .scrollTable {
 
             padding: 15px;
-            /*max-width: 800px !important;*/
-            /*overflow-x: auto;
+            max-width: 100% !important;
+            overflow-x: auto;
             overflow-y: auto;
-            white-space: nowrap;*/
-            /*border: 1px solid #ddd;*/
+            white-space: nowrap;
+            border: 1px solid #ddd;
         }
 
         ::-webkit-scrollbar-thumb {
@@ -263,7 +375,7 @@
         /* Important */
             position: sticky;
             z-index: 100;
-            top: 35px;
+            top: -17px;
         }
 
         table thead {
@@ -379,44 +491,44 @@
         $('.filterYear').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
         $('.filterYear').val('{{date("Y")-1}}-{{date("Y")}}').trigger("change");
         $('.filterCourse').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
-        /*$('.filterCourse').on('change', function (e) {
+        $('.filterCourse').on('change', function (e) {
             var data = $('.filterCourse').select2("val");
             if (data == null) data = [];
             @this.set('filterCourse', data);
             //@this.search();
-        });*/
+        });
 
         $('.filterLevel').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
-        /*$('.filterLevel').on('change', function (e) {
+        $('.filterLevel').on('change', function (e) {
             var data = $('.filterLevel').select2("val");
             if (data == null) data = [];
-            //@this.set('filterLevel', data);
+            @this.set('filterLevel', data);
             //@this.search();
-        });*/
+        });
 
         $('.filterFrequency').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
-        /*$('.filterFrequency').on('change', function (e) {
+        $('.filterFrequency').on('change', function (e) {
             var data = $('.filterFrequency').select2("val");
             if (data == null) data = [];
             @this.set('filterFrequency', data);
             //@this.search();
-        });*/
+        });
 
         $('.filterType').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
-        /*$('.filterType').on('change', function (e) {
+        $('.filterType').on('change', function (e) {
             var data = $('.filterType').select2("val");
             if (data == null) data = [];
             @this.set('filterType', data);
             //@this.search();
-        });*/
+        });
 
         $('.filterDuration').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
-        /*$('.filterDuration').on('change', function (e) {
+        $('.filterDuration').on('change', function (e) {
             var data = $('.filterDuration').select2("val");
             if (data == null) data = [];
             // @this.set('filterDuration', data);
             //@this.search();
-        });*/
+        });
 
         Livewire.on('load-data-table', () => {
             $('.filterYear').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
@@ -426,6 +538,10 @@
             $('.filterType').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
             $('.filterDuration').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
             loadDataTable();
+            setTimeout(() => {
+                setMaxWidth();
+                setMaxHeight();
+            }, 1);
         });
 
         Livewire.on('destroy-data-table', () => {
@@ -510,6 +626,7 @@
 
         function loadDataTable(){
 
+            /*
             if ( $.fn.DataTable.isDataTable('#tablesaw-350') ) {
                 $('#tablesaw-350').DataTable().destroy();
             }
@@ -531,6 +648,8 @@
 
             var filterType = $('.filterType').val();
             localStorage.setItem("filterTypeCourseList", filterType);
+            */
+            /*
 
             var output_table = $('#tablesaw-350').DataTable({
                 //scrollX: true,
@@ -897,16 +1016,7 @@
                                                 }
                                             }
                                         }
-                                    }/*,
-                                    {
-                                        extend: 'print',"action":newexportaction,
-                                        text: 'Stampa',
-                                        title: 'Pagamento corsi',
-                                        exportOptions: {
-                                            columns: ":not(':last')"
-                                        },
-                                        footer:false
-                                    }*/
+                                    }
                                 ],
                                 dropup: true
                             }
@@ -955,19 +1065,15 @@
 
                     }
 
-                }/*,
-                fixedColumns: {
-                    start: 1,
-                    end: 1
-                },
-                scrollX: true*/
+                }
             });
+
             $('#tablesaw-350 thead tr th').addClass('col');
             $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
             $('#tablesaw-350').on('draw.dt', function() {
                 $('[data-bs-toggle="popover"]').popover()
             });
-
+            */
             jQuery.fn.dataTable.Api.register( 'sum()', function ( ) {
                 return this.flatten().reduce( function ( a, b ) {
                     if ( typeof a === 'string') {
@@ -1074,21 +1180,19 @@
             $( window ).bind( "resize", setMaxWidth );
             $( window ).bind( "resize", setMaxHeight );
 
+        });
 
-            function setMaxWidth() {
+        function setMaxWidth() {
                  $("#resume-table").width( Math.round( $(window ).width() - size ) ) ;
-                 $(".justify-content-between").css({"width": Math.round( $(window ).width() - size) + "px;"}); //.width( Math.round( $(window ).width() - size ) ) ;
+                 //$(".justify-content-between").css({"width": Math.round( $(window ).width() - size) + "px;"}); //.width( Math.round( $(window ).width() - size ) ) ;
 
             }
             function setMaxHeight() {
                 console.log('height:' + $(window ).height() + 'px !important');
-                 $("div.row.h-100").attr('style', 'height:' + ($(window ).height() + 50) + 'px !important');
-                 $("#resume-table").height( Math.round( $(window ).height() - 150 ) ) ;
+                 //$("div.row.h-100").attr('style', 'height:' + ($(window ).height() + 50) + 'px !important');
+                 $("#resume-table").height( Math.round( $(window ).height() - 220 ) ) ;
             }
 
-
-        });
-
     </script>
 @endpush
 

+ 1094 - 0
resources/views/livewire/course_list_original.php

@@ -0,0 +1,1094 @@
+<div class="col card--ui" id="card--dashboard" style="padding-top: 0px !important;">
+
+    <header id="title--section" style="display:none !important"  class="d-flex align-items-center justify-content-between">
+        <div class="title--section_name d-flex align-items-center justify-content-between">
+            <i class="ico--ui title_section utenti me-2"></i>
+            <h2 class="primary">Pagamento corsi</h2>
+        </div>
+
+    </header>
+
+    <div class="showFilter" style="display:none"  wire:ignore.self>
+        <hr size="1">
+        <div class="row g-3">
+            <div class="col-md-2">
+                <div class="row">
+                    <div class="col-md-12" style="margin-bottom:10px;">
+                        <b>Anno</b>
+                    </div>
+                    <div class="col-12">
+                        <select class="form-select filterYear" >
+                            <option value="">--Seleziona--
+                            @foreach($course_years as $c)
+                                @php
+                                $selected = '';
+                                try
+                                {
+                                    list($f, $t) = explode("-", $c);
+                                    if ($f == date("Y"))
+                                        $selected = 'selected';
+                                } catch (Exception $e) {
+
+                                }
+                                @endphp
+                                <option value="{{$c}}" {{$selected}}>{{$c}}
+                            @endforeach
+                        </select>
+                    </div>
+                </div>
+            </div>
+            <div class="col-md-2">
+                <div class="row">
+                    <div class="col-md-12" style="margin-bottom:10px;">
+                        <b>Corso</b>
+                    </div>
+                    <div class="col-12" >
+                        <select class="form-select filterCourse" multiple="multiple">
+                            @foreach($courses as $c)
+                                <option value="{{$c}}">{{$c}}
+                            @endforeach
+                        </select>
+                    </div>
+                </div>
+            </div>
+            <div class="col-md-2">
+                <div class="row">
+                    <div class="col-md-12" style="margin-bottom:10px;">
+                        <b>Livello</b>
+                    </div>
+                    <div class="col-12">
+                        <select class="form-select filterLevel"  multiple="multiple">
+                            @foreach($course_levels as $c)
+                                <option value="{{$c->id}}">{{$c->name}}
+                            @endforeach
+                        </select>
+                    </div>
+                </div>
+            </div>
+            <div class="col-md-2">
+                <div class="row">
+                    <div class="col-md-12" style="margin-bottom:10px;">
+                        <b>Frequenza</b>
+                    </div>
+                    <div class="col-12">
+                        <select class="form-select filterFrequency" multiple="multiple">
+                            @foreach($course_frequencies as $c)
+                                <option value="{{$c->id}}">{{$c->name}}
+                            @endforeach
+                        </select>
+                    </div>
+                </div>
+            </div>
+            <div class="col-md-2">
+                <div class="row">
+                    <div class="col-md-12" style="margin-bottom:10px;">
+                        <b>Tipologia</b>
+                    </div>
+                    <div class="col-12">
+                        <select class="form-select filterType"  multiple="multiple">
+                            @foreach($course_types as $c)
+                                <option value="{{$c->id}}">{{$c->name}}
+                            @endforeach
+                        </select>
+                    </div>
+                </div>
+            </div>
+            <div class="col-md-2">
+                <div class="row">
+                    <div class="col-md-12" style="margin-bottom:10px;">
+                        <b>Durata</b>
+                    </div>
+                    <div class="col-12">
+                        <select class="form-select filterDuration"  multiple="multiple">
+                            @foreach($course_durations as $c)
+                                <option value="{{$c->id}}">{{$c->name}}
+                            @endforeach
+                        </select>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+        <div class="row g-3" style="margin-top:20px;">
+            <div class="col-md-12" style="text-align:right">
+                <button class="btn--ui_outline light" onclick="reset()">CANCELLA</button>
+                <button class="btn--ui" onclick="loadDataTable()">FILTRA</button>
+            </div>
+        </div>
+        <hr size="1">
+    </div>
+
+    <div class="row text-right">
+        <div class="col-md-12" style="text-align:right">
+            <button style="display:none; width:200px;" class="btn--ui btNewPayment" onclick="newPayment()">NUOVA ENTRATA</button>
+        </div>
+    </div>
+
+    <section id="resume-table" class="scrollTable">
+        <div class="compare--chart_wrapper d-none"></div>
+
+
+            <table class="table tablesaw tableHead tablesaw-stack pagamento--corsi display nowrap" id="tablesaw-350" width="100%">
+                <thead>
+                    <tr>
+                        <th scope="col" class="sticky-col-header first-zero"></th>
+                        <th scope="col" class="sticky-col-header first-col" style="background-color:#f6f8fa !important">Corso</th>
+                        <th scope="col" class="sticky-col-header second-col">Cognome</th>
+                        <th scope="col" class="sticky-col-header third-col">Nome</th>
+                        <th scope="col">Iscrizione</th>
+                        @foreach($months as $m)
+                            <th scope="col">&nbsp;&nbsp;&nbsp;&nbsp;{{$m}}</th>
+                        @endforeach
+                    </tr>
+                </thead>
+                <tbody id="checkall-target">
+
+
+                </tbody>
+                <tfoot id="checkall-target">
+                    <tr>
+                        <th class="sticky-col-header first-zero"></th>
+                        <th class="sticky-col-header first-col"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                        <th style="padding-left:5px !important;padding-right:5px !important;"></th>
+                    </tr>
+                </tfoot>
+            </table>
+
+
+
+
+    </section>
+
+</div>
+
+@push('scripts')
+
+@endpush
+
+@push('scripts')
+    <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
+    <style>
+
+    .scrollTable {
+
+            padding: 15px;
+            /*max-width: 800px !important;*/
+            /*overflow-x: auto;
+            overflow-y: auto;
+            white-space: nowrap;*/
+            /*border: 1px solid #ddd;*/
+        }
+
+        ::-webkit-scrollbar-thumb {
+            background: #e4e4e4;
+            border-radius: 10px;
+        }
+
+        .select2-container--default .select2-selection--single{
+            background-color: #E9F0F5;
+            border: 0.0625rem solid #DFE5EB;
+            font-size: 0.75rem;
+        }
+        .select2-selection
+        {
+            height: 38px !important;
+        }
+        .select2-selection__rendered
+        {
+            padding-top:3px;
+        }
+        .select2 {
+            width:100% !important;
+        }
+        tfoot #checkall-target > tr > th
+        {
+            padding-right:5px !important;
+        }
+        /*.container-fluid
+        {
+            display: table-row !important;
+        }
+        .row.row.header--gestionale
+        {
+            padding-left:20px !important;
+        }*/
+
+
+    </style>
+    <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
+    <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
+@endpush
+
+@push('scripts')
+    <link href="/css/datatables.css" rel="stylesheet" />
+    <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
+
+
+    <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
+    <style>
+
+        #tablesaw-350_wrapper > div.justify-content-between
+        {
+            background-color: white;
+            position: sticky;
+            z-index: 100000;
+            padding-top:10px;
+            top: -15px;
+            left: 0px;
+
+        }
+
+
+        /*.table-v-scroll > div, #checkall-target
+        {
+            overflow-x: auto !important;
+            overflow-y: hidden !important;
+        }*/
+
+        table.tableHead thead {
+        /* Important */
+            position: sticky;
+            z-index: 100;
+            top: 35px;
+        }
+
+        table thead {
+        /* Important */
+            position: sticky;
+            z-index: 100;
+            top: 0;
+        }
+        .select2-container--default .select2-selection--single{
+            background-color: #E9F0F5;
+            border: 0.0625rem solid #DFE5EB;
+            font-size: 0.75rem;
+        }
+        .select2-selection
+        {
+            height: 38px !important;
+        }
+        .select2-selection__rendered
+        {
+            padding-top:3px;
+        }
+        .select2 {
+            width:100% !important;
+        }
+        .select2-selection--multiple{
+            overflow: hidden !important;
+            height: auto !important;
+        }
+        .select2-container {
+            box-sizing: border-box;
+            display: inline-block;
+            margin: 0;
+            position: relative;
+            vertical-align: middle;
+        }
+        .select2-container .select2-selection--single {
+            box-sizing: border-box;
+            cursor: pointer;
+            display: block;
+            height: 38px;
+            user-select: none;
+            -webkit-user-select: none;
+        }
+        .select2-container .select2-selection--single .select2-selection__rendered {
+            display: block;
+            padding-left: 8px;
+            padding-right: 20px;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            white-space: nowrap;
+        }
+        .select2-selection__choice__display{
+            color:#000000 !important;
+        }
+        .sticky-col-header {
+            position: -webkit-sticky !important;
+            position: sticky !important;
+            background-color: '#f6f8fa' !important;
+        }
+        .sticky-col {
+            position: -webkit-sticky !important;
+            position: sticky !important;
+            background-color: white;
+        }
+        .first-zero {
+            width: 20px;
+            min-width: 20px;
+            max-width: 20px;
+            left: 0px;
+            z-index:99;
+        }
+        .first-col {
+            width: 100px;
+            min-width: 100px;
+            max-width: 100px;
+            left: 0px;
+            z-index:99;
+        }
+
+        .second-col {
+            width: 150px;
+            min-width: 150px;
+            max-width: 150px;
+            left: 100px;
+            z-index:99;
+        }
+        .third-col {
+            width: 150px;
+            min-width: 150px;
+            max-width: 150px;
+            left: 250px;
+            z-index:99;
+        }
+    </style>
+    <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
+    <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
+    <script src="/assets/js/datatables.js"></script>
+    <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
+@endpush
+
+@push('scripts')
+    <script>
+
+        var totals = '';
+
+        $(document).ready(function() {
+            loadDataTable();
+        } );
+
+        $('.filterYear').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+        $('.filterYear').val('{{date("Y")-1}}-{{date("Y")}}').trigger("change");
+        $('.filterCourse').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+        /*$('.filterCourse').on('change', function (e) {
+            var data = $('.filterCourse').select2("val");
+            if (data == null) data = [];
+            @this.set('filterCourse', data);
+            //@this.search();
+        });*/
+
+        $('.filterLevel').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+        /*$('.filterLevel').on('change', function (e) {
+            var data = $('.filterLevel').select2("val");
+            if (data == null) data = [];
+            //@this.set('filterLevel', data);
+            //@this.search();
+        });*/
+
+        $('.filterFrequency').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+        /*$('.filterFrequency').on('change', function (e) {
+            var data = $('.filterFrequency').select2("val");
+            if (data == null) data = [];
+            @this.set('filterFrequency', data);
+            //@this.search();
+        });*/
+
+        $('.filterType').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+        /*$('.filterType').on('change', function (e) {
+            var data = $('.filterType').select2("val");
+            if (data == null) data = [];
+            @this.set('filterType', data);
+            //@this.search();
+        });*/
+
+        $('.filterDuration').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+        /*$('.filterDuration').on('change', function (e) {
+            var data = $('.filterDuration').select2("val");
+            if (data == null) data = [];
+            // @this.set('filterDuration', data);
+            //@this.search();
+        });*/
+
+        Livewire.on('load-data-table', () => {
+            $('.filterYear').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+            $('.filterCourse').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+            $('.filterLevel').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+            $('.filterFrequency').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+            $('.filterType').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+            $('.filterDuration').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
+            loadDataTable();
+        });
+
+        Livewire.on('destroy-data-table', () => {
+            $('#tablesaw-350').DataTable().destroy();
+        });
+
+        function destroyDataTable()
+        {
+            $('#tablesaw-350').DataTable().destroy();
+        }
+
+        var isFilter = false;
+        $(document).ready(function() {
+            $(document).on("click",".showHideFilter",function() {
+                if (isFilter)
+                {
+                    isFilter = false;
+                    $(".showFilter").hide();
+                }
+                else
+                {
+                    isFilter = true;
+                    $(".showFilter").show();
+                }
+            });
+        } );
+
+        function searchAction()
+        {
+            //destroyDataTable();
+            //@this.search();
+        }
+
+        @if(isset($_GET["showFilters"]))
+            var filterYear = localStorage.getItem("filterYearCourseList");
+            if (filterYear)
+            {
+                $('.filterYear').val(filterYear).trigger('change');
+            }
+            var filterCourse = localStorage.getItem("filterCourseCourseList");
+            if (filterCourse)
+            {
+                $('.filterCourse').val(filterCourse).trigger('change');
+            }
+            var filterLevel = localStorage.getItem("filterLevelCourseList");
+            if (filterLevel)
+            {
+                $('.filterLevel').val(filterLevel).trigger('change');
+            }
+            var filterFrequency = localStorage.getItem("filterFrequencyCourseList");
+            if (filterFrequency)
+            {
+                $('.filterFrequency').val(filterFrequency).trigger('change');
+            }
+            var filterDuration = localStorage.getItem("filterDurationCourseList");
+            if (filterDuration)
+            {
+                $('.filterDuration').val(filterDuration).trigger('change');
+            }
+            var filterType = localStorage.getItem("filterTypeCourseList");
+            if (filterType)
+            {
+                $('.filterType').val(filterType).trigger('change');
+            }
+        @endif
+
+        function reset()
+        {
+            $('.filterYear').val(null).trigger("change");
+            $('.filterCourse').val(null).trigger("change");
+            $('.filterLevel').val(null).trigger("change");
+            $('.filterFrequency').val(null).trigger("change");
+            $('.filterDuration').val(null).trigger("change");
+            $('.filterType').val(null).trigger("change");
+
+            destroyDataTable();
+
+            //localStorage.clear();
+
+            loadDataTable();
+        }
+
+        function loadDataTable(){
+
+            if ( $.fn.DataTable.isDataTable('#tablesaw-350') ) {
+                $('#tablesaw-350').DataTable().destroy();
+            }
+
+            var filterYear = $('.filterYear').val();
+            localStorage.setItem("filterYearCourseList", filterYear);
+
+            var filterCourse = $('.filterCourse').val();
+            localStorage.setItem("filterCourseCourseList", filterCourse);
+
+            var filterLevel = $('.filterLevel').val();
+            localStorage.setItem("filterLevelCourseList", filterLevel);
+
+            var filterDuration = $('.filterDuration').val();
+            localStorage.setItem("filterDurationCourseList", filterDuration);
+
+            var filterFrequency = $('.filterFrequency').val();
+            localStorage.setItem("filterFrequencyCourseList", filterFrequency);
+
+            var filterType = $('.filterType').val();
+            localStorage.setItem("filterTypeCourseList", filterType);
+
+            var output_table = $('#tablesaw-350').DataTable({
+                //scrollX: true,
+                //scrollY: true,
+                //scrollCollapse: true,
+                scrollY: '400px',
+                serverSide: true,
+                ajax: {
+                    url : '/get_course_list?filterCourse=' + filterCourse + '&filterDuration=' + filterDuration + '&filterLevel=' + filterLevel + '&filterType=' + filterType + '&filterFrequency=' + filterFrequency + '&filterYear=' + filterYear,
+                    dataSrc: function (json){
+                        if(json.totals){
+                            totals = json.totals;
+                        }
+                        return json.data;
+                    }
+                },
+                thead: {
+                'th': {'background-color': 'blue'}
+                },
+                columns: [
+                    {
+                        data: 'column_18',
+                        "orderable": false,
+                        className: 'red',
+                        render: function (data, type, row, meta){
+                            return data;
+                        }
+                    },
+                    {
+                        data: 'column_19',
+                        className: 'red',
+                        className: 'sticky-col  first-col'
+                    },
+                    {
+                        data: 'column_0',
+                        className: 'red',
+                        className: 'sticky-col second-col',
+                        render: function (data, type, row){
+                            var ret = '<a href="/members?member_detail=' + row["column_17"] + '&from=course_list">' + data + '</a>';
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_1',
+                        className: 'sticky-col third-col',
+                        render: function (data, type, row){
+                            const x = data.split("§");
+                            var ret = '<a href="/members?member_detail=' + row["column_17"] + '&from=course_list">' + data + '</a>';
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_2',
+                        orderSequence: ['asc', 'desc'],
+                        className: 'ciccio',
+                        render: function (data, type, row){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 0)
+                            {
+                                var ret = '<a style="width:100%;float:right; text-align:right; display:block; ' + (x[0] == 1 ? '' : 'cursor:pointer;') + '" class="' + (x[0] == 1 ? 'green' : 'orange') + ' sub_' + row["column_16"] + '" onclick="setSubscription(' + row["column_15"] + ', ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + (x[0] == 1 ? 'green' : 'orange') + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_3',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_1_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 1, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_4',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_2_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 2, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_5',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_3_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 3, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_6',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_4_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 4, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_7',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_5_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 5, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_8',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_6_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 6, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_9',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_7_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 7, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_10',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_8_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 8, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_11',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_9_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 9, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_12',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_10_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 10, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_13',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_11_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 11, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    },
+                    {
+                        data: 'column_14',
+                        orderSequence: ['asc', 'desc'],
+                        render: function (data, type, row, meta){
+                            const x = data.split("§");
+                            var ret = '';
+                            if (x[0] == 'orange')
+                            {
+                                ret = '<a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="' + x[0] + ' lnk_' + row["column_16"] + '" id="lnk_' + row["column_15"] + '_12_' + row["column_17"] + '" onclick="setPayMonth(' + row["column_15"] + ', 12, ' + row["column_17"] + ', ' + row["column_16"] + ')" style="cursor: pointer;"><small>' + x[1] + '</small></a>';
+                            }
+                            else
+                            {
+                                if (x[0] != 'wgrey')
+                                    ret = '<a style="width:100%;float:right; text-align:right; display:block;" class="' + x[0] + '"><small>' + x[1] + '</small></a>';
+                            }
+                            return ret;
+                        }
+                    }
+                ],
+                layout: {
+                    topStart : null,
+                    topEnd : null,
+                    top1A: {
+                        buttons: [
+                            {
+                                extend: 'collection',
+                                text: 'ESPORTA',
+                                buttons: [
+                                    {
+                                        extend: 'excelHtml5',"action":newexportaction,
+                                        title: 'Pagamento corsi',
+                                        orientation: 'landscape',
+                                        exportOptions: {
+                                            columns: ":not(':last')"
+                                        },
+                                        footer:false,
+                                        customize: function(xlsx) {
+                                            var sheet = xlsx.xl.worksheets['sheet1.xml'];
+                                            const letters = ["E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q"];
+
+                                            for(y=0; y<letters.length; y++)
+                                            {
+                                                z = y + 4;
+                                                var c = output_table.column(z).data().toArray();
+                                                //console.log(c);
+                                                for (var i = 0; i < c.length; i++)
+                                                {
+                                                    var j = c[i].split("§");
+                                                    if (j[0] == '0' || j[0] == 'orange')
+                                                    {
+                                                        $('row:nth-child('+(i+3)+') [r^="' + letters[y] + '"]', sheet).attr('s', '10');
+                                                        //sheet.table.body[i+1][z].fillColor = 'orange';
+                                                    }
+                                                    if (j[0] == '1' || j[0] == 'green')
+                                                    {
+                                                        $('row:nth-child('+(i+3)+') [r^="' + letters[y] + '"]', sheet).attr('s', '40');
+                                                        //doc.content[1].table.body[i+1][z].fillColor = 'green';
+                                                    }
+                                                    if (j[0] == 'yellow')
+                                                    {
+                                                        $('row:nth-child('+(i+3)+') [r^="' + letters[y] + '"]', sheet).attr('s', '20');
+                                                        //doc.content[1].table.body[i+1][z].fillColor = 'blue';
+                                                    }
+                                                }
+                                            }
+                                        },
+
+
+                                    },
+                                    {
+                                        extend: 'pdfHtml5',"action":newexportaction,
+                                        title: 'Pagamento corsi',
+                                        orientation: 'landscape',
+                                        exportOptions: {
+                                            columns: ":not(':last')"
+                                        },
+                                        footer:false,
+                                        customize: function(doc) {
+                                            for(z=4; z<=16; z++)
+                                            {
+                                                var c = output_table.column(z).data().toArray();
+                                                for (var i = 0; i < c.length; i++)
+                                                {
+                                                    var j = c[i].split("§");
+                                                    if (j[0] == '0' || j[0] == 'orange')
+                                                    {
+                                                        doc.content[1].table.body[i+1][z].fillColor = 'orange';
+                                                    }
+                                                    if (j[0] == '1' || j[0] == 'green')
+                                                    {
+                                                        doc.content[1].table.body[i+1][z].fillColor = 'green';
+                                                    }
+                                                    if (j[0] == 'yellow')
+                                                    {
+                                                        doc.content[1].table.body[i+1][z].fillColor = 'blue';
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }/*,
+                                    {
+                                        extend: 'print',"action":newexportaction,
+                                        text: 'Stampa',
+                                        title: 'Pagamento corsi',
+                                        exportOptions: {
+                                            columns: ":not(':last')"
+                                        },
+                                        footer:false
+                                    }*/
+                                ],
+                                dropup: true
+                            }
+                        ]
+                    },
+                    top1B : {
+                        pageLength: {
+                            menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
+                        }
+                    },
+                    top1C :'search',
+                },
+                order: [[2, 'asc'], [3, 'asc']],
+                pagingType: 'numbers',
+                "language": {
+                    "url": "/assets/js/Italian.json"
+                },
+                "fnInitComplete": function (oSettings, json) {
+                    var html = '&nbsp;<a href="#" class="showHideFilter btn--ui"><i class="fa-solid fa-sliders"></i></a>';
+                    $(".dt-search").append(html);
+                },
+                "footerCallback": function (row, data, start, end, display) {
+                    let api = this.api();
+
+                    api.column(0).footer().innerHTML = '';
+                    api.column(1).footer().innerHTML = '';
+                    api.column(2).footer().innerHTML = '';
+                    api.column(3).footer().innerHTML = '';
+
+                    for(var i=4; i<=15; i++)
+                    {
+                        api.column(i).footer().innerHTML = '';
+                    }
+
+                    if (totals != '')
+                    {
+
+                        totals.split("_").forEach(function (item)
+                        {
+                            var x = item.split("§");
+                            if (x[1] != undefined)
+                                api.column(x[0]).footer().innerHTML = x[1];
+                            else
+                                api.column(x[0]).footer().innerHTML = '';
+                        });
+
+                    }
+
+                }/*,
+                fixedColumns: {
+                    start: 1,
+                    end: 1
+                },
+                scrollX: true*/
+            });
+            $('#tablesaw-350 thead tr th').addClass('col');
+            $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
+            $('#tablesaw-350').on('draw.dt', function() {
+                $('[data-bs-toggle="popover"]').popover()
+            });
+
+            jQuery.fn.dataTable.Api.register( 'sum()', function ( ) {
+                return this.flatten().reduce( function ( a, b ) {
+                    if ( typeof a === 'string') {
+                        start = a.indexOf("€");
+                        a = a.substr(start + 2).replace("</small></a>", "").replace(",",".") * 1;
+                    }
+                    if ( typeof b === 'string' && b.indexOf('green') > 0) {
+                        start = b.indexOf("€");
+                        b = b.substr(start + 2).replace("</small></a>", "").replace(",",".") * 1;
+                    }
+                    else
+                    {
+                        b = 0;
+                    }
+
+                    return a + b;
+                }, 0 );
+                } );
+
+        }
+
+        Livewire.on('setTotals', (tot) =>
+        {
+            totals = tot;
+            console.log(totals);
+        });
+
+        var subscription = false;
+        var months = [];
+        var selectedCourseId = 0;
+        var selectedMemberId = 0;
+        var selectedMemberCourseId = 0;
+        function setPayMonth(course_id, month, member_id, id)
+        {
+            if (selectedMemberId > 0 && selectedMemberId != member_id)
+            {
+                months = [];
+                subscription = false;
+            }
+            if (selectedMemberCourseId != id)
+            {
+                $(".sub_" + selectedMemberCourseId).addClass("orange").removeClass("blue").removeClass("selected");
+                $(".lnk_" + selectedMemberCourseId).addClass("orange").removeClass("blue").removeClass("selected");
+            }
+            selectedCourseId = course_id;
+            selectedMemberId = member_id;
+            selectedMemberCourseId = id;
+
+            if(!months.includes(month))
+            {
+                months.push(month);
+                $("#lnk_" + course_id + "_" + month + "_" + member_id).addClass("blue").addClass("selected").removeClass("orange");
+            }
+            else
+            {
+                months.splice(months.indexOf(months), 1);
+                $("#lnk_" + course_id + "_" + month + "_" + member_id).addClass("orange").removeClass("blue").removeClass("selected");
+            }
+            if (months.length > 0)
+            {
+                $(".btNewPayment").show();
+            }
+            else
+            {
+                $(".btNewPayment").hide();
+            }
+        }
+
+        function setSubscription(course_id, member_id, id)
+        {
+            if (selectedMemberCourseId != id)
+            {
+                $(".sub_" + selectedMemberCourseId).addClass("orange").removeClass("blue").removeClass("selected");
+                $(".lnk_" + selectedMemberCourseId).addClass("orange").removeClass("blue").removeClass("selected");
+                months = [];
+                subscription = false;
+            }
+            selectedCourseId = course_id;
+            selectedMemberId = member_id;
+            selectedMemberCourseId = id;
+            if (subscription)
+            {
+                $(".sub_" + selectedMemberCourseId).addClass("orange").removeClass("blue").removeClass("selected");
+                subscription = false;
+                $(".btNewPayment").hide();
+            }
+            else
+            {
+                $(".sub_" + selectedMemberCourseId).addClass("blue").addClass("selected").removeClass("orange");
+                subscription = true;
+                $(".btNewPayment").show();
+            }
+        }
+
+        function newPayment()
+        {
+            @this.newPayment(selectedCourseId, months.toString(), selectedMemberId, selectedMemberCourseId, subscription);
+        }
+
+        $( document ).ready( function(){
+
+            setMaxWidth();
+            setMaxHeight();
+            $( window ).bind( "resize", setMaxWidth );
+            $( window ).bind( "resize", setMaxHeight );
+
+
+            function setMaxWidth() {
+                 $("#resume-table").width( Math.round( $(window ).width() - size ) ) ;
+                 $(".justify-content-between").css({"width": Math.round( $(window ).width() - size) + "px;"}); //.width( Math.round( $(window ).width() - size ) ) ;
+
+            }
+            function setMaxHeight() {
+                console.log('height:' + $(window ).height() + 'px !important');
+                 $("div.row.h-100").attr('style', 'height:' + ($(window ).height() + 50) + 'px !important');
+                 $("#resume-table").height( Math.round( $(window ).height() - 150 ) ) ;
+            }
+
+
+        });
+
+    </script>
+@endpush
+

+ 1 - 0
resources/views/livewire/member.blade.php

@@ -2425,6 +2425,7 @@
                     },
                 ],
                 fixedHeader: false,
+                // Set initial order from saved state or default
                 thead: {
                     'th': {'background-color': 'blue'}
                 },

+ 19 - 18
routes/web.php

@@ -31,7 +31,8 @@ Route::get('/login', function () {
 
 Route::post('/login', function () {
 
-    if (Auth::attempt(array('email' => $_POST["email"], 'password' => $_POST["password"]))) {
+    if(Auth::attempt(array('email' => $_POST["email"], 'password' => $_POST["password"])))
+    {
         return Redirect::to('/dashboard');
     } else {
         return Redirect::to('/?error=1');
@@ -227,7 +228,7 @@ Route::get('/get_members', function () {
 
     if ($_GET["filterCertificateType"] != "null") {
         $types = \App\Models\MemberCertificate::where('type', $_GET["filterCertificateType"])->where('expire_date', '>', date("Y-m-d"))->pluck('member_id');
-        $x = $x->whereIn('id', $types->toArray());;
+        $x = $x->whereIn('id', $types->toArray());
         //$ids = array_merge($ids, $types->toArray());
     }
 
@@ -293,19 +294,16 @@ Route::get('/get_members', function () {
         }
 
         $allScadIds = array_unique($allScadIds);
-
         Log::info("Total members after filterScadenza: " . count($allScadIds));
-
         $x = $x->whereIn('id', $allScadIds);
     }
+
     if ($_GET["filterStatus"] != "null") {
         $status = explode(",", $_GET["filterStatus"]);
         $members = \App\Models\Member::all();
         foreach ($status as $s) {
             foreach ($members as $m) {
-
-                $state = $m->isActive();
-
+                $state = $m->getStatus();
                 if ($state["status"] == $s)
                     $ids[] = $m->id;
             }
@@ -366,7 +364,6 @@ Route::get('/get_members', function () {
     Log::info($latestCertificates);
 
     foreach ($x as $idx => $r) {
-
         // $status = $r->getStatus();
         // $status = $status["status"];
 
@@ -441,7 +438,7 @@ Route::get('/get_members', function () {
         );
     }
 
-    return json_encode(array("data" => $datas,  "recordsTotal" => $count, "recordsFiltered" => $count));
+    return json_encode(array("data" => $datas, "recordsTotal" => $count, "recordsFiltered" => $count));
 });
 
 Route::get('/get_record_in', function () {
@@ -454,8 +451,13 @@ Route::get('/get_record_in', function () {
         ->leftJoin('receipts', 'records.id', '=', 'receipts.record_id')
         ->where('records.type', 'IN');
 
-    //$y = \App\Models\Record::select('records_rows.amount', 'records.member_id', 'records.corrispettivo_fiscale', 'records.deleted', 'records.financial_movement', 'records_rows.causal_id', 'records.payment_method_id', \DB::raw('members.first_name as first_name'), \DB::raw('members.last_name as last_name')) // , \DB::raw('SUM(records.id) As total'))
-    $y = \App\Models\Record::select('records_rows.amount', 'records.member_id', 'records.corrispettivo_fiscale', 'records.deleted', 'records.financial_movement', 'records_rows.causal_id', DB::raw('members.first_name as first_name'), DB::raw('members.last_name as last_name')) // , \DB::raw('SUM(records.id) As total'))
+        $x = \App\Models\Record::select('records.*', DB::raw('members.first_name as first_name'), DB::raw('members.last_name as last_name'), DB::raw('payment_methods.name as payment'), DB::raw('receipts.created_at as receipt_date')) // , \DB::raw('SUM(records.id) As total'))
+                ->leftJoin('members', 'records.member_id', '=', 'members.id')
+                ->leftJoin('payment_methods', 'records.payment_method_id', '=', 'payment_methods.id')
+                ->leftJoin('receipts', 'records.id', '=', 'receipts.record_id')
+                ->where('records.type', 'IN');
+
+        $y = \App\Models\Record::select('records_rows.amount', 'records.member_id', 'records.corrispettivo_fiscale', 'records.deleted', 'records.financial_movement', 'records_rows.causal_id', DB::raw('members.first_name as first_name'), DB::raw('members.last_name as last_name')) // , \DB::raw('SUM(records.id) As total'))
         ->leftJoin('members', 'records.member_id', '=', 'members.id')
         ->leftJoin('records_rows', 'records.id', '=', 'records_rows.record_id')
         //->leftJoin('receipts', 'records.id', '=', 'receipts.record_id')
@@ -564,8 +566,8 @@ Route::get('/get_record_in', function () {
         if ($borsellino)
             $excludeCausals[] = $borsellino->id;*/
 
-    // Aggiungo
-    /*
+        // Aggiungo
+        /*
         $excludes = \App\Models\Causal::where('no_records', true)->get();
         foreach($excludes as $e)
         {
@@ -1283,12 +1285,14 @@ Route::get('/get_course_members', function () {
             }
         }
 
+        // Remove duplicates
         $allScadIds = array_unique($allScadIds);
-
         Log::info("Course members - Total members after filterCertificateScadenza: " . count($allScadIds));
 
+        // Apply filter using the collected IDs
         $datas = $datas->whereIn('member_id', $allScadIds);
     }
+
     if ($_GET["fromYear"] != "") {
         $m_ids = \App\Models\Member::where('birth_date', '<', date("Y-m-d", strtotime("-" . $_GET["fromYear"] . " year", time())))->pluck('id');
         $datas = $datas->whereIn('member_id', $m_ids);
@@ -1388,9 +1392,7 @@ Route::get('/get_course_members', function () {
             $certificateInfo = $status . "|" . date("d/m/Y", strtotime($certificate->expire_date)) . "|" . $certificate->type;
         }
 
-
         $ret[] = array(
-
             "column_0" => $idx + 1,
             "column_8" => $r->course_name,
             "column_1" => $r->last_name,
@@ -1399,7 +1401,6 @@ Route::get('/get_course_members', function () {
             "column_4" => date("Y", strtotime($r->birth_date)),
             "column_5" => $r->phone,
             "column_6" => $certificateInfo,
-            "column_6" => $certificateInfo,
             "column_7" => $r->member_id
         );
     }
@@ -1498,7 +1499,7 @@ function getColor($months, $m)
     return $class;
 }
 
-Route::get('/migrate', function () {
+Route::get('/migrate', function(){
     Artisan::call('migrate');
     dd('migrated!');
 });