|
|
@@ -272,7 +272,9 @@ class Member extends Component
|
|
|
$levels_ids = [];
|
|
|
if ($this->course_name != '')
|
|
|
{
|
|
|
- $all = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->where('enabled', true)->get();
|
|
|
+ list($n, $y) = explode("(", $this->course_name);
|
|
|
+ $y = trim(str_replace(")", "", $y));
|
|
|
+ $all = \App\Models\Course::where('name', 'like', '%' . trim($n) . "%")->where('year', $y)->where('enabled', true)->get();
|
|
|
foreach($all as $a)
|
|
|
{
|
|
|
$levels_ids[] = $a->course_level_id;
|
|
|
@@ -291,7 +293,9 @@ class Member extends Component
|
|
|
$types_ids = [];
|
|
|
if ($this->course_level_id != '')
|
|
|
{
|
|
|
- $all = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->where('enabled', true)->where('course_level_id', $this->course_level_id)->get();
|
|
|
+ list($n, $y) = explode("(", $this->course_name);
|
|
|
+ $y = trim(str_replace(")", "", $y));
|
|
|
+ $all = \App\Models\Course::where('name', 'like', '%' . trim($n) . "%")->where('year', $y)->where('enabled', true)->where('course_level_id', $this->course_level_id)->get();
|
|
|
foreach($all as $a)
|
|
|
{
|
|
|
$types_ids[] = $a->course_type_id;
|
|
|
@@ -308,7 +312,9 @@ class Member extends Component
|
|
|
$frequencies_ids = [];
|
|
|
if ($this->course_type_id != '')
|
|
|
{
|
|
|
- $all = \App\Models\Course::where('name', 'like', '%' . $this->course_name . "%")->where('enabled', true)->where('course_level_id', $this->course_level_id)->where('course_type_id', $this->course_type_id)->get();
|
|
|
+ list($n, $y) = explode("(", $this->course_name);
|
|
|
+ $y = trim(str_replace(")", "", $y));
|
|
|
+ $all = \App\Models\Course::where('name', 'like', '%' . trim($n) . "%")->where('year', $y)->where('enabled', true)->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;
|
|
|
@@ -323,7 +329,9 @@ class Member extends Component
|
|
|
$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;
|
|
|
+ list($n, $y) = explode("(", $this->course_name);
|
|
|
+ $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;
|
|
|
|
|
|
if ($this->course_course_id > 0)
|
|
|
{
|
|
|
@@ -586,7 +594,15 @@ class Member extends Component
|
|
|
public function render()
|
|
|
{
|
|
|
|
|
|
- $this->course_names = \App\Models\Course::orderBy('name')->groupBy('name')->pluck('name');
|
|
|
+ $this->course_names = [];
|
|
|
+ $allC = \App\Models\Course::orderBy('name')->get();
|
|
|
+ foreach($allC as $c)
|
|
|
+ {
|
|
|
+ $cN = $c->name . " (" . $c->year . ")";
|
|
|
+ if (!in_array($cN, $this->course_names))
|
|
|
+ $this->course_names[] = $cN;
|
|
|
+ }
|
|
|
+ //$this->course_names = \App\Models\Course::orderBy('name')->groupBy('name')->pluck('name');
|
|
|
|
|
|
|
|
|
$datas = [];
|
|
|
@@ -1394,7 +1410,7 @@ class Member extends Component
|
|
|
|
|
|
// Carico i dati relativi alla struttura ad albero
|
|
|
$c = \App\Models\Course::findOrFail($this->course_course_id);
|
|
|
- $this->course_name = $c->name;
|
|
|
+ $this->course_name = $c->name . " (" . $c->year . ")";
|
|
|
$this->course_level_id = $c->course_level_id;
|
|
|
$this->course_type_id = $c->course_type_id;
|
|
|
$this->course_frequency_id = $c->course_frequency_id;
|
|
|
@@ -1965,15 +1981,15 @@ class Member extends Component
|
|
|
|
|
|
}
|
|
|
|
|
|
- public function updateBorsellino($member_id, $s)
|
|
|
+ public function updateBorsellino($importoBorsellino, $s)
|
|
|
{
|
|
|
- if ($this->importoBorsellino > 0)
|
|
|
+ if ($importoBorsellino > 0)
|
|
|
{
|
|
|
- $imp = $this->importoBorsellino;
|
|
|
+ $imp = $importoBorsellino;
|
|
|
if ($s == "-")
|
|
|
$imp = $imp * -1;
|
|
|
$money = new \App\Models\Money();
|
|
|
- $money->member_id = $member_id;
|
|
|
+ $money->member_id = $this->currentMember->id;
|
|
|
$money->record_id = null;
|
|
|
$money->amount = $imp;
|
|
|
$money->date = date("Y-m-d");
|