|
|
@@ -40,6 +40,8 @@ class Calendar extends Component
|
|
|
|
|
|
public $lastDate = null;
|
|
|
|
|
|
+ public $course_colors = [];
|
|
|
+
|
|
|
public function mount()
|
|
|
{
|
|
|
$this->names = \App\Models\Calendar::orderBy('name')->groupBy('name')->pluck('name')->toArray();
|
|
|
@@ -50,6 +52,7 @@ class Calendar extends Component
|
|
|
$this->courts = \App\Models\Court::select('*')->where('enabled', true)->get();
|
|
|
$this->instructors = \App\Models\User::select('*')->where('level', 2)->where('enabled', true)->get();
|
|
|
$this->motivations = \App\Models\Motivation::select('*')->where('enabled', true)->where('type', 'del')->get();
|
|
|
+ $this->course_colors = \App\Models\CourseColor::pluck('hex', 'name')->toArray();
|
|
|
|
|
|
if (isset($_GET["name_filter"]))
|
|
|
$this->name_filter = $_GET["name_filter"];
|
|
|
@@ -71,8 +74,10 @@ class Calendar extends Component
|
|
|
{
|
|
|
$s = $c->motivation ? $c->motivation->name : '';
|
|
|
$data = array('id' => $c->id, 'title' => ($c->course ? $c->course->name : $c->name) . ($c->status == 99 ? ' (annullata - ' . $s . ')' : ''), 'start' => $c->from, 'end' => $c->to);
|
|
|
- if ($c->course && $c->course->color != '')
|
|
|
- $data['color'] = $c->course->color;
|
|
|
+ // if ($c->course && $c->course->color != '')
|
|
|
+ // $data['color'] = $c->course->color;
|
|
|
+ if (isset($this->course_colors[$c->name]))
|
|
|
+ $data['color'] = $this->course_colors[$c->name];
|
|
|
if ($c->status == 99)
|
|
|
$data['color'] = "#808080";
|
|
|
$this->records[] = $data;
|