Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Improve gift card payments views

Damian Legawiec3292688fb4df
diff --git a/admin/app/views/spree/admin/payments/_payment.html.erb b/admin/app/views/spree/admin/payments/_payment.html.erb
index dae5f080f6..1e89e541b1 100644
--- a/admin/app/views/spree/admin/payments/_payment.html.erb
+++ b/admin/app/views/spree/admin/payments/_payment.html.erb
@@ -25,7 +25,7 @@
<%= link_to_with_icon 'eye', Spree.t(:details), payment.gateway_dashboard_payment_url, class: 'dropdown-item', target: '_blank' %>
<% end %>
<% if payment.source.is_a?(Spree::StoreCredit) && payment.source.respond_to?(:gift_card) && payment.source.gift_card.present? %>
- <%= link_to_with_icon 'eye', Spree.t(:details), spree.edit_admin_gift_card_path(payment.source.gift_card), class: 'dropdown-item' %>
+ <%= link_to_with_icon 'eye', Spree.t(:details), spree.admin_gift_card_path(payment.source.gift_card), class: 'dropdown-item' %>
<% end %>
<% if can?(:update, payment) && (payment.checkout? || payment.pending?) %>
@@ -72,7 +72,7 @@
<% end %>
</div>
</div>
- <% if payment.transaction_id.present? %>
+ <% if payment.transaction_id.present? && !payment.store_credit? %>
<div class="card-footer border-top border-top-dashed">
<p class="mb-0 d-flex justify-content-between align-items-center">
<span>
diff --git a/core/app/views/spree/shared/_payment.html.erb b/core/app/views/spree/shared/_payment.html.erb
index a8682abce1..f3e244e628 100644
--- a/core/app/views/spree/shared/_payment.html.erb
+++ b/core/app/views/spree/shared/_payment.html.erb
@@ -13,7 +13,7 @@
</div>
<% elsif source.is_a?(Spree::StoreCredit) %>
<% if source.respond_to?(:gift_card) && source.gift_card.present? %>
- <div class="d-flex flex rounded bg-light px-3 py-2 mb-3 align-items-center">
+ <div class="d-flex align-items-center text-decoration-none w-100 h-100">
<%= icon('gift', height: 30, class: 'mr-3 text-muted') %>
<div>
<p class="mb-1"><%= Spree.t(:gift_card) %>: <strong><%= source.gift_card.code.upcase %></strong></p>
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index 9e3974ae49..48bbf609f4 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -1093,13 +1093,13 @@ en:
general_settings: General Settings
generate_code: Generate coupon code
get_back_to_the: Get back to the
- gift_card: Gift card
- gift_card_applied: The gift card was successfully applied to your order!
- gift_card_batch: Gift card batch
- gift_card_no_amount_remaining: You can't apply the gift card with no balance on it.
- gift_card_removed: The gift card was successfully removed from your order
- gift_card_using_store_credit_error: You can't apply the gift card after you applied the store credit.
- gift_cards: Gift cards
+ gift_card: Gift Card
+ gift_card_applied: The Gift Card was successfully applied to your order!
+ gift_card_batch: Gift Card batch
+ gift_card_no_amount_remaining: You can't apply the Gift Card with no balance on it.
+ gift_card_removed: The Gift Card was successfully removed from your order
+ gift_card_using_store_credit_error: You can't apply the Gift Card after you applied the store credit.
+ gift_cards: Gift Cards
go_to_category: Go to category
go_to_facebook: Go to facebook
go_to_homepage: Go to Home Page
diff --git a/storefront/app/views/spree/checkout/payment/_store_credit.html.erb b/storefront/app/views/spree/checkout/payment/_store_credit.html.erb
index d50724ae89..d60ebacc61 100644
--- a/storefront/app/views/spree/checkout/payment/_store_credit.html.erb
+++ b/storefront/app/views/spree/checkout/payment/_store_credit.html.erb
@@ -2,12 +2,12 @@
<div class="d-flex flex-column mb-5" data-hook="checkout_payment_store_credit_success">
<p class="store-credit-title font-body">
<% if @order.respond_to?(:gift_card) && @order.gift_card.present? %>
- <%= Spree.t('storefront.checkout.gift_card_amount_applied', amount: @order.display_gift_card_total, code: @order.gift_card.code) %>
+ <%= Spree.t('storefront.checkout.gift_card_amount_applied', amount: @order.display_gift_card_total, code: @order.gift_card.code.upcase) %>
<% else %>
<%= Spree.t('storefront.checkout.store_credits_amount_applied', amount: @order.display_total_applicable_store_credit.abs) %>
<% end %>
- <%= Spree.t('storefront.checkout.you_will_need_to_pay_only', amount: @order.display_total_minus_store_credits) %>
+ <%= Spree.t('storefront.checkout.you_will_need_to_pay_only', amount: @order.display_total_minus_store_credits) if @order.total_minus_store_credits.positive? %>
</p>
</div>
<% end %>
diff --git a/storefront/app/views/themes/default/spree/account/gift_cards/_gift_card.html.erb b/storefront/app/views/themes/default/spree/account/gift_cards/_gift_card.html.erb
index 2781e99b8c..5bf578fdaa 100644
--- a/storefront/app/views/themes/default/spree/account/gift_cards/_gift_card.html.erb
+++ b/storefront/app/views/themes/default/spree/account/gift_cards/_gift_card.html.erb
@@ -1,6 +1,6 @@
<tr class="flex flex-wrap w-full md:table-row md:h-[72px] border border-accent md:border-none mb-4 p-4 md:p-0 hover:bg-accent-100" id="<%= dom_id(gift_card) %>">
<td class="mb-4 w-full md:w-auto md:px-4 md:border-y border-accent md:border-l font-medium">
- <%= gift_card.code %>
+ <%= gift_card.code.upcase %>
</td>
<td class="mb-4 w-full md:w-auto md:px-4 md:border-y border-accent">
diff --git a/storefront/config/locales/en.yml b/storefront/config/locales/en.yml
index 38e7e7037e..f162799622 100644
--- a/storefront/config/locales/en.yml
+++ b/storefront/config/locales/en.yml
@@ -31,7 +31,7 @@ en:
invalid_line_items:
one: This item will be removed from your cart because there are no delivery methods available for your address.
other: These %{count} items will be removed from your cart because there are no delivery methods available for your address.
- gift_card_amount_applied: Gift card %{code} applied %{amount} to your order.
+ gift_card_amount_applied: Gift Card %{code} applied %{amount} to your order.
it_seems_you_already_have_an_account_html: It seems you already have an account with us. Please %{link} to continue.
or_continue_below: or continue below
order_already_paid: You don't need to pay anything, just click Place now button to confirm the order.