Luca Parisio před 1 rokem
rodič
revize
5b545050ff

+ 5 - 1
app/Http/Livewire/Causal.php

@@ -6,7 +6,7 @@ use Livewire\Component;
 
 class Causal extends Component
 {
-    public $recordsIn, $recordsOut, $parent_id,  $name, $enabled, $money, $user_status, $no_first, $no_records, $type, $dataId, $update = false, $add = false;
+    public $recordsIn, $recordsOut, $parent_id,  $name, $enabled, $corrispettivo_fiscale, $money, $user_status, $no_first, $no_records, $type, $dataId, $update = false, $add = false;
 
     protected $rules = [
         'name' => 'required',
@@ -22,6 +22,7 @@ class Causal extends Component
         $this->parent_id = null;
         $this->type = null;
         $this->money = false;
+        $this->corrispettivo_fiscale = false;
         $this->user_status = false;
         $this->no_first = false;
         $this->no_records = false;
@@ -60,6 +61,7 @@ class Causal extends Component
                 'type' => $this->type,
                 'parent_id' => $this->parent_id,
                 'money' => $this->money,
+                'corrispettivo_fiscale' => $this->corrispettivo_fiscale,
                 'user_status' => $this->user_status,
                 'no_first' => $this->no_first,
                 'no_records' => $this->no_records,
@@ -81,6 +83,7 @@ class Causal extends Component
             } else {
                 $this->name = $causal->name;
                 $this->money = $causal->money;
+                $this->corrispettivo_fiscale = $causal->corrispettivo_fiscale;
                 $this->user_status = $causal->user_status;
                 $this->no_first = $causal->no_first;
                 $this->no_records = $causal->no_records;
@@ -108,6 +111,7 @@ class Causal extends Component
                 'no_first' => $this->no_first,
                 'no_records' => $this->no_records,
                 'money' => $this->money,
+                'corrispettivo_fiscale' => $this->corrispettivo_fiscale,
                 'enabled' => $this->enabled
             ]);
             session()->flash('success','Tessera aggiornata');

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

@@ -94,7 +94,7 @@ class CourseList extends Component
         foreach($member_course as $x)
         {
             $this->records[] = array(
-                $x->member_id . "§" . $x->member->first_name . " " . $x->member->last_name,
+                $x->member_id . "§" . $x->member->first_name . "§" . $x->member->last_name,
                 $this->getColor($x->months, 1),
                 $this->getColor($x->months, 2),
                 $this->getColor($x->months, 3),

+ 190 - 0
app/Http/Livewire/Member.php

@@ -48,6 +48,8 @@ class Member extends Component
 
     public $records, $first_name, $last_name, $image, $image_old, $status, $birth_place, $birth_city_id, $birth_province_id, $birth_nation_id, $birth_date, $gender, $fiscal_code, $address, $zip_code, $nation_id, $province_id, $city_id, $phone, $phone2, $phone3, $email, $enabled, $dataId, $update = false, $add = false;
 
+    public $isSaving = false;
+
     public $father_name, $mother_name, $father_email, $mother_email, $father_phone, $mother_phone, $father_fiscal_code, $mother_fiscal_code, $father_doc_number, $father_doc_type, $mother_doc_number, $mother_doc_type;
 
     public $document_type, $document_number, $document_from, $document_expire_date, $document_files, $document_files_old;
@@ -80,6 +82,12 @@ class Member extends Component
     public $cards = array();
     public $categories = array();
     public $courses = array();
+
+    public $course_names = array();
+    public $course_levels = array();
+    public $course_types = array();
+    public $course_frequencies = array();
+
     public $course_subscriptions = array();
 
     public $createSubscription = false;
@@ -107,6 +115,8 @@ class Member extends Component
     // Courses data
     public $member_courses = array(), $course_course_id, $course_date_from, $course_date_to, $course_when = array(), $addCourse, $updateCourse, $courseDataId, $course_course_subscription_id, $course_status, $course_note, $course_price, $course_subscription_price, $course_subscribed, $course_months = array(), $course_exist;
 
+    public $course_name, $course_level_id, $course_type_id, $course_frequency_id;
+
     // Certificates data
     public $member_certificates = array(), $certificate_type, $certificate_filename_old, $certificate_filename, $certificate_expire_date, $certificate_status, $addCertificate, $updateCertificate, $certificateDataId;
 
@@ -176,6 +186,8 @@ class Member extends Component
 
         $this->error_fc = false;
 
+        $this->isSaving = false;
+
         $this->emit('load-data-table');
     }
 
@@ -212,6 +224,10 @@ class Member extends Component
         $this->course_subscribed = false;
         $this->course_months = array();
         $this->course_note = '';
+        $this->course_name = '';
+        $this->course_level_id = '';
+        $this->course_type_id = '';
+        $this->course_frequency_id = '';
     }
 
     public function executeMultipleAction(){
@@ -229,6 +245,91 @@ 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 != '')
+        {
+            $all = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->get();
+            foreach($all as $a)
+            {
+                $levels_ids[] = $a->course_level_id;
+            }
+        }
+        $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 = [];
+        if ($this->course_level_id != '')
+        {
+            $all = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->where('course_level_id', $this->course_level_id)->get();
+            foreach($all as $a)
+            {
+                $types_ids[] = $a->course_type_id;
+            }
+        }
+        $this->course_types = \App\Models\CourseType::select('*')->where('enabled', true)->whereIn('id', $types_ids)->get();
+        $this->course_frequencies = [];
+    }
+
+    public function updatedCourseTypeId()
+    {
+        $this->course_course_id = null;
+        $this->course_frequency_id = '';
+        $frequencies_ids = [];
+        if ($this->course_type_id != '')
+        {
+            $all = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->where('course_level_id', $this->course_level_id)->where('course_type_id', $this->course_type_id)->get();
+            foreach($all as $a)
+            {
+                $frequencies_ids[] = $a->course_frequency_id;
+            }
+        }
+        $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->whereIn('id', $frequencies_ids)->get();
+
+    }
+
+    public function updatedCourseFrequencyId()
+    {
+        $this->course_course_id = null;
+        if ($this->course_frequency_id != '')
+        {
+            $this->course_course_id = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->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;
+
+            if ($this->course_course_id > 0)
+            {
+                $c = \App\Models\Course::findOrFail($this->course_course_id);
+                $this->course_price = formatPrice($c->price);
+                $this->course_subscription_price = formatPrice($c->subscription_price);
+                // 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;
+            }
+            else
+            {
+                $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 $documents = [];
 
     public function removeDocument($idx)
@@ -326,11 +427,61 @@ class Member extends Component
 
     public function updated()
     {
+        if ($this->isSaving)
+        {
+            $zzz = [];
+            if ($this->birth_nation_id == null)
+                $zzz[] = 'birth_nation_id='.$this->birth_nation_id;
+            if ($this->isBirthItaly)
+            {
+                if ($this->birth_province_id == null)
+                    $zzz[] = 'birth_province_id='.$this->birth_province_id;
+                if ($this->birth_city_id == null)
+                    $zzz[] = 'birth_city_id='.$this->birth_city_id;
+            }
+            if ($this->nation_id == null)
+                $zzz[] = 'nation_id='.$this->nation_id;
+            if ($this->isItaly)
+            {
+                if ($this->province_id == null)
+                    $zzz[] = 'province_id='.$this->province_id;
+                if ($this->city_id == null)
+                    $zzz[] = 'city_id='.$this->city_id;
+            }
+
+            $this->emit('setErrorMsg', $zzz);
+        }
         // $this->emit('load-select');
     }
 
     public function hydrate()
     {
+
+        if ($this->isSaving)
+        {
+            $zzz = [];
+            if ($this->birth_nation_id == null)
+                $zzz[] = 'birth_nation_id='.$this->birth_nation_id;
+            if ($this->isBirthItaly)
+            {
+                if ($this->birth_province_id == null)
+                    $zzz[] = 'birth_province_id='.$this->birth_province_id;
+                if ($this->birth_city_id == null)
+                    $zzz[] = 'birth_city_id='.$this->birth_city_id;
+            }
+            if ($this->nation_id == null)
+                $zzz[] = 'nation_id='.$this->nation_id;
+            if ($this->isItaly)
+            {
+                if ($this->province_id == null)
+                    $zzz[] = 'province_id='.$this->province_id;
+                if ($this->city_id == null)
+                    $zzz[] = 'city_id='.$this->city_id;
+            }
+
+            $this->emit('setErrorMsg', $zzz);
+        }
+
         $this->emit('load-select');
         // $this->emit('destroy-data-table');
 
@@ -412,6 +563,9 @@ class Member extends Component
     public function render()
     {
 
+        $this->course_names = \App\Models\Course::orderBy('name')->groupBy('name')->pluck('name');
+
+
         $datas = [];
         // $this->emit('destroy-data-table');
         if (false)
@@ -574,6 +728,9 @@ class Member extends Component
 
     public function store($close)
     {
+
+        $this->isSaving = false;
+
         $this->emit('load-select');
 
         $rules = [
@@ -784,6 +941,9 @@ class Member extends Component
 
     public function update($close)
     {
+
+        $this->isSaving = false;
+
         $this->emit('load-select');
 
         $rules = [
@@ -1153,6 +1313,36 @@ class Member extends Component
                 session()->flash('error','Corso non trovato');
             } else {
                 $this->course_course_id = $memberCourse->course_id;
+
+                // Carico i dati relativi alla struttura ad albero
+                $c = \App\Models\Course::findOrFail($this->course_course_id);
+                $this->course_name = $c->name;
+                $this->course_level_id = $c->course_level_id;
+                $this->course_type_id = $c->course_type_id;
+                $this->course_frequency_id = $c->course_frequency_id;
+
+                $all = \App\Models\Course::where('name', 'like', '%' . $c->name . "%")->get();
+                foreach($all as $a)
+                {
+                    $levels_ids[] = $a->course_level_id;
+                }
+                $this->course_levels = \App\Models\CourseLevel::select('*')->where('enabled', true)->whereIn('id', $levels_ids)->get();
+
+                $all = \App\Models\Course::where('name', 'like', '%' . $c->name . "%")->where('course_level_id', $this->course_level_id)->get();
+                foreach($all as $a)
+                {
+                    $types_ids[] = $a->course_type_id;
+                }
+                $this->course_types = \App\Models\CourseType::select('*')->where('enabled', true)->whereIn('id', $types_ids)->get();
+
+                $frequencies_ids = [];
+                $all = \App\Models\Course::where('name', 'like', '%' . $c->name . "%")->where('course_level_id', $this->course_level_id)->where('course_type_id', $this->course_type_id)->get();
+                foreach($all as $a)
+                {
+                    $frequencies_ids[] = $a->course_frequency_id;
+                }
+                $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->whereIn('id', $frequencies_ids)->get();
+
                 $this->course_date_from = $memberCourse->date_from;
                 $this->course_date_to = $memberCourse->date_to;
                 foreach(json_decode($memberCourse->when) as $z)

+ 5 - 1
app/Http/Livewire/PaymentMethod.php

@@ -6,7 +6,7 @@ use Livewire\Component;
 
 class PaymentMethod extends Component
 {
-    public $records, $name, $enabled, $money, $dataId, $bank_id, $update = false, $add = false;
+    public $records, $name, $enabled, $money, $corrispettivo_fiscale, $dataId, $bank_id, $update = false, $add = false;
 
     public $banks = array();
 
@@ -36,6 +36,7 @@ class PaymentMethod extends Component
     public function resetFields(){
         $this->name = '';
         $this->money = false;
+        $this->corrispettivo_fiscale = false;
         $this->enabled = true;
         $this->emit('load-data-table');
     }
@@ -74,6 +75,7 @@ class PaymentMethod extends Component
                 'name' => $this->name,
                 'bank_id' => $this->bank_id,
                 'money' => $this->money,
+                'corrispettivo_fiscale' => $this->corrispettivo_fiscale,
                 'enabled' => $this->enabled
             ]);
             session()->flash('success','Metodo pagamento creato');
@@ -92,6 +94,7 @@ class PaymentMethod extends Component
             } else {
                 $this->name = $payment_method->name;
                 $this->enabled = $payment_method->enabled;
+                $this->corrispettivo_fiscale = $payment_method->corrispettivo_fiscale;
                 $this->money = $payment_method->money;
                 $this->bank_id = $payment_method->bank_id;
                 $this->dataId = $payment_method->id;
@@ -111,6 +114,7 @@ class PaymentMethod extends Component
                 'name' => $this->name,
                 'bank_id' => $this->bank_id,
                 'money' => $this->money,
+                'corrispettivo_fiscale' => $this->corrispettivo_fiscale,
                 'enabled' => $this->enabled
             ]);
             session()->flash('success','Metodo pagamento aggiornato');

+ 4 - 2
app/Http/Livewire/Receipt.php

@@ -53,11 +53,13 @@ class Receipt extends Component
         $this->emit('load-data-table');
         $receipt = \App\Models\Receipt::findOrFail($id);
         //$pdf = PDF::loadView('pdf/receipt', array('datas' => $datas, 'from' => $x, 'to' => $y, 'who' => '', 'matricola' => $matricola));
-        $pdf = PDF::loadView('receipt', array('receipt' => $receipt))->output();
+        $pdf = PDF::loadView('receipt', array('receipt' => $receipt));//->output();
+        return $pdf->stream();
+        /*
         return response()->streamDownload(
             fn () => print($pdf),
             "ricevuta_" . $receipt->number . "_" . $receipt->year . ".pdf"
-        );
+        );*/
 
         /*return response()->streamDownload(function () {
             echo $pdf->stream();

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

@@ -64,7 +64,7 @@ class Record extends Component
             $this->years[] = array('value' => $year, 'text' => $year);
         }
         */
-        $this->payments = \App\Models\PaymentMethod::select('id', 'name')->where('enabled', true)->get();
+        $this->payments = \App\Models\PaymentMethod::select('id', 'name')->where('enabled', true)->where('money', false)->get();
 
     }
 
@@ -268,7 +268,7 @@ class Record extends Component
 
                 // aggiungere il nome * * *
                 //$causal = $prefix . $data->date . "§" . $causalCheck->getTree();
-                $causal = $prefix . $data->date . "§" . $causalCheck->getTree() . "§" . ($data->type == "IN" ? ($data->member->last_name . " " . $data->member->first_name)  : $data->supplier->name ?? "");
+                $causal = $prefix . $data->date . "§" . $causalCheck->getTree() . "§" . ($data->type == "IN" ? ($data->member ? ($data->member->last_name . " " . $data->member->first_name) : "")  : $data->supplier->name ?? "") . "§" . $data->note;
 
                 if (isset($this->records[$causal]))
                 {

+ 37 - 6
app/Http/Livewire/RecordIN.php

@@ -48,11 +48,13 @@ class RecordIN extends Component
     $month,
     $year,
     $type,
+    $deleted,
     $amount,
     $vat,
     $virtual,
     $note,
     $parent,
+    $corrispettivo_fiscale,
     $commercial, $update = false, $add = false;
 
     public $currentReceip;
@@ -160,8 +162,10 @@ class RecordIN extends Component
         $this->supplier_id = null;
         $this->payment_method_id = null;
         $this->commercial = 0;
+        $this->corrispettivo_fiscale = false;
         $this->date = date("Y-m-d");
         $this->type = 'IN';
+        $this->deleted = false;
         $this->newMemberFirstName = '';
         $this->newMemberLastName = '';
         $this->newMemberFiscalCode = '';
@@ -394,8 +398,10 @@ class RecordIN extends Component
                 'supplier_id' => $this->supplier_id,
                 'payment_method_id' => $this->payment_method_id,
                 'commercial' => $this->commercial,
+                'corrispettivo_fiscale' => $this->corrispettivo_fiscale,
                 'date' => $this->date,
                 'type' => $this->type,
+                'deleted' => $this->deleted
             ]);
             $this->dataId = $record->id;
 
@@ -485,8 +491,10 @@ class RecordIN extends Component
                 $this->supplier_id = $record->supplier_id;
                 $this->payment_method_id = $record->payment_method_id;
                 $this->commercial = $record->commercial;
+                $this->corrispettivo_fiscale = $record->corrispettivo_fiscale;
                 $this->date = date("Y-m-d", strtotime($record->date));
                 $this->type = $record->type;
+                $this->deleted = $record->deleted;
                 $this->dataId = $record->id;
                 $this->update = true;
                 $this->add = false;
@@ -539,8 +547,10 @@ class RecordIN extends Component
                 'supplier_id' => $this->supplier_id,
                 'payment_method_id' => $this->payment_method_id,
                 'commercial' => $this->commercial,
+                'corrispettivo_fiscale' => $this->corrispettivo_fiscale,
                 'date' => date("Y-m-d", strtotime($this->date)),
                 'type' => $this->type,
+                'deleted' => $this->deleted,
             ]);
 
             $tot = 0;
@@ -609,6 +619,14 @@ class RecordIN extends Component
 
             $r = \App\Models\Record::find($id);
 
+            // Annullo la ricevuta
+            $receipt = \App\Models\Receipt::where('record_id', $r->id)->first();
+            if($receipt)
+            {
+                $receipt->status = 99;
+                $receipt->save();
+            }
+
             if ($r->member_course_id > 0)
             {
                 $months = json_decode($r->months);
@@ -625,10 +643,20 @@ class RecordIN extends Component
                 $c->save();
             }
 
-            $r->delete();
+            $r->deleted = true;
+            $r->save();
 
-            session()->flash('success',"Movimento eliminato");
-        }catch(\Exception $e){
+            session()->flash('success','Movimento aggiornato');
+            $this->resetFields();
+            $this->update = false;
+            $this->isDuplicate = false;
+            $this->emit('setEdit', false);
+
+            $this->emit('reload');
+
+            //$this->emit('load-data-table');
+
+        }catch(\Exception $ex){
             session()->flash('error','Errore (' . $ex->getMessage() . ')');
         }
     }
@@ -743,6 +771,8 @@ class RecordIN extends Component
 
             $this->currentReceip = $receipt;
 
+            session()->flash('receipt',"Ricevuta " . $number . "/" . date("Y") . " creata correttamente");
+
             // Apro la ricevuta
             $this->emit('showReceipt', $this->currentReceip->id);
 
@@ -866,11 +896,12 @@ class RecordIN extends Component
     public function printReceipt()
     {
         //$pdf = PDF::loadView('pdf/receipt', array('datas' => $datas, 'from' => $x, 'to' => $y, 'who' => '', 'matricola' => $matricola));
-        $pdf = PDF::loadView('receipt', array('receipt' => $this->currentReceip))->output();
-        return response()->streamDownload(
+        $pdf = PDF::loadView('receipt', array('receipt' => $this->currentReceip));//->output();
+        return $pdf->stream();
+        /*return response()->streamDownload(
             fn () => print($pdf),
             "ricevuta_" . $this->currentReceip->number . "_" . $this->currentReceip->year . ".pdf"
-        );
+        );*/
         /*return response()->streamDownload(function () {
             echo $pdf->stream();
         }, 'test.pdf');*/

+ 1 - 0
app/Models/Causal.php

@@ -14,6 +14,7 @@ class Causal extends Model
         'name',
         'type',
         'money',
+        'corrispettivo_fiscale',
         'user_status',
         'no_first',
         'no_records',

+ 1 - 0
app/Models/PaymentMethod.php

@@ -12,6 +12,7 @@ class PaymentMethod extends Model
     protected $fillable = [
         'name',
         'money',
+        'corrispettivo_fiscale',
         'enabled',
         'bank_id'
     ];

+ 32 - 0
database/migrations/2024_08_29_100000_add_corrispettivo_fiscale_to_payment_methods_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('payment_methods', function (Blueprint $table) {
+            $table->boolean('corrispettivo_fiscale')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('payment_methods', function (Blueprint $table) {
+            $table->dropColumn('corrispettivo_fiscale');
+        });
+    }
+};

+ 32 - 0
database/migrations/2024_08_29_100000_add_corrispettivo_fiscale_to_records_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('records', function (Blueprint $table) {
+            $table->boolean('corrispettivo_fiscale')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('records', function (Blueprint $table) {
+            $table->dropColumn('corrispettivo_fiscale');
+        });
+    }
+};

+ 32 - 0
database/migrations/2024_08_29_172000_add_deleted_to_records_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('records', function (Blueprint $table) {
+            $table->boolean('deleted')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('records', function (Blueprint $table) {
+            $table->dropColumn('deleted');
+        });
+    }
+};

+ 32 - 0
database/migrations/2024_08_30_114500_add_corrispettivo_fiscale_to_causals_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('causals', function (Blueprint $table) {
+            $table->boolean('corrispettivo_fiscale')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('causals', function (Blueprint $table) {
+            $table->dropColumn('corrispettivo_fiscale');
+        });
+    }
+};

+ 15 - 8
resources/views/livewire/causal.blade.php

@@ -27,10 +27,10 @@
             <table class="table tablesaw tablesaw-stack" id="tablesaw-350">
                 <thead>
                     <tr>
-                        <th scope="col">Nome</th>
-                        <th scope="col">Tipologia</th>
-                        <th scope="col">Abilitato</th>
-                        <th scope="col">...</th>
+                        <th scope="col" width="50%">Nome</th>
+                        <th scope="col" width="10%">Tipologia</th>
+                        <th scope="col" width="10%">Abilitato</th>
+                        <th scope="col" width="30%">...</th>
                     </tr>
                 </thead>
                 <tbody id="checkall-target" wire:sortable="reorder" wire:sortable.options="{ animation: 100 }" wire:sortable-group="reorderGroup">
@@ -60,10 +60,10 @@
             <table class="table tablesaw tablesaw-stack" id="tablesaw-350">
                 <thead>
                     <tr>
-                        <th scope="col">Nome</th>
-                        <th scope="col">Tipologia</th>
-                        <th scope="col">Abilitato</th>
-                        <th scope="col">...</th>
+                        <th scope="col" width="50%">Nome</th>
+                        <th scope="col" width="10%">Tipologia</th>
+                        <th scope="col" width="10%">Abilitato</th>
+                        <th scope="col" width="30%">...</th>
                     </tr>
                 </thead>
                 <tbody id="checkall-target" wire:sortable="reorder" wire:sortable.options="{ animation: 100 }" wire:sortable-group="reorderGroup">
@@ -141,6 +141,13 @@
                             </div>
                         </div>
 
+                        <div class="form--item mb-3">
+                            <div class="form-check form-check-inline">
+                                <input class="form-check-input" type="checkbox" id="corrispettivo_fiscale" wire:model="corrispettivo_fiscale">
+                                <label class="form-check-label" for="corrispettivo_fiscale">Utilizza per corrispettivo fiscale</label>
+                            </div>
+                        </div>
+
                         <div class="form--item mb-3">
                             <div class="form-check form-check-inline">
                                 <input class="form-check-input" type="checkbox" id="user_status" wire:model="user_status">

+ 6 - 4
resources/views/livewire/course_list.blade.php

@@ -108,7 +108,8 @@
         <table class="table tablesaw tablesaw-stack" id="tablesaw-350">
             <thead>
                 <tr>
-                    <th scope="col"></th>
+                    <th scope="col">Cognome</th>
+                    <th scope="col">Nome</th>
                     @foreach($months as $m)
                         <th scope="col">&nbsp;&nbsp;&nbsp;&nbsp;{{$m}}</th>
                     @endforeach
@@ -118,13 +119,14 @@
                 @foreach($records as $record)
                     <tr>
                         @php
-                        list($id, $name) = explode("§", $record[0]);
+                        list($id, $first_name, $last_name) = explode("§", $record[0]);
                         @endphp
-                        <td><a href="/members?member_detail={{$id}}">{{$name}}</a></td>
+                        <td><a href="/members?member_detail={{$id}}">{{$last_name}}</a></td>
+                        <td><a href="/members?member_detail={{$id}}">{{$first_name}}</a></td>
                         @for($x=1; $x<=12; $x++)
                             <td>
                                 @if($record[$x] == 'orange')
-                                    <a class="{{$record[$x]}}" wire:click="newPayment({{$record[13]}}, {{$x}}, {{$id}}, {{$record[14]}})">&nbsp;</a>
+                                    <a class="{{$record[$x]}}" wire:click="newPayment({{$record[13]}}, {{$x}}, {{$id}}, {{$record[14]}})" style="cursor: pointer;">&nbsp;</a>
                                 @else
                                     <a class="{{$record[$x]}}">&nbsp;</a>
                                 @endif

+ 75 - 19
resources/views/livewire/member.blade.php

@@ -1137,19 +1137,76 @@
 
                                         <div class="form--wrapper">
                                             <form class="form--utente">
+                                                @if(false)
+                                                    <div class="row ">
+                                                        <div class="col-md-6">
+                                                            <label for="course_course_id" 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 $course)
+                                                                    <option value="{{$course->id}}">{{$course->name}} - {{$course->level->name ?? ""}} - {{$course->type->name ?? ""}} - {{$course->frequency->name ?? ""}}
+                                                                @endforeach
+                                                            </select>
+                                                            @if($course_exist)
+                                                                <small style="color:red">Attenzione : il corso selezionato è già associato all'utente</small>
+                                                            @endif
+                                                        </div>
+                                                    </div>
+                                                @endif
                                                 <div class="row ">
-                                                    <div class="col-md-6">
-                                                        <label for="course_course_id" 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" >
+                                                    <div class="col-md-3">
+                                                        <label for="course_name" class="form-label">Corso</label>
+
+                                                        <select id="course_name" class="form-select @error('course_course_id') is-invalid @enderror" aria-label="Corso" wire:model="course_name" >
                                                             <option value="">
-                                                            @foreach($courses as $course)
-                                                                <option value="{{$course->id}}">{{$course->name}} - {{$course->level->name ?? ""}} - {{$course->type->name ?? ""}} - {{$course->frequency->name ?? ""}}
+                                                            @foreach($course_names as $n)
+                                                                <option value="{{$n}}">{{$n}}
                                                             @endforeach
                                                         </select>
+
+                                                         @error('course_course_id')
+                                                            <div class="invalid-feedback">Devi selezionare un corso (corso, livello, tipologia e frequenza)</div>
+                                                        @enderror
+
                                                         @if($course_exist)
                                                             <small style="color:red">Attenzione : il corso selezionato è già associato all'utente</small>
                                                         @endif
                                                     </div>
+                                                    @if($course_name != '')
+                                                        <div class="col-md-3">
+                                                            <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="">
+                                                                @foreach($course_levels as $l)
+                                                                    <option value="{{$l->id}}">{{$l->name}}
+                                                                @endforeach
+                                                            </select>
+                                                        </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">
+                                                            <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="">
+                                                                @foreach($course_frequencies as $f)
+                                                                    <option value="{{$f->id}}">{{$f->name}}
+                                                                @endforeach
+                                                            </select>
+                                                        </div>
+                                                    @endif
+                                                </div>
+                                                <div class="row ">
                                                     <div class="col-md-6">
                                                         <label for="course_course_subscription_id" class="form-label">Abbonamento</label>
                                                         <select id="course_course_subscription_id" class="form-select  @error('course_course_subscription_id') is-invalid @enderror" aria-label="Abbonamento" wire:model="course_course_subscription_id">
@@ -1160,9 +1217,7 @@
                                                         </select>
 
                                                     </div>
-                                                </div>
 
-                                                <div class="row ">
                                                     <div class="col-md-6">
                                                         <label for="course_price" class="form-label">Costo mensile</label>
                                                         <input class="form-control" type="text" id="course_price" placeholder="Costo mensile" wire:model="course_price" onkeyup="onlyNumberAmount(this)">
@@ -1183,18 +1238,19 @@
                                                 <div class="row ">
                                                     <div class="col-md-12">
                                                         <label for="duration" class="form-label">Durata del corso</label><br>
-                                                        <a class="{{$this->checkMonth(1) ? 'selected' : 'notSelected'}}" wire:click="setMonth(1)">Gen</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(2) ? 'selected' : 'notSelected'}}" wire:click="setMonth(2)">Feb</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(3) ? 'selected' : 'notSelected'}}" wire:click="setMonth(3)">Mar</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(4) ? 'selected' : 'notSelected'}}" wire:click="setMonth(4)">Apr</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(5) ? 'selected' : 'notSelected'}}" wire:click="setMonth(5)">Mag</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(6) ? 'selected' : 'notSelected'}}" wire:click="setMonth(6)">Giu</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(7) ? 'selected' : 'notSelected'}}" wire:click="setMonth(7)">Lug</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(8) ? 'selected' : 'notSelected'}}" wire:click="setMonth(8)">Ago</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(9) ? 'selected' : 'notSelected'}}" wire:click="setMonth(9)">Set</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(10) ? 'selected' : 'notSelected'}}" wire:click="setMonth(10)">Ott</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(11) ? 'selected' : 'notSelected'}}" wire:click="setMonth(11)">Nov</a>&nbsp;
-                                                        <a class="{{$this->checkMonth(12) ? 'selected' : 'notSelected'}}" wire:click="setMonth(12)">Dic</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(9) ? 'selected' : 'notSelected'}}" wire:click="setMonth(9)">Set</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(10) ? 'selected' : 'notSelected'}}" wire:click="setMonth(10)">Ott</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(11) ? 'selected' : 'notSelected'}}" wire:click="setMonth(11)">Nov</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(12) ? 'selected' : 'notSelected'}}" wire:click="setMonth(12)">Dic</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(1) ? 'selected' : 'notSelected'}}" wire:click="setMonth(1)">Gen</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(2) ? 'selected' : 'notSelected'}}" wire:click="setMonth(2)">Feb</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(3) ? 'selected' : 'notSelected'}}" wire:click="setMonth(3)">Mar</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(4) ? 'selected' : 'notSelected'}}" wire:click="setMonth(4)">Apr</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(5) ? 'selected' : 'notSelected'}}" wire:click="setMonth(5)">Mag</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(6) ? 'selected' : 'notSelected'}}" wire:click="setMonth(6)">Giu</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(7) ? 'selected' : 'notSelected'}}" wire:click="setMonth(7)">Lug</a>&nbsp;
+                                                            <a class="{{$this->checkMonth(8) ? 'selected' : 'notSelected'}}" wire:click="setMonth(8)">Ago</a>&nbsp;
+
                                                     </div>
                                                 </div>
                                                 <div class="row">

+ 8 - 0
resources/views/livewire/payment_method.blade.php

@@ -145,6 +145,14 @@
                             </div>
                         </div>
 
+                        @if(false)
+                        <div class="form--item mb-3">
+                            <div class="form-check form-check-inline">
+                                <input class="form-check-input" type="checkbox" id="corrispettivo_fiscale" wire:model="corrispettivo_fiscale">
+                                <label class="form-check-label" for="corrispettivo_fiscale">Utilizza per corrispettivo fiscale</label>
+                            </div>
+                        </div>
+                        @endif
 
                         <!-- // inline input field -->
 

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

@@ -91,7 +91,7 @@
                         <td>{{date("d/m/Y", strtotime($record->date))}}</td>
                         <td>
                             <button type="button" class="btn btn-outline-primary btn-sm" onclick="document.location.href='/in?id={{$record->record_id}}'">Dettaglio</button>
-                            <button type="button" class="btn btn-outline-primary btn-sm" wire:click="printReceipt({{ $record->id }})">Stampa</button>
+                            <a target="_blank" class="btn btn-outline-primary btn-sm" href="/receipt/{{$record->id}}">Stampa</a>
                         </td>
                     </tr>
                 @endforeach

+ 5 - 1
resources/views/livewire/records.blade.php

@@ -72,6 +72,7 @@
                 <tr>
                     <th scope="col">Data</th>
                     <th scope="col" style="border-left:3px solid white;">Causale</th>
+                    <th scope="col" style="border-left:3px solid white;">Dettaglio Causale</th>
                     <th scope="col" style="border-left:3px solid white;">Nominativo</th>
                     @foreach($payments as $p)
                         <th colspan="2" scope="col" style="text-align:center; border-left:3px solid white;">{{$p->name}}</th>
@@ -81,6 +82,7 @@
                     <th scope="col"></th>
                     <th scope="col" style="border-left:3px solid white;"></th>
                     <th scope="col" style="border-left:3px solid white;"></th>
+                    <th scope="col" style="border-left:3px solid white;"></th>
                     @foreach($payments as $p)
                         <th scope="col" style="text-align:center; border-left:3px solid white;">Entrate</th>
                         <th scope="col" style="text-align:center">Uscite</th>
@@ -95,10 +97,11 @@
                     <tr>
                         @php
                         $check = strpos($causal, "$") ? explode("$", $causal)[1] : $causal;
-                        list($d, $c, $n) = explode("§", $check);
+                        list($d, $c, $n, $d) = explode("§", $check);
                         @endphp
                         <td style="background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{date("d/m/Y", strtotime($d))}}</td>
                         <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$c}}</td>
+                        <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$d}}</td>
                         <td style="border-left:3px solid white !important;background-color:{{$count % 2 == 0 ? 'white' : '#f2f4f7'}}">{{$n}}</td>
                         @foreach($payments as $p)
                             @if(isset($record[$p->name]))
@@ -125,6 +128,7 @@
             </tbody>
             <tfoot>
                 <tr>
+                    <td></td>
                     <td></td>
                     <td></td>
                     <td><b>Totale</b></td>

+ 63 - 29
resources/views/livewire/records_in.blade.php

@@ -124,6 +124,12 @@
                 <section id="subheader" class="d-flex align-items-center justify-content-between">
                 </section>
 
+                @if (session()->has('receipt'))
+                    <div class="alert alert-success" role="alert">
+                        {{ session()->get('receipt') }}
+                    </div>
+                @endif
+
                 <section id="resume-table">
                     <div class="compare--chart_wrapper d-none"></div>
 
@@ -138,6 +144,7 @@
                                 <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>
                         </thead>
@@ -170,11 +177,11 @@
                                         <div class="input-group mb-12">
                                             <div class="check--invoice d-flex align-items-center">
                                                 <div class="form-check me-3">
-                                                    <input class="form-check-input" type="radio" value="1" wire:model="commercial">
+                                                    <input class="form-check-input" type="radio" value="1" wire:model="commercial" {{$this->dataId > 0 ? 'disabled' : ''}}>
                                                     <label class="form-check-label" for="flexCheckChecked">&nbsp;Commerciale</label>
                                                 </div>
                                                 <div class="form-check">
-                                                    <input class="form-check-input" type="radio" value="0" wire:model="commercial">
+                                                    <input class="form-check-input" type="radio" value="0" wire:model="commercial" {{$this->dataId > 0 ? 'disabled' : ''}}>
                                                     <label class="form-check-label" for="flexCheck">&nbsp;Non Commerciale</label>
                                                 </div>
                                                 </div>
@@ -184,7 +191,7 @@
                                     <div class="col-md-6 mt-3">
                                         <span class="title-form d-block w-100">Data pagamento</span>
                                         <div class="input-group mb-3">
-                                            <input id="date" type="date" class="form-control"  wire:model="date">
+                                            <input id="date" type="date" class="form-control"  wire:model="date" {{$this->dataId > 0 ? 'disabled' : ''}}>
                                         </div>
                                     </div>
                                     <div class="col-md-6">&nbsp;</div>
@@ -192,7 +199,7 @@
 
                                     <div class="col-md-6">
                                         <span class="title-form d-block w-100">Persona</span>
-                                        <select name="member_id" class="form-select memberClass @error('member_id') is-invalid @enderror" aria-label="Seleziona una persona" wire:model="member_id">
+                                        <select name="member_id" class="form-select memberClass @error('member_id') is-invalid @enderror" aria-label="Seleziona una persona" wire:model="member_id" {{$this->dataId > 0 ? 'disabled' : ''}}>
                                             <option value="">--Seleziona--
                                             @foreach($members as $member)
                                                 <option value="{{$member->id}}">{{$member->last_name}} {{$member->first_name}} ({{$member->fiscal_code}})
@@ -202,9 +209,11 @@
                                             <div class="invalid-feedback">{{ $message }}</div>
                                         @enderror
                                         <br><br>
+                                        @if($this->dataId == 0)
                                         <button type="button" class="btn--ui primary" data-bs-toggle="modal" data-bs-target="#userModal">
                                             Aggiungi
                                         </button>
+                                        @endif
                                     </div>
                                     <div class="col-md-6">
                                         @if($this->member)
@@ -248,7 +257,11 @@
                                         <span class="title-form d-block w-100">Causale</span>
                                         <div class="col-md-12">
 
-                                            <livewire:causals :type="$typeIN" :idx="$idx" :causal_id="$rows[$idx]['causal_id']" :wire:key="$idx" />
+                                            @if($this->dataId > 0)
+                                                {{$this->getCausal($rows[$idx]['causal_id'])}}<br>
+                                            @else
+                                                <livewire:causals :type="$typeIN" :idx="$idx" :causal_id="$rows[$idx]['causal_id']" :wire:key="$idx"/>
+                                            @endif
 
                                             @error('rows.'. $idx . '.causal_id')
                                                 <span style="argin-top: 0.25rem; font-size: 0.875em; color: var(--bs-form-invalid-color);">{{ $message }}</span>
@@ -260,7 +273,7 @@
                                     <div class="row gx-2 mt-3">
                                         <span class="title-form d-block w-100">Dettaglio causale</span>
                                         <div class="col-md-12">
-                                            <input class="form-control " id="causal_detail_{{$idx}}" type="text" placeholder="Dettaglio causale" wire:model="rows.{{$idx}}.note">
+                                            <input class="form-control " id="causal_detail_{{$idx}}" type="text" placeholder="Dettaglio causale" wire:model="rows.{{$idx}}.note" {{$this->dataId > 0 ? 'disabled' : ''}}>
                                         </div>
                                     </div>
 
@@ -282,10 +295,10 @@
                                         @endif
                                         <div class="col-md-3">
                                             @if($add)
-                                                <input type="text" class="form-control totalInput text-end @error('amount') is-invalid @enderror" id="rows.{{$idx}}.amount" wire:model="rows.{{$idx}}.amount" wire:keydown.enter="store(false)" onkeyup="onlyNumberAmount(this)" placeholder="€ 0,00">
+                                                <input type="text" class="form-control totalInput text-end @error('amount') is-invalid @enderror" id="rows.{{$idx}}.amount" wire:model="rows.{{$idx}}.amount" wire:keydown.enter="store(false)" onkeyup="onlyNumberAmount(this)" placeholder="€ 0,00" {{$this->dataId > 0 ? 'disabled' : ''}}>
                                             @endif
                                             @if($update)
-                                                <input type="text" class="form-control totalInput text-end @error('amount') is-invalid @enderror" id="rows.{{$idx}}.amount" placeholder="€ 0,00" wire:model="rows.{{$idx}}.amount"  onkeyup="onlyNumberAmount(this)" wire:keydown.enter="update(false)">
+                                                <input type="text" class="form-control totalInput text-end @error('amount') is-invalid @enderror" id="rows.{{$idx}}.amount" placeholder="€ 0,00" wire:model="rows.{{$idx}}.amount"  onkeyup="onlyNumberAmount(this)" wire:keydown.enter="update(false)" {{$this->dataId > 0 ? 'disabled' : ''}}>
                                             @endif
                                             @error('rows.'. $idx . '.amount')
                                                 <span style="argin-top: 0.25rem; font-size: 0.875em; color: var(--bs-form-invalid-color);">{{ $message }}</span>
@@ -307,7 +320,7 @@
                                                         <div class="col-md-3">
                                                             <span class="title-form d-block w-100">Dal mese</span>
                                                             <div class="input-group mb-3">
-                                                                <select class="form-select form-select-lg me-1"  wire:model="multiMonthFrom">
+                                                                <select class="form-select form-select-lg me-1"  wire:model="multiMonthFrom" {{$this->dataId > 0 ? 'disabled' : ''}}>
                                                                     <option value="1">Gennaio</option>
                                                                     <option value="2">Febbraio</option>
                                                                     <option value="3">Marzo</option>
@@ -326,13 +339,13 @@
                                                         <div class="col-md-3">
                                                             <span class="title-form d-block w-100">Anno</span>
                                                             <div class="input-group mb-3">
-                                                                <input type="number" class="form-control"  wire:model="multiYearFrom" >
+                                                                <input type="number" class="form-control"  wire:model="multiYearFrom"  {{$this->dataId > 0 ? 'disabled' : ''}}>
                                                             </div>
                                                         </div>
                                                         <div class="col-md-3">
                                                             <span class="title-form d-block w-100">Dal mese</span>
                                                             <div class="input-group mb-3">
-                                                                <select class="form-select form-select-lg me-1"  wire:model="multiMonthTo">
+                                                                <select class="form-select form-select-lg me-1"  wire:model="multiMonthTo" {{$this->dataId > 0 ? 'disabled' : ''}}>
                                                                     <option value="1">Gennaio</option>
                                                                     <option value="2">Febbraio</option>
                                                                     <option value="3">Marzo</option>
@@ -351,19 +364,21 @@
                                                         <div class="col-md-3">
                                                             <span class="title-form d-block w-100">Anno</span>
                                                             <div class="input-group mb-3">
-                                                                <input type="number" class="form-control"  wire:model="multiYearTo" >
+                                                                <input type="number" class="form-control"  wire:model="multiYearTo"  {{$this->dataId > 0 ? 'disabled' : ''}}>
                                                             </div>
                                                         </div>
-                                                        <div class="col-md-6">
-                                                            <button type="button" class="btn--ui primary" wire:click.prevent="multiPeriodCreate({{$idx}})" style="margin-top:20px">
-                                                                Crea multi periodo
-                                                            </button>
-                                                        </div>
-                                                        <div class="col-md-6">
-                                                            <button type="button" class="btn--ui primary" wire:click.prevent="multiPeriodCancel()" style="margin-top:20px">
-                                                                Annulla multi periodo
-                                                            </button>
-                                                        </div>
+                                                        @if($this->dataId == 0)
+                                                            <div class="col-md-6">
+                                                                <button type="button" class="btn--ui primary" wire:click.prevent="multiPeriodCreate({{$idx}})" style="margin-top:20px">
+                                                                    Crea multi periodo
+                                                                </button>
+                                                            </div>
+                                                            <div class="col-md-6">
+                                                                <button type="button" class="btn--ui primary" wire:click.prevent="multiPeriodCancel()" style="margin-top:20px">
+                                                                    Annulla multi periodo
+                                                                </button>
+                                                            </div>
+                                                        @endif
                                                     </div>
 
 
@@ -372,7 +387,7 @@
                                                         <div class="col-md-4">
                                                             <span class="title-form d-block w-100">Mese</span>
                                                             <div class="input-group mb-3">
-                                                                <select class="form-select form-select-lg me-1"  wire:model="rows.{{$idx}}.when.{{$xxx}}.month">
+                                                                <select class="form-select form-select-lg me-1"  wire:model="rows.{{$idx}}.when.{{$xxx}}.month" {{$this->dataId > 0 ? 'disabled' : ''}}>
                                                                     <option value="1">Gennaio</option>
                                                                     <option value="2">Febbraio</option>
                                                                     <option value="3">Marzo</option>
@@ -391,7 +406,7 @@
                                                         <div class="col-md-3">
                                                             <span class="title-form d-block w-100">Anno</span>
                                                             <div class="input-group mb-3">
-                                                                <input type="number" class="form-control"  wire:model="rows.{{$idx}}.when.{{$xxx}}.year" >
+                                                                <input type="number" class="form-control"  wire:model="rows.{{$idx}}.when.{{$xxx}}.year"  {{$this->dataId > 0 ? 'disabled' : ''}}>
                                                             </div>
                                                         </div>
                                                         <div class="col-md-3">
@@ -399,11 +414,14 @@
                                                             <span class="netprice_p total--wrapper_netprice"><b>{{$this->currencyToDouble($rows[$idx]["amount"]) > 0 ? formatPrice(($this->currencyToDouble($rows[$idx]["amount"]) + getVatValue($this->currencyToDouble($rows[$idx]["amount"]), $rows[$idx]["vat_id"])) / sizeof($rows[$idx]["when"])) : ""}}</b></span>
                                                         </div>
                                                         <div class="col-md-2"><br>
+                                                            @if($this->dataId == 0)
                                                             <button type="button" class="btn--ui primary" wire:click.prevent="delPeriod({{$idx}}, {{$xxx}})" style="float:right">
                                                                 -
                                                             </button>
+                                                            @endif
                                                         </div>
                                                     @endforeach
+                                                    @if($this->dataId == 0)
                                                     <button type="button" class="btn--ui primary" wire:click.prevent="addPeriod({{$idx}})">
                                                         Aggiungi periodo
                                                     </button>
@@ -411,6 +429,7 @@
                                                     <button type="button" class="btn--ui primary" wire:click.prevent="multiPeriod()" style="margin-top:20px">
                                                         Imposta multi periodo
                                                     </button>
+                                                    @endif
                                                 @endif
 
                                             </div>
@@ -418,20 +437,24 @@
                                     </div>
 
                                     <br><br>
+                                    @if($this->dataId == 0)
                                     @if($idx > 0)
                                         <button type="button" class="btn--ui primary" wire:click.prevent="delRow({{$idx}})" style="float:right">
                                             Rimuovi causale
                                         </button>
                                         <br><br>
                                     @endif
+                                    @endif
                                     <hr size="1">
 
                                 @endforeach
 
+                                @if($this->dataId == 0)
                                 <br>
                                 <button type="button" class="btn--ui primary" wire:click.prevent="addRow()">
                                     Aggiungi causale
                                 </button>
+                                @endif
 
 
                                 <div class="accountingEntry--btn d-flex align-items-center justify-content-between">
@@ -570,7 +593,7 @@
                                             <button class="btn--ui primary sendInvoice mt-5 d-flex ms-auto" wire:click.prevent="update(true)"><i class="ico--ui sendingBtn"></i>salva e rigenera ricevuta</button>
                                         @else
                                             <div class="mt-5">
-                                                <button class="btn--ui " wire:click="printReceipt()"><i class="ico--ui sendingBtn"></i>stampa ricevuta</button>
+                                                <a target="_blank" class="btn--ui" href="/receipt/{{$currentReceip->id}}"><i class="ico--ui sendingBtn"></i>stampa ricevuta</a>
                                                 <button class="btn--ui " wire:click.prevent="removeReceipt()"><i class="ico--ui "></i>annulla ricevuta</button>
                                             </div>
                                         @endif
@@ -909,6 +932,7 @@
             localStorage.setItem("filterTo", filterTo);
 
             $('#tablesaw-350').DataTable({
+                searching: false,
                 ajax: '/get_record_in?filterCommercial=' + filterCommercial + "&filterMember=" + filterMember + "&filterPaymentMethod=" + filterPaymentMethod + "&filterCausals=" + filterCausals + "&filterFrom=" + filterFrom + "&filterTo=" + filterTo,
                 columns: [
                     //{ data: 'id' },
@@ -933,6 +957,7 @@
                     { data: 'commercial' },
                     { data: 'causals' },
                     { data: 'payment' },
+                    { data: 'status' },
                     {
                         data: "action",
                         render: function (data){
@@ -940,9 +965,13 @@
                                 return "";
                             const j = data.split("|");
                             $(".totalDiv").html('Totale&nbsp;:&nbsp;<b>' + j[1] + '</b>');
-                            var ret = '<button type="button" class="btn btn-outline-primary btn-sm" onclick="editData(' + j[0] + ')">Modifica</button>&nbsp;';
-                            ret += '<button type="button" class="btn btn-outline-danger btn-sm" onclick="deleteData(' + j[0] + ')">Elimina</button>';
-                            ret += '<button type="button" class="btn btn-outline-default btn-sm" onclick="duplicateData(' + j[0] + ')">Duplica</button>';
+                            var ret = '';
+                            if (j[2] != 'x')
+                            {
+                                ret = '<button type="button" class="btn btn-outline-primary btn-sm" onclick="editData(' + j[0] + ')">Modifica</button>&nbsp;';
+                                ret += '<button type="button" class="btn btn-outline-danger btn-sm" onclick="deleteData(' + j[0] + ')">Annulla pagamento</button>';
+                                ret += '<button type="button" class="btn btn-outline-default btn-sm" onclick="duplicateData(' + j[0] + ')">Duplica</button>';
+                            }
                             return ret;
                         }
                     },
@@ -1000,9 +1029,14 @@
         Livewire.on('setEdit', (x) =>
         {
             isEdit = x;
-            console.log(isEdit);
         });
 
+        Livewire.on('reload', (x) =>
+        {
+            location.reload();
+        });
+
+
         window.onbeforeunload = function(){
             if (isEdit)
                 return 'Cambiando pagina le eventuali modifiche andranno perse';

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

@@ -757,6 +757,7 @@
             console.log("/get_record_out?filterSupplier=" + filterSupplier + "&filterPaymentMethod=" + filterPaymentMethod + "&filterCausals=" + filterCausals + "&filterFrom=" + filterFrom + "&filterTo=" + filterTo);
 
             $('#tablesaw-350').DataTable({
+                searching: false,
                 ajax: "/get_record_out?filterSupplier=" + filterSupplier + "&filterPaymentMethod=" + filterPaymentMethod + "&filterCausals=" + filterCausals + "&filterFrom=" + filterFrom + "&filterTo=" + filterTo,
                 columns: [
                     {

+ 43 - 29
resources/views/livewire/settings.blade.php

@@ -10,6 +10,7 @@
 
 
     <div class="container">
+        <h4>Generale</h4>
         <div class="row">
             <div class="col-md-3 p-3">
                 <a href="/categories" class="nav-link d-flex align-items-center">
@@ -17,8 +18,8 @@
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/courses" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Corsi</span>
+                <a href="/disciplines" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Discipline</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
@@ -26,71 +27,84 @@
                     <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Tessere</span>
                 </a>
             </div>
+        </div>
+        <br>
+        <h4>Pagamenti</h4>
+        <div class="row">
             <div class="col-md-3 p-3">
-                <a href="/disciplines" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Discipline</span>
+                <a href="/banks" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Banche</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/nations_list" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Nazioni</span>
+                <a href="/causals" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Causali</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/provinces" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Province</span>
+                <a href="/vats" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">IVA</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/cities" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Comuni</span>
+                <a href="/payment_methods" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Metodi di pagamento</span>
                 </a>
             </div>
+        </div>
+        <br>
+        <h4>Corsi</h4>
+        <div class="row">
             <div class="col-md-3 p-3">
-                <a href="/banks" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Banche</span>
+                <a href="/course_subscriptions" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Abbonamenti</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/payment_methods" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Metodi di pagamento</span>
+                <a href="/courses" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Corsi</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/causals" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Causali</span>
+                <a href="/course_durations" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Durata</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/vats" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">IVA</span>
+                <a href="/course_frequencies" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Frequenze</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/course_types" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Tipologie corsi</span>
+                <a href="/course_levels" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Livelli</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/course_durations" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Durata corsi</span>
+                <a href="/course_types" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Tipologie</span>
                 </a>
             </div>
+            <!--
             <div class="col-md-3 p-3">
-                <a href="/course_subscriptions" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Abbonamenti corsi</span>
+                <a href="/nations_list" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Nazioni</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/course_levels" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Livelli corsi</span>
+                <a href="/provinces" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Province</span>
                 </a>
             </div>
             <div class="col-md-3 p-3">
-                <a href="/course_frequencies" class="nav-link d-flex align-items-center">
-                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Frequenze corsi</span>
+                <a href="/cities" class="nav-link d-flex align-items-center">
+                    <i class="ico--ui ico--ui_menu primanota"></i> <span class="ms-3 d-none d-md-inline">Comuni</span>
                 </a>
-            </div>
+            </div>-->
+
+
+
+
         </div>
     </div>
 

+ 3 - 1
routes/web.php

@@ -299,7 +299,8 @@ Route::get('/get_record_in', function(){
             'commercial' => $r->commercial ? 'SI' : 'NO',
             'causals' => $causals,
             'payment' => $r->payment_method->name,
-            'action' => $r->id . "|" . formatPrice($total)
+            'status' => $r->deleted ? 'Annullato' : '',
+            'action' => $r->id . "|" . formatPrice($total) . "|" . ($r->deleted ? 'x' : '')
         );
 
 
@@ -314,6 +315,7 @@ Route::get('/get_record_in', function(){
         'commercial' => '',
         'causals' => '',
         'payment' => '',
+        'status' => '',
         'action' => ''
     );