Forráskód Böngészése

causals - modifiche colori tasti + global hidden causal + default causals display only

ferrari 3 hete
szülő
commit
87c9017a99

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

@@ -153,7 +153,7 @@ class Course extends Component
         $this->course_levels = \App\Models\CourseLevel::select('*')->where('enabled', true)->get();
         $this->course_subscriptions = \App\Models\CourseSubscription::select('*')->where('enabled', true)->orderBy('name', 'asc')->get();
         $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->get();
-        $this->causals = \App\Models\Causal::select('*')->where('type', 'IN')->where('enabled', true)->get();
+        $this->causals = \App\Models\Causal::select('*')->where('type', 'IN')->where('enabled', true)->where('hidden', false)->get();
         $this->instructors = \App\Models\User::select('*')->where('level', 2)->get();
 
         $this->course_years = \App\Models\Course::select('year')->where('year', '<>', '')->groupBy('year')->pluck('year');

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

@@ -594,7 +594,7 @@ class Member extends Component
 
         $this->getCategories(\App\Models\Category::select('id', 'name')->where('parent_id', null)->orderBy('name')->get(), 0);
 
-        $c = \App\Models\Causal::where('type', 'IN')->where('money', true)->first();
+        $c = \App\Models\Causal::where('type', 'IN')->where('money', true)->where('hidden', false)->first();
         if ($c)
             $this->causalId = $c->id;
 

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

@@ -88,7 +88,7 @@ class Record extends Component
 
         $this->exportEmailSubject = 'Prima Nota - Export del ' . date('d/m/Y');
 
-        $this->getCausals(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->get(), 0);
+        $this->getCausals(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('hidden', false)->get(), 0);
 
         $this->members = \App\Models\Member::select(['id', 'first_name', 'last_name', 'fiscal_code'])
             ->where(function ($query) {
@@ -162,10 +162,10 @@ class Record extends Component
             $causals = array();
             foreach ($this->filterCausals as $z) {
                 $causals[] = $z;
-                $childs = \App\Models\Causal::where('parent_id', $z)->get();
+                $childs = \App\Models\Causal::where('parent_id', $z)->where('hidden', false)->get();
                 foreach ($childs as $c) {
                     $causals[] = $c->id;
-                    $childsX = \App\Models\Causal::where('parent_id', $c->id)->get();
+                    $childsX = \App\Models\Causal::where('parent_id', $c->id)->where('hidden', false)->get();
                     foreach ($childsX as $cX) {
                         $causals[] = $cX->id;
                     }
@@ -402,10 +402,10 @@ class Record extends Component
             $causals = array();
             foreach ($this->filterCausals as $z) {
                 $causals[] = $z;
-                $childs = \App\Models\Causal::where('parent_id', $z)->get();
+                $childs = \App\Models\Causal::where('parent_id', $z)->where('hidden', false)->get();
                 foreach ($childs as $c) {
                     $causals[] = $c->id;
-                    $childsX = \App\Models\Causal::where('parent_id', $c->id)->get();
+                    $childsX = \App\Models\Causal::where('parent_id', $c->id)->where('hidden', false)->get();
                     foreach ($childsX as $cX) {
                         $causals[] = $cX->id;
                     }
@@ -664,10 +664,10 @@ class Record extends Component
             $causals = array();
             foreach ($this->filterCausals as $z) {
                 $causals[] = $z;
-                $childs = \App\Models\Causal::where('parent_id', $z)->get();
+                $childs = \App\Models\Causal::where('parent_id', $z)->where('hidden', false)->get();
                 foreach ($childs as $c) {
                     $causals[] = $c->id;
-                    $childsX = \App\Models\Causal::where('parent_id', $c->id)->get();
+                    $childsX = \App\Models\Causal::where('parent_id', $c->id)->where('hidden', false)->get();
                     foreach ($childsX as $cX) {
                         $causals[] = $cX->id;
                     }
@@ -1163,10 +1163,10 @@ class Record extends Component
             $causals = array();
             foreach ($this->filterCausals as $z) {
                 $causals[] = $z;
-                $childs = \App\Models\Causal::where('parent_id', $z)->get();
+                $childs = \App\Models\Causal::where('parent_id', $z)->where('hidden', false)->get();
                 foreach ($childs as $c) {
                     $causals[] = $c->id;
-                    $childsX = \App\Models\Causal::where('parent_id', $c->id)->get();
+                    $childsX = \App\Models\Causal::where('parent_id', $c->id)->where('hidden', false)->get();
                     foreach ($childsX as $cX) {
                         $causals[] = $cX->id;
                     }

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

@@ -403,8 +403,13 @@ class RecordIN extends Component
     {
         foreach ($records as $record) {
             $this->causals[] = array('id' => $record->id, 'name' => $record->getTree(), 'text' => $record->getTree(), 'level' => $indentation);
-            if (count($record->childs))
-                $this->getCausale($record->childs, $indentation + 1);
+            if (count($record->childs)) {
+                $childs = $record->childs;
+                foreach ($childs as $index => $child) {
+                    if ($child->hidden) unset($childs[$index]);
+                }
+                $this->getCausale($childs, $indentation + 1);
+            }
         }
     }
 
@@ -444,7 +449,7 @@ class RecordIN extends Component
         if ($fisc)
             $this->corrispettivo_causal_id = $fisc->id;
 
-        $this->getCausale(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'IN')->get(), 0);
+        $this->getCausale(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'IN')->where('hidden', false)->get(), 0);
 
         $this->getCourses(\App\Models\Course::where('parent_id', null)->get(), 0);
         $this->getSubscriptions(\App\Models\Subscription::get(), 0);

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

@@ -85,12 +85,12 @@ class RecordINOUT extends Component
         $this->year_2 = date("Y");
         $this->show_block_2 = false;
 
-        $this->getCausale(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'IN')->whereNotIn('id', $this->excludeCausals)->get(), 'IN', 0);
-        $this->getCausale(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'OUT')->whereNotIn('id', $this->excludeCausals)->get(), 'OUT', 0);
+        $this->getCausale(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'IN')->where('hidden', false)->whereNotIn('id', $this->excludeCausals)->get(), 'IN', 0);
+        $this->getCausale(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'OUT')->where('hidden', false)->whereNotIn('id', $this->excludeCausals)->get(), 'OUT', 0);
 
-        $this->getCausalsIn(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'IN')->get(), 0);
+        $this->getCausalsIn(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'IN')->where('hidden', false)->get(), 0);
 
-        $this->getCausalsOut(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'OUT')->get(), 0);
+        $this->getCausalsOut(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'OUT')->where('hidden', false)->get(), 0);
 
         //$this->causalsIn = \App\Models\Causal::where('parent_id', null)->where('type', 'IN')->whereNotIn('id', $this->excludeCausals)->get();
         //$this->causalsOut = \App\Models\Causal::where('parent_id', null)->where('type', 'OUT')->whereNotIn('id', $this->excludeCausals)->get();
@@ -143,13 +143,13 @@ class RecordINOUT extends Component
             $aChilds[] = $first_parent_id;
         }
 
-        $childs = \App\Models\Causal::where('parent_id', $id)->get();
+        $childs = \App\Models\Causal::where('parent_id', $id)->where('hidden', false)->get();
         foreach ($childs as $child) {
             $aChilds[] = $child->id;
-            $childs2 = \App\Models\Causal::where('parent_id', $child->id)->get();
+            $childs2 = \App\Models\Causal::where('parent_id', $child->id)->where('hidden', false)->get();
             foreach ($childs2 as $child2) {
                 $aChilds[] = $child2->id;
-                $childs3 = \App\Models\Causal::where('parent_id', $child2->id)->get();
+                $childs3 = \App\Models\Causal::where('parent_id', $child2->id)->where('hidden', false)->get();
                 foreach ($childs3 as $child3) {
                     $aChilds[] = $child3->id;
                 }

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

@@ -221,7 +221,7 @@ class RecordOUT extends Component
 
         $this->causals = array();
 
-        $this->getCausale(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'OUT')->orderBy('name')->get(), 0);
+        $this->getCausale(\App\Models\Causal::select('id', 'name')->where('parent_id', null)->where('type', 'OUT')->where('hidden', false)->orderBy('name')->get(), 0);
 
         $this->suppliers = \App\Models\Supplier::select('name', 'id')->orderBy('name')->get();
         $this->payments = \App\Models\PaymentMethod::select('id', 'name')->whereIn('type', array('ALL', 'OUT'))->where('enabled', true)->orderBy('name')->get();
@@ -241,7 +241,7 @@ class RecordOUT extends Component
 
     public function loadImportCausals()
     {
-        $causals = \App\Models\Causal::select('id', 'name', 'parent_id')
+        $causals = \App\Models\Causal::select('id', 'name', 'parent_id')->where('hidden', false)
             ->where('type', 'OUT')
             ->orderBy('name')
             ->get();

+ 8 - 0
public/css/new_style.css

@@ -1390,3 +1390,11 @@ button.download-png {
 .dt-paging-button.page-item .page-link.last {
     padding-left: 5px;
 }
+
+body .btn--ui.btn-sm {
+    padding-block: 0.25rem !important;
+    padding-inline: 0.5rem !important;
+    height: unset !important;
+    font-weight: normal;
+    text-transform: none;
+}

+ 13 - 11
resources/views/livewire/causal.blade.php

@@ -49,13 +49,15 @@
                             <td>{{$record->type == 'IN' ? 'Entrata' : '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-success btn-sm" wire:click="addLevel({{ $record->id }})">Aggiungi livello</button>
-                                <button type="button" class="btn btn-outline-success btn-sm" wire:click="duplicate({{ $record->id }})">Duplica</button>
-                                <button type="button" class="btn" wire:click="edit({{ $record->id }})" data-bs-toggle="popover"  data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>
-                                @if($record->hidden)
-                                    <button type="button" class="btn" wire:click="show({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Ripristina"><i class="fa-regular fa-eye"></i></button>
-                                @else
-                                    <button type="button" class="btn" onclick="confirm('Sei sicuro di voler nascondere questo elemento?') || event.stopImmediatePropagation()" wire:click="hide({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Nascondi"><i class="fa-regular fa-eye-slash"></i></button>
+                                @if (!in_array($record->name, ['PAGAMENTO CORSO', 'PAGAMENTO ISCRIZIONE', 'PAGAMENTO ABBONAMENTO']))
+                                    <button type="button" class="btn btn--ui btn-sm" wire:click="addLevel({{ $record->id }})">Aggiungi livello</button>
+                                    <button type="button" class="btn btn--ui btn-sm" wire:click="duplicate({{ $record->id }})">Duplica</button>
+                                    <button type="button" class="btn" wire:click="edit({{ $record->id }})" data-bs-toggle="popover"  data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>
+                                    @if($record->hidden)
+                                        <button type="button" class="btn" wire:click="show({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Ripristina"><i style="color: #3b994b" class="fa-regular fa-eye"></i></button>
+                                    @else
+                                        <button type="button" class="btn" onclick="confirm('Sei sicuro di voler nascondere questo elemento?') || event.stopImmediatePropagation()" wire:click="hide({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Nascondi"><i style="color: #be2828" class="fa-regular fa-eye-slash"></i></button>
+                                    @endif
                                 @endif
                             </td>
                         </tr>
@@ -102,13 +104,13 @@
                                 </span>
                             </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-success btn-sm" wire:click="duplicate({{ $record->id }})">Duplica</button>
+                                <button type="button" class="btn btn--ui btn-sm" wire:click="addLevel({{ $record->id }})">Aggiungi livello</button>
+                                <button type="button" class="btn btn--ui btn-sm" wire:click="duplicate({{ $record->id }})">Duplica</button>
                                 <button type="button" class="btn" wire:click="edit({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>
                                 @if($record->hidden)
-                                    <button type="button" class="btn" wire:click="show({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Ripristina"><i class="fa-regular fa-eye"></i></button>
+                                    <button type="button" class="btn" wire:click="show({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Mostra"><i style="color: #3b994b" class="fa-regular fa-eye"></i></button>
                                 @else
-                                    <button type="button" class="btn" onclick="confirm('Sei sicuro di voler nascondere questo elemento?') || event.stopImmediatePropagation()" wire:click="hide({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Nascondi"><i class="fa-regular fa-eye-slash"></i></button>
+                                    <button type="button" class="btn" onclick="confirm('Sei sicuro di voler nascondere questo elemento?') || event.stopImmediatePropagation()" wire:click="hide({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Nascondi"><i style="color: #be2828" class="fa-regular fa-eye-slash"></i></button>
                                 @endif
                                 </td>
                         </tr>

+ 5 - 5
resources/views/livewire/causal_child.blade.php

@@ -11,14 +11,14 @@
                 </span>
             </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-success btn-sm" wire:click="duplicate({{ $record->id }})">Duplica</button>
-                <button type="button" class="btn btn-sm" wire:click="edit({{ $record->id }})"><i class="fa-regular fa-pen-to-square"></i></button>
+                <button type="button" class="btn btn--ui btn-sm" wire:click="addLevel({{ $record->id }})">Aggiungi livello</button>
+                <button type="button" class="btn btn--ui btn-sm" wire:click="duplicate({{ $record->id }})">Duplica</button>
+                <button type="button" class="btn" wire:click="edit({{ $record->id }})"><i class="fa-regular fa-pen-to-square"></i></button>
 
                 @if($record->hidden)
-                    <button type="button" class="btn btn-sm" wire:click="show({{ $record->id }})"><i class="fa-regular fa-eye"></i></button>
+                    <button type="button" class="btn" data-bs-content="Mostra" wire:click="show({{ $record->id }})"><i style="color: #3b994b" class="fa-regular fa-eye"></i></button>
                 @else
-                    <button type="button" class="btn btn-sm" onclick="confirm('Sei sicuro di voler nascondere questo elemento?') || event.stopImmediatePropagation()" wire:click="hide({{ $record->id }})"><i class="fa-regular fa-eye-slash"></i></button>
+                    <button type="button" class="btn" data-bs-content="Nascondi" onclick="confirm('Sei sicuro di voler nascondere questo elemento?') || event.stopImmediatePropagation()" wire:click="hide({{ $record->id }})"><i style="color: #be2828" class="fa-regular fa-eye-slash"></i></button>
                 @endif
             </td>
         </tr>

+ 4 - 4
routes/web.php

@@ -969,10 +969,10 @@ Route::group(['middleware' => 'tenant'], function () {
 
             // Per ogni causale, se ha dei figli allora aggiungo le causali figlio
             foreach ($causals as $c) {
-                $childs = \App\Models\Causal::where('parent_id', $c)->get();
+                $childs = \App\Models\Causal::where('parent_id', $c)->where('hidden', false)->get();
                 foreach ($childs as $cc) {
                     $causals[] = $cc->id;
-                    $childss = \App\Models\Causal::where('parent_id', $cc->id)->get();
+                    $childss = \App\Models\Causal::where('parent_id', $cc->id)->where('hidden', false)->get();
                     foreach ($childss as $ccc) {
                         $causals[] = $ccc->id;
                     }
@@ -1187,10 +1187,10 @@ Route::group(['middleware' => 'tenant'], function () {
 
             // Per ogni causale, se ha dei figli allora aggiungo le causali figlio
             foreach ($causals as $c) {
-                $childs = \App\Models\Causal::where('parent_id', $c)->get();
+                $childs = \App\Models\Causal::where('parent_id', $c)->where('hidden', false)->get();
                 foreach ($childs as $cc) {
                     $causals[] = $cc->id;
-                    $childss = \App\Models\Causal::where('parent_id', $cc->id)->get();
+                    $childss = \App\Models\Causal::where('parent_id', $cc->id)->where('hidden', false)->get();
                     foreach ($childss as $ccc) {
                         $causals[] = $ccc->id;
                     }