|
@@ -127,15 +127,12 @@ class Member extends Component
|
|
|
public $member_categories = array(), $category_category_id;
|
|
public $member_categories = array(), $category_category_id;
|
|
|
|
|
|
|
|
// Courses data
|
|
// Courses data
|
|
|
- public $member_courses = array(), $course_course_id, $course_course_type, $course_date_from, $course_date_to, $course_when = array(), $addCourse, $updateCourse, $courseDataId, $course_course_subscription_id, $course_status, $course_note, $course_price, $course_subscription_price, $course_subscribed, $course_months = array(), $course_exist;
|
|
|
|
|
-
|
|
|
|
|
- public $course_months_list = [];
|
|
|
|
|
- public $course_price_list = [];
|
|
|
|
|
|
|
+ public $member_courses = array(), $course_course_id, $course_date_from, $course_date_to, $course_when = array(), $addCourse, $updateCourse, $courseDataId, $course_course_subscription_id, $course_status, $course_note, $course_price, $course_subscription_price, $course_subscribed, $course_months = array(), $course_exist;
|
|
|
|
|
|
|
|
public $course_name, $course_level_id, $course_type_id, $course_frequency_id;
|
|
public $course_name, $course_level_id, $course_type_id, $course_frequency_id;
|
|
|
|
|
|
|
|
// Certificates data
|
|
// Certificates data
|
|
|
- public $member_certificates = array(), $certificate_type, $certificate_filename_old, $certificate_filename, $certificate_expire_date, $certificate_status, $addCertificate, $updateCertificate, $certificateDataId, $cardCertificateId;
|
|
|
|
|
|
|
+ public $member_certificates = array(), $certificate_type, $certificate_filename_old, $certificate_filename, $certificate_expire_date, $certificate_status,$cardCertificateId, $addCertificate, $updateCertificate, $certificateDataId;
|
|
|
|
|
|
|
|
public $filterCard = [];
|
|
public $filterCard = [];
|
|
|
public $filterCategory = [];
|
|
public $filterCategory = [];
|
|
@@ -144,6 +141,7 @@ class Member extends Component
|
|
|
public $filterCertScaduto = 0;
|
|
public $filterCertScaduto = 0;
|
|
|
public $filterCertInScadenza = 0;
|
|
public $filterCertInScadenza = 0;
|
|
|
public $already_existing = false;
|
|
public $already_existing = false;
|
|
|
|
|
+
|
|
|
protected $rules = [
|
|
protected $rules = [
|
|
|
'first_name' => 'required',
|
|
'first_name' => 'required',
|
|
|
'last_name' => 'required',
|
|
'last_name' => 'required',
|
|
@@ -212,7 +210,6 @@ class Member extends Component
|
|
|
$this->age = '';
|
|
$this->age = '';
|
|
|
|
|
|
|
|
$this->error_fc = false;
|
|
$this->error_fc = false;
|
|
|
- $this->already_existing = false;
|
|
|
|
|
|
|
|
|
|
$this->isSaving = false;
|
|
$this->isSaving = false;
|
|
|
|
|
|
|
@@ -243,9 +240,6 @@ class Member extends Component
|
|
|
public function resetCourseFields()
|
|
public function resetCourseFields()
|
|
|
{
|
|
{
|
|
|
$this->course_course_id = null;
|
|
$this->course_course_id = null;
|
|
|
- $this->course_course_type = 'standard';
|
|
|
|
|
- $this->course_months_list = [];
|
|
|
|
|
- $this->course_price_list = [];
|
|
|
|
|
$this->course_when = array();
|
|
$this->course_when = array();
|
|
|
$this->course_when[] = array('day' => array(), 'from' => '', 'to' => '');
|
|
$this->course_when[] = array('day' => array(), 'from' => '', 'to' => '');
|
|
|
$this->course_date_from = null;
|
|
$this->course_date_from = null;
|
|
@@ -283,6 +277,7 @@ class Member extends Component
|
|
|
{
|
|
{
|
|
|
$this->course_course_id = null;
|
|
$this->course_course_id = null;
|
|
|
$this->course_level_id = '';
|
|
$this->course_level_id = '';
|
|
|
|
|
+ $this->course_type_id = '';
|
|
|
$this->course_frequency_id = '';
|
|
$this->course_frequency_id = '';
|
|
|
$levels_ids = [];
|
|
$levels_ids = [];
|
|
|
if ($this->course_name != '') {
|
|
if ($this->course_name != '') {
|
|
@@ -294,26 +289,28 @@ class Member extends Component
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$this->course_levels = \App\Models\CourseLevel::select('*')->where('enabled', true)->whereIn('id', $levels_ids)->get();
|
|
$this->course_levels = \App\Models\CourseLevel::select('*')->where('enabled', true)->whereIn('id', $levels_ids)->get();
|
|
|
|
|
+ $this->course_types = [];
|
|
|
$this->course_frequencies = [];
|
|
$this->course_frequencies = [];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function updatedCourseLevelId()
|
|
public function updatedCourseLevelId()
|
|
|
{
|
|
{
|
|
|
$this->course_course_id = null;
|
|
$this->course_course_id = null;
|
|
|
|
|
+ $this->course_type_id = '';
|
|
|
$this->course_frequency_id = '';
|
|
$this->course_frequency_id = '';
|
|
|
- $frequencies_ids = [];
|
|
|
|
|
|
|
+ $types_ids = [];
|
|
|
if ($this->course_level_id != '') {
|
|
if ($this->course_level_id != '') {
|
|
|
list($n, $y) = explode("(", $this->course_name);
|
|
list($n, $y) = explode("(", $this->course_name);
|
|
|
$y = trim(str_replace(")", "", $y));
|
|
$y = trim(str_replace(")", "", $y));
|
|
|
$all = \App\Models\Course::where('name', 'like', '%' . trim($n) . "%")->where('year', $y)->where('enabled', true)->where('course_level_id', $this->course_level_id)->get();
|
|
$all = \App\Models\Course::where('name', 'like', '%' . trim($n) . "%")->where('year', $y)->where('enabled', true)->where('course_level_id', $this->course_level_id)->get();
|
|
|
foreach ($all as $a) {
|
|
foreach ($all as $a) {
|
|
|
- $frequencies_ids[] = $a->course_frequency_id;
|
|
|
|
|
|
|
+ $types_ids[] = $a->course_type_id;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->whereIn('id', $frequencies_ids)->get();
|
|
|
|
|
|
|
+ $this->course_types = \App\Models\CourseType::select('*')->where('enabled', true)->whereIn('id', $types_ids)->get();
|
|
|
|
|
+ $this->course_frequencies = [];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /*
|
|
|
|
|
public function updatedCourseTypeId()
|
|
public function updatedCourseTypeId()
|
|
|
{
|
|
{
|
|
|
$this->course_course_id = null;
|
|
$this->course_course_id = null;
|
|
@@ -328,7 +325,7 @@ class Member extends Component
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
$this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->whereIn('id', $frequencies_ids)->get();
|
|
$this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->whereIn('id', $frequencies_ids)->get();
|
|
|
- }*/
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
public function updatedCourseFrequencyId()
|
|
public function updatedCourseFrequencyId()
|
|
|
{
|
|
{
|
|
@@ -336,36 +333,7 @@ class Member extends Component
|
|
|
if ($this->course_frequency_id != '') {
|
|
if ($this->course_frequency_id != '') {
|
|
|
list($n, $y) = explode("(", $this->course_name);
|
|
list($n, $y) = explode("(", $this->course_name);
|
|
|
$y = trim(str_replace(")", "", $y));
|
|
$y = trim(str_replace(")", "", $y));
|
|
|
- $this->course_course_id = \App\Models\Course::where('name', 'like', '%' . trim($n) . "%")->where('year', $y)->where('course_level_id', $this->course_level_id)->where('course_frequency_id', $this->course_frequency_id)->first()->id;
|
|
|
|
|
-
|
|
|
|
|
- $c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
|
|
|
- $this->course_price = formatPrice($c->price);
|
|
|
|
|
- $this->course_subscription_price = formatPrice($c->subscription_price);
|
|
|
|
|
- $this->course_date_from = $c->date_from;
|
|
|
|
|
- $this->course_date_to = $c->date_to;
|
|
|
|
|
- // Controllo se sono già iscritto la corso
|
|
|
|
|
- $this->course_exist = \App\Models\MemberCourse::where('course_id', $this->course_course_id)->where('member_id', $this->dataId)->count() > 0;
|
|
|
|
|
-
|
|
|
|
|
- // Carico gli abbonamenti e i mesi
|
|
|
|
|
- $period = \Carbon\CarbonPeriod::create($c->date_from, '1 month', $c->date_to);
|
|
|
|
|
- $this->course_months_list = [];
|
|
|
|
|
- foreach ($period as $dt) {
|
|
|
|
|
- $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();
|
|
|
|
|
-
|
|
|
|
|
- /*
|
|
|
|
|
|
|
+ $this->course_course_id = \App\Models\Course::where('name', 'like', '%' . trim($n) . "%")->where('year', $y)->where('course_level_id', $this->course_level_id)->where('course_type_id', $this->course_type_id)->where('course_frequency_id', $this->course_frequency_id)->first()->id;
|
|
|
|
|
|
|
|
if ($this->course_course_id > 0) {
|
|
if ($this->course_course_id > 0) {
|
|
|
$c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
$c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
@@ -377,7 +345,7 @@ class Member extends Component
|
|
|
$this->course_price = 0;
|
|
$this->course_price = 0;
|
|
|
$this->course_subscription_price = 0;
|
|
$this->course_subscription_price = 0;
|
|
|
$this->course_exist = false;
|
|
$this->course_exist = false;
|
|
|
- }*/
|
|
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
$this->course_price = 0;
|
|
$this->course_price = 0;
|
|
|
$this->course_subscription_price = 0;
|
|
$this->course_subscription_price = 0;
|
|
@@ -385,20 +353,6 @@ class Member extends Component
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function updatedCourseCourseType()
|
|
|
|
|
- {
|
|
|
|
|
- $this->course_level_id = '';
|
|
|
|
|
- $this->course_frequency_id = '';
|
|
|
|
|
- $this->course_course_id = null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public function updatedCourseCourseSubscriptionId()
|
|
|
|
|
- {
|
|
|
|
|
- $this->course_price = 0;
|
|
|
|
|
- if (isset($this->course_price_list[$this->course_course_subscription_id]))
|
|
|
|
|
- $this->course_price = $this->course_price_list[$this->course_course_subscription_id];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public $documents = [];
|
|
public $documents = [];
|
|
|
|
|
|
|
|
public $father_documents = [];
|
|
public $father_documents = [];
|
|
@@ -502,7 +456,9 @@ class Member extends Component
|
|
|
|
|
|
|
|
$this->getCategories(\App\Models\Category::select('id', 'name')->where('parent_id', null)->get(), 0);
|
|
$this->getCategories(\App\Models\Category::select('id', 'name')->where('parent_id', null)->get(), 0);
|
|
|
|
|
|
|
|
|
|
+ $this->courses = \App\Models\Course::select('id', 'name')->where('enabled', null)->get();
|
|
|
|
|
|
|
|
|
|
+ $this->course_subscriptions = \App\Models\CourseSubscription::select('*')->where('enabled', true)->get();
|
|
|
|
|
|
|
|
// $this->getCourses(\App\Models\Course::select('id', 'name')->where('parent_id', null)->get(), 0);
|
|
// $this->getCourses(\App\Models\Course::select('id', 'name')->where('parent_id', null)->get(), 0);
|
|
|
|
|
|
|
@@ -658,7 +614,7 @@ class Member extends Component
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
$this->course_names = [];
|
|
$this->course_names = [];
|
|
|
- $allC = \App\Models\Course::where('type', $this->course_course_type)->orderBy('name')->get();
|
|
|
|
|
|
|
+ $allC = \App\Models\Course::orderBy('name')->get();
|
|
|
foreach ($allC as $c) {
|
|
foreach ($allC as $c) {
|
|
|
$cN = $c->name . " (" . $c->year . ")";
|
|
$cN = $c->name . " (" . $c->year . ")";
|
|
|
if (!in_array($cN, $this->course_names))
|
|
if (!in_array($cN, $this->course_names))
|
|
@@ -751,9 +707,6 @@ class Member extends Component
|
|
|
$this->loadMemberCategories();
|
|
$this->loadMemberCategories();
|
|
|
$this->loadMemberCertificates();
|
|
$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();
|
|
|
|
|
-
|
|
|
|
|
return view('livewire.member', ['datas' => $datas]);
|
|
return view('livewire.member', ['datas' => $datas]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -763,29 +716,8 @@ class Member extends Component
|
|
|
$c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
$c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
|
$this->course_price = formatPrice($c->price);
|
|
$this->course_price = formatPrice($c->price);
|
|
|
$this->course_subscription_price = formatPrice($c->subscription_price);
|
|
$this->course_subscription_price = formatPrice($c->subscription_price);
|
|
|
- $this->course_date_from = $c->date_from;
|
|
|
|
|
- $this->course_date_to = $c->date_to;
|
|
|
|
|
// Controllo se sono già iscritto la corso
|
|
// Controllo se sono già iscritto la corso
|
|
|
$this->course_exist = \App\Models\MemberCourse::where('course_id', $this->course_course_id)->where('member_id', $this->dataId)->count() > 0;
|
|
$this->course_exist = \App\Models\MemberCourse::where('course_id', $this->course_course_id)->where('member_id', $this->dataId)->count() > 0;
|
|
|
-
|
|
|
|
|
- // Carico gli abbonamenti e i mesi
|
|
|
|
|
- $period = \Carbon\CarbonPeriod::create($c->date_from, '1 month', $c->date_to);
|
|
|
|
|
- $this->course_months_list = [];
|
|
|
|
|
- foreach ($period as $dt) {
|
|
|
|
|
- $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 {
|
|
} else {
|
|
|
$this->course_price = 0;
|
|
$this->course_price = 0;
|
|
|
$this->course_subscription_price = 0;
|
|
$this->course_subscription_price = 0;
|
|
@@ -1245,6 +1177,7 @@ class Member extends Component
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
public function cancel()
|
|
public function cancel()
|
|
|
{
|
|
{
|
|
|
$this->add = false;
|
|
$this->add = false;
|
|
@@ -1520,21 +1453,20 @@ class Member extends Component
|
|
|
$this->validate(['course_course_id' => 'required']);
|
|
$this->validate(['course_course_id' => 'required']);
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
- $mc = new \App\Models\MemberCourse();
|
|
|
|
|
- $mc->member_id = $this->dataId;
|
|
|
|
|
- $mc->course_id = $this->course_course_id;
|
|
|
|
|
- $mc->date_from = $this->course_date_from;
|
|
|
|
|
- $mc->date_to = $this->course_date_to;
|
|
|
|
|
- $mc->course_subscription_id = $this->course_course_subscription_id;
|
|
|
|
|
- $mc->status = $this->course_status;
|
|
|
|
|
- $mc->subscribed = false;
|
|
|
|
|
- $mc->price = currencyToDouble($this->course_price);
|
|
|
|
|
- $mc->subscription_price = currencyToDouble($this->course_subscription_price);
|
|
|
|
|
- $mc->notes = $this->course_note;
|
|
|
|
|
- $mc->months = json_encode($this->course_months);
|
|
|
|
|
- $mc->when = json_encode($this->course_when);
|
|
|
|
|
- $mc->save();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ \App\Models\MemberCourse::create([
|
|
|
|
|
+ 'member_id' => $this->dataId,
|
|
|
|
|
+ 'course_id' => $this->course_course_id,
|
|
|
|
|
+ 'date_from' => $this->course_date_from,
|
|
|
|
|
+ 'date_to' => $this->course_date_to,
|
|
|
|
|
+ 'course_subscription_id' => $this->course_course_subscription_id,
|
|
|
|
|
+ 'status' => $this->course_status,
|
|
|
|
|
+ 'subscribed' => false, // default non iscritto
|
|
|
|
|
+ 'price' => currencyToDouble($this->course_price),
|
|
|
|
|
+ 'subscription_price' => currencyToDouble($this->course_subscription_price),
|
|
|
|
|
+ 'notes' => $this->course_note,
|
|
|
|
|
+ 'months' => json_encode($this->course_months),
|
|
|
|
|
+ 'when' => json_encode($this->course_when)
|
|
|
|
|
+ ]);
|
|
|
// Se il corso ha associato una categoria iscrivo anche al gruppo
|
|
// Se il corso ha associato una categoria iscrivo anche al gruppo
|
|
|
$c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
$c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
|
if ($c) {
|
|
if ($c) {
|
|
@@ -1546,53 +1478,6 @@ class Member extends Component
|
|
|
]);
|
|
]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // Creo i pagamenti in base alla tipologia
|
|
|
|
|
- $r = \App\Models\CourseSubscription::findOrFail($this->course_course_subscription_id);
|
|
|
|
|
-
|
|
|
|
|
- $start = $this->course_date_from;
|
|
|
|
|
-
|
|
|
|
|
- // Creo il pagamento per l'iscrizione
|
|
|
|
|
- $rate = new \App\Models\Rate();
|
|
|
|
|
- $rate->member_id = $this->dataId;
|
|
|
|
|
- $rate->member_course_id = $mc->id;
|
|
|
|
|
- $rate->course_subscription_id = null;
|
|
|
|
|
- $rate->price = currencyToDouble($this->course_subscription_price);
|
|
|
|
|
- $rate->date = $start;
|
|
|
|
|
- $rate->months = json_encode([]);
|
|
|
|
|
- $rate->note = '';
|
|
|
|
|
- $rate->status = 0;
|
|
|
|
|
- $rate->is_subscription = true;
|
|
|
|
|
- $rate->save();
|
|
|
|
|
-
|
|
|
|
|
- $go = true;
|
|
|
|
|
- while ($go) {
|
|
|
|
|
-
|
|
|
|
|
- $mms = [];
|
|
|
|
|
- $mms[] = date("n", strtotime($start));
|
|
|
|
|
- for ($jj = 1; $jj < $r->months; $jj++) {
|
|
|
|
|
- $mms[] = date('n', strtotime("+" . $jj . " months", strtotime($start)));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $rate = new \App\Models\Rate();
|
|
|
|
|
- $rate->member_id = $this->dataId;
|
|
|
|
|
- $rate->member_course_id = $mc->id;
|
|
|
|
|
- $rate->course_subscription_id = $this->course_course_subscription_id;
|
|
|
|
|
- $rate->price = currencyToDouble($this->course_price);
|
|
|
|
|
- $rate->date = $start;
|
|
|
|
|
- $rate->months = json_encode($mms);
|
|
|
|
|
- $rate->note = '';
|
|
|
|
|
- $rate->status = 0;
|
|
|
|
|
- $rate->save();
|
|
|
|
|
-
|
|
|
|
|
- $start = date('Y-m-d', strtotime("+" . $r->months . " months", strtotime($start)));
|
|
|
|
|
-
|
|
|
|
|
- if ($start > $this->course_date_to) {
|
|
|
|
|
- $go = false;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
session()->flash('success, Corso creato');
|
|
session()->flash('success, Corso creato');
|
|
|
$this->resetCourseFields();
|
|
$this->resetCourseFields();
|
|
|
$this->addCourse = false;
|
|
$this->addCourse = false;
|
|
@@ -1616,7 +1501,6 @@ class Member extends Component
|
|
|
$c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
$c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
|
$this->course_name = $c->name . " (" . $c->year . ")";
|
|
$this->course_name = $c->name . " (" . $c->year . ")";
|
|
|
$this->course_level_id = $c->course_level_id;
|
|
$this->course_level_id = $c->course_level_id;
|
|
|
- $this->course_course_type = $c->type;
|
|
|
|
|
$this->course_type_id = $c->course_type_id;
|
|
$this->course_type_id = $c->course_type_id;
|
|
|
$this->course_frequency_id = $c->course_frequency_id;
|
|
$this->course_frequency_id = $c->course_frequency_id;
|
|
|
|
|
|
|
@@ -1990,19 +1874,25 @@ class Member extends Component
|
|
|
|
|
|
|
|
$price = $course["price"];
|
|
$price = $course["price"];
|
|
|
|
|
|
|
|
- if (sizeof($this->payMonths) == 1) {
|
|
|
|
|
|
|
+ if (sizeof($this->payMonths) == 1)
|
|
|
|
|
+ {
|
|
|
$month = $this->payMonths[0];
|
|
$month = $this->payMonths[0];
|
|
|
$records = \App\Models\Record::where('member_course_id', $this->selectedCourseMember)->where('deleted', 0)->get();
|
|
$records = \App\Models\Record::where('member_course_id', $this->selectedCourseMember)->where('deleted', 0)->get();
|
|
|
- foreach ($records as $record) {
|
|
|
|
|
|
|
+ foreach ($records as $record)
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
- if (in_array($month, json_decode($record->months))) {
|
|
|
|
|
|
|
+ if (in_array($month, json_decode($record->months)))
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
- foreach ($record->rows as $row) {
|
|
|
|
|
|
|
+ foreach ($record->rows as $row)
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
|
|
|
|
|
- if ($row->causal_id == $c->causal_id && !str_contains(strtolower($row->note), 'iscrizione')) {
|
|
|
|
|
|
|
+ if ($row->causal_id == $c->causal_id && !str_contains(strtolower($row->note), 'iscrizione'))
|
|
|
|
|
+ {
|
|
|
$tot = sizeof(json_decode($row->when));
|
|
$tot = sizeof(json_decode($row->when));
|
|
|
- foreach (json_decode($row->when) as $m) {
|
|
|
|
|
|
|
+ foreach(json_decode($row->when) as $m)
|
|
|
|
|
+ {
|
|
|
$price -= $row->amount / $tot;
|
|
$price -= $row->amount / $tot;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2062,16 +1952,21 @@ class Member extends Component
|
|
|
if ($mm->m == $m) {
|
|
if ($mm->m == $m) {
|
|
|
if ($mm->status == "")
|
|
if ($mm->status == "")
|
|
|
$this->payMonths[] = $m;
|
|
$this->payMonths[] = $m;
|
|
|
- if ($mm->status == "1") {
|
|
|
|
|
|
|
+ if ($mm->status == "1")
|
|
|
|
|
+ {
|
|
|
$mc = \App\Models\MemberCourse::findOrFail($selectedCourseMember);
|
|
$mc = \App\Models\MemberCourse::findOrFail($selectedCourseMember);
|
|
|
$price = $mc->price;
|
|
$price = $mc->price;
|
|
|
$payed = 0;
|
|
$payed = 0;
|
|
|
$extraC = '';
|
|
$extraC = '';
|
|
|
$recordsPayed = \App\Models\Record::where('member_course_id', $selectedCourseMember)->where('deleted', 0)->get();
|
|
$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')) {
|
|
|
|
|
|
|
+ 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));
|
|
$tot = sizeof(json_decode($row->when));
|
|
|
$payed += $row->amount / $tot;
|
|
$payed += $row->amount / $tot;
|
|
|
}
|
|
}
|
|
@@ -2137,17 +2032,22 @@ class Member extends Component
|
|
|
$class = "yellow";
|
|
$class = "yellow";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if ($class == 'green') {
|
|
|
|
|
|
|
+ if ($class == 'green')
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
$mc = \App\Models\MemberCourse::findOrFail($selectedCourseMember);
|
|
$mc = \App\Models\MemberCourse::findOrFail($selectedCourseMember);
|
|
|
$price = $mc->price;
|
|
$price = $mc->price;
|
|
|
$payed = 0;
|
|
$payed = 0;
|
|
|
$extraC = '';
|
|
$extraC = '';
|
|
|
$recordsPayed = \App\Models\Record::where('member_course_id', $selectedCourseMember)->where('deleted', 0)->get();
|
|
$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')) {
|
|
|
|
|
|
|
+ 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));
|
|
$tot = sizeof(json_decode($row->when));
|
|
|
$payed += $row->amount / $tot;
|
|
$payed += $row->amount / $tot;
|
|
|
}
|
|
}
|
|
@@ -2158,6 +2058,7 @@ class Member extends Component
|
|
|
$class = 'orange half';
|
|
$class = 'orange half';
|
|
|
//$class .= $extraC;
|
|
//$class .= $extraC;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|