|
@@ -48,6 +48,8 @@ class Member extends Component
|
|
|
|
|
|
|
|
public $records, $first_name, $last_name, $image, $image_old, $status, $birth_place, $birth_city_id, $birth_province_id, $birth_nation_id, $birth_date, $gender, $fiscal_code, $address, $zip_code, $nation_id, $province_id, $city_id, $phone, $phone2, $phone3, $email, $enabled, $dataId, $update = false, $add = false;
|
|
public $records, $first_name, $last_name, $image, $image_old, $status, $birth_place, $birth_city_id, $birth_province_id, $birth_nation_id, $birth_date, $gender, $fiscal_code, $address, $zip_code, $nation_id, $province_id, $city_id, $phone, $phone2, $phone3, $email, $enabled, $dataId, $update = false, $add = false;
|
|
|
|
|
|
|
|
|
|
+ public $isSaving = false;
|
|
|
|
|
+
|
|
|
public $father_name, $mother_name, $father_email, $mother_email, $father_phone, $mother_phone, $father_fiscal_code, $mother_fiscal_code, $father_doc_number, $father_doc_type, $mother_doc_number, $mother_doc_type;
|
|
public $father_name, $mother_name, $father_email, $mother_email, $father_phone, $mother_phone, $father_fiscal_code, $mother_fiscal_code, $father_doc_number, $father_doc_type, $mother_doc_number, $mother_doc_type;
|
|
|
|
|
|
|
|
public $document_type, $document_number, $document_from, $document_expire_date, $document_files, $document_files_old;
|
|
public $document_type, $document_number, $document_from, $document_expire_date, $document_files, $document_files_old;
|
|
@@ -80,6 +82,12 @@ class Member extends Component
|
|
|
public $cards = array();
|
|
public $cards = array();
|
|
|
public $categories = array();
|
|
public $categories = array();
|
|
|
public $courses = array();
|
|
public $courses = array();
|
|
|
|
|
+
|
|
|
|
|
+ public $course_names = array();
|
|
|
|
|
+ public $course_levels = array();
|
|
|
|
|
+ public $course_types = array();
|
|
|
|
|
+ public $course_frequencies = array();
|
|
|
|
|
+
|
|
|
public $course_subscriptions = array();
|
|
public $course_subscriptions = array();
|
|
|
|
|
|
|
|
public $createSubscription = false;
|
|
public $createSubscription = false;
|
|
@@ -107,6 +115,8 @@ class Member extends Component
|
|
|
// Courses data
|
|
// Courses data
|
|
|
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 $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;
|
|
|
|
|
+
|
|
|
// Certificates data
|
|
// Certificates data
|
|
|
public $member_certificates = array(), $certificate_type, $certificate_filename_old, $certificate_filename, $certificate_expire_date, $certificate_status, $addCertificate, $updateCertificate, $certificateDataId;
|
|
public $member_certificates = array(), $certificate_type, $certificate_filename_old, $certificate_filename, $certificate_expire_date, $certificate_status, $addCertificate, $updateCertificate, $certificateDataId;
|
|
|
|
|
|
|
@@ -176,6 +186,8 @@ class Member extends Component
|
|
|
|
|
|
|
|
$this->error_fc = false;
|
|
$this->error_fc = false;
|
|
|
|
|
|
|
|
|
|
+ $this->isSaving = false;
|
|
|
|
|
+
|
|
|
$this->emit('load-data-table');
|
|
$this->emit('load-data-table');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -212,6 +224,10 @@ class Member extends Component
|
|
|
$this->course_subscribed = false;
|
|
$this->course_subscribed = false;
|
|
|
$this->course_months = array();
|
|
$this->course_months = array();
|
|
|
$this->course_note = '';
|
|
$this->course_note = '';
|
|
|
|
|
+ $this->course_name = '';
|
|
|
|
|
+ $this->course_level_id = '';
|
|
|
|
|
+ $this->course_type_id = '';
|
|
|
|
|
+ $this->course_frequency_id = '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function executeMultipleAction(){
|
|
public function executeMultipleAction(){
|
|
@@ -229,6 +245,91 @@ class Member extends Component
|
|
|
$this->image_old = '';
|
|
$this->image_old = '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function updatedCourseName()
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->course_course_id = null;
|
|
|
|
|
+ $this->course_level_id = '';
|
|
|
|
|
+ $this->course_type_id = '';
|
|
|
|
|
+ $this->course_frequency_id = '';
|
|
|
|
|
+ $levels_ids = [];
|
|
|
|
|
+ if ($this->course_name != '')
|
|
|
|
|
+ {
|
|
|
|
|
+ $all = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->get();
|
|
|
|
|
+ foreach($all as $a)
|
|
|
|
|
+ {
|
|
|
|
|
+ $levels_ids[] = $a->course_level_id;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->course_levels = \App\Models\CourseLevel::select('*')->where('enabled', true)->whereIn('id', $levels_ids)->get();
|
|
|
|
|
+ $this->course_types = [];
|
|
|
|
|
+ $this->course_frequencies = [];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function updatedCourseLevelId()
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->course_course_id = null;
|
|
|
|
|
+ $this->course_type_id = '';
|
|
|
|
|
+ $this->course_frequency_id = '';
|
|
|
|
|
+ $types_ids = [];
|
|
|
|
|
+ if ($this->course_level_id != '')
|
|
|
|
|
+ {
|
|
|
|
|
+ $all = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->where('course_level_id', $this->course_level_id)->get();
|
|
|
|
|
+ foreach($all as $a)
|
|
|
|
|
+ {
|
|
|
|
|
+ $types_ids[] = $a->course_type_id;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->course_types = \App\Models\CourseType::select('*')->where('enabled', true)->whereIn('id', $types_ids)->get();
|
|
|
|
|
+ $this->course_frequencies = [];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function updatedCourseTypeId()
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->course_course_id = null;
|
|
|
|
|
+ $this->course_frequency_id = '';
|
|
|
|
|
+ $frequencies_ids = [];
|
|
|
|
|
+ if ($this->course_type_id != '')
|
|
|
|
|
+ {
|
|
|
|
|
+ $all = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->where('course_level_id', $this->course_level_id)->where('course_type_id', $this->course_type_id)->get();
|
|
|
|
|
+ foreach($all as $a)
|
|
|
|
|
+ {
|
|
|
|
|
+ $frequencies_ids[] = $a->course_frequency_id;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->whereIn('id', $frequencies_ids)->get();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function updatedCourseFrequencyId()
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->course_course_id = null;
|
|
|
|
|
+ if ($this->course_frequency_id != '')
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->course_course_id = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->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)
|
|
|
|
|
+ {
|
|
|
|
|
+ $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
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->course_price = 0;
|
|
|
|
|
+ $this->course_subscription_price = 0;
|
|
|
|
|
+ $this->course_exist = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->course_price = 0;
|
|
|
|
|
+ $this->course_subscription_price = 0;
|
|
|
|
|
+ $this->course_exist = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public $documents = [];
|
|
public $documents = [];
|
|
|
|
|
|
|
|
public function removeDocument($idx)
|
|
public function removeDocument($idx)
|
|
@@ -326,11 +427,61 @@ class Member extends Component
|
|
|
|
|
|
|
|
public function updated()
|
|
public function updated()
|
|
|
{
|
|
{
|
|
|
|
|
+ if ($this->isSaving)
|
|
|
|
|
+ {
|
|
|
|
|
+ $zzz = [];
|
|
|
|
|
+ if ($this->birth_nation_id == null)
|
|
|
|
|
+ $zzz[] = 'birth_nation_id='.$this->birth_nation_id;
|
|
|
|
|
+ if ($this->isBirthItaly)
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->birth_province_id == null)
|
|
|
|
|
+ $zzz[] = 'birth_province_id='.$this->birth_province_id;
|
|
|
|
|
+ if ($this->birth_city_id == null)
|
|
|
|
|
+ $zzz[] = 'birth_city_id='.$this->birth_city_id;
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($this->nation_id == null)
|
|
|
|
|
+ $zzz[] = 'nation_id='.$this->nation_id;
|
|
|
|
|
+ if ($this->isItaly)
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->province_id == null)
|
|
|
|
|
+ $zzz[] = 'province_id='.$this->province_id;
|
|
|
|
|
+ if ($this->city_id == null)
|
|
|
|
|
+ $zzz[] = 'city_id='.$this->city_id;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $this->emit('setErrorMsg', $zzz);
|
|
|
|
|
+ }
|
|
|
// $this->emit('load-select');
|
|
// $this->emit('load-select');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function hydrate()
|
|
public function hydrate()
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
|
|
+ if ($this->isSaving)
|
|
|
|
|
+ {
|
|
|
|
|
+ $zzz = [];
|
|
|
|
|
+ if ($this->birth_nation_id == null)
|
|
|
|
|
+ $zzz[] = 'birth_nation_id='.$this->birth_nation_id;
|
|
|
|
|
+ if ($this->isBirthItaly)
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->birth_province_id == null)
|
|
|
|
|
+ $zzz[] = 'birth_province_id='.$this->birth_province_id;
|
|
|
|
|
+ if ($this->birth_city_id == null)
|
|
|
|
|
+ $zzz[] = 'birth_city_id='.$this->birth_city_id;
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($this->nation_id == null)
|
|
|
|
|
+ $zzz[] = 'nation_id='.$this->nation_id;
|
|
|
|
|
+ if ($this->isItaly)
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->province_id == null)
|
|
|
|
|
+ $zzz[] = 'province_id='.$this->province_id;
|
|
|
|
|
+ if ($this->city_id == null)
|
|
|
|
|
+ $zzz[] = 'city_id='.$this->city_id;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $this->emit('setErrorMsg', $zzz);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$this->emit('load-select');
|
|
$this->emit('load-select');
|
|
|
// $this->emit('destroy-data-table');
|
|
// $this->emit('destroy-data-table');
|
|
|
|
|
|
|
@@ -412,6 +563,9 @@ class Member extends Component
|
|
|
public function render()
|
|
public function render()
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
+ $this->course_names = \App\Models\Course::orderBy('name')->groupBy('name')->pluck('name');
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
$datas = [];
|
|
$datas = [];
|
|
|
// $this->emit('destroy-data-table');
|
|
// $this->emit('destroy-data-table');
|
|
|
if (false)
|
|
if (false)
|
|
@@ -574,6 +728,9 @@ class Member extends Component
|
|
|
|
|
|
|
|
public function store($close)
|
|
public function store($close)
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
|
|
+ $this->isSaving = false;
|
|
|
|
|
+
|
|
|
$this->emit('load-select');
|
|
$this->emit('load-select');
|
|
|
|
|
|
|
|
$rules = [
|
|
$rules = [
|
|
@@ -784,6 +941,9 @@ class Member extends Component
|
|
|
|
|
|
|
|
public function update($close)
|
|
public function update($close)
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
|
|
+ $this->isSaving = false;
|
|
|
|
|
+
|
|
|
$this->emit('load-select');
|
|
$this->emit('load-select');
|
|
|
|
|
|
|
|
$rules = [
|
|
$rules = [
|
|
@@ -1153,6 +1313,36 @@ class Member extends Component
|
|
|
session()->flash('error','Corso non trovato');
|
|
session()->flash('error','Corso non trovato');
|
|
|
} else {
|
|
} else {
|
|
|
$this->course_course_id = $memberCourse->course_id;
|
|
$this->course_course_id = $memberCourse->course_id;
|
|
|
|
|
+
|
|
|
|
|
+ // Carico i dati relativi alla struttura ad albero
|
|
|
|
|
+ $c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
|
|
|
+ $this->course_name = $c->name;
|
|
|
|
|
+ $this->course_level_id = $c->course_level_id;
|
|
|
|
|
+ $this->course_type_id = $c->course_type_id;
|
|
|
|
|
+ $this->course_frequency_id = $c->course_frequency_id;
|
|
|
|
|
+
|
|
|
|
|
+ $all = \App\Models\Course::where('name', 'like', '%' . $c->name . "%")->get();
|
|
|
|
|
+ foreach($all as $a)
|
|
|
|
|
+ {
|
|
|
|
|
+ $levels_ids[] = $a->course_level_id;
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->course_levels = \App\Models\CourseLevel::select('*')->where('enabled', true)->whereIn('id', $levels_ids)->get();
|
|
|
|
|
+
|
|
|
|
|
+ $all = \App\Models\Course::where('name', 'like', '%' . $c->name . "%")->where('course_level_id', $this->course_level_id)->get();
|
|
|
|
|
+ foreach($all as $a)
|
|
|
|
|
+ {
|
|
|
|
|
+ $types_ids[] = $a->course_type_id;
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->course_types = \App\Models\CourseType::select('*')->where('enabled', true)->whereIn('id', $types_ids)->get();
|
|
|
|
|
+
|
|
|
|
|
+ $frequencies_ids = [];
|
|
|
|
|
+ $all = \App\Models\Course::where('name', 'like', '%' . $c->name . "%")->where('course_level_id', $this->course_level_id)->where('course_type_id', $this->course_type_id)->get();
|
|
|
|
|
+ foreach($all as $a)
|
|
|
|
|
+ {
|
|
|
|
|
+ $frequencies_ids[] = $a->course_frequency_id;
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->course_frequencies = \App\Models\CourseFrequency::select('*')->where('enabled', true)->whereIn('id', $frequencies_ids)->get();
|
|
|
|
|
+
|
|
|
$this->course_date_from = $memberCourse->date_from;
|
|
$this->course_date_from = $memberCourse->date_from;
|
|
|
$this->course_date_to = $memberCourse->date_to;
|
|
$this->course_date_to = $memberCourse->date_to;
|
|
|
foreach(json_decode($memberCourse->when) as $z)
|
|
foreach(json_decode($memberCourse->when) as $z)
|