From 860a20d9469397729c8c2675ce212a7525e7d23d Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Fri, 3 Jan 2025 17:10:08 +0100 Subject: [PATCH] Added: Fuel record create - not complete yet --- app/controllers/RefuelController.php | 9 ++++ app/models/Refuel.php | 5 ++ app/views/dashboard/index.php | 2 +- app/views/refuel/create.php | 71 ++++++++++++++++++++++++++++ app/views/vehicles/index.php | 1 + public/index.php | 8 +++- 6 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 app/controllers/RefuelController.php create mode 100644 app/models/Refuel.php create mode 100644 app/views/refuel/create.php diff --git a/app/controllers/RefuelController.php b/app/controllers/RefuelController.php new file mode 100644 index 0000000..b7b2151 --- /dev/null +++ b/app/controllers/RefuelController.php @@ -0,0 +1,9 @@ +getVehiclesByUser($_SESSION['user']['id']); + $this->view('refuel/create', ['title' => "New refuel record", 'vehicles' => $vehicles]); + } +} diff --git a/app/models/Refuel.php b/app/models/Refuel.php new file mode 100644 index 0000000..51b5c1a --- /dev/null +++ b/app/models/Refuel.php @@ -0,0 +1,5 @@ +

Welcome, !

- Add new refuel record! + Add new refuel record! List all vehicles
diff --git a/app/views/refuel/create.php b/app/views/refuel/create.php new file mode 100644 index 0000000..1514216 --- /dev/null +++ b/app/views/refuel/create.php @@ -0,0 +1,71 @@ + + +
+

get('title') ?>

+ + get('error')): ?> +
+ get('error')) ?> +
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
+
+ + diff --git a/app/views/vehicles/index.php b/app/views/vehicles/index.php index 4501970..29b6a74 100644 --- a/app/views/vehicles/index.php +++ b/app/views/vehicles/index.php @@ -11,6 +11,7 @@

+

Edit diff --git a/public/index.php b/public/index.php index 066ee8a..6c219fd 100644 --- a/public/index.php +++ b/public/index.php @@ -21,7 +21,7 @@ require_once '../core/middlewares/RequireAuth.php'; require_once models . 'User.php'; require_once models . 'Vehicle.php'; -#require_once models . 'Refueling.php'; +require_once models . 'Refuel.php'; // Initialize router $router = new Router(); @@ -41,7 +41,7 @@ $router->group('/auth', [], function ($router) { // dashboard route $router->add('/dashboard', 'DashboardController@index', ['RequireAuth']); -// habits routes +// vehicle routes $router->group('/vehicles', ['RequireAuth'], function ($router) { $router->add('', 'VehicleController@index'); $router->add('/create', 'VehicleController@create'); @@ -49,4 +49,8 @@ $router->group('/vehicles', ['RequireAuth'], function ($router) { $router->add('/delete/{id}', 'VehicleController@delete'); }); +$router->group('/refuel', ['RequireAuth'], function ($router) { + $router->add('/create', 'RefuelController@create'); +}); + $router->dispatch();