From c84c826c3f7815511fe2fbf092b9cf7eefed274e Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 4 Aug 2021 16:38:31 +0200 Subject: [PATCH] Airports Model/Controller --- controllers/Airport.php | 17 +++++++ controllers/airport/_list_toolbar.htm | 18 ++++++++ controllers/airport/config_form.yaml | 10 +++++ controllers/airport/config_list.yaml | 12 +++++ controllers/airport/create.htm | 46 +++++++++++++++++++ controllers/airport/index.htm | 1 + controllers/airport/preview.htm | 22 +++++++++ controllers/airport/update.htm | 54 +++++++++++++++++++++++ lang/en/lang.php | 20 ++++++++- models/Airport.php | 36 +++++++++++++++ models/airport/columns.yaml | 25 +++++++++++ models/airport/fields.yaml | 36 +++++++++++++++ plugin.yaml | 13 +++++- updates/builder_table_create_airports.php | 2 +- 14 files changed, 309 insertions(+), 3 deletions(-) create mode 100644 controllers/Airport.php create mode 100644 controllers/airport/_list_toolbar.htm create mode 100644 controllers/airport/config_form.yaml create mode 100644 controllers/airport/config_list.yaml create mode 100644 controllers/airport/create.htm create mode 100644 controllers/airport/index.htm create mode 100644 controllers/airport/preview.htm create mode 100644 controllers/airport/update.htm create mode 100644 models/Airport.php create mode 100644 models/airport/columns.yaml create mode 100644 models/airport/fields.yaml diff --git a/controllers/Airport.php b/controllers/Airport.php new file mode 100644 index 0000000..2c4754a --- /dev/null +++ b/controllers/Airport.php @@ -0,0 +1,17 @@ + + + + diff --git a/controllers/airport/config_form.yaml b/controllers/airport/config_form.yaml new file mode 100644 index 0000000..83f6b6f --- /dev/null +++ b/controllers/airport/config_form.yaml @@ -0,0 +1,10 @@ +name: Airport +form: $/germanairlinesva/routes/models/airport/fields.yaml +modelClass: GermanAirlinesVa\Routes\Models\Airport +defaultRedirect: germanairlinesva/routes/airport +create: + redirect: 'germanairlinesva/routes/airport/update/:id' + redirectClose: germanairlinesva/routes/airport +update: + redirect: germanairlinesva/routes/airport + redirectClose: germanairlinesva/routes/airport diff --git a/controllers/airport/config_list.yaml b/controllers/airport/config_list.yaml new file mode 100644 index 0000000..59c0d92 --- /dev/null +++ b/controllers/airport/config_list.yaml @@ -0,0 +1,12 @@ +list: $/germanairlinesva/routes/models/airport/columns.yaml +modelClass: GermanAirlinesVa\Routes\Models\Airport +title: Airports +noRecordsMessage: 'backend::lang.list.no_records' +showSetup: true +showCheckboxes: true +recordsPerPage: 20 +toolbar: + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' +recordUrl: 'germanairlinesva/routes/airport/update/:id' diff --git a/controllers/airport/create.htm b/controllers/airport/create.htm new file mode 100644 index 0000000..957797e --- /dev/null +++ b/controllers/airport/create.htm @@ -0,0 +1,46 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + +
+
+ + + + +

fatalError)) ?>

+

+ diff --git a/controllers/airport/index.htm b/controllers/airport/index.htm new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/controllers/airport/index.htm @@ -0,0 +1 @@ +listRender() ?> diff --git a/controllers/airport/preview.htm b/controllers/airport/preview.htm new file mode 100644 index 0000000..ca6b5ae --- /dev/null +++ b/controllers/airport/preview.htm @@ -0,0 +1,22 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + +

fatalError) ?>

+ + +

+ + + +

diff --git a/controllers/airport/update.htm b/controllers/airport/update.htm new file mode 100644 index 0000000..686e0ed --- /dev/null +++ b/controllers/airport/update.htm @@ -0,0 +1,54 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + + + +
+
+ + + +

fatalError)) ?>

+

+ diff --git a/lang/en/lang.php b/lang/en/lang.php index 599a624..c14d4ee 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -4,6 +4,24 @@ 'description' => '', ], 'menu' => [ - 'routes' => 'GA Routes', + 'main' => 'GA Routes', + 'airports' => 'Airports', + ], + 'airports' => [ + 'name' => 'Name', + 'iata' => 'IATA Code', + 'icao' => 'ICAO Code', + 'country' => 'Country', + 'elevation' => 'Elevation', + 'latitude' => 'Latitude', + 'longitude' => 'Longitude', + ], + 'permissions' => [ + 'tab' => [ + 'routes' => 'German Airlines VA - Routes', + ], + 'label' => [ + 'routes' => 'Manage Routes', + ], ], ]; diff --git a/models/Airport.php b/models/Airport.php new file mode 100644 index 0000000..0dee282 --- /dev/null +++ b/models/Airport.php @@ -0,0 +1,36 @@ + 'required', + 'icao' => 'required', + 'name' => 'required', + 'country' => 'required', + 'elevation' => 'required', + 'latitude' => 'required', + 'longitude' => 'required', + ]; +} diff --git a/models/airport/columns.yaml b/models/airport/columns.yaml new file mode 100644 index 0000000..424cd30 --- /dev/null +++ b/models/airport/columns.yaml @@ -0,0 +1,25 @@ +columns: + id: + label: id + type: number + iata: + label: iata + type: text + icao: + label: icao + type: text + name: + label: name + type: text + country: + label: country + type: text + elevation: + label: elevation + type: text + latitude: + label: latitude + type: text + longitude: + label: longitude + type: text diff --git a/models/airport/fields.yaml b/models/airport/fields.yaml new file mode 100644 index 0000000..52a2e89 --- /dev/null +++ b/models/airport/fields.yaml @@ -0,0 +1,36 @@ +fields: + iata: + label: 'germanairlinesva.routes::lang.airports.iata' + span: auto + required: 1 + type: text + icao: + label: 'germanairlinesva.routes::lang.airports.icao' + span: auto + required: 1 + type: text + name: + label: 'germanairlinesva.routes::lang.airports.name' + span: auto + required: 1 + type: text + country: + label: 'germanairlinesva.routes::lang.airports.country' + span: auto + required: 1 + type: text + elevation: + label: 'germanairlinesva.routes::lang.airports.elevation' + span: auto + required: 1 + type: text + latitude: + label: 'germanairlinesva.routes::lang.airports.latitude' + span: auto + required: 1 + type: text + longitude: + label: 'germanairlinesva.routes::lang.airports.longitude' + span: auto + required: 1 + type: text diff --git a/plugin.yaml b/plugin.yaml index 2f14875..45f941a 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -6,6 +6,17 @@ plugin: homepage: '' navigation: main-menu-item: - label: 'germanairlinesva.routes::lang.menu.routes' + label: 'germanairlinesva.routes::lang.menu.main' url: / icon: icon-location-arrow + permissions: + - routes + sideMenu: + side-menu-item: + label: 'germanairlinesva.routes::lang.menu.airports' + url: germanairlinesva/routes/airport + icon: icon-anchor +permissions: + routes: + tab: 'germanairlinesva.routes::lang.permissions.tab.routes' + label: 'germanairlinesva.routes::lang.permissions.label.routes' diff --git a/updates/builder_table_create_airports.php b/updates/builder_table_create_airports.php index 97cdd32..d33e588 100644 --- a/updates/builder_table_create_airports.php +++ b/updates/builder_table_create_airports.php @@ -11,7 +11,7 @@ class BuilderTableCreateAirports extends Migration $table->engine = 'InnoDB'; $table->bigIncrements('id')->unsigned(); $table->string('iata', 3); - $table->string('icao', 3); + $table->string('icao', 4); $table->string('name'); $table->string('country'); $table->string('elevation');