Преглед изворни кода

Merge branch 'iao_team' of http://host.webmagistri.biz:3000/parisio/iao_team into iao_team_ferrari

ferrari пре 5 месеци
родитељ
комит
9fbc9a6b70

+ 24 - 2
app/Http/Livewire/Calendar.php

@@ -44,7 +44,7 @@ class Calendar extends Component
         $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->get();
         $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->get();
         $this->courts = \App\Models\Court::select('*')->where('enabled', true)->get();
         $this->courts = \App\Models\Court::select('*')->where('enabled', true)->get();
         $this->instructors = \App\Models\User::select('*')->where('level', 2)->where('enabled', true)->get();
         $this->instructors = \App\Models\User::select('*')->where('level', 2)->where('enabled', true)->get();
-        $this->motivations = \App\Models\Motivation::select('*')->where('enabled', true)->get();
+        $this->motivations = \App\Models\Motivation::select('*')->where('enabled', true)->where('type', 'del')->get();
 
 
         if (isset($_GET["name_filter"]))
         if (isset($_GET["name_filter"]))
             $this->name_filter = $_GET["name_filter"];
             $this->name_filter = $_GET["name_filter"];
@@ -65,13 +65,35 @@ class Calendar extends Component
         foreach($calendars as $c)
         foreach($calendars as $c)
         {
         {
             $s = $c->motivation ? $c->motivation->name : '';
             $s = $c->motivation ? $c->motivation->name : '';
-            $data = array('id' => $c->id, 'title' => $c->course ? $c->course->name : $c->name . ($c->status == 99 ? ' (annullata - ' . $s . ')' : ''), 'start' => $c->from, 'end' => $c->to);
+            $data = array('id' => $c->id, 'title' => ($c->course ? $c->course->name : $c->name) . ($c->status == 99 ? ' (annullata - ' . $s . ')' : ''), 'start' => $c->from, 'end' => $c->to);
             if ($c->course && $c->course->color != '')
             if ($c->course && $c->course->color != '')
                 $data['color'] = $c->course->color;
                 $data['color'] = $c->course->color;
             if ($c->status == 99)
             if ($c->status == 99)
                 $data['color'] = "#808080";
                 $data['color'] = "#808080";
             $this->records[] = $data;
             $this->records[] = $data;
         }
         }
+
+        for ($anno = 2025; $anno <= 2040; $anno++) {
+
+            $color = "lightgrey";
+            $this->records[] = array('id' => 0, 'title' => 'Capodanno', 'start' => "$anno-01-01 00:00:00", 'end' => "$anno-01-01 23:59:59", 'color' => $color);
+            $this->records[] = array('id' => 0, 'title' => 'Epifania', 'start' => "$anno-01-06 00:00:00", 'end' => "$anno-01-06 23:59:59", 'color' => $color);
+            $this->records[] = array('id' => 0, 'title' => 'Festa della Liberazione', 'start' => "$anno-04-25 00:00:00", 'end' => "$anno-04-25 23:59:59", 'color' => $color);
+            $this->records[] = array('id' => 0, 'title' => 'Festa del Lavoro', 'start' => "$anno-05-01 00:00:00", 'end' => "$anno-05-01 23:59:59", 'color' => $color);
+            $this->records[] = array('id' => 0, 'title' => 'Festa della Repubblica', 'start' => "$anno-06-02 00:00:00", 'end' => "$anno-06-02 23:59:59", 'color' => $color);
+            $this->records[] = array('id' => 0, 'title' => 'Ferragosto', 'start' => "$anno-08-15 00:00:00", 'end' => "$anno-08-15 23:59:59", 'color' => $color);
+            $this->records[] = array('id' => 0, 'title' => 'Ognissanti', 'start' => "$anno-11-01 00:00:00", 'end' => "$anno-11-01 23:59:59", 'color' => $color);
+            $this->records[] = array('id' => 0, 'title' => 'Immacolata Concezione', 'start' => "$anno-12-08 00:00:00", 'end' => "$anno-12-08 23:59:59", 'color' => $color);
+            $this->records[] = array('id' => 0, 'title' => 'Natale', 'start' => "$anno-12-25 00:00:00", 'end' => "$anno-12-25 23:59:59", 'color' => $color);
+            $this->records[] = array('id' => 0, 'title' => 'Santo Stefano', 'start' => "$anno-12-26 00:00:00", 'end' => "$anno-12-26 23:59:59", 'color' => $color);
+
+            $pasqua = date("Y-m-d", easter_date($anno));
+            $this->records[] = array('id' => 0, 'title' => 'Pasqua', 'start' => "$pasqua 00:00:00", 'end' => "$pasqua 23:59:59", 'color' => $color);
+            $pasquetta = date("Y-m-d", strtotime("$pasqua +1 day"));
+            $this->records[] = array('id' => 0, 'title' => 'Pasquetta', 'start' => "$pasquetta 00:00:00", 'end' => "$pasquetta 23:59:59", 'color' => $color);
+        }
+
+        
         if ($reload)
         if ($reload)
             $this->emit('reload-calendar', ["'" . json_encode($this->records) . "'"]);
             $this->emit('reload-calendar', ["'" . json_encode($this->records) . "'"]);
         return view('livewire.calendar');
         return view('livewire.calendar');

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

@@ -149,6 +149,16 @@ class Member extends Component
     public $already_existing = false;
     public $already_existing = false;
     public $tabOrder = ['dati', 'tesseramento', 'corsi', 'gruppi'];
     public $tabOrder = ['dati', 'tesseramento', 'corsi', 'gruppi'];
 
 
+    public $presenceYears = [];
+    public $presenceTitle = [];
+    public $member_presences = [];
+
+    public $totals = 0;
+    public $presenze = 0;
+    public $assenze = 0;
+    public $annullate = 0;
+    public $recuperi = 0;
+
     protected $rules = [
     protected $rules = [
         'first_name' => 'required',
         'first_name' => 'required',
         'last_name' => 'required',
         'last_name' => 'required',
@@ -694,6 +704,7 @@ class Member extends Component
 
 
         $this->loadMemberCards();
         $this->loadMemberCards();
         $this->loadMemberCourses();
         $this->loadMemberCourses();
+        $this->loadMemberPresences();
         $this->loadMemberCategories();
         $this->loadMemberCategories();
         $this->loadMemberCertificates();
         $this->loadMemberCertificates();
 
 
@@ -739,6 +750,106 @@ class Member extends Component
         // return view('livewire.member');
         // return view('livewire.member');
     }
     }
 
 
+    public function loadMemberPresences()
+    {
+
+        $this->member_presences = [];
+
+        // Carico tutti i calendar_id delle presenza
+        $presences = \App\Models\Presence::where('member_id', $this->dataId)->where('status', '<>', 99)->pluck('calendar_id')->toArray();
+        $presences_annullate = \App\Models\Presence::where('member_id', $this->dataId)->where('status', 99)->pluck('calendar_id')->toArray();
+
+        $course_ids = array();
+        // Tutti i calendari
+        $calendars = \App\Models\Calendar::whereNull('manual')->orderBy('from')->get();
+
+        $this->totals = 0;
+        $this->presenze = 0;
+        $this->assenze = 0;
+        $this->annullate = 0;
+        $this->recuperi = 0;
+
+        foreach($calendars as $calendar)
+        {
+            $days = ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'];
+            $dow = date('w', strtotime($calendar->from));
+            $d = $days[$dow];
+
+            // Elenco corsi per tipologia in base al calendario
+            $courses = \App\Models\Course::where('name', $calendar->name)->where('date_from', '<=', $calendar->from)->where('date_to', '>=', $calendar->to)->pluck('id')->toArray();
+
+            // Elenco utenti iscritti al corso "padre"
+            if (\App\Models\MemberCourse::where('when', 'like', "%" . $d . "%")->whereIn('course_id', $courses)->where('member_id', $this->dataId)->first())
+            {
+                $status = '';
+                if (in_array($calendar->id, $presences))
+                {
+                    $status = "<span style=\"color:green\">Prezenza ordinaria</span>";
+                    $this->presenze += 1;
+                }
+                else
+                {
+                    if (in_array($calendar->id, $presences_annullate))
+                    {
+                        $status = "<span style=\"color:gray\">Annullata</span>";
+                        $this->annullate += 1;
+                    }
+                    else
+                    {
+                        if (date("Ymd") > date("Ymd", strtotime($calendar->from)))
+                        {
+                            $status = "<span style=\"color:red\">Assenza</span>";
+                            $this->assenze += 1;
+                        }
+                    }
+                }
+
+                if ($calendar->status == 99)
+                {
+                    $status = "<span style=\"color:gray\">Annullata</span>";
+                    $this->annullate += 1;
+                }
+                
+                $this->member_presences[] = array('calendar_id' => $calendar->id, 'from' => $calendar->from, 'to' => $calendar->to, 'status' => $status);//\App\Models\Presence::where('member_id', $this->dataId)->get();
+            }
+
+            //$courses = array(1);
+            foreach($courses as $c)
+            {
+                $course_ids[] = $c;    
+            }
+
+            //$course_ids = array_push($course_ids, $courses);
+
+        }
+
+        // Manuali (recuperi)
+        $calendar_recuperi = \App\Models\Calendar::where('manual', 1)->pluck('id')->toArray();
+        $presences_recuperi = \App\Models\Presence::whereIn('calendar_id', $calendar_recuperi)->where('member_id', $this->dataId)->get();
+        foreach($presences_recuperi as $p)
+        {
+            $this->member_presences[] = array('calendar_id' => $p->calendar->id, 'from' => $p->calendar->from, 'to' => $p->calendar->to, 'status' => '<span style=\"color:violet\">Recupero</span>');//\App\Models\Presence::where('member_id', $this->dataId)->get();
+            $this->recuperi += 1;
+        }
+
+        $sortVariable='from';
+        usort(
+            $this->member_presences, 
+            fn(array $a, array $b): int => $a[$sortVariable] <=> $b[$sortVariable]
+        );
+
+        //usort($this->member_presences, $this->cmp);
+        //usort($this->member_presences, function ($a, $b) { return $a['from'] > $b['from']; });
+        
+        $this->presenceYears = \App\Models\Course::whereIn('id', $course_ids)->orderBy('year')->groupBy('year')->pluck('year')->toArray();
+        $this->presenceTitle = \App\Models\Course::whereIn('id', $course_ids)->orderBy('name')->groupBy('name')->pluck('name')->toArray();
+
+        
+        // return view('livewire.member');
+    }
+
+    
+
     public function showDetailF($id)
     public function showDetailF($id)
     {
     {
         if (!isset($_GET["from"]) && $this->from == '')
         if (!isset($_GET["from"]) && $this->from == '')
@@ -1633,6 +1744,8 @@ class Member extends Component
                     $this->course_months[] = array("m" => $z->m, "status" => $z->status);
                     $this->course_months[] = array("m" => $z->m, "status" => $z->status);
                 }
                 }
                 $this->courseDataId = $memberCourse->id;
                 $this->courseDataId = $memberCourse->id;
+
+                
                 $this->updateCourse = true;
                 $this->updateCourse = true;
                 $this->addCourse = false;
                 $this->addCourse = false;
                 $this->emit('setEditCorso', true);
                 $this->emit('setEditCorso', true);
@@ -1662,6 +1775,100 @@ class Member extends Component
                 'months' => json_encode($this->course_months),
                 'months' => json_encode($this->course_months),
                 'when' => json_encode($this->course_when)
                 'when' => json_encode($this->course_when)
             ]);
             ]);
+
+            $course_name = '';
+            // Se il corso ha associato una categoria iscrivo anche al gruppo
+            $c = \App\Models\Course::findOrFail($this->course_course_id);
+            if ($c) {
+                if ($c->category_id > 0) {
+                    \App\Models\MemberCategory::create([
+                        'member_id' => $this->dataId,
+                        'category_id' => $c->category_id,
+                        'date' => \Carbon\Carbon::now()
+                    ]);
+                }
+                $course_name = $c->name;
+            }
+
+            $days = array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
+
+            //foreach($this->course_months as $m)
+            //{
+
+            $from = date("Y-m-d", strtotime($c->date_from));
+            $to = date("Y-m-d", strtotime($c->date_to));
+
+            $endDate = strtotime($to);
+
+            foreach($this->course_when as $d)
+            {
+
+                foreach($d["day"] as $dd)
+                {
+
+                    $day = '';
+                    switch ($dd) {
+                        case 'lun':
+                            $day = $days[0];
+                            break;
+                        case 'mar':
+                            $day = $days[1];
+                            break;
+                        case 'mer':
+                            $day = $days[2];
+                            break;
+                        case 'gio':
+                            $day = $days[3];
+                            break;
+                        case 'ven':
+                            $day = $days[4];
+                            break;
+                        case 'sab':
+                            $day = $days[5];
+                            break;
+                        case 'dom':
+                            $day = $days[6];
+                            break;
+                        default:
+                            $day = '';
+                            break;
+                    }
+                    
+                    if ($day != '')
+                    {
+                        for($i = strtotime($day, strtotime($from)); $i <= $endDate; $i = strtotime('+1 week', $i))
+                        {
+
+                            // Controllo che non esiste un corso così
+                            $exist = \App\Models\Calendar::where('from', date('Y-m-d ' . $d["from"] . ":00", $i))->where('to', date('Y-m-d ' . $d["to"] . ":00", $i))->where('name', $course_name)->first();
+
+                            if (!$exist && !in_array(date('Y-m-d', $i), $this->festivita))
+                            {
+
+                                // Creo il calendario del corso
+                                $calendar = new \App\Models\Calendar();
+                                $calendar->course_id = $this->course_course_id;
+                                $calendar->court_id = null;
+                                $calendar->name = $course_name;
+                                $calendar->course_type_id = null;
+                                $calendar->course_duration_id = null;
+                                $calendar->course_frequency_id = null;
+                                $calendar->course_level_id = null;
+                                $calendar->instructor_id = null;
+                                $calendar->from = date('Y-m-d ' . $d["from"] . ":00", $i);
+                                $calendar->to = date('Y-m-d ' . $d["to"] . ":00", $i);
+                                $calendar->note = '';
+                                $calendar->status = 0;
+                                $calendar->save();
+
+                            }
+                            
+                        }
+                    }
+                }
+            }
+
+
             session()->flash('success', 'Corso aggiornato');
             session()->flash('success', 'Corso aggiornato');
             $this->resetCourseFields();
             $this->resetCourseFields();
             $this->updateCourse = false;
             $this->updateCourse = false;

+ 36 - 22
app/Http/Livewire/Presence.php

@@ -77,6 +77,7 @@ class Presence extends Component
             // Elenco corsi per tipologia in base al calendario
             // Elenco corsi per tipologia in base al calendario
             $courses = \App\Models\Course::where('name', $this->calendar->name)->where('date_from', '<=', $this->calendar->from)->where('date_to', '>=', $this->calendar->to)->pluck('id')->toArray();
             $courses = \App\Models\Course::where('name', $this->calendar->name)->where('date_from', '<=', $this->calendar->from)->where('date_to', '>=', $this->calendar->to)->pluck('id')->toArray();
 
 
+
             // Elenco utenti iscritti al corso "padre"
             // Elenco utenti iscritti al corso "padre"
             $members_courses = \App\Models\MemberCourse::where('when', 'like', "%" . $d . "%")->whereIn('course_id', $courses)->pluck('member_id')->toArray();
             $members_courses = \App\Models\MemberCourse::where('when', 'like', "%" . $d . "%")->whereIn('course_id', $courses)->pluck('member_id')->toArray();
 
 
@@ -258,12 +259,12 @@ class Presence extends Component
         if (!$this->added)
         if (!$this->added)
         {
         {
             $this->newMemberFiscalCodeExist = false;
             $this->newMemberFiscalCodeExist = false;
-            $this->validate([
+            /*$this->validate([
                 // 'newMemberFiscalCode'=>'required|max:16',
                 // 'newMemberFiscalCode'=>'required|max:16',
                 'newMemberFirstName'=>'required',
                 'newMemberFirstName'=>'required',
                 'newMemberLastName'=>'required',
                 'newMemberLastName'=>'required',
                 //'newMemberEmail'=>'required',
                 //'newMemberEmail'=>'required',
-            ]);
+            ]);*/
 
 
             // Check fiscal code exist
             // Check fiscal code exist
             $exist = false;
             $exist = false;
@@ -287,10 +288,10 @@ class Presence extends Component
                     $this->newMembers[] = $member->id;
                     $this->newMembers[] = $member->id;
                 $this->emit('reload');
                 $this->emit('reload');
                 $this->emit('saved');
                 $this->emit('saved');
-                $this->newMemberFirstName = '';
+                /*$this->newMemberFirstName = '';
                 $this->newMemberLastName = '';
                 $this->newMemberLastName = '';
                 $this->newMemberEmail = '';
                 $this->newMemberEmail = '';
-                $this->newMemberFiscalCode = '';
+                $this->newMemberFiscalCode = '';*/
             }
             }
             else
             else
             {
             {
@@ -300,26 +301,29 @@ class Presence extends Component
         else
         else
         {
         {
 
 
-            foreach($this->member_ids as $m)
+            if ($this->member_ids != null)
             {
             {
-                if ($this->manual)
-                {
-                    //\App\Models\Presence::where('calendar_id', $this->calendar->id)->where('user_id', \Auth::user()->id)->where('status', '<>', 99)->delete();
-                    //foreach($ids as $id)
-                    //{
-                        $p = new \App\Models\Presence();
-                        $p->member_id = $m;
-                        $p->calendar_id = $this->calendar->id;
-                        $p->motivation_id = $this->newMemberMotivationId;
-                        $p->user_id = \Auth::user()->id;
-                        $p->status = 0;
-                        $p->save();
-                    //}
-                }
-                else
+                foreach($this->member_ids as $m)
                 {
                 {
-                    if (!in_array($m, $this->newMembers))
-                        $this->newMembers[] = $m;
+                    if ($this->manual)
+                    {
+                        //\App\Models\Presence::where('calendar_id', $this->calendar->id)->where('user_id', \Auth::user()->id)->where('status', '<>', 99)->delete();
+                        //foreach($ids as $id)
+                        //{
+                            $p = new \App\Models\Presence();
+                            $p->member_id = $m;
+                            $p->calendar_id = $this->calendar->id;
+                            $p->motivation_id = $this->newMemberMotivationId;
+                            $p->user_id = \Auth::user()->id;
+                            $p->status = 0;
+                            $p->save();
+                        //}
+                    }
+                    else
+                    {
+                        if (!in_array($m, $this->newMembers))
+                            $this->newMembers[] = $m;
+                    }
                 }
                 }
             }
             }
 
 
@@ -356,4 +360,14 @@ class Presence extends Component
         $this->emit('reload');
         $this->emit('reload');
 
 
     }
     }
+
+    public function revert($id)
+    {
+
+        $p = \App\Models\Presence::where('calendar_id', $this->calendar->id)->where('member_id', $id)->first();
+        $p->status = 0;
+        $p->save();
+        $this->emit('reload');
+
+    }
 }
 }

+ 36 - 0
public/css/extra.css

@@ -31,3 +31,39 @@ table.tableHead thead {
     background: #e4e4e4 !important;
     background: #e4e4e4 !important;
     border-radius: 10px;
     border-radius: 10px;
 }
 }
+.box-presenze
+{
+    padding:10px; 
+    border:1px solid green;
+    margin: 10px; 
+    border-radius: 10px; 
+    text-align: center;
+    color:green;
+}
+.box-assenze
+{
+    padding:10px; 
+    border:1px solid red;
+    margin: 10px; 
+    border-radius: 10px; 
+    text-align: center;
+    color:red;
+}
+.box-recupero
+{
+    padding:10px; 
+    border:1px solid violet;
+    margin: 10px; 
+    border-radius: 10px; 
+    text-align: center;
+    color:violet;
+}
+.box-annullate
+{
+    padding:10px; 
+    border:1px solid gray;
+    margin: 10px; 
+    border-radius: 10px; 
+    text-align: center;
+    color:gray;
+}

+ 12 - 2
resources/views/livewire/calendar.blade.php

@@ -67,7 +67,7 @@
                     </div>                
                     </div>                
                 </div>
                 </div>
                 <div class="modal-footer mt-2 justify-content-between">
                 <div class="modal-footer mt-2 justify-content-between">
-                    <button class="btn--ui lightGrey hideDelete" onclick="showDelete()">Annulla Lezione</a>
+                    <button class="btn--ui lightGrey hideDelete hideDeleteButton" onclick="showDelete()">Annulla Lezione</a>
                     <button type="button" class="btn--ui btn-primary hideDelete" onclick="goPresence()">Presenze</button>
                     <button type="button" class="btn--ui btn-primary hideDelete" onclick="goPresence()">Presenze</button>
                     <button type="button" class="btn--ui primary showDelete" onclick="deleteCalendar()" style="display:none">Annulla lezione</button>
                     <button type="button" class="btn--ui primary showDelete" onclick="deleteCalendar()" style="display:none">Annulla lezione</button>
                 </div>
                 </div>
@@ -252,6 +252,7 @@
                     right: 'prevYear,prev,next,nextYear today',
                     right: 'prevYear,prev,next,nextYear today',
                 },
                 },
                 dateClick: function(info) {
                 dateClick: function(info) {
+                    
                     var x = info.dateStr.split("T");
                     var x = info.dateStr.split("T");
                     $("#date").val(x[0]);
                     $("#date").val(x[0]);
                     var y = x[1].split("+");
                     var y = x[1].split("+");
@@ -266,11 +267,20 @@
                     var datestring = eventDate.getFullYear() + "-" + pad(eventDate.getMonth()+1, 2) + "-" + pad(eventDate.getDate(), 2) + " " + pad(eventDate.getHours(), 2) + ":" + pad(eventDate.getMinutes(), 2) + ":00";
                     var datestring = eventDate.getFullYear() + "-" + pad(eventDate.getMonth()+1, 2) + "-" + pad(eventDate.getDate(), 2) + " " + pad(eventDate.getHours(), 2) + ":" + pad(eventDate.getMinutes(), 2) + ":00";
                     var title = info.event.title;
                     var title = info.event.title;
                     $(".title").html(title);
                     $(".title").html(title);
+                    if (title.includes("annullata"))
+                    {
+                        $(".hideDeleteButton").css("display", "none");
+                    }
+                    else
+                    {
+                        $(".hideDeleteButton").css("display", "block");
+                    }
                     $(".time").html(pad(eventDate.getHours(), 2) + ":" + pad(eventDate.getMinutes(), 2));
                     $(".time").html(pad(eventDate.getHours(), 2) + ":" + pad(eventDate.getMinutes(), 2));
                     $(".date").html(eventDate.toLocaleDateString('it-IT', { weekday: 'long' }) + " " + pad(eventDate.getDate(), 2) + " " + eventDate.toLocaleDateString('it-IT', { month: 'long' }));
                     $(".date").html(eventDate.toLocaleDateString('it-IT', { weekday: 'long' }) + " " + pad(eventDate.getDate(), 2) + " " + eventDate.toLocaleDateString('it-IT', { month: 'long' }));
                     currentCalendar = info.event.id;
                     currentCalendar = info.event.id;
                     params = '?calendarId=' + info.event.id;// + "&date=" + datestring; 
                     params = '?calendarId=' + info.event.id;// + "&date=" + datestring; 
-                    $('.openModal').trigger('click');
+                    if (info.event.id > 0)
+                        $('.openModal').trigger('click');
                 },
                 },
                 locale: 'it',
                 locale: 'it',
                 events: @json($records),
                 events: @json($records),

+ 76 - 0
resources/views/livewire/member.blade.php

@@ -514,6 +514,7 @@
                                 <h4 style="cursor:pointer;{{$type == 'dati' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('dati')">Anagrafica</h4>
                                 <h4 style="cursor:pointer;{{$type == 'dati' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('dati')">Anagrafica</h4>
                                 <h4 style="cursor:pointer;{{$type == 'tesseramento' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('tesseramento')">Tesseramento</h4>
                                 <h4 style="cursor:pointer;{{$type == 'tesseramento' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('tesseramento')">Tesseramento</h4>
                                 <h4 style="cursor:pointer;{{$type == 'corsi' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('corsi')">Corsi</h4>
                                 <h4 style="cursor:pointer;{{$type == 'corsi' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('corsi')">Corsi</h4>
+                                <h4 style="cursor:pointer;{{$type == 'presenze' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('presenze')">Presenze</h4>
                                 <h4 style="cursor:pointer;{{$type == 'gruppi' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('gruppi')">Gruppi</h4>
                                 <h4 style="cursor:pointer;{{$type == 'gruppi' ? 'border-bottom:2px solid #0C6197; color:#0C6197;' : ''}}" wire:click="change('gruppi')">Gruppi</h4>
                             </div>
                             </div>
 
 
@@ -1130,6 +1131,81 @@
 
 
                                 @endif
                                 @endif
 
 
+                                @if($type == 'presenze')
+
+                                    <div class="form--wrapper">
+                                        <div class="row ">
+                                            <div class="col-md-6">
+                                                <select class="form-control">
+                                                    @foreach($presenceYears as $y)
+                                                        <option value="{{$y}}">{{$y}}</option>
+                                                    @endforeach
+                                                </select>
+                                            </div>
+                                            <div class="col-md-6">
+                                                <select class="form-control">
+                                                    @foreach($presenceTitle as $t)
+                                                        <option value="{{$t}}">{{$t}}</option>
+                                                    @endforeach
+                                                </select>
+                                            </div>
+                                        </div>
+                                        <div class="row ">
+                                            <div class="col-md-3">
+                                                <div class="box-presenze">
+                                                    Presenze<br>
+                                                    {{$presenze}}
+                                                </div>                                                
+                                            </div>
+                                            <div class="col-md-3">
+                                                <div class="box-assenze">
+                                                    Assenze<br>
+                                                    {{$assenze}}
+                                                </div>
+                                            </div>
+                                            <div class="col-md-3">
+                                                <div class="box-recupero">
+                                                    Recupero<br>
+                                                    {{$recuperi}}
+                                                </div>
+                                            </div>
+                                            <div class="col-md-3">
+                                                <div class="box-annullate">
+                                                    Annullate<br>
+                                                    {{$annullate}}
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="row ">
+                                            <div class="col-md-12">
+                                            </div>
+                                        </div>
+                                        <div class="row " style="height: 300px; overflow:auto; ">
+                                            <div class="col-md-12">
+                                                <table class="table tablesaw tableHead tablesaw-stack tabella--presenze" id="tablesaw-350-2" style="min-width:700px">
+                                                    <thead>
+                                                        <tr>
+                                                            <th>Data</th>
+                                                            <th>Orario</th>
+                                                            <th>Stato</th>
+                                                        </tr>                                                        
+                                                    </thead>
+                                                    <tbody>
+                                                        @foreach($member_presences as $mp)
+                                                            <tr>
+                                                                <td>{{date("d/m/Y", strtotime($mp["from"]))}}</td>
+                                                                <td>{{date("H:i", strtotime($mp["from"]))}} - {{date("H:i", strtotime($mp["to"]))}}</td>
+                                                                <td>{!!$mp["status"]!!}</td>
+                                                            </tr>
+                                                        @endforeach
+                                                    </tbody>
+                                                </table>
+                                            </div>
+                                        </div>
+                                    </div>
+
+                                @endif
+
                                 @if($type == 'corsi')
                                 @if($type == 'corsi')
                                     @if($dataId > 0)
                                     @if($dataId > 0)
 
 

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

@@ -112,15 +112,13 @@
                                                 <input class="member chkM" type="checkbox" value="{{$record["id"]}}" {{$record["presence"] ? 'checked' : ''}}>
                                                 <input class="member chkM" type="checkbox" value="{{$record["id"]}}" {{$record["presence"] ? 'checked' : ''}}>
                                             @endif
                                             @endif
                                         @else
                                         @else
-                                            {{-- &#10003; --}}
-                                            <i class="fa-solid fa-lock"></i>
+                                            <span style="color:#0C6197;font-size:25px;">&#10003;</span>
                                         @endif
                                         @endif
                                     @else
                                     @else
                                         <input class="member chkM" type="checkbox" value="{{$record["id"]}}" {{$record["presence"] ? 'checked' : ''}}>
                                         <input class="member chkM" type="checkbox" value="{{$record["id"]}}" {{$record["presence"] ? 'checked' : ''}}>
                                     @endif
                                     @endif
                                 @else
                                 @else
-                                    <span class="p-1 text-white" style="background-color: #BE231D; border-radius: 5px">Annullata</span>&nbsp;
-                                    <a href="#"><i class="fa-solid fa-undo"></i></a>
+                                    Annullata (<a href="#" wire:click="revert({{$record["id"]}})">Ripristina</a>)
                                 @endif
                                 @endif
                             </td>
                             </td>
                         </tr>
                         </tr>