Skip to content

Commit

Permalink
Merge branch 'main' into GO-370/attachment_search_rule
Browse files Browse the repository at this point in the history
  • Loading branch information
stage-rl committed Jul 14, 2024
2 parents 6b4b349 + 63dc9b4 commit fff71f3
Show file tree
Hide file tree
Showing 165 changed files with 19,015 additions and 567 deletions.
9 changes: 8 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=
ARCHIVER_API_URL=
GB_API_ENV=
GB_API_URL=
FORMS_STORAGE_API_URL=
FS_API_URL=
FS_FORMS_STORAGE_API_URL=
UPVS_FORMS_STORAGE_API_URL=
SITE_ADMIN_EMAILS=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
Expand All @@ -12,6 +17,8 @@ DB_HOST=
DB_USER=
DB_PASSWORD=
AUTO_SYNC_BOXES= # ON / OFF, default OFF
AUTO_SYNC_FS_FORMS= # ON / OFF, default OFF
AUTO_SYNC_UPVS_FORMS= # ON / OFF, default OFF
UPVS_SSO_SUBJECT=
UPVS_SSO_SP_CERTIFICATE=
UPVS_SSO_SP_PRIVATE_KEY=
Expand Down
3 changes: 3 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ OTXaz3Sj7jrQYJF2kB3lEKQXNbjFWEJp2Iwpdx6/wn732pINEbM0BAOVv5hd5/QE
s6yae9EqoPi5FbsEUtc08tcSz2RYyN2VQOMwpXaIDSiQC9zGUcGPp40iUhClac41
ZwIDAQAB
-----END PUBLIC KEY-----"
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=1
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=2
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=3
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0206)
mini_mime (1.1.5)
mini_portile2 (2.8.6)
minitest (5.22.2)
msgpack (1.7.2)
multi_xml (0.6.0)
Expand All @@ -232,6 +233,9 @@ GEM
net-protocol
netrc (0.11.0)
nio4r (2.7.0)
nokogiri (1.16.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-darwin)
Expand Down Expand Up @@ -438,6 +442,8 @@ GEM
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.0)
tailwindcss-rails (2.3.0)
railties (>= 6.0.0)
tailwindcss-rails (2.3.0-arm64-darwin)
railties (>= 6.0.0)
tailwindcss-rails (2.3.0-x86_64-darwin)
Expand Down Expand Up @@ -484,7 +490,9 @@ GEM
zeitwerk (2.6.13)

PLATFORMS
aarch64-linux
arm64-darwin-23
ruby
x86_64-darwin-21
x86_64-darwin-22
x86_64-linux
Expand Down
8 changes: 4 additions & 4 deletions app/components/message_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,21 @@
</div>
<% end %>

<% if @message.form && @message.form.nested_message_objects.count > 1 %>
<% if @message.form_object && @message.form_object.nested_message_objects.count > 1 %>
<div class="flex flex-col justify-stretch items-stretch divide-y relative px-4 bg-white border border-gray-200 w-full">
<% @message.form.nested_message_objects.each do |message_attachment| %>
<% @message.form_object.nested_message_objects.each do |message_attachment| %>
<!-- TODO lepsia podmienka (ma sa zobrazit vsetko okrem formulara) -->
<% unless message_attachment.xml? %>
<div class="flex justify-between items-center p-2 overflow-clip">
<%= link_to message_message_object_nested_message_object_path(@message, @message.form, message_attachment), data: { turbo_frame: "_top" }, class: "flex justify-start items-center gap-4 overflow-clip" do %>
<%= link_to message_message_object_nested_message_object_path(@message, @message.form_object, message_attachment), data: { turbo_frame: "_top" }, class: "flex justify-start items-center gap-4 overflow-clip" do %>
<div class="flex flex-col justify-start items-start overflow-clip">
<div class="flex justify-start items-start gap-4 w-full">
<span class="truncate text-base font-semibold text-left text-gray-900"><%= MessageObjectHelper.displayable_name(message_attachment) %></span>
</div>
</div>
<% end %>
<div class="flex justify-end items-center gap-4">
<%= link_to message_message_object_nested_message_object_path(@message, @message.form, message_attachment), data: { turbo_frame: "_top" }, class: "flex justify-end items-center md:px-3.5 md:py-2.5 md:rounded-md md:bg-white md:border md:border-gray-300 hover:bg-gray-100" do %>
<%= link_to message_message_object_nested_message_object_path(@message, @message.form_object, message_attachment), data: { turbo_frame: "_top" }, class: "flex justify-end items-center md:px-3.5 md:py-2.5 md:rounded-md md:bg-white md:border md:border-gray-300 hover:bg-gray-100" do %>
<%= render Icons::ArrowDownTrayComponent.new(css_classes: "w-5 h-5") %>
<% end %>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="<%= dom_id(@message, :attachments) %>" is="turbo-frame" class="border-b-0 w-full">
<% if @message.not_yet_submitted? || @attachments.present? %>
<% if @message.attachments_allowed? && (@message.not_yet_submitted? || @attachments.present?) %>
<div class="justify-stretch items-center self-stretch flex-grow-0 flex-shrink-0 gap-3 px-6 py-4 border-b">
<div class="flex justify-between items-center gap-4 overflow-clip">
<div class="flex justify-start items-center gap-4 overflow-clip">
Expand Down
50 changes: 31 additions & 19 deletions app/components/message_draft_body_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<p class="w-[100px] text-base text-left text-gray-900">Adresát:</p>
<p class="text-base font-semibold text-left text-gray-900"><%= @message.recipient_name || "Neznámy" %></p>
</div>
<% if @message.form.tags.present? %>
<% if @message.form_object&.tags&.present? %>
<div class="flex flex-wrap gap-1">
<% SigningTagsHelper.sort_tags(@message.form.tags).each do |tag| %>
<% SigningTagsHelper.sort_tags(@message.form_object.tags).each do |tag| %>
<%= render Common::TagComponent.new(tag) %>
<% end %>
</div>
Expand All @@ -25,12 +25,14 @@
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-red-600">Správu sa nepodarilo odoslať</p>
<% end %>
</div>
<% elsif @message.being_submitted? || @message.submitted? %>
<% elsif @message.being_validated? || @message.being_submitted? || @message.submitted? %>
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-1.5 px-1.5 py-0.5 rounded-md bg-purple-50 border border-purple-300">
<% if @message.submitted? %>
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-purple-600">Správa bola odoslaná</p>
<% if @message.being_validated? %>
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-purple-600">Prebieha validácia správy</p>
<% elsif @message.being_submitted? %>
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-purple-600">Správa sa odosiela</p>
<% elsif @message.submitted? %>
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-purple-600">Správa bola odoslaná</p>
<% end %>
</div>
<% end %>
Expand All @@ -41,22 +43,32 @@
</div>

<div class="flex flex-col justify-stretch items-start relative gap-4 p-6 border-t-0 border-r-0 border-b border-l-0 border-gray-200">
<% if @message.custom_visualization? %>
<% if @message.created_from_template? %>
<%= render MessageTemplateComponent.new(message: @message, is_last: @is_last) %>
<% elsif @message.html_visualization.present? %>
<div class="w-full">
<%= tag.iframe class: "relative border-none overflow-hidden h-full w-full", srcdoc: @message.html_visualization, onload: "(
function(iframe) {
iframe.contentWindow.document.body.style['height'] = 'unset';
iframe.contentWindow.document.body.style['min-height'] = 'unset';
iframe.parentElement.style.height = iframe.contentWindow.document.body.scrollHeight + 20 + 'px';
}
(this)
)" %>
</div>
<% else %>
<p>Správu nie je možné vizualizovať.</p>
<% if @message.metadata['validation_errors']&.any? %>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative w-full" role="alert">
<% @message.metadata['validation_errors'].each do |error| %>
<strong class="font-bold"><%= simple_format(error) %></strong>
<% end %>
</div>
<% end %>

<% if @message.html_visualization.present? %>
<div class="w-full">
<%= tag.iframe class: "relative border-none overflow-hidden h-full w-full", srcdoc: @message.format_html_visualization, onload: "(
function(iframe) {
iframe.contentWindow.document.body.style['height'] = 'unset';
iframe.contentWindow.document.body.style['min-height'] = 'unset';
iframe.parentElement.style.height = iframe.contentWindow.document.body.scrollHeight + 20 + 'px';
}
(this)
)" %>
</div>
<% else %>
<p>Správu nie je možné vizualizovať.</p>
<% end %>
<% end %>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<p class="text-sm text-gray-500">
<% if @message.reason_for_readonly == :form_signed %>
<%= t "message_draft.form_signed" %>
<% elsif @message.reason_for_readonly == :form_submitted %>
<%= t "message_draft.form_submitted" %>
<% elsif @message.reason_for_readonly == :submitted %>
<%= t "message_draft.submitted" %>
<% else %>
<%= t "message_draft.read_only_agenda" %>
<% end %>
Expand Down
12 changes: 6 additions & 6 deletions app/components/message_options_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<% if @message.form.present? %>
<% if @message.form_object.present? %>
<%= render Common::OptionsComponent.new(id: "message-options") do |options| %>
<% options.with_menu_content do %>
<%= link_to download_message_message_object_path(@message, @message.form), data: { turbo_frame: '_top', turbo: false }, class: 'whitespace-nowrap flex gap-3', role: 'menu-item', tabindex: -1 do %>
<%= link_to download_message_message_object_path(@message, @message.form_object), data: { turbo_frame: '_top', turbo: false }, class: 'whitespace-nowrap flex gap-3', role: 'menu-item', tabindex: -1 do %>
<%= render Icons::ArrowDownTrayComponent.new(css_classes: "w-5 h-5") %>
Stiahnuť správu
<% end %>
<% if @message.form&.downloadable_as_pdf? %>
<%= link_to download_pdf_message_message_object_path(@message, @message.form), data: { turbo_frame: '_top', turbo: false }, class: 'whitespace-nowrap flex gap-3', role: 'menu-item', tabindex: -1 do %>
<% if @message.form_object&.downloadable_as_pdf? %>
<%= link_to download_pdf_message_message_object_path(@message, @message.form_object), data: { turbo_frame: '_top', turbo: false }, class: 'whitespace-nowrap flex gap-3', role: 'menu-item', tabindex: -1 do %>
<%= render Common::IconComponent.new("document-arrow-down", classes: "w-5 h-5") %>
Stiahnuť ako PDF
<% end %>
Expand All @@ -15,8 +15,8 @@
<%= render Common::IconComponent.new("folder-arrow-down", classes: "w-5 h-5") %>
Exportovať správu
<% end %>
<% if @message.form&.downloadable_archived_object? %>
<%= link_to download_archived_message_message_object_path(@message, @message.form), class: "flex gap-3", role: "menuitem", tabindex: "-1" do %>
<% if @message.form_object&.downloadable_archived_object? %>
<%= link_to download_archived_message_message_object_path(@message, @message.form_object), class: "flex gap-3", role: "menuitem", tabindex: "-1" do %>
<%= render Icons::ArrowDownTrayComponent.new(css_classes: "h-5 w-5") %>
Stiahnuť archivovanú správu
<% end %>
Expand Down
6 changes: 3 additions & 3 deletions app/components/message_state_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<% if @message.form&.is_signed? || @message.form.present? || @message.authorized? %>
<% if @message.form_object&.is_signed? || @message.form_object.present? || @message.authorized? %>
<div class="w-fit flex flex-col gap-1 <%= @classes %>">
<% if @message.form&.is_signed? %>
<% if @message.form_object&.is_signed? %>
<%= render Common::BadgeComponent.new("Podpísané", "green", "fingerprint") %>
<% end %>
<% if @message.authorized? %>
<%= render Common::BadgeComponent.new("Prevzatá doručenka", "purple") %>
<% end %>
<% if @message.thread.archived? %>
<%= render ArchivedObjectTagComponent.new(@message.form&.archived_object) %>
<%= render ArchivedObjectTagComponent.new(@message.form_object&.archived_object) %>
<% end %>
</div>
<% end %>
32 changes: 29 additions & 3 deletions app/components/message_threads_bulk_actions_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,36 @@
<% end %>
<% end %>

<% if Current.box && Current.tenant.feature_enabled?(:template_messages) %>
<div class="relative hidden sm:inline-block text-left">
<%= link_to "Napísať novú správu", new_message_draft_path, class: "rounded-md bg-blue-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600", data: { turbo: false } %>
<% if Current.tenant.boxes.where(type: 'Upvs::Box').any? || (Current.tenant.feature_enabled?(:fs_api) && Current.tenant.boxes.where(type: 'Fs::Box').any?) %>
<div data-controller="dropdown" class="relative hidden sm:inline-block text-left">
<div>
<button type="button" data-action="dropdown#toggle click@window->dropdown#hide" class="inline-flex w-full justify-center items-center gap-x-1.5 rounded-md bg-white px-2 py-1 sm:px-3 sm:py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50" id="menu-button" aria-expanded="true" aria-haspopup="true">
Vytvoriť novú správu
<%= render Icons::ChevronDownComponent.new(css_classes: "w-4 h-4 text-gray-400", stroke_width: 2) %>
</button>
</div>

<div data-dropdown-target="menu"
class="absolute hidden right-0 z-10 mt-2 w-56 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none"
role="menu"
aria-orientation="vertical"
aria-labelledby="menu-button"
tabindex="-1">
<% if Current.tenant.boxes.where(type: 'Upvs::Box').any? %>
<div class="py-1" role="none">
<%= link_to "Napísať novú správu na slovensko.sk", new_upvs_message_draft_path,
class: "w-full text-gray-700 group flex items-center px-4 py-2 text-sm hover:bg-gray-100 hover:text-gray-900", data: { turbo_frame: "_top" }, role: "menuitem" %>
</div>
<% end %>
<% if Current.tenant.feature_enabled?(:fs_api) && Current.tenant.boxes.where(type: 'Fs::Box').any? %>
<div class="py-1" role="none">
<%= link_to "Vytvoriť novú správu na finančnú správu", new_fs_message_draft_path,
class: "w-full text-gray-700 group flex items-center px-4 py-2 text-sm hover:bg-gray-100 hover:text-gray-900", data: { turbo_frame: "_top" }, role: "menuitem" %>
</div>
<% end %>
</div>
</div>
<% end %>

</div>
<% end %>
2 changes: 1 addition & 1 deletion app/components/signing/documents_selection/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Component < ViewComponent::Base

def initialize(message_draft:, message_object_ids:, next_step:)
@message_draft = message_draft
@form = message_draft.form
@form = message_draft.form_object
@attachments = message_draft.objects.to_a.reject(&:form?).sort_by(&:created_at).reverse
@message_object_ids = message_object_ids
@next_step = next_step
Expand Down
23 changes: 10 additions & 13 deletions app/components/signing/signers_requests/list_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,31 @@
<%= hidden_field_tag "assignments[init][#{tag_id}]", value %>
<% end %>

<% if @signers_changes.signer_users.exists? %>
<% @signers_changes.signer_users.each do |signer_user| %>
<% if @signers_changes.signer_groups.any? %>
<% @signers_changes.signer_groups.each do |group| %>
<div class="flex px-2 py-4 border-b border-gray-200 items-center">
<div class="mx-1 flex h-6 items-center">
<%= hidden_field_tag "assignments[new][#{signer_user.id}]", RelationChanges::REMOVE_SIGN, id: nil %>
<%= hidden_field_tag "assignments[new][#{group.id}]", RelationChanges::REMOVE_SIGN, id: nil %>

<% checkbox = RelationChanges::Checkbox.new(assignments: @signers_changes.assignments, record_id: signer_user.id.to_s) %>
<% checkbox = RelationChanges::Checkbox.new(assignments: @signers_changes.assignments, record_id: group.id.to_s) %>
<% if checkbox.indeterminate? %>
<%= check_box_tag "assignments[new][#{signer_user.id}]",
<%= check_box_tag "assignments[new][#{group.id}]",
checkbox.value, checkbox.checked?,
data: { controller: "tri-state-checkbox", action: "click->tri-state-checkbox#nextState", "tri-state-checkbox-checked-value": RelationChanges::ADD_SIGN, "tri-state-checkbox-indeterminate-value": RelationChanges::KEEP_SIGN },
onchange: "this.form.requestSubmit();",
id: "new_assignments_#{signer_user.id}",
id: "new_assignments_#{group.id}",
class: "h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-600 cursor-pointer" %>
<% else %>
<%= check_box_tag "assignments[new][#{signer_user.id}]", checkbox.value, checkbox.checked?, id: "new_assignments_#{signer_user.id}", class: "h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-600 cursor-pointer", onchange: "this.form.requestSubmit();" %>
<%= check_box_tag "assignments[new][#{group.id}]", checkbox.value, checkbox.checked?, id: "new_assignments_#{group.id}", class: "h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-600 cursor-pointer", onchange: "this.form.requestSubmit();" %>
<% end %>
</div>
<%= label_tag "new_assignments_#{signer_user.id}", class: "px-2 select-none text-gray-900 cursor-pointer flex gap-2 items-center" do %>
<%= label_tag "new_assignments_#{group.id}", class: "px-2 select-none text-gray-900 cursor-pointer flex gap-2 items-center" do %>
<div class="inline-flex items-center justify-center w-12 h-12 overflow-hidden bg-blue-600 rounded-full">
<span class="text-white text-xl font-normal"><%= signer_user.name[0] %></span>
<span class="text-white text-xl font-normal"><%= group.name[0] %></span>
</div>
<div>
<div class="text-gray-900 text-sm font-medium">
<%= signer_user.name %>
</div>
<div class="text-gray-500 text-sm">
<%= signer_user.email %>
<%= group.name %>
</div>
</div>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
template_element_id = "message_template_id"
%>

<%= form_with url: message_drafts_path, id: form_id, class: 'w-full' do |f| %>
<%= form_with url: upvs_message_drafts_path, id: form_id, class: 'w-full' do |f| %>
<div class="self-stretch px-6 pt-6 flex-col justify-start items-start flex">
<div class="mb-4 w-full">
<% selected_box_attributes = @selected_box&.values_at(:name, :id) %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class NewMessageDraftComponent < ViewComponent::Base
class Upvs::NewMessageDraftComponent < ViewComponent::Base
DEFAULT_CLASSES = 'bg-gray-50 border border-gray-300 text-gray-900 focus:ring-blue-500 focus:border-blue-500'
ERROR_CLASSES = 'bg-red-50 border border-red-500 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500'

Expand Down
Loading

0 comments on commit fff71f3

Please sign in to comment.