Przeglądaj źródła

Fix vari grafici

Luca Parisio 11 miesięcy temu
rodzic
commit
8bbf8814e2

BIN
.DS_Store


BIN
app/.DS_Store


BIN
app/Http/.DS_Store


+ 3 - 1
app/Http/Livewire/Course.php

@@ -124,6 +124,7 @@ class Course extends Component
         $this->causals = \App\Models\Causal::select('*')->where('type', 'IN')->where('enabled', true)->get();
 
         $this->course_years = \App\Models\Course::select('year')->where('year', '<>', '')->groupBy('year')->pluck('year');
+
     }
 
     public function render()
@@ -131,7 +132,8 @@ class Course extends Component
         if (isset($_GET["year"]))
             $this->selectedYear = $_GET["year"];
         else
-            $this->selectedYear = date("Y") . "-" . (date("Y") + 1);
+            $this->selectedYear = $this->course_years[0];
+            //$this->selectedYear = date("Y") . "-" . (date("Y") + 1);
         $this->records = \App\Models\Course::where('parent_id', null)->where('year', $this->selectedYear)->with('type', 'duration')->get();
         return view('livewire.course');
     }

+ 12 - 3
app/Http/Livewire/RecordIN.php

@@ -370,10 +370,19 @@ class RecordIN extends Component
                 foreach($months as $idx => $m)
                 {
                     $this->rows[0]["when"][$idx]["month"] = $m;
-                    $this->rows[0]["when"][$idx]["year"] = $m < env('FISCAL_YEAR_MONTH_FROM', 1) ? (date("Y") + 1) : date("Y");
+                    if ($m > date("M"))
+                        $this->rows[0]["when"][$idx]["year"] = $m < env('FISCAL_YEAR_MONTH_FROM', 1) ? (date("Y") + 1) : date("Y");
+                    else
+                        $this->rows[0]["when"][$idx]["year"] = $m > env('FISCAL_YEAR_MONTH_TO', 1) ? (date("Y") - 1) : date("Y");
 
-                    $desc .= " " . $this->getMonth($m);
+                    if ($idx > 0)
+                    {
+                        if ($this->rows[0]["when"][$idx - 1]["year"] != $this->rows[0]["when"][$idx]["year"])
+                            $desc .= " " . $this->rows[0]["when"][$idx - 1]["year"] . " ";
+                    }
+                    $desc .= " " . $this->getMonth($m);// . " " . $this->rows[0]["when"][$idx]["year"];
                 }
+                $desc .= " " . $this->rows[0]["when"][$idx]["year"];
                 $this->rows[0]["note"] = $desc;
                 $count += 1;
 
@@ -835,7 +844,7 @@ class RecordIN extends Component
         $this->update = false;
         $this->resetFields();
         $this->emit('setEdit', false);
-        return redirect()->to('/' . $this->fromPage . "?showFilters=1");
+        return redirect()->to('/in');
     }
 
     public function delete($id)

+ 7 - 1
app/Http/Livewire/RecordINOUT.php

@@ -422,7 +422,13 @@ class RecordINOUT extends Component
 
     public function remove($idx)
     {
-        unset($this->datas[$idx]);
+        
+        if (sizeof($this->datas) > 1)
+            array_splice($this->datas, $idx, 1);
+            //unset($this->datas[$idx]);
+        else
+            $this->datas = array();
+        
         $this->show('', '');
     }
 

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

@@ -602,7 +602,7 @@ class RecordOUT extends Component
     {
 
         $period = \Carbon\CarbonPeriod::create($this->multiYearFrom . '-' . $this->multiMonthFrom . '-01', '1 month', $this->multiYearTo . '-' . $this->multiMonthTo . '-01');
-
+        $this->rows[$idx]['when'] = [];
         foreach ($period as $dt) {
             if (!in_array(array('month' => $dt->format("n"), 'year' => $dt->format("Y"), 'period' => ''), $this->rows[$idx]['when']))
                 $this->rows[$idx]['when'][] = array('month' => $dt->format("n"), 'year' => $dt->format("Y"), 'period' => '');

+ 5 - 4
app/Http/Livewire/Supplier.php

@@ -122,8 +122,8 @@ class Supplier extends Component
                 'address' => $this->address,
                 'zip_code' => $this->zip_code,
                 'nation_id' => $this->nation_id,
-                'province_id' => $this->province_id,
-                'city_id' => $this->city_id,
+                'province_id' => $this->province_id > 0 ? $this->province_id : null,
+                'city_id' => $this->city_id > 0 ? $this->city_id : null,
                 'referent' => $this->referent,
                 'website' => $this->website,
                 'phone' => $this->phone,
@@ -171,6 +171,7 @@ class Supplier extends Component
                 $this->dataId = $supplier->id;
                 $this->update = true;
                 $this->add = false;
+                $this->checkIsItaly();
                 $this->emit('load-provinces', $this->nation_id, 'provinceClass');
                 $this->emit('load-cities', $this->province_id, 'cityClass');
             }
@@ -190,8 +191,8 @@ class Supplier extends Component
                 'address' => $this->address,
                 'zip_code' => $this->zip_code,
                 'nation_id' => $this->nation_id,
-                'province_id' => $this->province_id,
-                'city_id' => $this->city_id,
+                'province_id' => $this->province_id > 0 ? $this->province_id : null,
+                'city_id' => $this->city_id > 0 ? $this->city_id : null,
                 'referent' => $this->referent,
                 'website' => $this->website,
                 'phone' => $this->phone,

+ 31 - 0
app/helpers.php

@@ -251,3 +251,34 @@ function getMonthList()
     }
     return $months;
 }
+
+function sms_send($params, $backup = false)
+{
+    static $content;
+
+    if ($backup == true) {
+        $url = 'https://api2.smsapi.com/sms.do';
+    } else {
+        $url = 'https://api.smsapi.com/sms.do';
+    }
+
+    $c = curl_init();
+    curl_setopt($c, CURLOPT_URL, $url);
+    curl_setopt($c, CURLOPT_POST, true);
+    curl_setopt($c, CURLOPT_POSTFIELDS, $params);
+    curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
+    curl_setopt($c, CURLOPT_HTTPHEADER, array(
+        "Authorization: Bearer " . env('SMS_TOKEN', 'kHebe4eQ5cTbPCHGiGrNJAFsy2z0fiF3W7DdO8Ss')
+    ));
+
+    $content = curl_exec($c);
+    $http_status = curl_getinfo($c, CURLINFO_HTTP_CODE);
+
+    if ($http_status != 200 && $backup == false) {
+        $backup = true;
+        sms_send($params, $token, $backup);
+    }
+
+    curl_close($c);
+    return $content;
+}

BIN
database/.DS_Store


Plik diff jest za duży
+ 0 - 142
iao.sql


BIN
public/.DS_Store


+ 5 - 1
public/css/extra.css

@@ -22,5 +22,9 @@ table.tableHead thead {
 /* Important */
     position: sticky;
     z-index: 100;
-    top: 0;
+    top: -15px;
 }
+::-webkit-scrollbar-thumb {
+    background: #e4e4e4 !important;
+    border-radius: 10px;
+}

BIN
public/img/.DS_Store


+ 79 - 0
public/upload.php

@@ -0,0 +1,79 @@
+<?php
+$files = $_FILES['file'];
+$file_path = $files['tmp_name'][0]; // temporary upload path of the first file
+$file_name = $_POST['name']; // desired name of the file
+
+$uploaded = move_uploaded_file($_FILES['file']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . '/public/uploads/' . $_FILES['file']['name']);
+if($uploaded) {
+    header('Access-Control-Allow-Origin: *');
+    header('Content-type: application/json');
+    $data = ['url' => '/public/uploads/' . basename($file_name), 'message' => 'The file ' . $file_name . ' has been uploaded.'];
+    http_response_code(201);
+    echo json_encode($data);
+}
+/*
+die;
+
+ini_set('display_errors', 1);
+ini_set('display_startup_errors', 1);
+error_reporting(E_ALL);
+
+// Get the maximum upload file size
+$max_size = ini_get('upload_max_filesize');
+
+if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
+    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
+        header('Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT');
+    }
+    //Make sure you remove those you do not want to support
+    header('Access-Control-Allow-Origin: *');
+
+    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
+        header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
+    }
+
+    //Just exit with 200 OK with the above headers for OPTIONS method
+    exit(0);
+}
+
+            
+
+    
+    $target_dir = __DIR__ . DIRECTORY_SEPARATOR . 'uploads';
+    $file_name = basename($_FILES['file']['name']);
+    $file_size = $_FILES['file']['size'];
+    $target_file = $target_dir . DIRECTORY_SEPARATOR . $file_name;
+
+    // Validate file size
+    if ($file_size > $max_size) {
+        header('Access-Control-Allow-Origin: *');
+        header('Content-type: application/json');
+        $data = ['message' => 'File size exceeds the maximum allowed size of ' . $max_size . '.'];
+        http_response_code(400);
+        echo json_encode($data);
+        exit;
+    }
+
+    // Sanitize file name to prevent directory traversal attacks
+    $file_name = preg_replace('/[^a-zA-Z0-9._-]/', '', $file_name);
+    $target_file = $target_dir . DIRECTORY_SEPARATOR . $file_name;
+
+    try {
+        if (move_uploaded_file($_FILES['file']['tmp_name'], $target_file)) {
+            header('Access-Control-Allow-Origin: *');
+            header('Content-type: application/json');
+            $data = ['url' => $target_file, 'message' => 'The file ' . $file_name . ' has been uploaded.'];
+            http_response_code(201);
+            echo json_encode($data);
+        } else {
+            throw new Exception('Unable to move the uploaded file to its final location:' . $target_file);
+        }
+
+    } catch (\Throwable $th) {
+        header('Access-Control-Allow-Origin: *');
+        header('Content-type: application/json');
+        $data = ['message' => 'Sorry, there was an error uploading your file.', 'error' => $th->getMessage()];
+        http_response_code(400);
+        echo json_encode($data);
+    }
+*/

BIN
public/uploads/.DS_Store


+ 0 - 0
public/uploads/sample.jpg


+ 125 - 0
public/uppy.html

@@ -0,0 +1,125 @@
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Uppy File Upload with Cloud Integrations, Camera, and Unsplash</title>
+    <link href="https://releases.transloadit.com/uppy/v2.6.0/uppy.min.css" rel="stylesheet">
+</head>
+<body>
+
+    <h2>Upload Files with Cloud Services, Audio, Camera, and Unsplash using Uppy</h2>
+    <div id="drag-drop-area"></div>
+    <span class="select-file-button">Open Uppy Popup</span>
+    <script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
+    <script src="https://releases.transloadit.com/uppy/v2.6.0/uppy.min.js"></script>
+    <script>
+        const uppy = new Uppy.Core({
+            restrictions: {
+                maxNumberOfFiles: 1,
+                allowedFileTypes: ['image/*', 'video/*']
+            },
+            autoProceed: false,
+            allowMultipleUploadBatches: false
+        })
+        .use(Uppy.Dashboard, {
+            inline: false,
+            target: '#drag-drop-area',
+            trigger: '.select-file-button',
+            showProgressDetails: true,
+            singleFileFullScreen: true,
+            //note: 'Upload files from cloud, record video, edit images, and search Unsplash',
+            doneButtonHandler: null,
+            closeModalOnClickOutside: true,
+            closeAfterFinish: true,
+            showLinkToFileUploadResult: true,
+            proudlyDisplayPoweredByUppy: false
+        })
+        /*.use(Uppy.Url, {
+            target: Uppy.Dashboard,
+            companionUrl: 'https://demo.morphme.io/uppy_demo'
+        })
+        .use(Uppy.Unsplash, {
+            target: Uppy.Dashboard,
+            companionUrl: 'https://demo.morphme.io/uppy_demo',
+            clientId: 'YOUR_UNSPLASH_ACCESS_KEY' // Replace with Unsplash Access Key
+        })
+        .use(Uppy.GoogleDrive, {
+            target: Uppy.Dashboard,
+            companionUrl: 'https://demo.morphme.io/uppy_demo'  // Companion server URL
+        })
+        .use(Uppy.OneDrive, {
+            target: Uppy.Dashboard,
+            companionUrl: 'https://demo.morphme.io/uppy_demo'
+        })
+        .use(Uppy.Dropbox, {
+            target: Uppy.Dashboard,
+            companionUrl: 'https://demo.morphme.io/uppy_demo'
+        })*/
+        .use(Uppy.Webcam, {
+            target: Uppy.Dashboard,
+            modes: ['picture', 'video-audio']
+        })
+        /*.use(Uppy.Audio, {
+            target: Uppy.Dashboard
+        })*/
+        
+        .use(Uppy.ImageEditor, {
+            target: Uppy.Dashboard,
+            quality: 0.8,
+            cropperOptions: {
+                viewMode: 1,
+                background: true
+            }
+        })
+        
+        .use(Uppy.XHRUpload, {
+            endpoint: 'upload.php',  // PHP endpoint
+            fieldName: 'file',
+            formData: true,
+            bundle: true,
+            getResponseData (response) {
+                console.log(response);
+              var json = jQuery.parseJSON(response);
+              console.log('status: '+json.status);
+              console.log('path: '+json.path);
+            }
+        });
+
+        uppy.on('file-added', (file) => {
+            console.log('Added file', file);
+            uppy.setMeta({
+                id: 110, 
+                entity: 'Entity123',
+                name: file.meta.name,
+                type: file.meta.type
+            });
+        });
+
+        uppy.on('upload-success', (file, response) => {
+            console.log(file.name);
+            console.log(response)
+            /*const img = new Image();
+            img.width = 300;
+            img.alt = file.id;
+            img.src = response.uploadURL;
+            document.body.appendChild(img);*/
+        });
+
+        uppy.on('complete', (result) => {
+            console.log('Upload complete! Files:', result.successful);
+            /*if (result.successful.length > 0) {
+                const fileUrl = result.successful[0].uploadURL;
+                console.log('File uploaded:', fileUrl);
+            }*/
+        });
+
+        uppy.on('dashboard:modal-closed', () => {
+            console.log('Dashboard modal closed');
+            uppy.cancelAll(); 
+        });
+    </script>
+
+</body>
+</html>

BIN
resources/.DS_Store


BIN
resources/views/.DS_Store


+ 16 - 12
resources/views/layouts/app.blade.php

@@ -169,11 +169,11 @@
             if (Request::is('settings'))
                 print "Impostazioni";
             if (Request::is('categories'))
-                print "Categorie";
+                print "Gruppi di appartenenza";
             if (Request::is('disciplines'))
                 print "Discipline";
             if (Request::is('cards'))
-                print "Tessere";
+                print "Tesseramenti";
             if (Request::is('course_subscriptions'))
                 print "Corsi - Abbonamenti";
             if (Request::is('courses'))
@@ -195,12 +195,14 @@
             if (Request::is('payment_methods'))
                 print "Metodi di pagamento";
             if (Request::is('users'))
-                print "Utenti";
+                print "Profilo utenti";
             @endphp
             </h3>
 
             <div class="header--userprofile d-flex align-items-center">
-                <figure><img src="" alt="" class="user--avatar"></figure>
+                <div style="vertical-align: middle;width: 50px;height: 50px;border-radius: 50%;background-color:white;text-align:center">
+                    <h3 style="font-size:1.50rem;color:#0C6197">{{substr(Auth::user()->name, 0, 1)}}</h3>
+                </div>
                 <a href="#" id="link-popover" data-bs-toggle="popover" data-bs-placement="bottom" data-bs-content="Bottom popover">{{Auth::user()->name}} <small>{{Auth::user()->level == 0 ? 'Admin' : 'Worker'}}</small></a>
             </div>
 
@@ -330,20 +332,22 @@
                         </div>
                     @endif
                     @if(Auth::user()->level == env('LEVEL_ADMIN', 0))
-                        <div class="accordion-item " style="{{Request::is('settings') || Request::is('categories') || Request::is('disciplines') || Request::is('cards') || Request::is('course_subscriptions') || Request::is('courses') || Request::is('course_durations') || Request::is('course_frequencies') || Request::is('course_levels') || Request::is('course_types') || Request::is('banks') || Request::is('causals') || Request::is('vats') || Request::is('payment_methods') ? 'background-color: #c5d9e6;' : ''}}">
+                        <div class="accordion-item " style="{{Request::is('settings') || Request::is('categories') || Request::is('disciplines') || Request::is('cards') || Request::is('course_subscriptions') || Request::is('courses') || Request::is('course_durations') || Request::is('course_frequencies') || Request::is('course_levels') || Request::is('course_types') || Request::is('banks') || Request::is('causals') || Request::is('vats') || Request::is('payment_methods') || Request::is('users') ? 'background-color: #c5d9e6;' : ''}}">
                             <h2 class="accordion-header linkMenu">
                                 <a class="accordion-button collapsed" href="/settings">
                                     Impostazioni
                                 </a>
                             </h2>
                         </div>
-                        <div class="accordion-item " style="{{Request::is('users') ? 'background-color: #c5d9e6;' : ''}}">
-                            <h2 class="accordion-header linkMenu">
-                                <a class="accordion-button collapsed" href="/users">
-                                    Utenti
-                                </a>
-                            </h2>
-                        </div>
+                        @if(false)
+                            <div class="accordion-item " style="{{Request::is('users') ? 'background-color: #c5d9e6;' : ''}}">
+                                <h2 class="accordion-header linkMenu">
+                                    <a class="accordion-button collapsed" href="/users">
+                                        Utenti
+                                    </a>
+                                </h2>
+                            </div>
+                        @endif
                     @endif
                 </div>
                 </div>

+ 1 - 1
resources/views/livewire/course.blade.php

@@ -37,7 +37,7 @@
                             try 
                             {
                                 list($f, $t) = explode("-", $c);
-                                if ($f == date("Y"))
+                                if ($f == date("Y") - 1)
                                     $selected = 'selected';
                             } catch (Exception $e) {
                             

+ 176 - 18
resources/views/livewire/course_list.blade.php

@@ -1,4 +1,4 @@
-<div class="col card--ui" id="card--dashboard">
+<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">
@@ -131,10 +131,10 @@
             <table class="table tablesaw tableHead tablesaw-stack pagamento--corsi display nowrap" id="tablesaw-350" width="100%">
                 <thead>
                     <tr>
-                        <th scope="col"></th>
-                        <th scope="col">Corso</th>
-                        <th scope="col">Cognome</th>
-                        <th scope="col">Nome</th>
+                        <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>
@@ -147,7 +147,8 @@
                 </tbody>
                 <tfoot id="checkall-target">
                     <tr>
-                        <th colspan="2"></th>
+                        <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>
@@ -186,14 +187,14 @@
             
             padding: 15px;
             /*max-width: 800px !important;*/
-            overflow-x: auto;
-            overflow-y: hidden;
-            white-space: nowrap;
-            border: 1px solid #ddd;
+            /*overflow-x: auto;
+            overflow-y: auto;
+            white-space: nowrap;*/
+            /*border: 1px solid #ddd;*/
         }
 
         ::-webkit-scrollbar-thumb {
-            background: #EDF0F2;
+            background: #e4e4e4;
             border-radius: 10px;
         }
 
@@ -225,6 +226,8 @@
         {
             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>
@@ -237,6 +240,32 @@
 
     <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;
@@ -289,6 +318,45 @@
         .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>
@@ -309,6 +377,7 @@
         } );
 
         $('.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");
@@ -463,8 +532,11 @@
             var filterType = $('.filterType').val();
             localStorage.setItem("filterTypeCourseList", filterType);
 
-            $('#tablesaw-350').DataTable({
+            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,
@@ -482,15 +554,20 @@
                     {
                         data: 'column_18',
                         "orderable": false,
+                        className: 'red',
                         render: function (data, type, row, meta){
                             return data;
                         }
                     },
                     {
-                        data: 'column_19'
+                        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;
@@ -498,6 +575,7 @@
                     },
                     {
                         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>';
@@ -506,6 +584,8 @@
                     },
                     {
                         data: 'column_2',
+                        orderSequence: ['asc', 'desc'],
+                        className: 'ciccio',
                         render: function (data, type, row){
                             const x = data.split("§");
                             var ret = '';
@@ -522,6 +602,7 @@
                     },
                     {
                         data: 'column_3',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -539,6 +620,7 @@
                     },
                     {
                         data: 'column_4',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -556,6 +638,7 @@
                     },
                     {
                         data: 'column_5',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -573,6 +656,7 @@
                     },
                     {
                         data: 'column_6',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -590,6 +674,7 @@
                     },
                     {
                         data: 'column_7',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -607,6 +692,7 @@
                     },
                     {
                         data: 'column_8',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -624,6 +710,7 @@
                     },
                     {
                         data: 'column_9',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -641,6 +728,7 @@
                     },
                     {
                         data: 'column_10',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -658,6 +746,7 @@
                     },
                     {
                         data: 'column_11',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -675,6 +764,7 @@
                     },
                     {
                         data: 'column_12',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -692,6 +782,7 @@
                     },
                     {
                         data: 'column_13',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -709,6 +800,7 @@
                     },
                     {
                         data: 'column_14',
+                        orderSequence: ['asc', 'desc'],
                         render: function (data, type, row, meta){
                             const x = data.split("§");
                             var ret = '';
@@ -737,19 +829,75 @@
                                     {
                                         extend: 'excelHtml5',"action":newexportaction,
                                         title: 'Pagamento corsi',
+                                        orientation: 'landscape',
                                         exportOptions: {
                                             columns: ":not(':last')"
                                         },
-                                        footer:false
+                                        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
-                                    },
+                                        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',
@@ -758,7 +906,7 @@
                                             columns: ":not(':last')"
                                         },
                                         footer:false
-                                    }
+                                    }*/
                                 ],
                                 dropup: true
                             }
@@ -922,10 +1070,20 @@
         $( document ).ready( function(){
 
             setMaxWidth();
-            $( window ).bind( "resize", setMaxWidth ); //Remove this if it's not needed. It will react when window changes size.
+            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 ) ) ;
             }
 
 

+ 3 - 2
resources/views/livewire/member.blade.php

@@ -1596,11 +1596,11 @@
                         <div class="row">
                             <div class="col-md-7 col-xl-8 d-flex gx-0">
                                 @if($add)
-                                    <button class="btn--ui primary d-flex order-1 me-2" wire:click="store(false)">continua</button>
+                                    <button class="btn--ui primary d-flex order-1 me-2" wire:click="store(false)">salva e continua</button>
                                     <button class="btn--ui primary d-flex order-3 ms-auto" wire:click="store(true)">salva e chiudi</button>
                                 @endif
                                 @if($update)
-                                    <button class="btn--ui primary d-flex order-1 me-2" wire:click="updateAAA(false)">continua</button>
+                                    <button class="btn--ui primary d-flex order-1 me-2" wire:click="updateAAA(false)">salva e continua</button>
                                     <button class="btn--ui primary d-flex order-3 ms-auto" wire:click="updateAAA(true)">salva e chiudi</button>
                                 @endif
                                 <button class="btn--ui lightGrey" onclick="annulla()" style="margin-right:10px">annulla</button><br><br>
@@ -2526,6 +2526,7 @@
         });
 
         Livewire.on('goToTop', () => {
+            @this.set('type', 'dati');
             document.body.scrollTop = document.documentElement.scrollTop = 0;
         });
 

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

@@ -386,6 +386,7 @@
                     },
                     top1C :'search',
                 },
+                order: [[0, 'desc'], [1, 'asc']],
                 pagingType: 'numbers',
                 "language": {
                     "url": "/assets/js/Italian.json"

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

@@ -192,11 +192,17 @@
                 </nav>
         </div>
         -->
+        <button type="button" class="btn btn-floating btn-lg" id="btn-back-to-bottom" ><i class="fas fa-arrow-down"></i></button>
+        <button type="button" class="btn btn-floating btn-lg" id="btn-back-to-top" ><i class="fas fa-arrow-up"></i></button>
     </section>
 
 
+    
+
+
 </div>
 
+
 @push('scripts')
     <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
 @endpush
@@ -204,19 +210,38 @@
     <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
     <style>
 
+        #btn-back-to-top {
+            background-color: #0C6197;
+            color: white;
+        position: fixed;
+        bottom: 20px;
+        right: 20px;
+        display: none;
+        }
+
+        #btn-back-to-bottom {
+            background-color: #0C6197;
+            color: white;
+            position: fixed;
+            top: 120px;
+            right: 20px;
+            z-index: 9999;
+            display: none;
+        }
+
         .scrollTable {
             margin-left: 0px ;
             margin-right: 0px ;
             padding: 15px;
             /*max-width: 800px !important;*/
             overflow-x: auto;
-            overflow-y: hidden;
+            overflow-y: auto;
             white-space: nowrap;
             border: 1px solid #ddd;
         }
 
         ::-webkit-scrollbar-thumb {
-            background: #EDF0F2;
+            background: #e4e4e4;
             border-radius: 10px;
         }
 
@@ -344,6 +369,7 @@
                 @this.set('filterMember', data);
             });
             setMaxWidth();
+            setMaxHeight();
         });
 
         load();
@@ -382,47 +408,83 @@
         $( document ).ready( function(){
 
             setMaxWidth();
+            setMaxHeight();
             $( window ).bind( "resize", setMaxWidth ); //Remove this if it's not needed. It will react when window changes size.
+            $( window ).bind( "resize", setMaxHeight );
 
             $(".open-filter").click(function(){
                 setMaxWidth();
+                setMaxHeight();
             });
 
         });
 
-        function setMaxWidth() {
+            function setMaxWidth() {
                 $("#resume-table").width( Math.round( $(window ).width() - size ) ) ;
             }
-        /*
-        const chart = new Chart(
-            document.getElementById('recordChart'), {
-                type: 'line',
-                data: {
-                    labels: @json($labels),
-                    datasets: @json($recordDatas)
-                },
-                options: {
-                    height:200,
-                    plugins: {
-                        legend: {
-                            position: 'bottom'
-                        }
-                    },
-                    responsive: true,
-                    elements: {
-                        line: {
-                            tension : 0.4  // smooth lines
-                        },
-                    },
 
+            function setMaxHeight() {
+                 $("#resume-table").height( Math.round( $(window ).height() - 300 ) ) ;
+            }
+        
+            let mybuttonBottom = document.getElementById("btn-back-to-bottom");
+            let mybutton = document.getElementById("btn-back-to-top");
+
+            // When the user scrolls down 20px from the top of the document, show the button
+            window.onscroll = function () {
+                scrollFunction();
+            };
+
+            const element = document.getElementById('resume-table');
+                element.onscroll = (e)=>{
+                    scrollFunction();
+                };
+                /*if (element.scrollTop < lastScrollTop){
+                    // upscroll 
+                    return;
+                } 
+                lastScrollTop = element.scrollTop <= 0 ? 0 : element.scrollTop;
+                    if (element.scrollTop + element.offsetHeight>= element.scrollHeight ){
+                    console.log("End");
+                    }
+                }*/
+
+                function scrollFunction() {
+                if (
+                    element.scrollTop > 20
+                ) {
+                    mybutton.style.display = "block";
+                    mybuttonBottom.style.display = "block";
+                } else {
+                    mybutton.style.display = "none";
+                    mybuttonBottom.style.display = "none";
                 }
             }
-        );
 
-        Livewire.on('updateChart', data => {
-            chart.data = data;
-            chart.update();
-        });
-        */
+            function scrollFunctionOld() {
+            if (
+                document.body.scrollTop > 20 ||
+                document.documentElement.scrollTop > 20
+            ) {
+                mybutton.style.display = "block";
+                mybuttonBottom.style.display = "block";
+            } else {
+                mybutton.style.display = "none";
+                mybuttonBottom.style.display = "none";
+            }
+            }
+            // When the user clicks on the button, scroll to the top of the document
+            mybutton.addEventListener("click", backToTop);
+            mybuttonBottom.addEventListener("click", backToBottom);
+
+            function backToTop() {
+                $('#resume-table').scrollTop(0);
+                /*document.body.scrollTop = 0;
+                document.documentElement.scrollTop = 0;*/
+            }
+            function backToBottom() {
+                $('#resume-table').scrollTop($('#resume-table')[0].scrollHeight);
+                //window.scrollTo(0, document.body.scrollHeight);
+            }
     </script>
 @endpush

+ 76 - 8
resources/views/livewire/records_in.blade.php

@@ -131,13 +131,14 @@
                 <thead>
                     <tr>
                         <!--<th scope="col"></th>-->
-                        <th scope="col">Data pagamento</th>
+                        <th scope="col">Data</th>
                         <th scope="col">Importo</th>
                         <th scope="col">Cognome</th>
                         <th scope="col">Nome</th>
                         <th scope="col">Commerciale</th>
                         <th scope="col">Causale</th>
                         <th scope="col">Pagamento</th>
+                        
                         <th scope="col">Stato</th>
                         <th scope="col">...</th>
                     </tr>
@@ -158,7 +159,11 @@
 
     @else
 
-        <a style="margin-top:20px" class="btn--ui lightGrey" href="/{{$fromPage != '' ? ($fromPage . '?showFilters=1') : 'in'}}"><i class="fa-solid fa-arrow-left"></i></a><br><br>
+        @if($isDuplicate)
+            <a style="margin-top:20px" class="btn--ui lightGrey" wire:click="cancel()" href="javascript:;"><i class="fa-solid fa-arrow-left"></i></a><br><br>
+        @else
+            <a style="margin-top:20px" class="btn--ui lightGrey" href="/{{$fromPage != '' ? ($fromPage . '?showFilters=1') : 'in'}}"><i class="fa-solid fa-arrow-left"></i></a><br><br>
+        @endif
 
         <a name="top"></a>
         @if (session()->has('error'))
@@ -513,7 +518,11 @@
 
 
                         <div class="accountingEntry--btn d-flex align-items-center justify-content-between mt-5">
-                            <button class="btn--ui lightGrey" onclick="annulla()">annulla</button>
+                            @if($isDuplicate)
+                                <button class="btn--ui lightGrey" wire:click="cancel()">annulla</button>
+                            @else
+                                <button class="btn--ui lightGrey" onclick="annulla()">annulla</button>
+                            @endif
                             @if(!$deleted)
                                 @if($canSave)
                                     @if($add)
@@ -561,10 +570,10 @@
             </div>
             @if(!$corrispettivo_fiscale)
             <div class="accountingEntry_resume card--ui" style="max-height:800px;width:35% !important;">
-                <header>
+                <header style="height: 80px">
                     <div class="username d-flex align-items-start">
                         <i class="ico--ui accountingResume me-2"></i>
-                        <div class="user--resume_name d-flex flex-column"><span class="primary">{{!$commercial ? 'Ricevuta' : 'Promemoria pagamento'}} {{$currentReceip ? $currentReceip->number . "/" . $currentReceip->year : ''}}</span></div></div>
+                        <div class="user--resume_name d-flex flex-column"><span class="primary">{{!$commercial ? 'Ricevuta' : 'Promemoria pagamento'}} {{$currentReceip ? $currentReceip->number . "/" . $currentReceip->year : ''}} {{$currentReceip != null ? ' del ' . date("d/m/Y", strtotime($currentReceip->created_at)) : ''}}</span></div></div>
                 </header>
 
                 <div class="resume--body d-flex justify-content-between flex-column">
@@ -796,6 +805,34 @@
         .page-link.active, .active > .page-link {
             background-color:#006099 !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;
+        }
         /* .total.primary
         {
             font-size:38px !important;
@@ -859,8 +896,26 @@
                 }
             });
         });
+
+        $(document).ready(function(){
+
+            $(document).on("keypress", $('.filterCausals'), function (e) {
+
+                setTimeout(() => {
+                    $(".select2-results__option").each(function(){
+                        var txt = $(this).html();
+                        var count = (txt.match(/-/g) || []).length;
+                        $(this).addClass('paddingLeftSelect' + count);
+                    });
+                }, 100);
+            });
+
+        });
+
         Livewire.on('load-select', () => {
 
+            
+
             $('.causalClass').each(function(i, obj) {
                 $(obj).select2({
                     //data: data,
@@ -911,7 +966,7 @@
                 //@this.set('filterCausals', data);
             });
 
-
+            
 
         });
 
@@ -1065,6 +1120,18 @@
                     $(".showFilter").show();
                 }
             });
+
+            $(document).on("select2:open",".filterCausals",function() {
+            //$('.filterCausals').on('select2:open', function (e) {
+                setTimeout(() => {
+                    $(".select2-results__option").each(function(){
+                        var txt = $(this).html();
+                        var count = (txt.match(/-/g) || []).length;
+                        $(this).addClass('paddingLeftSelect' + count);
+                    });
+                }, 100);
+            });
+
         } );
 
         function editData(id)
@@ -1171,7 +1238,7 @@
                         data: "date",
                         render: function (data, type){
                             if (data == "")
-                                return " TOTALE";
+                                return " ";
                             if (type == "sort"){
                                 return new Date(data).getTime();
                             }
@@ -1188,6 +1255,7 @@
                     { data: 'commercial' },
                     { data: 'causals', "orderable": false, },
                     { data: 'payment', "orderable": false, },
+                    //{ data: 'payment_date', "orderable": false, },
                     { data: 'status', "orderable": false, },
                     {
                         data: "action",
@@ -1274,7 +1342,7 @@
                 },
                 "fnInitComplete": function (oSettings, json) {
                     var html = '&nbsp;<a href="#" class="showHideFilter btn--ui"><i class="fa-solid fa-sliders"></i></a>';
-                    html += '&nbsp;<a href="#" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
+                    html += '&nbsp;<a  style="cursor:pointer" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
                     $(".dt-search").append(html);
                 }
             });

+ 4 - 2
resources/views/livewire/records_in_out.blade.php

@@ -128,7 +128,7 @@
 
                             @endforeach
                             <tr>
-                                <td><b>Totale entrate mensili</b></td>
+                                <td><b>Totale entrate</b></td>
                                 @foreach($columns as $column)
                                     <td class="cellBorder" style="text-align:right">
                                         @php
@@ -248,7 +248,7 @@
                             @endforeach
 
                             <tr>
-                                <td><b>Totale uscite mensili</b></td>
+                                <td><b>Totale uscite</b></td>
                                 @foreach($columns as $column)
                                     <td class="cellBorder" style="text-align:right">
                                         @php
@@ -424,6 +424,8 @@
             $(".act-more").remove();
             $(".spaces").remove();
 
+            $(".treetable-expander").trigger("click");
+
             //$("#checkall-target > tr").removeAttr("data-level");
             //$("#checkall-target > tr").removeAttr("class");
             $('#collaptableIN').unbind().removeData();

+ 55 - 0
resources/views/livewire/records_out.blade.php

@@ -501,6 +501,33 @@
         .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;
+        }
     </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>
@@ -532,6 +559,22 @@
                     }
                 });
         });
+
+        $(document).ready(function(){
+
+            $(document).on("keypress", $('.filterCausals'), function (e) {
+
+                setTimeout(() => {
+                    $(".select2-results__option").each(function(){
+                        var txt = $(this).html();
+                        var count = (txt.match(/-/g) || []).length;
+                        $(this).addClass('paddingLeftSelect' + count);
+                    });
+                }, 100);
+            });
+
+            });
+
         Livewire.on('load-select', () => {
             /*$('.causalClass').select2({
                     matcher: function(params, data) {
@@ -678,6 +721,18 @@
                     $(".showFilter").show();
                 }
             });
+
+            $(document).on("select2:open",".filterCausals",function() {
+            //$('.filterCausals').on('select2:open', function (e) {
+                setTimeout(() => {
+                    $(".select2-results__option").each(function(){
+                        var txt = $(this).html();
+                        var count = (txt.match(/-/g) || []).length;
+                        $(this).addClass('paddingLeftSelect' + count);
+                    });
+                }, 100);
+            });
+
         } );
 
         function editData(id)

+ 3 - 2
resources/views/livewire/settings.blade.php

@@ -21,13 +21,14 @@
             <h4 style="cursor:pointer;{{$type == 'anagrafica' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('anagrafica')">Anagrafica</h4>
             <h4 style="cursor:pointer;{{$type == 'corsi' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('corsi')">Corsi</h4>
             <h4 style="cursor:pointer;{{$type == 'contabilita' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('contabilita')">Contabilità</h4>
+            <a href="/users"><h4>Profilo utenti</h4></a>
         </div>
 
         @if($type == 'anagrafica')
             <div id="anagrafica">
                 <a href="/categories">
                     <div class="row">
-                        <div class="col-md-11 p-2"><h5>Categorie</h5></div>
+                        <div class="col-md-11 p-2"><h5>Gruppi di appartenenza</h5></div>
                         <div class="col-md-1 p-2"><i class="fa-solid fa-chevron-right"></i></div>
                     </div>
                 </a>
@@ -41,7 +42,7 @@
                 <hr size="1">
                 <a href="/cards">
                     <div class="row">
-                        <div class="col-md-11 p-2"><h5>Tessere</h5></div>
+                        <div class="col-md-11 p-2"><h5>Tesseramenti</h5></div>
                         <div class="col-md-1 p-2"><i class="fa-solid fa-chevron-right"></i></div>
                     </div>
                 </a>

+ 1 - 1
resources/views/receipt.blade.php

@@ -20,7 +20,7 @@
 <body>
     <img src="{{public_path() . env('LOGO')}}" width="200">
     <br><br><br>
-    <div align="right"><b>RICEVUTA DI PAGAMENTO N. {{$receipt->number . "/" . $receipt->year}}</b></div><br><br>
+    <div align="right"><b>RICEVUTA DI PAGAMENTO N. {{$receipt->number . "/" . $receipt->year}} del {{date("d/m/Y", strtotime($receipt->date))}}</b></div><br><br>
     @if($receipt->status == 99)
         <div align="right"><b style="color:red">ANNULLATA</b></div><br><br>
     @endif

+ 310 - 15
routes/web.php

@@ -184,16 +184,38 @@ Route::group(['middleware' => 'auth'],function(){
         }
         if ($_GET["filterCategories"] != "null")
         {
-            $cc = array();
+         
+            $categories = [];
             $cats = explode(",", $_GET["filterCategories"]);
+
+            // Per ogni causale, se ha dei figli allora aggiungo le causali figlio
             foreach($cats as $c)
+            {
+                $categories[] = $c;
+                $childs = \App\Models\Category::where('parent_id', $c)->get();
+                foreach($childs as $_cc)
+                {
+                    $categories[] = $_cc->id;
+                    $childss = \App\Models\Category::where('parent_id', $_cc->id)->get();
+                    foreach($childss as $ccc)
+                    {
+                        $categories[] = $ccc->id;
+                    }
+                }
+            }
+            
+            $cc = array();
+            foreach($categories as $c)
             {
                 $m_ids = \App\Models\MemberCategory::where('category_id', $c)->pluck('member_id')->toArray();
-                if (sizeof($cc) > 0)
+                /*if (sizeof($cc) > 0)
                     $cc = array_intersect($cc, $m_ids);
                 else
                     $cc = $m_ids;
+                */
+                $cc = array_merge($cc, $m_ids);
             }
+
             $x = $x->whereIn('id', $cc);
             //$cats_ids = \App\Models\MemberCategory::whereIn('category_id', explode(",", $_GET["filterCategories"]))->pluck('member_id');
             //$x = $x->whereIn('id', $cats_ids);
@@ -365,14 +387,16 @@ Route::group(['middleware' => 'auth'],function(){
 
         $datas = [];
 
-        $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('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')
         ->where('records.type', 'IN');
 
         $hasFilter = false;
@@ -415,32 +439,48 @@ Route::group(['middleware' => 'auth'],function(){
             if ($_GET["filterCommercial"] == 1)
             {
                 $hasFilter = true;
-                $x = $x->where('commercial', true );
+                $x = $x->where('records.commercial', true );
                 $y = $y->where('records.commercial', true );
             }
             if ($_GET["filterCommercial"] == 2)
             {
                 $hasFilter = true;
-                $x = $x->where('commercial', false);
+                $x = $x->where('records.commercial', false);
                 $y = $y->where('records.commercial', false);
             }
             if ($_GET["filterMember"] > 0)
             {
                 $hasFilter = true;
-                $x = $x->where('member_id', $_GET["filterMember"]);
-                $y = $y->where('member_id', $_GET["filterMember"]);
+                $x = $x->where('records.member_id', $_GET["filterMember"]);
+                $y = $y->where('records.member_id', $_GET["filterMember"]);
             }
             if ($_GET["filterPaymentMethod"] != "null")
             {
                 $hasFilter = true;
                 $payments = explode(",", $_GET["filterPaymentMethod"]);
-                $x = $x->whereIn('payment_method_id', $payments);
-                $y = $y->whereIn('payment_method_id', $payments);
+                $x = $x->whereIn('records.payment_method_id', $payments);
+                $y = $y->whereIn('records.payment_method_id', $payments);
             }
             if ($_GET["filterCausals"] != "null")
             {
                 $hasFilter = true;
                 $causals = explode(",", $_GET["filterCausals"]);
+
+                // Per ogni causale, se ha dei figli allora aggiungo le causali figlio
+                foreach($causals as $c)
+                {
+                    $childs = \App\Models\Causal::where('parent_id', $c)->get();
+                    foreach($childs as $cc)
+                    {
+                        $causals[] = $cc->id;
+                        $childss = \App\Models\Causal::where('parent_id', $cc->id)->get();
+                        foreach($childss as $ccc)
+                        {
+                            $causals[] = $ccc->id;
+                        }
+                    }
+                }
+
                 //$causals = \App\Models\RecordRow::where('causal_id', $_GET["filterCausals"])->pluck('record_id');
                 $causals = \App\Models\RecordRow::whereIn('causal_id', $causals)->pluck('record_id');
                 $x = $x->whereIn('records.id', $causals);
@@ -449,13 +489,13 @@ Route::group(['middleware' => 'auth'],function(){
             if ($_GET["filterFrom"] != '')
             {
                 $hasFilter = true;
-                $x = $x->where('date', '>=', $_GET["filterFrom"]);
+                $x = $x->where('records.date', '>=', $_GET["filterFrom"]);
                 $y = $y->where('date', '>=', $_GET["filterFrom"]);
             }
             if ($_GET["filterTo"] != '')
             {
                 $hasFilter = true;
-                $x = $x->where('date', '<=', $_GET["filterTo"]);
+                $x = $x->where('records.date', '<=', $_GET["filterTo"]);
                 $y = $y->where('date', '<=', $_GET["filterTo"]);
             }
 
@@ -553,12 +593,14 @@ Route::group(['middleware' => 'auth'],function(){
             $datas[] = array(
                 //'id' => $r->id,
                 'date' => $r->date,
+                //'date' => $r->receipt_date != null ? $r->receipt_date : "",
                 'total' => formatPrice($r->getTotal()),
                 'first_name' => $r->first_name,
                 'last_name' => $r->last_name,
                 'commercial' => $r->financial_movement ? 'Movimento finanziario' : ($r->commercial ? 'SI' : 'NO'),
                 'causals' => $causals,
                 'payment' => $r->payment_method->name,
+                //'payment_date' => date("d/m/Y", strtotime($r->date)),
                 'status' => $r->deleted ? 'Annullato' : '',
                 'action' => $r->id . "||" . ($r->deleted ? 'x' : '')
             );
@@ -617,6 +659,22 @@ Route::group(['middleware' => 'auth'],function(){
         if ($_GET["filterCausals"] != "null")
         {
             $causals = explode(",", $_GET["filterCausals"]);
+
+            // Per ogni causale, se ha dei figli allora aggiungo le causali figlio
+            foreach($causals as $c)
+            {
+                $childs = \App\Models\Causal::where('parent_id', $c)->get();
+                foreach($childs as $cc)
+                {
+                    $causals[] = $cc->id;
+                    $childss = \App\Models\Causal::where('parent_id', $cc->id)->get();
+                    foreach($childss as $ccc)
+                    {
+                        $causals[] = $ccc->id;
+                    }
+                }
+            }
+            
             //$causals = \App\Models\RecordRow::where('causal_id', $_GET["filterCausals"])->pluck('record_id');
             $causals = \App\Models\RecordRow::whereIn('causal_id', $causals)->pluck('record_id');
             $x = $x->whereIn('records.id', $causals);
@@ -761,6 +819,76 @@ Route::group(['middleware' => 'auth'],function(){
 
         $xxx = 1;
 
+        /*
+        $sortColumn = '';
+        if (isset($_GET["order"]))
+        {
+
+        }
+        */
+
+        $column = '';
+        $sort_value = 0;
+        if (isset($_GET["order"]))
+        {
+            $f = $_GET["order"][0]["column"];
+            $d = $_GET["order"][0]["dir"];
+            if ($f >= 5 && $f <= 16)
+            {
+                $column = 'column_' . ($f - 2);
+                if (session()->get('sort_column'))
+                {
+                    if (session()->get('sort_column') != $f)
+                    {
+                        session()->put('sort_column', $f);
+                        session()->put('sort_order', $d);
+                        session()->put('sort_value', 0);
+                        $sort_value = 0;
+                    }
+                    else
+                    {
+                        if (session()->get('sort_order') == $d)
+                        {
+                            //session()->put('sort_value', 0);
+                            $sort_value = session()->get('sort_value', 0);
+                        }
+                        else
+                        {
+                            if (session()->get('sort_value', 0) == 0)
+                            {
+                                $sort_value = 1;                                
+                            }
+                            if (session()->get('sort_value', 0) == 1)
+                            {
+                                $sort_value = 2;                                
+                            }
+                            if (session()->get('sort_value', 0) == 2)
+                            {
+                                $sort_value = 3;                                
+                            }
+                            if (session()->get('sort_value', 0) == 3)
+                            {
+                                $sort_value = 0;                                
+                            }
+                            session()->put('sort_value', $sort_value);
+                            
+                        }
+                        session()->put('sort_order', $d);
+                    }
+                }
+                else
+                {
+                    session()->put('sort_column', $f);
+                    session()->put('sort_order', $d);
+                    session()->put('sort_value', 0);
+                    $sort_value = 0;
+                }
+
+            }
+        }  
+
+        //print $sort_value;
+
         $member_course_totals = $member_course->get();
         foreach($member_course_totals as $x)
         {
@@ -804,8 +932,6 @@ Route::group(['middleware' => 'auth'],function(){
                         $totals[$i]['orange'] = 0;
                         $totals[$i]['yellow'] = 0;
                     }
-
-
                     if ($cls == 'yellow')
                     {
                         $totals[$i][$cls] += 1;
@@ -824,6 +950,135 @@ Route::group(['middleware' => 'auth'],function(){
             else
                 $totalIsc[$sub] = $subPrice;
 
+            $s = 0;
+            if ($column != '')
+            {
+                $z = 0;
+                switch ($column) {
+                    case 'column_3':
+                        $z = 9;
+                        break;
+                    case 'column_4':
+                        $z = 10;
+                        break;
+                    case 'column_5':
+                        $z = 11;
+                        break;
+                    case 'column_6':
+                        $z = 12;
+                        break;
+                    case 'column_7':
+                        $z = 1;
+                        break;
+                    case 'column_8':
+                        $z = 2;
+                        break;
+                    case 'column_9':
+                        $z = 3;
+                        break;
+                    case 'column_10':
+                        $z = 4;
+                        break;
+                    case 'column_11':
+                        $z = 5;
+                        break;
+                    case 'column_12':
+                        $z = 6;
+                        break;
+                    case 'column_13':
+                        $z = 7;
+                        break;
+                    case 'column_14':
+                        $z = 8;
+                        break;
+                    default:
+                        $z = 0;
+                        break;
+                }
+                $c = getColor($x->months, $z);
+                if ($sort_value == 0)
+                {
+                    switch ($c) {
+                        case 'wgrey':
+                            $s = 0;
+                            break;
+                        case 'orange':
+                            $s = 1;
+                            break;
+                        case 'green':
+                            $s = 2;
+                            break;
+                        case 'yellow':
+                            $s = 3;
+                            break;
+                        default:
+                            $s = 0;
+                            break;
+                    }
+                }
+                if ($sort_value == 1)
+                {
+                    switch ($c) {
+                        case 'wgrey':
+                            $s = 3;
+                            break;
+                        case 'orange':
+                            $s = 0;
+                            break;
+                        case 'green':
+                            $s = 1;
+                            break;
+                        case 'yellow':
+                            $s = 2;
+                            break;
+                        default:
+                            $s = 0;
+                            break;
+                    }
+                }
+                if ($sort_value == 2)
+                {
+                    switch ($c) {
+                        case 'wgrey':
+                            $s = 2;
+                            break;
+                        case 'orange':
+                            $s = 3;
+                            break;
+                        case 'green':
+                            $s = 0;
+                            break;
+                        case 'yellow':
+                            $s = 1;
+                            break;
+                        default:
+                            $s = 0;
+                            break;
+                    }
+                }
+                if ($sort_value == 3)
+                {
+                    switch ($c) {
+                        case 'wgrey':
+                            $s = 1;
+                            break;
+                        case 'orange':
+                            $s = 2;
+                            break;
+                        case 'green':
+                            $s = 3;
+                            break;
+                        case 'yellow':
+                            $s = 0;
+                            break;
+                        default:
+                            $s = 0;
+                            break;
+                    }
+                }
+
+            }
+
             $datas[] = array(
                 "column_19" => $x->course->name,
                 "column_0" => $x->member->last_name,
@@ -844,7 +1099,8 @@ Route::group(['middleware' => 'auth'],function(){
                 "column_15" => $x->course_id,
                 "column_16" => $x->id,
                 "column_17" => $x->member_id,
-                "column_18" => $xxx++
+                "column_18" => $xxx++,
+                "column_20" => $s
             );
 
         }
@@ -890,7 +1146,10 @@ Route::group(['middleware' => 'auth'],function(){
         {
             $s = $_GET["order"][0]["column"];
             if ($s == 1) $s = 21;
-            array_multisort(array_column($datas, 'column_' . ($s - 2)), $_GET["order"][0]["dir"] == "asc" ? SORT_ASC : SORT_DESC, SORT_NATURAL|SORT_FLAG_CASE, $datas);
+            if ($column != '')
+                array_multisort(array_column($datas, 'column_20'), SORT_ASC, SORT_NATURAL|SORT_FLAG_CASE, $datas);
+            else
+                array_multisort(array_column($datas, 'column_' . ($s - 2)), $_GET["order"][0]["dir"] == "asc" ? SORT_ASC : SORT_DESC, SORT_NATURAL|SORT_FLAG_CASE, $datas);
         }
 
         $xxx = 1;
@@ -1270,3 +1529,39 @@ Route::get('/updateCourseCausal', function(){
         }
     }
 });
+
+Route::get('/test_sms', function()
+{
+
+    $expire_date = date("Y-m-d", strtotime("+1 month"));
+    $expire_date_it = date("d/m/Y", strtotime("+1 month"));
+    $certificates = \App\Models\MemberCertificate::where('expire_date', $expire_date)->get();
+    foreach($certificates as $certificate)
+    {
+        //$phone = $certificate->member->phone;
+        $phone = '3893163265';
+        $params = array(
+            'to'            => '+39' . $phone,
+            'from'          => env('SMS_FROM', 'Test'),
+            'message'       => $certificate->member->first_name . ', il tuo certificato medico scadrà il ' . $expire_date_it,   
+            'format'        => 'json',           
+        );
+        
+        sms_send($params);
+        print "Inviato";
+    }
+
+    /*
+
+    $params = array(
+        'to'            => '+393893163265',
+        'from'          => env('SMS_FROM', 'Test'),
+        'message'       => 'Prova SMS da IAO',   
+        'format'        => 'json',           
+    );
+    
+    echo sms_send($params);
+
+    */
+    
+});

BIN
storage/.DS_Store


BIN
storage/framework/.DS_Store


BIN
tests/.DS_Store


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików