|
|
@@ -166,7 +166,7 @@ class Member extends Component
|
|
|
public $presenze = 0;
|
|
|
public $assenze = 0;
|
|
|
public $annullate = 0;
|
|
|
- public $recuperi = 0;
|
|
|
+ public $recuperi = [];
|
|
|
|
|
|
protected $rules = [
|
|
|
'first_name' => 'required',
|
|
|
@@ -746,12 +746,12 @@ class Member extends Component
|
|
|
$this->presenze = 0;
|
|
|
$this->assenze = 0;
|
|
|
$this->annullate = 0;
|
|
|
- $this->recuperi = 0;
|
|
|
+ $this->recuperi = [];
|
|
|
|
|
|
define("PRESENZE", 0);
|
|
|
define("ASSENZE", 1);
|
|
|
- define("RECUPERO", 2);
|
|
|
- define("ANNULLATE", 3);
|
|
|
+ // define("RECUPERO", 2);
|
|
|
+ define("ANNULLATE", 2);
|
|
|
|
|
|
$chartData = [
|
|
|
PRESENZE => [
|
|
|
@@ -775,17 +775,16 @@ class Member extends Component
|
|
|
"categoryPercentage" => 0.3,
|
|
|
|
|
|
],
|
|
|
- RECUPERO => [
|
|
|
- "label" => "Recupero",
|
|
|
- "backgroundColor" => "#7136f6",
|
|
|
- "data" => array_fill(0, 12, 0),
|
|
|
- "grouped" => true,
|
|
|
- "stack" => "chartData",
|
|
|
- "barThickness" => "flex",
|
|
|
- "barPercentage" => 0.5,
|
|
|
- "categoryPercentage" => 0.3,
|
|
|
-
|
|
|
- ],
|
|
|
+ // RECUPERO => [
|
|
|
+ // "label" => "Recupero",
|
|
|
+ // "backgroundColor" => "#7136f6",
|
|
|
+ // "data" => array_fill(0, 12, 0),
|
|
|
+ // "grouped" => true,
|
|
|
+ // "stack" => "chartData",
|
|
|
+ // "barThickness" => "flex",
|
|
|
+ // "barPercentage" => 0.5,
|
|
|
+ // "categoryPercentage" => 0.3,
|
|
|
+ // ],
|
|
|
ANNULLATE => [
|
|
|
"label" => "Annullate",
|
|
|
"backgroundColor" => "#808080",
|
|
|
@@ -834,7 +833,7 @@ class Member extends Component
|
|
|
$annullata = false;
|
|
|
if (in_array($calendar->id, $presences))
|
|
|
{
|
|
|
- $status = "<span style=\"color:#0c6197\">Prezenza ordinaria</span>";
|
|
|
+ $status = "<span style=\"color:#0c6197\">Presenza</span>";
|
|
|
$this->presenze += 1;
|
|
|
$this->valori[$monthMap[date('n', strtotime($calendar->from))]] += 1;
|
|
|
$chartData[PRESENZE]["data"][$monthMap[date('n', strtotime($calendar->from))]] += 1;
|
|
|
@@ -869,7 +868,7 @@ class Member extends Component
|
|
|
$chartData[ANNULLATE]["data"][$monthMap[date('n', strtotime($calendar->from))]] += 1;
|
|
|
}
|
|
|
|
|
|
- $this->member_presences[] = array('calendar_id' => $calendar->id, 'from' => $calendar->from, 'to' => $calendar->to, 'status' => $status);//\App\Models\Presence::where('member_id', $this->dataId)->get();
|
|
|
+ $this->member_presences[] = array('calendar_id' => $calendar->id, 'from' => $calendar->from, 'to' => $calendar->to, 'status' => $status, 'motivation' => null);//\App\Models\Presence::where('member_id', $this->dataId)->get();
|
|
|
}
|
|
|
|
|
|
//$courses = array(1);
|
|
|
@@ -883,14 +882,23 @@ class Member extends Component
|
|
|
}
|
|
|
|
|
|
// Manuali (recuperi)
|
|
|
+ // $calendar_recuperi = \App\Models\Calendar::where('manual', 1)->where('name', $this->presenceTitleFilter)->pluck('id')->toArray();
|
|
|
$calendar_recuperi = \App\Models\Calendar::where('manual', 1)->where('name', $this->presenceTitleFilter)->pluck('id')->toArray();
|
|
|
$presences_recuperi = \App\Models\Presence::whereIn('calendar_id', $calendar_recuperi)->where('member_id', $this->dataId)->get();
|
|
|
foreach($presences_recuperi as $p)
|
|
|
{
|
|
|
- $this->member_presences[] = array('calendar_id' => $p->calendar->id, 'from' => $p->calendar->from, 'to' => $p->calendar->to, 'status' => '<span style="color:#7136f6">Recupero</span>');//\App\Models\Presence::where('member_id', $this->dataId)->get();
|
|
|
- $this->recuperi += 1;
|
|
|
+ // $this->member_presences[] = array('calendar_id' => $p->calendar->id, 'from' => $p->calendar->from, 'to' => $p->calendar->to, 'status' => '<span style="color:#7136f6">Recupero</span>', 'motivation' => $p->motivation->name);//\App\Models\Presence::where('member_id', $this->dataId)->get();
|
|
|
+ $this->member_presences[] = array('calendar_id' => $p->calendar->id, 'from' => $p->calendar->from, 'to' => $p->calendar->to, 'status' => '<span style=\"color:#0c6197\">Presenza</span>', 'motivation' => $p->motivation->name);//\App\Models\Presence::where('member_id', $this->dataId)->get();
|
|
|
+
|
|
|
+ if ($p->motivation) {
|
|
|
+ if (!isset($this->recuperi[$p->motivation->name])) $this->recuperi[$p->motivation->name] = 0;
|
|
|
+
|
|
|
+ $this->recuperi[$p->motivation->name] += 1;
|
|
|
+ }
|
|
|
+ $this->presenze += 1;
|
|
|
|
|
|
- $chartData[RECUPERO]["data"][$monthMap[date('n', strtotime($p->calendar->from))]] += 1;
|
|
|
+ $chartData[PRESENZE]["data"][$monthMap[date('n', strtotime($p->calendar->from))]] += 1;
|
|
|
+ // $chartData[RECUPERO]["data"][$monthMap[date('n', strtotime($p->calendar->from))]] += 1;
|
|
|
}
|
|
|
|
|
|
$sortVariable='from';
|
|
|
@@ -946,7 +954,8 @@ class Member extends Component
|
|
|
// Manuali (recuperi)
|
|
|
$calendar_recuperi = \App\Models\Calendar::where('manual', 1)->pluck('name')->toArray();
|
|
|
|
|
|
- $this->presenceYears = \App\Models\Course::where('created_at', '>', '2025-08-01')->whereIn('id', $course_ids)->orderBy('year')->groupBy('year')->pluck('year')->toArray();
|
|
|
+ // $this->presenceYears = \App\Models\Course::where('created_at', '>', '2025-08-01')->whereIn('id', $course_ids)->orderBy('year')->groupBy('year')->pluck('year')->toArray();
|
|
|
+ $this->presenceYears = \App\Models\Course::whereIn('id', $course_ids)->orderBy('year')->groupBy('year')->pluck('year')->toArray();
|
|
|
$this->presenceTitle = \App\Models\Course::whereIn('id', $course_ids)->orderBy('name')->groupBy('name')->pluck('name')->toArray();
|
|
|
|
|
|
foreach($calendar_recuperi as $cr)
|