Skip to content

Commit

Permalink
fixed index page, added paid all to invoice page
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegPhenomenon committed Aug 22, 2023
1 parent a4b87c7 commit a9a492e
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 36 deletions.
13 changes: 13 additions & 0 deletions app/channels/notification_channel.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions app/controllers/invoices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
64 changes: 34 additions & 30 deletions app/views/auctions/_auction.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,44 +33,48 @@
<% end %>

<td class="u-text-left u-text-center-l">
<% if auction.english? %>
<% if user_signed_in? %>
<% if auction.english? %>

<% if auction.users_offer_uuid %>
<div class="c-btn-group c-btn-group--ghost">
<%= 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 %>
<span class="o-edit-icon"></span>
<% end %>
</div>
<% 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 %>
<div class="c-btn-group c-btn-group--ghost">
<%= 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 %>
<span class="o-edit-icon"></span>
<% end %>
</div>
<% 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 %>
<div class="c-btn-group c-btn-group--ghost">
<%= 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 %>
<span class="o-edit-icon"></span>
<% end %>
<% if auction.users_offer_uuid %>
<div class="c-btn-group c-btn-group--ghost">
<%= 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 %>
<span class="o-edit-icon"></span>
<% 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 %>
<span class="o-delete-icon"></span>
<% 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 %>
<span class="o-delete-icon"></span>
<% end %>

<%# <button class="c-btn c-btn--ghost c-btn--icon js-edit-modal-toggle" title="Edit"><span %>
<%# class="o-edit-icon"></span></button> %>
<%# <button class="c-btn c-btn--ghost c-btn--icon js-modal-delete-toggle" title="Delete"><span %>
<%# class="o-delete-icon"></span></button> %>
</div>
<% 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' } %>
<%# <td class="u-text-left u-text-center-l"><a href="#" class="c-btn c-btn--green">Esita pakkumus</a></td> %>
<% end %>
<%# <button class="c-btn c-btn--ghost c-btn--icon js-edit-modal-toggle" title="Edit"><span %>
<%# class="o-edit-icon"></span></button> %>
<%# <button class="c-btn c-btn--ghost c-btn--icon js-modal-delete-toggle" title="Delete"><span %>
<%# class="o-delete-icon"></span></button> %>
</div>
<% 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' } %>
<%# <td class="u-text-left u-text-center-l"><a href="#" class="c-btn c-btn--green">Esita pakkumus</a></td> %>
<% end %>

<% end %>
<% else %>
<%= link_to 'Esita pakkumus', new_user_session_path, class: "c-btn c-btn--green js-modal-toggle-po", target: '_top' %>
<% end %>
</td>
</tr>
13 changes: 10 additions & 3 deletions app/views/auctions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,29 @@
action: 'input->form--debounce#search'
} do |f| %>
<div class="c-table__filters">
<div class="c-table__filters__btns" data-controller="">
<div class="c-table__filters__btns" style='position: relative'>
<%= 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 %>
<span class="o-io-icon"></span>
<span class="u-hidden-m"> inglise oksjon</span>
<span class="o-io-icon"></span><span class="u-hidden-m"> inglise oksjon</span>
<% 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 %>
<span class="o-po-icon"></span>
<span class="u-hidden-m"> pime oksjon</span>
<% end %>
</div>

<div class="c-table__filters__search">
<%= f.search_field :domain_name, value: params[:domain_name], placeholder: t('search_by_domain_name'), class: 'c-table__search__input js-table-search-dt' %>
</div>

<div class="c-table__filters__more">
<a href="#" class="c-btn c-btn--ghost">Telli teavitused</a>
</div>
Expand All @@ -49,6 +55,7 @@
pime oksjon
</div>
</div>

</div>
<% end %>

Expand Down
23 changes: 20 additions & 3 deletions app/views/invoices/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%= component 'common/hero', title: 'Minu arved' %>
<!-- Table -->
<div class="o-container">

<div class="c-block" data-controller='table--tab' data-table--tab-active-class='is-active'>
<h2 class="c-block__title u-flex u-content-sp u-flex-gap-12 u-h3">Tasumata arved</h2>
<div class="c-tabs">
Expand All @@ -14,7 +15,13 @@
<button class="c-tabs__nav__btn js-tab-btn" data-table--tab-target='tab' data-action="click->table--tab#showTab" data-table--tab-index-param='2'>
Cancelled expired invoices <sup>(<%= @cancelled_expired_invoices.count %>)</sup>
</button>
<a href="#" class="c-tabs__nav__btn--ind">Tasu kõik <span class="u-hidden-m">maksmata arved</span> <sup>(5)</sup></a>

<%= 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 <span class="u-hidden-m">maksmata arved</span> <sup>(<%= @unpaid_invoices_count %>)</sup>
<% end %>
<% end if @unpaid_invoices_count.positive?%>

</div>
<div class="c-tabs__content">
<div class="c-tabs__content__tab is-active" data-table--tab-target='content'>
Expand Down Expand Up @@ -95,8 +102,15 @@
<button class="c-tabs__nav__btn js-tab-btn" data-table--tab-target='tab' data-action="click->table--tab#showTab" data-table--tab-index-param='1'>
Deposit paid <sup>(<%= @deposit_paid.count %>)</sup>
</button>
<a href="#" class="c-tabs__nav__btn--ind">Tasu kõik <span class="u-hidden-m">maksmata arved</span> <sup>(5)</sup></a>

<%= 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 <span class="u-hidden-m">maksmata arved</span> <sup>(<%= @unpaid_invoices_count %>)</sup>
<% end %>
<% end if @unpaid_invoices_count.positive?%>

</div>

<div class="c-tabs__content">
<div class="c-tabs__content__tab is-active" data-table--tab-target='content'>
<div class="c-table--responsive">
Expand All @@ -117,7 +131,8 @@
<% end %>
</div>
</div>
<div class="c-tabs__content__tab is-active" data-table--tab-target='content'>

<div class="c-tabs__content__tab" data-table--tab-target='content'>
<div class="c-table--responsive">
<% header_collection = [{ column: nil, caption: t('invoices.paid_deposit.date'), options: { class: "" } },
{ column: nil, caption: t('invoices.paid_deposit.sum'), options: { class: "" } },
Expand All @@ -140,10 +155,12 @@
<% end %>
</div>
</div>

</div>
</div>
</div>
</div>

<!-- Table -->
<div class="u-text-center">
<a href="#" class="c-btn c-btn--ghost">Näita kõiki</a>
Expand Down

0 comments on commit a9a492e

Please sign in to comment.