|
@@ -136,7 +136,7 @@ class Member extends Component
|
|
|
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,$cardCertificateId, $addCertificate, $updateCertificate, $certificateDataId;
|
|
|
|
|
|
|
+ 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 = [];
|
|
@@ -338,14 +338,18 @@ 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_type_id', $this->course_type_id)->where('course_frequency_id', $this->course_frequency_id)->first()->id;
|
|
|
|
|
|
|
+ $course = \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();
|
|
|
|
|
+
|
|
|
|
|
+ if ($course) {
|
|
|
|
|
+ $this->course_course_id = $course->id;
|
|
|
|
|
+ $this->course_price = formatPrice($course->price);
|
|
|
|
|
+ $this->course_subscription_price = formatPrice($course->subscription_price);
|
|
|
|
|
|
|
|
- if ($this->course_course_id > 0) {
|
|
|
|
|
- $c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
|
|
|
- $this->course_price = formatPrice($c->price);
|
|
|
|
|
- $this->course_subscription_price = formatPrice($c->subscription_price);
|
|
|
|
|
- // 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;
|
|
|
|
|
} else {
|
|
} else {
|
|
|
$this->course_price = 0;
|
|
$this->course_price = 0;
|
|
|
$this->course_subscription_price = 0;
|
|
$this->course_subscription_price = 0;
|
|
@@ -525,7 +529,6 @@ class Member extends Component
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$this->emit('load-select');
|
|
$this->emit('load-select');
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function checkIsItaly()
|
|
public function checkIsItaly()
|
|
@@ -900,7 +903,6 @@ class Member extends Component
|
|
|
$this->dispatchBrowserEvent('scroll-to-top');
|
|
$this->dispatchBrowserEvent('scroll-to-top');
|
|
|
}
|
|
}
|
|
|
$this->emit('setEdit', false);
|
|
$this->emit('setEdit', false);
|
|
|
-
|
|
|
|
|
} catch (\Exception $ex) {
|
|
} catch (\Exception $ex) {
|
|
|
session()->flash('error', 'Errore (' . $ex->getMessage() . ')');
|
|
session()->flash('error', 'Errore (' . $ex->getMessage() . ')');
|
|
|
}
|
|
}
|
|
@@ -1144,9 +1146,10 @@ class Member extends Component
|
|
|
if ($close) {
|
|
if ($close) {
|
|
|
$this->resetFields();
|
|
$this->resetFields();
|
|
|
$this->update = false;
|
|
$this->update = false;
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
$this->emit('saved-and-continue', $this->type);
|
|
$this->emit('saved-and-continue', $this->type);
|
|
|
- $this->dispatchBrowserEvent('scroll-to-top'); }
|
|
|
|
|
|
|
+ $this->dispatchBrowserEvent('scroll-to-top');
|
|
|
|
|
+ }
|
|
|
$this->emit('setEdit', false);
|
|
$this->emit('setEdit', false);
|
|
|
} catch (\Exception $ex) {
|
|
} catch (\Exception $ex) {
|
|
|
session()->flash('error', 'Errore (' . $ex->getMessage() . ')');
|
|
session()->flash('error', 'Errore (' . $ex->getMessage() . ')');
|
|
@@ -1425,19 +1428,6 @@ class Member extends Component
|
|
|
public function addCourse()
|
|
public function addCourse()
|
|
|
{
|
|
{
|
|
|
$this->resetCourseFields();
|
|
$this->resetCourseFields();
|
|
|
- /*if ($this->under18)
|
|
|
|
|
- {
|
|
|
|
|
- $this->course_months[] = array("m" => 9, "status" => "");
|
|
|
|
|
- $this->course_months[] = array("m" => 10, "status" => "");
|
|
|
|
|
- $this->course_months[] = array("m" => 11, "status" => "");
|
|
|
|
|
- $this->course_months[] = array("m" => 12, "status" => "");
|
|
|
|
|
- $this->course_months[] = array("m" => 1, "status" => "");
|
|
|
|
|
- $this->course_months[] = array("m" => 2, "status" => "");
|
|
|
|
|
- $this->course_months[] = array("m" => 3, "status" => "");
|
|
|
|
|
- $this->course_months[] = array("m" => 4, "status" => "");
|
|
|
|
|
- $this->course_months[] = array("m" => 5, "status" => "");
|
|
|
|
|
- $this->course_months[] = array("m" => 6, "status" => "");
|
|
|
|
|
- }*/
|
|
|
|
|
$this->addCourse = true;
|
|
$this->addCourse = true;
|
|
|
$this->updateCourse = false;
|
|
$this->updateCourse = false;
|
|
|
$this->emit('setEditCorso', true);
|
|
$this->emit('setEditCorso', true);
|
|
@@ -1870,25 +1860,19 @@ 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;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1948,21 +1932,16 @@ 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;
|
|
|
}
|
|
}
|
|
@@ -2028,22 +2007,17 @@ 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;
|
|
|
}
|
|
}
|
|
@@ -2054,7 +2028,6 @@ class Member extends Component
|
|
|
$class = 'orange half';
|
|
$class = 'orange half';
|
|
|
//$class .= $extraC;
|
|
//$class .= $extraC;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|