From 5e04d78275bead93f1d356d45fe4c95645fca8f4 Mon Sep 17 00:00:00 2001 From: Gogs Date: Mon, 14 Jun 2021 00:06:48 +0200 Subject: [PATCH] Typeratings --- Plugin.php | 9 +++ README.md | 5 ++ config/config.php | 25 ++++++++ controllers/Typerating.php | 17 ++++++ controllers/typerating/_list_toolbar.htm | 21 +++++++ controllers/typerating/config_form.yaml | 10 ++++ controllers/typerating/config_list.yaml | 12 ++++ controllers/typerating/create.htm | 54 +++++++++++++++++ controllers/typerating/index.htm | 1 + controllers/typerating/preview.htm | 20 +++++++ controllers/typerating/update.htm | 62 ++++++++++++++++++++ lang/en/lang.php | 8 +++ models/Typerating.php | 32 ++++++++++ models/typerating/columns.yaml | 10 ++++ models/typerating/fields.yaml | 11 ++++ plugin.yaml | 10 ++++ updates/builder_table_create_typeratings.php | 31 ++++++++++ updates/version.yaml | 5 +- 18 files changed, 342 insertions(+), 1 deletion(-) create mode 100644 README.md create mode 100644 config/config.php create mode 100644 controllers/Typerating.php create mode 100644 controllers/typerating/_list_toolbar.htm create mode 100644 controllers/typerating/config_form.yaml create mode 100644 controllers/typerating/config_list.yaml create mode 100644 controllers/typerating/create.htm create mode 100644 controllers/typerating/index.htm create mode 100644 controllers/typerating/preview.htm create mode 100644 controllers/typerating/update.htm create mode 100644 models/Typerating.php create mode 100644 models/typerating/columns.yaml create mode 100644 models/typerating/fields.yaml create mode 100644 updates/builder_table_create_typeratings.php diff --git a/Plugin.php b/Plugin.php index 45829d8..eaf2f50 100644 --- a/Plugin.php +++ b/Plugin.php @@ -1,5 +1,6 @@ [ + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => 'germanairlinesva_schooling', + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => 'InnoDB', + 'options' => extension_loaded('pdo_mysql') + ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) + : [], + ], +]; diff --git a/controllers/Typerating.php b/controllers/Typerating.php new file mode 100644 index 0000000..1630e92 --- /dev/null +++ b/controllers/Typerating.php @@ -0,0 +1,17 @@ + + + + diff --git a/controllers/typerating/config_form.yaml b/controllers/typerating/config_form.yaml new file mode 100644 index 0000000..da2887c --- /dev/null +++ b/controllers/typerating/config_form.yaml @@ -0,0 +1,10 @@ +name: Typerating +form: $/germanairlinesva/schooling/models/typerating/fields.yaml +modelClass: GermanAirlinesVa\Schooling\Models\Typerating +defaultRedirect: germanairlinesva/schooling/typerating +create: + redirect: 'germanairlinesva/schooling/typerating/update/:id' + redirectClose: germanairlinesva/schooling/typerating +update: + redirect: germanairlinesva/schooling/typerating + redirectClose: germanairlinesva/schooling/typerating diff --git a/controllers/typerating/config_list.yaml b/controllers/typerating/config_list.yaml new file mode 100644 index 0000000..7d82498 --- /dev/null +++ b/controllers/typerating/config_list.yaml @@ -0,0 +1,12 @@ +list: $/germanairlinesva/schooling/models/typerating/columns.yaml +modelClass: GermanAirlinesVa\Schooling\Models\Typerating +title: Typerating +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/schooling/typerating/update/:id' diff --git a/controllers/typerating/create.htm b/controllers/typerating/create.htm new file mode 100644 index 0000000..9da811d --- /dev/null +++ b/controllers/typerating/create.htm @@ -0,0 +1,54 @@ + + + + +fatalError): ?> + + +'layout']) ?> + +
formRender() ?>
+ +
+
+ + + + + + +
+
+ + + + +

fatalError)) ?>

+

+ +

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

fatalError) ?>

+ + +

+ + + +

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

fatalError)) ?>

+

+ +

+ diff --git a/lang/en/lang.php b/lang/en/lang.php index 2dca70e..b311ba0 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -3,4 +3,12 @@ 'name' => 'Schooling', 'description' => '', ], + 'typeratings' => [ + 'name' => 'Typerating Name', + 'price' => 'Price for exam', + ], + 'menu' => [ + 'main' => 'Schooling', + 'typeratings' => 'Typeratings', + ], ]; diff --git a/models/Typerating.php b/models/Typerating.php new file mode 100644 index 0000000..1d2558c --- /dev/null +++ b/models/Typerating.php @@ -0,0 +1,32 @@ + 'required', 'price' => 'required']; + + public $hasMany = [ + 'aircraft_types' => 'GermanAirlinesVa\Fleet', + ]; +} diff --git a/models/typerating/columns.yaml b/models/typerating/columns.yaml new file mode 100644 index 0000000..63cec10 --- /dev/null +++ b/models/typerating/columns.yaml @@ -0,0 +1,10 @@ +columns: + id: + label: id + type: text + name: + label: name + type: text + price: + label: price + type: number diff --git a/models/typerating/fields.yaml b/models/typerating/fields.yaml new file mode 100644 index 0000000..f0160e8 --- /dev/null +++ b/models/typerating/fields.yaml @@ -0,0 +1,11 @@ +fields: + name: + label: 'germanairlinesva.schooling::lang.typeratings.name' + span: auto + required: 1 + type: text + price: + label: 'germanairlinesva.schooling::lang.typeratings.price' + span: auto + required: 1 + type: number diff --git a/plugin.yaml b/plugin.yaml index 859b612..ba89c77 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -4,3 +4,13 @@ plugin: author: 'German Airlines Va' icon: oc-icon-university homepage: '' +navigation: + main-menu-item: + label: 'germanairlinesva.schooling::lang.menu.main' + url: / + icon: icon-university + sideMenu: + side-menu-item: + label: 'germanairlinesva.schooling::lang.menu.typeratings' + url: germanairlinesva/schooling/typerating + icon: icon-plane diff --git a/updates/builder_table_create_typeratings.php b/updates/builder_table_create_typeratings.php new file mode 100644 index 0000000..e34136a --- /dev/null +++ b/updates/builder_table_create_typeratings.php @@ -0,0 +1,31 @@ +create('typeratings', function ($table) { + $table->engine = 'InnoDB'; + $table->bigIncrements('id')->unsigned(); + $table->string('name'); + $table->integer('price'); + }); + + Schema::connection('germanairlinesva_fleet')->table('aircraft_types', function ($table) { + $table + ->foreign('typerating_id') + ->references('id') + ->on('germanairlinesva_schooling.typeratings'); + }); + } + + public function down() + { + Schema::connection('germanairlinesva_schooling')->disableForeignKeyConstraints(); + Schema::connection('germanairlinesva_schooling')->dropIfExists('typeratings'); + Schema::connection('germanairlinesva_schooling')->enableForeignKeyConstraints(); + } +} diff --git a/updates/version.yaml b/updates/version.yaml index 1894fd0..7b0f7ef 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -1,2 +1,5 @@ 1.0.1: - - Initialize plugin. + - 'Initialize plugin.' +1.0.2: + - 'Created table typeratings' + - builder_table_create_typeratings.php