From 1a396ca68944f74640af991c0e54c9a3ef27df67 Mon Sep 17 00:00:00 2001 From: MRoyhanF Date: Wed, 18 Dec 2024 12:46:17 +0700 Subject: [PATCH] feat: fligt | create flight feature --- public/css/app.css | 8 +- src/modules/flight/flight.controller.js | 12 +- src/resources/views/pages/flight/create.edge | 194 ++++++++++--------- 3 files changed, 121 insertions(+), 93 deletions(-) diff --git a/public/css/app.css b/public/css/app.css index 9991a27..034af6d 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -793,6 +793,10 @@ video { width: 33.333333%; } +.w-3\/12 { + width: 25%; +} + .w-5 { width: 1.25rem; } @@ -821,10 +825,6 @@ video { width: 100vw; } -.w-3\/12 { - width: 25%; -} - .min-w-\[200px\] { min-width: 200px; } diff --git a/src/modules/flight/flight.controller.js b/src/modules/flight/flight.controller.js index eb45349..3ee96e1 100644 --- a/src/modules/flight/flight.controller.js +++ b/src/modules/flight/flight.controller.js @@ -50,12 +50,20 @@ export const detail = async (req, res, next) => { export const create = async (req, res, next) => { try { const api = process.env.API_URL; - + + const routesResponse = await axios.get(`${api}/api/v1/routes`); + const airplanesResponse = await axios.get(`${api}/api/v1/airplanes`); + const terminalsResponse = await axios.get(`${api}/api/v1/terminals`); + + const data = { api: api, + routes: routesResponse.data.data || [], + airplanes: airplanesResponse.data.data || [], + terminals: terminalsResponse.data.data || [], }; - res.edge("pages/flight/create", data ) + res.edge("pages/flight/create", data); } catch (error) { next(error); } diff --git a/src/resources/views/pages/flight/create.edge b/src/resources/views/pages/flight/create.edge index 0bd0d57..9c144af 100644 --- a/src/resources/views/pages/flight/create.edge +++ b/src/resources/views/pages/flight/create.edge @@ -10,66 +10,49 @@
-
+
- - -
- -
- + @component('components/ui/select-search', { - id: 'airlineId', - name: 'airlineId', - placeholder: 'Choose a Airline' + id: 'routeId', + name: 'routeId', + placeholder: 'Choose a Routes' }) @slot('content') - - - - + @each(data in routes) + + @end @end @end -
- +
- - @component('components/ui/select-multiple', { - id: 'classId', - name: 'classId', - placeholder: 'Choose a Class' + + @component('components/ui/select-search', { + id: 'airplaneId', + name: 'airplaneId', + placeholder: 'Choose a Airplane' }) @slot('content') - - - - + @each(data in airplanes) + + @end @end @end -
+
-
+
@@ -78,8 +61,24 @@
+
+ + @component('components/ui/select-multiple', { + id: 'classId', + name: 'classId', + placeholder: 'Choose a Class' + }) + @slot('content') + + + + + + @end + @end +
-
+
@component('components/ui/select-search', { @@ -89,22 +88,11 @@ }) @slot('content') - - - - + @each(data in terminals) + + @end @end @end @@ -118,22 +106,11 @@ }) @slot('content') - - - - + @each(data in terminals) + + @end @end @end @@ -177,21 +154,64 @@
+ + // Format waktu ke ISO string + function formatToISOString(dateTime) { + const date = new Date(dateTime); + return date.toISOString(); + } +}); + + + @endslot @end \ No newline at end of file