Ver Fonte

Gestione categorie

Luca Parisio há 2 anos atrás
pai
commit
39ca49eb54

+ 31 - 22
app/Http/Livewire/Category.php

@@ -6,7 +6,7 @@ use Livewire\Component;
 
 class Category extends Component
 {
-    public $categories, $parent_id, $name, $enabled, $dataId, $updateCategory = false, $addCategory = false;
+    public $records, $parent_id, $name, $enabled, $dataId, $update = false, $add = false;
 
     protected $rules = [
         'name' => 'required'
@@ -18,42 +18,51 @@ class Category extends Component
 
     public function resetFields(){
         $this->name = '';
+        $this->parent_id = null;
         $this->enabled = true;
     }
 
     public function render()
     {
-        $this->categories = Category::where('parent_id', null)->get();
+        $this->records = \App\Models\Category::where('parent_id', null)->get();
         return view('livewire.category');
     }
 
-    public function addCategory()
+    public function add()
     {
         $this->resetFields();
-        $this->addCategory = true;
-        $this->updateCategory = false;
+        $this->add = true;
+        $this->update = false;
     }
 
-    public function storeCategory()
+    public function addLevel($parent_id)
+    {
+        $this->resetFields();
+        $this->parent_id = $parent_id;
+        $this->add = true;
+        $this->update = false;
+    }
+
+    public function store()
     {
         $this->validate();
         try {
-            Category::create([
+            \App\Models\Category::create([
                 'name' => $this->name,
-                'parent' => $this->parent_id,
+                'parent_id' => $this->parent_id,
                 'enabled' => $this->enabled
             ]);
             session()->flash('success','Categoria creata');
             $this->resetFields();
-            $this->addCategory = false;
+            $this->add = false;
         } catch (\Exception $ex) {
             session()->flash('error','Errore in fase di salvataggio');
         }
     }
 
-    public function editCategory($id){
+    public function edit($id){
         try {
-            $category = Category::findOrFail($id);
+            $category = \App\Models\Category::findOrFail($id);
             if( !$category) {
                 session()->flash('error','Categoria non trovata');
             } else {
@@ -61,42 +70,42 @@ class Category extends Component
                 $this->enabled = $category->enabled;
                 $this->parent_id = $category->parent_id;
                 $this->dataId = $category->id;
-                $this->updateCategory = true;
-                $this->addCategory = false;
+                $this->update = true;
+                $this->add = false;
             }
         } catch (\Exception $ex) {
             session()->flash('error','Errore');
         }
     }
 
-    public function updateCategory()
+    public function update()
     {
         $this->validate();
         try {
-            Category::whereId($this->dataId)->update([
+            \App\Models\Category::whereId($this->dataId)->update([
                 'name' => $this->name,
-                'parent' => $this->parent_id,
+                'parent_id' => $this->parent_id,
                 'enabled' => $this->enabled
             ]);
             session()->flash('success','Categoria aggiornata');
             $this->resetFields();
-            $this->updateCategory = false;
+            $this->update = false;
         } catch (\Exception $ex) {
             session()->flash('success','Errore');
         }
     }
 
-    public function cancelCategory()
+    public function cancel()
     {
-        $this->addCategory = false;
-        $this->updateCategory = false;
+        $this->add = false;
+        $this->update = false;
         $this->resetFields();
     }
 
-    public function deleteCategory($id)
+    public function delete($id)
     {
         try{
-            Category::find($id)->delete();
+            \App\Models\Category::find($id)->delete();
             session()->flash('success',"Categoria eliminata");
         }catch(\Exception $e){
             session()->flash('error',"Errore");

+ 107 - 0
app/Http/Livewire/Causal.php

@@ -0,0 +1,107 @@
+<?php
+
+namespace App\Http\Livewire;
+
+use Livewire\Component;
+
+class Causal extends Component
+{
+    public $records, $name, $enabled, $type, $dataId, $update = false, $add = false;
+
+    protected $rules = [
+        'name' => 'required',
+        'type' => 'required'
+    ];
+
+    protected $messages = [
+        'name.required' => 'Il nome è obbligatorio'
+    ];
+
+    public function resetFields(){
+        $this->name = '';
+        $this->type = null;
+        $this->enabled = true;
+    }
+
+    public function render()
+    {
+        $this->records = \App\Models\Causal::get();
+        return view('livewire.causal');
+    }
+
+    public function add()
+    {
+        $this->resetFields();
+        $this->add = true;
+        $this->update = false;
+    }
+
+    public function store()
+    {
+        $this->validate();
+        try {
+            \App\Models\Causal::create([
+                'name' => $this->name,
+                'type' => $this->type,
+                'enabled' => $this->enabled
+            ]);
+            session()->flash('success','Categoria creata');
+            $this->resetFields();
+            $this->add = false;
+        } catch (\Exception $ex) {
+            session()->flash('error','Errore');
+        }
+    }
+
+    public function edit($id){
+        try {
+            $causal = \App\Models\Causal::findOrFail($id);
+            if( !$causal) {
+                session()->flash('error','Categoria non trovata');
+            } else {
+                $this->name = $causal->name;
+                $this->enabled = $causal->enabled;
+                $this->type = $causal->type;
+                $this->dataId = $causal->id;
+                $this->update = true;
+                $this->add = false;
+            }
+        } catch (\Exception $ex) {
+            session()->flash('error','Errore');
+        }
+    }
+
+    public function update()
+    {
+        $this->validate();
+        try {
+            \App\Models\Causal::whereId($this->dataId)->update([
+                'name' => $this->name,
+                'type' => $this->type,
+                'enabled' => $this->enabled
+            ]);
+            session()->flash('success','Tessera aggiornata');
+            $this->resetFields();
+            $this->update = false;
+        } catch (\Exception $ex) {
+            session()->flash('success','Errore');
+        }
+    }
+
+    public function cancel()
+    {
+        $this->add = false;
+        $this->update = false;
+        $this->resetFields();
+    }
+
+    public function delete($id)
+    {
+        try{
+            \App\Models\Causal::find($id)->delete();
+            session()->flash('success',"Tessera eliminata");
+        }catch(\Exception $e){
+            session()->flash('error',"Errore");
+        }
+    }
+}

+ 52 - 3
app/Http/Livewire/Member.php

@@ -9,6 +9,7 @@ class Member extends Component
     public $records, $first_name, $last_name, $status, $birth_city_id, $birth_province_id, $birth_nation_id, $birth_date, $gender, $fiscal_code, $address, $zip_code, $nation_id, $province_id, $city_id, $phone, $email, $enabled, $dataId, $update = false, $add = false;
 
     public $cards = array();
+    public $categories = array();
     public $nations = array();
     public $provinces = array();
     public $cities = array();
@@ -68,10 +69,28 @@ class Member extends Component
         $this->certificate_status = 0;
     }
 
+    public function resetCategoryFields(){
+        $this->category_category_id = null;
+    }
+
+    public function getCategories($records, $indentation)
+    {
+        foreach($records as $record)
+        {
+            $this->categories[] = array('id' => $record->id, 'name' => str_repeat(" -> ", $indentation) . $record->name);
+            if(count($record->childs))
+                $this->getCategories($record->childs, $indentation + 1);
+        }
+    }
+
     public function mount()
     {
         $this->cards = \App\Models\Card::select('id', 'name')->get();
 
+        $this->categories = array();
+
+        $this->getCategories(\App\Models\Category::select('id', 'name')->where('parent_id', null)->get(), 0);
+
         $this->nations = \App\Models\Nation::select('id', 'name')->get();
         $this->provinces = array();
         $this->cities = array();
@@ -107,25 +126,26 @@ class Member extends Component
     {
         $this->records = \App\Models\Member::select('id', 'first_name', 'last_name', 'status', 'enabled')->get();
         $this->loadMemberCards();
+        $this->loadMemberCategories();
         return view('livewire.member');
     }
 
     public function loadMemberCards()
     {
         $this->member_cards = \App\Models\MemberCard::where('member_id', $this->dataId)->get();
-        return view('livewire.member');
+        // return view('livewire.member');
     }
 
     public function loadMemberCategories()
     {
         $this->member_categories = \App\Models\MemberCategory::where('member_id', $this->dataId)->get();
-        return view('livewire.member');
+        // return view('livewire.member');
     }
 
     public function loadMemberCertificates()
     {
         $this->member_certificates = \App\Models\MemberCertificate::where('member_id', $this->dataId)->get();
-        return view('livewire.member');
+        // return view('livewire.member');
     }
 
     public function add()
@@ -431,5 +451,34 @@ class Member extends Component
         }
     }
 
+    // Gruppi di appartenenza
+
+    public function storeCategory()
+    {
+
+        $this->validate(['category_category_id' => 'required']);
+        try {
+            \App\Models\MemberCategory::create([
+                'member_id' => $this->dataId,
+                'category_id' => $this->category_category_id,
+                'date' => \Carbon\Carbon::now()
+            ]);
+            session()->flash('success, Associazione creato');
+            $this->resetCategoryFields();
+            $this->addCard = false;
+        } catch (\Exception $ex) {
+            session()->flash('error','Errore in fase di salvataggio');
+        }
+    }
+
+    public function deleteCategory($id)
+    {
+        try{
+            \App\Models\MemberCategory::find($id)->delete();
+            session()->flash('success',"Associazione eliminata");
+        }catch(\Exception $e){
+            session()->flash('error',"Errore");
+        }
+    }
 
 }

+ 35 - 0
app/Models/Category.php

@@ -20,4 +20,39 @@ class Category extends Model
         return $this->belongsTo(Category::class);
     }
 
+    public function childs() {
+        return $this->hasMany(\App\Models\Category::class,'parent_id','id') ;
+    }
+
+    public function getTree()
+    {
+        $str = '';
+        if ($this->parent_id != null)
+        {
+            $a = $this->recursiveName($this->parent_id, array($this->name));
+            $a = array_reverse($a);
+            $str = implode(" - ", $a);
+        }
+        else
+        {
+            $str = $this->name;
+        }
+        return $str;
+    }
+
+    public function recursiveName($parent_id, $array)
+    {
+        $x = \App\Models\Category::findOrFail($parent_id);
+        $array[] = $x->name;
+
+        if ($x->parent_id != null)
+        {
+            return $this->recursiveName($x->parent_id, $array);
+        }
+        else
+        {
+            return $array;
+        }
+    }
+
 }

+ 2 - 1
app/Models/MemberCategory.php

@@ -11,7 +11,8 @@ class MemberCategory extends Model
 
     protected $fillable = [
         'member_id',
-        'category_id'
+        'category_id',
+        'date'
     ];
 
     public function member()

+ 1 - 0
database/migrations/2023_03_20_212926_create_member_categories_table.php

@@ -19,6 +19,7 @@ return new class extends Migration
             $table->foreign('member_id')->nullable()->references('id')->on('members')->onUpdate('cascade')->onDelete('cascade');
             $table->unsignedBigInteger('category_id');
             $table->foreign('category_id')->nullable()->references('id')->on('categories')->onUpdate('cascade')->onDelete('cascade');
+            $table->date('date');
             $table->timestamps();
         });
     }

+ 1 - 1
resources/views/layouts/app.blade.php

@@ -31,7 +31,7 @@
                         </a>
                     </li>
                     <li class="nav-item fornitori">
-                        <a href="#" class="nav-link d-flex align-items-center">
+                        <a href="/suppliers" class="nav-link d-flex align-items-center">
                             <i class="ico--ui ico--ui_menu fornitori"></i> <span class="ms-3 d-none d-md-inline">Fornitori</span>
                         </a>
                     </li>

+ 87 - 1
resources/views/livewire/category.blade.php

@@ -1,3 +1,89 @@
 <div>
-    {{-- In work, do what you enjoy. --}}
+
+    <header id="title--section" class="d-flex align-items-center justify-content-between">
+        <div class="title--section_name d-flex align-items-center justify-content-between">
+            <i class="ico--ui title_section utenti me-2"></i>
+            <h2 class="primary">@if(!$add && !$update)Elenco Categorie @else Inserimento/modifica categoria @endif</h2>
+        </div>
+
+        @if(!$add && !$update)
+            <div class="title--section_addButton">
+                <div class="card--ui card--ui_btnAddHeaderUser entrata d-flex justify-items-between">
+                    <header class="d-flex justify-content-between"><div class="card-title d-flex align-items-start"><h2>Aggiungi&nbsp;&nbsp;&nbsp;</h2></div><a href="#" wire:click="add()"><i class="ico--ui big add primary"></i></a></header>
+                </div>
+            </div>
+        @endif
+
+    </header>
+
+
+    @if(!$add && !$update)
+
+
+        <section id="resume-table">
+            <div class="compare--chart_wrapper d-none"></div>
+
+            <table class="table tablesaw tablesaw-stack" data-tablesaw="" id="tablesaw-350">
+                <thead>
+                    <tr>
+                        <th scope="col">Nome</th>
+                        <th scope="col">...</th>
+                    </tr>
+                </thead>
+                <tbody id="checkall-target">
+                    @foreach($records as $record)
+                        <tr>
+                            <td>{{$record->name}}</td>
+                            <td>
+                                <button type="button" class="btn btn-outline-success btn-sm" wire:click="addLevel({{ $record->id }})">Aggiungi livello</button>
+                                <button type="button" class="btn btn-outline-primary btn-sm" wire:click="edit({{ $record->id }})">Modifica</button>
+                                <button type="button" class="btn btn-outline-danger btn-sm" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="delete({{ $record->id }})">Elimina</button>
+                            </td>
+                        </tr>
+                        @if(count($record->childs))
+                            @include('livewire/category_child',['records' => $record->childs, 'indentation' => 1])
+                        @endif
+                    @endforeach
+
+                </tbody>
+            </table>
+
+        </section>
+
+    @else
+
+        <div class="container">
+            <div class="row">
+                <div class="col">
+
+                    <form action="">
+
+                        <div class="row mb-3">
+                            <div class="col">
+                                <div class="form--item">
+                                    <label for="inputName" class="form-label">Nome</label>
+                                    <input class="form-control js-keyupTitle @error('name') is-invalid @enderror" type="text" id="name" placeholder="Nome" wire:model="name">
+                                    @error('name')
+                                        <div class="invalid-feedback">{{ $message }}</div>
+                                    @enderror
+                                </div>
+                            </div>
+                        </div>
+
+                        <div class="form--item">
+                            @if($add)
+                                <button type="submit" class="btn--ui" wire:click.prevent="store()">Salva</button>
+                            @endif
+                            @if($update)
+                                <button type="submit" class="btn--ui" wire:click.prevent="update()">Salva</button>
+                            @endif
+                            <button type="button" class="btn--ui lightGrey" wire:click="cancel()">Annulla</button>
+                        </div>
+
+                    </form>
+                </div>
+            </div>
+        </div>
+
+    @endif
 </div>

+ 13 - 0
resources/views/livewire/category_child.blade.php

@@ -0,0 +1,13 @@
+@foreach($records as $record)
+    <tr>
+        <td>{!! str_repeat("&nbsp;", $indentation * 5) !!} {{$record->name}}</td>
+        <td>
+            <button type="button" class="btn btn-outline-success btn-sm" wire:click="addLevel({{ $record->id }})">Aggiungi livello</button>
+            <button type="button" class="btn btn-outline-primary btn-sm" wire:click="edit({{ $record->id }})">Modifica</button>
+            <button type="button" class="btn btn-outline-danger btn-sm" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="delete({{ $record->id }})">Elimina</button>
+        </td>
+    </tr>
+    @if(count($record->childs))
+        @include('livewire/category_child',['records' => $record->childs, 'indentation' => $indentation + 1])
+    @endif
+@endforeach

+ 108 - 0
resources/views/livewire/causal.blade.php

@@ -0,0 +1,108 @@
+<div>
+
+    <header id="title--section" class="d-flex align-items-center justify-content-between">
+        <div class="title--section_name d-flex align-items-center justify-content-between">
+            <i class="ico--ui title_section utenti me-2"></i>
+            <h2 class="primary">@if(!$add && !$update)Elenco causali @else Inserimento/modifica causale @endif</h2>
+        </div>
+
+        @if(!$add && !$update)
+            <div class="title--section_addButton">
+                <div class="card--ui card--ui_btnAddHeaderUser entrata d-flex justify-items-between">
+                    <header class="d-flex justify-content-between"><div class="card-title d-flex align-items-start"><h2>Aggiungi&nbsp;&nbsp;&nbsp;</h2></div><a href="#" wire:click="add()"><i class="ico--ui big add primary"></i></a></header>
+                </div>
+            </div>
+        @endif
+
+    </header>
+
+
+    @if(!$add && !$update)
+
+        <section id="resume-table">
+            <div class="compare--chart_wrapper d-none"></div>
+
+            <table class="table tablesaw tablesaw-stack" data-tablesaw="" id="tablesaw-350">
+                <thead>
+                    <tr>
+                        <th scope="col">Nome</th>
+                        <th scope="col">Tipologia</th>
+                        <th scope="col">Abilitato</th>
+                        <th scope="col">...</th>
+                    </tr>
+                </thead>
+                <tbody id="checkall-target">
+                    @foreach($records as $record)
+                        <tr>
+                            <td>{{$record->name}}</td>
+                            <td>{{$record->type == 'IN' ? 'Ingresso' : 'Uscita'}}</td>
+                            <td> <span class="tablesaw-cell-content"><span class="badge tessera-badge {{$record->enabled ? 'active' : 'suspended'}}">{{$record->enabled ? 'attivo' : 'disattivo'}}</span></span></td>
+                            <td>
+                                <button type="button" class="btn btn-outline-primary btn-sm" wire:click="edit({{ $record->id }})">Modifica</button>
+                                <button type="button" class="btn btn-outline-danger btn-sm" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="delete({{ $record->id }})">Elimina</button>
+                            </td>
+                        </tr>
+                    @endforeach
+
+                </tbody>
+            </table>
+
+        </section>
+
+    @else
+
+        <div class="container">
+            <div class="row">
+                <div class="col">
+
+                    <form action="">
+
+                        <div class="row mb-3">
+                            <div class="col">
+                                <div class="form--item">
+                                    <label for="inputName" class="form-label">Nome</label>
+                                    <input class="form-control js-keyupTitle @error('name') is-invalid @enderror" type="text" id="name" placeholder="Nome" wire:model="name">
+                                    @error('name')
+                                        <div class="invalid-feedback">{{ $message }}</div>
+                                    @enderror
+                                </div>
+                            </div>
+                        </div>
+
+                        <div class="row mb-3">
+                            <div class="col">
+                                <label for="next_month_expire" class="form-label">Tipologia</label>
+                                <select name="type" class="form-select  @error('type') is-invalid @enderror" aria-label="Seleziona una tipologia" wire:model="type">
+                                    <option value="">--Seleziona--
+                                    <option value="IN">Ingresso
+                                    <option value="OUT">Uscita
+                                </select>
+                            </div>
+                        </div>
+
+                        <div class="form--item mb-3">
+                            <div class="form-check form-check-inline">
+                                <input class="form-check-input" type="checkbox" id="enabled" wire:model="enabled">
+                                <label class="form-check-label" for="enabled">Abilitato</label>
+                            </div>
+                        </div>
+
+                        <!-- // inline input field -->
+
+                        <div class="form--item">
+                            @if($add)
+                                <button type="submit" class="btn--ui" wire:click.prevent="store()">Salva</button>
+                            @endif
+                            @if($update)
+                                <button type="submit" class="btn--ui" wire:click.prevent="update()">Salva</button>
+                            @endif
+                            <button type="button" class="btn--ui lightGrey" wire:click="cancel()">Annulla</button>
+                        </div>
+
+                    </form>
+                </div>
+            </div>
+        </div>
+
+    @endif
+</div>

+ 28 - 48
resources/views/livewire/member.blade.php

@@ -278,7 +278,7 @@
                                             <tr>
                                                 <td>{{$member_card->card->name}}</td>
                                                 <td>{{$member_card->number}}</td>
-                                                <td>{{$member_card->card_expire_date}}</td>
+                                                <td>{{$member_card->expire_date}}</td>
                                                 <td>
                                                     <button type="button" class="btn btn-outline-primary btn-sm" wire:click="editCard({{ $member_card->id }})">Modifica</button>
                                                     <button type="button" class="btn btn-outline-danger btn-sm" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCard({{ $member_card->id }})">Elimina</button>
@@ -329,12 +329,12 @@
 
                                 <br>
                                 @if($addCard)
-                                    <button class="btn--ui primary"wire:click.prevent="storeCard()">Salva</button>
+                                    <button class="btn--ui primary" wire:click.prevent="storeCard()">Salva</button>
                                 @endif
                                 @if($updateCard)
-                                    <button class="btn--ui primary"wire:click.prevent="updateCard()">Salva</button>
+                                    <button class="btn--ui primary" wire:click.prevent="updateCard()">Salva</button>
                                 @endif
-                                <button class="btn--ui primary"wire:click.prevent="cancelCard()">Annulla</button>
+                                <button class="btn--ui primary" wire:click.prevent="cancelCard()">Annulla</button>
 
                             @endif
                             <!--
@@ -383,55 +383,33 @@
 
                     <!-- TAB GRUPPI -->
                     <div class="tab-pane fade gruppi-tab" id="contact-tab-pane" role="tabpanel" aria-labelledby="contact-tab" tabindex="0" wire:ignore.self>
-                        <button class="tab--btn w-100 justify-content-between"><div class="tab--btn_name d-flex"><i class="ico--ui gruppi me-2"></i><span class="btn_title">nessun gruppo di appartenenza</span></div><i class="ico--ui big add primary"></i></button>
                         <form class="form--tesseramento mt-4">
 
-                        <div class="row g-3">
-
-                            <div class="col-auto">
-                                <select class="form-select" aria-label="Default select example">
-                                    <option selected="">Open this select menu</option>
-                                    <option value="1">One</option>
-                                    <option value="2">Two</option>
-                                    <option value="3">Three</option>
-                                </select>
-                            </div>
-                            <div class="col-auto">
-                                <select class="form-select" aria-label="Default select example">
-                                    <option selected="">Open this select menu</option>
-                                    <option value="1">One</option>
-                                    <option value="2">Two</option>
-                                    <option value="3">Three</option>
-                                </select>                                    </div>
-                            <div class="col-auto">
-                                <select class="form-select" aria-label="Default select example">
-                                    <option selected="">Open this select menu</option>
-                                    <option value="1">One</option>
-                                    <option value="2">Two</option>
-                                    <option value="3">Three</option>
-                                </select>                                    </div>
-                        </div>
-
                         <div class="tessera--added d-flex align-items-center justify-content-between mt-4 mb-3">
                             <div class="tessera--added_name d-flex align-items-start">
-                                <i class="ico--ui gruppi me-2"></i>
-                                <div class="title--tessera_added">
-                                    <h4>Tennis/Corso Tennis/Adulti/Bisettimanale</h4>
-                                    <span class="title-detail">Iscrizione: <span class="title-detail_date">12 marzo 2022</span></span></small>
-                                </div>
+                                <select id="category_category_id" class="form-select @error('category_category') is-invalid @enderror" aria-label="Gruppo" wire:model="category_category_id">
+                                    <option value="">--Seleziona--
+                                    @foreach($categories as $category)
+                                        <option value="{{$category["id"]}}">{{$category["name"]}}
+                                    @endforeach
+                                </select>
                             </div>
-                            <button class="btn--ui_outline"><i class="ico--ui gruppi"></i>aggiungi</button>
+                            <button class="btn--ui_outline" wire:click.prevent="storeCategory()"><i class="ico--ui gruppi"></i>aggiungi</button>
                         </div>
-                        <div class="tessera--added d-flex align-items-center justify-content-between mt-4 mb-3">
-                            <div class="tessera--added_name d-flex align-items-start">
-                                <i class="ico--ui gruppi me-2"></i>
-                                <div class="title--tessera_added">
-                                    <h4>Tennis/Corso Tennis/Adulti/Bisettimanale</h4>
-                                    <span class="title-detail">Iscrizione: <span class="title-detail_date">12 marzo 2022</span></span></small>
+
+                        @foreach($member_categories as $member_category)
+                            <div class="tessera--added d-flex align-items-center justify-content-between mt-4 mb-3">
+                                <div class="tessera--added_name d-flex align-items-start">
+                                    <i class="ico--ui gruppi me-2"></i>
+                                    <div class="title--tessera_added">
+                                        <h4>{{$member_category->category->getTree()}}</h4>
+                                        <span class="title-detail">Iscrizione: <span class="title-detail_date">{{$member_category->date}}</span></span></small>
+                                    </div>
                                 </div>
+                                <button type="button" class="btn btn-outline-danger btn-sm" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="deleteCategory({{ $member_category->id }})">Elimina</button>
                             </div>
-                            <button class="btn--ui_outline"><i class="ico--ui gruppi"></i>aggiungi</button>
-                        </div>
+                        @endforeach
+
                         </form>
                     </div>
                 </div>
@@ -486,9 +464,11 @@
                     </div>
                     <div class="resume--tab_info gruppi">
                         <h2 class="mb-3">Gruppi di appartenenza</h2>
-                        <div class="resume--info d-flex align-items-center">
-                            <i class="ico--ui gruppi me-2"></i><span><strong>Nessuna Tessera presente in archivio</strong></span>
-                        </div>
+                            @foreach($member_categories as $member_category)
+                                <div class="resume--info d-flex align-items-center">
+                                    <i class="ico--ui gruppi me-2"></i><span><strong>{{$member_category->category->getTree()}}</strong></span>
+                                </div>
+                            @endforeach
                         </div>
                 </div>
             </div>

+ 2 - 2
resources/views/livewire/supplier.blade.php

@@ -107,7 +107,7 @@
                         <div class="row mb-3">
                             <div class="col">
                                 <label for="nation_id" class="form-label">Nazione</label>
-                                <select name="nation_id" class="form-select" aria-label="Seleziona una nazione" wire:model="nation_id">
+                                <select name="nation_id" class="form-select" aria-label="Seleziona una nazione" wire:model="nation_id" wire:change="loadProvinces()">
                                     <option value="">--Seleziona--
                                     @foreach($nations as $nation)
                                         <option value="{{$nation->id}}">{{$nation->name}}
@@ -116,7 +116,7 @@
                             </div>
                             <div class="col">
                                 <label for="province_id" class="form-label">Provincia</label>
-                                <select name="province_id" class="form-select" aria-label="Seleziona una provincia" wire:model="province_id">
+                                <select name="province_id" class="form-select" aria-label="Seleziona una provincia" wire:model="province_id" wire:change="loadCities()">
                                     <option value="">--Seleziona--
                                     @foreach($provinces as $province)
                                         <option value="{{$province->id}}">{{$province->name}}

+ 3 - 0
routes/web.php

@@ -18,10 +18,13 @@ Route::get('/', function () {
 });
 
 Route::get('/settings', \App\Http\Livewire\Setting::class);
+Route::get('/categories', \App\Http\Livewire\Category::class);
 Route::get('/nations', \App\Http\Livewire\Nation::class);
 Route::get('/provinces', \App\Http\Livewire\Province::class);
 Route::get('/cities', \App\Http\Livewire\City::class);
 Route::get('/banks', \App\Http\Livewire\Bank::class);
 Route::get('/cards', \App\Http\Livewire\Card::class);
+Route::get('/causals', \App\Http\Livewire\Causal::class);
 Route::get('/payment_methods', \App\Http\Livewire\PaymentMethod::class);
 Route::get('/members', \App\Http\Livewire\Member::class);
+Route::get('/suppliers', \App\Http\Livewire\Supplier::class);