diff --git a/src/app/Controllers/CIncidence.php b/src/app/Controllers/CIncidence.php index a30b9e49..bb65b3eb 100644 --- a/src/app/Controllers/CIncidence.php +++ b/src/app/Controllers/CIncidence.php @@ -4,17 +4,42 @@ use App\Core\View; use App\Models\MIncidence; +use App\Models\MElement; class CIncidence { public function index() { - $incidences = MIncidence::findAll(); View::render([ "view" => "Incidence", "title" => "Incidences", "layout" => "MainLayout", + ]); + } + + public function findall() + { + $incidences = MIncidence::findAll(); + + View::render([ + "view" => "Incidence/SeeAllIncidences", + "title" => "Incidences", + "layout" => "MainLayout", "data" => ["incidences" => $incidences] ]); } + + public function get() + { + $elements = MElement::findAll(); + + View::render([ + "view" => "Incidence/Create", + "title" => "Create Incidence", + "layout" => "MainLayout", + "data" => [ + "elements" => $elements, + ] + ]); + } } diff --git a/src/app/Views/Incidence.php b/src/app/Views/Incidence.php index fe525e7a..ddc538f8 100644 --- a/src/app/Views/Incidence.php +++ b/src/app/Views/Incidence.php @@ -1,26 +1,13 @@ -
- - - - - - - - - - - - - - - - - - - - - - - -
IDElement NameNameDescriptionPhotoIncident Date
getId(); ?>name; ?>element()->name; ?>description; ?>photo; ?>getCreatedAt(); ?>
-
\ No newline at end of file +
+

Incidencias

+

Here you can see your incidences šŸ˜

+
+ + + +
+
diff --git a/src/app/Views/Incidence/Create.php b/src/app/Views/Incidence/Create.php new file mode 100644 index 00000000..a47868c8 --- /dev/null +++ b/src/app/Views/Incidence/Create.php @@ -0,0 +1,35 @@ +
+

Crear Incidencia

+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+
diff --git a/src/app/Views/Incidence/SeeAllIncidences.php b/src/app/Views/Incidence/SeeAllIncidences.php new file mode 100644 index 00000000..2128fca5 --- /dev/null +++ b/src/app/Views/Incidence/SeeAllIncidences.php @@ -0,0 +1,27 @@ +
+

Todas las Incidencias

+ + + + + + + + + + + + + + + + + + + + + + + +
Element NameNameDescriptionPhotoIncident Date
name; ?>element()->name; ?>description; ?>photo ?? 'No photo'; ?>getCreatedAt(); ?>
+
diff --git a/src/app/routes.php b/src/app/routes.php index fe2859f1..e59458f6 100644 --- a/src/app/routes.php +++ b/src/app/routes.php @@ -15,6 +15,7 @@ use App\Controllers\CHome; use App\Controllers\CAuth; +use App\Controllers\CIncidence; return $routes = [ "GET" => [ @@ -25,6 +26,18 @@ "/login" => [ "controller" => CAuth::class, "method" => "index" + ], + "/incidence" => [ + "controller" => CIncidence::class, + "method"=> "index" + ], + "/incidence/create" => [ + "controller" => CIncidence::class, + "method"=> "get" + ], + "/incidence/all" => [ + "controller" => CIncidence::class, + "method"=> "findall" ] ], ];