From d1dcda871e1e9e2216077a241e8e06dcd322cfcd Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 8 Aug 2023 12:06:32 +0200 Subject: [PATCH 01/34] Try to use MessageDraft model instead of Draft --- app/controllers/drafts/imports_controller.rb | 2 +- app/controllers/message_drafts_controller.rb | 11 ++- app/jobs/drafts/finish_import_job.rb | 10 ++- app/jobs/drafts/load_content_job.rb | 49 ++++++----- app/jobs/drafts/parse_import_job.rb | 87 +++++++++++++------ app/jobs/drafts/submit_job.rb | 63 ++++++++------ app/models/draft.rb | 2 +- app/models/drafts/import.rb | 9 +- app/models/message_draft.rb | 4 + app/models/message_object.rb | 10 ++- app/models/message_thread.rb | 1 - app/policies/message_draft_policy.rb | 16 ++++ app/views/message_drafts/index.html.erb | 27 ++++++ ..._be_signed_attribute_to_message_objects.rb | 11 +++ db/schema.rb | 5 +- 15 files changed, 213 insertions(+), 94 deletions(-) create mode 100644 app/views/message_drafts/index.html.erb create mode 100644 db/migrate/20230804122837_temporary_add_to_be_signed_attribute_to_message_objects.rb diff --git a/app/controllers/drafts/imports_controller.rb b/app/controllers/drafts/imports_controller.rb index 30624d599..185c23d85 100644 --- a/app/controllers/drafts/imports_controller.rb +++ b/app/controllers/drafts/imports_controller.rb @@ -13,7 +13,7 @@ def create import_path = file_storage.store("imports", import_path(import), zip_content.read.force_encoding("UTF-8")) Drafts::ParseImportJob.perform_later(import, import_path) - redirect_to drafts_path + redirect_to message_drafts_path end def upload_new diff --git a/app/controllers/message_drafts_controller.rb b/app/controllers/message_drafts_controller.rb index 2837bcdf9..94bff2b17 100644 --- a/app/controllers/message_drafts_controller.rb +++ b/app/controllers/message_drafts_controller.rb @@ -1,6 +1,10 @@ class MessageDraftsController < ApplicationController + before_action :load_message_drafts, only: :index before_action :set_message, only: :create - before_action :set_message_draft, except: :create + before_action :set_message_draft, except: [:index, :create] + + def index + end def create authorize @message @@ -49,6 +53,11 @@ def destroy private + def load_message_drafts + authorize MessageDraft + @message_drafts = policy_scope(MessageDraft) + end + def set_message @message = policy_scope(Message).find(params[:original_message_id]) end diff --git a/app/jobs/drafts/finish_import_job.rb b/app/jobs/drafts/finish_import_job.rb index 5df646a6a..876eb863c 100644 --- a/app/jobs/drafts/finish_import_job.rb +++ b/app/jobs/drafts/finish_import_job.rb @@ -1,11 +1,13 @@ class Drafts::FinishImportJob < ApplicationJob def perform(batch, params) - batch.properties[:import].drafts.find_each do |draft| - if draft.valid?(:validate_data) - draft.loading_done! + batch.properties[:import].message_drafts.find_each do |message_draft| + if message_draft.valid?(:validate_data) + message_draft.metadata["status"] = "loading_done" else - draft.invalid_data! + message_draft.metadata["status"] = "invalid_data" end + + message_draft.save end Utils.delete_file(batch.properties[:zip_path]) diff --git a/app/jobs/drafts/load_content_job.rb b/app/jobs/drafts/load_content_job.rb index 115bf7b5f..7e8516932 100644 --- a/app/jobs/drafts/load_content_job.rb +++ b/app/jobs/drafts/load_content_job.rb @@ -5,47 +5,50 @@ class << self delegate :uuid, to: SecureRandom end - def perform(draft, draft_path) - Dir.each_child(draft_path) do |subdirectory_name| + def perform(message_draft, message_draft_path) + Dir.each_child(message_draft_path) do |subdirectory_name| case subdirectory_name when "podpisane" - load_draft_objects(draft, File.join(draft_path, subdirectory_name), signed: true, to_be_signed: false) + load_draft_message_drafts(message_draft, File.join(message_draft_path, subdirectory_name), signed: true, to_be_signed: false) when "podpisat" - load_draft_objects(draft, File.join(draft_path, subdirectory_name), signed: false, to_be_signed: true) + load_draft_message_drafts(message_draft, File.join(message_draft_path, subdirectory_name), signed: false, to_be_signed: true) when "nepodpisovat" - load_draft_objects(draft, File.join(draft_path, subdirectory_name), signed: false, to_be_signed: false) + load_draft_message_drafts(message_draft, File.join(message_draft_path, subdirectory_name), signed: false, to_be_signed: false) end end end private - def load_draft_objects(draft, objects_path, signed:, to_be_signed:) - Dir.foreach(objects_path) do |filename| - next if filename == '.' or filename == '..' - - draft_object = Drafts::Object.create( - draft_id: draft.id, - uuid: uuid, - name: filename, - form: form?(draft, filename), - signed: signed, - to_be_signed: to_be_signed + def load_draft_message_drafts(message_draft, objects_path, signed:, to_be_signed:) + Dir.foreach(objects_path) do |file_name| + next if file_name == '.' or file_name == '..' + + is_form = form?(message_draft, file_name) + + draft_message_draft = MessageObject.create( + name: file_name, + mimetype: Utils.detect_mime_type(entry_name: file_name, is_form: is_form), + object_type: is_form ? "FORM" : "ATTACHMENT", + is_signed: signed, + to_be_signed: to_be_signed, + message: message_draft ) - File.open(File.join(objects_path, filename)) do |io| - draft_object.content.attach(io: io, filename: filename) - end + MessageObjectDatum.create( + message_object: draft_message_draft, + blob: File.read(File.join(objects_path, file_name)) + ) - draft_object.save! + draft_message_draft.save! end end - def form?(draft, filename) - file_basename = File.basename(filename, ".*") + def form?(message_draft, file_name) + file_base_name = File.basename(file_name, ".*") # Form file must have the same name as subfolder - file_basename == draft.import_subfolder + file_base_name == message_draft.metadata["import_subfolder"] end delegate :uuid, to: self diff --git a/app/jobs/drafts/parse_import_job.rb b/app/jobs/drafts/parse_import_job.rb index d223d8045..76ccff098 100644 --- a/app/jobs/drafts/parse_import_job.rb +++ b/app/jobs/drafts/parse_import_job.rb @@ -15,26 +15,39 @@ def perform(import, import_zip_path, jobs_batch: GoodJob::Batch.new, load_conten csv_paths = Dir[extracted_import_path + "/*.csv"] - load_import_csv(import, csv_paths.first) + ActiveRecord::Base.transaction do + load_import_csv(import, csv_paths.first) - Dir.each_child(extracted_import_path) do |entry_name| - if File.directory?(File.join(extracted_import_path, entry_name)) - draft = Draft.find_or_create_by!( - box: import.box, - import: import, - import_subfolder: File.basename(entry_name), - ) - draft.being_loaded! + Dir.each_child(extracted_import_path) do |entry_name| + if File.directory?(File.join(extracted_import_path, entry_name)) - jobs_batch.add do - load_content_job.perform_later(draft, File.join(extracted_import_path, entry_name)) + message_draft = MessageDraft.where("metadata ->> 'import_id' = ?", import.id.to_s).where("metadata ->> 'import_subfolder' = ?", File.basename(entry_name)).take + + unless message_draft + MessageDraft.create( + uuid: uuid, + thread: thread, + title: File.basename(entry_name), + replyable: false, + delivered_at: Time.now, + metadata: { + "import_id": import.id, + "import_subfolder": File.basename(entry_name), + "status": "being_loaded" + } + ) + end + + jobs_batch.add do + load_content_job.perform_later(message_draft, File.join(extracted_import_path, entry_name)) + end end end - end - jobs_batch.enqueue(on_success: on_success_job, import: import, zip_path: import_zip_path, extracted_data_path: extracted_import_path) + jobs_batch.enqueue(on_success: on_success_job, import: import, zip_path: import_zip_path, extracted_data_path: extracted_import_path) - import.parsed! + import.parsed! + end rescue # TODO Send notification import.destroy! @@ -48,21 +61,39 @@ def load_import_csv(import, csv_path) col_sep: File.open(csv_path) { |f| f.readline }.include?(';') ? ';' : ',', headers: true } - + + folder = Folder.find_or_create_by!( + box: import.box, + name: "Drafts" + ) + CSV.parse(File.read(csv_path), **csv_options) do |row| - Draft.create!( - box: import.box, - import: import, - import_subfolder: row['subfolder'], - recipient_uri: row['recipient_uri'], - posp_id: row['posp_id'], - posp_version: row['posp_version'], - message_type: row['message_type'], - message_subject: row['message_subject'], - sender_business_reference: row['sender_business_reference'], - recipient_business_reference: row['recipient_business_reference'], - message_id: uuid, - correlation_id: uuid + message_thread = folder.message_threads.create( + folder: folder, + title: row['message_subject'], + original_title: row['message_subject'], + delivered_at: Time.now, + last_message_delivered_at: Time.now + ) + + MessageDraft.create!( + uuid: uuid, + thread: message_thread, + title: row['message_subject'], + replyable: false, + delivered_at: Time.now, + metadata: { + "recipient_uri": row['recipient_uri'], + "posp_id": row['posp_id'], + "posp_version": row['posp_version'], + "message_type": row['message_type'], + "correlation_id": uuid, + "sender_business_reference": row['sender_business_reference'], + "recipient_business_reference": row['recipient_business_reference'], + "import_id": import.id, + "import_subfolder": row['subfolder'], + "status": "being_loaded" + } ) end end diff --git a/app/jobs/drafts/submit_job.rb b/app/jobs/drafts/submit_job.rb index bce674cd6..c98d579c0 100644 --- a/app/jobs/drafts/submit_job.rb +++ b/app/jobs/drafts/submit_job.rb @@ -1,57 +1,64 @@ class Drafts::SubmitJob < ApplicationJob - def perform(draft, upvs_client: UpvsEnvironment.upvs_client) - draft_data = { - posp_id: draft.posp_id, - posp_version: draft.posp_version, - message_type: draft.message_type, - message_id: draft.message_id, - correlation_id: draft.correlation_id, - recipient_uri: draft.recipient_uri, - message_subject: draft.message_subject, - objects: build_objects(draft) - } - - sktalk_api = upvs_client.api(folder.box).sktalk + def perform(message_draft, upvs_client: UpvsEnvironment.upvs_client) + message_draft_data = { + posp_id: message_draft.metadata["posp_id"], + posp_version: message_draft.metadata["posp_version"], + message_type: message_draft.metadata["message_type"], + message_id: message_draft.uuid, + correlation_id: message_draft.metadata["correlation_id"], + recipient_uri: message_draft.metadata["recipient_uri"], + message_subject: message_draft.title, + sender_business_reference: message_draft.metadata["sender_business_reference"], + recipient_business_reference: message_draft.metadata["recipient_business_reference"], + objects: build_objects(message_draft) + }.compact + + sktalk_api = upvs_client.api(message_draft.thread.folder.box).sktalk begin - success, response_status = sktalk_api.receive_and_save_to_outbox(draft_data) + success, response_status = sktalk_api.receive_and_save_to_outbox(message_draft_data) if success - draft.update!(status: "submitted") + message_draft.metadata["status"] = "submitted" else - handle_submit_fail(draft, response_status) + handle_submit_fail(message_draft, response_status) end - rescue - draft.submit_failed_temporary! + + message_draft.save! + rescue Error => error + message_draft.metadata["status"] = "submit_failed_temporary" + message_draft.save! + + raise error end end private - def build_objects(draft) + def build_objects(message_draft) objects = [] - draft.objects.each do |object| + message_draft.objects.each do |object| objects << { - id: object.uuid, + id: SecureRandom.uuid, name: object.name, encoding: "Base64", - signed: object.signed, - mime_type: Utils.detect_mime_type(entry_name: object.name, is_form: object.form?), - form: (object.form if object.form), - content: Base64.strict_encode64(object.content.download) + signed: object.is_signed, + mime_type: object.mimetype, + form: object.form?, + content: Base64.strict_encode64(object.message_object_datum.blob) }.compact end objects end - def handle_submit_fail(draft, response_status) + def handle_submit_fail(message_draft, response_status) case response_status when 408 # TODO when 422 - draft.submit_failed_unprocessable! + message_draft.metadata["status"] = "submit_failed_unprocessable" else - draft.submit_failed_temporary! + message_draft.metadata["status"] = "submit_failed_temporary" end end end diff --git a/app/models/draft.rb b/app/models/draft.rb index 9ebe70496..0c746b4a2 100644 --- a/app/models/draft.rb +++ b/app/models/draft.rb @@ -4,7 +4,7 @@ # # id :integer not null, primary key # box_id :integer -# package_id :integer +# import_id :integer # status :integer default("created") # recipient_uri :string # posp_id :string diff --git a/app/models/drafts/import.rb b/app/models/drafts/import.rb index 99a4a04e0..d4a2a3522 100644 --- a/app/models/drafts/import.rb +++ b/app/models/drafts/import.rb @@ -1,6 +1,6 @@ # == Schema Information # -# Table name: drafts_packages +# Table name: drafts_imports # # id :integer not null, primary key # name :string not null @@ -11,12 +11,17 @@ class Drafts::Import < ApplicationRecord belongs_to :box, class_name: 'Box' - has_many :drafts, :dependent => :destroy + + after_destroy_commit { MessageDraft.where("metadata ->> 'import_subfolder' = ?", id.to_s).destroy_all } validates_with DraftsImportValidator, if: :content_path enum status: { uploaded: 0, parsed: 1, parsing_failed: 2 } + def message_drafts + MessageDraft.where("metadata ->> 'import_id' = ?", id.to_s) + end + def base_name name.split('_', 2).last end diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index 2766728eb..912a5fb95 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -17,6 +17,10 @@ def self.create_from_message(message) ) end + def import + Drafts::Import.find(metadata["import_id"]) if metadata["import_id"] + end + def submittable? title.present? && metadata["message_body"].present? && not_yet_submitted? end diff --git a/app/models/message_object.rb b/app/models/message_object.rb index 2c05b35f4..1383f773f 100644 --- a/app/models/message_object.rb +++ b/app/models/message_object.rb @@ -4,11 +4,11 @@ # # id :integer not null, primary key # name :string not null -# encoding :string not null # mimetype :string not null -# signed :boolean +# is_signed :boolean +# to_be_signed :boolean not null, default: false # object_type :string not null -# message_id :datetime not null +# message_id :integer not null # created_at :datetime not null # updated_at :datetime not null @@ -33,6 +33,10 @@ def self.create_message_objects(message, objects) end end + def form? + object_type == "FORM" + end + def destroyable? message.is_a?(MessageDraft) end diff --git a/app/models/message_thread.rb b/app/models/message_thread.rb index 3da71b546..fb5ab8556 100644 --- a/app/models/message_thread.rb +++ b/app/models/message_thread.rb @@ -5,7 +5,6 @@ # id :integer not null, primary key # title :string not null # original_title :string not null -# merge_uuids :uuid not null # delivered_at :datetime not null # last_message_delivered_at :datetime not null # created_at :datetime not null diff --git a/app/policies/message_draft_policy.rb b/app/policies/message_draft_policy.rb index ee8714f6e..3d87be27b 100644 --- a/app/policies/message_draft_policy.rb +++ b/app/policies/message_draft_policy.rb @@ -24,6 +24,22 @@ def resolve ) end end + + def resolve_index + scope.where( + 'import_id in ( + select imports.id + from drafts_imports imports + join boxes on boxes.id = imports.box_id + join tenants on tenants.id = boxes.tenant_id + where tenant_id = ?)', + @user.tenant_id + ) + end + end + + def index? + true end def create? diff --git a/app/views/message_drafts/index.html.erb b/app/views/message_drafts/index.html.erb new file mode 100644 index 000000000..68ecfee98 --- /dev/null +++ b/app/views/message_drafts/index.html.erb @@ -0,0 +1,27 @@ +

Drafty

+ +
+ <%= link_to "Nahrať import", upload_new_drafts_imports_path %> +
+ +<% if @message_drafts.any? %> +
+

Vytvorené podania

+
+ + + + + + + + <% @message_drafts.each do |message_draft| %> + + + + + + <% end %> +
PodanieBalíkStav
<%= " #{message_draft.import&.base_name}" %><%= " #{message_draft.metadata["status"]}" %>
+
+<% end %> diff --git a/db/migrate/20230804122837_temporary_add_to_be_signed_attribute_to_message_objects.rb b/db/migrate/20230804122837_temporary_add_to_be_signed_attribute_to_message_objects.rb new file mode 100644 index 000000000..56a1ccc1d --- /dev/null +++ b/db/migrate/20230804122837_temporary_add_to_be_signed_attribute_to_message_objects.rb @@ -0,0 +1,11 @@ +class TemporaryAddToBeSignedAttributeToMessageObjects < ActiveRecord::Migration[7.0] + def up + add_column :message_objects, :to_be_signed, :boolean + + MessageObject.update_all( + to_be_signed: false + ) + + change_column :message_objects, :to_be_signed, :boolean, null: false, default: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 787db99f0..8b3d9f16f 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[7.0].define(version: 2023_08_02_071745) do +ActiveRecord::Schema[7.0].define(version: 2023_08_04_122837) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -282,6 +282,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.boolean "is_signed" + t.boolean "to_be_signed", default: false, null: false t.index ["message_id"], name: "index_message_objects_on_message_id" end @@ -328,8 +329,8 @@ t.text "html_visualization" t.boolean "read", default: false, null: false t.json "metadata" - t.string "type" t.boolean "replyable", default: true, null: false + t.string "type" t.index ["message_thread_id"], name: "index_messages_on_message_thread_id" end From 5cf29781631c2e40e0105acf6bf77b3bd7e33478 Mon Sep 17 00:00:00 2001 From: stage-rl Date: Wed, 9 Aug 2023 15:50:52 +0200 Subject: [PATCH 02/34] Add message_thread title to view to show as popup --- app/components/message_threads_table_row_component.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/message_threads_table_row_component.html.erb b/app/components/message_threads_table_row_component.html.erb index 85a7a1962..120a805cd 100644 --- a/app/components/message_threads_table_row_component.html.erb +++ b/app/components/message_threads_table_row_component.html.erb @@ -10,7 +10,7 @@ <%= link_to message_path(@message_thread.last_message_id), class:"flex justify-stretch overflow-clip items-center grow gap-2" do %>
-

"><%= @message_thread.title %>

+

"><%= @message_thread.title %>

<%= @message_thread.with_whom %>

From f832f3cd30c8e045d9ae53a325fbb3ed552727ce Mon Sep 17 00:00:00 2001 From: stage-rl Date: Wed, 9 Aug 2023 16:43:29 +0200 Subject: [PATCH 03/34] Fix messages order in sidebar and change link to message thread to redirect to message --- .../layout/message_thread_sidebar_component.rb | 2 +- .../message_threads_table_row_component.html.erb | 2 +- app/controllers/message_threads_controller.rb | 6 +++++- app/policies/message_thread_policy.rb | 10 +--------- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/components/layout/message_thread_sidebar_component.rb b/app/components/layout/message_thread_sidebar_component.rb index ff194b5f3..f83007156 100644 --- a/app/components/layout/message_thread_sidebar_component.rb +++ b/app/components/layout/message_thread_sidebar_component.rb @@ -1,6 +1,6 @@ class Layout::MessageThreadSidebarComponent < ViewComponent::Base def initialize(message:) @selected_message = message - @thread_messages = @selected_message.thread.messages.order(delivered_at: :desc) + @thread_messages = @selected_message.thread.messages.order(delivered_at: :asc) end end diff --git a/app/components/message_threads_table_row_component.html.erb b/app/components/message_threads_table_row_component.html.erb index 120a805cd..2c13a2f3b 100644 --- a/app/components/message_threads_table_row_component.html.erb +++ b/app/components/message_threads_table_row_component.html.erb @@ -8,7 +8,7 @@
- <%= link_to message_path(@message_thread.last_message_id), class:"flex justify-stretch overflow-clip items-center grow gap-2" do %> + <%= link_to message_thread_path(@message_thread), class:"flex justify-stretch overflow-clip items-center grow gap-2" do %>

"><%= @message_thread.title %>

<%= @message_thread.with_whom %>

diff --git a/app/controllers/message_threads_controller.rb b/app/controllers/message_threads_controller.rb index 83c78c2e1..000e28802 100644 --- a/app/controllers/message_threads_controller.rb +++ b/app/controllers/message_threads_controller.rb @@ -1,8 +1,12 @@ class MessageThreadsController < ApplicationController - before_action :set_message_thread, only: %i[show, update] + before_action :set_message_thread, only: %i[show update] def show authorize @message_thread + redirect_to message_path( + @message_thread.messages.where(read: false).order(delivered_at: :asc).first || + @message_thread.messages.order(delivered_at: :desc).first + ) end def update diff --git a/app/policies/message_thread_policy.rb b/app/policies/message_thread_policy.rb index bd0da5c5f..3855db50d 100644 --- a/app/policies/message_thread_policy.rb +++ b/app/policies/message_thread_policy.rb @@ -13,15 +13,7 @@ def resolve if @user.site_admin? scope.all else - scope.where( - 'id in ( - select mt.id - from message_threads mt - join message_threads_tags mt_tags on mt.id = mt_tags.message_thread_id - join tag_users tu on mt_tags.tag_id = tu.tag_id - where user_id = ?)', - @user.id - ) + scope.joins(tags: :users).where(users: { id: @user.id }) end end end From 2bff787ace88ba4b0f86a75f4fc577f984d17049 Mon Sep 17 00:00:00 2001 From: stage-rl Date: Wed, 9 Aug 2023 17:13:27 +0200 Subject: [PATCH 04/34] Remove unnecessary path helpers --- app/components/message_threads_table_row_component.html.erb | 2 +- app/controllers/message_threads_controller.rb | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/components/message_threads_table_row_component.html.erb b/app/components/message_threads_table_row_component.html.erb index 2c13a2f3b..c71351b2f 100644 --- a/app/components/message_threads_table_row_component.html.erb +++ b/app/components/message_threads_table_row_component.html.erb @@ -8,7 +8,7 @@
- <%= link_to message_thread_path(@message_thread), class:"flex justify-stretch overflow-clip items-center grow gap-2" do %> + <%= link_to @message_thread, class:"flex justify-stretch overflow-clip items-center grow gap-2" do %>

"><%= @message_thread.title %>

<%= @message_thread.with_whom %>

diff --git a/app/controllers/message_threads_controller.rb b/app/controllers/message_threads_controller.rb index 000e28802..ac3a00032 100644 --- a/app/controllers/message_threads_controller.rb +++ b/app/controllers/message_threads_controller.rb @@ -3,10 +3,8 @@ class MessageThreadsController < ApplicationController def show authorize @message_thread - redirect_to message_path( - @message_thread.messages.where(read: false).order(delivered_at: :asc).first || + redirect_to @message_thread.messages.where(read: false).order(delivered_at: :asc).first || @message_thread.messages.order(delivered_at: :desc).first - ) end def update From 7414af906e4d53d75730b49d1b9043cc2b8ca5fb Mon Sep 17 00:00:00 2001 From: stage-rl Date: Thu, 10 Aug 2023 08:58:30 +0200 Subject: [PATCH 05/34] Fix messages merge and apply thread routing instead of message --- app/controllers/message_threads_controller.rb | 2 +- app/models/message_thread.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/message_threads_controller.rb b/app/controllers/message_threads_controller.rb index ac3a00032..20268e534 100644 --- a/app/controllers/message_threads_controller.rb +++ b/app/controllers/message_threads_controller.rb @@ -52,7 +52,7 @@ def merge end @selected_message_threads.merge_threads flash[:notice] = 'Vlákna boli úspešne spojené' - redirect_to @selected_message_threads.first.messages.first + redirect_to @selected_message_threads.first end private diff --git a/app/models/message_thread.rb b/app/models/message_thread.rb index 3da71b546..66347705a 100644 --- a/app/models/message_thread.rb +++ b/app/models/message_thread.rb @@ -41,7 +41,7 @@ def self.merge_threads self.all.each do |thread| if thread != target_thread thread.merge_identifiers.update_all(message_thread_id: target_thread.id) - target_thread.last_message_delivered_at = max(target_thread.last_message_delivered_at, thread.last_message_delivered_at) + target_thread.last_message_delivered_at = [target_thread.last_message_delivered_at, thread.last_message_delivered_at].max thread.messages.each do |message| message.thread = target_thread message.save! @@ -52,6 +52,7 @@ def self.merge_threads thread.destroy! end end + target_thread.save end end end From ae6dfa0afef6799efa6fcbaa0853a6249951c08e Mon Sep 17 00:00:00 2001 From: Robo Lences Date: Thu, 10 Aug 2023 09:51:24 +0200 Subject: [PATCH 06/34] Minor fix --- app/models/message_thread.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/message_thread.rb b/app/models/message_thread.rb index 66347705a..c51b680e6 100644 --- a/app/models/message_thread.rb +++ b/app/models/message_thread.rb @@ -52,7 +52,7 @@ def self.merge_threads thread.destroy! end end - target_thread.save + target_thread.save! end end end From 66fcc79042c2e89b73a7a80a7d4fc2c167c2ec3b Mon Sep 17 00:00:00 2001 From: stage-rl Date: Fri, 11 Aug 2023 11:33:52 +0200 Subject: [PATCH 07/34] Fix delivered_at field behavior during threads mergeing --- app/models/message_thread.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/message_thread.rb b/app/models/message_thread.rb index c51b680e6..468b27f99 100644 --- a/app/models/message_thread.rb +++ b/app/models/message_thread.rb @@ -42,6 +42,7 @@ def self.merge_threads if thread != target_thread thread.merge_identifiers.update_all(message_thread_id: target_thread.id) target_thread.last_message_delivered_at = [target_thread.last_message_delivered_at, thread.last_message_delivered_at].max + target_thread.delivered_at = [target_thread.delivered_at, thread.delivered_at].min thread.messages.each do |message| message.thread = target_thread message.save! From d9343efc5d56ee53a226427b302cb2aceec994dc Mon Sep 17 00:00:00 2001 From: stage-rl Date: Fri, 11 Aug 2023 11:34:20 +0200 Subject: [PATCH 08/34] Gitignore .env.test --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cde1e55b4..aceb6077f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ yarn-debug.log* .yarn-integrity .env.local +.env.test /app/assets/builds/* !/app/assets/builds/.keep From 96b089df552408baae73e745837920705ebefc5a Mon Sep 17 00:00:00 2001 From: stage-rl Date: Fri, 11 Aug 2023 11:35:18 +0200 Subject: [PATCH 09/34] Implement model tests for threads merging --- test/fixtures/message_threads.yml | 4 +-- test/fixtures/messages.yml | 18 ++++++++++++++ test/models/message_thread_test.rb | 39 ++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/test/fixtures/message_threads.yml b/test/fixtures/message_threads.yml index 2edd7e33b..d1f3f46b4 100644 --- a/test/fixtures/message_threads.yml +++ b/test/fixtures/message_threads.yml @@ -11,5 +11,5 @@ two: folder: two title: MyString original_title: MyString - delivered_at: 2023-05-18 16:06:56 - last_message_delivered_at: 2023-05-18 16:06:56 + delivered_at: 2023-05-18 16:19:26 + last_message_delivered_at: 2023-05-18 16:20:26 diff --git a/test/fixtures/messages.yml b/test/fixtures/messages.yml index eab7a2372..089b3bc88 100644 --- a/test/fixtures/messages.yml +++ b/test/fixtures/messages.yml @@ -17,3 +17,21 @@ two: html_visualization: MyString delivered_at: 2023-05-18 16:18:26 thread: one + +three: + uuid: <%= SecureRandom.uuid %> + title: MyString + sender_name: MyString + recipient_name: MyString + html_visualization: MyString + delivered_at: 2023-05-18 16:19:26 + thread: two + +four: + uuid: <%= SecureRandom.uuid %> + title: MyString + sender_name: MyString + recipient_name: MyString + html_visualization: MyString + delivered_at: 2023-05-18 16:20:26 + thread: two \ No newline at end of file diff --git a/test/models/message_thread_test.rb b/test/models/message_thread_test.rb index e369b076a..23667c91e 100644 --- a/test/models/message_thread_test.rb +++ b/test/models/message_thread_test.rb @@ -73,4 +73,43 @@ class MessageThreadTest < ActiveSupport::TestCase assert_equal last_message_delivered_at, thread.last_message_delivered_at end + + test "should merge threads with correct last_message_delivered_at" do + threads = MessageThread.all + target_last_message_delivered_at = message_threads(:two).last_message_delivered_at + + threads.merge_threads + + assert_equal target_last_message_delivered_at, message_threads(:two).last_message_delivered_at + end + + test "should merge threads with correct delivered_at" do + threads = MessageThread.all + target_delivered_at = message_threads(:one).last_message_delivered_at + + threads.merge_threads + + assert_equal target_delivered_at, message_threads(:one).delivered_at + end + + test "should delete older thread during merge threads" do + threads = MessageThread.all + + threads.merge_threads + + assert_raises(ActiveRecord::RecordNotFound) do + message_threads(:one) + end + end + + test "should contain all messages in target thread after merge threads" do + threads = MessageThread.all + + threads.merge_threads + + assert_includes message_threads(:two).messages, messages(:one) + assert_includes message_threads(:two).messages, messages(:two) + assert_includes message_threads(:two).messages, messages(:three) + assert_includes message_threads(:two).messages, messages(:four) + end end From a14a2421a5869552eaac6e516e2eaf083c99b0ce Mon Sep 17 00:00:00 2001 From: Miroslav Hettes Date: Mon, 14 Aug 2023 16:44:30 +0200 Subject: [PATCH 10/34] Create model, migration and UI to admin for group_tags --- .../tag_group_table_row_component.html.erb | 12 + .../admin/tag_group_table_row_component.rb | 10 + .../admin/tag_table_row_component.html.erb | 8 +- .../admin/tag_table_row_component.rb | 4 +- .../tag_user_table_row_component.html.erb | 2 +- app/controllers/admin/groups_controller.rb | 20 +- .../admin/tag_groups_controller.rb | 30 ++ app/models/group.rb | 2 + app/models/tag_group.rb | 4 + app/policies/admin/tag_group_policy.rb | 52 +++ app/views/admin/groups/show.html.erb | 139 ++++++- app/views/admin/tags/_form.html.erb | 2 +- app/views/admin/tenants/show.html.erb | 20 +- app/views/admin/users/show.html.erb | 370 ++++++++---------- config/routes.rb | 2 + db/migrate/20230814095815_create_tag_group.rb | 10 + ...4111339_migrate_tag_users_to_tag_groups.rb | 11 + db/schema.rb | 13 +- 18 files changed, 475 insertions(+), 236 deletions(-) create mode 100644 app/components/admin/tag_group_table_row_component.html.erb create mode 100644 app/components/admin/tag_group_table_row_component.rb create mode 100644 app/controllers/admin/tag_groups_controller.rb create mode 100644 app/models/tag_group.rb create mode 100644 app/policies/admin/tag_group_policy.rb create mode 100644 db/migrate/20230814095815_create_tag_group.rb create mode 100644 db/migrate/20230814111339_migrate_tag_users_to_tag_groups.rb diff --git a/app/components/admin/tag_group_table_row_component.html.erb b/app/components/admin/tag_group_table_row_component.html.erb new file mode 100644 index 000000000..25ac5897f --- /dev/null +++ b/app/components/admin/tag_group_table_row_component.html.erb @@ -0,0 +1,12 @@ + + + <%= link_to @tag_group.tag.name, admin_tenant_tag_path(Current.tenant, @tag_group.tag) %> + + + <%= @tag_group.tag.visible %> + + + <%= button_to 'Unassign tag', admin_tag_group_path(@tag_group), + method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium cursor-pointer" %> + + diff --git a/app/components/admin/tag_group_table_row_component.rb b/app/components/admin/tag_group_table_row_component.rb new file mode 100644 index 000000000..51d873708 --- /dev/null +++ b/app/components/admin/tag_group_table_row_component.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class Admin::TagGroupTableRowComponent < ViewComponent::Base + with_collection_parameter :tag_group + + def initialize(tag_group:) + @tag_group = tag_group + end + +end diff --git a/app/components/admin/tag_table_row_component.html.erb b/app/components/admin/tag_table_row_component.html.erb index 8318f76fe..ff8997bba 100644 --- a/app/components/admin/tag_table_row_component.html.erb +++ b/app/components/admin/tag_table_row_component.html.erb @@ -9,12 +9,12 @@ case @tag_action when 'add' %> - <%= form_with model: [:admin, TagUser.new(tag_id: @tag.id, user_id: @user.id)], class: "contents" do |form| %> + <%= form_with model: [:admin, TagGroup.new(tag_id: @tag.id, group_id: @group.id)], class: "contents" do |form| %> <%= form.hidden_field :tag_id %> - <%= form.hidden_field :user_id %> + <%= form.hidden_field :group_id %> <%= form.submit 'Assign tag' ,class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %> - - <% end %> + <% end %> + <% else %> <%= link_to 'Edit this tag', edit_admin_tenant_tag_path(Current.tenant, @tag), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %> diff --git a/app/components/admin/tag_table_row_component.rb b/app/components/admin/tag_table_row_component.rb index 22758878d..2dddc1de5 100644 --- a/app/components/admin/tag_table_row_component.rb +++ b/app/components/admin/tag_table_row_component.rb @@ -3,9 +3,9 @@ class Admin::TagTableRowComponent < ViewComponent::Base with_collection_parameter :tag - def initialize(tag:, user: "", tag_action: "") + def initialize(tag:, group: "", tag_action: "") @tag = tag - @user = user + @group = group @tag_action = tag_action end end diff --git a/app/components/admin/tag_user_table_row_component.html.erb b/app/components/admin/tag_user_table_row_component.html.erb index a3ae3b215..b49b47ee7 100644 --- a/app/components/admin/tag_user_table_row_component.html.erb +++ b/app/components/admin/tag_user_table_row_component.html.erb @@ -6,7 +6,7 @@ <%= @tag_user.tag.visible %> - <%= button_to 'Unassign tag', admin_tag_user_path(@tag_user), + <%#= button_to 'Unassign tag', admin_tag_user_path(@tag_user), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium cursor-pointer" %> diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 12a701ac2..7ed7f0de9 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -9,6 +9,7 @@ def index def show @group = policy_scope([:admin, Group]).find(params[:id]) authorize([:admin, @group]) + @other_tags = other_tags end def new @@ -47,11 +48,18 @@ def destroy end private - def set_group - @group = Group.find(params[:id]) - end + def set_group + @group = Group.find(params[:id]) + end - def group_params - params.require(:group).permit(:name, :group_type) - end + def group_params + params.require(:group).permit(:name, :group_type) + end + + def other_tags + @other_tags = + Tag + .where(tenant_id: params[:tenant_id]) + .where.not(id: @group.tag_ids) + end end diff --git a/app/controllers/admin/tag_groups_controller.rb b/app/controllers/admin/tag_groups_controller.rb new file mode 100644 index 000000000..a8e4572b6 --- /dev/null +++ b/app/controllers/admin/tag_groups_controller.rb @@ -0,0 +1,30 @@ +class Admin::TagGroupsController < ApplicationController + before_action :set_tag_group, only: %i[ destroy ] + # TODO - rediscuss the whole concept of SITE_ADMIN vs TENANT admin responsibilities and functionality + + def create + @tag_group = TagGroup.new(tag_group_params) + authorize([:admin, @tag_group]) + + @tag_group.save! + + redirect_back fallback_location:"/", notice: "Tag permission was successfully assigned." + end + + def destroy + authorize([:admin, @tag_group]) + @tag_group.destroy + redirect_back fallback_location:"/", notice: "Tag permission was successfully destroyed." + end + + private + + def set_tag_group + @tag_group = policy_scope([:admin, TagGroup]).find(params[:id]) + end + + # Only allow a list of trusted parameters through. + def tag_group_params + params.require(:tag_group).permit(:tag_id, :group_id) + end +end diff --git a/app/models/group.rb b/app/models/group.rb index 1365be552..138211701 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -2,6 +2,8 @@ class Group < ApplicationRecord belongs_to :tenant has_many :group_memberships, dependent: :destroy has_many :users, through: :group_memberships + has_many :tag_groups, dependent: :destroy + has_many :tags, through: :tag_groups validates_presence_of :name validates_uniqueness_of :name, scope: :tenant_id diff --git a/app/models/tag_group.rb b/app/models/tag_group.rb new file mode 100644 index 000000000..ad3de2192 --- /dev/null +++ b/app/models/tag_group.rb @@ -0,0 +1,4 @@ +class TagGroup < ApplicationRecord + belongs_to :group + belongs_to :tag +end diff --git a/app/policies/admin/tag_group_policy.rb b/app/policies/admin/tag_group_policy.rb new file mode 100644 index 000000000..3fdc1f265 --- /dev/null +++ b/app/policies/admin/tag_group_policy.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +class Admin::TagGroupPolicy < ApplicationPolicy + attr_reader :user, :tag_group + + def initialize(user, tag_group) + @user = user + @tag_group = tag_group + end + + class Scope < Scope + def resolve + if @user.site_admin? + scope.all + else + scope.includes(:group, :tag).where(tag: { tenant_id: Current.tenant.id }, tag: { tenant_id: Current.tenant.id }) + end + end + end + + def index + @user.site_admin? || @user.admin? + end + + def show? + @user.site_admin? || @user.admin? + end + + def create? + return false if !@user.site_admin? && !@user.admin? + return false unless @tag_group.tag.tenant == Current.tenant + return false unless @tag_group.group.tenant == Current.tenant + + true + end + + def new? + create? + end + + def update? + @user.site_admin? || @user.admin? + end + + def edit? + update? + end + + def destroy? + @user.site_admin? || @user.admin? + end +end diff --git a/app/views/admin/groups/show.html.erb b/app/views/admin/groups/show.html.erb index b27c62956..0f11382cd 100644 --- a/app/views/admin/groups/show.html.erb +++ b/app/views/admin/groups/show.html.erb @@ -1,13 +1,132 @@ -
-
- <% if notice.present? %> -

<%= notice %>

- <% end %> - <%= render @group %> - <%= link_to 'Edit this group', edit_admin_tenant_group_path(@group.tenant_id, @group), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> -
- <%= button_to 'Destroy this group', admin_tenant_group_path(@group.tenant_id, @group), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %> +
+
+
+
    +
  • +
    +

    Group

    +
    +
    +
    + <% if notice.present? %> +

    <%= notice %>

    + <% end %> + <%= render @group %> + <%= link_to 'Edit this group', edit_admin_tenant_group_path(@group.tenant_id, @group), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> +
    + <%= button_to 'Destroy this group', admin_tenant_group_path(@group.tenant_id, @group), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %> +
    + <%= link_to 'Back to tenant', admin_tenant_path(@group.tenant_id), class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> +
    +
    +
  • +
  • +
    +
    +

    Tags Assigned

    +
    + +
    +
    +
    +
    +
    + + + + + + + + + + <%= render Admin::TagGroupTableRowComponent.with_collection(@group.tag_groups.includes(:tag)) %> + +
    + + Name + + + + + + Type + + + + + Edit +
    +
    +
    +
    +
    +
    +
    +
  • +
  • +
    +
    +

    Other Tags

    +
    + +
    +
    +
    +
    + + + + + + + + + + <%= render Admin::TagTableRowComponent.with_collection(@other_tags, group: @group, tag_action: 'add') %> + +
    + + Name + + + + + + Type + + + + + Edit +
    +
    +
    +
    +
    +
    +
  • +
- <%= link_to 'Back to tenant', admin_tenant_path(@group.tenant_id), class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
diff --git a/app/views/admin/tags/_form.html.erb b/app/views/admin/tags/_form.html.erb index c5ecfdef0..a2c2946bb 100644 --- a/app/views/admin/tags/_form.html.erb +++ b/app/views/admin/tags/_form.html.erb @@ -15,7 +15,7 @@
<%= form.label :visible %> - <%= form.check_box :visible, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> + <%= form.check_box :visible, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2" %>
<%= form.label :user_id %> diff --git a/app/views/admin/tenants/show.html.erb b/app/views/admin/tenants/show.html.erb index e668e9e93..ecf912c77 100644 --- a/app/views/admin/tenants/show.html.erb +++ b/app/views/admin/tenants/show.html.erb @@ -6,7 +6,7 @@

Tenant

-
+
<% if notice.present? %>

<%= notice %>

@@ -23,7 +23,7 @@ -
  • +
  • Groups

    @@ -76,7 +76,7 @@ Tu zacina tabulka s groupami -
  • +
  • Users

    @@ -102,7 +102,7 @@ Tu zacina tabulka s usermi - E-Mail + Email
  • - - - -
  • +
  • Boxes

    @@ -180,7 +180,7 @@ Tu zacina tabulka s boxmi
  • -
  • +
  • Tags

    @@ -206,7 +206,7 @@ Tu zacina tabulka s boxmi
    - URI + Visible
  • +
    +
    +

    Groups Membership

    +
    +
    +
    +
    +
    +
    + + + + + + + + + + <%= render Admin::GroupMembershipTableRowComponent.with_collection(@user.group_memberships) %> + +
    + + Name + + + + + + Type + + + + + Edit +
    +
    +
    +
    +
    +
    +
    +
  • +
  • +
    + -
    -

    Other Groups

    -
    -
    -
    -
    -
    -
    - - - - - - - - - - <%= render Admin::GroupTableRowComponent.with_collection(@other_groups, user: @user, group_action: 'add') %> - -
    - - Name - - - - - - Type - - - - - Edit -
    +
    +

    Other Groups

    +
    +
    +
    +
    +
    +
    + + + + + + + + + + <%= render Admin::GroupTableRowComponent.with_collection(@other_groups, user: @user, group_action: 'add') %> + +
    + + Name + + + + + + Type + + + + + Edit +
    +
    +
    +
    +
    -
    -
    -
    - -
    -

    Tags Assigned

    -
    -
    -
    -
    -
    -
    - - - - - - - - - - <%= render Admin::TagUserTableRowComponent.with_collection(@user.tag_users) %> - -
    - - Name - - - - - - Type - - - - - Edit -
    +
    +

    Tags Assigned

    -
    -
    -
    -
    - -
    -

    Other Tags

    -
    -
    -
    -
    +
  • +
    diff --git a/config/routes.rb b/config/routes.rb index f2b12a5f8..02128780c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,6 +18,8 @@ resources :group_memberships resources :tag_users + + resources :tag_groups, only: [:create, :destroy] end resources :boxes, path: 'schranky', only: [:index, :show] do diff --git a/db/migrate/20230814095815_create_tag_group.rb b/db/migrate/20230814095815_create_tag_group.rb new file mode 100644 index 000000000..9e113ea85 --- /dev/null +++ b/db/migrate/20230814095815_create_tag_group.rb @@ -0,0 +1,10 @@ +class CreateTagGroup < ActiveRecord::Migration[7.0] + def change + create_table :tag_groups do |t| + t.references :group, null: false, foreign_key: true + t.references :tag, null: false, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20230814111339_migrate_tag_users_to_tag_groups.rb b/db/migrate/20230814111339_migrate_tag_users_to_tag_groups.rb new file mode 100644 index 000000000..637e12969 --- /dev/null +++ b/db/migrate/20230814111339_migrate_tag_users_to_tag_groups.rb @@ -0,0 +1,11 @@ +class MigrateTagUsersToTagGroups < ActiveRecord::Migration[7.0] + def change + User.transaction do + User.find_each do |user| + user_group = user.groups.find_by_name!(user.name) + + user_group.tag_ids = user.tag_ids + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 787db99f0..28f1180b1 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[7.0].define(version: 2023_08_02_071745) do +ActiveRecord::Schema[7.0].define(version: 2023_08_14_111339) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -342,6 +342,15 @@ t.index ["tag_id"], name: "index_messages_tags_on_tag_id" end + create_table "tag_groups", force: :cascade do |t| + t.bigint "group_id", null: false + t.bigint "tag_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["group_id"], name: "index_tag_groups_on_group_id" + t.index ["tag_id"], name: "index_tag_groups_on_tag_id" + end + create_table "tag_users", force: :cascade do |t| t.bigint "user_id", null: false t.bigint "tag_id", null: false @@ -405,6 +414,8 @@ add_foreign_key "messages", "message_threads" add_foreign_key "messages_tags", "messages" add_foreign_key "messages_tags", "tags" + add_foreign_key "tag_groups", "groups" + add_foreign_key "tag_groups", "tags" add_foreign_key "tag_users", "tags" add_foreign_key "tag_users", "users" add_foreign_key "tags", "tenants" From 92976f34d391d2c9784162febe35d02737543112 Mon Sep 17 00:00:00 2001 From: Miroslav Hettes Date: Tue, 15 Aug 2023 14:31:00 +0200 Subject: [PATCH 11/34] Use group_tags model for checking access --- app/models/tag.rb | 2 ++ app/policies/admin/tag_group_policy.rb | 2 +- app/policies/message_draft_policy.rb | 3 ++- app/policies/message_object_policy.rb | 3 ++- app/policies/message_policy.rb | 3 ++- app/policies/message_thread_policy.rb | 2 +- app/policies/message_threads_tag_policy.rb | 12 ++++++++++-- app/policies/tag_policy.rb | 2 +- 8 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index 9cc2ca8cd..cd616e854 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -15,6 +15,8 @@ class Tag < ApplicationRecord has_and_belongs_to_many :message_threads has_many :tag_users, dependent: :destroy has_many :users, through: :tag_users + has_many :tag_groups, dependent: :destroy + has_many :groups, through: :tag_groups belongs_to :owner, class_name: 'User', optional: true end diff --git a/app/policies/admin/tag_group_policy.rb b/app/policies/admin/tag_group_policy.rb index 3fdc1f265..215b8a12c 100644 --- a/app/policies/admin/tag_group_policy.rb +++ b/app/policies/admin/tag_group_policy.rb @@ -13,7 +13,7 @@ def resolve if @user.site_admin? scope.all else - scope.includes(:group, :tag).where(tag: { tenant_id: Current.tenant.id }, tag: { tenant_id: Current.tenant.id }) + scope.includes(:group, :tag).where(group: { tenant_id: Current.tenant.id }, tag: { tenant_id: Current.tenant.id }) end end end diff --git a/app/policies/message_draft_policy.rb b/app/policies/message_draft_policy.rb index ee8714f6e..0ce4e71bf 100644 --- a/app/policies/message_draft_policy.rb +++ b/app/policies/message_draft_policy.rb @@ -18,7 +18,8 @@ def resolve select mt.id from message_threads mt join message_threads_tags mt_tags on mt.id = mt_tags.message_thread_id - join tag_users tu on mt_tags.tag_id = tu.tag_id + join tag_groups tg on mt_tags.tag_id = tg.tag_id + join group_memberships gm on tg.group_id = gm.group_id where user_id = ?)', @user.id ) diff --git a/app/policies/message_object_policy.rb b/app/policies/message_object_policy.rb index cd97b87b1..3761719f3 100644 --- a/app/policies/message_object_policy.rb +++ b/app/policies/message_object_policy.rb @@ -19,7 +19,8 @@ def resolve from messages m join message_threads mt on mt.id = m.message_thread_id join message_threads_tags mt_tags on mt.id = mt_tags.message_thread_id - join tag_users tu on mt_tags.tag_id = tu.tag_id + join tag_groups tg on mt_tags.tag_id = tg.tag_id + join group_memberships gm on tg.group_id = gm.group_id where user_id = ?)', @user.id ) diff --git a/app/policies/message_policy.rb b/app/policies/message_policy.rb index a47f66b56..fc6e8aa9b 100644 --- a/app/policies/message_policy.rb +++ b/app/policies/message_policy.rb @@ -18,7 +18,8 @@ def resolve select mt.id from message_threads mt join message_threads_tags mt_tags on mt.id = mt_tags.message_thread_id - join tag_users tu on mt_tags.tag_id = tu.tag_id + join tag_groups tg on mt_tags.tag_id = tg.tag_id + join group_memberships gm on tg.group_id = gm.group_id where user_id = ?)', @user.id ) diff --git a/app/policies/message_thread_policy.rb b/app/policies/message_thread_policy.rb index 3855db50d..cb7607b69 100644 --- a/app/policies/message_thread_policy.rb +++ b/app/policies/message_thread_policy.rb @@ -13,7 +13,7 @@ def resolve if @user.site_admin? scope.all else - scope.joins(tags: :users).where(users: { id: @user.id }) + scope.joins(tags: { groups: :group_memberships }).where(group_memberships: { user_id: @user.id }) end end end diff --git a/app/policies/message_threads_tag_policy.rb b/app/policies/message_threads_tag_policy.rb index 9cfbd95a2..03bea0be6 100644 --- a/app/policies/message_threads_tag_policy.rb +++ b/app/policies/message_threads_tag_policy.rb @@ -18,10 +18,18 @@ def resolve select mt.id from message_threads mt join message_threads_tags mt_tags on mt.id = mt_tags.message_thread_id - join tag_users tu on mt_tags.tag_id = tu.user_id + join tag_groups tg on mt_tags.tag_id = tg.tag_id + join group_memberships gm on tg.group_id = gm.group_id where user_id = ?)', @user.id - ).where("tag_id in (select tag_id from tag_users where user_id = ?)", user.id) + ).where( + "tag_id in ( + select tag_id + from tag_groups tg + join group_memberships gm on tg.group_id = gm.group_id + where user_id = ?)", + @user.id + ) end end end diff --git a/app/policies/tag_policy.rb b/app/policies/tag_policy.rb index 8c4011750..416b8c6fa 100644 --- a/app/policies/tag_policy.rb +++ b/app/policies/tag_policy.rb @@ -12,7 +12,7 @@ class Scope < Scope def resolve return scope.where(tenant_id: Current.tenant.id) if @user.site_admin? return scope.where(tenant_id: @user.tenant_id) if @user.admin? - scope.includes(:tag_users).where(tag_users: { user_id: @user.id }) + joins(groups: :group_memberships).where(group_memberships: {user_id: @user.id}) end end From 70b2af99c343bc70b4502b2fb5882a4d65a51a53 Mon Sep 17 00:00:00 2001 From: Miroslav Hettes Date: Tue, 15 Aug 2023 14:36:21 +0200 Subject: [PATCH 12/34] Add obsolete mark to read only view --- app/views/admin/users/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb index 492560a36..f8bfcea7b 100644 --- a/app/views/admin/users/show.html.erb +++ b/app/views/admin/users/show.html.erb @@ -134,7 +134,7 @@ Tabulka s groupami, kde nie je Tabulka s tagmi, ktore moze vidiet -->
    -

    Tags Assigned

    +

    Tags Assigned (obsolete)

    From b83423f35fde86de51f632089ede0ad3cd7c62a4 Mon Sep 17 00:00:00 2001 From: Miroslav Hettes Date: Thu, 17 Aug 2023 15:16:10 +0200 Subject: [PATCH 13/34] Convert joins to subselect --- app/policies/message_thread_policy.rb | 15 ++++++++++----- app/policies/tag_policy.rb | 7 ++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/policies/message_thread_policy.rb b/app/policies/message_thread_policy.rb index cb7607b69..6d6d5ec48 100644 --- a/app/policies/message_thread_policy.rb +++ b/app/policies/message_thread_policy.rb @@ -10,11 +10,16 @@ def initialize(user, message_thread) class Scope < Scope def resolve - if @user.site_admin? - scope.all - else - scope.joins(tags: { groups: :group_memberships }).where(group_memberships: { user_id: @user.id }) - end + return scope.all if @user.site_admin? + + scope.where( + 'id IN ( + SELECT message_thread_id FROM message_threads_tags mt_tags + JOIN tag_groups tg on mt_tags.tag_id = tg.tag_id + JOIN group_memberships gm on tg.group_id = gm.group_id + WHERE gm.user_id = ?)', + @user.id + ) end end diff --git a/app/policies/tag_policy.rb b/app/policies/tag_policy.rb index 416b8c6fa..eea53689e 100644 --- a/app/policies/tag_policy.rb +++ b/app/policies/tag_policy.rb @@ -12,7 +12,12 @@ class Scope < Scope def resolve return scope.where(tenant_id: Current.tenant.id) if @user.site_admin? return scope.where(tenant_id: @user.tenant_id) if @user.admin? - joins(groups: :group_memberships).where(group_memberships: {user_id: @user.id}) + + scope.where('id IN ( + SELECT tag_id FROM tag_groups tg + JOIN group_memberships gm on tg.group_id = gm.group_id + WHERE gm.user_id = ? + )', @user.id) end end From 87832bf96456e26419ff873b18d0dfea982bd943 Mon Sep 17 00:00:00 2001 From: Miroslav Hettes Date: Fri, 18 Aug 2023 14:06:25 +0200 Subject: [PATCH 14/34] White subselect with exists and user active record methods --- app/models/message_threads_tag.rb | 3 +++ app/models/tag_group.rb | 3 +++ app/policies/message_draft_policy.rb | 24 +++++++---------- app/policies/message_object_policy.rb | 25 +++++++---------- app/policies/message_policy.rb | 24 +++++++---------- app/policies/message_thread_policy.rb | 12 ++++----- app/policies/message_threads_tag_policy.rb | 31 +++++++--------------- app/policies/tag_policy.rb | 13 +++++---- 8 files changed, 60 insertions(+), 75 deletions(-) diff --git a/app/models/message_threads_tag.rb b/app/models/message_threads_tag.rb index 6a3054d2a..b6b9270f4 100644 --- a/app/models/message_threads_tag.rb +++ b/app/models/message_threads_tag.rb @@ -11,4 +11,7 @@ class MessageThreadsTag < ApplicationRecord belongs_to :message_thread belongs_to :tag + + # used for joins only + has_many :tag_groups, primary_key: :tag_id, foreign_key: :tag_id end diff --git a/app/models/tag_group.rb b/app/models/tag_group.rb index ad3de2192..e6d077459 100644 --- a/app/models/tag_group.rb +++ b/app/models/tag_group.rb @@ -1,4 +1,7 @@ class TagGroup < ApplicationRecord belongs_to :group belongs_to :tag + + # used for joins only + has_many :group_memberships, primary_key: :group_id, foreign_key: :group_id end diff --git a/app/policies/message_draft_policy.rb b/app/policies/message_draft_policy.rb index 0ce4e71bf..425554454 100644 --- a/app/policies/message_draft_policy.rb +++ b/app/policies/message_draft_policy.rb @@ -10,20 +10,16 @@ def initialize(user, message) class Scope < Scope def resolve - if @user.site_admin? - scope.all - else - scope.where( - 'message_thread_id in ( - select mt.id - from message_threads mt - join message_threads_tags mt_tags on mt.id = mt_tags.message_thread_id - join tag_groups tg on mt_tags.tag_id = tg.tag_id - join group_memberships gm on tg.group_id = gm.group_id - where user_id = ?)', - @user.id - ) - end + scope.all if @user.site_admin? + + scope.where( + MessageThreadsTag + .select("1") + .joins(tag_groups: :group_memberships) + .where("message_threads_tags.message_thread_id = messages.message_thread_id") + .where(group_memberships: { user_id: @user.id }) + .arel.exists + ) end end diff --git a/app/policies/message_object_policy.rb b/app/policies/message_object_policy.rb index 3761719f3..94b37dd78 100644 --- a/app/policies/message_object_policy.rb +++ b/app/policies/message_object_policy.rb @@ -10,21 +10,16 @@ def initialize(user, message_object) class Scope < Scope def resolve - if @user.site_admin? - scope.all - else - scope.where( - 'message_id in ( - select m.id - from messages m - join message_threads mt on mt.id = m.message_thread_id - join message_threads_tags mt_tags on mt.id = mt_tags.message_thread_id - join tag_groups tg on mt_tags.tag_id = tg.tag_id - join group_memberships gm on tg.group_id = gm.group_id - where user_id = ?)', - @user.id - ) - end + scope.all if @user.site_admin? + + scope.where( + Message + .select("1") + .joins(message_threads_tags: { tag_groups: :group_memberships }) + .where("message_objects.message_id = messages.id") + .where(group_memberships: { user_id: @user.id }) + .arel.exists + ) end end diff --git a/app/policies/message_policy.rb b/app/policies/message_policy.rb index fc6e8aa9b..5deb2e085 100644 --- a/app/policies/message_policy.rb +++ b/app/policies/message_policy.rb @@ -10,20 +10,16 @@ def initialize(user, message) class Scope < Scope def resolve - if @user.site_admin? - scope.all - else - scope.where( - 'message_thread_id in ( - select mt.id - from message_threads mt - join message_threads_tags mt_tags on mt.id = mt_tags.message_thread_id - join tag_groups tg on mt_tags.tag_id = tg.tag_id - join group_memberships gm on tg.group_id = gm.group_id - where user_id = ?)', - @user.id - ) - end + scope.all if @user.site_admin? + + scope.where( + MessageThreadsTag + .select("1") + .joins(tag_groups: :group_memberships) + .where("message_threads_tags.message_thread_id = messages.message_thread_id") + .where(group_memberships: { user_id: @user.id }) + .arel.exists + ) end end diff --git a/app/policies/message_thread_policy.rb b/app/policies/message_thread_policy.rb index 6d6d5ec48..fa660d561 100644 --- a/app/policies/message_thread_policy.rb +++ b/app/policies/message_thread_policy.rb @@ -13,12 +13,12 @@ def resolve return scope.all if @user.site_admin? scope.where( - 'id IN ( - SELECT message_thread_id FROM message_threads_tags mt_tags - JOIN tag_groups tg on mt_tags.tag_id = tg.tag_id - JOIN group_memberships gm on tg.group_id = gm.group_id - WHERE gm.user_id = ?)', - @user.id + MessageThreadsTag + .select("1") + .joins(:tag_groups => :group_memberships) + .where("message_threads_tags.message_thread_id = message_threads.id") + .where(group_memberships: { user_id: @user.id }) + .arel.exists ) end end diff --git a/app/policies/message_threads_tag_policy.rb b/app/policies/message_threads_tag_policy.rb index 03bea0be6..61efd292f 100644 --- a/app/policies/message_threads_tag_policy.rb +++ b/app/policies/message_threads_tag_policy.rb @@ -10,27 +10,16 @@ def initialize(user, message_threads_tag) class Scope < Scope def resolve - if @user.site_admin? - scope.all - else - scope.where( - 'message_thread_id in ( - select mt.id - from message_threads mt - join message_threads_tags mt_tags on mt.id = mt_tags.message_thread_id - join tag_groups tg on mt_tags.tag_id = tg.tag_id - join group_memberships gm on tg.group_id = gm.group_id - where user_id = ?)', - @user.id - ).where( - "tag_id in ( - select tag_id - from tag_groups tg - join group_memberships gm on tg.group_id = gm.group_id - where user_id = ?)", - @user.id - ) - end + scope.all if @user.site_admin? + + scope.where( + TagGroup + .select("1") + .joins(:group_memberships) + .where("tag_groups.tag_id = message_threads_tags.tag_id") + .where(group_memberships: { user_id: @user.id }) + .arel.exists + ) end end diff --git a/app/policies/tag_policy.rb b/app/policies/tag_policy.rb index eea53689e..db6579bfd 100644 --- a/app/policies/tag_policy.rb +++ b/app/policies/tag_policy.rb @@ -13,11 +13,14 @@ def resolve return scope.where(tenant_id: Current.tenant.id) if @user.site_admin? return scope.where(tenant_id: @user.tenant_id) if @user.admin? - scope.where('id IN ( - SELECT tag_id FROM tag_groups tg - JOIN group_memberships gm on tg.group_id = gm.group_id - WHERE gm.user_id = ? - )', @user.id) + scope.where( + TagGroup + .select("1") + .joins(:group_memberships) + .where("tag_groups.tag_id = tags.id") + .where(group_memberships: { user_id: @user.id }) + .arel.exists + ) end end From 6c9480c30db035eee3edee01438f926d8bc9beda Mon Sep 17 00:00:00 2001 From: Miroslav Hettes Date: Mon, 21 Aug 2023 11:27:08 +0200 Subject: [PATCH 15/34] Change to select 1 --- app/policies/message_draft_policy.rb | 2 +- app/policies/message_object_policy.rb | 2 +- app/policies/message_policy.rb | 2 +- app/policies/message_thread_policy.rb | 2 +- app/policies/message_threads_tag_policy.rb | 2 +- app/policies/tag_policy.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/policies/message_draft_policy.rb b/app/policies/message_draft_policy.rb index 425554454..6e4d6e2e3 100644 --- a/app/policies/message_draft_policy.rb +++ b/app/policies/message_draft_policy.rb @@ -14,7 +14,7 @@ def resolve scope.where( MessageThreadsTag - .select("1") + .select(1) .joins(tag_groups: :group_memberships) .where("message_threads_tags.message_thread_id = messages.message_thread_id") .where(group_memberships: { user_id: @user.id }) diff --git a/app/policies/message_object_policy.rb b/app/policies/message_object_policy.rb index 94b37dd78..6fa5e82de 100644 --- a/app/policies/message_object_policy.rb +++ b/app/policies/message_object_policy.rb @@ -14,7 +14,7 @@ def resolve scope.where( Message - .select("1") + .select(1) .joins(message_threads_tags: { tag_groups: :group_memberships }) .where("message_objects.message_id = messages.id") .where(group_memberships: { user_id: @user.id }) diff --git a/app/policies/message_policy.rb b/app/policies/message_policy.rb index 5deb2e085..e020a5c05 100644 --- a/app/policies/message_policy.rb +++ b/app/policies/message_policy.rb @@ -14,7 +14,7 @@ def resolve scope.where( MessageThreadsTag - .select("1") + .select(1) .joins(tag_groups: :group_memberships) .where("message_threads_tags.message_thread_id = messages.message_thread_id") .where(group_memberships: { user_id: @user.id }) diff --git a/app/policies/message_thread_policy.rb b/app/policies/message_thread_policy.rb index fa660d561..6ba588a6a 100644 --- a/app/policies/message_thread_policy.rb +++ b/app/policies/message_thread_policy.rb @@ -14,7 +14,7 @@ def resolve scope.where( MessageThreadsTag - .select("1") + .select(1) .joins(:tag_groups => :group_memberships) .where("message_threads_tags.message_thread_id = message_threads.id") .where(group_memberships: { user_id: @user.id }) diff --git a/app/policies/message_threads_tag_policy.rb b/app/policies/message_threads_tag_policy.rb index 61efd292f..214dce59e 100644 --- a/app/policies/message_threads_tag_policy.rb +++ b/app/policies/message_threads_tag_policy.rb @@ -14,7 +14,7 @@ def resolve scope.where( TagGroup - .select("1") + .select(1) .joins(:group_memberships) .where("tag_groups.tag_id = message_threads_tags.tag_id") .where(group_memberships: { user_id: @user.id }) diff --git a/app/policies/tag_policy.rb b/app/policies/tag_policy.rb index db6579bfd..fad809012 100644 --- a/app/policies/tag_policy.rb +++ b/app/policies/tag_policy.rb @@ -15,7 +15,7 @@ def resolve scope.where( TagGroup - .select("1") + .select(1) .joins(:group_memberships) .where("tag_groups.tag_id = tags.id") .where(group_memberships: { user_id: @user.id }) From 570b0dee12dbbf23734b3e954a6606cdeb94d1a8 Mon Sep 17 00:00:00 2001 From: Miroslav Hettes Date: Tue, 22 Aug 2023 09:00:45 +0200 Subject: [PATCH 16/34] Fix admin policy --- app/policies/message_draft_policy.rb | 2 +- app/policies/message_object_policy.rb | 2 +- app/policies/message_policy.rb | 2 +- app/policies/message_threads_tag_policy.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/policies/message_draft_policy.rb b/app/policies/message_draft_policy.rb index 6e4d6e2e3..326af2cd4 100644 --- a/app/policies/message_draft_policy.rb +++ b/app/policies/message_draft_policy.rb @@ -10,7 +10,7 @@ def initialize(user, message) class Scope < Scope def resolve - scope.all if @user.site_admin? + return scope.all if @user.site_admin? scope.where( MessageThreadsTag diff --git a/app/policies/message_object_policy.rb b/app/policies/message_object_policy.rb index 6fa5e82de..260e53f80 100644 --- a/app/policies/message_object_policy.rb +++ b/app/policies/message_object_policy.rb @@ -10,7 +10,7 @@ def initialize(user, message_object) class Scope < Scope def resolve - scope.all if @user.site_admin? + return scope.all if @user.site_admin? scope.where( Message diff --git a/app/policies/message_policy.rb b/app/policies/message_policy.rb index e020a5c05..72f665dfd 100644 --- a/app/policies/message_policy.rb +++ b/app/policies/message_policy.rb @@ -10,7 +10,7 @@ def initialize(user, message) class Scope < Scope def resolve - scope.all if @user.site_admin? + return scope.all if @user.site_admin? scope.where( MessageThreadsTag diff --git a/app/policies/message_threads_tag_policy.rb b/app/policies/message_threads_tag_policy.rb index 214dce59e..d913a5ba1 100644 --- a/app/policies/message_threads_tag_policy.rb +++ b/app/policies/message_threads_tag_policy.rb @@ -10,7 +10,7 @@ def initialize(user, message_threads_tag) class Scope < Scope def resolve - scope.all if @user.site_admin? + return scope.all if @user.site_admin? scope.where( TagGroup From e1de5cb63cb449a3d24270e2cf4a2fb85ff928f7 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Wed, 23 Aug 2023 19:42:26 +0200 Subject: [PATCH 17/34] Update models, Add GeneralAgendaBuilder --- .../message_drafts_component.html.erb | 2 +- app/controllers/drafts_controller.rb | 44 ----------- app/controllers/message_drafts_controller.rb | 26 ++++--- ...b => message_drafts_imports_controller.rb} | 8 +- app/jobs/drafts/finish_import_job.rb | 4 +- app/jobs/drafts/parse_import_job.rb | 2 + app/lib/upvs/GeneralAgendaBuilder.rb | 12 +++ app/models/box.rb | 4 +- app/models/draft.rb | 69 ----------------- app/models/drafts.rb | 5 -- app/models/drafts/object.rb | 36 --------- app/models/message_draft.rb | 77 ++++++++++++++++++- .../import.rb => message_drafts_import.rb} | 6 +- ....rb => message_drafts_import_validator.rb} | 2 +- app/policies/draft_policy.rb | 36 --------- ...icy.rb => message_drafts_import_policy.rb} | 2 +- app/views/drafts/index.html.erb | 33 -------- app/views/drafts/show.html.erb | 31 -------- app/views/message_drafts/index.html.erb | 11 ++- .../upload_new.html.erb | 2 +- config/routes.rb | 14 +--- db/migrate/20230809141544_drop_drafts.rb | 6 ++ ...rafts_imports_to_message_drafts_imports.rb | 5 ++ db/schema.rb | 61 ++++----------- 24 files changed, 151 insertions(+), 347 deletions(-) delete mode 100644 app/controllers/drafts_controller.rb rename app/controllers/{drafts/imports_controller.rb => message_drafts_imports_controller.rb} (69%) create mode 100644 app/lib/upvs/GeneralAgendaBuilder.rb delete mode 100644 app/models/draft.rb delete mode 100644 app/models/drafts.rb delete mode 100644 app/models/drafts/object.rb rename app/models/{drafts/import.rb => message_drafts_import.rb} (85%) rename app/models/validators/{drafts_import_validator.rb => message_drafts_import_validator.rb} (96%) delete mode 100644 app/policies/draft_policy.rb rename app/policies/{drafts/import_policy.rb => message_drafts_import_policy.rb} (80%) delete mode 100644 app/views/drafts/index.html.erb delete mode 100644 app/views/drafts/show.html.erb rename app/views/{drafts/imports => message_drafts_imports}/upload_new.html.erb (69%) create mode 100644 db/migrate/20230809141544_drop_drafts.rb create mode 100644 db/migrate/20230809145031_rename_drafts_imports_to_message_drafts_imports.rb diff --git a/app/components/message_drafts_component.html.erb b/app/components/message_drafts_component.html.erb index a0fc58fbc..f2f426bac 100644 --- a/app/components/message_drafts_component.html.erb +++ b/app/components/message_drafts_component.html.erb @@ -80,7 +80,7 @@ <% end %>
    - <%= button_to message_draft_path(@message), method: :delete, class: "flex justify-strech items-start self-stretch flex-grow-0 flex-shrink-0 gap-2 p-6 rounded-lg border border-gray-400 px-3.5 py-2.5 hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 rounded-lg", title: "Zahodiť draft" do %> + <%= button_to message_draft_path(@message), method: :delete, params: { redirect_url: message_path(@message.original_message) }, class: "flex justify-strech items-start self-stretch flex-grow-0 flex-shrink-0 gap-2 p-6 rounded-lg border border-gray-400 px-3.5 py-2.5 hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 rounded-lg", title: "Zahodiť draft" do %> diff --git a/app/controllers/drafts_controller.rb b/app/controllers/drafts_controller.rb deleted file mode 100644 index 02773228d..000000000 --- a/app/controllers/drafts_controller.rb +++ /dev/null @@ -1,44 +0,0 @@ -class DraftsController < ApplicationController - before_action :load_draft, only: [:show, :submit] - before_action :load_drafts, only: [:index, :destroy, :submit_all] - - def index - @drafts = @drafts.order(created_at: :desc) - end - - def show - end - - def destroy - @drafts.find(params[:id]).destroy - - redirect_to drafts_path - end - - def submit - submit_draft(@draft) - end - - def submit_all - @drafts.each do |draft| - submit_draft(draft) if draft.submittable? - end - end - - private - - def submit_draft(draft) - draft.being_submitted! - Drafts::SubmitJob.perform_later(draft) - end - - def load_draft - @draft = policy_scope(Draft).find(params[:id] || params[:draft_id]) - authorize @draft - end - - def load_drafts - authorize Draft - @drafts = policy_scope(Draft) - end -end diff --git a/app/controllers/message_drafts_controller.rb b/app/controllers/message_drafts_controller.rb index 94bff2b17..2187f1fd3 100644 --- a/app/controllers/message_drafts_controller.rb +++ b/app/controllers/message_drafts_controller.rb @@ -1,15 +1,16 @@ class MessageDraftsController < ApplicationController before_action :load_message_drafts, only: :index before_action :set_message, only: :create - before_action :set_message_draft, except: [:index, :create] + before_action :load_draft, except: [:index, :create] def index + @message_drafts = @message_drafts.order(created_at: :desc) end def create authorize @message - @message_draft = MessageDraft.create_from_message(@message) + @message_draft = MessageDraft.create_message_reply(@message) redirect_to message_draft_path(@message_draft) end @@ -24,31 +25,32 @@ def update permitted_params = message_params - @message_draft.title = permitted_params["message_title"] - @message_draft.metadata["message_body"] = permitted_params["message_text"] - @message_draft.save! + @message_draft.update_content(title: permitted_params["message_title"], body: permitted_params["message_text"]) end def submit authorize @message_draft if @message_draft.submittable? - Govbox::SubmitMessageDraftJob.perform_later(@message_draft) - - @message_draft.metadata["status"] = "being_submitted" - @message_draft.save! - + MessageDraft.submit(@message_draft) redirect_to message_path(@message_draft.original_message), notice: "Správa bola zaradená na odoslanie." else + # TODO prisposobit importovanym draftom redirect_to message_draft_path(@message_draft), notice: "Vyplňte predmet a text odpovede." end end + + def submit_all + @message_drafts.each do |message_draft| + MessageDraft.submit(@message_draft) if message_draft.submittable? + end + end def destroy authorize @message_draft @message_draft.destroy - redirect_to message_path(@message_draft.original_message) + redirect_to (params[:redirect_url] || message_drafts_path) end private @@ -62,7 +64,7 @@ def set_message @message = policy_scope(Message).find(params[:original_message_id]) end - def set_message_draft + def load_draft @message_draft = policy_scope(MessageDraft).find(params[:id]) @menu = SidebarMenu.new(controller_name, action_name, { message: @message_draft }) end diff --git a/app/controllers/drafts/imports_controller.rb b/app/controllers/message_drafts_imports_controller.rb similarity index 69% rename from app/controllers/drafts/imports_controller.rb rename to app/controllers/message_drafts_imports_controller.rb index 185c23d85..1e0979c66 100644 --- a/app/controllers/drafts/imports_controller.rb +++ b/app/controllers/message_drafts_imports_controller.rb @@ -1,11 +1,11 @@ -class Drafts::ImportsController < ApplicationController +class MessageDraftsImportsController < ApplicationController def create - authorize Drafts::Import, policy_class: Drafts::ImportPolicy + authorize MessageDraftsImport file_storage = FileStorage.new zip_content = params[:content] - import = Drafts::Import.create!( + import = MessageDraftsImport.create!( name: "#{Time.now.to_i}_#{zip_content.original_filename}", box: Current.box ) @@ -17,7 +17,7 @@ def create end def upload_new - authorize Drafts::Import, policy_class: Drafts::ImportPolicy + authorize MessageDraftsImport end private diff --git a/app/jobs/drafts/finish_import_job.rb b/app/jobs/drafts/finish_import_job.rb index 876eb863c..5c62d4bba 100644 --- a/app/jobs/drafts/finish_import_job.rb +++ b/app/jobs/drafts/finish_import_job.rb @@ -2,9 +2,9 @@ class Drafts::FinishImportJob < ApplicationJob def perform(batch, params) batch.properties[:import].message_drafts.find_each do |message_draft| if message_draft.valid?(:validate_data) - message_draft.metadata["status"] = "loading_done" + message_draft.metadata["status"] = "created" else - message_draft.metadata["status"] = "invalid_data" + message_draft.metadata["status"] = "invalid" end message_draft.save diff --git a/app/jobs/drafts/parse_import_job.rb b/app/jobs/drafts/parse_import_job.rb index 76ccff098..c4ebb1b96 100644 --- a/app/jobs/drafts/parse_import_job.rb +++ b/app/jobs/drafts/parse_import_job.rb @@ -29,6 +29,7 @@ def perform(import, import_zip_path, jobs_batch: GoodJob::Batch.new, load_conten thread: thread, title: File.basename(entry_name), replyable: false, + read: true, delivered_at: Time.now, metadata: { "import_id": import.id, @@ -81,6 +82,7 @@ def load_import_csv(import, csv_path) thread: message_thread, title: row['message_subject'], replyable: false, + read: true, delivered_at: Time.now, metadata: { "recipient_uri": row['recipient_uri'], diff --git a/app/lib/upvs/GeneralAgendaBuilder.rb b/app/lib/upvs/GeneralAgendaBuilder.rb new file mode 100644 index 000000000..8e5877c5d --- /dev/null +++ b/app/lib/upvs/GeneralAgendaBuilder.rb @@ -0,0 +1,12 @@ +class GeneralAgendaBuilder + GENERAL_AGENDA_SCHEMA ||= 'http://schemas.gov.sk/form/App.GeneralAgenda/1.9' + + def self.build_xml(subject:, body:) + <<~GENERAL_AGENDA + + #{subject} + #{body} + + GENERAL_AGENDA + end +end \ No newline at end of file diff --git a/app/models/box.rb b/app/models/box.rb index 789e57e08..8f017d420 100644 --- a/app/models/box.rb +++ b/app/models/box.rb @@ -14,8 +14,6 @@ class Box < ApplicationRecord has_many :folders has_many :message_threads, through: :folders, extend: MessageThreadsExtensions - - has_many :drafts_imports, class_name: 'Drafts::Import' - has_many :drafts + has_many :message_drafts_imports end diff --git a/app/models/draft.rb b/app/models/draft.rb deleted file mode 100644 index 0c746b4a2..000000000 --- a/app/models/draft.rb +++ /dev/null @@ -1,69 +0,0 @@ -# == Schema Information -# -# Table name: drafts -# -# id :integer not null, primary key -# box_id :integer -# import_id :integer -# status :integer default("created") -# recipient_uri :string -# posp_id :string -# posp_version :string -# message_type :string -# message_subject :string -# sender_business_reference :string -# recipient_business_reference :string -# import_subfolder :string -# message_id :uuid -# correlation_id :uuid -# created_at :datetime not null -# updated_at :datetime not null - -class Draft < ApplicationRecord - belongs_to :box - belongs_to :import, class_name: 'Drafts::Import', optional: true - - has_many :objects, class_name: 'Drafts::Object', :dependent => :destroy - - delegate :tenant, to: :box - - with_options on: :validate_data do |loaded_draft| - loaded_draft.validates :recipient_uri, :posp_id, :posp_version, :message_type, :message_subject, :message_id, :correlation_id, presence: true - loaded_draft.validates :message_id, :correlation_id, format: { with: Utils::UUID_PATTERN }, allow_blank: true - loaded_draft.validate :validate_form - loaded_draft.validate :validate_objects - end - - enum status: { created: 0, being_loaded: 1, loading_done: 2, invalid_data: 3, being_submitted: 4, submitted: 5, submit_failed_unprocessable: 6, submit_failed_temporary: 7 } - - def title - message_subject || import_subfolder - end - - def submittable? - (loading_done? || submit_failed_temporary?) && valid? - end - - def form - objects.select { |o| o.form? }&.first - end - - private - - def validate_form - forms = objects.select { |o| o.form? } - - if objects.size == 0 - errors.add(:objects, "No objects found for draft") - elsif forms.count != 1 - errors.add(:objects, "Draft has to contain exactly one form") - end - end - - def validate_objects - objects.each do |object| - object.valid?(:validate_data) - errors.merge!(object.errors) - end - end -end diff --git a/app/models/drafts.rb b/app/models/drafts.rb deleted file mode 100644 index 8cebffe19..000000000 --- a/app/models/drafts.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Drafts - def self.table_name_prefix - 'drafts_' - end -end diff --git a/app/models/drafts/object.rb b/app/models/drafts/object.rb deleted file mode 100644 index 80c98451e..000000000 --- a/app/models/drafts/object.rb +++ /dev/null @@ -1,36 +0,0 @@ -# == Schema Information -# -# Table name: drafts_objects -# -# id :integer not null, primary key -# draft_id :string not null -# uuid :uuid not null -# name :string not null -# signed :boolean -# to_be_signed :boolean -# form :boolean -# created_at :datetime not null -# updated_at :datetime not null - -class Drafts::Object < ApplicationRecord - belongs_to :draft, class_name: 'Draft' - - has_one_attached :content - - validates :name, :uuid, presence: true, on: :validate_data - validates :uuid, format: { with: Utils::UUID_PATTERN }, on: :validate_data - validate :content_attached?, on: :validate_data - validate :allowed_mime_type?, on: :validate_data - - private - - def content_attached? - content.attached? - end - - def allowed_mime_type? - Utils.detect_mime_type(entry_name: self.name, is_form: self.form?) - rescue StandardError - errors.add(:mime_type, "of #{name} object is disallowed", allowed_mime_types: Utils::EXTENSIONS_ALLOW_LIST.join(', ')) - end -end diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index 912a5fb95..6e83f1450 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -1,5 +1,16 @@ class MessageDraft < Message - def self.create_from_message(message) + MESSAGE_REPLY_POSP_ID ||= "App.GeneralAgenda" + MESSAGE_REPLY_POSP_VERSION ||= "1.9" + MESSAGE_REPLY_MESSAGE_TYPE ||= "App.GeneralAgenda" + + with_options on: :validate_data do |message_draft| + message_draft.validates :uuid, format: { with: Utils::UUID_PATTERN }, allow_blank: false + message_draft.validate :validate_metadata + message_draft.validate :validate_form + message_draft.validate :validate_objects + end + + def self.create_message_reply(message) MessageDraft.create!( uuid: SecureRandom.uuid, thread: message.thread, @@ -8,17 +19,47 @@ def self.create_from_message(message) read: true, delivered_at: Time.now, metadata: { - "status": "created", + "recipient_uri": message.metadata["sender_uri"], + "posp_id": MESSAGE_REPLY_POSP_ID, + "posp_version": MESSAGE_REPLY_POSP_VERSION, + "message_type": MESSAGE_REPLY_MESSAGE_TYPE, "correlation_id": message.metadata["correlation_id"], "reference_id": message.uuid, "original_message_id": message.id, - "recipient_uri": message.metadata["sender_uri"], + "status": "created" } ) end + def self.submit(message_draft) + Govbox::SubmitMessageDraftJob.perform_later(message_draft) + + message_draft.metadata["status"] = "being_submitted" + message_draft.save! + end + + def update_content(title:, body:) + form = objects.select { |o| o.form? }&.first + + unless form + form = MessageObject.create( + message_id: id, + name: "form.xml", + mimetype: "application/x-eform-xml", + object_type: "FORM", + is_signed: false + ) + + form.message_object_datum.create + end + + form.message_object_datum.update( + blob: GeneralAgendaBuilder.build_xml(subject: title, body: body) + ) + end + def import - Drafts::Import.find(metadata["import_id"]) if metadata["import_id"] + MessageDraftsImport.find(metadata["import_id"]) if metadata["import_id"] end def submittable? @@ -40,4 +81,32 @@ def submitted? def original_message Message.find(metadata["original_message_id"]) end + + private + + def validate_metadata + errors.add(:metadata, "No recipient URI") unless metadata["recipient_uri"].present? + errors.add(:metadata, "No posp ID") unless metadata["posp_id"].present? + errors.add(:metadata, "No posp version") unless metadata["posp_version"].present? + errors.add(:metadata, "No message type") unless metadata["message_type"].present? + errors.add(:metadata, "No correlation ID") unless metadata["correlation_id"].present? + errors.add(:metadata, "Correlation ID must be UUID") unless metadata["correlation_id"]&.match?(Utils::UUID_PATTERN) + end + + def validate_form + forms = objects.select { |o| o.form? } + + if objects.size == 0 + errors.add(:objects, "No objects found for draft") + elsif forms.count != 1 + errors.add(:objects, "Draft has to contain exactly one form") + end + end + + def validate_objects + objects.each do |object| + object.valid?(:validate_data) + errors.merge!(object.errors) + end + end end diff --git a/app/models/drafts/import.rb b/app/models/message_drafts_import.rb similarity index 85% rename from app/models/drafts/import.rb rename to app/models/message_drafts_import.rb index d4a2a3522..641d975c6 100644 --- a/app/models/drafts/import.rb +++ b/app/models/message_drafts_import.rb @@ -1,6 +1,6 @@ # == Schema Information # -# Table name: drafts_imports +# Table name: message_drafts_imports # # id :integer not null, primary key # name :string not null @@ -9,12 +9,12 @@ # created_at :datetime not null # updated_at :datetime not null -class Drafts::Import < ApplicationRecord +class MessageDraftsImport < ApplicationRecord belongs_to :box, class_name: 'Box' after_destroy_commit { MessageDraft.where("metadata ->> 'import_subfolder' = ?", id.to_s).destroy_all } - validates_with DraftsImportValidator, if: :content_path + validates_with MessageDraftsImportValidator, if: :content_path enum status: { uploaded: 0, parsed: 1, parsing_failed: 2 } diff --git a/app/models/validators/drafts_import_validator.rb b/app/models/validators/message_drafts_import_validator.rb similarity index 96% rename from app/models/validators/drafts_import_validator.rb rename to app/models/validators/message_drafts_import_validator.rb index 40efed2b0..50d492a58 100644 --- a/app/models/validators/drafts_import_validator.rb +++ b/app/models/validators/message_drafts_import_validator.rb @@ -1,4 +1,4 @@ -class DraftsImportValidator < ActiveModel::Validator +class MessageDraftsImportValidator < ActiveModel::Validator def validate(record) record.errors.add(:drafts, "No drafts found") if Utils.sub_folders(record.content_path).empty? diff --git a/app/policies/draft_policy.rb b/app/policies/draft_policy.rb deleted file mode 100644 index 78d8bfe48..000000000 --- a/app/policies/draft_policy.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -class DraftPolicy < ApplicationPolicy - attr_reader :user, :draft - - def initialize(user, draft) - @user = user - @draft = draft - end - - class Scope < Scope - def resolve - @user.site_admin? ? scope.all : scope.where(box: Current.box) - end - end - - def index? - true - end - - def show? - @user.tenant == @draft.box.tenant && @draft.box == Current.box - end - - def destroy? - @user.tenant == @draft.box.tenant && @draft.box == Current.box - end - - def submit? - @user.tenant == @draft.box.tenant && @draft.box == Current.box - end - - def submit_all? - @user.tenant == @draft.box.tenant && @draft.box == Current.box - end -end diff --git a/app/policies/drafts/import_policy.rb b/app/policies/message_drafts_import_policy.rb similarity index 80% rename from app/policies/drafts/import_policy.rb rename to app/policies/message_drafts_import_policy.rb index 2d4402048..9a20d638c 100644 --- a/app/policies/drafts/import_policy.rb +++ b/app/policies/message_drafts_import_policy.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Drafts::ImportPolicy < ApplicationPolicy +class MessageDraftsImportPolicy < ApplicationPolicy attr_reader :user def initialize(user, _) diff --git a/app/views/drafts/index.html.erb b/app/views/drafts/index.html.erb deleted file mode 100644 index c68422dac..000000000 --- a/app/views/drafts/index.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -

    Drafty

    - -
    - <%= link_to "Vytvoriť nový draft", drafts_path %> -
    - <%= link_to "Nahrať import", upload_new_drafts_imports_path %> - <% if @drafts.any? %> -
    - <%= button_to "Podať všetky", submit_all_drafts_path, method: :post %> - <% end %> -
    - -<% if @drafts.any? %> -
    -

    Vytvorené podania

    -
    - - - - - - - - <% @drafts.each do |draft| %> - - - - - - <% end %> -
    PodanieBalíkStav
    <%= link_to draft.title, draft_path(draft.id) %><%= " #{draft.import&.base_name}" %><%= " #{draft.status}" %>
    -
    -<% end %> diff --git a/app/views/drafts/show.html.erb b/app/views/drafts/show.html.erb deleted file mode 100644 index 8d2418b27..000000000 --- a/app/views/drafts/show.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -

    Draft <%= @draft.message_subject %>

    - -

    Stav: <%= @draft.status %>

    -
    - -<% if @draft.import %> -

    Z importu: <%= @draft.import.base_name %>

    -
    -<% end %> - -<%= form_tag draft_path(@draft), method: :delete do %> - <%= submit_tag 'Zmazať' %> -<% end %> - -
    - -<% if @draft.submittable? %> - <%= form_tag draft_submit_path(@draft), method: :post do %> - <%= submit_tag 'Podať' %> - <% end %> -<% end %> - -<% unless @draft.valid?(:validate_data) %> -

    Errors:

    -
      - <% @draft.errors.each do |error| %> -
    • <%= error.full_message %>
    • - <% end %> -
    -<% end %> - diff --git a/app/views/message_drafts/index.html.erb b/app/views/message_drafts/index.html.erb index 68ecfee98..599e92066 100644 --- a/app/views/message_drafts/index.html.erb +++ b/app/views/message_drafts/index.html.erb @@ -1,12 +1,12 @@

    Drafty

    - <%= link_to "Nahrať import", upload_new_drafts_imports_path %> + <%= link_to "Nahrať import", upload_new_message_drafts_imports_path %>
    <% if @message_drafts.any? %>
    -

    Vytvorené podania

    +

    Podania

    @@ -18,10 +18,15 @@ <% @message_drafts.each do |message_draft| %> - + <% end %>
    <%= " #{message_draft.import&.base_name}" %><%= " #{message_draft.title}" %> <%= " #{message_draft.metadata["status"]}" %>
    + +
    +
    + +
    <% end %> diff --git a/app/views/drafts/imports/upload_new.html.erb b/app/views/message_drafts_imports/upload_new.html.erb similarity index 69% rename from app/views/drafts/imports/upload_new.html.erb rename to app/views/message_drafts_imports/upload_new.html.erb index 5045ed07f..66a4a03d4 100644 --- a/app/views/drafts/imports/upload_new.html.erb +++ b/app/views/message_drafts_imports/upload_new.html.erb @@ -1,6 +1,6 @@

    Nový import draftov

    -<%= form_tag drafts_imports_path, method: :post, multipart: true do %> +<%= form_tag message_drafts_imports_path, method: :post, multipart: true do %> <%= label_tag :content, 'Import' %> <%= file_field_tag :content, accept: "application/zip" %>

    diff --git a/config/routes.rb b/config/routes.rb index f2b12a5f8..fd0d8ecbe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,7 +26,7 @@ resources :tags do resources :message_threads do - end + end end resources :message_threads do @@ -45,6 +45,7 @@ resources :message_objects do member do get 'download' + get 'signing_data' end end end @@ -59,15 +60,8 @@ resource :settings - namespace :drafts, path: 'drafty' do - resources :imports, path: 'importy', only: :create do - get :upload_new, path: 'novy', on: :collection - end - end - - resources :drafts, path: 'drafty', only: %i[index show destroy] do - post :submit - post :submit_all, on: :collection + resources :message_drafts_imports, only: :create do + get :upload_new, path: 'novy', on: :collection end resources :sessions do diff --git a/db/migrate/20230809141544_drop_drafts.rb b/db/migrate/20230809141544_drop_drafts.rb new file mode 100644 index 000000000..19ebcd4ca --- /dev/null +++ b/db/migrate/20230809141544_drop_drafts.rb @@ -0,0 +1,6 @@ +class DropDrafts < ActiveRecord::Migration[7.0] + def up + drop_table :drafts_objects + drop_table :drafts + end +end diff --git a/db/migrate/20230809145031_rename_drafts_imports_to_message_drafts_imports.rb b/db/migrate/20230809145031_rename_drafts_imports_to_message_drafts_imports.rb new file mode 100644 index 000000000..8d33f6908 --- /dev/null +++ b/db/migrate/20230809145031_rename_drafts_imports_to_message_drafts_imports.rb @@ -0,0 +1,5 @@ +class RenameDraftsImportsToMessageDraftsImports < ActiveRecord::Migration[7.0] + def up + rename_table :drafts_imports, :message_drafts_imports + end +end diff --git a/db/schema.rb b/db/schema.rb index 8b3d9f16f..eb4a629ba 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[7.0].define(version: 2023_08_04_122837) do +ActiveRecord::Schema[7.0].define(version: 2023_08_09_145031) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -86,48 +86,6 @@ t.index ["tenant_id"], name: "index_boxes_on_tenant_id" end - create_table "drafts", force: :cascade do |t| - t.bigint "import_id" - t.integer "status", default: 0 - t.string "recipient_uri" - t.string "posp_id" - t.string "posp_version" - t.string "message_type" - t.string "message_subject" - t.string "import_subfolder" - t.string "sender_business_reference" - t.string "recipient_business_reference" - t.uuid "message_id" - t.uuid "correlation_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.bigint "box_id", null: false - t.index ["box_id"], name: "index_drafts_on_box_id" - t.index ["import_id"], name: "index_drafts_on_import_id" - end - - create_table "drafts_imports", force: :cascade do |t| - t.string "name", null: false - t.integer "status", default: 0 - t.string "content_path" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.bigint "box_id", null: false - t.index ["box_id"], name: "index_drafts_imports_on_box_id" - end - - create_table "drafts_objects", force: :cascade do |t| - t.bigint "draft_id", null: false - t.uuid "uuid", null: false - t.string "name", null: false - t.boolean "signed" - t.boolean "to_be_signed" - t.boolean "form" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["draft_id"], name: "index_drafts_objects_on_draft_id" - end - create_table "folders", force: :cascade do |t| t.bigint "box_id", null: false t.string "name", null: false @@ -266,6 +224,16 @@ t.index ["tenant_id"], name: "index_groups_on_tenant_id" end + create_table "message_drafts_imports", force: :cascade do |t| + t.string "name", null: false + t.integer "status", default: 0 + t.string "content_path" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "box_id", null: false + t.index ["box_id"], name: "index_message_drafts_imports_on_box_id" + end + create_table "message_object_data", force: :cascade do |t| t.bigint "message_object_id", null: false t.binary "blob", null: false @@ -329,8 +297,8 @@ t.text "html_visualization" t.boolean "read", default: false, null: false t.json "metadata" - t.boolean "replyable", default: true, null: false t.string "type" + t.boolean "replyable", default: true, null: false t.index ["message_thread_id"], name: "index_messages_on_message_thread_id" end @@ -385,10 +353,6 @@ add_foreign_key "automation_rules", "tenants" add_foreign_key "automation_rules", "users" add_foreign_key "boxes", "tenants" - add_foreign_key "drafts", "boxes" - add_foreign_key "drafts", "drafts_imports", column: "import_id" - add_foreign_key "drafts_imports", "boxes" - add_foreign_key "drafts_objects", "drafts" add_foreign_key "folders", "boxes" add_foreign_key "govbox_api_connections", "boxes" add_foreign_key "govbox_folders", "boxes" @@ -397,6 +361,7 @@ add_foreign_key "group_memberships", "groups" add_foreign_key "group_memberships", "users" add_foreign_key "groups", "tenants" + add_foreign_key "message_drafts_imports", "boxes" add_foreign_key "message_object_data", "message_objects" add_foreign_key "message_objects", "messages" add_foreign_key "message_thread_merge_identifiers", "message_threads" From be91d6bdfe53dad18e3afc609e760ba8f3002733 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Wed, 23 Aug 2023 20:59:58 +0200 Subject: [PATCH 18/34] Make one job for submitting messages --- app/controllers/message_drafts_controller.rb | 4 +- app/jobs/drafts/submit_job.rb | 64 ----------------- app/jobs/govbox/submit_message_draft_job.rb | 72 ++++++++++++------- ...daBuilder.rb => general_agenda_builder.rb} | 2 +- app/models/message_draft.rb | 45 +++++++----- app/models/message_object.rb | 2 +- app/views/message_drafts/index.html.erb | 8 +-- 7 files changed, 78 insertions(+), 119 deletions(-) delete mode 100644 app/jobs/drafts/submit_job.rb rename app/lib/upvs/{GeneralAgendaBuilder.rb => general_agenda_builder.rb} (90%) diff --git a/app/controllers/message_drafts_controller.rb b/app/controllers/message_drafts_controller.rb index 2187f1fd3..7633442fe 100644 --- a/app/controllers/message_drafts_controller.rb +++ b/app/controllers/message_drafts_controller.rb @@ -32,7 +32,7 @@ def submit authorize @message_draft if @message_draft.submittable? - MessageDraft.submit(@message_draft) + @message_draft.submit redirect_to message_path(@message_draft.original_message), notice: "Správa bola zaradená na odoslanie." else # TODO prisposobit importovanym draftom @@ -42,7 +42,7 @@ def submit def submit_all @message_drafts.each do |message_draft| - MessageDraft.submit(@message_draft) if message_draft.submittable? + message_draft.submit if message_draft.submittable? end end diff --git a/app/jobs/drafts/submit_job.rb b/app/jobs/drafts/submit_job.rb deleted file mode 100644 index c98d579c0..000000000 --- a/app/jobs/drafts/submit_job.rb +++ /dev/null @@ -1,64 +0,0 @@ -class Drafts::SubmitJob < ApplicationJob - def perform(message_draft, upvs_client: UpvsEnvironment.upvs_client) - message_draft_data = { - posp_id: message_draft.metadata["posp_id"], - posp_version: message_draft.metadata["posp_version"], - message_type: message_draft.metadata["message_type"], - message_id: message_draft.uuid, - correlation_id: message_draft.metadata["correlation_id"], - recipient_uri: message_draft.metadata["recipient_uri"], - message_subject: message_draft.title, - sender_business_reference: message_draft.metadata["sender_business_reference"], - recipient_business_reference: message_draft.metadata["recipient_business_reference"], - objects: build_objects(message_draft) - }.compact - - sktalk_api = upvs_client.api(message_draft.thread.folder.box).sktalk - - begin - success, response_status = sktalk_api.receive_and_save_to_outbox(message_draft_data) - if success - message_draft.metadata["status"] = "submitted" - else - handle_submit_fail(message_draft, response_status) - end - - message_draft.save! - rescue Error => error - message_draft.metadata["status"] = "submit_failed_temporary" - message_draft.save! - - raise error - end - end - - private - - def build_objects(message_draft) - objects = [] - message_draft.objects.each do |object| - objects << { - id: SecureRandom.uuid, - name: object.name, - encoding: "Base64", - signed: object.is_signed, - mime_type: object.mimetype, - form: object.form?, - content: Base64.strict_encode64(object.message_object_datum.blob) - }.compact - end - - objects - end - - def handle_submit_fail(message_draft, response_status) - case response_status - when 408 - # TODO - when 422 - message_draft.metadata["status"] = "submit_failed_unprocessable" - else - message_draft.metadata["status"] = "submit_failed_temporary" - end - end -end diff --git a/app/jobs/govbox/submit_message_draft_job.rb b/app/jobs/govbox/submit_message_draft_job.rb index ae71bb5a5..59b388aaa 100644 --- a/app/jobs/govbox/submit_message_draft_job.rb +++ b/app/jobs/govbox/submit_message_draft_job.rb @@ -1,47 +1,65 @@ class Govbox::SubmitMessageDraftJob < ApplicationJob - class << self - delegate :uuid, to: SecureRandom - end - def perform(message_draft, upvs_client: UpvsEnvironment.upvs_client) - reply_data = { + message_draft_data = { + posp_id: message_draft.metadata["posp_id"], + posp_version: message_draft.metadata["posp_version"], + message_type: message_draft.metadata["message_type"], message_id: message_draft.uuid, correlation_id: message_draft.metadata["correlation_id"], - reference_id: message_draft.metadata["reference_id"], recipient_uri: message_draft.metadata["recipient_uri"], - general_agenda: { - subject: message_draft.title, - body: message_draft.metadata["message_body"] - }, - attachments: (message_attachments_data(message_draft) if message_draft.objects.any?) + message_subject: message_draft.title, + sender_business_reference: message_draft.metadata["sender_business_reference"], + recipient_business_reference: message_draft.metadata["recipient_business_reference"], + objects: build_objects(message_draft) }.compact sktalk_api = upvs_client.api(message_draft.thread.folder.box).sktalk - success, response_status = sktalk_api.receive_and_save_to_outbox(reply_data) + begin + success, response_status = sktalk_api.receive_and_save_to_outbox(message_draft_data) + if success + message_draft.metadata["status"] = "submitted" + Govbox::SyncBoxJob.set(wait: 3.minutes).perform_later(message_draft.thread.folder.box) + else + handle_submit_fail(message_draft, response_status) + end - raise StandardError, "Message reply submission failed!" unless success + message_draft.save! + rescue Error => error + message_draft.metadata["status"] = "submit_failed_temporary" + message_draft.save! - message_draft.metadata["status"] = "submitted" - message_draft.save! - - Govbox::SyncBoxJob.set(wait: 3.minutes).perform_later(message_draft.thread.folder.box) + raise error + end end private - def message_attachments_data(message_draft) - message_draft.objects.map do |message_attachment| - { - id: uuid, - name: message_attachment.name, - signed: message_attachment.is_signed, + def build_objects(message_draft) + objects = [] + message_draft.objects.each do |object| + objects << { + id: SecureRandom.uuid, + name: object.name, encoding: "Base64", - mime_type: Utils.detect_mime_type(entry_name: message_attachment.name), - content: Base64.strict_encode64(message_attachment.message_object_datum.blob) - } + signed: object.is_signed, + mime_type: object.mimetype, + form: object.form?, + content: Base64.strict_encode64(object.message_object_datum.blob) + }.compact end + + objects end - delegate :uuid, to: self + def handle_submit_fail(message_draft, response_status) + case response_status + when 408 + # TODO + when 422 + message_draft.metadata["status"] = "submit_failed_unprocessable" + else + message_draft.metadata["status"] = "submit_failed_temporary" + end + end end diff --git a/app/lib/upvs/GeneralAgendaBuilder.rb b/app/lib/upvs/general_agenda_builder.rb similarity index 90% rename from app/lib/upvs/GeneralAgendaBuilder.rb rename to app/lib/upvs/general_agenda_builder.rb index 8e5877c5d..db69ece58 100644 --- a/app/lib/upvs/GeneralAgendaBuilder.rb +++ b/app/lib/upvs/general_agenda_builder.rb @@ -1,4 +1,4 @@ -class GeneralAgendaBuilder +class Upvs::GeneralAgendaBuilder GENERAL_AGENDA_SCHEMA ||= 'http://schemas.gov.sk/form/App.GeneralAgenda/1.9' def self.build_xml(subject:, body:) diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index 6e83f1450..7ea474241 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -1,7 +1,7 @@ class MessageDraft < Message - MESSAGE_REPLY_POSP_ID ||= "App.GeneralAgenda" - MESSAGE_REPLY_POSP_VERSION ||= "1.9" - MESSAGE_REPLY_MESSAGE_TYPE ||= "App.GeneralAgenda" + GENERAL_AGENDA_POSP_ID ||= "App.GeneralAgenda" + GENERAL_AGENDA_POSP_VERSION ||= "1.9" + GENERAL_AGENDA_MESSAGE_TYPE ||= "App.GeneralAgenda" with_options on: :validate_data do |message_draft| message_draft.validates :uuid, format: { with: Utils::UUID_PATTERN }, allow_blank: false @@ -20,9 +20,9 @@ def self.create_message_reply(message) delivered_at: Time.now, metadata: { "recipient_uri": message.metadata["sender_uri"], - "posp_id": MESSAGE_REPLY_POSP_ID, - "posp_version": MESSAGE_REPLY_POSP_VERSION, - "message_type": MESSAGE_REPLY_MESSAGE_TYPE, + "posp_id": GENERAL_AGENDA_POSP_ID, + "posp_version": GENERAL_AGENDA_POSP_VERSION, + "message_type": GENERAL_AGENDA_MESSAGE_TYPE, "correlation_id": message.metadata["correlation_id"], "reference_id": message.uuid, "original_message_id": message.id, @@ -31,17 +31,23 @@ def self.create_message_reply(message) ) end - def self.submit(message_draft) - Govbox::SubmitMessageDraftJob.perform_later(message_draft) + def submit + Govbox::SubmitMessageDraftJob.perform_later(self) - message_draft.metadata["status"] = "being_submitted" - message_draft.save! + metadata["status"] = "being_submitted" + save! end def update_content(title:, body:) - form = objects.select { |o| o.form? }&.first + self.title = title + metadata["message_body"] = body + save! - unless form + if form + form.message_object_datum.update( + blob: Upvs::GeneralAgendaBuilder.build_xml(subject: title, body: body) + ) + else form = MessageObject.create( message_id: id, name: "form.xml", @@ -50,18 +56,21 @@ def update_content(title:, body:) is_signed: false ) - form.message_object_datum.create + form.message_object_datum = MessageObjectDatum.create( + message_object: form, + blob: Upvs::GeneralAgendaBuilder.build_xml(subject: title, body: body) + ) end - - form.message_object_datum.update( - blob: GeneralAgendaBuilder.build_xml(subject: title, body: body) - ) + end + + def form + objects.select { |o| o.form? }&.first end def import MessageDraftsImport.find(metadata["import_id"]) if metadata["import_id"] end - + def submittable? title.present? && metadata["message_body"].present? && not_yet_submitted? end diff --git a/app/models/message_object.rb b/app/models/message_object.rb index 1383f773f..8275fb7f7 100644 --- a/app/models/message_object.rb +++ b/app/models/message_object.rb @@ -38,6 +38,6 @@ def form? end def destroyable? - message.is_a?(MessageDraft) + message.is_a?(MessageDraft) && !form? end end diff --git a/app/views/message_drafts/index.html.erb b/app/views/message_drafts/index.html.erb index 599e92066..780c702fd 100644 --- a/app/views/message_drafts/index.html.erb +++ b/app/views/message_drafts/index.html.erb @@ -18,15 +18,11 @@ <% @message_drafts.each do |message_draft| %> - <%= " #{message_draft.title}" %> + <%= message_draft.title %> + <%= " #{message_draft&.import&.base_name || '-'}" %> <%= " #{message_draft.metadata["status"]}" %> <% end %> - -
    -
    - -
    <% end %> From 5a957f3b5e7186d03d54a6106ba8d65f05cd5af5 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Wed, 23 Aug 2023 22:07:33 +0200 Subject: [PATCH 19/34] Add editable?, custom_visualization? methods to MessageDraft --- .../message_drafts_component.html.erb | 20 +++++++++++-------- app/jobs/drafts/parse_import_job.rb | 6 ++++++ app/models/message_draft.rb | 10 +++++++++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/components/message_drafts_component.html.erb b/app/components/message_drafts_component.html.erb index f2f426bac..9d43858d5 100644 --- a/app/components/message_drafts_component.html.erb +++ b/app/components/message_drafts_component.html.erb @@ -31,14 +31,18 @@
    - <%= form_tag message_draft_path(@message), method: :put, class: "w-full", id: "reply_form" do %> -
    -
    - <%= text_field_tag "message_title", @message.title, placeholder: "Predmet", onchange: 'document.getElementById("reply_form").submit();', disabled: !@message.not_yet_submitted?, class:"mb-3 px-3 py-4 placeholder-slate-300 text-slate-í00 relative bg-white bg-white rounded-lg text-base border-0 shadow outline-none focus:outline-none focus:ring w-full" %> - <%= text_area_tag "message_text", @message.metadata["message_body"], placeholder: "Text", onchange: 'document.getElementById("reply_form").submit();', rows: 10, disabled: !@message.not_yet_submitted?, class:"px-3 py-4 placeholder-slate-300 text-slate-í00 relative bg-white bg-white rounded-lg text-base border-0 shadow outline-none focus:outline-none focus:ring w-full h-full" %> + <% if @message.custom_visualization? %> + <%= form_tag message_draft_path(@message), method: :put, class: "w-full", id: "reply_form" do %> +
    +
    + <%= text_field_tag "message_title", @message.title, placeholder: "Predmet", onchange: 'document.getElementById("reply_form").submit();', disabled: !@message.editable?, class:"mb-3 px-3 py-4 placeholder-slate-300 text-slate-í00 relative bg-white bg-white rounded-lg text-base border-0 shadow outline-none focus:outline-none focus:ring w-full" %> + <%= text_area_tag "message_text", @message.metadata["message_body"], placeholder: "Text", onchange: 'document.getElementById("reply_form").submit();', rows: 10, disabled: !@message.editable?, class:"px-3 py-4 placeholder-slate-300 text-slate-í00 relative bg-white bg-white rounded-lg text-base border-0 shadow outline-none focus:outline-none focus:ring w-full h-full" %> +
    -
    - <% end %> + <% end %> + <% else %> + <%= @message.html_visualization&.html_safe %> + <% end %> <% if @message.not_yet_submitted? || @message.objects.present? %>
    @@ -80,7 +84,7 @@ <% end %>
    - <%= button_to message_draft_path(@message), method: :delete, params: { redirect_url: message_path(@message.original_message) }, class: "flex justify-strech items-start self-stretch flex-grow-0 flex-shrink-0 gap-2 p-6 rounded-lg border border-gray-400 px-3.5 py-2.5 hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 rounded-lg", title: "Zahodiť draft" do %> + <%= button_to message_draft_path(@message), method: :delete, params: { redirect_url: (message_path(@message.original_message) if @message.original_message || nil) }, class: "flex justify-strech items-start self-stretch flex-grow-0 flex-shrink-0 gap-2 p-6 rounded-lg border border-gray-400 px-3.5 py-2.5 hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 rounded-lg", title: "Zahodiť draft" do %> diff --git a/app/jobs/drafts/parse_import_job.rb b/app/jobs/drafts/parse_import_job.rb index c4ebb1b96..d306fc25c 100644 --- a/app/jobs/drafts/parse_import_job.rb +++ b/app/jobs/drafts/parse_import_job.rb @@ -76,6 +76,12 @@ def load_import_csv(import, csv_path) delivered_at: Time.now, last_message_delivered_at: Time.now ) + + message_thread.tags << Tag.find_or_create_by!( + name: "Drafts", + tenant: import.box.tenant, + visible: true + ) MessageDraft.create!( uuid: uuid, diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index 7ea474241..e16850935 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -71,6 +71,14 @@ def import MessageDraftsImport.find(metadata["import_id"]) if metadata["import_id"] end + def editable? + metadata["posp_id"] == GENERAL_AGENDA_POSP_ID && !form.is_signed? && not_yet_submitted? + end + + def custom_visualization? + metadata["posp_id"] == GENERAL_AGENDA_POSP_ID + end + def submittable? title.present? && metadata["message_body"].present? && not_yet_submitted? end @@ -88,7 +96,7 @@ def submitted? end def original_message - Message.find(metadata["original_message_id"]) + Message.find(metadata["original_message_id"]) if metadata["original_message_id"] end private From 3b84a52acfbc8fd85b41fdd16da51cc5d456260a Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Thu, 24 Aug 2023 00:21:30 +0200 Subject: [PATCH 20/34] Add Upvs::FormTeplate, Upvs::FormTemplateRelatedDocument --- app/jobs/drafts/load_content_job.rb | 40 +- app/models/upvs.rb | 5 + app/models/upvs/form_template.rb | 26 + .../upvs/form_template_related_document.rb | 15 + ...230823200853_create_upvs_form_templates.rb | 12 + ...te_upvs_form_template_related_documents.rb | 14 + db/schema.rb | 22 +- db/seeds.rb | 1577 ++++++++++++++++- 8 files changed, 1701 insertions(+), 10 deletions(-) create mode 100644 app/models/upvs.rb create mode 100644 app/models/upvs/form_template.rb create mode 100644 app/models/upvs/form_template_related_document.rb create mode 100644 db/migrate/20230823200853_create_upvs_form_templates.rb create mode 100644 db/migrate/20230823200907_create_upvs_form_template_related_documents.rb diff --git a/app/jobs/drafts/load_content_job.rb b/app/jobs/drafts/load_content_job.rb index 7e8516932..2c4ed3949 100644 --- a/app/jobs/drafts/load_content_job.rb +++ b/app/jobs/drafts/load_content_job.rb @@ -9,24 +9,26 @@ def perform(message_draft, message_draft_path) Dir.each_child(message_draft_path) do |subdirectory_name| case subdirectory_name when "podpisane" - load_draft_message_drafts(message_draft, File.join(message_draft_path, subdirectory_name), signed: true, to_be_signed: false) + load_message_draft_objects(message_draft, File.join(message_draft_path, subdirectory_name), signed: true, to_be_signed: false) when "podpisat" - load_draft_message_drafts(message_draft, File.join(message_draft_path, subdirectory_name), signed: false, to_be_signed: true) + load_message_draft_objects(message_draft, File.join(message_draft_path, subdirectory_name), signed: false, to_be_signed: true) when "nepodpisovat" - load_draft_message_drafts(message_draft, File.join(message_draft_path, subdirectory_name), signed: false, to_be_signed: false) + load_message_draft_objects(message_draft, File.join(message_draft_path, subdirectory_name), signed: false, to_be_signed: false) end end + + save_form_visualisation(message_draft) end private - def load_draft_message_drafts(message_draft, objects_path, signed:, to_be_signed:) + def load_message_draft_objects(message_draft, objects_path, signed:, to_be_signed:) Dir.foreach(objects_path) do |file_name| next if file_name == '.' or file_name == '..' is_form = form?(message_draft, file_name) - draft_message_draft = MessageObject.create( + message_draft_object = MessageObject.create( name: file_name, mimetype: Utils.detect_mime_type(entry_name: file_name, is_form: is_form), object_type: is_form ? "FORM" : "ATTACHMENT", @@ -36,11 +38,11 @@ def load_draft_message_drafts(message_draft, objects_path, signed:, to_be_signed ) MessageObjectDatum.create( - message_object: draft_message_draft, + message_object: message_draft_object, blob: File.read(File.join(objects_path, file_name)) ) - - draft_message_draft.save! + + message_draft_object.save! end end @@ -50,6 +52,28 @@ def form?(message_draft, file_name) # Form file must have the same name as subfolder file_base_name == message_draft.metadata["import_subfolder"] end + + def save_form_visualisation(message_draft) + upvs_form_template = Upvs::FormTemplate.find_by(identifier: message_draft.metadata["posp_id"], version: message_draft.metadata["posp_version"]) + upvs_form_template_xslt_html = upvs_form_template&.xslt_html + raise MissingFormTemplateError.new unless upvs_form_template_xslt_html + + xslt_template = Nokogiri::XSLT(upvs_form_template_xslt_html) + + if message_draft.form.is_signed? + # TODO add unsigned_content method which calls UPVS OdpodpisanieDat endpoint and uncomment + # message_draft.update( + # html_visualization: xslt_template.transform(Nokogiri::XML(message_draft.form.unsigned_content)).to_s.gsub('"', '\'') + # ) + else + message_draft.update( + html_visualization: xslt_template.transform(Nokogiri::XML(message_draft.form.message_object_datum.blob)).to_s.gsub('"', '\'') + ) + end + end + + class MissingFormTemplateError < StandardError + end delegate :uuid, to: self end diff --git a/app/models/upvs.rb b/app/models/upvs.rb new file mode 100644 index 000000000..c1fa2b7a2 --- /dev/null +++ b/app/models/upvs.rb @@ -0,0 +1,5 @@ +module Upvs + def self.table_name_prefix + "upvs_" + end +end diff --git a/app/models/upvs/form_template.rb b/app/models/upvs/form_template.rb new file mode 100644 index 000000000..7239542c4 --- /dev/null +++ b/app/models/upvs/form_template.rb @@ -0,0 +1,26 @@ +# == Schema Information +# +# Table name: upvs_form_templates +# +# id :integer not null, primary key +# identifier :string not null +# version :string not null +# version_minor :integer not null +# created_at :datetime not null +# updated_at :datetime not null + +class Upvs::FormTemplate < ApplicationRecord + has_many :related_documents, class_name: 'Upvs::FormTemplateRelatedDocument', foreign_key: 'upvs_form_template_id' + + def xslt_html + related_document('CLS_F_XSLT_HTML') + end + + def xsd_schema + related_document('CLS_F_XSD_EDOC') + end + + def related_document(type) + related_documents.where(document_type: type).where("lower(language) = 'sk'")&.first&.data + end +end diff --git a/app/models/upvs/form_template_related_document.rb b/app/models/upvs/form_template_related_document.rb new file mode 100644 index 000000000..5f0dc94c8 --- /dev/null +++ b/app/models/upvs/form_template_related_document.rb @@ -0,0 +1,15 @@ +# == Schema Information +# +# Table name: upvs_form_template_related_documents +# +# id :integer not null, primary key +# upvs_form_template_id :integer not null +# data :string not null +# language :string not null +# document_type :string not null +# created_at :datetime not null +# updated_at :datetime not null + +class Upvs::FormTemplateRelatedDocument < ApplicationRecord + belongs_to :upvs_form_template, class_name: 'Upvs::FormTemplate' +end diff --git a/db/migrate/20230823200853_create_upvs_form_templates.rb b/db/migrate/20230823200853_create_upvs_form_templates.rb new file mode 100644 index 000000000..30be6a65f --- /dev/null +++ b/db/migrate/20230823200853_create_upvs_form_templates.rb @@ -0,0 +1,12 @@ +class CreateUpvsFormTemplates < ActiveRecord::Migration[7.0] + def change + create_table :upvs_form_templates do |t| + t.string :identifier, null: false + t.string :version, null: false + + t.timestamps + end + + add_index :upvs_form_templates, [:identifier, :version], unique: true, name: 'index_form_templates_on_identifier_and_version' + end +end \ No newline at end of file diff --git a/db/migrate/20230823200907_create_upvs_form_template_related_documents.rb b/db/migrate/20230823200907_create_upvs_form_template_related_documents.rb new file mode 100644 index 000000000..74a1dc52a --- /dev/null +++ b/db/migrate/20230823200907_create_upvs_form_template_related_documents.rb @@ -0,0 +1,14 @@ +class CreateUpvsFormTemplateRelatedDocuments < ActiveRecord::Migration[7.0] + def change + create_table :upvs_form_template_related_documents do |t| + t.references :upvs_form_template, null: false, foreign_key: true, index: { name: :index_upvs_form_template_related_documents_on_form_template_id } + t.string :data, null: false + t.string :language, null: false + t.string :document_type, null: false + + t.timestamps + end + + add_index :upvs_form_template_related_documents, [:upvs_form_template_id, :language, :document_type], unique: true, name: 'index_related_documents_on_template_id_and_language_and_type' + end +end diff --git a/db/schema.rb b/db/schema.rb index 6d2042ff2..ecee7ea7a 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[7.0].define(version: 2023_08_14_111339) do +ActiveRecord::Schema[7.0].define(version: 2023_08_23_200907) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -346,6 +346,25 @@ t.datetime "updated_at", null: false end + create_table "upvs_form_template_related_documents", force: :cascade do |t| + t.bigint "upvs_form_template_id", null: false + t.string "data", null: false + t.string "language", null: false + t.string "document_type", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["upvs_form_template_id", "language", "document_type"], name: "index_related_documents_on_template_id_and_language_and_type", unique: true + t.index ["upvs_form_template_id"], name: "index_upvs_form_template_related_documents_on_form_template_id" + end + + create_table "upvs_form_templates", force: :cascade do |t| + t.string "identifier", null: false + t.string "version", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["identifier", "version"], name: "index_form_templates_on_identifier_and_version", unique: true + end + create_table "users", force: :cascade do |t| t.bigint "tenant_id" t.string "email", null: false @@ -386,5 +405,6 @@ add_foreign_key "tag_users", "users" add_foreign_key "tags", "tenants" add_foreign_key "tags", "users" + add_foreign_key "upvs_form_template_related_documents", "upvs_form_templates" add_foreign_key "users", "tenants" end diff --git a/db/seeds.rb b/db/seeds.rb index 53daa3433..6e3f94990 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -26,4 +26,1579 @@ rule.conditions.find_or_create_by!(attr: 'sender_uri', type: 'Automation::MetadataValueCondition', value: 'ico://sk/42156424_10037') rule.actions.find_or_create_by!(type: 'Automation::AddTagAction', params: { tag_name: 'NASES' }) rule.actions.find_or_create_by!(type: 'Automation::AddMessageThreadTagAction', params: { tag_name: 'NASES' }) - end +end + +ga_form_template = Upvs::FormTemplate.find_or_create_by!( + identifier: "App.GeneralAgenda", + version: "1.9", +) + +ga_related_documents = [ + { + data: + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n" + + "\r\n", + language: "sk", + document_type: "CLS_F_XSD_EDOC" + }, + { + data: + "Všeobecná agenda Predmet: Text:ÁnoNieÁnoNie18 and string(number(substring($dateTimeString, 1, 4))) != 'NaN' \">18 and string(number(substring($dateTimeString, 1, 4))) != 'NaN' \">", + language: "sk", + document_type: "CLS_F_XSLT_TXT_SGN" + }, + { + data: + "Všeobecná agenda
    Všeobecná agenda
     
     
    ÁnoNieÁnoNie18 and string(number(substring($dateTimeString, 1, 4))) != 'NaN' \">18 and string(number(substring($dateTimeString, 1, 4))) != 'NaN' \">
    ", + language: "sk", + document_type: "CLS_F_XSLT_HTML" + } +] + +ga_related_documents.each do |related_document| + Upvs::FormTemplateRelatedDocument.find_or_create_by!( + upvs_form_template: ga_form_template, + data: related_document[:data], + language: related_document[:language], + document_type: related_document[:document_type] + ) +end + +exe_form_template = Upvs::FormTemplate.find_or_create_by!( + identifier: "00166073.RESS_Exekucne_konanie_Navrh_na_vykonanie_exekucie.sk", + version: "1.24", +) + +exe_related_documents = [ + { + data: "Návrh na vykonanie exekúcieUÃ\u009ADAJE O BANKOVOM Ã\u009AÄ\u008CTEÃ\u009ADAJE O BANKOVOM Ã\u009AÄ\u008CTEExekuÄ\u008Dný titulDruh exekuÄ\u008Dného tituluOrgán, ktorý exekuÄ\u008Dný titul vydalSpisová znaÄ\u008Dka/Ä\u008Díslo konaniaDátum vydaniaDátum vykonateľnostiDoplÅ\u0088ujúce informácieVymáhaný nárokVymáhaný nároknepeÅ\u0088ažný nárokPeÅ\u0088ažný nárokpeÅ\u0088ažný nárokPeÅ\u0088ažný nárokDoplÅ\u0088ujúce informácie o peÅ\u0088ažnom nároku PeÅ\u0088ažný nárok - výživnémissed alimonyBežné výživnéDoplÅ\u0088ujúce informácie o vyživovacej povinnosti Trovy konania v ktorom bol vydaný exekuÄ\u008Dný titul (vrátane trov právneho zastúpenia) Trovy exekúcie- oprávnenýSúdny poplatok (návrh na vykonanie exekúcie)Súdny poplatokPoplatok za konverziuTrovy právneho zastúpeniaTrovy za spísanie návrhu na vykonanie exekúcie u súdneho exekútoraVýška trov za spísanie návrhu na vykonanie exekúcie u súdneho exekútoraIné trovyVýška iných trovTrovy celkom (vrátane DPH)Odôvodnenie trovOslobodenie od súdneho poplatkuOslobodenie od súdneho poplatkuOslobodenie od súdneho poplatku DôvodyVyhlásenia a návrhOprávnený vyhlasuje, že nárok uvedený v Ä\u008Dasti E) povinný ku dÅ\u0088u podania návrhu na vykonanie exekúcie nesplnil dobrovoľne a preto navrhuje, aby súd vydal poverenie pre súdneho exekútora na jeho vymoženiePodrobnostiOprávnený vyhlasuje, že na podklade exekuÄ\u008Dného titulu uvedeného v Ä\u008Dasti D) nie je proti povinnému ohľadne toho istého nároku vedené iné exekuÄ\u008Dné konanie alebo obdobné vykonávacie konanie.PodrobnostiÄ\u008CasÅ¥ nároku z exekuÄ\u008Dného titulu je vymáhaná v inom exekuÄ\u008Dnom konaní.PodrobnostiNávrhom sa uplatÅ\u0088uje nárok zo starej exekúciePodrobnostiOprávnený je oprávnený vyžadovaÅ¥ splnenie vymáhaného nároku zároveÅ\u0088 od iných osôb.PodrobnostiOprávnený je oprávnený vyžadovaÅ¥ splnenie vymáhaného nároku zároveÅ\u0088 od iných osôb.Opíšte skutoÄ\u008Dnosti, z ktorých právne nástupníctvo vyplýva. Listinné dôkazy pripojte ako prílohu.Nárok priznaný exekuÄ\u008Dným titulom vyplýva zo zmenkyOpíšte rozhodujúce skutoÄ\u008Dnosti a oznaÄ\u008Dte dôkazy týkajúce sa vlastného vzÅ¥ahu s povinným. Listinné dôkazy pripojte ako prílohu.Na vymáhanie nároku sú oprávnení aj iní oprávneníOpíšte skutoÄ\u008Dnosti týkajúce sa splnenia podmienky alebo vzájomnej povinnosti a oznaÄ\u008Dte dôkazy. Listinné dôkazy pripojte ako prílohu.Návrhom sa uplatÅ\u0088uje nárok zo spotrebiteľskej zmluvy alebo z iných zmluvných dokumentov súvisiacich so spotrebiteľskou zmluvouPoleVPoleDnaPolePodavajuciDruh adresy (D.1.3.17.1) - CL010139 Druh adresy.", + language: "sk", + document_type: "CLS_F_XSD_EDOC" + }, + { + data: "Exekučné konanie - Návrh na vykonanie exekúcie
    1.24http://schemas.gov.sk/form/00166073.RESS_Exekucne_konanie_Navrh_na_vykonanie_exekucie.sk/1.24
    layoutRow6696_Repeating_Nazov_2_Repeating_
    layoutRowContentlayoutRow6696_Repeating_
    layoutColumn10274_Repeating_
    layoutCell23239_Repeating_
     
    layoutCell23240_Repeating_
     
     
    Názov profilu
    Exekučné konanie - Návrh na vykonanie exekúcie
    Okresnému súdu Banská Bystrica
    layoutRow7096_Repeating_Sekcia_SudnyExekutor_Repeating_
    Spôsob podania návrhu
     
    layoutRowContentlayoutRow7096_Repeating_
    layoutColumn10915_Repeating_
    layoutCell24716_Repeating_
     
    layoutCell24737_Repeating_
     
     
    Návrh sa podáva prostredníctvom súdneho exekútora
    layoutRow7103_Repeating_Sekcia_MenoPriezviskoExekutor_Repeating_
    layoutRowContentlayoutRow7103_Repeating_
    layoutColumn10926_Repeating_
    layoutCell25329_Repeating_
     
    layoutCell24739_Repeating_
     
    layoutCell24741_Repeating_
     
    layoutColumn10927_Repeating_
    layoutCell24743_Repeating_
     
    layoutCell24745_Repeating_
     
     
    Evidenčné číslo
    layoutRow7104_Repeating_Sekcia_MenoExekutor_Repeating_
    layoutRowContentlayoutRow7104_Repeating_
    layoutColumn10928_Repeating_
    layoutCell24740_Repeating_
     
     
    Meno
    layoutRow7105_Repeating_Sekcia_TitulPredExekutor_Repeating_
    layoutRowContentlayoutRow7105_Repeating_
    layoutColumn10929_Repeating_
    layoutCell24742_Repeating_
     
     
    Titul pred
    Titul pred kód
    layoutRow7106_Repeating_Sekcia_PriezviskoExekutor_Repeating_
    layoutRowContentlayoutRow7106_Repeating_
    layoutColumn10930_Repeating_
    layoutCell24744_Repeating_
     
     
    Priezvisko
    layoutRow7107_Repeating_Sekcia_TitulZaExekutor_Repeating_
    layoutRowContentlayoutRow7107_Repeating_
    layoutColumn10931_Repeating_
    layoutCell24746_Repeating_
     
     
    Titul za
    Titul za kód
    layoutRow6897_Repeating_Asekcia_ucastniciKonaniaOpravneny_Repeating_
    A) Účastníci konania a ich zákonní zástupcovia – oprávnení
     
    layoutRowContentlayoutRow6897_Repeating_
    layoutColumn10597_Repeating_
    layoutCell23919_Repeating_
     
     
    layoutRow6898_Repeating_UcastnikKonaniaOpravneny_Repeating_
    Oprávnený č.
     
    layoutRowContentlayoutRow6898_Repeating_
    layoutColumn10598_Repeating_
    layoutCell25343_Repeating_
     
    layoutCell23920_Repeating_
     
    layoutCell23922_Repeating_
     
    layoutCell23959_Repeating_
     
    layoutCell23982_Repeating_
     
    layoutCell24005_Repeating_
     
    layoutCell25346_Repeating_
     
    layoutCell24032_Repeating_
     
     
    layoutRow7252_Repeating_CisloSekcie_Repeating_
    layoutRowContentlayoutRow7252_Repeating_
    layoutColumn11219_Repeating_
    layoutCell25344_Repeating_
     
    layoutColumn11220_Repeating_
    layoutCell25345_Repeating_
     
     
     
    Opravnený č.
    Typ subjektu
    Typ subjektu kód
    layoutRow6899_Repeating_Sekcia_UdajeOsobyUcastnikKonaniaOpravnenyFO_Repeating_
    layoutRowContentlayoutRow6899_Repeating_
    layoutColumn10599_Repeating_
    layoutCell27112_Repeating_
     
    layoutCell32600_Repeating_
     
    layoutCell25331_Repeating_
     
    layoutCell23941_Repeating_
     
    layoutCell23956_Repeating_
     
    layoutCell23923_Repeating_
     
    layoutCell32561_Repeating_
     
    layoutCell32562_Repeating_
     
    layoutCell23935_Repeating_
     
     
    Ak sa jedná o fyzickú osobu – podnikateľa, informácie o osobe je možné načítať na základe IČO z Registra právnických osôb po stlačení tlačidla \"Načítať údaje z RPO\".
    layoutRow9426_Repeating_SekciaSpisovaZnacka_Repeating_
    layoutRowContentlayoutRow9426_Repeating_
    layoutColumn15183_Repeating_
    layoutCell32601_Repeating_
     
     
    Vaša značka
    layoutRow7250_Repeating_SekciaIdentifikatory_Repeating_
    layoutRowContentlayoutRow7250_Repeating_
    layoutColumn11208_Repeating_
    layoutCell23958_Repeating_
     
    layoutColumn11209_Repeating_
    layoutColumn11206_Repeating_
    layoutCell23943_Repeating_
     
    layoutColumn11207_Repeating_
    layoutCell23944_Repeating_
     
     
    IČO
    Dátum narodenia
    Rodné číslo
    layoutRow6904_Repeating_MenoPriezviskoNavrhovatelFO_1_Repeating_
    layoutRowContentlayoutRow6904_Repeating_
    layoutColumn10608_Repeating_
    layoutCell23946_Repeating_
     
    layoutCell23942_Repeating_
     
    layoutCell23948_Repeating_
     
    layoutColumn10609_Repeating_
    layoutCell23951_Repeating_
     
    layoutCell23945_Repeating_
     
    layoutCell23953_Repeating_
     
     
    layoutRow6905_Repeating_Sekcia_MenoUcastnikKonaniaOpravneny_Repeating_
    layoutRowContentlayoutRow6905_Repeating_
    layoutColumn10610_Repeating_
    layoutCell23947_Repeating_
     
     
    Meno
    Rodné priezvisko
    layoutRow6906_Repeating_Sekcia_TitulPredUcastnikKonaniaOpravneny_Repeating_
    layoutRowContentlayoutRow6906_Repeating_
    layoutColumn10611_Repeating_
    layoutCell23949_Repeating_
     
     
    Titul pred
    Titul pred kód
    layoutRow6907_Repeating_Sekcia_PriezviskoUcastnikKonaniaOpravneny_Repeating_
    layoutRowContentlayoutRow6907_Repeating_
    layoutColumn10612_Repeating_
    layoutCell23952_Repeating_
     
     
    Priezvisko
     
    layoutRow6908_Repeating_Sekcia_TitulZaUcastnikKonaniaOpravneny_Repeating_
    layoutRowContentlayoutRow6908_Repeating_
    layoutColumn10613_Repeating_
    layoutCell23954_Repeating_
     
     
    Titul za
    Titul za kód
    layoutRow6909_Repeating_SekciaIcoOm_Repeating_
    layoutRowContentlayoutRow6909_Repeating_
    layoutColumn10614_Repeating_
    layoutCell23957_Repeating_
     
     
    Obchodné meno
    layoutRow6900_Repeating_Sekcia_Adresa1NavrhovatelaFO_1_Repeating_
    Trvalý pobyt / Pobyt / Miesto podnikania
     
    layoutRowContentlayoutRow6900_Repeating_
    layoutColumn10600_Repeating_
    layoutCell23924_Repeating_
     
    layoutCell23925_Repeating_
     
    layoutCell23927_Repeating_
     
    layoutColumn10601_Repeating_
    layoutCell23928_Repeating_
     
    layoutCell24514_Repeating_
     
    layoutCell24514_Repeating_
     
    layoutCell23931_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow6901_Repeating_Sekcia_Supisne1NavrhovatelFO_1_Repeating_
    layoutRowContentlayoutRow6901_Repeating_
    layoutColumn10602_Repeating_
    layoutCell23932_Repeating_
     
    layoutColumn10603_Repeating_
    layoutCell23933_Repeating_
     
    layoutColumn10604_Repeating_
    layoutCell23934_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    Adresa, na ktorú sa má doručovať prednostne
    layoutRow9420_Repeating_Sekcia_Adresa2ZalobcaFO_Repeating_
    Adresa, na ktorú sa má doručovať prednostne
     
    layoutRowContentlayoutRow9420_Repeating_
    layoutColumn15168_Repeating_
    layoutCell32563_Repeating_
     
    layoutCell32564_Repeating_
     
    layoutCell32566_Repeating_
     
    layoutColumn15169_Repeating_
    layoutCell32567_Repeating_
     
    layoutCell32607_Repeating_
     
    layoutCell32607_Repeating_
     
    layoutCell32570_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow9421_Repeating_Sekcia_Supisne2ZalobcaFO_Repeating_
    layoutRowContentlayoutRow9421_Repeating_
    layoutColumn15170_Repeating_
    layoutCell32571_Repeating_
     
    layoutColumn15171_Repeating_
    layoutCell32572_Repeating_
     
    layoutColumn15172_Repeating_
    layoutCell32573_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow6902_Repeating_Sekcie_KontaktneNavrhovatelFO_1_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow6902_Repeating_
    layoutColumn10605_Repeating_
    layoutCell23937_Repeating_
     
    layoutCell32982_Repeating_
     
     
    layoutRow6903_Repeating_Sekcia_TelefonUcastnikKonaniaOpravnenyFO_Repeating_
    layoutRowContentlayoutRow6903_Repeating_
    layoutColumn10606_Repeating_
    layoutCell23938_Repeating_
     
    layoutColumn10607_Repeating_
    layoutCell23940_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9502_Repeating_Sec_EmailSchrankaFO_Repeating_
    layoutRowContentlayoutRow9502_Repeating_
    layoutColumn15342_Repeating_
    layoutCell23936_Repeating_
     
    layoutColumn15343_Repeating_
    layoutCell32984_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow6910_Repeating_Sekcia_UdajeOsobyUcastnikKonaniaOpravnenyPO_Repeating_
    layoutRowContentlayoutRow6910_Repeating_
    layoutColumn10615_Repeating_
    layoutCell27118_Repeating_
     
    layoutCell32602_Repeating_
     
    layoutCell23979_Repeating_
     
    layoutCell23960_Repeating_
     
    layoutCell32380_Repeating_
     
    layoutCell32381_Repeating_
     
    layoutCell23961_Repeating_
     
    layoutCell32574_Repeating_
     
    layoutCell32575_Repeating_
     
    layoutCell23973_Repeating_
     
     
    Informácie o právnickej osobe je možné načítať na základe IČO z Registra právnických osôb pomocou tlačidla \"Načítať údaje z RPO\".
    layoutRow9427_Repeating_SekciaSpisovaZnackaPO_Repeating_
    layoutRowContentlayoutRow9427_Repeating_
    layoutColumn15184_Repeating_
    layoutCell32603_Repeating_
     
     
    Vaša značka
    layoutRow6915_Repeating_SekciaICODICNavrhovatelPO_1_Repeating_
    layoutRowContentlayoutRow6915_Repeating_
    layoutColumn10624_Repeating_
    layoutCell23980_Repeating_
     
    layoutColumn11214_Repeating_
    layoutColumn10625_Repeating_
    layoutCell23981_Repeating_
     
     
    IČO
    Iné identifikačné číslo
    Názov
    Spor sa týka organizačnej zložky právnickej osoby
    layoutRow9381_Repeating_sporPO_Repeating_
    layoutRowContentlayoutRow9381_Repeating_
    layoutColumn15083_Repeating_
    layoutCell32382_Repeating_
     
     
    Údaje o organizačnej zložke vyplňte v časti \"Oprávnený má zákonného zástupcu (správcu)\".
    layoutRow6911_Repeating_Sekcia_Adresa1NavrhovatelaPO_1_Repeating_
    Adresa / sídlo
     
    layoutRowContentlayoutRow6911_Repeating_
    layoutColumn10616_Repeating_
    layoutCell23962_Repeating_
     
    layoutCell23963_Repeating_
     
    layoutCell23965_Repeating_
     
    layoutColumn10617_Repeating_
    layoutCell23966_Repeating_
     
    layoutCell24516_Repeating_
     
    layoutCell24516_Repeating_
     
    layoutCell23969_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow6912_Repeating_Sekcia_Supisne1NavrhovatelPO_1_Repeating_
    layoutRowContentlayoutRow6912_Repeating_
    layoutColumn10618_Repeating_
    layoutCell23970_Repeating_
     
    layoutColumn10619_Repeating_
    layoutCell23971_Repeating_
     
    layoutColumn10620_Repeating_
    layoutCell23972_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    Adresa, na ktorú sa má doručovať prednostne
    layoutRow9422_Repeating_Sekcia_Adresa2ZalobcaPO_Repeating_
    Adresa, na ktorú sa má doručovať prednostne
     
    layoutRowContentlayoutRow9422_Repeating_
    layoutColumn15173_Repeating_
    layoutCell32576_Repeating_
     
    layoutCell32577_Repeating_
     
    layoutCell32579_Repeating_
     
    layoutColumn15174_Repeating_
    layoutCell32580_Repeating_
     
    layoutCell32610_Repeating_
     
    layoutCell32610_Repeating_
     
    layoutCell32583_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow9423_Repeating_Sekcia_Supisne2ZalobcaPO_Repeating_
    layoutRowContentlayoutRow9423_Repeating_
    layoutColumn15175_Repeating_
    layoutCell32584_Repeating_
     
    layoutColumn15176_Repeating_
    layoutCell32585_Repeating_
     
    layoutColumn15177_Repeating_
    layoutCell32586_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow6913_Repeating_Sekcie_KontaktneNavrhovatelPO_1_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow6913_Repeating_
    layoutColumn10621_Repeating_
    layoutCell23975_Repeating_
     
    layoutCell32985_Repeating_
     
     
    layoutRow6914_Repeating_Sekcia_TelefonUcastnikKonaniaOpravnenyPO_Repeating_
    layoutRowContentlayoutRow6914_Repeating_
    layoutColumn10622_Repeating_
    layoutCell23976_Repeating_
     
    layoutColumn10623_Repeating_
    layoutCell23978_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9503_Repeating_Sec_EmailSchrankaPO_Repeating_
    layoutRowContentlayoutRow9503_Repeating_
    layoutColumn15344_Repeating_
    layoutCell23974_Repeating_
     
    layoutColumn15345_Repeating_
    layoutCell32987_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow6916_Repeating_Sekcia_UdajeOsobyStatUcastnikKonaniaOpravneny_Repeating_
    layoutRowContentlayoutRow6916_Repeating_
    layoutColumn10626_Repeating_
    layoutCell32604_Repeating_
     
    layoutCell23983_Repeating_
     
    layoutCell23987_Repeating_
     
    layoutCell32587_Repeating_
     
    layoutCell32588_Repeating_
     
    layoutCell23999_Repeating_
     
     
    layoutRow9428_Repeating_SekciaSpisovaZnackaStat_Repeating_
    layoutRowContentlayoutRow9428_Repeating_
    layoutColumn15185_Repeating_
    layoutCell32605_Repeating_
     
     
    Vaša značka
    layoutRow6917_Repeating_Sekcia_NazovNavrhovatelaStatUcastnikKonaniaOpravneny_Repeating_
    layoutRowContentlayoutRow6917_Repeating_
    layoutColumn10627_Repeating_
    layoutCell23984_Repeating_
     
    layoutCell23985_Repeating_
     
    layoutCell23986_Repeating_
     
     
    Názov
    Označenie štátneho orgánu, alebo právnickej osoby, ktorý za štát koná
    IČO
    layoutRow6918_Repeating_Sekcia_Adresa1NavrhovatelaStat_1_Repeating_
    Adresa / sídlo
     
    layoutRowContentlayoutRow6918_Repeating_
    layoutColumn10628_Repeating_
    layoutCell23988_Repeating_
     
    layoutCell23989_Repeating_
     
    layoutCell23991_Repeating_
     
    layoutColumn10629_Repeating_
    layoutCell23992_Repeating_
     
    layoutCell24518_Repeating_
     
    layoutCell24518_Repeating_
     
    layoutCell23995_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow6919_Repeating_Sekcia_Supisne1NavrhovatelStat_1_Repeating_
    layoutRowContentlayoutRow6919_Repeating_
    layoutColumn10630_Repeating_
    layoutCell23996_Repeating_
     
    layoutColumn10631_Repeating_
    layoutCell23997_Repeating_
     
    layoutColumn10632_Repeating_
    layoutCell23998_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    Adresa, na ktorú sa má doručovať prednostne
    layoutRow9424_Repeating_Sekcia_Adresa2ZalobcaStat_Repeating_
    Adresa, na ktorú sa má doručovať prednostne
     
    layoutRowContentlayoutRow9424_Repeating_
    layoutColumn15178_Repeating_
    layoutCell32589_Repeating_
     
    layoutCell32590_Repeating_
     
    layoutCell32592_Repeating_
     
    layoutColumn15179_Repeating_
    layoutCell32593_Repeating_
     
    layoutCell32613_Repeating_
     
    layoutCell32613_Repeating_
     
    layoutCell32596_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow9425_Repeating_Sekcia_Supisne2ZalobcaStat_Repeating_
    layoutRowContentlayoutRow9425_Repeating_
    layoutColumn15180_Repeating_
    layoutCell32597_Repeating_
     
    layoutColumn15181_Repeating_
    layoutCell32598_Repeating_
     
    layoutColumn15182_Repeating_
    layoutCell32599_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow6920_Repeating_Sekcie_KontaktneNavrhovatelStat_1_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow6920_Repeating_
    layoutColumn10633_Repeating_
    layoutCell24001_Repeating_
     
    layoutCell32988_Repeating_
     
     
    layoutRow6921_Repeating_Sekcia_TelefonNavrhovatelStatUcastnikKonaniaOpravneny_Repeating_
    layoutRowContentlayoutRow6921_Repeating_
    layoutColumn10634_Repeating_
    layoutCell24002_Repeating_
     
    layoutColumn10635_Repeating_
    layoutCell24004_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9504_Repeating_Sec_EmailSchrankaST_Repeating_
    layoutRowContentlayoutRow9504_Repeating_
    layoutColumn15346_Repeating_
    layoutCell24000_Repeating_
     
    layoutColumn15347_Repeating_
    layoutCell32990_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow6922_Repeating_FudajeObankovomUcteUcastnikKonaniaOpravneny_Repeating_
    Údaje pre poukázanie vymoženého nároku
     
    layoutRowContentlayoutRow6922_Repeating_
    layoutColumn10636_Repeating_
    layoutCell24006_Repeating_
     
     
    layoutRow6923_Repeating_UdajeZalovanaSuma_2_Repeating_
    layoutRowContentlayoutRow6923_Repeating_
    layoutColumn10637_Repeating_
    layoutCell24007_Repeating_
     
    layoutCell24013_Repeating_
     
     
    layoutRow6924_Repeating_hlavickaZalovanaSuma_Repeating_
    layoutRowContentlayoutRow6924_Repeating_
    layoutColumn10638_Repeating_
    layoutCell24008_Repeating_
     
    layoutColumn10639_Repeating_
    layoutCell24009_Repeating_
     
    layoutColumn10640_Repeating_
    layoutCell24010_Repeating_
     
    layoutColumn10641_Repeating_
    layoutCell24011_Repeating_
     
    layoutColumn10642_Repeating_
    layoutCell24012_Repeating_
     
     
     
    IBAN
    BIC
    Variabilný symbol
    Špecifický symbol
    layoutRow6925_Repeating_udajeZalovanaSuma_Repeating_
    layoutRowContentlayoutRow6925_Repeating_
    layoutColumn10643_Repeating_
    layoutCell24014_Repeating_
     
    layoutColumn10644_Repeating_
    layoutCell24015_Repeating_
     
    layoutColumn10645_Repeating_
    layoutCell24016_Repeating_
     
    layoutColumn10646_Repeating_
    layoutCell24017_Repeating_
     
    layoutColumn10647_Repeating_
    layoutCell24018_Repeating_
     
     
    Údaje o bankovom účte oprávneného
    Údaje pre zaplatenie žalovanej sumy - IBAN
    Údaje pre zaplatenie žalovanej sumy - BIC
    Údaje pre zaplatenie žalovanej sumy - Variabilný symbol
    Údaje pre zaplatenie žalovanej sumy - Špecifický symbol
    Oprávnený má zákonného zástupcu (správcu)
    layoutRow6929_Repeating_Sekcia_ZakZas_Repeating_
    Zákonní zástupcovia
     
    layoutRowContentlayoutRow6929_Repeating_
    layoutColumn10659_Repeating_
    layoutCell24034_Repeating_
     
    layoutCell32386_Repeating_
     
    layoutCell24036_Repeating_
     
     
    Typ subjektu
    Typ subjektu kód
    Typ zákonného zástupcu (správcu)
    layoutRow6930_Repeating_Sekcia_ZastupcaUcastnikKonaniaOpravneny_2_Repeating_
    layoutRowContentlayoutRow6930_Repeating_
    layoutColumn10660_Repeating_
    layoutCell24037_Repeating_
     
    layoutCell24071_Repeating_
     
     
    layoutRow6931_Repeating_Sekcia_UdajeZastupcaFO_2_Repeating_
    layoutRowContentlayoutRow6931_Repeating_
    layoutColumn10661_Repeating_
    layoutCell24056_Repeating_
     
    layoutCell24044_Repeating_
     
    layoutCell24041_Repeating_
     
     
    layoutRow6936_Repeating_Sekcia_MenoPriezvisko2_2_Repeating_
    layoutRowContentlayoutRow6936_Repeating_
    layoutColumn10670_Repeating_
    layoutCell24058_Repeating_
     
    layoutCell24061_Repeating_
     
    layoutCell24057_Repeating_
     
    layoutCell24063_Repeating_
     
    layoutColumn10671_Repeating_
    layoutCell24059_Repeating_
     
    layoutCell24066_Repeating_
     
    layoutCell24060_Repeating_
     
    layoutCell24068_Repeating_
     
     
    Dátum narodenia
    layoutRow6937_Repeating_Sekcia_MenoZastupcaUcastnikKonaniaOpravnenyFO_2_Repeating_
    layoutRowContentlayoutRow6937_Repeating_
    layoutColumn10672_Repeating_
    layoutCell24062_Repeating_
     
     
    Meno
    Rodné priezvisko
    layoutRow6938_Repeating_Sekcia_TitulPredZastupcaUcastnikKonaniaOpravnenyFO_2_Repeating_
    layoutRowContentlayoutRow6938_Repeating_
    layoutColumn10673_Repeating_
    layoutCell24064_Repeating_
     
     
    Titul pred
    Titul pred kód
    Rodné číslo
    layoutRow6939_Repeating_Sekcia_PriezviskoZastupcaUcastnikKonaniaOpravnenyFO_2_Repeating_
    layoutRowContentlayoutRow6939_Repeating_
    layoutColumn10674_Repeating_
    layoutCell24067_Repeating_
     
     
    Priezvisko
     
    layoutRow6940_Repeating_Sekcia_TitulZaZastupcaUcastnikKonaniaOpravnenyFO_2_Repeating_
    layoutRowContentlayoutRow6940_Repeating_
    layoutColumn10675_Repeating_
    layoutCell24069_Repeating_
     
     
    Titul za
    Titul za kód
    layoutRow6934_Repeating_Sekcia_AdresaZastupcaFO_2_Repeating_
    Trvalý pobyt / Pobyt
     
    layoutRowContentlayoutRow6934_Repeating_
    layoutColumn10665_Repeating_
    layoutCell24045_Repeating_
     
    layoutCell24046_Repeating_
     
    layoutCell24048_Repeating_
     
    layoutColumn10666_Repeating_
    layoutCell24049_Repeating_
     
    layoutCell24524_Repeating_
     
    layoutCell24524_Repeating_
     
    layoutCell24052_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow6935_Repeating_Sekcia_SupisneZastupcaFO_2_Repeating_
    layoutRowContentlayoutRow6935_Repeating_
    layoutColumn10667_Repeating_
    layoutCell24053_Repeating_
     
    layoutColumn10668_Repeating_
    layoutCell24054_Repeating_
     
    layoutColumn10669_Repeating_
    layoutCell24055_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow6933_Repeating_Sekcie_KontaktneZastupcaFO_2_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow6933_Repeating_
    layoutColumn10664_Repeating_
    layoutCell24042_Repeating_
     
    layoutCell32991_Repeating_
     
     
    layoutRow6932_Repeating_Sekcia_TelefonZastupcaUcastnikKonaniaOpravnenyFO_2_Repeating_
    layoutRowContentlayoutRow6932_Repeating_
    layoutColumn10662_Repeating_
    layoutCell24038_Repeating_
     
    layoutColumn10663_Repeating_
    layoutCell24040_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9505_Repeating_Sec_EmailSchrankaFO_1_Repeating_
    layoutRowContentlayoutRow9505_Repeating_
    layoutColumn15348_Repeating_
    layoutCell24043_Repeating_
     
    layoutColumn15349_Repeating_
    layoutCell32993_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow6941_Repeating_Sekcia_UdajeZastupcaPO_2_Repeating_
    layoutRowContentlayoutRow6941_Repeating_
    layoutColumn10676_Repeating_
    layoutCell27117_Repeating_
     
    layoutCell24091_Repeating_
     
    layoutCell24072_Repeating_
     
    layoutCell24073_Repeating_
     
    layoutCell24088_Repeating_
     
     
    Informácie o právnickej osobe je možné načítať na základe IČO z Registra právnických osôb pomocou tlačidla \"Načítať údaje z RPO\".
    layoutRow6946_Repeating_SekciaICODICZastupcaZalobcu_2_Repeating_
    layoutRowContentlayoutRow6946_Repeating_
    layoutColumn10685_Repeating_
    layoutCell24092_Repeating_
     
    layoutColumn11215_Repeating_
    layoutColumn10686_Repeating_
    layoutCell24093_Repeating_
     
     
    IČO
    Iné identifikačné číslo
    Názov
    layoutRow6942_Repeating_Sekcia_AdresaZastupcaPO_2_Repeating_
    Adresa / sídlo zástupcu
     
    layoutRowContentlayoutRow6942_Repeating_
    layoutColumn10677_Repeating_
    layoutCell24074_Repeating_
     
    layoutCell24075_Repeating_
     
    layoutCell24077_Repeating_
     
    layoutColumn10678_Repeating_
    layoutCell24078_Repeating_
     
    layoutCell24526_Repeating_
     
    layoutCell24526_Repeating_
     
    layoutCell24081_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow6943_Repeating_Sekcia_SupisneZastupcaPO_2_Repeating_
    layoutRowContentlayoutRow6943_Repeating_
    layoutColumn10679_Repeating_
    layoutCell24082_Repeating_
     
    layoutColumn10680_Repeating_
    layoutCell24083_Repeating_
     
    layoutColumn10681_Repeating_
    layoutCell24084_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow6945_Repeating_Sekcie_KontaktneZastupcaPO_2_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow6945_Repeating_
    layoutColumn10684_Repeating_
    layoutCell24089_Repeating_
     
    layoutCell32994_Repeating_
     
     
    layoutRow6944_Repeating_Sekcia_TelefonZastupcaUcastnikKonaniaOpravnenyPO_2_Repeating_
    layoutRowContentlayoutRow6944_Repeating_
    layoutColumn10682_Repeating_
    layoutCell24085_Repeating_
     
    layoutColumn10683_Repeating_
    layoutCell24087_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9506_Repeating_Sec_EmailSchrankaPO_1_Repeating_
    layoutRowContentlayoutRow9506_Repeating_
    layoutColumn15350_Repeating_
    layoutCell24090_Repeating_
     
    layoutColumn15351_Repeating_
    layoutCell32996_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow7253_Repeating_SekciaBmaNema_Repeating_
    layoutRowContentlayoutRow7253_Repeating_
    layoutColumn11221_Repeating_
    layoutCell25348_Repeating_
     
     
    Oprávnený má právneho zástupcu
    layoutRow7021_Repeating_Sekcia_MaZastupcu_1_Repeating_
    B) Právny zástupca (spoločný zástupca)
     
    layoutRowContentlayoutRow7021_Repeating_
    layoutColumn10813_Repeating_
    layoutCell24443_Repeating_
     
    layoutCell26962_Repeating_
     
    layoutCell24367_Repeating_
     
    layoutCell24371_Repeating_
     
     
    layoutRow7045_Repeating_SekciaZastupcaZalobcuFoPo_1_Repeating_
    layoutRowContentlayoutRow7045_Repeating_
    layoutColumn10855_Repeating_
    layoutCell24444_Repeating_
     
    layoutColumn10856_Repeating_
    layoutCell24446_Repeating_
     
     
    Typ subjektu
    Typ subjektu kód
    layoutRow7949_Repeating_spolocnyZastupcaPomSekcia_Repeating_
    layoutRowContentlayoutRow7949_Repeating_
    layoutColumn12092_Repeating_
    layoutCell24366_Repeating_
     
     
    Spoločný zástupca
    layoutRow7022_Repeating_advokatZalobcaPom_1_Repeating_
    layoutRowContentlayoutRow7022_Repeating_
    layoutColumn10814_Repeating_
    layoutCell24368_Repeating_
     
    layoutCell24369_Repeating_
     
     
    Advokát
    layoutRow7023_Repeating_advokatZalobcaEvidencneCisloPom_1_Repeating_
    layoutRowContentlayoutRow7023_Repeating_
    layoutColumn10815_Repeating_
    layoutCell24370_Repeating_
     
     
    Registračné číslo advokáta
    layoutRow7024_Repeating_Sekcia_ZastupcaZalobca_1_Repeating_
    layoutRowContentlayoutRow7024_Repeating_
    layoutColumn10816_Repeating_
    layoutCell24372_Repeating_
     
    layoutCell24406_Repeating_
     
    layoutCell32873_Repeating_
     
     
    layoutRow7025_Repeating_Sekcia_UdajeZastupcaFO_1_Repeating_
    layoutRowContentlayoutRow7025_Repeating_
    layoutColumn10817_Repeating_
    layoutCell32388_Repeating_
     
    layoutCell24391_Repeating_
     
    layoutCell24379_Repeating_
     
    layoutCell24373_Repeating_
     
     
    layoutRow9383_Repeating_sekBIdenti_Repeating_
    layoutRowContentlayoutRow9383_Repeating_
    layoutColumn15087_Repeating_
    layoutCell24393_Repeating_
     
    layoutColumn15088_Repeating_
    layoutCell24394_Repeating_
     
    layoutColumn15085_Repeating_
    layoutCell32390_Repeating_
     
    layoutColumn15086_Repeating_
     
    Dátum narodenia
    Rodné číslo
    IČO
    layoutRow7030_Repeating_Sekcia_MenoPriezvisko2_1_Repeating_
    layoutRowContentlayoutRow7030_Repeating_
    layoutColumn10826_Repeating_
    layoutCell24396_Repeating_
     
    layoutCell26964_Repeating_
     
    layoutCell24398_Repeating_
     
    layoutColumn10827_Repeating_
    layoutCell24401_Repeating_
     
    layoutCell24395_Repeating_
     
    layoutCell24403_Repeating_
     
     
    layoutRow7031_Repeating_Sekcia_MenoZastupcaZalobcaFO_1_Repeating_
    layoutRowContentlayoutRow7031_Repeating_
    layoutColumn10828_Repeating_
    layoutCell24397_Repeating_
     
     
    Meno
    layoutRow7950_Repeating_rodnePriezviskoPomSekcia_Repeating_
    layoutRowContentlayoutRow7950_Repeating_
    layoutColumn12093_Repeating_
    layoutCell24392_Repeating_
     
     
    Rodné priezvisko
    layoutRow7032_Repeating_Sekcia_TitulPredZastupcaZalobcaFO_1_Repeating_
    layoutRowContentlayoutRow7032_Repeating_
    layoutColumn10829_Repeating_
    layoutCell24399_Repeating_
     
     
    Titul pred
    Titul pred kód
    layoutRow7033_Repeating_Sekcia_PriezviskoZastupcaZalobcaFO_1_Repeating_
    layoutRowContentlayoutRow7033_Repeating_
    layoutColumn10830_Repeating_
    layoutCell24402_Repeating_
     
     
    Priezvisko
     
    layoutRow7034_Repeating_Sekcia_TitulZaZastupcaZalobcaFO_1_Repeating_
    layoutRowContentlayoutRow7034_Repeating_
    layoutColumn10831_Repeating_
    layoutCell24404_Repeating_
     
     
    Titul za
    Titul za kód
    layoutRow7028_Repeating_Sekcia_AdresaZastupcaFO_1_Repeating_
    Sídlo zástupcu
     
    layoutRowContentlayoutRow7028_Repeating_
    layoutColumn10821_Repeating_
    layoutCell24380_Repeating_
     
    layoutCell24381_Repeating_
     
    layoutCell24383_Repeating_
     
    layoutColumn10822_Repeating_
    layoutCell24384_Repeating_
     
    layoutCell24520_Repeating_
     
    layoutCell24520_Repeating_
     
    layoutCell24387_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow7029_Repeating_Sekcia_SupisneZastupcaFO_1_Repeating_
    layoutRowContentlayoutRow7029_Repeating_
    layoutColumn10823_Repeating_
    layoutCell24388_Repeating_
     
    layoutColumn10824_Repeating_
    layoutCell24389_Repeating_
     
    layoutColumn10825_Repeating_
    layoutCell24390_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow7026_Repeating_Sekcie_KontaktneZastupcaFO_1_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow7026_Repeating_
    layoutColumn10818_Repeating_
    layoutCell24375_Repeating_
     
    layoutCell32997_Repeating_
     
     
    layoutRow7027_Repeating_Sekcia_TelefonZastupcaZalobcaFO_1_Repeating_
    layoutRowContentlayoutRow7027_Repeating_
    layoutColumn10819_Repeating_
    layoutCell24376_Repeating_
     
    layoutColumn10820_Repeating_
    layoutCell24378_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9507_Repeating_Sec_EmailSchrankaFO_B_Repeating_
    layoutRowContentlayoutRow9507_Repeating_
    layoutColumn15352_Repeating_
    layoutCell24374_Repeating_
     
    layoutColumn15353_Repeating_
    layoutCell32999_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow7035_Repeating_Sekcia_UdajeZastupcaPO_1_Repeating_
    layoutRowContentlayoutRow7035_Repeating_
    layoutColumn10832_Repeating_
    layoutCell27116_Repeating_
     
    layoutCell24426_Repeating_
     
    layoutCell24407_Repeating_
     
    layoutCell24408_Repeating_
     
    layoutCell24420_Repeating_
     
     
    Informácie o právnickej osobe je možné načítať na základe IČO z Registra právnických osôb pomocou tlačidla \"Načítať údaje z RPO\".
    layoutRow7040_Repeating_SekciaICODICZastupcaZalobcu_1_Repeating_
    layoutRowContentlayoutRow7040_Repeating_
    layoutColumn10841_Repeating_
    layoutCell24427_Repeating_
     
    layoutColumn11216_Repeating_
    layoutColumn10842_Repeating_
    layoutCell24428_Repeating_
     
     
    IČO
    Iné identifikačné číslo
    Názov
    layoutRow7036_Repeating_Sekcia_AdresaZastupcaPO_1_Repeating_
    Adresa / sídlo zástupcu
     
    layoutRowContentlayoutRow7036_Repeating_
    layoutColumn10833_Repeating_
    layoutCell24409_Repeating_
     
    layoutCell24410_Repeating_
     
    layoutCell24412_Repeating_
     
    layoutColumn10834_Repeating_
    layoutCell24413_Repeating_
     
    layoutCell24522_Repeating_
     
    layoutCell24522_Repeating_
     
    layoutCell24416_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow7037_Repeating_Sekcia_SupisneZastupcaPO_1_Repeating_
    layoutRowContentlayoutRow7037_Repeating_
    layoutColumn10835_Repeating_
    layoutCell24417_Repeating_
     
    layoutColumn10836_Repeating_
    layoutCell24418_Repeating_
     
    layoutColumn10837_Repeating_
    layoutCell24419_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow7038_Repeating_Sekcie_KontaktneZastupcaPO_1_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow7038_Repeating_
    layoutColumn10838_Repeating_
    layoutCell24422_Repeating_
     
    layoutCell33000_Repeating_
     
     
    layoutRow7039_Repeating_Sekcia_TelefonZastupcaZalobcaPO_1_Repeating_
    layoutRowContentlayoutRow7039_Repeating_
    layoutColumn10839_Repeating_
    layoutCell24423_Repeating_
     
    layoutColumn10840_Repeating_
    layoutCell24425_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9508_Repeating_Sec_EmailSchrankaPO_B_Repeating_
    layoutRowContentlayoutRow9508_Repeating_
    layoutColumn15354_Repeating_
    layoutCell24421_Repeating_
     
    layoutColumn15355_Repeating_
    layoutCell33002_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow9468_Repeating_B_FudajeObankovomUcteUcastnikKonaniaOpravneny_Repeating_
    Údaje o bankovom účte právneho zástupcu (spoločného zástupcu)
     
    layoutRowContentlayoutRow9468_Repeating_
    layoutColumn15265_Repeating_
    layoutCell32874_Repeating_
     
     
    layoutRow9469_Repeating_B_UdajeZalovanaSuma_Repeating_
    layoutRowContentlayoutRow9469_Repeating_
    layoutColumn15266_Repeating_
    layoutCell32875_Repeating_
     
    layoutCell32881_Repeating_
     
     
    layoutRow9470_Repeating_hlavickaZalovanaSuma_1_Repeating_
    layoutRowContentlayoutRow9470_Repeating_
    layoutColumn15267_Repeating_
    layoutCell32876_Repeating_
     
    layoutColumn15268_Repeating_
    layoutCell32877_Repeating_
     
    layoutColumn15269_Repeating_
    layoutCell32878_Repeating_
     
    layoutColumn15270_Repeating_
    layoutCell32879_Repeating_
     
    layoutColumn15271_Repeating_
    layoutCell32880_Repeating_
     
     
     
    IBAN
    BIC
    Variabilný symbol
    Špecifický symbol
    layoutRow9471_Repeating_udajeZalovanaSuma_1_Repeating_
    layoutRowContentlayoutRow9471_Repeating_
    layoutColumn15272_Repeating_
    layoutCell32882_Repeating_
     
    layoutColumn15273_Repeating_
    layoutCell32883_Repeating_
     
    layoutColumn15274_Repeating_
    layoutCell32884_Repeating_
     
    layoutColumn15275_Repeating_
    layoutCell32885_Repeating_
     
    layoutColumn15276_Repeating_
    layoutCell32886_Repeating_
     
     
    Údaje o bankovom účte
    Údaje pre zaplatenie žalovanej sumy - IBAN
    Údaje pre zaplatenie žalovanej sumy - BIC
    Údaje pre zaplatenie žalovanej sumy - Variabilný symbol
    Údaje pre zaplatenie žalovanej sumy - Špecifický symbol
    layoutRow6972_Repeating_Csekcia_ucastniciKonaniaPovinny_Repeating_
    C) Účastníci konania a ich zákonní zástupcovia – povinní
     
    layoutRowContentlayoutRow6972_Repeating_
    layoutColumn10731_Repeating_
    layoutCell24178_Repeating_
     
     
    layoutRow6973_Repeating_Zalovany_Repeating_
    Povinný č.
     
    layoutRowContentlayoutRow6973_Repeating_
    layoutColumn10732_Repeating_
    layoutCell25349_Repeating_
     
    layoutCell24179_Repeating_
     
    layoutCell24181_Repeating_
     
    layoutCell24231_Repeating_
     
    layoutCell24267_Repeating_
     
    layoutCell25352_Repeating_
     
    layoutCell24303_Repeating_
     
     
    layoutRow7254_Repeating_CisloSekcie_1_Repeating_
    layoutRowContentlayoutRow7254_Repeating_
    layoutColumn11222_Repeating_
    layoutCell25350_Repeating_
     
    layoutColumn11223_Repeating_
    layoutCell25351_Repeating_
     
     
     
    Povinný č.
    Typ subjektu
    Typ subjektu kód
    layoutRow6974_Repeating_Sekcia_UdajeOsobyFO_Repeating_
    layoutRowContentlayoutRow6974_Repeating_
    layoutColumn10733_Repeating_
    layoutCell27113_Repeating_
     
    layoutCell25336_Repeating_
     
    layoutCell24213_Repeating_
     
    layoutCell24228_Repeating_
     
    layoutCell24183_Repeating_
     
    layoutCell24182_Repeating_
     
    layoutCell24201_Repeating_
     
    layoutCell24195_Repeating_
     
     
    Ak sa jedná o fyzickú osobu – podnikateľa, informácie o osobe je možné načítať na základe IČO z Registra právnických osôb po stlačení tlačidla \"Načítať údaje z RPO\".
    layoutRow7251_Repeating_SekciaIdentifikatoryC_Repeating_
    layoutRowContentlayoutRow7251_Repeating_
    layoutColumn11210_Repeating_
    layoutCell24230_Repeating_
     
    layoutColumn11211_Repeating_
    layoutColumn11212_Repeating_
    layoutCell24215_Repeating_
     
    layoutColumn11213_Repeating_
    layoutCell24216_Repeating_
     
     
    IČO
    Dátum narodenia
    Rodné číslo
    layoutRow6981_Repeating_MenoPriezviskoNavrhovatelFO_Repeating_
    layoutRowContentlayoutRow6981_Repeating_
    layoutColumn10747_Repeating_
    layoutCell24218_Repeating_
     
    layoutCell24214_Repeating_
     
    layoutCell24220_Repeating_
     
    layoutColumn10748_Repeating_
    layoutCell24223_Repeating_
     
    layoutCell24217_Repeating_
     
    layoutCell24225_Repeating_
     
     
    layoutRow6982_Repeating_Sekcia_MenoNavrhovatela_Repeating_
    layoutRowContentlayoutRow6982_Repeating_
    layoutColumn10749_Repeating_
    layoutCell24219_Repeating_
     
     
    Meno
    Rodné priezvisko
    layoutRow6983_Repeating_Sekcia_TitulPred_Repeating_
    layoutRowContentlayoutRow6983_Repeating_
    layoutColumn10750_Repeating_
    layoutCell24221_Repeating_
     
     
    Titul pred
    Titul pred kód
    layoutRow6984_Repeating_Sekcia_PriezviskoNavrhovatela_Repeating_
    layoutRowContentlayoutRow6984_Repeating_
    layoutColumn10751_Repeating_
    layoutCell24224_Repeating_
     
     
    Priezvisko
     
    layoutRow6985_Repeating_Sekcia_TitulZa_Repeating_
    layoutRowContentlayoutRow6985_Repeating_
    layoutColumn10752_Repeating_
    layoutCell24226_Repeating_
     
     
    Titul za
    Titul za kód
    layoutRow6986_Repeating_Sekcia_IcoOm_Repeating_
    layoutRowContentlayoutRow6986_Repeating_
    layoutColumn10753_Repeating_
    layoutCell24229_Repeating_
     
     
    Obchodné meno
    layoutRow6975_Repeating_Sekcia_Adresa1NavrhovatelaFO_Repeating_
    Trvalý pobyt / Pobyt / Miesto podnikania
     
    layoutRowContentlayoutRow6975_Repeating_
    layoutColumn10734_Repeating_
    layoutCell24184_Repeating_
     
    layoutCell24185_Repeating_
     
    layoutCell24187_Repeating_
     
    layoutColumn10735_Repeating_
    layoutCell24188_Repeating_
     
    layoutCell24528_Repeating_
     
    layoutCell24528_Repeating_
     
    layoutCell24191_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow6976_Repeating_Sekcia_Supisne1NavrhovatelFO_Repeating_
    layoutRowContentlayoutRow6976_Repeating_
    layoutColumn10736_Repeating_
    layoutCell24192_Repeating_
     
    layoutColumn10737_Repeating_
    layoutCell24193_Repeating_
     
    layoutColumn10738_Repeating_
    layoutCell24194_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    Adresa, na ktorú sa má doručovať prednostne
    layoutRow6979_Repeating_Sekcia_Adresa2NavrhovatelaFO_Repeating_
    Adresa, na ktorú sa má doručovať prednostne
     
    layoutRowContentlayoutRow6979_Repeating_
    layoutColumn10742_Repeating_
    layoutCell24202_Repeating_
     
    layoutCell24203_Repeating_
     
    layoutCell24205_Repeating_
     
    layoutColumn10743_Repeating_
    layoutCell24206_Repeating_
     
    layoutCell24530_Repeating_
     
    layoutCell24530_Repeating_
     
    layoutCell24209_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow6980_Repeating_Sekcia_Supisne2NavrhovatelFO_Repeating_
    layoutRowContentlayoutRow6980_Repeating_
    layoutColumn10744_Repeating_
    layoutCell24210_Repeating_
     
    layoutColumn10745_Repeating_
    layoutCell24211_Repeating_
     
    layoutColumn10746_Repeating_
    layoutCell24212_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow6977_Repeating_Sekcie_KontaktneNavrhovatelFO_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow6977_Repeating_
    layoutColumn10739_Repeating_
    layoutCell24197_Repeating_
     
    layoutCell33003_Repeating_
     
     
    layoutRow6978_Repeating_Sekcia_TelefonNavrhovatelFO_Repeating_
    layoutRowContentlayoutRow6978_Repeating_
    layoutColumn10740_Repeating_
    layoutCell24198_Repeating_
     
    layoutColumn10741_Repeating_
    layoutCell24200_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9509_Repeating_Sec_EmailSchrankaFO_C_Repeating_
    layoutRowContentlayoutRow9509_Repeating_
    layoutColumn15356_Repeating_
    layoutCell24196_Repeating_
     
    layoutColumn15357_Repeating_
    layoutCell33005_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow6987_Repeating_Sekcia_UdajeOsobyPO_Repeating_
    layoutRowContentlayoutRow6987_Repeating_
    layoutColumn10754_Repeating_
    layoutCell27114_Repeating_
     
    layoutCell24264_Repeating_
     
    layoutCell24232_Repeating_
     
    layoutCell32383_Repeating_
     
    layoutCell32384_Repeating_
     
    layoutCell24234_Repeating_
     
    layoutCell24233_Repeating_
     
    layoutCell24246_Repeating_
     
    layoutCell24258_Repeating_
     
     
    Informácie o právnickej osobe je možné načítať na základe IČO z Registra právnických osôb pomocou tlačidla \"Načítať údaje z RPO\".
    layoutRow6994_Repeating_SekciaICODICNavrhovatelPO_Repeating_
    layoutRowContentlayoutRow6994_Repeating_
    layoutColumn10768_Repeating_
    layoutCell24265_Repeating_
     
    layoutColumn11217_Repeating_
    layoutColumn10769_Repeating_
    layoutCell24266_Repeating_
     
     
    IČO
    Iné identifikačné číslo
    Názov
    Spor sa týka organizačnej zložky právnickej osoby
    layoutRow9382_Repeating_sporPO_1_Repeating_
    layoutRowContentlayoutRow9382_Repeating_
    layoutColumn15084_Repeating_
    layoutCell32385_Repeating_
     
     
    Údaje o organizačnej zložke vyplňte v časti \"Povinný má zákonného zástupcu (správcu)\".
    layoutRow6988_Repeating_Sekcia_Adresa1NavrhovatelaPO_Repeating_
    Adresa / sídlo
     
    layoutRowContentlayoutRow6988_Repeating_
    layoutColumn10755_Repeating_
    layoutCell24235_Repeating_
     
    layoutCell24236_Repeating_
     
    layoutCell24238_Repeating_
     
    layoutColumn10756_Repeating_
    layoutCell24239_Repeating_
     
    layoutCell24532_Repeating_
     
    layoutCell24532_Repeating_
     
    layoutCell24242_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow6989_Repeating_Sekcia_Supisne1NavrhovatelPO_Repeating_
    layoutRowContentlayoutRow6989_Repeating_
    layoutColumn10757_Repeating_
    layoutCell24243_Repeating_
     
    layoutColumn10758_Repeating_
    layoutCell24244_Repeating_
     
    layoutColumn10759_Repeating_
    layoutCell24245_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    Adresa, na ktorú sa má doručovať prednostne
    layoutRow6990_Repeating_Sekcia_Adresa2NavrhovatelaPO_Repeating_
    Adresa, na ktorú sa má doručovať prednostne
     
    layoutRowContentlayoutRow6990_Repeating_
    layoutColumn10760_Repeating_
    layoutCell24247_Repeating_
     
    layoutCell24248_Repeating_
     
    layoutCell24250_Repeating_
     
    layoutColumn10761_Repeating_
    layoutCell24251_Repeating_
     
    layoutCell24534_Repeating_
     
    layoutCell24534_Repeating_
     
    layoutCell24254_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow6991_Repeating_Sekcia_Supisne2NavrhovatelPO_Repeating_
    layoutRowContentlayoutRow6991_Repeating_
    layoutColumn10762_Repeating_
    layoutCell24255_Repeating_
     
    layoutColumn10763_Repeating_
    layoutCell24256_Repeating_
     
    layoutColumn10764_Repeating_
    layoutCell24257_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow6992_Repeating_Sekcie_KontaktneNavrhovatelPO_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow6992_Repeating_
    layoutColumn10765_Repeating_
    layoutCell24260_Repeating_
     
    layoutCell33006_Repeating_
     
     
    layoutRow6993_Repeating_Sekcia_TelefonNavrhovatelPO_Repeating_
    layoutRowContentlayoutRow6993_Repeating_
    layoutColumn10766_Repeating_
    layoutCell24261_Repeating_
     
    layoutColumn10767_Repeating_
    layoutCell24263_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9510_Repeating_Sec_EmailSchrankaPO_C_Repeating_
    layoutRowContentlayoutRow9510_Repeating_
    layoutColumn15358_Repeating_
    layoutCell24259_Repeating_
     
    layoutColumn15359_Repeating_
    layoutCell33008_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow6995_Repeating_Sekcia_UdajeOsobyStat_Repeating_
    layoutRowContentlayoutRow6995_Repeating_
    layoutColumn10770_Repeating_
    layoutCell24269_Repeating_
     
    layoutCell24273_Repeating_
     
    layoutCell24268_Repeating_
     
    layoutCell24285_Repeating_
     
    layoutCell24297_Repeating_
     
     
    layoutRow6996_Repeating_Sekcia_NazovNavrhovatelaStat_Repeating_
    layoutRowContentlayoutRow6996_Repeating_
    layoutColumn10771_Repeating_
    layoutCell24270_Repeating_
     
    layoutCell24271_Repeating_
     
    layoutCell24272_Repeating_
     
     
    Názov
    Označenie štátneho orgánu, alebo právnickej osoby, ktorý za štát koná
    IČO
    layoutRow6997_Repeating_Sekcia_Adresa1NavrhovatelaStat_Repeating_
    Adresa / sídlo
     
    layoutRowContentlayoutRow6997_Repeating_
    layoutColumn10772_Repeating_
    layoutCell24274_Repeating_
     
    layoutCell24275_Repeating_
     
    layoutCell24277_Repeating_
     
    layoutColumn10773_Repeating_
    layoutCell24278_Repeating_
     
    layoutCell24536_Repeating_
     
    layoutCell24536_Repeating_
     
    layoutCell24281_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow6998_Repeating_Sekcia_Supisne1NavrhovatelStat_Repeating_
    layoutRowContentlayoutRow6998_Repeating_
    layoutColumn10774_Repeating_
    layoutCell24282_Repeating_
     
    layoutColumn10775_Repeating_
    layoutCell24283_Repeating_
     
    layoutColumn10776_Repeating_
    layoutCell24284_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    Adresa, na ktorú sa má doručovať prednostne
    layoutRow6999_Repeating_Sekcia_Adresa2NavrhovatelaStat_Repeating_
    Adresa, na ktorú sa má doručovať prednostne
     
    layoutRowContentlayoutRow6999_Repeating_
    layoutColumn10777_Repeating_
    layoutCell24286_Repeating_
     
    layoutCell24287_Repeating_
     
    layoutCell24289_Repeating_
     
    layoutColumn10778_Repeating_
    layoutCell24290_Repeating_
     
    layoutCell24538_Repeating_
     
    layoutCell24538_Repeating_
     
    layoutCell24293_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow7000_Repeating_Sekcia_Supisne2NavrhovatelStat_Repeating_
    layoutRowContentlayoutRow7000_Repeating_
    layoutColumn10779_Repeating_
    layoutCell24294_Repeating_
     
    layoutColumn10780_Repeating_
    layoutCell24295_Repeating_
     
    layoutColumn10781_Repeating_
    layoutCell24296_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow7001_Repeating_Sekcie_KontaktneNavrhovatelStat_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow7001_Repeating_
    layoutColumn10782_Repeating_
    layoutCell24299_Repeating_
     
    layoutCell33009_Repeating_
     
     
    layoutRow7002_Repeating_Sekcia_TelefonNavrhovatelStat_Repeating_
    layoutRowContentlayoutRow7002_Repeating_
    layoutColumn10783_Repeating_
    layoutCell24300_Repeating_
     
    layoutColumn10784_Repeating_
    layoutCell24302_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9511_Repeating_Sec_EmailSchrankaST_C_Repeating_
    layoutRowContentlayoutRow9511_Repeating_
    layoutColumn15360_Repeating_
    layoutCell24298_Repeating_
     
    layoutColumn15361_Repeating_
    layoutCell33011_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    Povinný má zákonného zástupcu (správcu)
    layoutRow7003_Repeating_Sekcia_MaZastupcu_Repeating_
    Zakonní zástupcovia
     
    layoutRowContentlayoutRow7003_Repeating_
    layoutColumn10785_Repeating_
    layoutCell24305_Repeating_
     
    layoutCell32387_Repeating_
     
    layoutCell24307_Repeating_
     
     
    Typ subjektu
    Typ subjektu kód
    Typ zákonného zástupcu (správcu)
    layoutRow7004_Repeating_Sekcia_Zastupca_Repeating_
    layoutRowContentlayoutRow7004_Repeating_
    layoutColumn10786_Repeating_
    layoutCell24308_Repeating_
     
    layoutCell24342_Repeating_
     
     
    layoutRow7005_Repeating_Sekcia_UdajeZastupcaFO_Repeating_
    layoutRowContentlayoutRow7005_Repeating_
    layoutColumn10787_Repeating_
    layoutCell24327_Repeating_
     
    layoutCell24315_Repeating_
     
    layoutCell24312_Repeating_
     
     
    layoutRow7010_Repeating_Sekcia_MenoPriezvisko2_Repeating_
    layoutRowContentlayoutRow7010_Repeating_
    layoutColumn10796_Repeating_
    layoutCell24329_Repeating_
     
    layoutCell24332_Repeating_
     
    layoutCell24328_Repeating_
     
    layoutCell24334_Repeating_
     
    layoutColumn10797_Repeating_
    layoutCell24330_Repeating_
     
    layoutCell24337_Repeating_
     
    layoutCell24331_Repeating_
     
    layoutCell24339_Repeating_
     
     
    Dátum narodenia
    layoutRow7011_Repeating_Sekcia_MenoZastupcaFO_Repeating_
    layoutRowContentlayoutRow7011_Repeating_
    layoutColumn10798_Repeating_
    layoutCell24333_Repeating_
     
     
    Meno
    Rodné priezvisko
    layoutRow7012_Repeating_Sekcia_TitulPredZastupcaFO_Repeating_
    layoutRowContentlayoutRow7012_Repeating_
    layoutColumn10799_Repeating_
    layoutCell24335_Repeating_
     
     
    Titul pred
    Titul pred kód
    Rodné číslo
    layoutRow7013_Repeating_Sekcia_PriezviskoZastupcaFO_Repeating_
    layoutRowContentlayoutRow7013_Repeating_
    layoutColumn10800_Repeating_
    layoutCell24338_Repeating_
     
     
    Priezvisko
     
    layoutRow7014_Repeating_Sekcia_TitulZaZastupcaFO_Repeating_
    layoutRowContentlayoutRow7014_Repeating_
    layoutColumn10801_Repeating_
    layoutCell24340_Repeating_
     
     
    Titul za
    Titul za kód
    layoutRow7008_Repeating_Sekcia_AdresaZastupcaFO_Repeating_
    Trvalý pobyt / Pobyt
     
    layoutRowContentlayoutRow7008_Repeating_
    layoutColumn10791_Repeating_
    layoutCell24316_Repeating_
     
    layoutCell24317_Repeating_
     
    layoutCell24319_Repeating_
     
    layoutColumn10792_Repeating_
    layoutCell24320_Repeating_
     
    layoutCell24540_Repeating_
     
    layoutCell24540_Repeating_
     
    layoutCell24323_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow7009_Repeating_Sekcia_SupisneZastupcaFO_Repeating_
    layoutRowContentlayoutRow7009_Repeating_
    layoutColumn10793_Repeating_
    layoutCell24324_Repeating_
     
    layoutColumn10794_Repeating_
    layoutCell24325_Repeating_
     
    layoutColumn10795_Repeating_
    layoutCell24326_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow7007_Repeating_Sekcie_KontaktneZastupcaFO_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow7007_Repeating_
    layoutColumn10790_Repeating_
    layoutCell24313_Repeating_
     
    layoutCell33015_Repeating_
     
     
    layoutRow7006_Repeating_Sekcia_TelefonZastupcaFO_Repeating_
    layoutRowContentlayoutRow7006_Repeating_
    layoutColumn10788_Repeating_
    layoutCell24309_Repeating_
     
    layoutColumn10789_Repeating_
    layoutCell24311_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9513_Repeating_Sec_EmailSchrankaFO_C1_Repeating_
    layoutRowContentlayoutRow9513_Repeating_
    layoutColumn15364_Repeating_
    layoutCell24314_Repeating_
     
    layoutColumn15365_Repeating_
    layoutCell33017_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow7015_Repeating_Sekcia_UdajeZastupcaPO_Repeating_
    layoutRowContentlayoutRow7015_Repeating_
    layoutColumn10802_Repeating_
    layoutCell27115_Repeating_
     
    layoutCell24362_Repeating_
     
    layoutCell24343_Repeating_
     
    layoutCell24344_Repeating_
     
    layoutCell24359_Repeating_
     
     
    Informácie o právnickej osobe je možné načítať na základe IČO z Registra právnických osôb pomocou tlačidla \"Načítať údaje z RPO\".
    layoutRow7020_Repeating_SekciaICODICZastupcaZalovaneho_Repeating_
    layoutRowContentlayoutRow7020_Repeating_
    layoutColumn10811_Repeating_
    layoutCell24363_Repeating_
     
    layoutColumn11218_Repeating_
    layoutColumn10812_Repeating_
    layoutCell24364_Repeating_
     
     
    IČO
    Iné identifikačné číslo
    Názov
    layoutRow7016_Repeating_Sekcia_AdresaZastupcaPO_Repeating_
    Adresa / sídlo zástupcu
     
    layoutRowContentlayoutRow7016_Repeating_
    layoutColumn10803_Repeating_
    layoutCell24345_Repeating_
     
    layoutCell24346_Repeating_
     
    layoutCell24348_Repeating_
     
    layoutColumn10804_Repeating_
    layoutCell24349_Repeating_
     
    layoutCell24542_Repeating_
     
    layoutCell24542_Repeating_
     
    layoutCell24352_Repeating_
     
     
    Štát
    Štát kód
    Ulica
    PSČ
    Obec
    Obec
    Obec kód
    layoutRow7017_Repeating_Sekcia_SupisneZastupcaPO_Repeating_
    layoutRowContentlayoutRow7017_Repeating_
    layoutColumn10805_Repeating_
    layoutCell24353_Repeating_
     
    layoutColumn10806_Repeating_
    layoutCell24354_Repeating_
     
    layoutColumn10807_Repeating_
    layoutCell24355_Repeating_
     
     
    Súpisné / Orientačné číslo
    Súpisné číslo
    Orientačné číslo
    layoutRow7019_Repeating_Sekcie_KontaktneZastupcaPO_Repeating_
    Kontaktné údaje
     
    layoutRowContentlayoutRow7019_Repeating_
    layoutColumn10810_Repeating_
    layoutCell24360_Repeating_
     
    layoutCell33012_Repeating_
     
     
    layoutRow7018_Repeating_Sekcia_TelefonZastupcaPO_Repeating_
    layoutRowContentlayoutRow7018_Repeating_
    layoutColumn10808_Repeating_
    layoutCell24356_Repeating_
     
    layoutColumn10809_Repeating_
    layoutCell24358_Repeating_
     
     
    Typ telefónu
    Typ telefónu kód
    Telefónne číslo
    layoutRow9512_Repeating_Sec_EmailSchrankaPO_C1_Repeating_
    layoutRowContentlayoutRow9512_Repeating_
    layoutColumn15362_Repeating_
    layoutCell24361_Repeating_
     
    layoutColumn15363_Repeating_
    layoutCell33014_Repeating_
     
     
    Email
    Označenie elektronickej schránky
    layoutRow6793_Repeating_Dsekcia_ExekucnyTitul_Repeating_
    D) Exekučný titul
     
    layoutRowContentlayoutRow6793_Repeating_
    layoutColumn10422_Repeating_
    layoutCell24485_Repeating_
     
     
    layoutRow7049_Repeating_exekucnyTitulOpak_Repeating_
    layoutRowContentlayoutRow7049_Repeating_
    layoutColumn10860_Repeating_
    layoutCell24484_Repeating_
     
    layoutCell23563_Repeating_
     
    layoutCell27144_Repeating_
     
    layoutCell27144_Repeating_
     
    layoutCell27185_Repeating_
     
    layoutCell23564_Repeating_
     
     
    Druh exekučného titulu
    Druh exekučného titulu
    Druh exekučného titulu kód
    Iný exekučný titul
    layoutRow8004_Repeating_labelsSection_Repeating_
    layoutRowContentlayoutRow8004_Repeating_
    layoutColumn12219_Repeating_
    layoutCell25114_Repeating_
     
    layoutCell25115_Repeating_
     
    layoutCell25116_Repeating_
     
     
    K návrhu na vykonanie exekúcie na podklade cudzieho exekučného titulu je potrebné pripojiť aj listiny uvedené v osobitnom predpise.<sup>1)</sup> Ak sa podľa osobitného predpisu vyžaduje rozhodnutie o vyhlásení vykonateľnosti <sup>2)</sup> alebo o uznaní <sup>3)</sup> ako podmienka výkonu cudzieho exekučného titulu, je potrebné pripojiť aj rozhodnutie súdu o uznaní alebo o vyhlásení vykonateľnosti tohto cudzieho exekučného titulu. Ak bol exekučný titul osvedčený podľa osobitného predpisu a ako podmienka jeho výkonu sa nevyžaduje rozhodnutie súdu o jeho vykonateľnosti, je potrebné pripojiť osvedčenie podľa tohto osobitného predpisu. <sup>4)</sup>
    1) Napríklad § 47 zákona č.244/2002 Z. z. v znení neskorších predpisov<br/> 2) Napríklad nariadenie Rady (ES) č.44/2001 z 22. decembra 2000 o právomoci a o uznávaní a výkone rozsudkov v občianskych a obchodných veciach (Ú.v. ES L12, 16. 1. 2001), nariadenie Rady (ES) č.4/2009 z 18. decembra 2008 o právomoci, rozhodnom práve, uznávaní a výkone rozhodnutí a o spolupráci vo veciach vyživovacej povinnosti (Ú.v. EÚ L7, 10. 1. 2009) v prípade rozhodnutia vydaného v členskom štáte, ktorý nie je viazaný Haagskym protokolom z roku 2007, nariadenie (ES) č.650/2012 z júla 2012 o právomoci, rozhodnom práve, uznávaní a výkone verejných listín v dedičských veciach a o zavedení európskeho osvedčenia o dedičstve, Lugánsky dohovor zo 16. septembra 1988 o právomoci a výkone rozsudkov v občianskych a obchodných veciach, ktorým sa rozširuje pôsobnosť pravidiel obsiahnutých v Bruselskom dohovore z roku 1968 na niektoré členské štáty Európskeho združenia voľného obchodu
    3) Napríklad § 67 ods. 4 zákona č.97/1963 Zb. o medzinárodnom práve súkromnom a procesnom v znení neskorších predpisov<br/> 4) Napríklad nariadenie Európskeho parlamentu a Rady (EÚ) č.1215/2012 z 12. decembra 2012 o právomoci a o uznávaní a výkone rozsudkov v občianskych a obchodných veciach (prepracované znenie) (Ú.v. EÚ L351, 20. 12. 2012) v platnom znení, nariadenie Európskeho parlamentu a Rady (ES) č.805/2004 z 21. apríla 2004, ktorým sa vytvára európsky exekučný titul pre nesporné nároky (Ú.v. EÚ L143, 30. 4. 2004) v platnom znení, nariadenie Európskeho parlamentu a Rady (ES) č. 896/2006 z 12. decembra 2006, ktorým sa zavádza európske konanie o platobnom rozkaze (Ú.v. EÚ L399, 30. 12. 2006) v platnom znení, nariadenie Európskeho parlamentu a Rady (ES) č.861/2007 z 11. júla 2007, ktorým sa ustanovuje Európske konanie vo veciach s nízkou hodnotou sporu (Ú.v. EÚ L 199, 31. 7. 2007) v platnom znení, nariadenie Európskeho parlamentu a Rady (EÚ) č. 606/2013 z 12. júna 2013 o vzájomnom uznávaní ochranných opatrení v občianskych veciach (Ú.v. EÚ L 181, 29. 6. 2013)
    layoutRow6795_Repeating_oznacenieExekucnehoTituluSekcia_Repeating_
    Označenie exekučného titulu
     
    layoutRowContentlayoutRow6795_Repeating_
    layoutColumn10424_Repeating_
    layoutCell23565_Repeating_
     
    layoutCell23566_Repeating_
     
    layoutCell23567_Repeating_
     
    layoutCell23568_Repeating_
     
     
    Orgán, ktorý exekučný titul vydal
    Spisová značka/číslo konania
    Dátum vydania
    layoutRow6796_Repeating_datumVykonatelnostiPomSekcia_Repeating_
    layoutRowContentlayoutRow6796_Repeating_
    layoutColumn10425_Repeating_
    layoutCell23569_Repeating_
     
    layoutCell23570_Repeating_
     
     
    Dátum vykonateľnosti
    Doplňujúce informácie
    layoutRow6794_Repeating_Esekcia_VymahanyNarok_Repeating_
    E) Vymáhaný nárok
     
    layoutRowContentlayoutRow6794_Repeating_
    layoutColumn10423_Repeating_
    layoutCell23579_Repeating_
     
    layoutCell23581_Repeating_
     
    layoutCell23582_Repeating_
     
    layoutCell23580_Repeating_
     
     
    Vymáhaný nárok
    Vymáhaný nárok kód
    layoutRow6803_Repeating_penaznyNarokSekcia_Repeating_
    layoutRowContentlayoutRow6803_Repeating_
    layoutColumn10433_Repeating_
    layoutCell23584_Repeating_
     
    layoutCell32374_Repeating_
     
    layoutCell25213_Repeating_
     
    layoutCell25251_Repeating_
     
    layoutCell25270_Repeating_
     
    layoutCell25288_Repeating_
     
    layoutCell25309_Repeating_
     
    layoutCell32347_Repeating_
     
    layoutCell23586_Repeating_
     
     
    Peňažný nárok
    Peňažný nárok kód
    layoutRow9379_Repeating_sekIstina_Repeating_
    layoutRowContentlayoutRow9379_Repeating_
    layoutColumn15081_Repeating_
    layoutCell25209_Repeating_
     
    layoutCell25208_Repeating_
     
     
    Istina
    layoutRow7211_Repeating_istinaPom_Repeating_
    layoutRowContentlayoutRow7211_Repeating_
    layoutColumn11126_Repeating_
    layoutCell25210_Repeating_
     
    layoutColumn11127_Repeating_
    layoutCell25211_Repeating_
     
     
    Výška istiny
    Jednotka meny
    Jednotka meny kód
    layoutRow7212_Repeating_SecUrok_Repeating_
    layoutRowContentlayoutRow7212_Repeating_
    layoutColumn11128_Repeating_
    layoutCell25214_Repeating_
     
    layoutCell25215_Repeating_
     
     
    Úrok
    layoutRow7213_Repeating_SecUrokOpak_Repeating_
    layoutRowContentlayoutRow7213_Repeating_
    layoutColumn11129_Repeating_
    layoutCell25229_Repeating_
     
    layoutCell25216_Repeating_
     
    layoutCell27073_Repeating_
     
     
    layoutRow7216_Repeating_datumUrokCheckboxPomSekcia_Repeating_
    layoutRowContentlayoutRow7216_Repeating_
    layoutColumn11139_Repeating_
    layoutCell25230_Repeating_
     
    layoutColumn11140_Repeating_
    layoutCell25231_Repeating_
     
     
     
    dátum
    layoutRow7214_Repeating_SecPercentualnaSadzba_Repeating_
    layoutRowContentlayoutRow7214_Repeating_
    layoutColumn11130_Repeating_
    layoutCell25217_Repeating_
     
    layoutColumn11131_Repeating_
    layoutCell25218_Repeating_
     
    layoutColumn11132_Repeating_
    layoutCell25219_Repeating_
     
    layoutColumn11133_Repeating_
    layoutCell25221_Repeating_
     
    layoutColumn11134_Repeating_
    layoutCell25222_Repeating_
     
    layoutColumn11135_Repeating_
    layoutCell25223_Repeating_
     
    layoutColumn11136_Repeating_
    layoutCell25224_Repeating_
     
    layoutColumn11137_Repeating_
    layoutCell25225_Repeating_
     
    layoutCell25226_Repeating_
     
     
    percentuálna sadzba
    %
    periodicita
    periodicita kód
    zo sumy
    suma
    Jednotka meny
    Jednotka meny kód
    od
    do
    do
    layoutRow7974_Repeating_SekciaSuma_Repeating_
    layoutRowContentlayoutRow7974_Repeating_
    layoutColumn12154_Repeating_
    layoutCell27074_Repeating_
     
     
    suma kapitalizovaných úrokov
    layoutRow7222_Repeating_SecUrok_3_Repeating_
    layoutRowContentlayoutRow7222_Repeating_
    layoutColumn11154_Repeating_
    layoutCell25252_Repeating_
     
    layoutCell25253_Repeating_
     
     
    Úrok z omeškania
    layoutRow7223_Repeating_SecUrokZOmeskaniaOpak_3_Repeating_
    layoutRowContentlayoutRow7223_Repeating_
    layoutColumn11155_Repeating_
    layoutCell25267_Repeating_
     
    layoutCell25254_Repeating_
     
    layoutCell27075_Repeating_
     
     
    layoutRow7226_Repeating_datumUrokZomeskaniaCheckboxPomSekcia_3_Repeating_
    layoutRowContentlayoutRow7226_Repeating_
    layoutColumn11165_Repeating_
    layoutCell25268_Repeating_
     
    layoutColumn11166_Repeating_
    layoutCell25269_Repeating_
     
     
     
    dátum
    layoutRow7224_Repeating_SecPercentualnaSadzba_3_Repeating_
    layoutRowContentlayoutRow7224_Repeating_
    layoutColumn11156_Repeating_
    layoutCell25255_Repeating_
     
    layoutColumn11157_Repeating_
    layoutCell25256_Repeating_
     
    layoutColumn11158_Repeating_
    layoutCell25257_Repeating_
     
    layoutColumn11159_Repeating_
    layoutCell25259_Repeating_
     
    layoutColumn11160_Repeating_
    layoutCell25260_Repeating_
     
    layoutColumn11161_Repeating_
    layoutCell25261_Repeating_
     
    layoutColumn11162_Repeating_
    layoutCell25262_Repeating_
     
    layoutColumn11163_Repeating_
    layoutCell25263_Repeating_
     
    layoutCell25264_Repeating_
     
     
    percentuálna sadzba
    % alebo ‰
    % alebo ‰ kód
    periodicita
    periodicita kód
    zo sumy
    suma
    Jednotka meny
    Jednotka meny kód
    od
    do
    do
    layoutRow7975_Repeating_SekciaSuma_1_Repeating_
    layoutRowContentlayoutRow7975_Repeating_
    layoutColumn12155_Repeating_
    layoutCell27076_Repeating_
     
     
    suma kapitalizovaných úrokov z omeškania
    layoutRow7227_Repeating_SecUrok_6_Repeating_
    layoutRowContentlayoutRow7227_Repeating_
    layoutColumn11167_Repeating_
    layoutCell25271_Repeating_
     
    layoutCell25272_Repeating_
     
     
    Poplatok z omeškania
    layoutRow7228_Repeating_SecPoplatokZOmeskaniaOpak_6_Repeating_
    layoutRowContentlayoutRow7228_Repeating_
    layoutColumn11168_Repeating_
    layoutCell25285_Repeating_
     
    layoutCell25273_Repeating_
     
    layoutCell27077_Repeating_
     
     
    layoutRow7231_Repeating_datumPoplatokZomeskaniaCheckboxPomSekcia_6_Repeating_
    layoutRowContentlayoutRow7231_Repeating_
    layoutColumn11178_Repeating_
    layoutCell25286_Repeating_
     
    layoutColumn11179_Repeating_
    layoutCell25287_Repeating_
     
     
     
    dátum
    layoutRow7229_Repeating_SecPercentualnaSadzba_6_Repeating_
    layoutRowContentlayoutRow7229_Repeating_
    layoutColumn11169_Repeating_
    layoutCell25274_Repeating_
     
    layoutColumn11170_Repeating_
    layoutCell25275_Repeating_
     
    layoutColumn11171_Repeating_
    layoutCell25276_Repeating_
     
    layoutColumn11172_Repeating_
    layoutCell25277_Repeating_
     
    layoutColumn11173_Repeating_
    layoutCell25278_Repeating_
     
    layoutColumn11174_Repeating_
    layoutCell25279_Repeating_
     
    layoutColumn11175_Repeating_
    layoutCell25280_Repeating_
     
    layoutColumn11176_Repeating_
    layoutCell25281_Repeating_
     
    layoutCell25282_Repeating_
     
     
    sadzba
    % alebo ‰
    % alebo ‰ kód
    denne
    zo sumy
    suma
    Jednotka meny
    Jednotka meny kód
    od
    do
    do
    layoutRow7976_Repeating_SekciaSuma_2_Repeating_
    layoutRowContentlayoutRow7976_Repeating_
    layoutColumn12156_Repeating_
    layoutCell27078_Repeating_
     
     
    suma kapitalizovaných poplatkov z omeškania
    layoutRow7232_Repeating_SecZmluvnaPokutaObal_Repeating_
    layoutRowContentlayoutRow7232_Repeating_
    layoutColumn11180_Repeating_
    layoutCell25289_Repeating_
     
     
    layoutRow7233_Repeating_SecZmluvnaPokutaOpak_Repeating_
    layoutRowContentlayoutRow7233_Repeating_
    layoutColumn11181_Repeating_
    layoutCell25291_Repeating_
     
    layoutCell25290_Repeating_
     
    layoutCell25293_Repeating_
     
    layoutCell25296_Repeating_
     
     
    Zmluvná pokuta
    Druh pokuty kód
    layoutRow7234_Repeating_SecZmluvnaPokuta_Repeating_
    layoutRowContentlayoutRow7234_Repeating_
    layoutColumn11182_Repeating_
    layoutCell25294_Repeating_
     
     
    layoutRow7235_Repeating_SecZmluvnaPokutaPevnaSuma_Repeating_
    layoutRowContentlayoutRow7235_Repeating_
    layoutColumn11183_Repeating_
    layoutCell25295_Repeating_
     
    layoutColumn12160_Repeating_
    layoutCell27096_Repeating_
     
     
    suma
    Jednotka meny
    Jednotka meny kód
    layoutRow7236_Repeating_SecZmluvnaPokuta_3_Repeating_
    layoutRowContentlayoutRow7236_Repeating_
    layoutColumn11184_Repeating_
    layoutCell28201_Repeating_
     
    layoutCell25297_Repeating_
     
     
    layoutRow8299_Repeating_datumZmluvnaPokutaCheckboxPomSekcia_Repeating_
    layoutRowContentlayoutRow8299_Repeating_
    layoutColumn12789_Repeating_
    layoutCell28202_Repeating_
     
    layoutColumn12790_Repeating_
    layoutCell28203_Repeating_
     
     
     
    dátum
    layoutRow7237_Repeating_PokutaPercentualnaSadzbaPom_3_Repeating_
    layoutRowContentlayoutRow7237_Repeating_
    layoutColumn11185_Repeating_
    layoutCell25298_Repeating_
     
    layoutColumn11186_Repeating_
    layoutCell25299_Repeating_
     
    layoutColumn11187_Repeating_
    layoutCell25300_Repeating_
     
    layoutColumn11188_Repeating_
    layoutCell25302_Repeating_
     
    layoutColumn11189_Repeating_
    layoutCell25303_Repeating_
     
    layoutColumn11190_Repeating_
    layoutCell25304_Repeating_
     
    layoutColumn11191_Repeating_
    layoutCell25305_Repeating_
     
    layoutColumn11192_Repeating_
    layoutCell25306_Repeating_
     
    layoutCell28204_Repeating_
     
     
    percentuálna sadzba
    %
    periodicita
    periodicita kód
    zo sumy
    suma
    Jednotka meny
    Jednotka meny kód
    od
    do
    do
    layoutRow7239_Repeating_naklSpojeneSuplatPohlPom_Repeating_
    layoutRowContentlayoutRow7239_Repeating_
    layoutColumn11194_Repeating_
    layoutCell25310_Repeating_
     
    layoutCell25311_Repeating_
     
     
    Náklady spojené s uplatnením pohľadávky
    layoutRow7240_Repeating_sumaPom_Repeating_
    layoutRowContentlayoutRow7240_Repeating_
    layoutColumn11195_Repeating_
    layoutCell25312_Repeating_
     
    layoutColumn11196_Repeating_
    layoutCell25313_Repeating_
     
     
    Suma
    Jednotka meny
    Jednotka meny kód
    layoutRow9372_Repeating_SecIneObal_2_Repeating_
    layoutRowContentlayoutRow9372_Repeating_
    layoutColumn15065_Repeating_
    layoutCell32348_Repeating_
     
     
    layoutRow9373_Repeating_SecZmluvnaPokutaOpak_2_Repeating_
    layoutRowContentlayoutRow9373_Repeating_
    layoutColumn15066_Repeating_
    layoutCell32350_Repeating_
     
    layoutCell32373_Repeating_
     
    layoutCell32349_Repeating_
     
    layoutCell32352_Repeating_
     
    layoutCell32357_Repeating_
     
     
    Iné
    Iné
    Druh iné kód
    layoutRow9374_Repeating_SecInePev_2_Repeating_
    layoutRowContentlayoutRow9374_Repeating_
    layoutColumn15067_Repeating_
    layoutCell32353_Repeating_
     
     
    layoutRow9375_Repeating_SecIneSuma_2_Repeating_
    layoutRowContentlayoutRow9375_Repeating_
    layoutColumn15068_Repeating_
    layoutCell32354_Repeating_
     
    layoutColumn15069_Repeating_
    layoutCell32355_Repeating_
     
     
    suma
    Jednotka meny
    Jednotka meny kód
    layoutRow9376_Repeating_SecInePer_2_Repeating_
    layoutRowContentlayoutRow9376_Repeating_
    layoutColumn15070_Repeating_
    layoutCell32370_Repeating_
     
    layoutCell32358_Repeating_
     
     
    layoutRow9378_Repeating_datumIneCheckboxPomSekcia_2_Repeating_
    layoutRowContentlayoutRow9378_Repeating_
    layoutColumn15079_Repeating_
    layoutCell32371_Repeating_
     
    layoutColumn15080_Repeating_
    layoutCell32372_Repeating_
     
     
     
    dátum
    layoutRow9377_Repeating_InePercentualnaSadzbaPom_2_Repeating_
    layoutRowContentlayoutRow9377_Repeating_
    layoutColumn15071_Repeating_
    layoutCell32359_Repeating_
     
    layoutColumn15072_Repeating_
    layoutCell32360_Repeating_
     
    layoutColumn15073_Repeating_
    layoutCell32361_Repeating_
     
    layoutColumn15074_Repeating_
    layoutCell32363_Repeating_
     
    layoutColumn15075_Repeating_
    layoutCell32364_Repeating_
     
    layoutColumn15076_Repeating_
    layoutCell32365_Repeating_
     
    layoutColumn15077_Repeating_
    layoutCell32367_Repeating_
     
    layoutColumn15078_Repeating_
    layoutCell32368_Repeating_
     
    layoutCell32369_Repeating_
     
     
    percentuálna sadzba
    %
    periodicita
    periodicita kód
    zo sumy
    suma
    Jednotka meny
    Jednotka meny kód
    od
    do
    do
    Doplňujúce informácie o peňažnom nároku
    layoutRow6804_Repeating_penaznyNarokVyzivneSekcia_Repeating_
    layoutRowContentlayoutRow6804_Repeating_
    layoutColumn10434_Repeating_
    layoutCell23587_Repeating_
     
    layoutCell23588_Repeating_
     
    layoutCell23589_Repeating_
     
     
    Zameškané výživné (ku dňu podania návrhu)
    Bežné výživné
    Doplňujúce informácie o vyživovacej povinnosti
    layoutRow6802_Repeating_nepenaznyNarokSekcia_Repeating_
    layoutRowContentlayoutRow6802_Repeating_
    layoutColumn10432_Repeating_
    layoutCell23583_Repeating_
     
    layoutCell27062_Repeating_
     
     
    Popis
    layoutRow7973_Repeating_SuvisiacPenNarok_Repeating_
    layoutRowContentlayoutRow7973_Repeating_
    layoutColumn12153_Repeating_
    layoutCell27072_Repeating_
     
    layoutCell27061_Repeating_
     
    layoutCell26979_Repeating_
     
    layoutCell26985_Repeating_
     
    layoutCell27003_Repeating_
     
    layoutCell27019_Repeating_
     
    layoutCell27036_Repeating_
     
    layoutCell27055_Repeating_
     
    layoutCell32672_Repeating_
     
     
    <b>Súvisiaci peňažný nárok</b>
    Peňažný nárok
    Peňažný nárok kód
    layoutRow7952_Repeating_istinaPom_1_Repeating_
    layoutRowContentlayoutRow7952_Repeating_
    layoutColumn12099_Repeating_
    layoutCell26980_Repeating_
     
    layoutCell26981_Repeating_
     
    layoutColumn12100_Repeating_
    layoutCell26983_Repeating_
     
    layoutCell26982_Repeating_
     
     
    Istina
    Výška istiny
     
    Jednotka meny
    Jednotka meny kód
    layoutRow7953_Repeating_SecUrok_5_Repeating_
    layoutRowContentlayoutRow7953_Repeating_
    layoutColumn12101_Repeating_
    layoutCell26986_Repeating_
     
    layoutCell26987_Repeating_
     
     
    Úrok
    layoutRow7954_Repeating_SecUrokOpak_5_Repeating_
    layoutRowContentlayoutRow7954_Repeating_
    layoutColumn12102_Repeating_
    layoutCell27000_Repeating_
     
    layoutCell26988_Repeating_
     
    layoutCell27079_Repeating_
     
     
    layoutRow7956_Repeating_datumUrokCheckboxPomSekcia_5_Repeating_
    layoutRowContentlayoutRow7956_Repeating_
    layoutColumn12111_Repeating_
    layoutCell27001_Repeating_
     
    layoutColumn12112_Repeating_
    layoutCell27002_Repeating_
     
     
     
    dátum
    layoutRow7955_Repeating_SecPercentualnaSadzba_5_Repeating_
    layoutRowContentlayoutRow7955_Repeating_
    layoutColumn12103_Repeating_
    layoutCell26989_Repeating_
     
    layoutColumn12104_Repeating_
    layoutCell26990_Repeating_
     
    layoutColumn12105_Repeating_
    layoutCell26991_Repeating_
     
    layoutColumn12106_Repeating_
    layoutCell26993_Repeating_
     
    layoutColumn12107_Repeating_
    layoutCell26994_Repeating_
     
    layoutColumn12108_Repeating_
    layoutCell26995_Repeating_
     
    layoutColumn12109_Repeating_
    layoutCell26997_Repeating_
     
    layoutColumn12110_Repeating_
    layoutCell26998_Repeating_
     
    layoutCell26999_Repeating_
     
     
    percentuálna sadzba
    %
    periodicita
    periodicita kód
    zo sumy
    suma
    Jednotka meny
    Jednotka meny kód
    od
    do
    do
    layoutRow7977_Repeating_SekciaSuma_3_Repeating_
    layoutRowContentlayoutRow7977_Repeating_
    layoutColumn12157_Repeating_
    layoutCell27080_Repeating_
     
     
    suma kapitalizovaných úrokov
    layoutRow7957_Repeating_SecUrok_7_Repeating_
    layoutRowContentlayoutRow7957_Repeating_
    layoutColumn12113_Repeating_
    layoutCell27004_Repeating_
     
    layoutCell27005_Repeating_
     
     
    Úrok z omeškania
    layoutRow7958_Repeating_SecUrokZOmeskaniaOpak_7_Repeating_
    layoutRowContentlayoutRow7958_Repeating_
    layoutColumn12114_Repeating_
    layoutCell27016_Repeating_
     
    layoutCell27006_Repeating_
     
    layoutCell27081_Repeating_
     
     
    layoutRow7960_Repeating_datumUrokZomeskaniaCheckboxPomSekcia_7_Repeating_
    layoutRowContentlayoutRow7960_Repeating_
    layoutColumn12123_Repeating_
    layoutCell27017_Repeating_
     
    layoutColumn12124_Repeating_
    layoutCell27018_Repeating_
     
     
     
    dátum
    layoutRow7959_Repeating_SecPercentualnaSadzba_7_Repeating_
    layoutRowContentlayoutRow7959_Repeating_
    layoutColumn12115_Repeating_
    layoutCell27007_Repeating_
     
    layoutColumn15295_Repeating_
    layoutCell32914_Repeating_
     
    layoutColumn12116_Repeating_
    layoutCell32668_Repeating_
     
    layoutColumn12117_Repeating_
    layoutCell27009_Repeating_
     
    layoutColumn12118_Repeating_
    layoutCell27010_Repeating_
     
    layoutColumn12119_Repeating_
    layoutCell27011_Repeating_
     
    layoutColumn12120_Repeating_
    layoutCell27012_Repeating_
     
    layoutColumn12121_Repeating_
    layoutCell27013_Repeating_
     
    layoutColumn12122_Repeating_
    layoutCell27014_Repeating_
     
    layoutCell27015_Repeating_
     
     
    percentuálna sadzba
     
    % alebo ‰
    % alebo ‰ kód
    periodicita
    periodicita kód
    zo sumy
    suma
    Jednotka meny
    Jednotka meny kód
    od
    do
    do
    layoutRow7978_Repeating_SekciaSuma_4_Repeating_
    layoutRowContentlayoutRow7978_Repeating_
    layoutColumn12158_Repeating_
    layoutCell27082_Repeating_
     
     
    suma kapitalizovaných úrokov z omeškania
    layoutRow7961_Repeating_SecUrok_9_Repeating_
    layoutRowContentlayoutRow7961_Repeating_
    layoutColumn12125_Repeating_
    layoutCell27020_Repeating_
     
    layoutCell27021_Repeating_
     
     
    Poplatok z omeškania
    layoutRow7962_Repeating_SecPoplatokZOmeskaniaOpak_9_Repeating_
    layoutRowContentlayoutRow7962_Repeating_
    layoutColumn12126_Repeating_
    layoutCell27033_Repeating_
     
    layoutCell27022_Repeating_
     
    layoutCell27083_Repeating_
     
     
    layoutRow7964_Repeating_datumPoplatokZomeskaniaCheckboxPomSekcia_9_Repeating_
    layoutRowContentlayoutRow7964_Repeating_
    layoutColumn12135_Repeating_
    layoutCell27034_Repeating_
     
    layoutColumn12136_Repeating_
    layoutCell27035_Repeating_
     
     
     
    dátum
    layoutRow7963_Repeating_SecPercentualnaSadzba_9_Repeating_
    layoutRowContentlayoutRow7963_Repeating_
    layoutColumn12127_Repeating_
    layoutCell27023_Repeating_
     
    layoutColumn12128_Repeating_
    layoutCell32670_Repeating_
     
    layoutColumn12129_Repeating_
    layoutCell27025_Repeating_
     
    layoutColumn12130_Repeating_
    layoutCell27026_Repeating_
     
    layoutColumn12131_Repeating_
    layoutCell27027_Repeating_
     
    layoutColumn12132_Repeating_
    layoutCell27028_Repeating_
     
    layoutColumn12133_Repeating_
    layoutCell27030_Repeating_
     
    layoutColumn12134_Repeating_
    layoutCell27031_Repeating_
     
    layoutCell27032_Repeating_
     
     
    sadzba
    % alebo ‰
    % alebo ‰ kód
    denne
    zo sumy
    suma
    Jednotka meny
    Jednotka meny kód
    od
    do
    do
    layoutRow7979_Repeating_SekciaSuma_5_Repeating_
    layoutRowContentlayoutRow7979_Repeating_
    layoutColumn12159_Repeating_
    layoutCell27084_Repeating_
     
     
    suma kapitalizovaných poplatkov z omeškania
    layoutRow7965_Repeating_SecZmluvnaPokutaObal_1_Repeating_
    layoutRowContentlayoutRow7965_Repeating_
    layoutColumn12137_Repeating_
    layoutCell27037_Repeating_
     
     
    layoutRow7966_Repeating_SecZmluvnaPokutaOpak_1_Repeating_
    layoutRowContentlayoutRow7966_Repeating_
    layoutColumn12138_Repeating_
    layoutCell27039_Repeating_
     
    layoutCell27038_Repeating_
     
    layoutCell27040_Repeating_
     
    layoutCell27043_Repeating_
     
     
    Zmluvná pokuta
    layoutRow7967_Repeating_SecZmluvnaPokuta_1_Repeating_
    layoutRowContentlayoutRow7967_Repeating_
    layoutColumn12139_Repeating_
    layoutCell27041_Repeating_
     
     
    layoutRow7968_Repeating_SecZmluvnaPokutaPevnaSuma_1_Repeating_
    layoutRowContentlayoutRow7968_Repeating_
    layoutColumn12140_Repeating_
    layoutCell27042_Repeating_
     
    layoutColumn12161_Repeating_
    layoutCell27097_Repeating_
     
     
    suma
    Jednotka meny
    Jednotka meny kód
    layoutRow7969_Repeating_SecZmluvnaPokuta_1a_Repeating_
    layoutRowContentlayoutRow7969_Repeating_
    layoutColumn12141_Repeating_
    layoutCell28209_Repeating_
     
    layoutCell27044_Repeating_
     
     
    layoutRow8301_Repeating_datumZmluvnaPokutaNepenaznyCheckboxPomSekcia_Repeating_
    layoutRowContentlayoutRow8301_Repeating_
    layoutColumn12793_Repeating_
    layoutCell28210_Repeating_
     
    layoutColumn12794_Repeating_
    layoutCell28211_Repeating_
     
     
     
    dátum
    layoutRow7970_Repeating_PokutaPercentualnaSadzbaPom_1_Repeating_
    layoutRowContentlayoutRow7970_Repeating_
    layoutColumn12142_Repeating_
    layoutCell27045_Repeating_
     
    layoutColumn12143_Repeating_
    layoutCell27046_Repeating_
     
    layoutColumn12144_Repeating_
    layoutCell27047_Repeating_
     
    layoutColumn12145_Repeating_
    layoutCell27049_Repeating_
     
    layoutColumn12146_Repeating_
    layoutCell27050_Repeating_
     
    layoutColumn12147_Repeating_
    layoutCell27051_Repeating_
     
    layoutColumn12148_Repeating_
    layoutCell27053_Repeating_
     
    layoutColumn12149_Repeating_
    layoutCell27054_Repeating_
     
    layoutCell28212_Repeating_
     
     
    percentuálna sadzba
    %
    periodicita
    periodicita kód
    zo sumy
    suma
    Jednotka meny
    Jednotka meny kód
    od
    do
    do
    Druh pokuty kód
    layoutRow7971_Repeating_naklSpojeneSuplatPohlPom_1_Repeating_
    layoutRowContentlayoutRow7971_Repeating_
    layoutColumn12150_Repeating_
    layoutCell27056_Repeating_
     
    layoutCell27057_Repeating_
     
     
    Náklady spojené s uplatnením pohľadávky
    layoutRow7972_Repeating_sumaPom_1_Repeating_
    layoutRowContentlayoutRow7972_Repeating_
    layoutColumn12151_Repeating_
    layoutCell27058_Repeating_
     
    layoutColumn12152_Repeating_
    layoutCell27059_Repeating_
     
     
    Suma
    Jednotka meny
    Jednotka meny kód
    layoutRow9443_Repeating_SecIneObal_3_Repeating_
    layoutRowContentlayoutRow9443_Repeating_
    layoutColumn15212_Repeating_
    layoutCell32673_Repeating_
     
     
    layoutRow9444_Repeating_SecZmluvnaPokutaOpak_3_Repeating_
    layoutRowContentlayoutRow9444_Repeating_
    layoutColumn15213_Repeating_
    layoutCell32675_Repeating_
     
    layoutCell32676_Repeating_
     
    layoutCell32674_Repeating_
     
    layoutCell32678_Repeating_
     
    layoutCell32683_Repeating_
     
     
    Iné
    Iné
    Druh iné kód
    layoutRow9445_Repeating_SecInePev_3_Repeating_
    layoutRowContentlayoutRow9445_Repeating_
    layoutColumn15214_Repeating_
    layoutCell32679_Repeating_
     
     
    layoutRow9446_Repeating_SecIneSuma_3_Repeating_
    layoutRowContentlayoutRow9446_Repeating_
    layoutColumn15215_Repeating_
    layoutCell32680_Repeating_
     
    layoutColumn15216_Repeating_
    layoutCell32681_Repeating_
     
     
    suma
    Jednotka meny
    Jednotka meny kód
    layoutRow9447_Repeating_SecInePer_3_Repeating_
    layoutRowContentlayoutRow9447_Repeating_
    layoutColumn15217_Repeating_
    layoutCell32696_Repeating_
     
    layoutCell32684_Repeating_
     
     
    layoutRow9449_Repeating_datumIneCheckboxPomSekcia_3_Repeating_
    layoutRowContentlayoutRow9449_Repeating_
    layoutColumn15226_Repeating_
    layoutCell32697_Repeating_
     
    layoutColumn15227_Repeating_
    layoutCell32698_Repeating_
     
     
     
    dátum
    layoutRow9448_Repeating_InePercentualnaSadzbaPom_1_Repeating_
    layoutRowContentlayoutRow9448_Repeating_
    layoutColumn15218_Repeating_
    layoutCell32685_Repeating_
     
    layoutColumn15219_Repeating_
    layoutCell32686_Repeating_
     
    layoutColumn15220_Repeating_
    layoutCell32687_Repeating_
     
    layoutColumn15221_Repeating_
    layoutCell32689_Repeating_
     
    layoutColumn15222_Repeating_
    layoutCell32690_Repeating_
     
    layoutColumn15223_Repeating_
    layoutCell32691_Repeating_
     
    layoutColumn15224_Repeating_
    layoutCell32693_Repeating_
     
    layoutColumn15225_Repeating_
    layoutCell32694_Repeating_
     
    layoutCell32695_Repeating_
     
     
    percentuálna sadzba
    %
    periodicita
    periodicita kód
    zo sumy
    suma
    Jednotka meny
    Jednotka meny kód
    od
    do
    do
    layoutRow6805_Repeating_Fsekcia_TrovyExekucie_Repeating_
    F) Trovy exekúcie - oprávnený
     
    layoutRowContentlayoutRow6805_Repeating_
    layoutColumn10435_Repeating_
    layoutCell23591_Repeating_
     
    layoutCell28185_Repeating_
     
    layoutCell32344_Repeating_
     
    layoutCell28186_Repeating_
     
    layoutCell23593_Repeating_
     
    layoutCell28187_Repeating_
     
    layoutCell32864_Repeating_
     
    layoutCell32865_Repeating_
     
    layoutCell28188_Repeating_
     
    layoutCell25206_Repeating_
     
    layoutCell23595_Repeating_
     
     
    Súdny poplatok (návrh na vykonanie exekúcie)
    layoutRow8291_Repeating_SekciaSudnyPoplatok_Repeating_
    layoutRowContentlayoutRow8291_Repeating_
    layoutColumn12772_Repeating_
    layoutCell25207_Repeating_
     
    layoutColumn12773_Repeating_
     
    Súdny poplatok
    EUR
    layoutRow9371_Repeating_sek_PoplatokZaKonverziu_Repeating_
    layoutRowContentlayoutRow9371_Repeating_
    layoutColumn15063_Repeating_
    layoutCell32345_Repeating_
     
    layoutColumn15064_Repeating_
     
    Poplatok za konverziu
    EUR
    layoutRow8292_Repeating_SekciaTrovy_1_Repeating_
    layoutRowContentlayoutRow8292_Repeating_
    layoutColumn12774_Repeating_
    layoutCell23592_Repeating_
     
    layoutColumn12775_Repeating_
     
    Trovy právneho zastúpenia (vrátane DPH)
    EUR
    Trovy za spísanie návrhu na vykonanie exekúcie u súdneho exekútora
    layoutRow8293_Repeating_SekciaVyska_2_Repeating_
    layoutRowContentlayoutRow8293_Repeating_
    layoutColumn12776_Repeating_
    layoutCell24748_Repeating_
     
    layoutColumn12777_Repeating_
     
    Výška trov za spísanie návrhu na vykonanie exekúcie u súdneho exekútora
    EUR
    Iné trovy
    layoutRow9466_Repeating_sec_ine_trovy_Repeating_
    layoutRowContentlayoutRow9466_Repeating_
    layoutColumn15262_Repeating_
    layoutCell32867_Repeating_
     
    layoutColumn15263_Repeating_
     
    Výška iných trov
    EUR
    layoutRow8294_Repeating_SekciaTrovy_3_Repeating_
    layoutRowContentlayoutRow8294_Repeating_
    layoutColumn12778_Repeating_
    layoutCell23594_Repeating_
     
    layoutColumn12779_Repeating_
     
    Trovy celkom (vrátane DPH)
    EUR
    Odôvodnenie trov
    Odôvodnenie trov
    layoutRow6806_Repeating_Gsekcia_OslobodenieOdSudnehoPoplatku_Repeating_
    G) Oslobodenie od súdneho poplatku
     
    layoutRowContentlayoutRow6806_Repeating_
    layoutColumn10436_Repeating_
    layoutCell23597_Repeating_
     
    layoutCell24498_Repeating_
     
     
    Oslobodenie od súdneho poplatku
    layoutRow7050_Repeating_oslobodenieOdSUdnehoPoplatkuPom_Repeating_
    layoutRowContentlayoutRow7050_Repeating_
    layoutColumn10861_Repeating_
    layoutCell23598_Repeating_
     
    layoutCell23599_Repeating_
     
     
    Oslobodenie od súdneho poplatku
    Oslobodenie od súdneho poplatku kód
    Dôvody
    layoutRow6807_Repeating_Hsekcia_VyhlaseniaNavrh_Repeating_
    H) Vyhlásenia a návrh
     
    layoutRowContentlayoutRow6807_Repeating_
    layoutColumn10437_Repeating_
    layoutCell23601_Repeating_
     
    layoutCell27171_Repeating_
     
    layoutCell23602_Repeating_
     
    layoutCell27175_Repeating_
     
    layoutCell23605_Repeating_
     
    layoutCell27177_Repeating_
     
    layoutCell32868_Repeating_
     
    layoutCell32870_Repeating_
     
    layoutCell23603_Repeating_
     
    layoutCell27179_Repeating_
     
    layoutCell27070_Repeating_
     
    layoutCell27181_Repeating_
     
    layoutCell24749_Repeating_
     
    layoutCell27183_Repeating_
     
    layoutCell23604_Repeating_
     
    layoutCell27173_Repeating_
     
    layoutCell32343_Repeating_
     
     
    Oprávnený vyhlasuje, že nárok podľa exekučného titulu povinný ku dňu podania návrhu na vykonanie exekúcie dobrovoľne nesplnil
    layoutRow7997_Repeating_SekciaPodrobnosti_Repeating_
    layoutRowContentlayoutRow7997_Repeating_
    layoutColumn12212_Repeating_
    layoutCell27172_Repeating_
     
    layoutCell27063_Repeating_
     
     
    Uveďte podrobnosti
    Uveďte podrobnosti
     
    Oprávnený vyhlasuje, že na podklade exekučného titulu uvedeného v časti D) ohľadne toho istého nároku iné exekučné konanie alebo obdobné vykonávacie konanie
    layoutRow7999_Repeating_SekciaPodrobnosti_2_Repeating_
    layoutRowContentlayoutRow7999_Repeating_
    layoutColumn12214_Repeating_
    layoutCell27176_Repeating_
     
    layoutCell27064_Repeating_
     
     
    Uveďte podrobnosti
    Uveďte podrobnosti
     
    Časť nároku podľa exekučného titulu je vymáhaná v inom exekučnom konaní alebo obdobnom vykonávacom konaní
    layoutRow8000_Repeating_SekciaPodrobnosti_3_Repeating_
    layoutRowContentlayoutRow8000_Repeating_
    layoutColumn12215_Repeating_
    layoutCell27178_Repeating_
     
    layoutCell27065_Repeating_
     
     
    Uveďte podrobnosti
    Uveďte podrobnosti
     
    Návrhom sa uplatňuje nárok zo starej exekúcie
    layoutRow9467_Repeating_SekciaPodrobnosti_8_Repeating_
    layoutRowContentlayoutRow9467_Repeating_
    layoutColumn15264_Repeating_
    layoutCell32872_Repeating_
     
    layoutCell32871_Repeating_
     
     
    Uveďte podrobnosti
    Uveďte podrobnosti
     
    Oprávnený je oprávnený vyžadovať splnenie vymáhaného nároku zároveň od iných osôb
    layoutRow8001_Repeating_SekciaPodrobnosti_4_Repeating_
    layoutRowContentlayoutRow8001_Repeating_
    layoutColumn12216_Repeating_
    layoutCell27180_Repeating_
     
    layoutCell27066_Repeating_
     
     
    Uveďte podrobnosti
    Uveďte podrobnosti
     
    Oprávnený/povinný je právnym nástupcom osoby uvedenej v exekučnom titule
    layoutRow8002_Repeating_SekciaPodrobnosti_5_Repeating_
    layoutRowContentlayoutRow8002_Repeating_
    layoutColumn12217_Repeating_
    layoutCell27182_Repeating_
     
    layoutCell27069_Repeating_
     
     
    Opíšte skutočnosti, z ktorých právne nástupníctvo vyplýva. Listinné dôkazy pripojte ako prílohu.
    Opíšte skutočnosti, z ktorých právne nástupníctvo vyplýva. Listinné dôkazy pripojte ako prílohu.
     
    Nárok priznaný exekučným titulom vyplýva zo zmenky
    layoutRow8003_Repeating_SekciaPodrobnosti_6_Repeating_
    layoutRowContentlayoutRow8003_Repeating_
    layoutColumn12218_Repeating_
    layoutCell27184_Repeating_
     
    layoutCell27067_Repeating_
     
     
    Opíšte rozhodujúce skutočnosti a označte dôkazy týkajúce sa vlastného vzťahu s povinným. Listinné dôkazy pripojte ako prílohu.
    Opíšte rozhodujúce skutočnosti a označte dôkazy týkajúce sa vlastného vzťahu s povinným. Listinné dôkazy pripojte ako prílohu.
     
    Nárok je podmienený splnením podmienky alebo vzájomnej povinnosti oprávneným
    layoutRow7998_Repeating_SekciaPodrobnosti_7_Repeating_
    layoutRowContentlayoutRow7998_Repeating_
    layoutColumn12213_Repeating_
    layoutCell27174_Repeating_
     
    layoutCell27068_Repeating_
     
     
    Opíšte skutočnosti týkajúce sa splnenia podmienky alebo vzájomnej povinnosti a označte dôkazy. Listinné dôkazy pripojte ako prílohu.
    Opíšte skutočnosti týkajúce sa splnenia podmienky alebo vzájomnej povinnosti a označte dôkazy. Listinné dôkazy pripojte ako prílohu.
    Návrhom na vykonanie exekúcie sa uplatňuje nárok zo spotrebiteľskej zmluvy
    layoutRow7046_Repeating_Isekcia_prilohySpr_Repeating_
    I) Prílohy uložené v OpP
     
    layoutRowContentlayoutRow7046_Repeating_
    layoutColumn10857_Repeating_
    layoutCell24449_Repeating_
     
    layoutCell25201_Repeating_
     
     
    Uložené v správnom registri súdu (OpP)
    layoutRow7210_Repeating_SekciaCisloSpr_1_Repeating_
    layoutRowContentlayoutRow7210_Repeating_
    layoutColumn11124_Repeating_
    layoutCell24451_Repeating_
     
    layoutColumn11125_Repeating_
    layoutCell25203_Repeating_
     
     
    Číslo OpP
    Popis prílohy
    layoutRow9369_Repeating_SekOznacenieMiesta_Repeating_
    J) Označenie miesta, dátumu a podávajúceho
     
    layoutRowContentlayoutRow9369_Repeating_
    layoutColumn15060_Repeating_
    layoutCell32338_Repeating_
     
    layoutCell32339_Repeating_
     
    layoutCell32337_Repeating_
     
     
    V
    dňa
    Podávajúci
    layoutRow6808_Repeating_Hsekcia_Prilohy_Repeating_
    K) Prílohy
     
    layoutRowContentlayoutRow6808_Repeating_
    layoutColumn10438_Repeating_
    layoutCell23613_Repeating_
     
    layoutCell23608_Repeating_
     
     
    (Zoznam príloh vo formulári je aktualizovaný po každej zmene v sekcii “Prílohy” úvodnej obrazovky podania, kde je možné prílohy pridávať, podpisovať a poprípade odstraňovať. Samotný formulár neobsahuje funkcionalitu na pridanie alebo odstránenie príloh.)
    layoutRow6810_Repeating_AttachmentLabel_Repeating_
    layoutRowContentlayoutRow6810_Repeating_
    layoutColumn10443_Repeating_
    layoutCell23614_Repeating_
     
    layoutColumn10444_Repeating_
    layoutCell23615_Repeating_
     
    layoutColumn10445_Repeating_
    layoutCell23616_Repeating_
     
    layoutColumn10446_Repeating_
    layoutCell23617_Repeating_
     
     
    Por. číslo
    Názov prílohy
    Názov súboru prílohy
    Spôsob doručenia
    layoutRow6809_Repeating_Attachment_Repeating_
    layoutRowContentlayoutRow6809_Repeating_
    layoutColumn10439_Repeating_
    layoutCell23609_Repeating_
     
    layoutColumn10440_Repeating_
    layoutCell23610_Repeating_
     
    layoutColumn10441_Repeating_
    layoutCell23611_Repeating_
     
    layoutColumn10442_Repeating_
    layoutCell23612_Repeating_
     
     
    Poradové číslo
    Názov prílohy
    Názov súboru prílohy
    Spôsob doručenia
    ÁnoÁnoNieNie
    ", + language: "sk", + document_type: "CLS_F_XSLT_HTML" + }, + { + data: "Exekučné konanie - Návrh na vykonanie exekúcie Spôsob podania návrhu Návrh sa podáva prostredníctvom súdneho exekútora: A) Účastníci konania a ich zákonní zástupcovia – oprávnení Oprávnený má právneho zástupcu: B) Právny zástupca (spoločný zástupca) C) Účastníci konania a ich zákonní zástupcovia – povinní D) Exekučný titul E) Vymáhaný nárok Vymáhaný nárok: F) Trovy exekúcie - oprávnený Súdny poplatok (návrh na vykonanie exekúcie): Trovy za spísanie návrhu na vykonanie exekúcie u súdneho exekútora: Iné trovy: Odôvodnenie trov: G) Oslobodenie od súdneho poplatku Oslobodenie od súdneho poplatku: H) Vyhlásenia a návrh Oprávnený vyhlasuje, že nárok podľa exekučného titulu povinný ku dňu podania návrhu na vykonanie exekúcie dobrovoľne nesplnil: Oprávnený vyhlasuje, že na podklade exekučného titulu uvedeného v časti D) ohľadne toho istého nároku iné exekučné konanie alebo obdobné vykonávacie konanie: Časť nároku podľa exekučného titulu je vymáhaná v inom exekučnom konaní alebo obdobnom vykonávacom konaní: Návrhom sa uplatňuje nárok zo starej exekúcie: Oprávnený je oprávnený vyžadovať splnenie vymáhaného nároku zároveň od iných osôb: Oprávnený/povinný je právnym nástupcom osoby uvedenej v exekučnom titule: Nárok priznaný exekučným titulom vyplýva zo zmenky: Nárok je podmienený splnením podmienky alebo vzájomnej povinnosti oprávneným: Návrhom na vykonanie exekúcie sa uplatňuje nárok zo spotrebiteľskej zmluvy: I) Prílohy uložené v OpP Uložené v správnom registri súdu (OpP): J) Označenie miesta, dátumu a podávajúceho V: dňa: Podávajúci: K) Prílohy Evidenčné číslo: Meno: Titul pred: Priezvisko: Titul za: Oprávnený č. Typ subjektu: Oprávnený má zákonného zástupcu (správcu): Opravnený č.: Adresa, na ktorú sa má doručovať prednostne: Vaša značka: IČO: Dátum narodenia: Rodné číslo: Rodné priezvisko: Meno: Titul pred: Priezvisko: Titul za: Obchodné meno: Trvalý pobyt / Pobyt / Miesto podnikania Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Adresa, na ktorú sa má doručovať prednostne Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Názov: Spor sa týka organizačnej zložky právnickej osoby: Adresa, na ktorú sa má doručovať prednostne: Vaša značka: IČO: Iné identifikačné číslo: Adresa / sídlo Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Adresa, na ktorú sa má doručovať prednostne Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Adresa, na ktorú sa má doručovať prednostne: Vaša značka: Názov: Označenie štátneho orgánu, alebo právnickej osoby, ktorý za štát koná: IČO: Adresa / sídlo Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Adresa, na ktorú sa má doručovať prednostne Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Údaje pre poukázanie vymoženého nároku Údaje pre zaplatenie žalovanej sumy - IBAN: Údaje pre zaplatenie žalovanej sumy - BIC: Údaje pre zaplatenie žalovanej sumy - Variabilný symbol: Údaje pre zaplatenie žalovanej sumy - Špecifický symbol: Zákonní zástupcovia Typ subjektu: Typ zákonného zástupcu (správcu): Dátum narodenia: Rodné priezvisko: Rodné číslo: Meno: Titul pred: Priezvisko: Titul za: Trvalý pobyt / Pobyt Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Názov: IČO: Iné identifikačné číslo: Adresa / sídlo zástupcu Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Typ subjektu: Spoločný zástupca: Advokát: Registračné číslo advokáta: Dátum narodenia: Rodné číslo: IČO: Meno: Rodné priezvisko: Titul pred: Priezvisko: Titul za: Sídlo zástupcu Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Názov: IČO: Iné identifikačné číslo: Adresa / sídlo zástupcu Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Údaje o bankovom účte právneho zástupcu (spoločného zástupcu) Údaje pre zaplatenie žalovanej sumy - IBAN: Údaje pre zaplatenie žalovanej sumy - BIC: Údaje pre zaplatenie žalovanej sumy - Variabilný symbol: Údaje pre zaplatenie žalovanej sumy - Špecifický symbol: Povinný č. Typ subjektu: Povinný má zákonného zástupcu (správcu): Povinný č.: Adresa, na ktorú sa má doručovať prednostne: IČO: Dátum narodenia: Rodné číslo: Rodné priezvisko: Meno: Titul pred: Priezvisko: Titul za: Obchodné meno: Trvalý pobyt / Pobyt / Miesto podnikania Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Adresa, na ktorú sa má doručovať prednostne Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Názov: Spor sa týka organizačnej zložky právnickej osoby: Adresa, na ktorú sa má doručovať prednostne: IČO: Iné identifikačné číslo: Adresa / sídlo Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Adresa, na ktorú sa má doručovať prednostne Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Adresa, na ktorú sa má doručovať prednostne: Názov: Označenie štátneho orgánu, alebo právnickej osoby, ktorý za štát koná: IČO: Adresa / sídlo Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Adresa, na ktorú sa má doručovať prednostne Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Zakonní zástupcovia Typ subjektu: Typ zákonného zástupcu (správcu): Dátum narodenia: Rodné priezvisko: Rodné číslo: Meno: Titul pred: Priezvisko: Titul za: Trvalý pobyt / Pobyt Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Názov: IČO: Iné identifikačné číslo: Adresa / sídlo zástupcu Štát: Ulica: PSČ: Obec: Obec: Súpisné číslo: Orientačné číslo: Kontaktné údaje Typ telefónu: Telefónne číslo: Email: Označenie elektronickej schránky: Druh exekučného titulu: Iný exekučný titul: Označenie exekučného titulu Orgán, ktorý exekučný titul vydal: Spisová značka/číslo konania: Dátum vydania: Dátum vykonateľnosti: Doplňujúce informácie: Peňažný nárok: Doplňujúce informácie o peňažnom nároku: Výška istiny: Jednotka meny: dátum: percentuálna sadzba: periodicita: suma: Jednotka meny: od: do: do: suma kapitalizovaných úrokov: dátum: percentuálna sadzba: % alebo ‰: periodicita: suma: Jednotka meny: od: do: do: suma kapitalizovaných úrokov z omeškania: dátum: sadzba: % alebo ‰: suma: Jednotka meny: od: do: do: suma kapitalizovaných poplatkov z omeškania: Druh pokuty: suma: Jednotka meny: dátum: percentuálna sadzba: periodicita: suma: Jednotka meny: od: do: do: Suma: Jednotka meny: Iné: Druh iné: suma: Jednotka meny: dátum: percentuálna sadzba: periodicita: suma: Jednotka meny: od: do: do: Zameškané výživné (ku dňu podania návrhu): Bežné výživné: Doplňujúce informácie o vyživovacej povinnosti: Popis: Peňažný nárok: Výška istiny: Jednotka meny: dátum: percentuálna sadzba: periodicita: suma: Jednotka meny: od: do: do: suma kapitalizovaných úrokov: dátum: percentuálna sadzba: % alebo ‰: periodicita: suma: Jednotka meny: od: do: do: suma kapitalizovaných úrokov z omeškania: dátum: sadzba: % alebo ‰: suma: Jednotka meny: od: do: do: suma kapitalizovaných poplatkov z omeškania: Druh pokuty: suma: Jednotka meny: dátum: percentuálna sadzba: periodicita: suma: Jednotka meny: od: do: do: Suma: Jednotka meny: Iné: Druh iné: suma: Jednotka meny: dátum: percentuálna sadzba: periodicita: suma: Jednotka meny: od: do: do: Súdny poplatok: Poplatok za konverziu: Trovy právneho zastúpenia (vrátane DPH): Výška trov za spísanie návrhu na vykonanie exekúcie u súdneho exekútora: Výška iných trov: Trovy celkom (vrátane DPH): Oslobodenie od súdneho poplatku: Dôvody: Uveďte podrobnosti: Uveďte podrobnosti: Uveďte podrobnosti: Uveďte podrobnosti: Uveďte podrobnosti: Opíšte skutočnosti, z ktorých právne nástupníctvo vyplýva. Listinné dôkazy pripojte ako prílohu.: Opíšte rozhodujúce skutočnosti a označte dôkazy týkajúce sa vlastného vzťahu s povinným. Listinné dôkazy pripojte ako prílohu.: Opíšte skutočnosti týkajúce sa splnenia podmienky alebo vzájomnej povinnosti a označte dôkazy. Listinné dôkazy pripojte ako prílohu.: Číslo OpP: Popis prílohy: Poradové číslo: Názov prílohy: Názov súboru prílohy: Spôsob doručenia: ÁnoÁnoNieNie", + language: "sk", + document_type: "CLS_F_XSLT_TXT_SGN" + } +] + +exe_related_documents.each do |related_document| + Upvs::FormTemplateRelatedDocument.find_or_create_by!( + upvs_form_template: exe_form_template, + data: related_document[:data], + language: related_document[:language], + document_type: related_document[:document_type] + ) +end + From b19df9d78753be7c9202df220fae04f812a61460 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Thu, 24 Aug 2023 14:54:46 +0200 Subject: [PATCH 21/34] Small refactoring & updates on form visualization --- app/controllers/message_drafts_controller.rb | 23 +++++++++++--------- app/jobs/drafts/load_content_job.rb | 6 +++++ app/lib/upvs/general_agenda_builder.rb | 14 +++++++++++- app/models/message_draft.rb | 10 ++++++--- app/models/message_object.rb | 2 ++ app/views/message_drafts/index.html.erb | 5 ++--- 6 files changed, 43 insertions(+), 17 deletions(-) diff --git a/app/controllers/message_drafts_controller.rb b/app/controllers/message_drafts_controller.rb index 7633442fe..2539c17ec 100644 --- a/app/controllers/message_drafts_controller.rb +++ b/app/controllers/message_drafts_controller.rb @@ -1,6 +1,6 @@ class MessageDraftsController < ApplicationController before_action :load_message_drafts, only: :index - before_action :set_message, only: :create + before_action :load_message, only: :create before_action :load_draft, except: [:index, :create] def index @@ -31,26 +31,29 @@ def update def submit authorize @message_draft - if @message_draft.submittable? - @message_draft.submit - redirect_to message_path(@message_draft.original_message), notice: "Správa bola zaradená na odoslanie." + if @message_draft.submit + redirect_path = if @message_draft.original_message.present? + message_path(@message_draft.original_message) + else + message_drafts_path + end + redirect_to redirect_path, notice: "Správa bola zaradená na odoslanie." else - # TODO prisposobit importovanym draftom + # TODO prisposobit chybovu hlasku aj importovanym draftom redirect_to message_draft_path(@message_draft), notice: "Vyplňte predmet a text odpovede." end end def submit_all - @message_drafts.each do |message_draft| - message_draft.submit if message_draft.submittable? - end + @message_drafts.each { |message_draft| message_draft.submit } end def destroy authorize @message_draft @message_draft.destroy - redirect_to (params[:redirect_url] || message_drafts_path) + + redirect_to (params[:redirect_url].presence || message_drafts_path) end private @@ -60,7 +63,7 @@ def load_message_drafts @message_drafts = policy_scope(MessageDraft) end - def set_message + def load_message @message = policy_scope(Message).find(params[:original_message_id]) end diff --git a/app/jobs/drafts/load_content_job.rb b/app/jobs/drafts/load_content_job.rb index 2c4ed3949..f1b263308 100644 --- a/app/jobs/drafts/load_content_job.rb +++ b/app/jobs/drafts/load_content_job.rb @@ -56,6 +56,7 @@ def form?(message_draft, file_name) def save_form_visualisation(message_draft) upvs_form_template = Upvs::FormTemplate.find_by(identifier: message_draft.metadata["posp_id"], version: message_draft.metadata["posp_version"]) upvs_form_template_xslt_html = upvs_form_template&.xslt_html + raise MissingFormTemplateError.new unless upvs_form_template_xslt_html xslt_template = Nokogiri::XSLT(upvs_form_template_xslt_html) @@ -69,6 +70,11 @@ def save_form_visualisation(message_draft) message_draft.update( html_visualization: xslt_template.transform(Nokogiri::XML(message_draft.form.message_object_datum.blob)).to_s.gsub('"', '\'') ) + + if message_draft.custom_visualization? + message_draft.metadata["message_body"] = Upvs::GeneralAgendaBuilder.parse_text(message_draft.form.message_object_datum.blob) + message_draft.save! + end end end diff --git a/app/lib/upvs/general_agenda_builder.rb b/app/lib/upvs/general_agenda_builder.rb index db69ece58..6933c2d09 100644 --- a/app/lib/upvs/general_agenda_builder.rb +++ b/app/lib/upvs/general_agenda_builder.rb @@ -9,4 +9,16 @@ def self.build_xml(subject:, body:) GENERAL_AGENDA end -end \ No newline at end of file + + def self.parse_text(general_agenda_xml) + general_agenda_xml = delete_extra_whitespaces(general_agenda_xml) + xml_doc = Nokogiri::XML(general_agenda_xml) + xml_doc.at('text').text + end + + private + + def self.delete_extra_whitespaces(xml) + xml.gsub(/\\n/, '').gsub(/>\s*/, ">").gsub(/\s* { where(to_be_signed: true) } + def self.create_message_objects(message, objects) objects.each do |raw_object| message_object = MessageObject.create!( diff --git a/app/views/message_drafts/index.html.erb b/app/views/message_drafts/index.html.erb index 780c702fd..46f81f7a8 100644 --- a/app/views/message_drafts/index.html.erb +++ b/app/views/message_drafts/index.html.erb @@ -17,9 +17,8 @@ <% @message_drafts.each do |message_draft| %> - - <%= message_draft.title %> - <%= " #{message_draft&.import&.base_name || '-'}" %> + <%= link_to message_draft.title, message_draft_path(message_draft.id) %> + <%= " #{message_draft.import&.base_name || '-'}" %> <%= " #{message_draft.metadata["status"]}" %> <% end %> From 31d312dea691ec10fc9a1398fcd1ab49f7061ecd Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Wed, 30 Aug 2023 14:43:31 +0200 Subject: [PATCH 22/34] Add submit_all option to hromadne podania --- app/controllers/message_drafts_controller.rb | 4 ++-- app/models/message_draft.rb | 2 ++ app/policies/message_draft_policy.rb | 4 ++++ app/views/message_drafts/index.html.erb | 4 ++++ config/routes.rb | 2 ++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/controllers/message_drafts_controller.rb b/app/controllers/message_drafts_controller.rb index 2539c17ec..212489cd4 100644 --- a/app/controllers/message_drafts_controller.rb +++ b/app/controllers/message_drafts_controller.rb @@ -1,7 +1,7 @@ class MessageDraftsController < ApplicationController - before_action :load_message_drafts, only: :index + before_action :load_message_drafts, only: [:index, :submit_all] before_action :load_message, only: :create - before_action :load_draft, except: [:index, :create] + before_action :load_draft, except: [:index, :create, :submit_all] def index @message_drafts = @message_drafts.order(created_at: :desc) diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index a92fe233d..1e140ca7b 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -1,4 +1,6 @@ class MessageDraft < Message + after_destroy { self.thread.destroy! if self.thread.messages.none? } + GENERAL_AGENDA_POSP_ID ||= "App.GeneralAgenda" GENERAL_AGENDA_POSP_VERSION ||= "1.9" GENERAL_AGENDA_MESSAGE_TYPE ||= "App.GeneralAgenda" diff --git a/app/policies/message_draft_policy.rb b/app/policies/message_draft_policy.rb index 82f8205a4..347f1f51c 100644 --- a/app/policies/message_draft_policy.rb +++ b/app/policies/message_draft_policy.rb @@ -55,6 +55,10 @@ def submit? create? end + def submit_all? + submit? + end + def destroy? create? end diff --git a/app/views/message_drafts/index.html.erb b/app/views/message_drafts/index.html.erb index 46f81f7a8..cfe45cab6 100644 --- a/app/views/message_drafts/index.html.erb +++ b/app/views/message_drafts/index.html.erb @@ -24,4 +24,8 @@ <% end %>
    + + <% if @message_drafts.any?(&:submittable?) %> + <%= button_to "Podať všetky", submit_all_message_drafts_path, method: :post %> + <% end %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 4ce23ec1a..e6e3818cc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -56,6 +56,8 @@ member do post 'submit' end + + post 'submit_all', on: :collection end resources :messages_tags From f4b808dac24e284c7965effedf53e0514b7fdcfe Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Wed, 30 Aug 2023 14:46:57 +0200 Subject: [PATCH 23/34] Fix destroyable? condition in MessageObjects --- app/models/message_object.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/message_object.rb b/app/models/message_object.rb index 1a240ba31..6d7fe1baf 100644 --- a/app/models/message_object.rb +++ b/app/models/message_object.rb @@ -40,6 +40,6 @@ def form? end def destroyable? - message.is_a?(MessageDraft) && !form? + message.is_a?(MessageDraft) && message.not_yet_submitted? && !form? end end From 2b62afbd8cbc914867a0bcacd46f9ec2d483a23d Mon Sep 17 00:00:00 2001 From: stage-rl Date: Mon, 4 Sep 2023 17:04:33 +0200 Subject: [PATCH 24/34] Remove unused code from unused nested form concept --- app/models/settings/rules/action_form.rb | 26 ------------------ app/models/settings/rules/condition_form.rb | 27 ------------------- app/models/settings/rules/rule_form.rb | 30 --------------------- 3 files changed, 83 deletions(-) delete mode 100644 app/models/settings/rules/action_form.rb delete mode 100644 app/models/settings/rules/condition_form.rb delete mode 100644 app/models/settings/rules/rule_form.rb diff --git a/app/models/settings/rules/action_form.rb b/app/models/settings/rules/action_form.rb deleted file mode 100644 index 3169f1708..000000000 --- a/app/models/settings/rules/action_form.rb +++ /dev/null @@ -1,26 +0,0 @@ -module Settings - module Rules - class ActionForm - include ActiveModel::Model - include ActiveModel::Serializers::JSON - - attr_accessor :id, :type, :attr, :value, :rule_form - - validates_presence_of :id, message: 'Zadajte', on: :id - validates_presence_of :type, message: 'Zadajte', on: :type - validates_presence_of :attr, message: 'Zadajte', on: :attr - validates_presence_of :value, message: 'Zadajte', on: :value - def attributes=(hash) - hash.each { |key, value| send("#{key}=", value) } - end - - def persisted? - @id ? true: false - end - - def attributes - { id: nil, attr: nil, type: nil, value: nil, rule_form: nil } - end - end - end -end diff --git a/app/models/settings/rules/condition_form.rb b/app/models/settings/rules/condition_form.rb deleted file mode 100644 index 629223187..000000000 --- a/app/models/settings/rules/condition_form.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Settings - module Rules - class ConditionForm - include ActiveModel::Model - include ActiveModel::Serializers::JSON - - attr_accessor :id, :attr, :type, :value, :rule_form - - validates_presence_of :id, message: 'Zadajte', on: :id - validates_presence_of :attr, message: 'Zadajte', on: :attr - validates_presence_of :type, message: 'Zadajte', on: :type - validates_presence_of :value, message: 'Zadajte', on: :value - - def attributes=(hash) - hash.each { |key, value| send("#{key}=", value) } - end - - def persisted? - @id ? true: false - end - - def attributes - { id: nil, attr: nil, type: nil, value: nil, rule_form: nil } - end - end - end -end diff --git a/app/models/settings/rules/rule_form.rb b/app/models/settings/rules/rule_form.rb deleted file mode 100644 index 9d96dbb69..000000000 --- a/app/models/settings/rules/rule_form.rb +++ /dev/null @@ -1,30 +0,0 @@ -module Settings - module Rules - class RuleForm - include ActiveModel::Model - include ActiveModel::Serializers::JSON - - attr_accessor :id, :name, :trigger_event, :condition_forms, :action_forms - - validates_presence_of :name, message: 'Zadajte', on: :name - validates_presence_of :trigger_event, message: 'Zadajte', on: :trigger_event - def attributes=(hash) - hash.each { |key, value| send("#{key}=", value) } - end - - def initialize(attributes = {}) - super - @condition_forms ||= [] - @action_forms ||= [] - end - - def persisted? - @id ? true : false - end - - def attributes - { id: nil, name: nil, trigger_event: nil, condition_forms: nil, action_forms: nil } - end - end - end -end From a3097243141b7b7b09cf26eac3bf7e0fc95b9131 Mon Sep 17 00:00:00 2001 From: stage-rl Date: Tue, 5 Sep 2023 08:52:06 +0200 Subject: [PATCH 25/34] PR review minor refactors --- .../settings/rules/condition_form_component.rb | 10 ++-------- .../settings/automation_actions_controller.rb | 2 +- .../settings/automation_conditions_controller.rb | 2 +- app/models/automation/condition.rb | 2 ++ app/policies/settings/automation_rule_policy.rb | 4 ++++ ...dit.turbo_stream.erb => edit_form.turbo_stream.erb} | 0 ...dit.turbo_stream.erb => edit_form.turbo_stream.erb} | 0 config/routes.rb | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) rename app/views/settings/automation_actions/{edit.turbo_stream.erb => edit_form.turbo_stream.erb} (100%) rename app/views/settings/automation_conditions/{edit.turbo_stream.erb => edit_form.turbo_stream.erb} (100%) diff --git a/app/components/settings/rules/condition_form_component.rb b/app/components/settings/rules/condition_form_component.rb index f3c677b6a..887d1e842 100644 --- a/app/components/settings/rules/condition_form_component.rb +++ b/app/components/settings/rules/condition_form_component.rb @@ -9,12 +9,6 @@ def initialize(form:, index:, enabled: true) def before_render @condition_type_list = Automation::Condition.subclasses.map { |subclass| [t(subclass.name), subclass.name] } - # TODO: Toto som chcel vytiahnut ako ENUM, nepodarilo sa - @attr_list = [ - [t('sender_name'), 'sender_name'], - [t('recipient_name'), 'recipient_name'], - [t('sender_uri'), 'sender_uri'], - [t('recipient_uri'), 'recipient_uri'] - ] + @attr_list = Automation::Condition::ATTR_LIST.map { |attr| [t(attr), attr] } end -end +end \ No newline at end of file diff --git a/app/controllers/settings/automation_actions_controller.rb b/app/controllers/settings/automation_actions_controller.rb index 297319043..63af552f8 100644 --- a/app/controllers/settings/automation_actions_controller.rb +++ b/app/controllers/settings/automation_actions_controller.rb @@ -5,7 +5,7 @@ def create authorize @automation_rule, policy_class: Settings::AutomationRulePolicy end - def edit + def edit_form authorize @automation_rule, policy_class: Settings::AutomationRulePolicy end diff --git a/app/controllers/settings/automation_conditions_controller.rb b/app/controllers/settings/automation_conditions_controller.rb index bf6305297..44413d519 100644 --- a/app/controllers/settings/automation_conditions_controller.rb +++ b/app/controllers/settings/automation_conditions_controller.rb @@ -5,7 +5,7 @@ def create authorize @automation_rule, policy_class: Settings::AutomationRulePolicy end - def edit + def edit_form authorize @automation_rule, policy_class: Settings::AutomationRulePolicy end diff --git a/app/models/automation/condition.rb b/app/models/automation/condition.rb index b60f81916..940dbb3cc 100644 --- a/app/models/automation/condition.rb +++ b/app/models/automation/condition.rb @@ -5,6 +5,8 @@ class Condition < ApplicationRecord attr_accessor :delete_record # neviem ich z kodu vylistovat, vid conditions_form_component.rb # enum attr: %i[sender_name recipient_name title sender_uri recipient_uri] + + ATTR_LIST = %i[sender_name recipient_name title sender_uri recipient_uri] end class ContainsCondition < Automation::Condition diff --git a/app/policies/settings/automation_rule_policy.rb b/app/policies/settings/automation_rule_policy.rb index f8257022f..8a48afd7c 100644 --- a/app/policies/settings/automation_rule_policy.rb +++ b/app/policies/settings/automation_rule_policy.rb @@ -48,6 +48,10 @@ def actions_step? true end + def edit_form? + true + end + def destroy? true end diff --git a/app/views/settings/automation_actions/edit.turbo_stream.erb b/app/views/settings/automation_actions/edit_form.turbo_stream.erb similarity index 100% rename from app/views/settings/automation_actions/edit.turbo_stream.erb rename to app/views/settings/automation_actions/edit_form.turbo_stream.erb diff --git a/app/views/settings/automation_conditions/edit.turbo_stream.erb b/app/views/settings/automation_conditions/edit_form.turbo_stream.erb similarity index 100% rename from app/views/settings/automation_conditions/edit.turbo_stream.erb rename to app/views/settings/automation_conditions/edit_form.turbo_stream.erb diff --git a/config/routes.rb b/config/routes.rb index c0d25cc0a..f9e812d90 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,10 +12,10 @@ patch 'actions_step' end resources :automation_conditions, param: :index do - post '/', to: 'automation_conditions#edit', on: :member + post '/', to: 'automation_conditions#edit_form', on: :member end resources :automation_actions, param: :index do - post '/', to: 'automation_actions#edit', on: :member + post '/', to: 'automation_actions#edit_form', on: :member end resources :tags resource :profile From 5cad40585204bcac786faca979c8f990d065410c Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 5 Sep 2023 11:56:39 +0200 Subject: [PATCH 26/34] Small after review changes --- app/components/message_drafts_component.html.erb | 2 +- app/controllers/message_drafts_controller.rb | 12 +++++------- app/models/message_draft.rb | 7 ++++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/components/message_drafts_component.html.erb b/app/components/message_drafts_component.html.erb index 9d43858d5..eb6b81510 100644 --- a/app/components/message_drafts_component.html.erb +++ b/app/components/message_drafts_component.html.erb @@ -84,7 +84,7 @@ <% end %>
    - <%= button_to message_draft_path(@message), method: :delete, params: { redirect_url: (message_path(@message.original_message) if @message.original_message || nil) }, class: "flex justify-strech items-start self-stretch flex-grow-0 flex-shrink-0 gap-2 p-6 rounded-lg border border-gray-400 px-3.5 py-2.5 hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 rounded-lg", title: "Zahodiť draft" do %> + <%= button_to message_draft_path(@message), method: :delete, class: "flex justify-strech items-start self-stretch flex-grow-0 flex-shrink-0 gap-2 p-6 rounded-lg border border-gray-400 px-3.5 py-2.5 hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 rounded-lg", title: "Zahodiť draft" do %> diff --git a/app/controllers/message_drafts_controller.rb b/app/controllers/message_drafts_controller.rb index 212489cd4..49a1f5f16 100644 --- a/app/controllers/message_drafts_controller.rb +++ b/app/controllers/message_drafts_controller.rb @@ -32,11 +32,7 @@ def submit authorize @message_draft if @message_draft.submit - redirect_path = if @message_draft.original_message.present? - message_path(@message_draft.original_message) - else - message_drafts_path - end + redirect_path = @message_draft.original_message.present? ? message_path(@message_draft.original_message) : message_drafts_path redirect_to redirect_path, notice: "Správa bola zaradená na odoslanie." else # TODO prisposobit chybovu hlasku aj importovanym draftom @@ -45,15 +41,17 @@ def submit end def submit_all - @message_drafts.each { |message_draft| message_draft.submit } + @message_drafts.each(&:submit) end def destroy authorize @message_draft + redirect_path = @message_draft.original_message.present? ? message_path(@message_draft.original_message) : message_drafts_path + @message_draft.destroy - redirect_to (params[:redirect_url].presence || message_drafts_path) + redirect_to redirect_path end private diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index 1e140ca7b..de0f6b796 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -1,9 +1,9 @@ class MessageDraft < Message after_destroy { self.thread.destroy! if self.thread.messages.none? } - GENERAL_AGENDA_POSP_ID ||= "App.GeneralAgenda" - GENERAL_AGENDA_POSP_VERSION ||= "1.9" - GENERAL_AGENDA_MESSAGE_TYPE ||= "App.GeneralAgenda" + GENERAL_AGENDA_POSP_ID = "App.GeneralAgenda" + GENERAL_AGENDA_POSP_VERSION = "1.9" + GENERAL_AGENDA_MESSAGE_TYPE = "App.GeneralAgenda" with_options on: :validate_data do |message_draft| message_draft.validates :uuid, format: { with: Utils::UUID_PATTERN }, allow_blank: false @@ -49,6 +49,7 @@ def update_content(title:, body:) return unless title.present? && body.present? + # TODO clean the domain (no UPVS stuff) if form form.message_object_datum.update( blob: Upvs::GeneralAgendaBuilder.build_xml(subject: title, body: body) From e9c1b01c78739f8daa7b81e801cd57b5a8c431c5 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 5 Sep 2023 11:58:12 +0200 Subject: [PATCH 27/34] Add import reference to messages --- app/jobs/drafts/parse_import_job.rb | 6 +++--- app/models/message.rb | 3 ++- app/models/message_draft.rb | 6 ++---- app/models/message_drafts_import.rb | 7 +------ db/migrate/20230904194828_add_import_id_to_messages.rb | 5 +++++ db/schema.rb | 5 ++++- 6 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 db/migrate/20230904194828_add_import_id_to_messages.rb diff --git a/app/jobs/drafts/parse_import_job.rb b/app/jobs/drafts/parse_import_job.rb index d306fc25c..40680da35 100644 --- a/app/jobs/drafts/parse_import_job.rb +++ b/app/jobs/drafts/parse_import_job.rb @@ -21,7 +21,7 @@ def perform(import, import_zip_path, jobs_batch: GoodJob::Batch.new, load_conten Dir.each_child(extracted_import_path) do |entry_name| if File.directory?(File.join(extracted_import_path, entry_name)) - message_draft = MessageDraft.where("metadata ->> 'import_id' = ?", import.id.to_s).where("metadata ->> 'import_subfolder' = ?", File.basename(entry_name)).take + message_draft = MessageDraft.where(import: import).where("metadata ->> 'import_subfolder' = ?", File.basename(entry_name)).take unless message_draft MessageDraft.create( @@ -31,8 +31,8 @@ def perform(import, import_zip_path, jobs_batch: GoodJob::Batch.new, load_conten replyable: false, read: true, delivered_at: Time.now, + import: import, metadata: { - "import_id": import.id, "import_subfolder": File.basename(entry_name), "status": "being_loaded" } @@ -90,6 +90,7 @@ def load_import_csv(import, csv_path) replyable: false, read: true, delivered_at: Time.now, + import: import, metadata: { "recipient_uri": row['recipient_uri'], "posp_id": row['posp_id'], @@ -98,7 +99,6 @@ def load_import_csv(import, csv_path) "correlation_id": uuid, "sender_business_reference": row['sender_business_reference'], "recipient_business_reference": row['recipient_business_reference'], - "import_id": import.id, "import_subfolder": row['subfolder'], "status": "being_loaded" } diff --git a/app/models/message.rb b/app/models/message.rb index c2f3226b2..b5cef1e52 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -13,12 +13,13 @@ # read :boolean not null, default: false # replyable :boolean not null, default: true # delivered_at :datetime not null +# import_id :integer # created_at :datetime not null # updated_at :datetime not null class Message < ApplicationRecord has_and_belongs_to_many :tags - belongs_to :thread, class_name: 'MessageThread', foreign_key: 'message_thread_id' + belongs_to :thread, class_name: 'MessageThread', foreign_key: :message_thread_id has_many :objects, class_name: 'MessageObject', dependent: :destroy delegate :tenant, to: :thread after_create_commit ->(message) { EventBus.publish(:message_created, message) } diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index de0f6b796..98ba6a786 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -1,4 +1,6 @@ class MessageDraft < Message + belongs_to :import, class_name: 'MessageDraftsImport', foreign_key: :import_id, optional: true + after_destroy { self.thread.destroy! if self.thread.messages.none? } GENERAL_AGENDA_POSP_ID = "App.GeneralAgenda" @@ -74,10 +76,6 @@ def form objects.select { |o| o.form? }&.first end - def import - MessageDraftsImport.find(metadata["import_id"]) if metadata["import_id"] - end - def editable? metadata["posp_id"] == GENERAL_AGENDA_POSP_ID && !form&.is_signed? && not_yet_submitted? end diff --git a/app/models/message_drafts_import.rb b/app/models/message_drafts_import.rb index 641d975c6..3c30fc607 100644 --- a/app/models/message_drafts_import.rb +++ b/app/models/message_drafts_import.rb @@ -11,17 +11,12 @@ class MessageDraftsImport < ApplicationRecord belongs_to :box, class_name: 'Box' - - after_destroy_commit { MessageDraft.where("metadata ->> 'import_subfolder' = ?", id.to_s).destroy_all } + has_many :message_drafts, foreign_key: :import_id, dependent: :destroy validates_with MessageDraftsImportValidator, if: :content_path enum status: { uploaded: 0, parsed: 1, parsing_failed: 2 } - def message_drafts - MessageDraft.where("metadata ->> 'import_id' = ?", id.to_s) - end - def base_name name.split('_', 2).last end diff --git a/db/migrate/20230904194828_add_import_id_to_messages.rb b/db/migrate/20230904194828_add_import_id_to_messages.rb new file mode 100644 index 000000000..7fb720ce6 --- /dev/null +++ b/db/migrate/20230904194828_add_import_id_to_messages.rb @@ -0,0 +1,5 @@ +class AddImportIdToMessages < ActiveRecord::Migration[7.0] + def change + add_reference :messages, :import, null: true, foreign_key: { to_table: :message_drafts_imports } + end +end diff --git a/db/schema.rb b/db/schema.rb index ecee7ea7a..5691b8fe1 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[7.0].define(version: 2023_08_23_200907) do +ActiveRecord::Schema[7.0].define(version: 2023_09_04_194828) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -299,6 +299,8 @@ t.json "metadata" t.string "type" t.boolean "replyable", default: true, null: false + t.bigint "import_id" + t.index ["import_id"], name: "index_messages_on_import_id" t.index ["message_thread_id"], name: "index_messages_on_message_thread_id" end @@ -396,6 +398,7 @@ add_foreign_key "message_threads", "folders" add_foreign_key "message_threads_tags", "message_threads" add_foreign_key "message_threads_tags", "tags" + add_foreign_key "messages", "message_drafts_imports", column: "import_id" add_foreign_key "messages", "message_threads" add_foreign_key "messages_tags", "messages" add_foreign_key "messages_tags", "tags" From 34f964b02bd69313475b39a09900fe78a5aad7d6 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 5 Sep 2023 11:58:33 +0200 Subject: [PATCH 28/34] Updtae MessageDraftPolicy --- app/policies/message_draft_policy.rb | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/app/policies/message_draft_policy.rb b/app/policies/message_draft_policy.rb index 347f1f51c..eeb58878c 100644 --- a/app/policies/message_draft_policy.rb +++ b/app/policies/message_draft_policy.rb @@ -12,6 +12,7 @@ class Scope < Scope def resolve return scope.all if @user.site_admin? + # TODO: this does not work for imported drafts (no tags present) scope.where( MessageThreadsTag .select(1) @@ -21,18 +22,6 @@ def resolve .arel.exists ) end - - def resolve_index - scope.where( - 'import_id in ( - select imports.id - from drafts_imports imports - join boxes on boxes.id = imports.box_id - join tenants on tenants.id = boxes.tenant_id - where tenant_id = ?)', - @user.tenant_id - ) - end end def index? From 264e002d121dd5a0c3028c43278387d6092ddd86 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 5 Sep 2023 18:54:13 +0200 Subject: [PATCH 29/34] Add author reference to messages --- .../layout/message_thread_sidebar_component.rb | 2 +- app/controllers/message_drafts_controller.rb | 2 +- app/controllers/message_threads_controller.rb | 4 ++-- app/models/message.rb | 3 +++ app/models/message_draft.rb | 17 +++++++++-------- app/models/message_thread.rb | 4 ++++ app/models/user.rb | 1 + app/policies/message_draft_policy.rb | 2 +- .../20230905100110_add_author_id_to_messages.rb | 5 +++++ db/schema.rb | 5 ++++- 10 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20230905100110_add_author_id_to_messages.rb diff --git a/app/components/layout/message_thread_sidebar_component.rb b/app/components/layout/message_thread_sidebar_component.rb index f83007156..b43107aa0 100644 --- a/app/components/layout/message_thread_sidebar_component.rb +++ b/app/components/layout/message_thread_sidebar_component.rb @@ -1,6 +1,6 @@ class Layout::MessageThreadSidebarComponent < ViewComponent::Base def initialize(message:) @selected_message = message - @thread_messages = @selected_message.thread.messages.order(delivered_at: :asc) + @thread_messages = @selected_message.thread.messages_visible_to_user(Current.user).order(delivered_at: :asc) end end diff --git a/app/controllers/message_drafts_controller.rb b/app/controllers/message_drafts_controller.rb index 49a1f5f16..de7107105 100644 --- a/app/controllers/message_drafts_controller.rb +++ b/app/controllers/message_drafts_controller.rb @@ -10,7 +10,7 @@ def index def create authorize @message - @message_draft = MessageDraft.create_message_reply(@message) + @message_draft = MessageDraft.create_message_reply(original_message: @message, author: Current.user) redirect_to message_draft_path(@message_draft) end diff --git a/app/controllers/message_threads_controller.rb b/app/controllers/message_threads_controller.rb index 20268e534..5750dfba4 100644 --- a/app/controllers/message_threads_controller.rb +++ b/app/controllers/message_threads_controller.rb @@ -3,8 +3,8 @@ class MessageThreadsController < ApplicationController def show authorize @message_thread - redirect_to @message_thread.messages.where(read: false).order(delivered_at: :asc).first || - @message_thread.messages.order(delivered_at: :desc).first + + redirect_to @message_thread.messages.where(read: false).order(delivered_at: :asc).first || @message_thread.messages_visible_to_user(Current.user).order(delivered_at: :desc).first end def update diff --git a/app/models/message.rb b/app/models/message.rb index b5cef1e52..bb0e661e2 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -14,14 +14,17 @@ # replyable :boolean not null, default: true # delivered_at :datetime not null # import_id :integer +# author_id :integer # created_at :datetime not null # updated_at :datetime not null class Message < ApplicationRecord has_and_belongs_to_many :tags belongs_to :thread, class_name: 'MessageThread', foreign_key: :message_thread_id + belongs_to :author, class_name: 'User', foreign_key: :author_id has_many :objects, class_name: 'MessageObject', dependent: :destroy delegate :tenant, to: :thread + after_create_commit ->(message) { EventBus.publish(:message_created, message) } def automation_rules_for_event(event) diff --git a/app/models/message_draft.rb b/app/models/message_draft.rb index 98ba6a786..cfbf64429 100644 --- a/app/models/message_draft.rb +++ b/app/models/message_draft.rb @@ -14,22 +14,23 @@ class MessageDraft < Message message_draft.validate :validate_objects end - def self.create_message_reply(message) + def self.create_message_reply(original_message: , author:) MessageDraft.create!( uuid: SecureRandom.uuid, - thread: message.thread, - sender_name: message.recipient_name, - recipient_name: message.sender_name, + thread: original_message.thread, + sender_name: original_message.recipient_name, + recipient_name: original_message.sender_name, read: true, delivered_at: Time.now, + author: author, metadata: { - "recipient_uri": message.metadata["sender_uri"], + "recipient_uri": original_message.metadata["sender_uri"], "posp_id": GENERAL_AGENDA_POSP_ID, "posp_version": GENERAL_AGENDA_POSP_VERSION, "message_type": GENERAL_AGENDA_MESSAGE_TYPE, - "correlation_id": message.metadata["correlation_id"], - "reference_id": message.uuid, - "original_message_id": message.id, + "correlation_id": original_message.metadata["correlation_id"], + "reference_id": original_message.uuid, + "original_message_id": original_message.id, "status": "created" } ) diff --git a/app/models/message_thread.rb b/app/models/message_thread.rb index e9960818e..060cbd0ed 100644 --- a/app/models/message_thread.rb +++ b/app/models/message_thread.rb @@ -30,6 +30,10 @@ def read? messages.all?(&:read) end + def messages_visible_to_user(user) + messages.where(messages: { author_id: user.id }).or(messages.where(messages: { author_id: nil })) + end + def automation_rules_for_event(event) folder.tenant.automation_rules.where(trigger_event: event) end diff --git a/app/models/user.rb b/app/models/user.rb index 1e884b4a7..cbc5287f8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -16,6 +16,7 @@ class User < ApplicationRecord has_many :tag_users, dependent: :destroy has_many :tags, through: :tag_users has_many :own_tags, class_name: 'Tag', foreign_key: 'user_id', inverse_of: :owner + has_many :message_drafts, foreign_key: :author_id has_many :automation_rules, class_name: 'Automation::Rule' validates_presence_of :name, :email diff --git a/app/policies/message_draft_policy.rb b/app/policies/message_draft_policy.rb index eeb58878c..ceaedfd3f 100644 --- a/app/policies/message_draft_policy.rb +++ b/app/policies/message_draft_policy.rb @@ -13,7 +13,7 @@ def resolve return scope.all if @user.site_admin? # TODO: this does not work for imported drafts (no tags present) - scope.where( + scope.where(author_id: @user.id).where( MessageThreadsTag .select(1) .joins(tag_groups: :group_memberships) diff --git a/db/migrate/20230905100110_add_author_id_to_messages.rb b/db/migrate/20230905100110_add_author_id_to_messages.rb new file mode 100644 index 000000000..638b239d0 --- /dev/null +++ b/db/migrate/20230905100110_add_author_id_to_messages.rb @@ -0,0 +1,5 @@ +class AddAuthorIdToMessages < ActiveRecord::Migration[7.0] + def change + add_reference :messages, :author, null: true, foreign_key: { to_table: :users } + end +end diff --git a/db/schema.rb b/db/schema.rb index 5691b8fe1..a15fa814d 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[7.0].define(version: 2023_09_04_194828) do +ActiveRecord::Schema[7.0].define(version: 2023_09_05_100110) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -300,6 +300,8 @@ t.string "type" t.boolean "replyable", default: true, null: false t.bigint "import_id" + t.bigint "author_id" + t.index ["author_id"], name: "index_messages_on_author_id" t.index ["import_id"], name: "index_messages_on_import_id" t.index ["message_thread_id"], name: "index_messages_on_message_thread_id" end @@ -400,6 +402,7 @@ add_foreign_key "message_threads_tags", "tags" add_foreign_key "messages", "message_drafts_imports", column: "import_id" add_foreign_key "messages", "message_threads" + add_foreign_key "messages", "users", column: "author_id" add_foreign_key "messages_tags", "messages" add_foreign_key "messages_tags", "tags" add_foreign_key "tag_groups", "groups" From 6765231ed6f59b4bd3a7de6b08be813700b22980 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Tue, 5 Sep 2023 19:03:38 +0200 Subject: [PATCH 30/34] Add optional parameter to author reference in messages --- app/models/message.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/message.rb b/app/models/message.rb index bb0e661e2..38fe8a167 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -21,7 +21,7 @@ class Message < ApplicationRecord has_and_belongs_to_many :tags belongs_to :thread, class_name: 'MessageThread', foreign_key: :message_thread_id - belongs_to :author, class_name: 'User', foreign_key: :author_id + belongs_to :author, class_name: 'User', foreign_key: :author_id, optional: true has_many :objects, class_name: 'MessageObject', dependent: :destroy delegate :tenant, to: :thread From b414f72fec4dc490cea716fbe89bbeae02164a45 Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Thu, 7 Sep 2023 14:43:37 +0200 Subject: [PATCH 31/34] Add syncable flag to boxes --- app/jobs/govbox/sync_all_boxes_job.rb | 2 +- app/models/box.rb | 1 + db/migrate/20230907123137_add_syncable_flag_to_boxes.rb | 5 +++++ db/schema.rb | 3 ++- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20230907123137_add_syncable_flag_to_boxes.rb diff --git a/app/jobs/govbox/sync_all_boxes_job.rb b/app/jobs/govbox/sync_all_boxes_job.rb index 98e8b970d..201047ccf 100644 --- a/app/jobs/govbox/sync_all_boxes_job.rb +++ b/app/jobs/govbox/sync_all_boxes_job.rb @@ -4,7 +4,7 @@ class SyncAllBoxesJob < ApplicationJob def perform Box.find_each do |box| - SyncBoxJob.perform_later(box) + SyncBoxJob.perform_later(box) if box.syncable? end end end diff --git a/app/models/box.rb b/app/models/box.rb index 8f017d420..bf6c09b44 100644 --- a/app/models/box.rb +++ b/app/models/box.rb @@ -6,6 +6,7 @@ # tenant_id :integer not null # name :string not null # uri :string +# syncable :boolean not null, default: true # created_at :datetime not null # updated_at :datetime not null diff --git a/db/migrate/20230907123137_add_syncable_flag_to_boxes.rb b/db/migrate/20230907123137_add_syncable_flag_to_boxes.rb new file mode 100644 index 000000000..2cf099b37 --- /dev/null +++ b/db/migrate/20230907123137_add_syncable_flag_to_boxes.rb @@ -0,0 +1,5 @@ +class AddSyncableFlagToBoxes < ActiveRecord::Migration[7.0] + def change + add_column :boxes, :syncable, :boolean, null: false, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index a15fa814d..1e796c945 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[7.0].define(version: 2023_09_05_100110) do +ActiveRecord::Schema[7.0].define(version: 2023_09_07_123137) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -83,6 +83,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.bigint "tenant_id", null: false + t.boolean "syncable", default: true, null: false t.index ["tenant_id"], name: "index_boxes_on_tenant_id" end From 8bb82293eeffba36178a83b145b8c38948c5068f Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Fri, 8 Sep 2023 08:45:52 +0200 Subject: [PATCH 32/34] Update Govbox::SyncAllBoxesJob --- app/jobs/govbox/sync_all_boxes_job.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/govbox/sync_all_boxes_job.rb b/app/jobs/govbox/sync_all_boxes_job.rb index 201047ccf..153f4ee38 100644 --- a/app/jobs/govbox/sync_all_boxes_job.rb +++ b/app/jobs/govbox/sync_all_boxes_job.rb @@ -3,8 +3,8 @@ class SyncAllBoxesJob < ApplicationJob queue_as :default def perform - Box.find_each do |box| - SyncBoxJob.perform_later(box) if box.syncable? + Box.where(syncable: true).find_each do |box| + SyncBoxJob.perform_later(box) end end end From 6faf3cb1a5932f51d815075a7e54e9087e16f9bc Mon Sep 17 00:00:00 2001 From: luciajanikova <19lucia99@gmail.com> Date: Fri, 8 Sep 2023 08:56:10 +0200 Subject: [PATCH 33/34] Do not run Govbox::SyncBoxJob unless syncable box --- app/jobs/govbox/sync_box_job.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/jobs/govbox/sync_box_job.rb b/app/jobs/govbox/sync_box_job.rb index 767a79aa1..f81c7d460 100644 --- a/app/jobs/govbox/sync_box_job.rb +++ b/app/jobs/govbox/sync_box_job.rb @@ -3,6 +3,8 @@ class SyncBoxJob < ApplicationJob queue_as :default def perform(box, upvs_client: UpvsEnvironment.upvs_client) + return unless box.syncable? + edesk_api = upvs_client.api(box).edesk response_status, raw_folders = edesk_api.fetch_folders From 1ae4e775475d6c286236c9f0f8f94757df0b5823 Mon Sep 17 00:00:00 2001 From: stage-rl Date: Fri, 8 Sep 2023 11:08:27 +0200 Subject: [PATCH 34/34] Fix schema.rb --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 27dcc7253..1af7e4624 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[7.0].define(version: 2023_08_18_084605) do +ActiveRecord::Schema[7.0].define(version: 2023_09_07_123137) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql"