|
|
@@ -517,6 +517,7 @@ class Member extends Component
|
|
|
$this->festivita[] = $pasquetta; // Lunedì dell'Angelo
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public function updated()
|
|
|
@@ -632,87 +633,10 @@ class Member extends Component
|
|
|
|
|
|
|
|
|
$datas = [];
|
|
|
- // $this->emit('destroy-data-table');
|
|
|
- if (false) {
|
|
|
-
|
|
|
- if (!$this->advanced) {
|
|
|
- /*if ($this->search != '')
|
|
|
- $datas = \App\Models\Member::select('members.*') // , \DB::raw('SUM(records.id) As total'))
|
|
|
- ->where('first_name', 'LIKE', '%' . $this->search . '%')
|
|
|
- ->orWhere('last_name', 'LIKE', '%' . $this->search . '%')
|
|
|
- ->orWhere('email', 'LIKE', '%' . $this->search . '%');
|
|
|
- $this->records = \App\Models\Member::where('first_name', 'LIKE', '%' . $this->search . '%')->orWhere('last_name', 'LIKE', '%' . $this->search . '%')->orWhere('email', 'LIKE', '%' . $this->search . '%')->get();
|
|
|
- else*/
|
|
|
- $this->records = \App\Models\Member::select('id', 'first_name', 'last_name', 'phone')->get();
|
|
|
- //$datas = \App\Models\Member::select('members.*');
|
|
|
- } else {
|
|
|
- //$this->records = \App\Models\Member::where('id', '>', 0);
|
|
|
- $datas = \App\Models\Member::select('members.*')->where('id', '>', 0);
|
|
|
- if (sizeof($this->filterCard) > 0) {
|
|
|
- $card_ids = \App\Models\MemberCard::whereIn('card_id', $this->filterCard)->pluck('member_id');
|
|
|
- //$this->records->whereIn('id', $card_ids);
|
|
|
- $datas = $datas->whereIn('id', $card_ids);
|
|
|
- }
|
|
|
- if (sizeof($this->filterCategory) > 0) {
|
|
|
- $cats_ids = \App\Models\MemberCategory::whereIn('category_id', $this->filterCategory)->pluck('member_id');
|
|
|
- //$this->records->whereIn('id', $cats_ids);
|
|
|
- $datas = $datas->whereIn('id', $cats_ids);
|
|
|
- }
|
|
|
- $certs = [];
|
|
|
-
|
|
|
- if ($this->filterCertNormal > 0) {
|
|
|
- $normal = \App\Models\MemberCertificate::where('type', 'N')->pluck('member_id');
|
|
|
- //$this->records->whereIn('id', $normal);
|
|
|
- $datas = $datas->whereIn('id', $normal);;
|
|
|
- }
|
|
|
- if ($this->filterCertAgonistic > 0) {
|
|
|
- $agonistic = \App\Models\MemberCertificate::where('type', 'A')->pluck('member_id');
|
|
|
- //$this->records->whereIn('id', $agonistic);
|
|
|
- $datas = $datas->whereIn('id', $agonistic);
|
|
|
- }
|
|
|
- if ($this->filterCertScaduto > 0) {
|
|
|
- $scaduto = \App\Models\MemberCertificate::where('expire_date', '<', date("Y-m-d"))->pluck('member_id');
|
|
|
- //$this->records->whereIn('id', $scaduto);
|
|
|
- $datas = $datas->whereIn('id', $scaduto);
|
|
|
- }
|
|
|
- if ($this->filterCertInScadenza > 0) {
|
|
|
- $scaduto = \App\Models\MemberCertificate::whereBetween('expire_date', [date("Y-m-d"), date("Y-m-d", strtotime("+1 month"))])->pluck('member_id');
|
|
|
- //$this->records->whereIn('id', $scaduto);
|
|
|
- $datas = $datas->whereIn('id', $scaduto);
|
|
|
- }
|
|
|
- if (sizeof($certs) > 0) {
|
|
|
- $datas = $datas->whereIn('id', $certs);
|
|
|
- //$this->records->whereIn('id', $certs);
|
|
|
- }
|
|
|
- $this->records = $datas->get();
|
|
|
- }
|
|
|
-
|
|
|
- foreach ($this->records as $r) {
|
|
|
- $r->age = $r->getAge();
|
|
|
- $active = $r->isActive();
|
|
|
- $r->status = $active["status"];
|
|
|
- $r->date = $active["date"];
|
|
|
- $r->certificate = $r->hasCertificate()["date"];
|
|
|
- $r->state = $r->getStatus()["status"];
|
|
|
- }
|
|
|
- /*
|
|
|
- if ($this->sortAsc)
|
|
|
- $this->records = $this->records->sortBy($this->sortField);
|
|
|
- else
|
|
|
- $this->records = $this->records->sortByDesc($this->sortField);
|
|
|
- */
|
|
|
-
|
|
|
- //$datas = $datas->get(); // ->orderBy($this->sortField, $this->sortAsc ? 'ASC' : 'DESC')->paginate(10);
|
|
|
-
|
|
|
- //$this->records = $this->records->get();
|
|
|
-
|
|
|
-
|
|
|
- $this->emit('load-data-table');
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
$this->loadMemberCards();
|
|
|
$this->loadMemberCourses();
|
|
|
- $this->loadMemberPresences();
|
|
|
+ // $this->loadMemberPresences();
|
|
|
$this->loadMemberCategories();
|
|
|
$this->loadMemberCertificates();
|
|
|
|
|
|
@@ -1177,6 +1101,10 @@ class Member extends Component
|
|
|
$this->edit($member->id);
|
|
|
$this->emit('saved-and-continue', $this->type);
|
|
|
$this->dispatchBrowserEvent('scroll-to-top');
|
|
|
+ if ($this->birth_nation_id != null)
|
|
|
+ $this->isBirthItaly = \App\Models\Nation::findOrFail($this->birth_nation_id)->first()->is_italy;// $this->nation_id;//$this->checkIsItaly();
|
|
|
+ if ($this->nation_id != null)
|
|
|
+ $this->isItaly = \App\Models\Nation::findOrFail($this->nation_id)->first()->is_italy;// $this->nation_id;//$this->checkIsItaly();
|
|
|
}
|
|
|
$this->emit('setEdit', false);
|
|
|
} catch (\Exception $ex) {
|
|
|
@@ -1269,6 +1197,12 @@ class Member extends Component
|
|
|
$this->update = true;
|
|
|
$this->add = false;
|
|
|
|
|
|
+ //$this->loadMemberCards();
|
|
|
+ //$this->loadMemberCourses();
|
|
|
+ //$this->loadMemberPresences();
|
|
|
+ //$this->loadMemberCategories();
|
|
|
+ //$this->loadMemberCertificates();
|
|
|
+
|
|
|
$this->emit('setIds', $this->nation_id, $this->birth_nation_id);
|
|
|
|
|
|
$this->emit('load-select');
|
|
|
@@ -1420,11 +1354,17 @@ class Member extends Component
|
|
|
updateMemberData($this->dataId);
|
|
|
session()->flash('success', 'Tesserato aggiornato');
|
|
|
if ($close) {
|
|
|
- $this->resetFields();
|
|
|
- $this->update = false;
|
|
|
+ $this->emit('saved-and-close');
|
|
|
+ //$this->resetFields();
|
|
|
+ //$this->update = false;
|
|
|
} else {
|
|
|
+
|
|
|
$this->emit('saved-and-continue', $this->type);
|
|
|
$this->dispatchBrowserEvent('scroll-to-top');
|
|
|
+ if ($this->birth_nation_id != null)
|
|
|
+ $this->isBirthItaly = \App\Models\Nation::findOrFail($this->birth_nation_id)->first()->is_italy;// $this->nation_id;//$this->checkIsItaly();
|
|
|
+ if ($this->nation_id != null)
|
|
|
+ $this->isItaly = \App\Models\Nation::findOrFail($this->nation_id)->first()->is_italy;// $this->nation_id;//$this->checkIsItaly();
|
|
|
}
|
|
|
$this->emit('setEdit', false);
|
|
|
} catch (\Exception $ex) {
|