فهرست منبع

Fix valore abbonamento

Luca Parisio 9 ماه پیش
والد
کامیت
a7c5202f7b
1فایلهای تغییر یافته به همراه11 افزوده شده و 1 حذف شده
  1. 11 1
      app/Http/Livewire/Member.php

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

@@ -353,15 +353,20 @@ class Member extends Component
                 $this->course_months_list[] = $dt->format("m");
             }
             
+            $course_subscription_ids = [];
             $this->course_price_list = [];
             if ($c->prices != null)
             {
                 foreach(json_decode($c->prices) as $z)
                 {
                     $this->course_price_list[$z->course_subscription_id] = $z->price;
+                    if ($z->price > 0)
+                        $course_subscription_ids[] = $z->course_subscription_id;
                 }
             }
 
+            $this->course_subscriptions = \App\Models\CourseSubscription::select('*')->whereIn('id', $course_subscription_ids)->where('enabled', true)->get();
+
             /*
 
             if ($this->course_course_id > 0) {
@@ -749,7 +754,7 @@ class Member extends Component
         $this->loadMemberCertificates();
 
         $this->courses = \App\Models\Course::select('id', 'name')->where('type', $this->course_course_type)->get();
-        $this->course_subscriptions = \App\Models\CourseSubscription::select('*')->where('enabled', true)->get();
+        // $this->course_subscriptions = \App\Models\CourseSubscription::select('*')->where('enabled', true)->get();
 
         return view('livewire.member', ['datas' => $datas]);
     }
@@ -773,15 +778,20 @@ class Member extends Component
                 $this->course_months_list[] = $dt->format("m");
             }
 
+            $course_subscription_ids = [];
             $this->course_price_list = [];
             if ($c->prices != null)
             {
                 foreach(json_decode($c->prices) as $z)
                 {
                     $this->course_price_list[$z->course_subscription_id] = $z->price;
+                    if ($z->price > 0)
+                        $course_subscription_ids[] = $z->course_subscription_id;
                 }
             }
 
+            $this->course_subscriptions = \App\Models\CourseSubscription::select('*')->whereIn('id', $course_subscription_ids)->where('enabled', true)->get();
+
         } else {
             $this->course_price = 0;
             $this->course_subscription_price = 0;