Skip to content

Commit

Permalink
[19] - Navbar añadido
Browse files Browse the repository at this point in the history
  • Loading branch information
LeWricka authored May 24, 2021
1 parent a0e75fc commit 3348f2d
Show file tree
Hide file tree
Showing 20 changed files with 1,286 additions and 1,433 deletions.
Binary file modified mysql/ib_logfile0
Binary file not shown.
Binary file modified mysql/ibdata1
Binary file not shown.
Binary file modified mysql/ibtmp1
Binary file not shown.
22 changes: 13 additions & 9 deletions src/app/Controllers/Calendar/CalendarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,27 @@
namespace App\Controllers\Calendar;

use Core\Routines\Domain\Routine;
use DateTime;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

class CalendarController extends Controller
{
public function __invoke(Request $request)
{
$routine1 = new Routine("First Routine", new DateTime('2021-05-14'), "#e04f1a");
$routine2 = new Routine("First Routine 2.0", new DateTime('2021-05-14'), "#82b54b");
$routine3 = new Routine("Second Routine", new DateTime('2021-05-17'), "#82b54b");
$routine4 = new Routine("Third Routine", new DateTime('2021-05-20'), "#ffb119");
$routine5 = new Routine("Final Routine", new DateTime('2021-05-22'), "#e04f1a");

$routine1 = new Routine("First Routine","2021-05-14", "2021-05-16", "#e04f1a");
$routine2 = new Routine("Second Routine", "2021-05-17", "2021-05-19", "#82b54b");
$routine3 = new Routine("Third Routine","2021-05-20", "2021-05-20", "#ffb119");
$routine4 = new Routine("Final Routine","2021-05-22", "2021-05-24", "#e04f1a");


$routines = [];
array_push($routines,$routine1->routineToJson(), $routine2->routineToJson(), $routine3->routineToJson(), $routine4->routineToJson());

$routines = [
$routine1->routineToKeyValue(),
$routine2->routineToKeyValue(),
$routine3->routineToKeyValue(),
$routine4->routineToKeyValue(),
$routine5->routineToKeyValue()
];
return view('pages/mainCalendar', ['routines' => $routines]);
}
}
39 changes: 39 additions & 0 deletions src/app/Controllers/DailySchedule/DailyScheduleController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace App\Controllers\DailySchedule;

use Core\Routines\Domain\Routine;
use DateTime;
use Illuminate\Routing\Controller;

class DailyScheduleController extends Controller
{
public function __invoke($date)
{
$routines = $this->getRoutinesOfDay($date);
return view('pages/dailySchedule', ['date' => $date, 'routines' => $routines]);
}

public function getRoutinesOfDay(string $date)
{
$allRoutines = $this->getAllRoutines();
$routinesOfDay = [];
foreach ($allRoutines as $routine) {
if ($routine->getStart()->format('Y-m-d') == $date) {
array_push($routinesOfDay, $routine);
}
}
return $routinesOfDay;
}

public function getAllRoutines()
{
return [
new Routine("First Routine", new DateTime('2021-05-14'), "#e04f1a"),
new Routine("First Routine 2.0", new DateTime('2021-05-14'), "#82b54b"),
new Routine("Second Routine", new DateTime('2021-05-17'), "#82b54b"),
new Routine("Third Routine", new DateTime('2021-05-20'), "#ffb119"),
new Routine("Final Routine", new DateTime('2021-05-22'), "#e04f1a")
];
}
}
13 changes: 13 additions & 0 deletions src/app/View/Components/Footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\View\Components;

use Illuminate\View\Component;

class Footer extends Component
{
public function render()
{
return view('components.footer');
}
}
13 changes: 13 additions & 0 deletions src/app/View/Components/Head.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\View\Components;

use Illuminate\View\Component;

class Head extends Component
{
public function render()
{
return view('components.head');
}
}
13 changes: 13 additions & 0 deletions src/app/View/Components/Navbar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\View\Components;

use Illuminate\View\Component;

class Navbar extends Component
{
public function render()
{
return view('components.navbar');
}
}
41 changes: 6 additions & 35 deletions src/core/Routines/Domain/Routine.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,38 @@

namespace Core\Routines\Domain;

use DateTime;

class Routine
{
private string $name;
private String $start;
private String $end;
private DateTime $start;
private string $color;

public function __construct(string $name, string $start, string $end, string $color)
public function __construct(string $name, DateTime $start, string $color)
{
$this->name = $name;
$this->start = $start;
$this->end = $end;
$this->color = $color;
}


public function getName(): string
{
return $this->name;
}


public function setName(string $name): void
{
$this->name = $name;
}


public function getStart(): String
public function getStart(): DateTime
{
return $this->start;
}

public function setStart(String $start): void
{
$this->start = $start;
}

public function getEnd(): String
{
return $this->end;
}

public function setEnd(String $end): void
{
$this->end = $end;
}

public function getColor(): string
{
return $this->color;
}

public function setColor(string $color): void
public function routineToKeyValue()
{
$this->color = $color;
return ["title" => $this->getName(), "start" => $this->getStart()->format('Y-m-d'), "color" => $this->getColor()];
}

public function routineToJson(){
return ["title" => $this->getName(), "start" => $this->getStart(), "end" => $this->getEnd(), "color" => $this->getColor()];
}

}
Empty file.
Loading

0 comments on commit 3348f2d

Please sign in to comment.