|
|
@@ -141,6 +141,7 @@ class Member extends Component
|
|
|
public $filterCertScaduto = 0;
|
|
|
public $filterCertInScadenza = 0;
|
|
|
public $already_existing = false;
|
|
|
+ public $tabOrder = ['dati', 'tesseramento', 'corsi', 'gruppi'];
|
|
|
|
|
|
protected $rules = [
|
|
|
'first_name' => 'required',
|
|
|
@@ -409,7 +410,6 @@ class Member extends Component
|
|
|
public function getCategories($records, $indentation)
|
|
|
{
|
|
|
foreach ($records as $record) {
|
|
|
- // $this->categories[] = array('id' => $record->id, 'name' => str_repeat(" / ", $indentation) . $record->name);
|
|
|
$this->categories[] = array('id' => $record->id, 'name' => $record->getTree(), 'indentation' => $indentation);
|
|
|
if (count($record->childs))
|
|
|
$this->getCategories($record->childs, $indentation + 1);
|
|
|
@@ -419,7 +419,6 @@ class Member extends Component
|
|
|
public function getCourses($records, $indentation)
|
|
|
{
|
|
|
foreach ($records as $record) {
|
|
|
- // $this->categories[] = array('id' => $record->id, 'name' => str_repeat(" / ", $indentation) . $record->name);
|
|
|
$this->courses[] = array('id' => $record->id, 'name' => $record->getTree());
|
|
|
if (count($record->childs))
|
|
|
$this->getCourses($record->childs, $indentation + 1);
|
|
|
@@ -460,12 +459,6 @@ class Member extends Component
|
|
|
|
|
|
$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->nations = \App\Models\Nation::select('id', 'name')->orderBy('name')->get();
|
|
|
- $this->provinces = \App\Models\Province::where('nation_id', 1)->orderBy('name')->get();
|
|
|
- $this->cities = \App\Models\City::where('province_id', 178)->orderBy('name')->orderBy('name')->get();*/
|
|
|
-
|
|
|
$c = \App\Models\Causal::where('type', 'IN')->where('money', true)->first();
|
|
|
if ($c)
|
|
|
$this->causalId = $c->id;
|
|
|
@@ -474,9 +467,6 @@ class Member extends Component
|
|
|
$this->showDetailF($_GET["member_detail"]);
|
|
|
$this->refreshAfter = 1;
|
|
|
}
|
|
|
- /*$this->birthNations = \App\Models\Nation::select('id', 'name')->orderBy('name')->get();
|
|
|
- $this->birthProvinces = \App\Models\Province::where('nation_id', 1)->orderBy('name')->get();
|
|
|
- $this->birthCities = \App\Models\City::where('province_id', 178)->orderBy('name')->orderBy('name')->get();*/
|
|
|
}
|
|
|
|
|
|
public function updated()
|
|
|
@@ -531,7 +521,6 @@ class Member extends Component
|
|
|
}
|
|
|
|
|
|
$this->emit('load-select');
|
|
|
- // $this->emit('destroy-data-table');
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -550,36 +539,6 @@ class Member extends Component
|
|
|
$this->isBirthItaly = false;
|
|
|
}
|
|
|
|
|
|
- /*public function loadProvinces()
|
|
|
- {
|
|
|
- $n = \App\Models\Nation::findOrFail($this->nation_id);
|
|
|
- $this->isItaly = $n->is_italy;
|
|
|
- $this->provinces = \App\Models\Province::where('nation_id', $this->nation_id)->orderBy('name')->get();
|
|
|
- $this->cities = array();
|
|
|
- $this->selectId++;
|
|
|
- }
|
|
|
-
|
|
|
- public function loadCities()
|
|
|
- {
|
|
|
- $this->cities = \App\Models\City::where('province_id', $this->province_id)->orderBy('name')->orderBy('name')->get();
|
|
|
- $this->selectId++;
|
|
|
- }
|
|
|
-
|
|
|
- public function loadBirthProvinces()
|
|
|
- {
|
|
|
- $n = \App\Models\Nation::findOrFail($this->birth_nation_id);
|
|
|
- $this->isBirthItaly = $n->is_italy;
|
|
|
- $this->birthProvinces = \App\Models\Province::where('nation_id', $this->birth_nation_id)->orderBy('name')->get();
|
|
|
- $this->birthCities = array();
|
|
|
- $this->selectId++;
|
|
|
- }
|
|
|
-
|
|
|
- public function loadBirthCities()
|
|
|
- {
|
|
|
- $this->birthCities = \App\Models\City::where('province_id', $this->birth_province_id)->get();
|
|
|
- $this->selectId++;
|
|
|
- }
|
|
|
- */
|
|
|
public function search()
|
|
|
{
|
|
|
if ($this->searchTxt != '') {
|
|
|
@@ -770,6 +729,14 @@ class Member extends Component
|
|
|
$this->emit('setEdit', true);
|
|
|
$this->emit('setEditCorso', false);
|
|
|
}
|
|
|
+ private function moveToNextTab()
|
|
|
+ {
|
|
|
+ $currentIndex = array_search($this->type, $this->tabOrder);
|
|
|
+
|
|
|
+ if ($currentIndex !== false && $currentIndex < count($this->tabOrder) - 1) {
|
|
|
+ $this->type = $this->tabOrder[$currentIndex + 1];
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
public function store($close)
|
|
|
{
|
|
|
@@ -925,8 +892,11 @@ class Member extends Component
|
|
|
$this->add = false;
|
|
|
} else {
|
|
|
$this->edit($member->id);
|
|
|
+ $this->emit('saved-and-continue', $this->type);
|
|
|
+ $this->dispatchBrowserEvent('scroll-to-top');
|
|
|
}
|
|
|
$this->emit('setEdit', false);
|
|
|
+
|
|
|
} catch (\Exception $ex) {
|
|
|
session()->flash('error', 'Errore (' . $ex->getMessage() . ')');
|
|
|
}
|
|
|
@@ -1170,7 +1140,9 @@ class Member extends Component
|
|
|
if ($close) {
|
|
|
$this->resetFields();
|
|
|
$this->update = false;
|
|
|
- }
|
|
|
+ }else{
|
|
|
+ $this->emit('saved-and-continue', $this->type);
|
|
|
+ $this->dispatchBrowserEvent('scroll-to-top'); }
|
|
|
$this->emit('setEdit', false);
|
|
|
} catch (\Exception $ex) {
|
|
|
session()->flash('error', 'Errore (' . $ex->getMessage() . ')');
|