|
@@ -24,6 +24,16 @@ class Member extends Component
|
|
|
|
|
|
|
|
public $groupMsg = '';
|
|
public $groupMsg = '';
|
|
|
|
|
|
|
|
|
|
+ protected $messages = [
|
|
|
|
|
+ 'birth_nation_id.required' => 'birth_nation_id',
|
|
|
|
|
+ 'birth_province_id.required' => 'birth_province_id',
|
|
|
|
|
+ 'birth_city_id.required' => 'birth_city_id',
|
|
|
|
|
+ 'nation_id.required' => 'nation_id',
|
|
|
|
|
+ 'province_id.required' => 'province_id',
|
|
|
|
|
+ 'city_id.required' => 'city_id',
|
|
|
|
|
+ 'gender' => 'Obbligatorio'
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
public function sortBy($field)
|
|
public function sortBy($field)
|
|
|
{
|
|
{
|
|
|
if($this->sortField === $field)
|
|
if($this->sortField === $field)
|
|
@@ -66,6 +76,7 @@ class Member extends Component
|
|
|
|
|
|
|
|
public $age = '';
|
|
public $age = '';
|
|
|
|
|
|
|
|
|
|
+ public $disciplines = array();
|
|
|
public $cards = array();
|
|
public $cards = array();
|
|
|
public $categories = array();
|
|
public $categories = array();
|
|
|
public $courses = array();
|
|
public $courses = array();
|
|
@@ -88,13 +99,13 @@ class Member extends Component
|
|
|
public $active;
|
|
public $active;
|
|
|
|
|
|
|
|
// Card data
|
|
// Card data
|
|
|
- public $member_cards = array(), $card_card_id, $card_number, $card_date, $card_accept_date, $card_status, $addCard, $updateCard, $cardDataId;
|
|
|
|
|
|
|
+ public $member_cards = array(), $card_card_id, $card_number, $card_date, $card_accept_date, $card_status, $card_discipline1_id, $card_discipline2_id, $card_discipline3_id, $addCard, $updateCard, $cardDataId;
|
|
|
|
|
|
|
|
// Categories data
|
|
// Categories data
|
|
|
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_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();
|
|
|
|
|
|
|
+ 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;
|
|
|
|
|
|
|
|
// 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;
|
|
@@ -109,6 +120,8 @@ class Member extends Component
|
|
|
protected $rules = [
|
|
protected $rules = [
|
|
|
'first_name' => 'required',
|
|
'first_name' => 'required',
|
|
|
'last_name' => 'required',
|
|
'last_name' => 'required',
|
|
|
|
|
+ 'email' => 'required',
|
|
|
|
|
+ 'phone' => 'required',
|
|
|
'birth_date' => 'before_or_equal:today'
|
|
'birth_date' => 'before_or_equal:today'
|
|
|
];
|
|
];
|
|
|
|
|
|
|
@@ -136,7 +149,7 @@ class Member extends Component
|
|
|
$this->mother_doc_number = '';
|
|
$this->mother_doc_number = '';
|
|
|
$this->father_doc_type = '';
|
|
$this->father_doc_type = '';
|
|
|
$this->mother_doc_type = '';
|
|
$this->mother_doc_type = '';
|
|
|
- $this->gender = '';
|
|
|
|
|
|
|
+ $this->gender = null;
|
|
|
$this->fiscal_code = '';
|
|
$this->fiscal_code = '';
|
|
|
$this->address = '';
|
|
$this->address = '';
|
|
|
$this->zip_code = '';
|
|
$this->zip_code = '';
|
|
@@ -172,6 +185,9 @@ class Member extends Component
|
|
|
$this->card_date = null;
|
|
$this->card_date = null;
|
|
|
$this->card_accept_date = null;
|
|
$this->card_accept_date = null;
|
|
|
$this->card_status = 0;
|
|
$this->card_status = 0;
|
|
|
|
|
+ $this->card_discipline1_id = null;
|
|
|
|
|
+ $this->card_discipline2_id = null;
|
|
|
|
|
+ $this->card_discipline3_id = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function resetCertificateFields(){
|
|
public function resetCertificateFields(){
|
|
@@ -192,6 +208,7 @@ class Member extends Component
|
|
|
$this->course_status = 0;
|
|
$this->course_status = 0;
|
|
|
$this->course_price = 0;
|
|
$this->course_price = 0;
|
|
|
$this->course_subscription_price = 0;
|
|
$this->course_subscription_price = 0;
|
|
|
|
|
+ $this->course_exist = false;
|
|
|
$this->course_subscribed = false;
|
|
$this->course_subscribed = false;
|
|
|
$this->course_months = array();
|
|
$this->course_months = array();
|
|
|
$this->course_note = '';
|
|
$this->course_note = '';
|
|
@@ -277,6 +294,8 @@ class Member extends Component
|
|
|
|
|
|
|
|
$this->cards = \App\Models\Card::select('id', 'name')->get();
|
|
$this->cards = \App\Models\Card::select('id', 'name')->get();
|
|
|
|
|
|
|
|
|
|
+ $this->disciplines = \App\Models\Discipline::select('id', 'name')->get();
|
|
|
|
|
+
|
|
|
$this->categories = array();
|
|
$this->categories = array();
|
|
|
|
|
|
|
|
$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);
|
|
@@ -500,11 +519,14 @@ 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);
|
|
|
|
|
+ // 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;
|
|
|
|
|
+ $this->course_exist = false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -556,10 +578,60 @@ class Member extends Component
|
|
|
|
|
|
|
|
$rules = [
|
|
$rules = [
|
|
|
'first_name' => 'required',
|
|
'first_name' => 'required',
|
|
|
- 'last_name' => 'required'
|
|
|
|
|
|
|
+ 'last_name' => 'required',
|
|
|
|
|
+ 'email' => 'required',
|
|
|
|
|
+ 'phone' => 'required',
|
|
|
|
|
+ 'birth_nation_id' => 'required',
|
|
|
|
|
+ //'birth_place' => 'required',
|
|
|
|
|
+ 'address' => 'required',
|
|
|
|
|
+ 'zip_code' => 'required',
|
|
|
|
|
+ 'nation_id' => 'required',
|
|
|
|
|
+ 'fiscal_code' => 'required',
|
|
|
|
|
+ 'birth_date' => 'before_or_equal:today',
|
|
|
|
|
+ 'gender' => 'required'
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
|
|
+ if ($this->isBirthItaly)
|
|
|
|
|
+ {
|
|
|
|
|
+ $rules['birth_province_id'] = 'required';
|
|
|
|
|
+ $rules['birth_city_id'] = 'required';
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ $rules['birth_place'] = 'required';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($this->isItaly)
|
|
|
|
|
+ {
|
|
|
|
|
+ $rules['province_id'] = 'required';
|
|
|
|
|
+ $rules['city_id'] = 'required';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $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->validate($rules);
|
|
$this->validate($rules);
|
|
|
|
|
+ //$this->emit('setErrors');
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
$name = '';
|
|
$name = '';
|
|
@@ -714,7 +786,59 @@ class Member extends Component
|
|
|
{
|
|
{
|
|
|
$this->emit('load-select');
|
|
$this->emit('load-select');
|
|
|
|
|
|
|
|
- $this->validate();
|
|
|
|
|
|
|
+ $rules = [
|
|
|
|
|
+ 'first_name' => 'required',
|
|
|
|
|
+ 'last_name' => 'required',
|
|
|
|
|
+ 'email' => 'required',
|
|
|
|
|
+ 'phone' => 'required',
|
|
|
|
|
+ 'birth_nation_id' => 'required',
|
|
|
|
|
+ //'birth_place' => 'required',
|
|
|
|
|
+ 'address' => 'required',
|
|
|
|
|
+ 'zip_code' => 'required',
|
|
|
|
|
+ 'nation_id' => 'required',
|
|
|
|
|
+ 'fiscal_code' => 'required',
|
|
|
|
|
+ 'birth_date' => 'before_or_equal:today'
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ if ($this->isBirthItaly)
|
|
|
|
|
+ {
|
|
|
|
|
+ $rules['birth_province_id'] = 'required';
|
|
|
|
|
+ $rules['birth_city_id'] = 'required';
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ $rules['birth_place'] = 'required';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($this->isItaly)
|
|
|
|
|
+ {
|
|
|
|
|
+ $rules['province_id'] = 'required';
|
|
|
|
|
+ $rules['city_id'] = 'required';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $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->validate($rules);
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
$name = '';
|
|
$name = '';
|
|
@@ -878,7 +1002,10 @@ class Member extends Component
|
|
|
'date' => $this->card_date,
|
|
'date' => $this->card_date,
|
|
|
'accept_date' => $this->card_accept_date != '' ? $this->card_accept_date : $this->card_date,
|
|
'accept_date' => $this->card_accept_date != '' ? $this->card_accept_date : $this->card_date,
|
|
|
'expire_date' => $expire_date,
|
|
'expire_date' => $expire_date,
|
|
|
- 'status' => $this->card_status
|
|
|
|
|
|
|
+ 'status' => $this->card_status,
|
|
|
|
|
+ 'discipline1_id' => $this->card_discipline1_id,
|
|
|
|
|
+ 'discipline2_id' => $this->card_discipline2_id,
|
|
|
|
|
+ 'discipline3_id' => $this->card_discipline3_id,
|
|
|
]);
|
|
]);
|
|
|
session()->flash('success, Tesserato creato');
|
|
session()->flash('success, Tesserato creato');
|
|
|
$this->resetCardFields();
|
|
$this->resetCardFields();
|
|
@@ -899,6 +1026,9 @@ class Member extends Component
|
|
|
$this->card_date = $memberCard->date;
|
|
$this->card_date = $memberCard->date;
|
|
|
$this->card_accept_date = $memberCard->accept_date;
|
|
$this->card_accept_date = $memberCard->accept_date;
|
|
|
$this->card_status = $memberCard->status;
|
|
$this->card_status = $memberCard->status;
|
|
|
|
|
+ $this->card_discipline1_id = $memberCard->discipline1_id;
|
|
|
|
|
+ $this->card_discipline2_id = $memberCard->discipline2_id;
|
|
|
|
|
+ $this->card_discipline3_id = $memberCard->discipline3_id;
|
|
|
$this->cardDataId = $memberCard->id;
|
|
$this->cardDataId = $memberCard->id;
|
|
|
$this->updateCard = true;
|
|
$this->updateCard = true;
|
|
|
$this->addCard = false;
|
|
$this->addCard = false;
|
|
@@ -949,7 +1079,10 @@ class Member extends Component
|
|
|
'date' => $this->card_date,
|
|
'date' => $this->card_date,
|
|
|
'accept_date' => $this->card_accept_date != '' ? $this->card_accept_date : $this->card_date,
|
|
'accept_date' => $this->card_accept_date != '' ? $this->card_accept_date : $this->card_date,
|
|
|
'expire_date' => $expire_date,
|
|
'expire_date' => $expire_date,
|
|
|
- 'status' => $this->card_status
|
|
|
|
|
|
|
+ 'status' => $this->card_status,
|
|
|
|
|
+ 'discipline1_id' => $this->card_discipline1_id,
|
|
|
|
|
+ 'discipline2_id' => $this->card_discipline2_id,
|
|
|
|
|
+ 'discipline3_id' => $this->card_discipline3_id,
|
|
|
]);
|
|
]);
|
|
|
session()->flash('success','Tesserato aggiornato');
|
|
session()->flash('success','Tesserato aggiornato');
|
|
|
$this->resetCardFields();
|
|
$this->resetCardFields();
|
|
@@ -988,7 +1121,7 @@ class Member extends Component
|
|
|
public function storeCourse()
|
|
public function storeCourse()
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- $this->validate(['course_course_id' => 'required', 'course_course_subscription_id' => 'required']);
|
|
|
|
|
|
|
+ $this->validate(['course_course_id' => 'required']);
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
\App\Models\MemberCourse::create([
|
|
\App\Models\MemberCourse::create([
|