Luca Parisio 9 ヶ月 前
コミット
82df8c1d9c

+ 74 - 23
app/Http/Livewire/Course.php

@@ -172,29 +172,80 @@ class Course extends Component
     {
         $this->validate();
         try {
-            \App\Models\Course::create([
-                'name' => $this->name,
-                'parent_id' => $this->parent_id,
-                'course_type_id' => $this->course_type_id,
-                'course_duration_id' => $this->course_duration_id,
-                'course_frequency_id' => $this->course_frequency_id,
-                'course_level_id' => $this->course_level_id,
-                'date_from' => $this->date_from,
-                'date_to' => $this->date_to,
-                'category_id' => $this->category_id,
-                'causal_id' => $this->causal_id,
-                'sub_causal_id' => $this->sub_causal_id,
-                'max_members' => $this->max_members,
-                'instructor_id' => $this->instructor_id,
-                'year' => $this->year,
-                'price' => currencyToDouble($this->price),
-                'subscription_price' => currencyToDouble($this->subscription_price),
-                'months' => json_encode($this->months),
-                'type' => $this->type,
-                'when' => json_encode($this->when),
-                'prices' => json_encode($this->prices),
-                'enabled' => $this->enabled
-            ]);
+            $course = new \App\Models\Course();
+
+            $course->name = $this->name;
+            $course->parent_id = $this->parent_id;
+            $course->course_type_id = $this->course_type_id;
+            $course->course_duration_id = $this->course_duration_id;
+            $course->course_frequency_id = $this->course_frequency_id;
+            $course->course_level_id = $this->course_level_id;
+            $course->date_from = $this->date_from;
+            $course->date_to = $this->date_to;
+            $course->category_id = $this->category_id;
+            //$course->causal_id = $this->causal_id;
+            //$course->sub_causal_id = $this->sub_causal_id;
+            $course->max_members = $this->max_members;
+            $course->instructor_id = $this->instructor_id;
+            $course->year = $this->year;
+            $course->price = currencyToDouble($this->price);
+            $course->subscription_price = currencyToDouble($this->subscription_price);
+            $course->months = json_encode($this->months);
+            $course->type = $this->type;
+            $course->when = json_encode($this->when);
+            $course->prices = json_encode($this->prices);
+            $course->enabled = $this->enabled;
+            $course->save();
+
+            $lev = '';
+            if ($this->course_level_id > 0)
+                $lev = \App\Models\CourseLevel::findOrFail($this->course_level_id)->name;
+
+            $freq = '';
+            if ($this->course_frequency_id > 0)
+                $freq = \App\Models\CourseLevel::findOrFail($this->course_frequency_id)->name;
+
+            // Creo le causali di pagamento
+            $causal = "Pagamento rata " . $this->name . " - " . $lev . " - " . $freq . " - " . $this->year;
+            $cp = \App\Models\Causal::where('name', $causal)->first();
+            if (!$cp)
+            {
+                $cp = new \App\Models\Causal();
+                $cp->name = $causal;
+                $cp->type = "IN";
+                $cp->parent_id = null;
+                $cp->money = false;
+                $cp->corrispettivo_fiscale = false;
+                $cp->no_receipt = false;
+                $cp->user_status = false;
+                $cp->no_first = false;
+                $cp->no_records = false;
+                $cp->enabled = true;
+                $cp->save();
+            }
+            $course->causal_id = $cp->id;
+
+            $causal = "Pagamento iscrizione " . $this->name . " - " . $lev . " - " . $freq . " - " . $this->year;
+            $ci = \App\Models\Causal::where('name', $causal)->first();
+            if (!$ci)
+            {
+                $ci = new \App\Models\Causal();
+                $ci->name = $causal;
+                $ci->type = "IN";
+                $ci->parent_id = null;
+                $ci->money = false;
+                $ci->corrispettivo_fiscale = false;
+                $ci->no_receipt = false;
+                $ci->user_status = false;
+                $ci->no_first = false;
+                $ci->no_records = false;
+                $ci->enabled = true;
+                $ci->save();
+            }
+            $course->sub_causal_id = $ci->id;
+
+            $course->save();
+            
             session()->flash('success','Corso creato');
             $this->resetFields();
             $this->add = false;

+ 38 - 13
app/Http/Livewire/Member.php

@@ -277,12 +277,10 @@ class Member extends Component
         $this->image_old = '';
     }
 
-    /*
     public function updatedCourseName()
     {
         $this->course_course_id = null;
         $this->course_level_id = '';
-        $this->course_type_id = '';
         $this->course_frequency_id = '';
         $levels_ids = [];
         if ($this->course_name != '') {
@@ -294,28 +292,26 @@ class Member extends Component
             }
         }
         $this->course_levels = \App\Models\CourseLevel::select('*')->where('enabled', true)->whereIn('id', $levels_ids)->get();
-        $this->course_types = [];
         $this->course_frequencies = [];
     }
 
     public function updatedCourseLevelId()
     {
         $this->course_course_id = null;
-        $this->course_type_id = '';
         $this->course_frequency_id = '';
-        $types_ids = [];
+        $frequencies_ids = [];
         if ($this->course_level_id != '') {
             list($n, $y) = explode("(", $this->course_name);
             $y = trim(str_replace(")", "", $y));
             $all = \App\Models\Course::where('name', 'like', '%' . trim($n) . "%")->where('year', $y)->where('enabled', true)->where('course_level_id', $this->course_level_id)->get();
             foreach ($all as $a) {
-                $types_ids[] = $a->course_type_id;
+                $frequencies_ids[] = $a->course_frequency_id;
             }
         }
-        $this->course_types = \App\Models\CourseType::select('*')->where('enabled', true)->whereIn('id', $types_ids)->get();
-        $this->course_frequencies = [];
+        $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->whereIn('id', $frequencies_ids)->get();
     }
 
+    /*
     public function updatedCourseTypeId()
     {
         $this->course_course_id = null;
@@ -330,7 +326,7 @@ class Member extends Component
             }
         }
         $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->whereIn('id', $frequencies_ids)->get();
-    }
+    }*/
 
     public function updatedCourseFrequencyId()
     {
@@ -338,7 +334,34 @@ class Member extends Component
         if ($this->course_frequency_id != '') {
             list($n, $y) = explode("(", $this->course_name);
             $y = trim(str_replace(")", "", $y));
-            $this->course_course_id = \App\Models\Course::where('name', 'like', '%' . trim($n) . "%")->where('year', $y)->where('course_level_id', $this->course_level_id)->where('course_type_id', $this->course_type_id)->where('course_frequency_id', $this->course_frequency_id)->first()->id;
+            $this->course_course_id = \App\Models\Course::where('name', 'like', '%' . trim($n) . "%")->where('year', $y)->where('course_level_id', $this->course_level_id)->where('course_frequency_id', $this->course_frequency_id)->first()->id;
+
+            $c = \App\Models\Course::findOrFail($this->course_course_id);
+            $this->course_price = formatPrice($c->price);
+            $this->course_subscription_price = formatPrice($c->subscription_price);
+            $this->course_date_from = $c->date_from;
+            $this->course_date_to = $c->date_to;
+            // Controllo se sono già iscritto la corso
+            $this->course_exist = \App\Models\MemberCourse::where('course_id', $this->course_course_id)->where('member_id', $this->dataId)->count() > 0;
+
+            // Carico gli abbonamenti e i mesi
+            $period = \Carbon\CarbonPeriod::create($c->date_from, '1 month', $c->date_to);
+            $this->course_months_list = [];
+            foreach ($period as $dt) 
+            {
+                $this->course_months_list[] = $dt->format("m");
+            }
+            
+            $this->course_price_list = [];
+            if ($c->prices != null)
+            {
+                foreach(json_decode($c->prices) as $z)
+                {
+                    $this->course_price_list[$z->course_subscription_id] = $z->price;
+                }
+            }
+
+            /*
 
             if ($this->course_course_id > 0) {
                 $c = \App\Models\Course::findOrFail($this->course_course_id);
@@ -350,16 +373,18 @@ class Member extends Component
                 $this->course_price = 0;
                 $this->course_subscription_price = 0;
                 $this->course_exist = false;
-            }
+            }*/
         } else {
             $this->course_price = 0;
             $this->course_subscription_price = 0;
             $this->course_exist = false;
         }
-    }*/
+    }
 
     public function updatedCourseCourseType()
     {
+        $this->course_level_id = '';
+        $this->course_frequency_id = '';
         $this->course_course_id = null;
     }
 
@@ -629,7 +654,7 @@ class Member extends Component
     {
 
         $this->course_names = [];
-        $allC = \App\Models\Course::orderBy('name')->get();
+        $allC = \App\Models\Course::where('type', $this->course_course_type)->orderBy('name')->get();
         foreach ($allC as $c) {
             $cN = $c->name . " (" . $c->year . ")";
             if (!in_array($cN, $this->course_names))

+ 11 - 0
app/Http/Livewire/Rate.php

@@ -86,4 +86,15 @@ class Rate extends Component
         $this->hasFilter = false;
     }
 
+    public function delete($id)
+    {
+        try{
+            \App\Models\Rate::find($id)->delete();
+            //$this->emit('load-data-table');
+            session()->flash('success',"Rata eliminata");
+        }catch(\Exception $e){
+            session()->flash('error','Errore (' . $ex->getMessage() . ')');
+        }
+    }
+
 }

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

@@ -378,7 +378,7 @@ class RecordIN extends Component
             {
                 $this->rateId = $_GET["rateId"];
             }
-            if (isset($_GET["months"]))
+            if (isset($_GET["months"]) && $_GET["months"] != '')
             {
 
                 $price = $_GET["price"] / 100 * 100;

+ 15 - 0
app/Models/MemberCourse.php

@@ -40,4 +40,19 @@ class MemberCourse extends Model
     {
         return $this->belongsTo(CourseSubscription::class);
     }
+
+    public function getStatus()
+    {
+        $status = 0;
+        $rates = \App\Models\Rate::where('member_course_id', $this->id)->orderBy('date')->get();
+        foreach($rates as $rate)
+        {
+            if ($rate->date > date("Y-m-d"))
+            {
+                break;
+            }
+            $status = $rate->status;
+        }
+        return $status;
+    }
 }

+ 1 - 1
app/Models/Rate.php

@@ -29,7 +29,7 @@ class Rate extends Model
 
     public function member_course()
     {
-        return $this->belongsTo(MemberCourse::class, 'course_type_id');
+        return $this->belongsTo(MemberCourse::class, 'member_course_id');
     }
 
     public function course_subscription()

+ 51 - 39
resources/views/livewire/member.blade.php

@@ -1142,7 +1142,7 @@
                                                                 <b>{{$member_course->course->name}}</b><br>
                                                             </td>
                                                             <td style="width:10%">
-                                                                {{$member_course->course->type->name ?? ""}}<br>
+                                                                {{$member_course->course->frequency->name ?? ""}}<br>
                                                             </td>
                                                             <td style="width:10%">
                                                                 {{$member_course->course->level->name ?? ""}}<br>
@@ -1163,16 +1163,29 @@
                                                                     h {{$x->from}} - {{$x->to}}
                                                                 @endforeach
                                                             </td>
-                                                            <td style="width:25%">
-                                                                {{date("d/m/Y", strtotime($member_course->date_from))}} - {{date("d/m/Y", strtotime($member_course->date_to))}}                                                                
+                                                            <td style="width:15%">
+                                                                {{date("d/m/Y", strtotime($member_course->date_from))}} <br> {{date("d/m/Y", strtotime($member_course->date_to))}}                                                                
                                                             </td>
-                                                            @if(false)
-                                                                <td style="width:10%">Iscrizione:<br><b>{{$member_course->status == 1 ? 'Pagata' : ($member_course->status == 2 ? 'Da pagare' : 'Sospesa')}}</b></td>
-                                                            @endif
-                                                            <td style="text-align:right;width:15%">
-                                                                <button type="button" class="btn" wire:click="showHideCourse({{ $member_course->id }})"><i class="fa-solid fa-chevron-down"></i></button>&nbsp;
+                                                            <td style="text-align:right;width:10%">
+                                                                <div class="row">
+                                                                    <div class="col-6">
+                                                                        <button style="float:left;" type="button" class="btn" wire:click="editCourse({{ $member_course->id }})" data-bs-toggle="popover"  data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>
+                                                                    </div>
+                                                                    <div class="col-6">
+                                                                        <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCourse({{ $member_course->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Elimina"><i class="fa-regular fa-trash-can"></i></button>
+                                                                    </div>
+                                                                </div>
                                                             </td>
-
+                                                            <td style="text-align:right;width:5%">
+                                                                @php
+                                                                $status = $member_course->getStatus();
+                                                                @endphp
+                                                                <a href="/rates?member_id={{$member_course->member_id}}&member_course_id={{$member_course->id}}"><span class="badge tessera-badge {{$status == 0 ? 'due' : ($status == 1 ? 'active' : 'suspended')}}">{{$status == 0 ? 'Da pagare' : ($status == 1 ? 'Pagato' : 'Sospeso')}}</span></a>
+                                                                @if($member_course->notes != '')
+                                                                    <button type="button" class="btn" wire:click="showHideCourse({{ $member_course->id }})"><i class="fa-solid fa-chevron-down"></i></button>&nbsp;
+                                                                @endif
+                                                            </td>
+                                                            
                                                         </tr>
                                                         @if(in_array($member_course->id, $showCourse))
                                                             @if(false)
@@ -1199,7 +1212,7 @@
                                                                 </tr>
                                                             @endif
                                                             <tr >
-                                                                <td  colspan="5">
+                                                                <td  colspan="7">
                                                                     @if($selectedCourseMember == $member_course->id)
                                                                         @if(sizeof($payMonths) > 0 || $createSubscription)
                                                                             <button class="btn--ui primary" style="color:white" wire:click="newPayment({{$member_course}})">Nuova entrata</button>&nbsp;
@@ -1214,10 +1227,6 @@
                                                                         {{$member_course->notes}}
                                                                     @endif
                                                                 </td>
-                                                                <td>
-                                                                    <button type="button" class="btn" wire:click="editCourse({{ $member_course->id }})" data-bs-toggle="popover"  data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>&nbsp;
-                                                                    <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCourse({{ $member_course->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Elimina"><i class="fa-regular fa-trash-can"></i></button>
-                                                                </td>
                                                             </tr>
                                                         
                                                         @endif
@@ -1232,21 +1241,34 @@
                                             <div class="form--wrapper">
                                                 <form class="form--utente">
                                                     <div class="row ">
-                                                        <div class="col-6 mt-2">
+                                                        <div class="col-12 mt-2">
                                                             <label for="course_name" class="form-label">Tipo corso</label><br>
                                                             <input type="radio" name="chkType" value="standard" wire:model="course_course_type">&nbsp;Standard
                                                             &nbsp;&nbsp;&nbsp;
                                                             <input type="radio" name="chkType" value="custom" wire:model="course_course_type">&nbsp;Personalizzato
                                                         </div>
-                                                        <div class="col-md-6">
-                                                            <label for="course_name" class="form-label">Corso</label>
+                                                        <div class="row">
 
-                                                            <select id="course_course_id" class="form-select @error('course_course_id') is-invalid @enderror" aria-label="Corso" wire:model="course_course_id" >
-                                                                <option value="">
-                                                                @foreach($courses as $c)
-                                                                    <option value="{{$c->id}}">{{$c->name}}
-                                                                @endforeach
-                                                            </select>
+                                                            <div class="col-md-4">
+                                                                <label for="course_name" class="form-label">Corso</label>
+                                                                <select id="course_name" class="form-select" aria-label="Livello" wire:model="course_name" >
+                                                                    <option value="">
+                                                                    @foreach($course_names as $cn)
+                                                                        <option value="{{$cn}}">{{$cn}}
+                                                                    @endforeach
+                                                                </select>
+                                                            </div>
+
+                                                            @if(false)
+                                                                <label for="course_name" class="form-label">Corso</label>
+
+                                                                <select id="course_course_id" class="form-select @error('course_course_id') is-invalid @enderror" aria-label="Corso" wire:model="course_course_id" >
+                                                                    <option value="">
+                                                                    @foreach($courses as $c)
+                                                                        <option value="{{$c->id}}">{{$c->name}}
+                                                                    @endforeach
+                                                                </select>
+                                                            @endif
 
                                                             @error('course_course_id')
                                                                 <div class="invalid-feedback">Devi selezionare un corso</div>
@@ -1255,10 +1277,9 @@
                                                             @if($course_exist)
                                                                 <small style="color:red">Attenzione : il corso selezionato è già associato all'utente</small>
                                                             @endif
-                                                        </div>
-                                                        @if(false)
+
                                                             @if($course_name != '')
-                                                                <div class="col-md-3">
+                                                                <div class="col-md-4">
                                                                     <label for="course_level_id" class="form-label">Livello</label>
                                                                     <select id="course_level_id" class="form-select" aria-label="Livello" wire:model="course_level_id" >
                                                                         <option value="">
@@ -1269,18 +1290,7 @@
                                                                 </div>
                                                             @endif
                                                             @if($course_level_id != '')
-                                                                <div class="col-md-3">
-                                                                    <label for="course_type_id" class="form-label">Tipologia</label>
-                                                                    <select id="course_type_id" class="form-select" aria-label="Tipologia" wire:model="course_type_id" >
-                                                                        <option value="">
-                                                                        @foreach($course_types as $t)
-                                                                            <option value="{{$t->id}}">{{$t->name}}
-                                                                        @endforeach
-                                                                    </select>
-                                                                </div>
-                                                            @endif
-                                                            @if($course_type_id != '')
-                                                                <div class="col-md-3">
+                                                                <div class="col-md-4">
                                                                     <label for="course_frequency_id" class="form-label">Frequenza</label>
                                                                     <select id="course_frequency_id" class="form-select" aria-label="Tipologia" wire:model="course_frequency_id" >
                                                                         <option value="">
@@ -1290,7 +1300,9 @@
                                                                     </select>
                                                                 </div>
                                                             @endif
-                                                        @endif
+                                                            
+                                                        </div>
+                                                        
                                                     </div>
                                                     @if($course_course_id > 0)
                                                         <div class="row mt-4">

+ 32 - 160
resources/views/livewire/rate.blade.php

@@ -129,9 +129,12 @@
                                     data-bs-content="Visualizza ricevuta"><i class="fa-regular fa-eye"></i></button>
                             @endif
                             @if($record->status == 0)
-                                <a target="_blank" class="btn  u" href="/in?new=1&memberId={{$record->member_id}}&causalId=&subCausalId=&createSubscription=&months={{implode("|", json_decode($record->months))}}&price={{$record->price}}&subscription_price=&courseId={{$record->member_course_id}}&rateId={{$record->id}}" data-bs-toggle="popover"
+                                <a class="btn  u" href="/in?new=1&memberId={{$record->member_id}}&causalId={{!$record->is_subscription ? $record->member_course->course->causal_id : ''}}&subCausalId={{$record->is_subscription ? $record->member_course->course->sub_causal_id : ''}}&createSubscription={{$record->is_subscription ? '1' : ''}}&months={{implode("|", json_decode($record->months))}}&price={{!$record->is_subscription ? $record->price : ''}}&subscription_price={{$record->is_subscription ? $record->price : ''}}&courseId={{$record->member_course_id}}&rateId={{$record->id}}" data-bs-toggle="popover"
                                 data-bs-trigger="hover focus" data-bs-placement="bottom"
                                 data-bs-content="Crea entrata"><i class="fa-regular fa-file-lines"></i></a>
+                                <a class="btn u" onclick="confirmDelete({{$record->id}})" data-bs-toggle="popover"
+                                    data-bs-trigger="hover focus" data-bs-placement="bottom"
+                                    data-bs-content="Elimina"><i class="fa-regular fa-trash-can"></i></button>
                             @endif
                         </td>
                     </tr>
@@ -244,160 +247,33 @@
 @push('scripts')
     <script>
 
-        /*
-        $(document).ready(function () {
-            loadDataTable();
-        });
-
-        $('.filterStatus').select2({ "language": { "noResults": function () { return "Nessun risultato"; } } });
-        $('.filterMember').select2({
-            "language": { "noResults": function () { return "Nessun risultato"; } }
-        });
-
-
-        Livewire.on('load-data-table', () => {
-            $('.filterStatus').select2({ "language": { "noResults": function () { return "Nessun risultato"; } } });
-            $('.filterMember').select2({ "language": { "noResults": function () { return "Nessun risultato"; } } });
+        function confirmDelete(id)
+        {
+            if (confirm('Confermi di voler eliminare la rata?'))
+            {
+                @this.delete(id);
+            }
+        }
 
+        $(document).ready(function() {
             loadDataTable();
-        });
+        } );
 
         Livewire.on('load-data-table', () => {
-            setTimeout(function () { loadDataTable() }, 100);
-        });
-
-        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();
-                }
-            });
+            loadDataTable();
         });
 
-        function sendMail(id) {
-            $.get("/receipt/mail/" + id, function (data, status) {
-                alert('Mail inviata');
-            });
-        }
-
-        @if(isset($_GET["showFilters"]))
-            var filterStatus = localStorage.getItem("filterStatusReceipt");
-            if (filterStatus) {
-                $('.filterStatus').val(filterStatus).trigger('change');
-            }
-            var filterFrom = localStorage.getItem("filterFromReceipt");
-            if (filterFrom) {
-                $('input[name="txtFrom"]').val(filterFrom);
-            }
-            var filterTo = localStorage.getItem("filterToReceipt");
-            if (filterTo) {
-                $('input[name="txtTo"]').val(filterFrom);
-            }
-            var filterMember = localStorage.getItem("filterMemberReceipt");
-            if (filterMember) {
-                $('.filterMember').val(filterMember).trigger('change');
-            }
-        @endif
-
-            function reset() {
-                $(".todayButton").addClass("lightGrey");
-                $(".yesterdayButton").addClass("lightGrey");
-                $('.filterStatus').val(null).trigger("change");
-                $('.filterMember').val(null).trigger("change");
-                $('.filterFrom').val('');
-                $('.filterTo').val('');
-                destroyDataTable();
-                loadDataTable();
-            }
-
-        function loadDataTable() {
-
-            if ($.fn.DataTable.isDataTable('#tablesaw-350')) {
+        function loadDataTable(){
+            if ( $.fn.DataTable.isDataTable('#tablesaw-350') ) {
                 $('#tablesaw-350').DataTable().destroy();
             }
-
-            var filterStatus = $('.filterStatus').val();
-            localStorage.setItem("filterStatusReceipt", filterStatus);
-
-            var filterFrom = $('.filterFrom').val();
-            localStorage.setItem("filterFromReceipt", filterFrom);
-
-            var filterTo = $('.filterTo').val();
-            localStorage.setItem("filterToReeipt", filterTo);
-
-            var filterMember = $('.filterMember').val();
-            localStorage.setItem("filterMemberReceipt", filterMember);
-
             $('#tablesaw-350').DataTable({
-                serverSide: true,
-                ajax: {
-                    url: '/get_receipts?filterStatus=' + filterStatus + '&filterFrom=' + filterFrom + '&filterTo=' + filterTo + '&filterMember=' + filterMember,
-                    dataSrc: function (json) {
-                        if (json.totals) {
-                            totals = json.totals;
-                        }
-                        return json.data;
-                    }
-                },
                 thead: {
-                    'th': { 'background-color': 'blue' }
+                'th': {'background-color': 'blue'}
                 },
-                columns: [
-                    {
-                        data: 'year'
-                    },
-                    {
-                        data: 'number'
-                    },
-                    {
-                        data: 'last_name'
-                    },
-                    {
-                        data: 'first_name'
-                    },
-                    {
-                        data: "status",
-                        render: function (data) {
-                            // Split class and text
-                            var ret = '<span class="tablesaw-cell-content"><span class="badge tessera-badge ' + (data == 1 ? 'active' : 'suspended') + '">' + (data == 1 ? 'Attiva' : 'Annullata') + '</span></span>';
-                            return ret;
-                        }
-                    },
-                    {
-                        data: 'date'
-                    },
-                    {
-                        data: 'totals'
-                    },
-                    {
-                        data: "action",
-                        render: function (data) {
-                            var ids = data.split("|");
-                            // Split class and text
-                            var ret = '<button type="button" class="btn u" onclick="document.location.href=' + "'" + '/in?id=' + ids[1] + "&from=receipts'" + '" data-bs-toggle="popover"  data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Visualizza ricevuta"><i class="fa-regular fa-eye"></i></button>';
-                            ret += '<a target="_blank" class="btn  u" href="/receipt/' + ids[0] + '" data-bs-toggle="popover"  data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Stampa ricevuta"><i class="fa-regular fa-file-lines"></i></a>';
-                            ret += '<a target="_blank" class="btn u" onclick="sendMail(' + ids[0] + ')"><i class="fa-regular fa-envelope" data-bs-toggle="popover"  data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Invia email"></i></a>';
-                            return ret;
-                        }
-                    }
-                ],
                 layout: {
-                    topStart: null,
-                    topEnd: null,
+                    topStart : null,
+                    topEnd : null,
                     top1A: {
                         buttons: [
                             {
@@ -405,23 +281,23 @@
                                 text: 'ESPORTA',
                                 buttons: [
                                     {
-                                        extend: 'excelHtml5', "action": newexportaction,
-                                        title: 'Ricevute',
+                                    extend: 'excelHtml5',
+                                        title: 'Metodi di pagamento',
                                         exportOptions: {
                                             columns: ":not(':last')"
                                         }
                                     },
                                     {
-                                        extend: 'pdfHtml5', "action": newexportaction,
-                                        title: 'Ricevute',
+                                        extend: 'pdfHtml5',
+                                        title: 'Metodi di pagamento',
                                         exportOptions: {
                                             columns: ":not(':last')"
                                         }
                                     },
                                     {
-                                        extend: 'print', "action": newexportaction,
+                                        extend: 'print',
                                         text: 'Stampa',
-                                        title: 'Ricevute',
+                                        title: 'Metodi di pagamento',
                                         exportOptions: {
                                             columns: ":not(':last')"
                                         }
@@ -431,36 +307,32 @@
                             }
                         ]
                     },
-                    top1B: {
+                    top1B : {
                         pageLength: {
                             menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
                         }
                     },
-                    top1C: 'search',
+                    top1C :'search',
                 },
-                order: [[0, 'desc'], [1, '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>';
+                    var html = '&nbsp;<a href="#" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
                     $(".dt-search").append(html);
                 }
             });
             $('#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()
-            });
 
-            $(document).ready(function () {
-                $(document).on("click", ".addData", function () {
+            $(document).ready(function() {
+                $(document).on("click",".addData",function() {
                     $(".title--section_addButton").trigger("click")
                 });
-            });
+            } );
 
-        }*/
+        }
 
     </script>
 @endpush