Luca Parisio 10 月之前
父節點
當前提交
5e25e91957

+ 39 - 5
app/Http/Livewire/Course.php

@@ -18,7 +18,7 @@ class Course extends Component
         $category_id,
         $sub_causal_id,
         $max_members,
-        $instructor,
+        $instructor_id,
         $year,
         $price,
         $subscription_price,
@@ -36,6 +36,8 @@ class Course extends Component
     public $course_durations = [];
     public $course_frequencies = [];
     public $course_levels = [];
+    public $course_subscriptions = [];
+    public $instructors = [];
     public $causals = [];
 
     public $course_years = [];
@@ -74,7 +76,7 @@ class Course extends Component
         $this->causal_id = null;
         $this->sub_causal_id = null;
         $this->max_members = 0;
-        $this->instructor = '';
+        $this->instructor_id = null;
         $this->year = date("Y");
         $this->price = 0;
         $this->subscription_price = 0;
@@ -86,6 +88,7 @@ class Course extends Component
         $this->when = array();
         $this->when[] = array('day' => array(), 'from' => '', 'to' => '');
         $this->prices = [];
+        $this->prices[] = array('course_subscription_id' => null, 'price' => 0);
         $this->emit('load-data-table');
     }
 
@@ -127,8 +130,10 @@ class Course extends Component
         $this->course_types = \App\Models\CourseType::select('*')->where('enabled', true)->get();
         $this->course_durations = \App\Models\CourseDuration::select('*')->where('enabled', true)->get();
         $this->course_levels = \App\Models\CourseLevel::select('*')->where('enabled', true)->get();
+        $this->course_subscriptions = \App\Models\CourseSubscription::select('*')->where('enabled', true)->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->instructors = \App\Models\User::select('*')->where('level', 2)->get();
 
         $this->course_years = \App\Models\Course::select('year')->where('year', '<>', '')->groupBy('year')->pluck('year');
 
@@ -180,13 +185,14 @@ class Course extends Component
                 'causal_id' => $this->causal_id,
                 'sub_causal_id' => $this->sub_causal_id,
                 'max_members' => $this->max_members,
-                'instructor' => $this->instructor,
+                'instructor_id' => $this->instructor_id,
                 'year' => $this->year,
                 'price' => currencyToDouble($this->price),
                 'subscription_price' => currencyToDouble($this->subscription_price),
                 'months' => json_encode($this->months),
                 'type' => $this->type,
                 'when' => json_encode($this->when),
+                'prices' => json_encode($this->prices),
                 'enabled' => $this->enabled
             ]);
             session()->flash('success','Corso creato');
@@ -218,7 +224,7 @@ class Course extends Component
                 $this->causal_id = $course->causal_id;
                 $this->sub_causal_id = $course->sub_causal_id;
                 $this->max_members = $course->max_members;
-                $this->instructor = $course->instructor;
+                $this->instructor_id = $course->instructor_id;
                 $this->year = $course->year;
                 $this->price = formatPrice($course->price);
                 $this->subscription_price = formatPrice($course->subscription_price);
@@ -231,6 +237,23 @@ class Course extends Component
                         $this->when[] = array("day" => $z->day, "from" => $z->from, "to" => $z->to);
                     }
                 }
+                else
+                {
+                    $this->when[] = array('day' => array(), 'from' => '', 'to' => '');
+                }
+        
+                $this->prices = array();
+                if ($course->prices != null)
+                {
+                    foreach(json_decode($course->prices) as $z)
+                    {
+                        $this->prices[] = array("course_subscription_id" => $z->course_subscription_id, "price" => $z->price);
+                    }
+                }
+                else
+                {
+                    $this->prices[] = array('course_subscription_id' => null, 'price' => 0);
+                }
                 $this->type = $course->type;
                 $this->dataId = $course->id;
                 $this->update = true;
@@ -259,13 +282,14 @@ class Course extends Component
                 'causal_id' => $this->causal_id,
                 'sub_causal_id' => $this->sub_causal_id,
                 'max_members' => $this->max_members,
-                'instructor' => $this->instructor,
+                'instructor_id' => $this->instructor_id,
                 'year' => $this->year,
                 'price' => currencyToDouble($this->price),
                 'subscription_price' => currencyToDouble($this->subscription_price),
                 'months' => json_encode($this->months),
                 'type' => $this->type,
                 'when' => json_encode($this->when),
+                'prices' => json_encode($this->prices),
                 'enabled' => $this->enabled
             ]);
             session()->flash('success','Corso aggiornato');
@@ -360,4 +384,14 @@ class Course extends Component
         unset($this->when[$idx]);
     }
 
+    public function addPrice()
+    {
+        $this->prices[] = array('course_subscription_id' => null, 'price' => 0);
+    }
+
+    public function delPrice($idx)
+    {
+        unset($this->prices[$idx]);
+    }
+
 }

+ 41 - 238
app/Http/Livewire/CourseList.php

@@ -98,183 +98,6 @@ class CourseList extends Component
     public function render()
     {
 
-        /*
-
-        if ($this->hasFilter)
-        {
-
-            $member_course = \App\Models\MemberCourse::with('member');
-            if (sizeof($this->filterCourse) > 0)
-            {
-                $course_ids = [];
-                foreach($this->filterCourse as $c)
-                {
-                    $all = \App\Models\Course::where('name', 'like', '%' . $c . "%")->get();
-                    foreach($all as $a)
-                    {
-                        $course_ids[] = $a->id;
-                    }
-                    //$course_ids = array_merge($course_ids, $a);
-                }
-                //$course_ids = \App\Models\Course::where('name', 'like', '%' . $this->filterCourse . "%")->pluck('id');
-                $member_course = $member_course->whereIn('course_id', $course_ids);
-            }
-            if (sizeof($this->filterLevel) > 0)
-            {
-                $course_ids = \App\Models\Course::whereIn('course_level_id', $this->filterLevel)->pluck('id');
-                $member_course = $member_course->whereIn('course_id', $course_ids);
-            }
-            if (sizeof($this->filterFrequency) > 0)
-            {
-                $course_ids = \App\Models\Course::whereIn('course_frequency_id', $this->filterFrequency)->pluck('id');
-                $member_course = $member_course->whereIn('course_id', $course_ids);
-            }
-            if (sizeof($this->filterType) > 0)
-            {
-                $course_ids = \App\Models\Course::whereIn('course_type_id', $this->filterType)->pluck('id');
-                $member_course = $member_course->whereIn('course_id', $course_ids);
-            }
-            if (sizeof($this->filterDuration) > 0)
-            {
-                $course_ids = \App\Models\Course::whereIn('course_duration_id', $this->filterDuration)->pluck('id');
-                $member_course = $member_course->whereIn('course_id', $course_ids);
-            }
-
-            //$member_course = $member_course->where('course_id', 999999);
-
-            $member_course = $member_course->get();
-        }
-        else
-        {
-            $member_course = \App\Models\MemberCourse::with('member')->get();
-        }
-
-        $this->records = [];
-        $this->totals = [];
-        $this->totalIsc = [];
-
-        foreach($member_course as $x)
-        {
-
-            $price = 0;
-            $price = $x->course->price;
-            $subPrice = $x->course->subscription_price;
-            $records = \App\Models\Record::where('member_course_id', $x->id)->where('deleted', 0)->get();
-            $prices = [];
-            foreach ($records as $record)
-            {
-                foreach ($record->rows as $row)
-                {
-
-                    //if ($row->causal_id == $x->course->sub_causal_id || str_contains(strtolower($row->note), 'iscrizione'))
-                    if (str_contains(strtolower($row->note), 'iscrizione'))
-                    {
-                        $subPrice = $row->amount;
-                    }
-                    if ($row->causal_id == $x->course->causal_id && !str_contains(strtolower($row->note), 'iscrizione'))
-                    {
-                        $tot = sizeof(json_decode($row->when));
-                        foreach(json_decode($row->when) as $m)
-                        {
-                            $prices[$m->month] = $row->amount / $tot;
-                        }
-                    }
-                }
-            }
-
-            for($i=1; $i<=12; $i++)
-            {
-
-                $cls = $this->getColor($x->months, $i);
-                if ($cls != 'grey')
-                {
-
-                    if (!isset($this->totals[$i]))
-                    {
-                        $this->totals[$i]['green'] = 0;
-                        $this->totals[$i]['orange'] = 0;
-                        $this->totals[$i]['yellow'] = 0;
-                    }
-
-
-                    if ($cls == 'yellow')
-                    {
-                        $this->totals[$i][$cls] += 1;
-                    }
-                    else
-                    {
-                        $p = isset($prices[$i]) ? $prices[$i] : $price;
-                        $this->totals[$i][$cls] += $p;
-                    }
-                }
-            }
-
-            $sub = $x->subscribed ? "Y" : "N";
-            if (isset($this->totalIsc[$sub]))
-                $this->totalIsc[$sub] += $subPrice;
-            else
-                $this->totalIsc[$sub] = $subPrice;
-
-            $this->records[] = array(
-                $x->member_id . "§" . $x->member->first_name . "§" . $x->member->last_name,
-                $this->getColor($x->months, 9) . "§" . (isset($prices[9]) ? $prices[9] : $price),
-                $this->getColor($x->months, 10) . "§" . (isset($prices[10]) ? $prices[10] : $price),
-                $this->getColor($x->months, 11) . "§" . (isset($prices[11]) ? $prices[11] : $price),
-                $this->getColor($x->months, 12) . "§" . (isset($prices[12]) ? $prices[12] : $price),
-                $this->getColor($x->months, 1) . "§" . (isset($prices[1]) ? $prices[1] : $price),
-                $this->getColor($x->months, 2) . "§" . (isset($prices[2]) ? $prices[2] : $price),
-                $this->getColor($x->months, 3) . "§" . (isset($prices[3]) ? $prices[3] : $price),
-                $this->getColor($x->months, 4) . "§" . (isset($prices[4]) ? $prices[4] : $price),
-                $this->getColor($x->months, 5) . "§" . (isset($prices[5]) ? $prices[5] : $price),
-                $this->getColor($x->months, 6) . "§" . (isset($prices[6]) ? $prices[6] : $price),
-                $this->getColor($x->months, 7) . "§" . (isset($prices[7]) ? $prices[7] : $price),
-                $this->getColor($x->months, 8) . "§" . (isset($prices[8]) ? $prices[8] : $price),
-                $x->course_id,
-                $x->id,
-                $x->subscribed . "§" . $subPrice
-            );
-        }
-
-        $js = '';
-        $xx = 2;
-        $str = '';
-        $str .= "<a class=green><small>" . (isset($this->totalIsc["Y"]) ? formatPrice($this->totalIsc["Y"]) : 0) . "</small></a><br>";
-        $str .= "<a class=orange><small>" . (isset($this->totalIsc["N"]) ? formatPrice($this->totalIsc["N"]) : 0) . "</small></a><br>";
-        $str .= "<a class=yellow><small>0</small></a><br>";
-        $js .= "2§" . $str . "_";
-        $str = "";
-        foreach($this->totals as $z => $t)
-        {
-            if ($z == 1) $xx = 7;
-            if ($z == 2) $xx = 8;
-            if ($z == 3) $xx = 9;
-            if ($z == 4) $xx = 10;
-            if ($z == 5) $xx = 11;
-            if ($z == 6) $xx = 12;
-            if ($z == 7) $xx = 13;
-            if ($z == 8) $xx = 14;
-            if ($z == 9) $xx = 3;
-            if ($z == 10) $xx = 4;
-            if ($z == 11) $xx = 5;
-            if ($z == 12) $xx = 6;
-            $str = '';
-            foreach($t as $x => $c)
-            {
-                $y = $x == 'yellow' ? $c : formatPrice($c);
-                $str .= "<a class=" . $x . "><small>" . $y . "</small></a><br>";
-            }
-            $js .= $xx . "§" . $str . "_";
-            $xx += 1;
-        }
-
-        //$this->aaa = $js;
-
-        //$this->emit('setTotals', $js);
-
-        $this->emit('load-data-table');
-
-        */
-
         $member_course = \App\Models\MemberCourse::with('member')->with('course');
 
         if ($this->hasFilter)
@@ -336,53 +159,6 @@ class CourseList extends Component
                 $member_course = $member_course->whereIn('course_id', $course_ids);
             }
         }
-        /*
-        if ($_GET["filterCourse"] != "null")
-        {
-            $course_ids = [];
-            $courses = explode(",", $_GET["filterCourse"]);
-            foreach($courses as $c)
-            {
-                $all = \App\Models\Course::where('name', 'like', '%' . $c . "%")->get();
-                foreach($all as $a)
-                {
-                    $course_ids[] = $a->id;
-                }
-            }
-            $member_course = $member_course->whereIn('course_id', $course_ids);
-        }
-
-        if ($_GET["filterYear"] != "")
-        {
-            $course_ids = \App\Models\Course::where('year', $_GET["filterYear"])->pluck('id');
-            $member_course = $member_course->whereIn('course_id', $course_ids);
-        }
-
-        if ($_GET["filterLevel"] != "null")
-        {
-            $levels = explode(",", $_GET["filterLevel"]);
-            $course_ids = \App\Models\Course::whereIn('course_level_id', $levels)->pluck('id');
-            $member_course = $member_course->whereIn('course_id', $course_ids);
-        }
-        if ($_GET["filterFrequency"] != "null")
-        {
-            $frequencies = explode(",", $_GET["filterFrequency"]);
-            $course_ids = \App\Models\Course::whereIn('course_frequency_id', $frequencies)->pluck('id');
-            $member_course = $member_course->whereIn('course_id', $course_ids);
-        }
-        if ($_GET["filterType"] != "null")
-        {
-            $types = explode(",", $_GET["filterType"]);
-            $course_ids = \App\Models\Course::whereIn('course_type_id', $types)->pluck('id');
-            $member_course = $member_course->whereIn('course_id', $course_ids);
-        }
-        if ($_GET["filterDuration"] != "null")
-        {
-            $durations = explode(",", $_GET["filterDuration"]);
-            $course_ids = \App\Models\Course::whereIn('course_duration_id', $durations)->pluck('id');
-            $member_course = $member_course->whereIn('course_id', $course_ids);
-        }
-        */
 
         $totals = [];
         $totalIsc = [];
@@ -665,18 +441,18 @@ class CourseList extends Component
                 "column_0" => $x->member->last_name,
                 "column_1" => $x->member->first_name,
                 "column_2" => $x->subscribed . "§" . formatPrice($subPrice),
-                "column_3" => $this->getColor($x->months, 9, isset($prices[9]) && $prices[9] == $price) . "§" . formatPrice(isset($prices[9]) ? $prices[9] : $price) . "§" . (isset($prices[9]) && $prices[9] != $price ? 'X' : ''),
-                "column_4" => $this->getColor($x->months, 10, isset($prices[10]) && $prices[10] == $price) . "§" . formatPrice(isset($prices[10]) ? $prices[10] : $price) . "§" . (isset($prices[10]) && $prices[10] != $price ? 'X' : ''),
-                "column_5" => $this->getColor($x->months, 11, isset($prices[11]) && $prices[11] == $price) . "§" . formatPrice(isset($prices[11]) ? $prices[11] : $price) . "§" . (isset($prices[11]) && $prices[11] != $price ? 'X' : ''),
-                "column_6" => $this->getColor($x->months, 12, isset($prices[12]) && $prices[12] == $price) . "§" . formatPrice(isset($prices[12]) ? $prices[12] : $price) . "§" . (isset($prices[12]) && $prices[12] != $price ? 'X' : ''),
-                "column_7" => $this->getColor($x->months, 1, isset($prices[1]) && $prices[1] == $price) . "§" . formatPrice(isset($prices[1]) ? $prices[1] : $price) . "§" . (isset($prices[1]) && $prices[1] != $price ? 'X' : ''),
-                "column_8" => $this->getColor($x->months, 2, isset($prices[2]) && $prices[2] == $price) . "§" . formatPrice(isset($prices[2]) ? $prices[2] : $price) . "§" . (isset($prices[2]) && $prices[2] != $price ? 'X' : ''),
-                "column_9" => $this->getColor($x->months, 3, isset($prices[3]) && $prices[3] == $price) . "§" . formatPrice(isset($prices[3]) ? $prices[3] : $price) . "§" . (isset($prices[3]) && $prices[3] != $price ? 'X' : ''),
-                "column_10" => $this->getColor($x->months, 4, isset($prices[4]) && $prices[4] == $price) . "§" . formatPrice(isset($prices[4]) ? $prices[4] : $price) . "§" . (isset($prices[4]) && $prices[4] != $price ? 'X' : ''),
-                "column_11" => $this->getColor($x->months, 5, isset($prices[5]) && $prices[5] == $price) . "§" . formatPrice(isset($prices[5]) ? $prices[5] : $price) . "§" . (isset($prices[5]) && $prices[5] != $price ? 'X' : ''),
-                "column_12" => $this->getColor($x->months, 6, isset($prices[6]) && $prices[6] == $price) . "§" . formatPrice(isset($prices[6]) ? $prices[6] : $price) . "§" . (isset($prices[6]) && $prices[6] != $price ? 'X' : ''),
-                "column_13" => $this->getColor($x->months, 7, isset($prices[7]) && $prices[7] == $price) . "§" . formatPrice(isset($prices[7]) ? $prices[7] : $price) . "§" . (isset($prices[7]) && $prices[7] != $price ? 'X' : ''),
-                "column_14" => $this->getColor($x->months, 8, isset($prices[8]) && $prices[8] == $price) . "§" . formatPrice(isset($prices[8]) ? $prices[8] : $price) . "§" . (isset($prices[8]) && $prices[8] != $price ? 'X' : ''),
+                "column_3" => $this->getColor($x->months, 9, isset($prices[9]) && $prices[9] >= $price) . "§" . formatPrice(isset($prices[9]) ? $prices[9] : $price) . "§" . (isset($prices[9]) && $prices[9] <= $price ? 'X' : ''),
+                "column_4" => $this->getColor($x->months, 10, isset($prices[10]) && $prices[10] >= $price) . "§" . formatPrice(isset($prices[10]) ? $prices[10] : $price) . "§" . (isset($prices[10]) && $prices[10] <= $price ? 'X' : ''),
+                "column_5" => $this->getColor($x->months, 11, isset($prices[11]) && $prices[11] >= $price) . "§" . formatPrice(isset($prices[11]) ? $prices[11] : $price) . "§" . (isset($prices[11]) && $prices[11] <= $price ? 'X' : ''),
+                "column_6" => $this->getColor($x->months, 12, isset($prices[12]) && $prices[12] >= $price) . "§" . formatPrice(isset($prices[12]) ? $prices[12] : $price) . "§" . (isset($prices[12]) && $prices[12] <= $price ? 'X' : ''),
+                "column_7" => $this->getColor($x->months, 1, isset($prices[1]) && $prices[1] >= $price) . "§" . formatPrice(isset($prices[1]) ? $prices[1] : $price) . "§" . (isset($prices[1]) && $prices[1] <= $price ? 'X' : ''),
+                "column_8" => $this->getColor($x->months, 2, isset($prices[2]) && $prices[2] >= $price) . "§" . formatPrice(isset($prices[2]) ? $prices[2] : $price) . "§" . (isset($prices[2]) && $prices[2] <= $price ? 'X' : ''),
+                "column_9" => $this->getColor($x->months, 3, isset($prices[3]) && $prices[3] >= $price) . "§" . formatPrice(isset($prices[3]) ? $prices[3] : $price) . "§" . (isset($prices[3]) && $prices[3] <= $price ? 'X' : ''),
+                "column_10" => $this->getColor($x->months, 4, isset($prices[4]) && $prices[4] >= $price) . "§" . formatPrice(isset($prices[4]) ? $prices[4] : $price) . "§" . (isset($prices[4]) && $prices[4] <= $price ? 'X' : ''),
+                "column_11" => $this->getColor($x->months, 5, isset($prices[5]) && $prices[5] >= $price) . "§" . formatPrice(isset($prices[5]) ? $prices[5] : $price) . "§" . (isset($prices[5]) && $prices[5] <= $price ? 'X' : ''),
+                "column_12" => $this->getColor($x->months, 6, isset($prices[6]) && $prices[6] >= $price) . "§" . formatPrice(isset($prices[6]) ? $prices[6] : $price) . "§" . (isset($prices[6]) && $prices[6] <= $price ? 'X' : ''),
+                "column_13" => $this->getColor($x->months, 7, isset($prices[7]) && $prices[7] >= $price) . "§" . formatPrice(isset($prices[7]) ? $prices[7] : $price) . "§" . (isset($prices[7]) && $prices[7] <= $price ? 'X' : ''),
+                "column_14" => $this->getColor($x->months, 8, isset($prices[8]) && $prices[8] >= $price) . "§" . formatPrice(isset($prices[8]) ? $prices[8] : $price) . "§" . (isset($prices[8]) && $prices[8] <= $price ? 'X' : ''),
                 "column_15" => $x->course_id,
                 "column_16" => $x->id,
                 "column_17" => $x->member_id,
@@ -820,7 +596,7 @@ class CourseList extends Component
                 {
                     $class = "yellow";
                 }
-                if (!$all)
+                if (!$all && $class == "green")
                 {
                     $class = "orange";
                 }
@@ -846,7 +622,34 @@ class CourseList extends Component
 
         $c = \App\Models\Course::findOrFail($course_id);
         $m = \App\Models\MemberCourse::findOrFail($id);
-        return redirect()->to('/in?new=1&memberId=' . $member_id . (sizeof($newMonths) > 0 ? '&causalId=' . $c->causal_id : '') . '&subCausalId=' . $c->sub_causal_id . '&createSubscription=' . ($subscription ? 1 : 0) . (sizeof($newMonths) > 0 ? '&months=' . implode("|", $newMonths) : '') . (sizeof($newMonths) > 0 ? '&price=' . $m->price : '') . '&subscription_price=' . $m->subscription_price . "&courseId=" . $id);
+
+        $price = $m->price;
+        $subscription_price = $m->subscription_price;
+
+        $records = \App\Models\Record::where('member_course_id', $m->id)->where('deleted', 0)->get();
+        foreach ($records as $record)
+        {
+
+            if (in_array($month, json_decode($record->months)))
+            {
+
+                foreach ($record->rows as $row)
+                {
+
+                    
+                    if ($row->causal_id == $c->causal_id && !str_contains(strtolower($row->note), 'iscrizione'))
+                    {
+                        $tot = sizeof(json_decode($row->when));
+                        foreach(json_decode($row->when) as $m)
+                        {
+                            $price -= $row->amount / $tot;
+                        }
+                    }
+                }
+            }
+        }
+
+        return redirect()->to('/in?new=1&memberId=' . $member_id . (sizeof($newMonths) > 0 ? '&causalId=' . $c->causal_id : '') . '&subCausalId=' . $c->sub_causal_id . '&createSubscription=' . ($subscription ? 1 : 0) . (sizeof($newMonths) > 0 ? '&months=' . implode("|", $newMonths) : '') . (sizeof($newMonths) > 0 ? ('&price=' . $price) : '') . '&subscription_price=' . $subscription_price . "&courseId=" . $id);
 
     }
 

+ 7 - 0
app/Http/Livewire/CourseMember.php

@@ -42,9 +42,16 @@ class CourseMember extends Component
 
     public $filter = '';
 
+    public $filterFromPrevious = '';
+
     public function mount()
     {
 
+        if (isset($_GET["id"]))
+        {
+            $this->filterFromPrevious = $_GET["id"];
+        }
+
         $this->course_types = \App\Models\CourseType::select('*')->where('enabled', true)->get();
         $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->get();
         $this->course_levels = \App\Models\CourseLevel::select('*')->where('enabled', true)->get();

+ 17 - 0
app/Http/Livewire/CourseMemberOne.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Http\Livewire;
+
+use Livewire\Component;
+
+class CourseMemberOne extends Component
+{
+    public $records = [];
+
+    public function render()
+    {
+        $this->records[] = array('name' => 'Standard', 'type' => 'standard');
+        $this->records[] = array('name' => 'Personalizzati', 'type' => 'custom');
+        return view('livewire.course_member_one');
+    }
+}

+ 16 - 0
app/Http/Livewire/CourseMemberTwo.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Http\Livewire;
+
+use Livewire\Component;
+
+class CourseMemberTwo extends Component
+{
+    public $records = [];
+
+    public function render()
+    {
+        $this->records = \App\Models\Course::where('parent_id', null)->where('type', $_GET["type"])->with('type', 'duration', 'getins')->get();
+        return view('livewire.course_member_two');
+    }
+}

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

@@ -1825,9 +1825,39 @@ class Member extends Component
     public function newPayment($course)
     {
         $c = \App\Models\Course::findOrFail($course["course_id"]);
+
+        $price = $course["price"];
+
+        if (sizeof($this->payMonths) == 1)
+        {
+            $month = $this->payMonths[0];
+            $records = \App\Models\Record::where('member_course_id', $this->selectedCourseMember)->where('deleted', 0)->get();
+            foreach ($records as $record)
+            {
+
+                if (in_array($month, json_decode($record->months)))
+                {
+
+                    foreach ($record->rows as $row)
+                    {
+
+                        
+                        if ($row->causal_id == $c->causal_id && !str_contains(strtolower($row->note), 'iscrizione'))
+                        {
+                            $tot = sizeof(json_decode($row->when));
+                            foreach(json_decode($row->when) as $m)
+                            {
+                                $price -= $row->amount / $tot;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
         $this->emit('setEdit', false);
         $this->emit('setEditCorso', false);
-        return redirect()->to('/in?new=1&memberId=' . $this->dataId . '&causalId=' . $c->causal_id . '&subCausalId=' . $c->sub_causal_id . '&createSubscription=' . $this->createSubscription .  (sizeof($this->payMonths) > 0 ? '&months=' . implode("|", $this->payMonths) : "") . '&price=' . $course["price"] . '&subscription_price=' . $course["subscription_price"] . "&courseId=" . $course["id"]);
+        return redirect()->to('/in?new=1&memberId=' . $this->dataId . '&causalId=' . $c->causal_id . '&subCausalId=' . $c->sub_causal_id . '&createSubscription=' . $this->createSubscription .  (sizeof($this->payMonths) > 0 ? '&months=' . implode("|", $this->payMonths) : "") . '&price=' . $price . '&subscription_price=' . $course["subscription_price"] . "&courseId=" . $course["id"]);
     }
 
     public function block($course)
@@ -1876,6 +1906,31 @@ class Member extends Component
                 if ($mm->m == $m) {
                     if ($mm->status == "")
                         $this->payMonths[] = $m;
+                    if ($mm->status == "1")
+                    {
+                        $mc = \App\Models\MemberCourse::findOrFail($selectedCourseMember);
+                        $price = $mc->price;
+                        $payed = 0;
+                        $extraC = '';
+                        $recordsPayed = \App\Models\Record::where('member_course_id', $selectedCourseMember)->where('deleted', 0)->get();
+                        foreach ($recordsPayed as $record)
+                        {
+                            if (in_array($m, json_decode($record->months)))
+                            {
+                                foreach ($record->rows as $row)
+                                {
+                                    if ($row->causal_id == $mc->course->causal_id && !str_contains(strtolower($row->note), 'iscrizione'))
+                                    {
+                                        $tot = sizeof(json_decode($row->when));
+                                        $payed += $row->amount / $tot;
+                                    }
+                                }
+                                if ($payed < $price)
+                                    $this->payMonths[] = $m;
+                            }
+                        }
+                    }
+                        
                     if ($mm->status == "2")
                         $this->suspendedMonths[] = $m;
                 }
@@ -1930,6 +1985,34 @@ class Member extends Component
                     else
                         $class = "yellow";
                 }
+
+                if ($class == 'green')
+                {
+
+                    $mc = \App\Models\MemberCourse::findOrFail($selectedCourseMember);
+                    $price = $mc->price;
+                    $payed = 0;
+                    $extraC = '';
+                    $recordsPayed = \App\Models\Record::where('member_course_id', $selectedCourseMember)->where('deleted', 0)->get();
+                    foreach ($recordsPayed as $record)
+                    {
+                        if (in_array($m, json_decode($record->months)))
+                        {
+                            foreach ($record->rows as $row)
+                            {
+                                if ($row->causal_id == $mc->course->causal_id && !str_contains(strtolower($row->note), 'iscrizione'))
+                                {
+                                    $tot = sizeof(json_decode($row->when));
+                                    $payed += $row->amount / $tot;
+                                }
+                            }
+                            if ($payed < $price)
+                                $class = 'orange half';
+                        }
+                    }
+                    //$class .= $extraC;
+                }
+
             }
         }
 

+ 7 - 1
app/Models/Course.php

@@ -31,7 +31,8 @@ class Course extends Model
         'active',
         'type',
         'when',
-        'prices'
+        'prices',
+        'instructor_id'
     ];
 
     public function parent()
@@ -69,6 +70,11 @@ class Course extends Model
         return $this->belongsTo(Member::class);
     }
 
+    public function getins()
+    {
+        return $this->belongsTo(User::class, 'instructor_id');
+    }
+
     public function childs() {
         return $this->hasMany(\App\Models\Course::class,'parent_id','id') ;
     }

+ 33 - 0
database/migrations/2025_03_27_164000_add_instructor_id_to_course_table.php

@@ -0,0 +1,33 @@
+<?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('courses', function (Blueprint $table) {
+            $table->unsignedBigInteger('instructor_id')->nullable();
+            $table->foreign('instructor_id')->nullable()->references('id')->on('users')->onUpdate('cascade')->onDelete('set null');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('courses', function (Blueprint $table) {
+            $table->dropColumn('instructor_id');
+        });
+    }
+};

+ 4 - 0
public/css/style.css

@@ -16515,9 +16515,13 @@ a:hover, a:visited {
 #checkall-target a.yellow {
   border: 3px solid #0C6197;
 }
+#checkall-target a.orange.half {
+  border: 3px solid #e09f77 !important;
+}
 #checkall-target a.orange {
   border: 3px solid #F28322;
 }
+
 #checkall-target a.grey {
   border: 3px solid #dee2e6;
 }

+ 10 - 6
resources/views/layouts/app.blade.php

@@ -160,10 +160,14 @@
                 print "Gestionale";
             if (Request::is('records'))
                 print "Prima nota";
-            if (Request::is('course_list'))
-                print "Pagamento corsi";
+            if (Request::is('course_member_one'))
+                print "Corsi";
+            if (Request::is('course_member_two'))
+                print "Corsi";
             if (Request::is('course_member'))
                 print "Iscritti corsi";
+            if (Request::is('course_list'))
+                print "Pagamento corsi";
             if (Request::is('reminders'))
                 print "Scadenze";
             if (Request::is('settings'))
@@ -301,15 +305,15 @@
                     </div>
                     <div class="accordion-item">
                         <h2 class="accordion-header linkMenu" id="headingThree">
-                            <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="{{Request::is('course_list') || Request::is('course_member') ? 'true' : 'false'}}" aria-controls="collapseThree">
+                            <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="{{Request::is('course_member_one') || Request::is('course_member_two') || Request::is('course_list') || Request::is('course_member') ? 'true' : 'false'}}" aria-controls="collapseThree">
                                 Corsi
                             </button>
                         </h2>
-                        <div id="collapseThree" class="accordion-collapse collapse {{Request::is('course_list') || Request::is('course_member') ? 'show' : ''}}" aria-labelledby="headingThree" data-bs-parent="#accordionExample">
+                        <div id="collapseThree" class="accordion-collapse collapse {{Request::is('course_member_one') || Request::is('course_member_two') || Request::is('course_list') || Request::is('course_member') ? 'show' : ''}}" aria-labelledby="headingThree" data-bs-parent="#accordionExample">
                             <div class="accordion-body">
                                 <ul class="nav nav-pills flex-column align-items-center align-items-sm-start w-100" id="menu-contabilita" style="margin-top:0px;">
-                                    <li class="nav-item" style="{{Request::is('course_member') ? 'background-color: #c5d9e6;' : ''}}">
-                                        <a href="/course_member" class="nav-link d-flex align-items-center linkMenu">
+                                    <li class="nav-item" style="{{Request::is('course_member_one') || Request::is('course_member_two') || Request::is('course_member') ? 'background-color: #c5d9e6;' : ''}}">
+                                        <a href="/{{env('MANAGE_COURSE', false) ? 'course_member_one' : 'course_member'}}" class="nav-link d-flex align-items-center linkMenu">
                                             <span class="ms-3 d-md-inline">Iscritti</span>
                                         </a>
                                     </li>

+ 110 - 69
resources/views/livewire/course.blade.php

@@ -114,11 +114,13 @@
                     <form action="">
 
                         <div class="row mb-3 ">
-                            <div class="col-12 mt-2">
-                                <input type="radio" name="chkType" value="standard" wire:model="type">&nbsp;Standard
-                                &nbsp;&nbsp;&nbsp;
-                                <input type="radio" name="chkType" value="custom" wire:model="type">&nbsp;Personalizzato
-                            </div>
+                            @if(env('MANAGE_COURSE', false))
+                                <div class="col-12 mt-2">
+                                    <input type="radio" name="chkType" value="standard" wire:model="type">&nbsp;Standard
+                                    &nbsp;&nbsp;&nbsp;
+                                    <input type="radio" name="chkType" value="custom" wire:model="type">&nbsp;Personalizzato
+                                </div>
+                            @endif
                             <div class="col-6 mt-2">
                                 <div class="form--item">
                                     <label for="inputName" class="form-label">Nome</label>
@@ -233,10 +235,12 @@
                             <div class="col-6 mt-2">
                                 <div class="form--item">
                                     <label for="inputName" class="form-label">Istruttore</label>
-                                    <input class="form-control js-keyupTitle @error('instructor') is-invalid @enderror" type="text" id="instructor" placeholder="Istruttore" wire:model="instructor">
-                                    @error('instructor')
-                                        <div class="invalid-feedback">{{ $message }}</div>
-                                    @enderror
+                                    <select class="form-select form-select-lg" wire:model="instructor_id">
+                                        <option value="">
+                                        @foreach($instructors as $ins)
+                                            <option value="{{$ins["id"]}}">{{$ins["name"]}}
+                                        @endforeach
+                                    </select>
                                 </div>
                             </div>
                             <div class="col-6 mt-2">
@@ -272,77 +276,114 @@
                                 </div>
                             </div>
 
+                            @if(env('MANAGE_COURSE', false))
 
-                            @foreach($when as $idW => $w)
-
-                                <div class="col-12">
-                                    <div class="day durata--corso d-flex">
-                                        <label for="" class="form-label">Giorno</label>
-                                        <div class="durata--corso_days mb-3">
-                                            <a class="{{in_array('lun', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'lun')">Lun</a>
-                                            <a class="{{in_array('mar', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mar')">Mar</a>
-                                            <a class="{{in_array('mer', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mer')">Mer</a>
-                                            <a class="{{in_array('gio', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'gio')">Gio</a>
-                                            <a class="{{in_array('ven', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'ven')">Ven</a>
-                                            <a class="{{in_array('sab', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'sab')">Sab</a>
-                                            <a class="{{in_array('dom', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'dom')">Dom</a>
-                                        </div>
-
-                                        <div class="durata--corso_select">
-                                            <div class="from--h me-3">
-                                                <label for="" class="form-label">Dalle</label>
-                                                <select class="form-select" wire:model="when.{{$idW}}.from">
-                                                    <option value="">--Seleziona--
-                                                    @for($c=6;$c<=23;$c++)
-                                                        <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
-                                                        <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
-                                                    @endfor
-                                                </select>
-                                            </div>
-                                            <div class="to--h">
-                                                <label for="" class="form-label">Alle</label>
-                                                <select class="form-select" wire:model="when.{{$idW}}.to">
-                                                    <option value="">--Seleziona--
-                                                    @for($c=6;$c<=23;$c++)
-                                                        <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
-                                                        <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
-                                                    @endfor
-                                                </select>
+                                <div class="row">
+                                    <div class="col-1">
+                                        <br><button class="btn--ui primary add--daye" wire:click.prevent="addPrice()"><i class="fa-solid fa-plus"></i></button>
+                                    </div>
+                                    <div class="col-6">
+                                        @foreach($prices as $idP => $p)
+                                            <div class="row mt-2">
+                                                <div class="col-6">
+                                                    <label for="abb" class="form-label">Abbonamento</label>
+                                                    <select class="form-control" wire:model="prices.{{$idP}}.course_subscription_id">
+                                                        @foreach($course_subscriptions as $s)
+                                                            <option value="{{$s["id"]}}">{{$s["name"]}}
+                                                        @endforeach
+                                                    </select>
+                                                </div>
+                                                <div class="col-5">
+                                                    <label for="price" class="form-label">Prezzo</label>
+                                                    <input class="form-control " type="text" onkeyup="onlyNumberAmount(this)" placeholder="€ 0,00" wire:model="prices.{{$idP}}.price">
+                                                </div>
+                                                <div class="col-1">
+                                                    @if($idP > 0)
+                                                        <br><button class="btn--ui primary add--daye" wire:click.prevent="delPrice({{$idP}})"><i class="fa-solid fa-minus"></i></button>
+                                                    @endif
+                                                </div>
                                             </div>
-                                        </div>
-
-                                        <button class="btn--ui primary remove--day position-absolute" wire:click.prevent="delRow({{$idW}})"><i class="fa-solid fa-minus"></i></button>
-                                        <button class="btn--ui primary add--day position-absolute" wire:click.prevent="addRow()"><i class="fa-solid fa-plus"></i></button>
+                                        @endforeach
                                     </div>
                                 </div>
 
-                            @endforeach
+                                @if($type == 'standard')
+
+                                    @foreach($when as $idW => $w)
+
+                                        <div class="col-12">
+                                            <div class="day durata--corso d-flex">
+                                                <label for="" class="form-label">Giorno</label>
+                                                <div class="durata--corso_days mb-3">
+                                                    <a class="{{in_array('lun', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'lun')">Lun</a>
+                                                    <a class="{{in_array('mar', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mar')">Mar</a>
+                                                    <a class="{{in_array('mer', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'mer')">Mer</a>
+                                                    <a class="{{in_array('gio', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'gio')">Gio</a>
+                                                    <a class="{{in_array('ven', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'ven')">Ven</a>
+                                                    <a class="{{in_array('sab', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'sab')">Sab</a>
+                                                    <a class="{{in_array('dom', $when[$idW]["day"]) ? 'selected' : 'notSelected'}}" wire:click="setDay({{$idW}}, 'dom')">Dom</a>
+                                                </div>
 
-                            <!--<div class="col-6">
-                                <div class="form--item">
-                                    <label for="inputName" class="form-label">Durata</label>
-                                    <input class="form-control js-keyupTitle " type="text" id="duration" placeholder="Durata" wire:model="duration">
+                                                <div class="durata--corso_select">
+                                                    <div class="from--h me-3">
+                                                        <label for="" class="form-label">Dalle</label>
+                                                        <select class="form-select" wire:model="when.{{$idW}}.from">
+                                                            <option value="">--Seleziona--
+                                                            @for($c=6;$c<=23;$c++)
+                                                                <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
+                                                                <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
+                                                            @endfor
+                                                        </select>
+                                                    </div>
+                                                    <div class="to--h">
+                                                        <label for="" class="form-label">Alle</label>
+                                                        <select class="form-select" wire:model="when.{{$idW}}.to">
+                                                            <option value="">--Seleziona--
+                                                            @for($c=6;$c<=23;$c++)
+                                                                <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:00
+                                                                <option value="{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30">{{str_pad($c, 2, "0", STR_PAD_LEFT)}}:30
+                                                            @endfor
+                                                        </select>
+                                                    </div>
+                                                </div>
 
-                                </div>
-                            </div>-->
-                            @if(false)
-                                <div class="col-12">
+                                                <button class="btn--ui primary remove--day position-absolute" wire:click.prevent="delRow({{$idW}})"><i class="fa-solid fa-minus"></i></button>
+                                                <button class="btn--ui primary add--day position-absolute" wire:click.prevent="addRow()"><i class="fa-solid fa-plus"></i></button>
+                                            </div>
+                                        </div>
+
+                                    @endforeach
+                                
+                                @endif
+
+                                <!--<div class="col-6">
                                     <div class="form--item">
-                                        <label for="inputName" class="form-label">Seleziona mesi</label>
-                                        @foreach($monthList as $idx => $y)
-                                            <div class="row">
-                                                <div class="col-12">
-                                                    <b>{{$idx}}</b>
+                                        <label for="inputName" class="form-label">Durata</label>
+                                        <input class="form-control js-keyupTitle " type="text" id="duration" placeholder="Durata" wire:model="duration">
+
+                                    </div>
+                                </div>-->
+                                @if(false)
+                                    <div class="col-12">
+                                        <div class="form--item">
+                                            <label for="inputName" class="form-label">Seleziona mesi</label>
+                                            @foreach($monthList as $idx => $y)
+                                                <div class="row">
+                                                    <div class="col-12">
+                                                        <b>{{$idx}}</b>
+                                                    </div>
+                                                    @foreach($y as $m)
+                                                        <div class="col-3">{{$m}}</div>
+                                                    @endforeach
                                                 </div>
-                                                @foreach($y as $m)
-                                                    <div class="col-3">{{$m}}</div>
-                                                @endforeach
-                                            </div>
-                                            <div class="row"><br></div>
-                                        @endforeach
+                                                <div class="row"><br></div>
+                                            @endforeach
+                                        </div>
                                     </div>
-                                </div>
+                                @endif
+                            
                             @endif
+                            
                         </div>
 
 

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

@@ -199,10 +199,14 @@
                                 <td>
 
                                     @if ($color == 'orange')
-                                        <a style="{{$diff == 'X' ? 'background-color:#d9ad86' : ''}};width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="{{$color}} lnk_{{$record["column_16"]}}" id="lnk_{{$record["column_15"]}}_{{$ii - 2}}_{{$record["column_17"]}}" onclick="setPayMonth('{{$record["column_15"]}}', {{$ii - 2}}, '{{$record["column_17"]}}', '{{$record["column_16"]}}')" style="cursor: pointer;"><small>{{$value}}</small></a>
+                                        <a style="width:100%;float:right; text-align:right; display:block; cursor:pointer;" class="{{$color}} {{$diff == 'X' ? 'half' : ''}} lnk_{{$record["column_16"]}}" id="lnk_{{$record["column_15"]}}_{{$ii - 2}}_{{$record["column_17"]}}" onclick="setPayMonth('{{$record["column_15"]}}', {{$ii - 2}}, '{{$record["column_17"]}}', '{{$record["column_16"]}}')" style="cursor: pointer;"><small>{{$value}}</small></a>
                                     @else
                                         @if ($color != 'wgrey')
-                                            <a style="width:100%;float:right; text-align:right; display:block;" class="{{$color}}"><small>{{$value}}</small></a>
+                                            @if($color == 'yellow')
+                                                <a style="width:100%;float:right; text-align:right; display:block;cursor:pointer;" class="{{$color}} lnk_{{$record["column_16"]}}" id="lnk_{{$record["column_15"]}}_{{$ii - 2}}_{{$record["column_17"]}}" onclick="resumePayMonth('{{$record["column_15"]}}', {{$ii - 2}}, '{{$record["column_17"]}}', '{{$record["column_16"]}}')"><small>{{$value}}</small></a>
+                                            @else
+                                                <a style="width:100%;float:right; text-align:right; display:block;" class="{{$color}}"><small>{{$value}}</small></a>
+                                            @endif
                                         @endif
                                     @endif
 
@@ -1137,6 +1141,7 @@
                 months.splice(months.indexOf(months), 1);
                 $("#lnk_" + course_id + "_" + month + "_" + member_id).addClass("orange").removeClass("blue").removeClass("selected");
             }
+            $(".btResumePayment").hide();
             if (months.length > 0)
             {
                 $(".btNewPayment").show();
@@ -1170,13 +1175,15 @@
             if(!months.includes(month))
             {
                 months.push(month);
-                $("#lnk_" + course_id + "_" + month + "_" + member_id).removeClass("blue").removeClass("selected").addClass("orange").addClass("selected");
+                $("#lnk_" + course_id + "_" + month + "_" + member_id).removeClass("blue").removeClass("selected").addClass("selected");
             }
             else
             {
                 months.splice(months.indexOf(months), 1);
-                $("#lnk_" + course_id + "_" + month + "_" + member_id).removeClass("orange").addClass("blue").addClass("selected");
+                $("#lnk_" + course_id + "_" + month + "_" + member_id).removeClass("orange").addClass("blue").removeClass("selected");
             }
+            $(".btNewPayment").hide();
+            $(".btStopPayment").hide();
             if (months.length > 0)
             {
                 $(".btResumePayment").show();

+ 6 - 1
resources/views/livewire/course_member.blade.php

@@ -626,10 +626,15 @@
             var toToYear = $('.toToYear').val();
             localStorage.setItem("toYearYearCourseMember", toToYear);
 
+            var filterFromPrevious = '';
+            @if($filterFromPrevious != '')
+                filterFromPrevious = '&filterFromPrevious={{$filterFromPrevious}}';
+            @endif
+
             $('#tablesaw-350').DataTable({
                 serverSide: true,
                 ajax: {
-                    url: '/get_course_members?filterCourse=' + filterCourse + '&filterDuration=' + filterDuration + '&filterLevel=' + filterLevel + '&filterType=' + filterType + '&filterFrequency=' + filterFrequency + '&filterDays=' + filterDays + '&filterHours=' + filterHours + '&filterStatus=' + filterStatus + '&filterSubscription=' + filterSubscription + '&filterYear=' + filterYear + '&filterCards=' + filterCards + '&filterCertificateScadenza=' + filterCertificateScadenza + '&filterCertificateType=' + filterCertificateType + '&fromYear=' + fromYear + '&toYear=' + toYear + '&fromFromYear=' + fromFromYear + '&toToYear=' + toToYear,
+                    url: '/get_course_members?filterCourse=' + filterCourse + '&filterDuration=' + filterDuration + '&filterLevel=' + filterLevel + '&filterType=' + filterType + '&filterFrequency=' + filterFrequency + '&filterDays=' + filterDays + '&filterHours=' + filterHours + '&filterStatus=' + filterStatus + '&filterSubscription=' + filterSubscription + '&filterYear=' + filterYear + '&filterCards=' + filterCards + '&filterCertificateScadenza=' + filterCertificateScadenza + '&filterCertificateType=' + filterCertificateType + '&fromYear=' + fromYear + '&toYear=' + toYear + '&fromFromYear=' + fromFromYear + '&toToYear=' + toToYear + filterFromPrevious,
                     /*dataSrc: function (json){
                         if(json.totals){
                             totals = json.totals;

+ 135 - 0
resources/views/livewire/course_member_one.blade.php

@@ -0,0 +1,135 @@
+<div class="col card--ui" id="card--dashboard">
+    
+    <header id="title--section" style="display:none !important"  class="d-flex align-items-center justify-content-between">
+        <div class="title--section_name d-flex align-items-center justify-content-between">
+            <i class="ico--ui title_section utenti me-2"></i>
+            <h2 class="primary">Durata corsi</h2>
+        </div>
+
+
+    </header>
+
+    <a class="btn--ui lightGrey" href="/settings?type=corsi"><i class="fa-solid fa-arrow-left"></i></a><br>
+
+    <section id="resume-table">
+        <div class="compare--chart_wrapper d-none"></div>
+
+        <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
+            <thead>
+                <tr>
+                    <th scope="col">Tipologia</th>
+                    <th scope="col">...</th>
+                </tr>
+            </thead>
+            <tbody id="checkall-target">
+                @foreach($records as $record)
+                    <tr>
+                        <td>{{$record["name"]}}</td>
+                        <td>
+                            <a href="/course_member_two?type={{$record["type"]}}" type="button" class="btn" >></button>
+                        </td>
+                    </tr>
+                @endforeach
+
+            </tbody>
+        </table>
+
+    </section>
+
+</div>
+
+@push('scripts')
+    <link href="/css/datatables.css" rel="stylesheet" />
+    <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
+    <script src="/assets/js/datatables.js"></script>
+    <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
+@endpush
+
+@push('scripts')
+    <script>
+
+        $(document).ready(function() {
+            loadDataTable();
+        } );
+
+        Livewire.on('load-data-table', () => {
+            loadDataTable();
+        });
+
+        function loadDataTable(){
+            if ( $.fn.DataTable.isDataTable('#tablesaw-350') ) {
+                $('#tablesaw-350').DataTable().destroy();
+            }
+            $('#tablesaw-350').DataTable({
+                thead: {
+                'th': {'background-color': 'blue'}
+                },
+                layout: {
+                    topStart : null,
+                    topEnd : null,
+                    top1A: {
+                        buttons: [
+                            {
+                                extend: 'collection',
+                                text: 'ESPORTA',
+                                buttons: [
+                                    {
+                                    extend: 'excelHtml5',
+                                        title: 'Durata corsi',
+                                        exportOptions: {
+                                            columns: ":not(':last')"
+                                        }
+                                    },
+                                    {
+                                        extend: 'pdfHtml5',
+                                        title: 'Durata corsi',
+                                        exportOptions: {
+                                            columns: ":not(':last')"
+                                        }
+                                    },
+                                    {
+                                        extend: 'print',
+                                        text: 'Stampa',
+                                        title: 'Durata corsi',
+                                        exportOptions: {
+                                            columns: ":not(':last')"
+                                        }
+                                    }
+                                ],
+                                dropup: true
+                            }
+                        ]
+                    },
+                    top1B : {
+                        pageLength: {
+                            menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
+                        }
+                    },
+                    top1C :'search',
+                },
+                pagingType: 'numbers',
+                "language": {
+                    "url": "/assets/js/Italian.json"
+                },
+                "fnInitComplete": function (oSettings, json) {
+                    var html = '&nbsp;<a href="#" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
+                    $(".dt-search").append(html);
+                }
+            });
+            $('#tablesaw-350 thead tr th').addClass('col');
+            $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
+
+            $(document).ready(function() {
+                $(document).on("click",".addData",function() {
+                    $(".title--section_addButton").trigger("click")
+                });
+            } );
+
+        }
+
+    </script>
+@endpush
+

+ 145 - 0
resources/views/livewire/course_member_two.blade.php

@@ -0,0 +1,145 @@
+<div class="col card--ui" id="card--dashboard">
+    
+    <header id="title--section" style="display:none !important"  class="d-flex align-items-center justify-content-between">
+        <div class="title--section_name d-flex align-items-center justify-content-between">
+            <i class="ico--ui title_section utenti me-2"></i>
+            <h2 class="primary">Durata corsi</h2>
+        </div>
+
+
+    </header>
+
+    <a class="btn--ui lightGrey" href="/course_member_one"><i class="fa-solid fa-arrow-left"></i></a><br>
+
+    <section id="resume-table">
+        <div class="compare--chart_wrapper d-none"></div>
+
+        <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
+            <thead>
+                <tr>
+                    <th scope="col">Nome</th>
+                    <th scope="col">Frequenza</th>
+                    <th scope="col">Livello</th>
+                    <th scope="col">Durata</th>                        
+                    <th scope="col">Giorni</th>                        
+                    <th scope="col">Istruttore</th>                        
+                    <th scope="col">...</th>
+                </tr>
+            </thead>
+            <tbody id="checkall-target">
+                @foreach($records as $record)
+                    <tr>
+                        <td>{{$record->name}}</td>
+                        <td>{{$record->frequency->name ?? ""}}</td>
+                        <td>{{$record->level->name ?? ""}}</td>
+                        <td></td>                            
+                        <td></td>                            
+                        <td>{{$record->getins->name ?? ""}}</td>
+                        <td>
+                            <a href="/course_member?id={{$record->id}}" type="button" class="btn" >></button>
+                        </td>
+                    </tr>
+                @endforeach
+
+            </tbody>
+        </table>
+
+    </section>
+
+</div>
+
+@push('scripts')
+    <link href="/css/datatables.css" rel="stylesheet" />
+    <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
+    <script src="/assets/js/datatables.js"></script>
+    <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
+@endpush
+
+@push('scripts')
+    <script>
+
+        $(document).ready(function() {
+            loadDataTable();
+        } );
+
+        Livewire.on('load-data-table', () => {
+            loadDataTable();
+        });
+
+        function loadDataTable(){
+            if ( $.fn.DataTable.isDataTable('#tablesaw-350') ) {
+                $('#tablesaw-350').DataTable().destroy();
+            }
+            $('#tablesaw-350').DataTable({
+                thead: {
+                'th': {'background-color': 'blue'}
+                },
+                layout: {
+                    topStart : null,
+                    topEnd : null,
+                    top1A: {
+                        buttons: [
+                            {
+                                extend: 'collection',
+                                text: 'ESPORTA',
+                                buttons: [
+                                    {
+                                    extend: 'excelHtml5',
+                                        title: 'Durata corsi',
+                                        exportOptions: {
+                                            columns: ":not(':last')"
+                                        }
+                                    },
+                                    {
+                                        extend: 'pdfHtml5',
+                                        title: 'Durata corsi',
+                                        exportOptions: {
+                                            columns: ":not(':last')"
+                                        }
+                                    },
+                                    {
+                                        extend: 'print',
+                                        text: 'Stampa',
+                                        title: 'Durata corsi',
+                                        exportOptions: {
+                                            columns: ":not(':last')"
+                                        }
+                                    }
+                                ],
+                                dropup: true
+                            }
+                        ]
+                    },
+                    top1B : {
+                        pageLength: {
+                            menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
+                        }
+                    },
+                    top1C :'search',
+                },
+                pagingType: 'numbers',
+                "language": {
+                    "url": "/assets/js/Italian.json"
+                },
+                "fnInitComplete": function (oSettings, json) {
+                    var html = '&nbsp;<a href="#" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
+                    $(".dt-search").append(html);
+                }
+            });
+            $('#tablesaw-350 thead tr th').addClass('col');
+            $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
+
+            $(document).ready(function() {
+                $(document).on("click",".addData",function() {
+                    $(".title--section_addButton").trigger("click")
+                });
+            } );
+
+        }
+
+    </script>
+@endpush
+

+ 12 - 12
resources/views/livewire/member.blade.php

@@ -1183,18 +1183,18 @@
                                                             <tr>
                                                                 <td colspan="5">
                                                                     <a class="{{$this->getSubscriptionStatus($member_course->subscribed, $member_course->id)}}" wire:click="setCreateSubscription({{$member_course->subscribed}}, {{$member_course->id}})" style="float:none; width:150px;{{$this->getSubscriptionStatus($member_course->subscribed,$member_course->id) == 'blue' || $this->getSubscriptionStatus($member_course->subscribed,$member_course->id) == 'orange' || $this->getSubscriptionStatus($member_course->subscribed,$member_course->id) == 'yellow' ? 'cursor:pointer' : ''}}">Iscrizione</a><br>
-                                                                    <a class="{{$this->getMonthStatus(9, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(9, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(9, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(9, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(9, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Set</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(10, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(10, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(10, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(10, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(10, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Ott</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(11, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(11, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(11, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(11, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(11, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Nov</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(12, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(12, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(12, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(12, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(12, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Dic</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(1, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(1, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(1, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(1, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(1, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Gen</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(2, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(2, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(2, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(2, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(2, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Feb</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(3, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(3, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(3, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(3, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(3, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Mar</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(4, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(4, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(4, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(4, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(4, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Apr</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(5, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(5, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(5, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(5, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(5, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Mag</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(6, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(6, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(6, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(6, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(6, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Giu</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(7, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(7, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(7, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(7, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(7, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Lug</a>&nbsp;
-                                                                    <a class="{{$this->getMonthStatus(8, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(8, '{{ $member_course->months }}', {{$member_course->id}})" {{$this->getMonthStatus(8, $member_course->months, $member_course->id) == 'blue' || $this->getMonthStatus(8, $member_course->months, $member_course->id) == 'orange' || $this->getMonthStatus(8, $member_course->months, $member_course->id) == 'yellow' ? 'style=cursor:pointer' : ''}}>Ago</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(9, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(9, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(9, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Set</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(10, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(10, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(10, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Ott</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(11, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(11, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(11, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ?  'style=cursor:pointer' : ''}}>Nov</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(12, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(12, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(12, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ?  'style=cursor:pointer' : ''}}>Dic</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(1, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(1, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(1, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ?  'style=cursor:pointer' : ''}}>Gen</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(2, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(2, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(2, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ?  'style=cursor:pointer' : ''}}>Feb</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(3, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(3, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(3, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ?  'style=cursor:pointer' : ''}}>Mar</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(4, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(4, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(4, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Apr</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(5, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(5, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(5, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Mag</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(6, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(6, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(6, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Giu</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(7, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(7, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(7, $member_course->months, $member_course->id), ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Lug</a>&nbsp;
+                                                                    <a class="{{$this->getMonthStatus(8, $member_course->months, $member_course->id)}}" wire:click="setPayMonth(8, '{{ $member_course->months }}', {{$member_course->id}})" {{in_array($this->getMonthStatus(8, $member_course->months, $member_course->id) , ['blue', 'orange', 'yellow', 'orange half']) ? 'style=cursor:pointer' : ''}}>Ago</a>&nbsp;
                                                                 </td>
                                                                 <td>
                                                                     <button type="button" class="btn" wire:click="editCourse({{ $member_course->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>&nbsp;

+ 2 - 1
resources/views/livewire/user.blade.php

@@ -33,7 +33,7 @@
                         <tr>
                             <td>{{$record->name}}</td>
                             <td>{{$record->email}}</td>
-                            <td>{{$record->level == 0 ? 'Admin' : 'Worker'}}</td>
+                            <td>{{$record->level == 0 ? 'Admin' : ($record->level == 1 ? 'Worker' : 'Istruttore')}}</td>
                             <td> <span class="tablesaw-cell-content"><span class="badge tessera-badge {{$record->enabled ? 'active' : 'suspended'}}">{{$record->enabled ? 'attivo' : 'disattivo'}}</span></span></td>
                             <td>
                                 @if($record->email != 'admin@admin.com')
@@ -103,6 +103,7 @@
                                     <select class="form-control" id="level" wire:model="level">
                                         <option value="0">Admin
                                         <option value="1">Worker
+                                        <option value="2">Istruttore
                                     </select>
                                 </div>
                             </div>

+ 7 - 0
routes/web.php

@@ -63,6 +63,8 @@ Route::group(['middleware' => 'auth'], function () {
     Route::get('/course_durations', \App\Http\Livewire\CourseDuration::class);
     Route::get('/course_levels', \App\Http\Livewire\CourseLevel::class);
     Route::get('/course_frequencies', \App\Http\Livewire\CourseFrequency::class);
+    Route::get('/course_member_one', \App\Http\Livewire\CourseMemberOne::class);
+    Route::get('/course_member_two', \App\Http\Livewire\CourseMemberTwo::class);
     Route::get('/course_list', \App\Http\Livewire\CourseList::class);
     Route::get('/course_member', \App\Http\Livewire\CourseMember::class);
     Route::get('/receipts', \App\Http\Livewire\Receipt::class);
@@ -1163,6 +1165,11 @@ Route::get('/get_course_members', function () {
         $datas = $datas->whereIn('member_id', $member_ids);
     }
 
+    if (isset($_GET["filterFromPrevious"]) && $_GET["filterFromPrevious"] != "")
+    {
+        $datas = $datas->whereIn('course_id', [$_GET["filterFromPrevious"]]);
+    }
+
     if ($_GET["filterCourse"] != "null") {
         $course_ids = [];
         $courses = explode(",", $_GET["filterCourse"]);