Skip to content

Commit

Permalink
Add blank for upvs boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuchal committed Nov 18, 2024
1 parent 87d8f0f commit d05d050
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 21 deletions.
3 changes: 2 additions & 1 deletion app/components/common/blank_results_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def before_render
filters: "bookmark-slash",
rules: "funnel-slash",
tags: "tag-slash",
not_found: "magnifying-glass"
not_found: "magnifying-glass",
boxes: "inbox-stack",
}

@header = t "blank_results.#{@reason}.header"
Expand Down
3 changes: 2 additions & 1 deletion app/components/common/icon_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class IconComponent < ViewComponent::Base
"magnifying-glass" => "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z",
"bookmark-slash" => "m3 3 1.664 1.664M21 21l-1.5-1.5m-5.485-1.242L12 17.25 4.5 21V8.742m.164-4.078a2.15 2.15 0 0 1 1.743-1.342 48.507 48.507 0 0 1 11.186 0c1.1.128 1.907 1.077 1.907 2.185V19.5M4.664 4.664 19.5 19.5",
"funnel-slash" => "M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3ZM2 2l20 20",
"tag-slash" => "M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z M6 6h.008v.008H6V6ZM3 21l18-18"
"tag-slash" => "M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z M6 6h.008v.008H6V6ZM3 21l18-18",
"inbox-stack" => "m7.875 14.25 1.214 1.942a2.25 2.25 0 0 0 1.908 1.058h2.006c.776 0 1.497-.4 1.908-1.058l1.214-1.942M2.41 9h4.636a2.25 2.25 0 0 1 1.872 1.002l.164.246a2.25 2.25 0 0 0 1.872 1.002h2.092a2.25 2.25 0 0 0 1.872-1.002l.164-.246A2.25 2.25 0 0 1 16.954 9h4.636M2.41 9a2.25 2.25 0 0 0-.16.832V12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 12V9.832c0-.287-.055-.57-.16-.832M2.41 9a2.25 2.25 0 0 1 .382-.632l3.285-3.832a2.25 2.25 0 0 1 1.708-.786h8.43c.657 0 1.281.287 1.709.786l3.284 3.832c.163.19.291.404.382.632M4.5 20.25h15A2.25 2.25 0 0 0 21.75 18v-2.625c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125V18a2.25 2.25 0 0 0 2.25 2.25Z",
}.freeze

def initialize(icon, classes: "", stroke_width: 1.5)
Expand Down
2 changes: 1 addition & 1 deletion app/lib/sidebar_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def admin_menu
TW::SidebarMenuDividerComponent.new(name: 'Administrácia'),
TW::SidebarMenuItemComponent.new(name: 'Používatelia', url: admin_tenant_users_path(Current.tenant), icon: Icons::UsersComponent.new),
TW::SidebarMenuItemComponent.new(name: 'Prístup', url: admin_tenant_tag_groups_path(Current.tenant), icon: Icons::LockClosedComponent.new),
TW::SidebarMenuItemComponent.new(name: 'Schránky', url: admin_tenant_boxes_path(Current.tenant), icon: Icons::RectangleStackComponent.new),
TW::SidebarMenuItemComponent.new(name: 'Schránky', url: admin_tenant_boxes_path(Current.tenant), icon: Common::IconComponent.new("inbox-stack")),
TW::SidebarMenuItemComponent.new(name: 'API Prepojenia', url: admin_tenant_api_connections_path(Current.tenant), icon: Icons::RectangleStackComponent.new),
TW::SidebarMenuItemComponent.new(name: 'Skupiny', url: admin_tenant_groups_path(Current.tenant), icon: Icons::UserGroupsComponent.new),
TW::SidebarMenuItemComponent.new(name: 'Štítky', url: admin_tenant_tags_path(Current.tenant), icon: Icons::TagComponent.new),
Expand Down
40 changes: 22 additions & 18 deletions app/views/admin/boxes/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,42 @@
<div class="self-stretch bg-white rounded-md border border-gray-200 flex-col justify-start items-start flex">
<div class="self-stretch p-6 border-b border-gray-200 justify-start items-center gap-4 inline-flex">
<div class="grow shrink basis-0 text-gray-900 text-xl font-semibold leading-[35px]">ÚPVS Schránky</div>
<% if Current.tenant.api_connections.where(type: "Govbox::ApiConnectionWithOboSupport" ).any? %>
<% if Current.tenant.api_connections.where(type: "Govbox::ApiConnectionWithOboSupport").any? %>
<%= link_to new_admin_tenant_boxes_upvs_box_path, data: { turbo_frame: "modal" }, class: "px-3.5 py-2.5 bg-blue-600 rounded-md justify-center items-center gap-2.5 flex" do %>
<p class="text-white text-base font-medium leading-normal">Pripojiť novú schránku</p>
<% end %>
<% end %>
</div>
<div class="self-stretch flex-col justify-start items-start flex">
<% @boxes.where(type: "Upvs::Box").each do |box| %>
<div class="self-stretch p-6 border-b border-gray-200 justify-start items-center gap-4 inline-flex">
<div class="grow basis-0 flex-col justify-start items-start gap-1 inline-flex">
<div class="text-center text-gray-900 text-lg font-medium leading-loose">
<%= render Common::BoxLabelComponent.new(box, "items-start justify-start gap-0" ) %>
<% if @boxes.where(type: "Upvs::Box").any? %>
<% @boxes.where(type: "Upvs::Box").each do |box| %>
<div class="self-stretch p-6 border-b border-gray-200 justify-start items-center gap-4 inline-flex">
<div class="grow basis-0 flex-col justify-start items-start gap-1 inline-flex">
<div class="text-center text-gray-900 text-lg font-medium leading-loose">
<%= render Common::BoxLabelComponent.new(box, "items-start justify-start gap-0") %>
</div>
<div class="text-center text-gray-500 text-base font-normal leading-normal">
<%= box.name %>, URI: <%= box.uri %>
</div>
</div>
<div class="text-center text-gray-500 text-base font-normal leading-normal">
<%= box.name %>, URI: <%= box.uri %>
<div class="justify-start items-start gap-2 flex">
<%= link_to edit_polymorphic_path([:admin, box.tenant, :boxes, box]), data: { turbo_frame: "modal" } do %>
<%= render Common::EditButtonComponent.new %>
<% end %>
</div>
</div>
<div class="justify-start items-start gap-2 flex">
<%= link_to edit_polymorphic_path([:admin, box.tenant, :boxes, box]), data: { turbo_frame: "modal" } do %>
<%= render Common::EditButtonComponent.new %>
<% end %>
</div>
</div>
<% end %>
<% else %>
<%= render Common::BlankResultsComponent.new(:boxes) %>
<% end %>
</div>
</div>

<% if Current.tenant.feature_enabled?(:fs_api) %>
<div class="self-stretch bg-white rounded-md border border-gray-200 flex-col justify-start items-start flex">
<div class="self-stretch p-6 border-b border-gray-200 justify-start items-center gap-4 inline-flex">
<div class="grow shrink basis-0 text-gray-900 text-xl font-semibold leading-[35px]">FS Schránky</div>
<% if Current.tenant.api_connections.where(type: "Fs::ApiConnection" ).any? %>
<% if Current.tenant.api_connections.where(type: "Fs::ApiConnection").any? %>
<%= link_to new_admin_tenant_boxes_fs_box_path, data: { turbo_frame: "modal" }, class: "px-3.5 py-2.5 bg-blue-600 rounded-md justify-center items-center gap-2.5 flex" do %>
<p class="text-white text-base font-medium leading-normal">Pripojiť novú schránku</p>
<% end %>
Expand All @@ -43,9 +47,9 @@
<div class="self-stretch flex-col justify-start items-start flex">
<% @boxes.where(type: "Fs::Box").each do |box| %>
<div class="self-stretch p-6 border-b border-gray-200 justify-start items-center gap-4 inline-flex">
<div class="grow basis-0 flex-col justify-start items-start gap-1 inline-flex">
<div class="grow basis-0 flex-col justify-start items-start gap-1 inline-flex">
<div class="text-center text-gray-900 text-lg font-medium leading-loose">
<%= render Common::BoxLabelComponent.new(box, "items-start justify-start gap-0" ) %>
<%= render Common::BoxLabelComponent.new(box, "items-start justify-start gap-0") %>
</div>
<div class="text-center text-gray-500 text-base font-normal leading-normal">
<%= box.name %>, DIČ: <%= box.settings_dic %>
Expand All @@ -60,7 +64,7 @@
<% end %>
</div>
<% else %>
<%= render Common::BlankResultsComponent.new(:empty) %>
<%= render Common::BlankResultsComponent.new(:boxes) %>
<% end %>
</div>
<% end %>
Expand Down
3 changes: 3 additions & 0 deletions config/locales/sk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ sk:
rules:
header: "Žiadne pravidlá"
description: 'Zatiaľ nie sú vytvorené žiadne pravidlá.'
boxes:
header: "Žiadne schránky"
description: 'Zatiaľ nie sú vytvorené žiadne schránky.'
not_found:
header: "Žiadne správy"
description: "Zvolenému vyhľadávaniu nevyhovuje žiadna správa, skúste vybrať iný štítok alebo zmeniť vyhľadávací výraz."

0 comments on commit d05d050

Please sign in to comment.