From 2324a7dcf08111d8a21a29e0390e9ee76552b86f Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Mon, 28 Mar 2022 11:30:38 +0200 Subject: [PATCH] fixes and addon --- app/controllers/dotations_controller.rb | 4 ++- app/views/dotations/_form.html.erb | 34 +++++++++++++++++++ config/locales/pl/models/dotation.yml | 8 +++-- db/migrate/20220215114605_create_experts.rb | 2 +- ...4_add_min_max_dot_ammounts_to_dotations.rb | 8 +++++ db/schema.rb | 8 +++-- 6 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20220328092314_add_min_max_dot_ammounts_to_dotations.rb diff --git a/app/controllers/dotations_controller.rb b/app/controllers/dotations_controller.rb index ff87a40..6ca0411 100644 --- a/app/controllers/dotations_controller.rb +++ b/app/controllers/dotations_controller.rb @@ -105,7 +105,9 @@ class DotationsController < ApplicationController :max_amount, :max_percent, :localization, :company_size_id, :partner_id, :expert_id, :expert_info, :start_date, :end_date, :announcement_date, :full_descr, :positioning_text, :points, - :date_of_recruitment, :min_amount_curr_id, :max_amount_curr_id, + :date_of_recruitment, :min_amount_curr_id, + :max_amount_curr_id, :min_dot_ammount, :max_dot_ammount, + :min_dot_amount_curr_id, :max_dot_amount_curr_id, project_ids: [], tag_ids: [], company_activity_ids: [], company_size_ids: [], expense_ids: []) end diff --git a/app/views/dotations/_form.html.erb b/app/views/dotations/_form.html.erb index 31ca9ad..868b95a 100644 --- a/app/views/dotations/_form.html.erb +++ b/app/views/dotations/_form.html.erb @@ -102,6 +102,40 @@ +
+
+
+
+
+ <%= form.label :min_dot_ammount %> + <%= form.text_field :min_dot_ammount, class: 'form-control', placeholder: 'Minimalna wartość dotacji' %> +
+
+
+
+ <%= form.label :min_dot_amount_curr_id %> + <%= form.select(:min_dot_amount_curr_id, @currencies.collect {|p| [ p.name, p.id ] }, { include_blank: false }, class: 'form-control select2' ) %> +
+
+
+
+
+
+
+
+ <%= form.label :max_dot_ammount %> + <%= form.text_field :max_dot_ammount, class: 'form-control', placeholder: 'Maksymalna wartość dotacji' %> +
+
+
+
+ <%= form.label :max_dot_amount_curr_id %> + <%= form.select(:max_dot_amount_curr_id, @currencies.collect {|p| [ p.name, p.id ] }, { include_blank: false, }, class: 'form-control select2' ) %> +
+
+
+
+
<%= form.label :max_percent %> <%= form.text_field :max_percent, class: 'form-control', placeholder: 'Maksymalny poziom dofinansowania' %> diff --git a/config/locales/pl/models/dotation.yml b/config/locales/pl/models/dotation.yml index 5a828b9..9542776 100644 --- a/config/locales/pl/models/dotation.yml +++ b/config/locales/pl/models/dotation.yml @@ -7,13 +7,17 @@ pl: name: "Opisowa nazwa dotacji" formal_name: "Nazwa formalna" points: Punktacja - date_from: Data od - date_to: Data do + date_from: Data początku obowiązywania dotacji + date_to: Data końca ważności dotacji localization: Lokalizacja min_amount: Minimalna wartość projektu max_amount: Maksymalna wartość projektu min_amount_curr_id: Waluta max_amount_curr_id: Waluta + min_dot_ammount: Minimalna wartość dotacji + max_dot_ammount: Maksymalna wartość dotacji + min_dot_amount_curr_id: Waluta + max_dot_amount_curr_id: Waluta max_percent: Maksymalny poziom dofinansowania company_activities: Dominująca działalność firmy company_sizes: Wielkość firmy diff --git a/db/migrate/20220215114605_create_experts.rb b/db/migrate/20220215114605_create_experts.rb index 06c3ebb..c14b1d7 100644 --- a/db/migrate/20220215114605_create_experts.rb +++ b/db/migrate/20220215114605_create_experts.rb @@ -2,7 +2,7 @@ class CreateExperts < ActiveRecord::Migration[5.2] def change create_table :experts do |t| t.string :name - t.string :description + t.text :description t.integer :created_by t.integer :updated_by diff --git a/db/migrate/20220328092314_add_min_max_dot_ammounts_to_dotations.rb b/db/migrate/20220328092314_add_min_max_dot_ammounts_to_dotations.rb new file mode 100644 index 0000000..66c307a --- /dev/null +++ b/db/migrate/20220328092314_add_min_max_dot_ammounts_to_dotations.rb @@ -0,0 +1,8 @@ +class AddMinMaxDotAmmountsToDotations < ActiveRecord::Migration[5.2] + def change + add_column :dotations, :min_dot_ammount, :bigint + add_column :dotations, :min_dot_amount_curr_id, :integer, default: 1 + add_column :dotations, :max_dot_ammount, :bigint + add_column :dotations, :max_dot_amount_curr_id, :integer, default: 1 + end +end diff --git a/db/schema.rb b/db/schema.rb index 9a18f59..3de9d19 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_03_22_143440) do +ActiveRecord::Schema.define(version: 2022_03_28_092314) do create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "name", null: false @@ -99,6 +99,10 @@ ActiveRecord::Schema.define(version: 2022_03_22_143440) do t.integer "updated_by" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.bigint "min_dot_ammount" + t.integer "min_dot_amount_curr_id", default: 1 + t.bigint "max_dot_ammount" + t.integer "max_dot_amount_curr_id", default: 1 t.index ["active"], name: "index_dotations_on_active" t.index ["announcement_date"], name: "index_dotations_on_announcement_date" t.index ["arch"], name: "index_dotations_on_arch" @@ -141,7 +145,7 @@ ActiveRecord::Schema.define(version: 2022_03_22_143440) do create_table "experts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "name" - t.string "description" + t.text "description" t.integer "created_by" t.integer "updated_by" t.datetime "created_at", null: false