From a9a492e309b58a9e42ada4d0a17f410a93b04e49 Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Tue, 22 Aug 2023 16:33:05 +0300 Subject: [PATCH] fixed index page, added paid all to invoice page --- app/channels/notification_channel.rb | 13 ++++++ app/controllers/invoices_controller.rb | 2 + app/views/auctions/_auction.html.erb | 64 ++++++++++++++------------ app/views/auctions/index.html.erb | 13 ++++-- app/views/invoices/index.html.erb | 23 +++++++-- 5 files changed, 79 insertions(+), 36 deletions(-) create mode 100644 app/channels/notification_channel.rb diff --git a/app/channels/notification_channel.rb b/app/channels/notification_channel.rb new file mode 100644 index 000000000..9672de475 --- /dev/null +++ b/app/channels/notification_channel.rb @@ -0,0 +1,13 @@ +class NotificationChannel < ApplicationCable::Channel + def subscribed + # TODO + + # 1. indicate who subscribe + # 2. indicate his locale + # 3. transform incoming message to his locale + + stream_from "notification_channel_#{params[:user_id]}" + + + end +end diff --git a/app/controllers/invoices_controller.rb b/app/controllers/invoices_controller.rb index 3c6671f10..28688e41b 100644 --- a/app/controllers/invoices_controller.rb +++ b/app/controllers/invoices_controller.rb @@ -28,6 +28,8 @@ def index @cancelled_payable_invoices = invoices_list_by_status(Invoice.statuses[:cancelled]).with_ban @cancelled_expired_invoices = invoices_list_by_status(Invoice.statuses[:cancelled]).without_ban + @unpaid_invoices_count = @issued_invoices.count + @cancelled_payable_invoices.count + @cancelled_expired_invoices.count + @paid_invoices = invoices_list_by_status(Invoice.statuses[:paid]) @deposit_paid = current_user.domain_participate_auctions.order(created_at: :desc) diff --git a/app/views/auctions/_auction.html.erb b/app/views/auctions/_auction.html.erb index 13020034f..1a734ab59 100644 --- a/app/views/auctions/_auction.html.erb +++ b/app/views/auctions/_auction.html.erb @@ -33,44 +33,48 @@ <% end %> - <% if auction.english? %> + <% if user_signed_in? %> + <% if auction.english? %> - <% if auction.users_offer_uuid %> -
- <%= link_to edit_english_offer_path(auction.users_offer_uuid), class: "c-btn c-btn--ghost c-btn--icon", title: "Edit", data: { turbo_frame: 'modal' } do %> - - <% end %> -
- <% else %> - <% if auction.allow_to_set_bid?(user) %> - <%= link_to 'Esita pakkumus', new_auction_english_offer_path(auction_uuid: auction.uuid), class: "c-btn c-btn--green js-modal-toggle", data: { turbo_frame: 'modal' } %> + <% if auction.users_offer_uuid %> +
+ <%= link_to edit_english_offer_path(auction.users_offer_uuid), class: "c-btn c-btn--ghost c-btn--icon", title: "Edit", data: { turbo_frame: 'modal' } do %> + + <% end %> +
<% else %> - <%= link_to 'Deposit', new_auction_english_offer_path(auction_uuid: auction.uuid), class: "c-btn c-btn--orange js-modal-toggle", data: { turbo_frame: 'modal' } %> + <% if auction.allow_to_set_bid?(user) %> + <%= link_to 'Esita pakkumus', new_auction_english_offer_path(auction_uuid: auction.uuid), class: "c-btn c-btn--green js-modal-toggle", data: { turbo_frame: 'modal' } %> + <% else %> + <%= link_to 'Deposit', new_auction_english_offer_path(auction_uuid: auction.uuid), class: "c-btn c-btn--orange js-modal-toggle", data: { turbo_frame: 'modal' } %> + <% end %> <% end %> - <% end %> - <% else %> + <% else %> - <% if auction.users_offer_uuid %> -
- <%= link_to edit_offer_path(auction.users_offer_uuid), class: "c-btn c-btn--ghost c-btn--icon", title: "Edit", data: { turbo_frame: 'modal' } do %> - - <% end %> + <% if auction.users_offer_uuid %> +
+ <%= link_to edit_offer_path(auction.users_offer_uuid), class: "c-btn c-btn--ghost c-btn--icon", title: "Edit", data: { turbo_frame: 'modal' } do %> + + <% end %> - <%= button_to offer_path(auction.offer_from_user(user).uuid), method: :delete, form: { data: { turbo_confirm: t(".confirm_delete") } }, class: "c-btn c-btn--ghost c-btn--icon" do %> - - <% end %> + <%= button_to offer_path(auction.offer_from_user(user).uuid), method: :delete, form: { data: { turbo_confirm: t(".confirm_delete") } }, class: "c-btn c-btn--ghost c-btn--icon" do %> + + <% end %> - <%# %> - <%# %> -
- <% else %> - <%= link_to 'Esita pakkumus', new_auction_offer_path(auction_uuid: auction.uuid), class: "c-btn c-btn--green js-modal-toggle-po", data: { turbo_frame: 'modal' } %> - <%# Esita pakkumus %> - <% end %> + <%# %> + <%# %> +
+ <% else %> + <%= link_to 'Esita pakkumus', new_auction_offer_path(auction_uuid: auction.uuid), class: "c-btn c-btn--green js-modal-toggle-po", data: { turbo_frame: 'modal' } %> + <%# Esita pakkumus %> + <% end %> + <% end %> + <% else %> + <%= link_to 'Esita pakkumus', new_user_session_path, class: "c-btn c-btn--green js-modal-toggle-po", target: '_top' %> <% end %> diff --git a/app/views/auctions/index.html.erb b/app/views/auctions/index.html.erb index d79a3dea0..b1d053e2c 100644 --- a/app/views/auctions/index.html.erb +++ b/app/views/auctions/index.html.erb @@ -21,23 +21,29 @@ action: 'input->form--debounce#search' } do |f| %>
-
+
<%= f.radio_button :type, 'all', class: "js-table-filter-btn", checked: true, style: 'visibility: hidden; position: absolute;', id: 'filter_all_button', data: { form__filter_target: 'button' } %> + <%= f.label :type_all, "kõik", class: "c-table__filters__btn is-active js-table-filter-btn", style: 'cursor: pointer;', for: 'filter_all_button', data: { form__filter_target: 'label', action: "click->form--filter#click" } %> + <%= f.radio_button :type, 'english', class: "js-table-filter-btn", style: 'visibility: hidden; position: absolute;', id: 'filter_IO_button', data: { form__filter_target: 'button' } %> + <%= f.label :type_english, class: "c-table__filters__btn js-table-filter-btn", style: 'cursor: pointer;', for: 'filter_IO_button', data: { form__filter_target: 'label', action: "click->form--filter#click" } do %> - - inglise oksjon + inglise oksjon <% end %> + <%= f.radio_button :type, 'blind', class: "js-table-filter-btn", style: 'visibility: hidden; position: absolute;', id: 'filter_PO_button', data: { form__filter_target: 'button' } %> + <%= f.label :type_blind, class: "c-table__filters__btn js-table-filter-btn", style: 'cursor: pointer;', for: 'filter_PO_button', data: { form__filter_target: 'label', action: "click->form--filter#click" } do %> pime oksjon <% end %>
+ + @@ -49,6 +55,7 @@ pime oksjon
+ <% end %> diff --git a/app/views/invoices/index.html.erb b/app/views/invoices/index.html.erb index 6b2859d6d..cac13e80d 100644 --- a/app/views/invoices/index.html.erb +++ b/app/views/invoices/index.html.erb @@ -1,6 +1,7 @@ <%= component 'common/hero', title: 'Minu arved' %>
+

Tasumata arved

@@ -14,7 +15,13 @@ - Tasu kõik maksmata arved (5) + + <%= tag.div class: 'c-tabs__nav__btn--ind' do %> + <%= button_to pay_all_bills_invoices_path, method: :post, style: 'background-color: inherit; color: inherit; text-decoration: none; border: none; box-shadow: none;' do %> + Tasu kõik maksmata arved (<%= @unpaid_invoices_count %>) + <% end %> + <% end if @unpaid_invoices_count.positive?%> +
@@ -95,8 +102,15 @@ - Tasu kõik maksmata arved (5) + + <%= tag.div class: 'c-tabs__nav__btn--ind' do %> + <%= button_to pay_all_bills_invoices_path, method: :post, style: 'background-color: inherit; color: inherit; text-decoration: none; border: none; box-shadow: none;' do %> + Tasu kõik maksmata arved (<%= @unpaid_invoices_count %>) + <% end %> + <% end if @unpaid_invoices_count.positive?%> +
+
@@ -117,7 +131,8 @@ <% end %>
-
+ +
<% header_collection = [{ column: nil, caption: t('invoices.paid_deposit.date'), options: { class: "" } }, { column: nil, caption: t('invoices.paid_deposit.sum'), options: { class: "" } }, @@ -140,10 +155,12 @@ <% end %>
+
+