Luca Parisio 2 月之前
父節點
當前提交
2be8fcdfde
共有 2 個文件被更改,包括 16 次插入3 次删除
  1. 14 1
      app/Http/Livewire/Member.php
  2. 2 2
      resources/views/livewire/rate.blade.php

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

@@ -1184,7 +1184,7 @@ class Member extends Component
                 $this->age = $interval->y . " anni";
                 $this->under18 = $interval->y < 18;
                 $this->update = true;
-                $this->add = false;
+                $this->add = false;                
 
                 $this->emit('setIds', $this->nation_id, $this->birth_nation_id);
 
@@ -1778,6 +1778,19 @@ class Member extends Component
                 foreach (json_decode($memberCourse->months) as $z) {
                     $this->course_months[] = array("m" => $z->m, "status" => $z->status);
                 }
+
+                $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();
+                
                 $this->courseDataId = $memberCourse->id;
                 $this->updateCourse = true;
                 $this->addCourse = false;

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

@@ -562,7 +562,7 @@
                     var subCausalId = '';
                     var createSubscription = '';
                     var months = '';
-                    var price = '';
+                    var price = '0';
                     var subscription_price = '';
                     var courseId = 0;
                     var rateId = 0;
@@ -585,7 +585,7 @@
                                 if (months != '') 
                                     months += "|";
                                 months += $("#months_" + id).val();;
-                                price += $("#price_" + id).val();;                            
+                                price = parseFloat(price) + parseFloat($("#price_" + id).val());                            
                             }
                             courseId = $("#courseId_" + id).val();;
                             if (rateId != '')