workarea-global_e 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. checksums.yaml +7 -0
  2. data/.eslintrc.json +37 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  4. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  6. data/.github/workflows/ci.yml +77 -0
  7. data/.gitignore +20 -0
  8. data/.rubocop.yml +2 -0
  9. data/.ruby-version +1 -0
  10. data/CHANGELOG.md +261 -0
  11. data/Gemfile +16 -0
  12. data/README.md +39 -0
  13. data/Rakefile +59 -0
  14. data/app/assets/javascripts/workarea/storefront/global_e/modules/checkout_info_validator.js +122 -0
  15. data/app/assets/javascripts/workarea/storefront/global_e/modules/suppress_price_ranges.js +19 -0
  16. data/app/controllers/workarea/admin/country_exceptions_controller.rb +67 -0
  17. data/app/controllers/workarea/admin/fixed_prices_controller.rb +89 -0
  18. data/app/controllers/workarea/admin/orders_controller.decorator +6 -0
  19. data/app/controllers/workarea/storefront/application_controller.decorator +30 -0
  20. data/app/controllers/workarea/storefront/checkouts_controller.decorator +22 -0
  21. data/app/controllers/workarea/storefront/ge_checkouts_controller.rb +10 -0
  22. data/app/controllers/workarea/storefront/global_e_controller.rb +42 -0
  23. data/app/controllers/workarea/storefront/globale/api_controller.rb +108 -0
  24. data/app/controllers/workarea/storefront/globale/refund_controller.rb +65 -0
  25. data/app/controllers/workarea/storefront/users/logins_controller.decorator +13 -0
  26. data/app/helpers/workarea/admin/global_e_helpers.rb +28 -0
  27. data/app/models/workarea/address.decorator +11 -0
  28. data/app/models/workarea/catalog/product.decorator +14 -0
  29. data/app/models/workarea/fulfillment/status/partially_refunded.rb +13 -0
  30. data/app/models/workarea/fulfillment/status/refunded.rb +15 -0
  31. data/app/models/workarea/fulfillment.decorator +55 -0
  32. data/app/models/workarea/global_e/country_exception.rb +37 -0
  33. data/app/models/workarea/global_e/fixed_price.rb +93 -0
  34. data/app/models/workarea/global_e/order_api_events.rb +29 -0
  35. data/app/models/workarea/order/item.decorator +46 -0
  36. data/app/models/workarea/order/status/pending_global_e_fraud_check.rb +12 -0
  37. data/app/models/workarea/order.decorator +64 -0
  38. data/app/models/workarea/payment/status/global_e_appoved.rb +9 -0
  39. data/app/models/workarea/payment/status/pending_global_e_fraud_check.rb +9 -0
  40. data/app/models/workarea/payment/tender/global_e_payment.rb +16 -0
  41. data/app/models/workarea/payment.decorator +10 -0
  42. data/app/models/workarea/price_adjustment.decorator +13 -0
  43. data/app/models/workarea/price_adjustment_set.decorator +25 -0
  44. data/app/models/workarea/pricing/calculators/item_calculator.decorator +48 -0
  45. data/app/models/workarea/pricing/collection.decorator +90 -0
  46. data/app/models/workarea/pricing/discount/appliation_group.decorator +16 -0
  47. data/app/models/workarea/pricing/discount/international_item_proxy.rb +27 -0
  48. data/app/models/workarea/pricing/discount/international_order.rb +29 -0
  49. data/app/models/workarea/pricing/discount.decorator +65 -0
  50. data/app/models/workarea/pricing/price_distributor.decorator +37 -0
  51. data/app/models/workarea/pricing/request.decorator +17 -0
  52. data/app/models/workarea/pricing/sku.decorator +17 -0
  53. data/app/models/workarea/search/admin/order.decorator +11 -0
  54. data/app/models/workarea/shipping/sku.decorator +23 -0
  55. data/app/models/workarea/shipping.decorator +11 -0
  56. data/app/models/workarea/user.decorator +10 -0
  57. data/app/seeds/workarea/global_e_seeds.rb +66 -0
  58. data/app/services/workarea/create_fulfillment.decorator +12 -0
  59. data/app/services/workarea/global_e/address_details.rb +218 -0
  60. data/app/services/workarea/global_e/api/notify_order_refunded.rb +45 -0
  61. data/app/services/workarea/global_e/api/perform_order_payment.rb +46 -0
  62. data/app/services/workarea/global_e/api/remove_restricted_products.rb +28 -0
  63. data/app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb +147 -0
  64. data/app/services/workarea/global_e/api/send_order_to_merchant/save_user.rb +59 -0
  65. data/app/services/workarea/global_e/api/send_order_to_merchant.rb +359 -0
  66. data/app/services/workarea/global_e/api/update_order_shipping_info.rb +38 -0
  67. data/app/services/workarea/global_e/api/update_order_status/canceled.rb +42 -0
  68. data/app/services/workarea/global_e/api/update_order_status.rb +28 -0
  69. data/app/services/workarea/global_e/attribute.rb +44 -0
  70. data/app/services/workarea/global_e/brand.rb +19 -0
  71. data/app/services/workarea/global_e/cart_user_details.rb +34 -0
  72. data/app/services/workarea/global_e/category.rb +19 -0
  73. data/app/services/workarea/global_e/checkout_cart_info.rb +358 -0
  74. data/app/services/workarea/global_e/custom_product_attribute.rb +19 -0
  75. data/app/services/workarea/global_e/discount.rb +215 -0
  76. data/app/services/workarea/global_e/merchant/brand.rb +21 -0
  77. data/app/services/workarea/global_e/merchant/category.rb +21 -0
  78. data/app/services/workarea/global_e/merchant/customer.rb +36 -0
  79. data/app/services/workarea/global_e/merchant/customer_details.rb +201 -0
  80. data/app/services/workarea/global_e/merchant/discount.rb +127 -0
  81. data/app/services/workarea/global_e/merchant/international_details.rb +296 -0
  82. data/app/services/workarea/global_e/merchant/order.rb +425 -0
  83. data/app/services/workarea/global_e/merchant/order_refund.rb +103 -0
  84. data/app/services/workarea/global_e/merchant/original_order.rb +28 -0
  85. data/app/services/workarea/global_e/merchant/parcel_tracking.rb +31 -0
  86. data/app/services/workarea/global_e/merchant/payment_details.rb +161 -0
  87. data/app/services/workarea/global_e/merchant/product.rb +222 -0
  88. data/app/services/workarea/global_e/merchant/refund_product.rb +69 -0
  89. data/app/services/workarea/global_e/merchant/response_info.rb +115 -0
  90. data/app/services/workarea/global_e/merchant_cart_product_attribute.rb +21 -0
  91. data/app/services/workarea/global_e/order_status.rb +20 -0
  92. data/app/services/workarea/global_e/order_status_details.rb +79 -0
  93. data/app/services/workarea/global_e/order_status_reason.rb +20 -0
  94. data/app/services/workarea/global_e/parcel.rb +53 -0
  95. data/app/services/workarea/global_e/product.rb +612 -0
  96. data/app/services/workarea/global_e/product_meta_data.rb +13 -0
  97. data/app/services/workarea/global_e/tracking_details.rb +23 -0
  98. data/app/services/workarea/global_e/update_order_dispatch_exception.rb +46 -0
  99. data/app/services/workarea/global_e/update_order_dispatch_request.rb +108 -0
  100. data/app/services/workarea/global_e/user_id_number_type.rb +21 -0
  101. data/app/services/workarea/global_e/users_details.rb +151 -0
  102. data/app/services/workarea/global_e/vat_category.rb +20 -0
  103. data/app/services/workarea/global_e/vat_rate_type.rb +27 -0
  104. data/app/services/workarea/save_order_analytics.decorator +18 -0
  105. data/app/view_models/workarea/admin/order_view_model.decorator +13 -0
  106. data/app/view_models/workarea/storefront/cart_view_model.decorator +7 -0
  107. data/app/view_models/workarea/storefront/order_item_view_model.decorator +16 -0
  108. data/app/view_models/workarea/storefront/order_view_model.decorator +45 -0
  109. data/app/view_models/workarea/storefront/product_view_model.decorator +35 -0
  110. data/app/views/workarea/admin/catalog_products/_country_exceptions_card.html.haml +31 -0
  111. data/app/views/workarea/admin/catalog_products/_global_e_attributes.html.haml +3 -0
  112. data/app/views/workarea/admin/catalog_products/_global_e_fields.html.haml +4 -0
  113. data/app/views/workarea/admin/country_exceptions/edit.html.haml +48 -0
  114. data/app/views/workarea/admin/country_exceptions/index.html.haml +47 -0
  115. data/app/views/workarea/admin/country_exceptions/new.html.haml +44 -0
  116. data/app/views/workarea/admin/fixed_prices/edit.html.haml +73 -0
  117. data/app/views/workarea/admin/fixed_prices/index.html.haml +55 -0
  118. data/app/views/workarea/admin/fixed_prices/new.html.haml +70 -0
  119. data/app/views/workarea/admin/orders/_global_e.html.haml +27 -0
  120. data/app/views/workarea/admin/orders/attributes.html.haml +131 -0
  121. data/app/views/workarea/admin/orders/global_e.html.haml +110 -0
  122. data/app/views/workarea/admin/orders/show.html.haml +27 -0
  123. data/app/views/workarea/admin/orders/tenders/_global_e_payment.html.haml +3 -0
  124. data/app/views/workarea/admin/pricing_skus/_cards.html.haml +98 -0
  125. data/app/views/workarea/storefront/cart_items/create.html.haml +71 -0
  126. data/app/views/workarea/storefront/carts/_pricing.html.haml +14 -0
  127. data/app/views/workarea/storefront/carts/show.html.haml +187 -0
  128. data/app/views/workarea/storefront/ge_checkouts/show.html.haml +1 -0
  129. data/app/views/workarea/storefront/global_e/_country_picker.html.haml +1 -0
  130. data/app/views/workarea/storefront/global_e/_head.html.haml +10 -0
  131. data/app/views/workarea/storefront/orders/_summary.html.haml +275 -0
  132. data/app/views/workarea/storefront/orders/tenders/_global_e_payment.html.haml +3 -0
  133. data/app/views/workarea/storefront/products/_pricing.html.haml +49 -0
  134. data/app/views/workarea/storefront/products/_restricted_item_text.html.haml +1 -0
  135. data/app/views/workarea/storefront/users/orders/_summary.html.haml +22 -0
  136. data/app/workers/workarea/global_e/update_order_dispatch.rb +28 -0
  137. data/app/workers/workarea/save_user_order_details.decorator +9 -0
  138. data/bin/rails +25 -0
  139. data/config/initializers/appends.rb +46 -0
  140. data/config/initializers/seeds.rb +1 -0
  141. data/config/initializers/workarea.rb +64 -0
  142. data/config/locales/en.yml +105 -0
  143. data/config/routes.rb +31 -0
  144. data/lib/workarea/global_e/engine.rb +10 -0
  145. data/lib/workarea/global_e/error.rb +8 -0
  146. data/lib/workarea/global_e/version.rb +5 -0
  147. data/lib/workarea/global_e.rb +58 -0
  148. data/script/admin_ci +5 -0
  149. data/script/ci +8 -0
  150. data/script/core_ci +5 -0
  151. data/script/plugins_ci +5 -0
  152. data/script/storefront_ci +5 -0
  153. data/test/dummy/.ruby-version +1 -0
  154. data/test/dummy/Rakefile +6 -0
  155. data/test/dummy/app/assets/config/manifest.js +3 -0
  156. data/test/dummy/app/assets/images/.keep +0 -0
  157. data/test/dummy/app/assets/javascripts/application.js +14 -0
  158. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  159. data/test/dummy/app/controllers/application_controller.rb +2 -0
  160. data/test/dummy/app/controllers/concerns/.keep +0 -0
  161. data/test/dummy/app/helpers/application_helper.rb +2 -0
  162. data/test/dummy/app/jobs/application_job.rb +2 -0
  163. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  164. data/test/dummy/app/models/concerns/.keep +0 -0
  165. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  166. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  167. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  168. data/test/dummy/bin/bundle +3 -0
  169. data/test/dummy/bin/rails +4 -0
  170. data/test/dummy/bin/rake +4 -0
  171. data/test/dummy/bin/setup +28 -0
  172. data/test/dummy/bin/update +28 -0
  173. data/test/dummy/bin/yarn +11 -0
  174. data/test/dummy/config/application.rb +23 -0
  175. data/test/dummy/config/boot.rb +5 -0
  176. data/test/dummy/config/environment.rb +5 -0
  177. data/test/dummy/config/environments/development.rb +52 -0
  178. data/test/dummy/config/environments/production.rb +83 -0
  179. data/test/dummy/config/environments/test.rb +45 -0
  180. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  181. data/test/dummy/config/initializers/assets.rb +14 -0
  182. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  183. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  184. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  185. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  186. data/test/dummy/config/initializers/inflections.rb +16 -0
  187. data/test/dummy/config/initializers/mime_types.rb +4 -0
  188. data/test/dummy/config/initializers/workarea.rb +5 -0
  189. data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
  190. data/test/dummy/config/locales/en.yml +33 -0
  191. data/test/dummy/config/puma.rb +34 -0
  192. data/test/dummy/config/routes.rb +5 -0
  193. data/test/dummy/config/secrets.yml +18 -0
  194. data/test/dummy/config/spring.rb +6 -0
  195. data/test/dummy/config.ru +5 -0
  196. data/test/dummy/db/seeds.rb +2 -0
  197. data/test/dummy/lib/assets/.keep +0 -0
  198. data/test/dummy/log/.keep +0 -0
  199. data/test/factories/workarea/global_e_factories.rb +836 -0
  200. data/test/integration/workarea/admin/catalog_product_country_exceptions_integration_test.rb +81 -0
  201. data/test/integration/workarea/admin/global_e_jump_to_integration_test.rb +20 -0
  202. data/test/integration/workarea/admin/pricing_sku_fixed_prices_integration_test.rb +83 -0
  203. data/test/integration/workarea/storefront/global_e_api/receive_order_integration_test.rb +278 -0
  204. data/test/integration/workarea/storefront/global_e_api/receive_order_refund_integration_test.rb +25 -0
  205. data/test/integration/workarea/storefront/global_e_api/receive_payment_integration_test.rb +34 -0
  206. data/test/integration/workarea/storefront/global_e_api/receive_shipping_info_integration_test.rb +29 -0
  207. data/test/integration/workarea/storefront/global_e_api/remove_restricted_products_integration_test.rb +27 -0
  208. data/test/integration/workarea/storefront/global_e_api/update_order_status_integration_test.rb +29 -0
  209. data/test/integration/workarea/storefront/global_e_checkout_cart_info/fixed_pricing_test.rb +438 -0
  210. data/test/integration/workarea/storefront/global_e_checkout_cart_info/gift_card_test.rb +63 -0
  211. data/test/integration/workarea/storefront/global_e_checkout_cart_info_integration_test.rb +660 -0
  212. data/test/integration/workarea/storefront/global_e_checkouts_integration_test.rb +71 -0
  213. data/test/integration/workarea/storefront/users/global_e_logins_integration_test.rb +20 -0
  214. data/test/models/workarea/catalog/product_global_e_test.rb +13 -0
  215. data/test/models/workarea/fixed_pricing_test.rb +117 -0
  216. data/test/models/workarea/global_e/country_exception_test.rb +36 -0
  217. data/test/models/workarea/payment_test.decorator +31 -0
  218. data/test/models/workarea/pricing/calculators/item_calculator_fixed_prices_test.rb +83 -0
  219. data/test/models/workarea/pricing/collection_fixed_prices_test.rb +83 -0
  220. data/test/models/workarea/pricing/price_distributor_test.decorator +21 -0
  221. data/test/models/workarea/pricing/sku_fixed_price_test.rb +133 -0
  222. data/test/support/workarea/global_e_support.rb +18 -0
  223. data/test/system/workarea/admin/global_e_system_test.rb +21 -0
  224. data/test/system/workarea/storefront/global_e_cart_system_test.rb +48 -0
  225. data/test/system/workarea/storefront/global_e_order_history_system_test.rb +43 -0
  226. data/test/teaspoon_env.rb +6 -0
  227. data/test/test_helper.rb +9 -0
  228. data/test/view_models/workarea/admin/global_e_order_view_model_test.rb +22 -0
  229. data/test/workers/workarea/global_e/update_order_dispatch_test.rb +64 -0
  230. data/test/workers/workarea/global_e_save_user_order_details_test.rb +41 -0
  231. data/workarea-global_e.gemspec +16 -0
  232. metadata +293 -0
@@ -0,0 +1,44 @@
1
+ - @page_title = t('workarea.admin.country_exceptions.new.page_title', product: @product.name)
2
+
3
+ .view
4
+ .view__header
5
+ .grid.grid--middle.grid--right
6
+ .grid__cell.grid__cell--50
7
+ .view__heading
8
+ = link_to_index_for(@product)
9
+ %h1= link_to @product.name, url_for(@product)
10
+ .grid__cell.grid__cell--25
11
+ = render_aux_navigation_for(@product)
12
+
13
+ .view__container
14
+ = render_cards_for(@product, :country_exceptions)
15
+
16
+ - @country_exception.errors.full_messages.each do |message|
17
+ = render_message 'error', message
18
+
19
+ = form_tag catalog_product_country_exceptions_path(@product), method: 'post', id: 'country_exception_form', data: { unsaved_changes: '' } do
20
+ %table
21
+ %thead
22
+ %tr
23
+ %th= t('workarea.admin.fields.country')
24
+ %th= t('workarea.admin.fields.restricted')
25
+ %th= t('workarea.admin.fields.vat_rate')
26
+ %tbody
27
+ - @product.country_exceptions.each do |country_exception|
28
+ %tr
29
+ %td= country_exception.country
30
+ %td= country_exception.restricted
31
+ %td= country_exception.vat_rate
32
+
33
+ %tr
34
+ %td
35
+ = select_tag "country_exception[country]", options_for_select(global_e_country_options, @country_exception.country&.alpha2), title: t('workarea.admin.fields.country')
36
+ %td
37
+ = toggle_button_for 'country_exception[restricted]', @country_exception.restricted?
38
+ %td
39
+ = text_field_tag 'country_exception[vat_rate]', @country_exception.vat_rate, class: 'text-box text-box--small', title: t('workarea.admin.fields.vat_rate')
40
+
41
+ .workflow-bar
42
+ .grid.grid--auto.grid--right.grid--middle
43
+ .grid__cell= render 'workarea/admin/shared/activate_select', name: 'country_exception[activate_with]'
44
+ .grid__cell= button_tag t('workarea.admin.country_exceptions.new.create_country_exception'), value: 'create_country_exception', class: 'workflow-bar__button workflow-bar__button--create'
@@ -0,0 +1,73 @@
1
+ - @page_title = t('workarea.admin.fixed_prices.title', sku: @sku.name)
2
+
3
+ .view
4
+ .view__header
5
+ .grid
6
+ .grid__cell.grid__cell--25
7
+ = render 'workarea/admin/releases/select'
8
+ .grid__cell.grid__cell--50
9
+ .view__heading
10
+ = link_to_index_for(@sku)
11
+ %h1= link_to @sku.name, url_for(@sku)
12
+ .grid__cell.grid__cell--25
13
+ = render_aux_navigation_for(@sku)
14
+
15
+ .view__container
16
+ = render_cards_for(@sku, :fixed_prices)
17
+
18
+ .view__container.view__container
19
+ = form_tag pricing_sku_fixed_price_path(@sku, @fixed_price), method: :patch, data: { unsaved_changes: '' } do
20
+ = hidden_field_tag "fixed_price[currency_code]", @fixed_price.currency.iso_code
21
+
22
+ %table
23
+ %thead
24
+ %tr
25
+ %th= t('workarea.admin.fixed_prices.country')
26
+ %th= t('workarea.admin.fixed_prices.regular_price')
27
+ %th #{t('workarea.admin.fixed_prices.sale_price')} #{t('workarea.admin.fixed_prices.sale_price_default')}
28
+ %th= t('workarea.admin.fixed_prices.msrp')
29
+ %th
30
+ = t('workarea.admin.fields.active')
31
+ = inline_svg('workarea/admin/i18n.svg', class: 'svg-icon svg-icon--small') if locale_options.many? && Workarea.config.localized_active_fields
32
+ %th
33
+ %th
34
+ %tbody
35
+ - @sku.fixed_prices.each do |fixed_price|
36
+ - if fixed_price.id == @fixed_price.id
37
+ %tr
38
+ %td
39
+ = select_tag "fixed_price[country]", options_for_select(global_e_country_options, @fixed_price.country&.alpha2), title: t('workarea.admin.field.country')
40
+ %td
41
+ %span.currency_symbol= fixed_price.currency.symbol
42
+ = text_field_tag 'fixed_price[regular]', fixed_price.regular, class: 'text-box text-box--small', title: t('workarea.admin.fields.regular'), id: "fixed_price[regular]"
43
+ %td
44
+ %span.currency_symbol= fixed_price.currency.symbol
45
+ = text_field_tag 'fixed_price[sale]', fixed_price.sale, class: 'text-box text-box--small', title: t('workarea.admin.fields.sale'), id: "fixed_price[sale]"
46
+ %td
47
+ - if fixed_price.msrp
48
+ %span.currency_symbol= fixed_price.currency.symbol
49
+ = text_field_tag 'fixed_price[msrp]', fixed_price.msrp, class: 'text-box text-box--small', title: t('workarea.admin.fields.msrp'), id: "fixed_price[msrp]"
50
+ %td
51
+ = toggle_button_for 'fixed_price[active]', @fixed_price.active?
52
+ %td
53
+ %td
54
+ - else
55
+ %tr
56
+ %td= fixed_price.country
57
+ %td= number_to_currency(fixed_price.regular)
58
+ %td= number_to_currency(fixed_price.sale)
59
+ %td
60
+ - if fixed_price.msrp
61
+ = number_to_currency(fixed_price.msrp)
62
+ %td
63
+ - if fixed_price.active?
64
+ = t('workarea.admin.fixed_prices.active')
65
+ - else
66
+ = t('workarea.admin.fixed_prices.inactive')
67
+ %td
68
+ %td
69
+
70
+ .workflow-bar
71
+ .grid.grid--auto.grid--right.grid--middle
72
+ .grid__cell= render 'workarea/admin/shared/publishing_select'
73
+ .grid__cell= button_tag t('workarea.admin.form.save_changes'), value: 'save_fixed_price', class: 'workflow-bar__button workflow-bar__button--update'
@@ -0,0 +1,55 @@
1
+ - @page_title = t('workarea.admin.fixed_prices.title', sku: @sku.name)
2
+
3
+ .view
4
+ .view__header
5
+ .grid
6
+ .grid__cell.grid__cell--25
7
+ = render 'workarea/admin/releases/select'
8
+ .grid__cell.grid__cell--50
9
+ .view__heading
10
+ = link_to_index_for(@sku)
11
+ %h1= link_to @sku.name, url_for(@sku)
12
+ .grid__cell.grid__cell--25
13
+ = render_aux_navigation_for(@sku)
14
+
15
+ .view__container
16
+ = render_cards_for(@sku, :fixed_prices)
17
+
18
+ .view__container.view__container--narrow
19
+ %table
20
+ %thead
21
+ %tr
22
+ %th= t('workarea.admin.fixed_prices.currency')
23
+ %th= t('workarea.admin.fixed_prices.country')
24
+ %th= t('workarea.admin.fixed_prices.regular_price')
25
+ %th #{t('workarea.admin.fixed_prices.sale_price')} #{t('workarea.admin.fixed_prices.sale_price_default')}
26
+ %th= t('workarea.admin.fixed_prices.msrp')
27
+ %th= t('workarea.admin.fields.active')
28
+ %th= t('workarea.admin.fields.on_sale')
29
+ %th
30
+ %tbody
31
+ - @sku.fixed_prices.each do |fixed_price|
32
+ %tr
33
+ %td #{fixed_price.currency} (#{fixed_price.currency.symbol})
34
+ %td= fixed_price.country&.name
35
+ %td= number_to_currency(fixed_price.regular)
36
+ %td= number_to_currency(fixed_price.sale)
37
+ %td
38
+ - if fixed_price.msrp
39
+ = number_to_currency(fixed_price.msrp)
40
+ %td
41
+ - if fixed_price.active?
42
+ = t('workarea.admin.fixed_prices.active')
43
+ - else
44
+ = t('workarea.admin.fixed_prices.inactive')
45
+ %td= fixed_price.on_sale? ? t("workarea.admin.pricing_skus.on_sale") : t("workarea.admin.pricing_skus.not_on_sale")
46
+ %td
47
+ .align-right<
48
+ = link_to edit_pricing_sku_fixed_price_path(@sku, fixed_price), id: dom_id(fixed_price, 'edit_action') do
49
+ = inline_svg('workarea/admin/icons/edit.svg', class: 'svg-icon svg-icon--small', title: t('workarea.admin.actions.edit'))
50
+ = link_to pricing_sku_fixed_price_path(@sku, fixed_price), id: dom_id(fixed_price, 'delete_action'), data: { method: 'delete', confirm: t('workarea.admin.actions.delete_confirmation') } do
51
+ = inline_svg('workarea/admin/icons/delete.svg', class: 'svg-icon svg-icon--small svg-icon--red', title: t('workarea.admin.actions.delete'))
52
+
53
+ .workflow-bar
54
+ .grid.grid--auto.grid--right.grid--middle
55
+ .grid__cell= link_to t('workarea.admin.fixed_prices.index.button'), new_pricing_sku_fixed_price_path(@sku), id: 'add_pricing_sku_fixed_price', class: 'workflow-bar__button workflow-bar__button--create'
@@ -0,0 +1,70 @@
1
+ - @page_title = t('workarea.admin.fixed_prices.title', sku: @sku.name)
2
+
3
+ .view
4
+ .view__header
5
+ .grid.grid--middle.grid--right
6
+ .grid__cell.grid__cell--50
7
+ .view__heading
8
+ = link_to_index_for(@sku)
9
+ %h1= link_to @sku.name, url_for(@sku)
10
+ .grid__cell.grid__cell--25
11
+ = render_aux_navigation_for(@sku)
12
+
13
+ .view__container
14
+ = render_cards_for(@sku, :fixed_prices)
15
+
16
+ .view__container.view__container
17
+ - @fixed_price.errors.full_messages.each do |message|
18
+ = render_message 'error', message
19
+
20
+ %p= t('workarea.admin.fixed_prices.fixed_price_description')
21
+
22
+ = form_tag pricing_sku_fixed_prices_path(@sku), method: :post, data: { unsaved_changes: '' } do
23
+ %table
24
+ %thead
25
+ %tr
26
+ %th= t('workarea.admin.fixed_prices.currency')
27
+ %th= t('workarea.admin.fixed_prices.country')
28
+ %th= t('workarea.admin.fixed_prices.regular_price')
29
+ %th= t('workarea.admin.fixed_prices.sale_price')
30
+ %th= t('workarea.admin.fixed_prices.msrp')
31
+ %th= t('workarea.admin.fields.active')
32
+ %th
33
+ %th
34
+ %tbody
35
+ - @sku.fixed_prices.each do |fixed_price, index|
36
+ %tr
37
+ %td #{fixed_price.currency.name} (#{fixed_price.currency.symbol})
38
+ %td= fixed_price.country
39
+ %td= number_to_currency(fixed_price.regular)
40
+ %td= number_to_currency(fixed_price.sale)
41
+ %td
42
+ - if fixed_price.msrp
43
+ = number_to_currency(fixed_price.msrp)
44
+ %td
45
+ - if fixed_price.active?
46
+ = t('workarea.admin.fixed_prices.active')
47
+ - else
48
+ = t('workarea.admin.fixed_prices.inactive')
49
+ %td
50
+ %td
51
+
52
+ %tr
53
+ %td
54
+ = select_tag "fixed_price[currency_code]", options_for_select(currency_options, @fixed_price.currency_code), title: t('workarea.admin.fields.currency')
55
+ %td
56
+ = select_tag "fixed_price[country]", options_for_select(global_e_country_options, @fixed_price.country&.alpha2), title: t('workarea.admin.fields.country')
57
+ %td
58
+ = text_field_tag 'fixed_price[regular]', @fixed_price.regular, class: 'text-box text-box--small', title: t('workarea.admin.fields.regular')
59
+ %td
60
+ = text_field_tag 'fixed_price[sale]', @fixed_price.sale, class: 'text-box text-box--small', title: t('workarea.admin.fields.sale')
61
+ %td
62
+ = text_field_tag 'fixed_price[msrp]', @fixed_price.msrp, class: 'text-box text-box--small', title: t('workarea.admin.fields.msrp')
63
+ %td
64
+ = toggle_button_for 'fixed_price[active]', @fixed_price.active
65
+ %td
66
+ %td
67
+
68
+ .workflow-bar
69
+ .grid.grid--auto.grid--right.grid--middle
70
+ .grid__cell= button_tag t('workarea.admin.fixed_prices.new.create_fixed_price'), value: 'create_fixed_price', class: 'workflow-bar__button workflow-bar__button--create'
@@ -0,0 +1,27 @@
1
+ - if order.global_e?
2
+ .grid__cell
3
+ .card{ class: card_classes(:global_e, local_assigns[:active]) }
4
+ = link_to global_e_order_path(order), class: 'card__header' do
5
+ %span.card__header-text= t('workarea.admin.orders.cards.global_e.title')
6
+ = inline_svg 'workarea/admin/i18n.svg', class: 'card__icon'
7
+
8
+ - if local_assigns[:active].blank?
9
+ .card__body
10
+ %ul.list-reset
11
+ %li
12
+ %strong= t('workarea.admin.orders.cards.global_e.global_e_id')
13
+ = order.global_e_id
14
+ %li
15
+ %strong= t('workarea.admin.orders.cards.global_e.international_subtotal_price')
16
+ = order.international_subtotal_price
17
+ %li
18
+ %strong= t('workarea.admin.orders.cards.global_e.international_shipping_total')
19
+ = order.international_shipping_total
20
+ %li
21
+ %strong= t('workarea.admin.orders.cards.global_e.total_duties_price')
22
+ = number_to_currency order.total_duties_price
23
+ %li
24
+ %strong= t('workarea.admin.orders.cards.global_e.total_price')
25
+ = number_to_currency order.international_total_price
26
+ = link_to global_e_order_path(order), class: 'card__button' do
27
+ %span.button.button--small= t('workarea.admin.orders.cards.global_e.button')
@@ -0,0 +1,131 @@
1
+ - @page_title = t('workarea.admin.orders.attributes.title', name: @order.name)
2
+
3
+ .view
4
+ .view__header
5
+ .grid.grid--middle.grid--right
6
+ .grid__cell.grid__cell--50
7
+ .view__heading
8
+ = link_to_index_for(@order)
9
+ %h1= link_to @order.name, url_for(@order)
10
+ .grid__cell.grid__cell--25
11
+ = render_aux_navigation_for(@order)
12
+
13
+ .view__container
14
+ = render_cards_for(@order, :attributes)
15
+
16
+ .view__container.view__container--narrow
17
+ .grid
18
+ .grid__cell.grid__cell--25
19
+ %h2= t('workarea.admin.orders.attributes.checkout.title')
20
+ %ul.list-reset
21
+ - if @order.user.present? || @order.email.present?
22
+ %li
23
+ %strong= t('workarea.admin.orders.attributes.checkout.customer')
24
+ - if @order.user.present?
25
+ = link_to @order.user.name, user_path(@order.user)
26
+ - else
27
+ = @order.email
28
+ - if @order.checkout_by.present? && @order.checkout_by != @order.user
29
+ %li
30
+ %strong
31
+ = t('workarea.admin.orders.attributes.checkout.placed_by')
32
+ = link_to @order.checkout_by.name, user_path(@order.checkout_by)
33
+ - if @order.source.present?
34
+ %li
35
+ %strong
36
+ = t('workarea.admin.orders.attributes.checkout.source')
37
+ = @order.source.titleize
38
+ - if @order.copied_from.present?
39
+ %li
40
+ %strong
41
+ = t('workarea.admin.fields.copied_from_id')
42
+ = link_to @order.copied_from.name, order_path(@order.copied_from)
43
+ %li
44
+ %strong= t('workarea.admin.orders.attributes.checkout.status')
45
+ = @order.model.status.to_s.titleize
46
+ %li
47
+ %strong= t('workarea.admin.orders.attributes.checkout.promo_codes')
48
+ = @order.promo_codes.join(', ').presence || t('workarea.admin.orders.attributes.checkout.none')
49
+ %li
50
+ %strong= t('workarea.admin.orders.attributes.checkout.placed')
51
+ - if @order.placed?
52
+ = local_time_ago(@order.placed_at)
53
+ %li
54
+ %strong= t('workarea.admin.orders.attributes.checkout.ip_address')
55
+ = @order.ip_address.presence || t('workarea.admin.orders.attributes.checkout.none')
56
+ %li
57
+ %strong= t('workarea.admin.fields.updated_at')
58
+ #{local_time_ago(@order.updated_at)}
59
+ %li
60
+ %strong= t('workarea.admin.fields.created_at')
61
+ #{local_time_ago(@order.created_at)}
62
+ = append_partials('admin.order_attributes', order: @order)
63
+
64
+ .grid__cell.grid__cell--75
65
+ %h2= t('workarea.admin.orders.attributes.items.title')
66
+ %table
67
+ %thead
68
+ %tr
69
+ %th= t('workarea.admin.orders.attributes.items.product')
70
+ %th.align-center= t('workarea.admin.orders.attributes.items.quantity')
71
+ %th.align-right= t('workarea.admin.orders.attributes.items.pricing')
72
+ %th.align-right= t('workarea.admin.orders.attributs.items.nonadjusted_pricing')
73
+ %tbody
74
+ - @order.items.each do |item|
75
+ %tr
76
+ %td
77
+ .grid.grid--auto
78
+ .grid__cell
79
+ = link_to image_tag(product_image_url(item.image, :small), alt: item.product.name), catalog_product_url(item.product, sku: item.sku)
80
+ .grid__cell
81
+ %p= link_to item.product.name, catalog_product_path(item.product, sku: item.sku)
82
+ %p= item.sku
83
+ - if item.customizations.any?
84
+ - item.customizations.each do |name, value|
85
+ %p #{name.titleize}: #{value}
86
+ = append_partials('admin.order_attributes_item_details', item: item)
87
+ %td.align-center= item.quantity
88
+ %td.align-right
89
+ - item.price_adjustments.each do |adjustment|
90
+ %p
91
+ %strong= price_adjustment_description_for(adjustment)
92
+ %span= number_to_currency(adjustment.amount)
93
+ %td.align-right
94
+ - if item.nonadjusted_amount.present?
95
+ %p
96
+ %span= number_to_currency(item.nonadjusted_amount.amount)
97
+ .grid.grid--right
98
+ .grid__cell.grid__cell--50
99
+ %table.data-pairs
100
+ %tbody
101
+ %tr
102
+ %th
103
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.subtotal')
104
+ %td= number_to_currency @order.subtotal_price
105
+ - if @order.total_adjustments.any?
106
+ - @order.total_adjustments.each do |adjustment|
107
+ %tr
108
+ %th
109
+ %span= adjustment.description.titleize
110
+ %td
111
+ - if adjustment.discount?
112
+ %strong= number_to_currency(adjustment.amount)
113
+ - else
114
+ %span= number_to_currency(adjustment.amount)
115
+ %tr
116
+ %th
117
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.shipping')
118
+ %td= number_to_currency @order.shipping_total
119
+ %tr
120
+ %th
121
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.tax')
122
+ %td= number_to_currency @order.tax_total
123
+ %tr
124
+ %th
125
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.total_price')
126
+ %td
127
+ %strong= number_to_currency @order.total_price
128
+ %tr
129
+ %th
130
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.total_value')
131
+ %td= number_to_currency @order.total_value
@@ -0,0 +1,110 @@
1
+ - @page_title = t('workarea.admin.orders.global_e.title', name: @order.name)
2
+
3
+ .view
4
+ .view__header
5
+ .grid.grid--middle.grid--right
6
+ .grid__cell.grid__cell--50
7
+ .view__heading
8
+ = link_to_index_for(@order)
9
+ %h1= link_to @order.name, url_for(@order)
10
+ .grid__cell.grid__cell--25
11
+ = render_aux_navigation_for(@order)
12
+
13
+ .view__container
14
+ = render_cards_for(@order, :global_e)
15
+
16
+ .view__container.view__container--narrow
17
+ %h2
18
+ = t('workarea.admin.orders.global_e.global_e_id')
19
+ = @order.global_e_id
20
+ %span (#{@order.currency})
21
+ .section
22
+ .grid.grid--huge
23
+ .grid__cell.grid__cell--66-at-medium
24
+ %h2= t('workarea.admin.orders.global_e.items.title')
25
+ %table
26
+ %thead
27
+ %tr
28
+ %th= t('workarea.admin.orders.global_e.items.product')
29
+ %th.align-center= t('workarea.admin.orders.global_e.items.quantity')
30
+ %th.align-right= t('workarea.admin.orders.global_e.items.international_pricing')
31
+ %tbody
32
+ - @order.items.each do |item|
33
+ %tr
34
+ %td
35
+ .grid.grid--auto
36
+ .grid__cell
37
+ = link_to image_tag(product_image_url(item.image, :small), alt: item.product.name), catalog_product_url(item.product, sku: item.sku)
38
+ .grid__cell
39
+ %p= link_to item.product.name, catalog_product_path(item.product, sku: item.sku)
40
+ %p= item.sku
41
+ - if item.customizations.any?
42
+ - item.customizations.each do |name, value|
43
+ %p #{name.titleize}: #{value}
44
+ = append_partials('admin.order_attributes_item_details', item: item)
45
+ %td.align-center= item.quantity
46
+ %td.align-right
47
+ - item.international_price_adjustments.each do |adjustment|
48
+ %p
49
+ %strong= price_adjustment_description_for(adjustment)
50
+ %span= number_to_currency(adjustment.amount)
51
+
52
+ .grid__cell.grid__cell--33-at-medium
53
+ %h2= t('workarea.admin.orders.global_e.international_totals')
54
+ %table
55
+ %thead
56
+ %tr
57
+ %th
58
+ %th.align-right= t('workarea.admin.field.amount')
59
+ %tbody
60
+ %tr
61
+ %td
62
+ %p= t('workarea.admin.orders.cards.global_e.international_subtotal_price')
63
+ %td.align-right= number_to_currency(@order.international_subtotal_price)
64
+ - if @order.international_discount_adjustments.any?
65
+ - @order.international_discount_adjustments.each do |adjustment|
66
+ %tr
67
+ %td
68
+ %span= adjustment.description.titleize
69
+ %td.align-right
70
+ - if adjustment.discount?
71
+ %strong= number_to_currency(adjustment.amount)
72
+ - else
73
+ %span= number_to_currency(adjustment.amount)
74
+ - if @order.discount_adjustments.any?
75
+ - @order.discount_adjustments.each do |adjustment|
76
+ %tr
77
+ %td
78
+ %span= adjustment.description.titleize
79
+ %td.align-right
80
+ - if adjustment.discount?
81
+ %strong= number_to_currency(adjustment.amount)
82
+ - else
83
+ %span= number_to_currency(adjustment.amount)
84
+ %tr
85
+ %td
86
+ %p= t('workarea.admin.orders.cards.global_e.international_shipping_total')
87
+ %td.align-right= number_to_currency(@order.international_shipping_total)
88
+ %tr
89
+ %td
90
+ %p= t('workarea.admin.orders.cards.global_e.total_duties_price')
91
+ %td.align-right= number_to_currency @order.total_duties_price
92
+ %tr
93
+ %td
94
+ %p= t('workarea.admin.orders.cards.global_e.total_price')
95
+ %td.align-right= number_to_currency @order.international_total_price
96
+
97
+ - if current_user.super_admin?
98
+ .view__container
99
+ %h2= t('workarea.admin.orders.global_e.raw_receive_order')
100
+ .section
101
+ %table.data-pairs
102
+ %tbody
103
+ - @order.global_e_api_events.receive_order.each do |key, value|
104
+ - sanitized = sanitize_config_value(value)
105
+ - if sanitized.present?
106
+ %tr
107
+ %th
108
+ %span.data-pairs__name= key.to_s.titleize
109
+ %td
110
+ = sanitized
@@ -0,0 +1,27 @@
1
+ - @page_title = @order.name
2
+
3
+ .view
4
+ .view__header
5
+ .grid.grid--middle.grid--right
6
+ .grid__cell.grid__cell--50
7
+ .view__heading
8
+ = link_to_index_for(@order)
9
+ %h1
10
+ = @order.name
11
+ - if @order.global_e_id.present?
12
+ (#{@order.global_e_id})
13
+ .grid__cell.grid__cell--25
14
+ = render_aux_navigation_for(@order)
15
+
16
+ .view__container
17
+ = render_cards_for(@order)
18
+
19
+ - if partials_to_append?('admin.order_show_workflow_bar_left') || partials_to_append?('admin.order_show_workflow_bar_right')
20
+ .workflow-bar
21
+ .grid
22
+ .grid__cell.grid__cell--50
23
+ .grid.grid--auto.grid--middle
24
+ = append_partials('admin.order_show_workflow_bar_left', order: @order)
25
+ .grid__cell.grid__cell--50
26
+ .grid.grid--auto.grid--right.grid--middle
27
+ = append_partials('admin.order_show_workflow_bar_right', order: @order)
@@ -0,0 +1,3 @@
1
+ %li
2
+ = "GlobalE Payment: #{tender.name}"
3
+ = number_to_currency tender.amount
@@ -0,0 +1,98 @@
1
+ .grid.grid--auto.grid--flush.grid--center
2
+ .grid__cell
3
+ .card{ class: card_classes(:attributes, local_assigns[:active]) }
4
+ = link_to edit_pricing_sku_path(model), class: 'card__header' do
5
+ %span.card__header-text= t('workarea.admin.cards.attributes.title')
6
+ = inline_svg 'workarea/admin/icons/attributes.svg', class: 'card__icon'
7
+
8
+ - if local_assigns[:active].blank?
9
+ .card__body
10
+ %ul.list-reset
11
+ %li
12
+ %strong #{t('workarea.admin.fields.active')}?
13
+ = check_box_tag 'sku', 'active', model.active, disabled: true
14
+ %li
15
+ %strong #{t('workarea.admin.fields.tax_code')}:
16
+ = model.tax_code.presence || '(none)'
17
+ %li
18
+ %strong #{t('workarea.admin.fields.msrp')}:
19
+ - if model.msrp.blank?
20
+ = t('workarea.admin.cards.attributes.no_value')
21
+ - else
22
+ = number_to_currency model.msrp
23
+ %li
24
+ %strong #{t('workarea.admin.fields.on_sale')}:
25
+ = model.on_sale?.to_s.titleize
26
+ %li
27
+ %strong #{t('workarea.admin.fields.discountable')}:
28
+ = model.discountable?.to_s.titleize
29
+ %li
30
+ %strong= t('workarea.admin.fields.updated_at')
31
+ #{local_time_ago(model.updated_at)}
32
+ %li
33
+ %strong= t('workarea.admin.fields.created_at')
34
+ #{local_time_ago(model.created_at)}
35
+ = append_partials('admin.pricing_sku_attributes_card', pricing_sku: model)
36
+
37
+ = link_to edit_pricing_sku_path(model), class: 'card__button' do
38
+ %span.button.button--small= t('workarea.admin.cards.attributes.button')
39
+
40
+ .grid__cell
41
+ .card{ class: card_classes(:prices, local_assigns[:active]) }
42
+ = link_to pricing_sku_prices_path(model), class: 'card__header' do
43
+ %span.card__header-text= t('workarea.admin.prices.label')
44
+ = inline_svg 'workarea/admin/icons/prices.svg', class: 'card__icon'
45
+
46
+ - if local_assigns[:active].blank?
47
+ .card__body
48
+ %ul.list-reset
49
+ - model.prices.take(10).each do |price|
50
+ %li
51
+ %strong= t('workarea.admin.prices.regular_price')
52
+ = number_to_currency price.regular
53
+ - if price.min_quantity > 1
54
+ = t('workarea.admin.pricing_skus.cards.prices.summary', quantity: price.min_quantity)
55
+ - if price.sale?
56
+ %li
57
+ %strong= t('workarea.admin.prices.sale_price')
58
+ = number_to_currency price.sale
59
+
60
+ %hr.card__hr
61
+ - if model.prices.size > 10
62
+ %li= t('workarea.admin.cards.more', amount: model.prices.size - 10)
63
+ = link_to pricing_sku_prices_path(model), class: 'card__button' do
64
+ %span.button.button--small= t('workarea.admin.pricing_skus.cards.prices.button')
65
+
66
+ .grid__cell
67
+ .card{ class: card_classes(:fixed_prices, local_assigns[:active]) }
68
+ = link_to pricing_sku_fixed_prices_path(model), class: 'card__header' do
69
+ %span.card__header-text= t('workarea.admin.fixed_prices.label')
70
+ = inline_svg 'workarea/admin/i18n.svg', class: 'card__icon'
71
+
72
+ - if local_assigns[:active].blank?
73
+ .card__body
74
+ %ul.list-reset
75
+ - model.fixed_prices.take(10).each do |fixed_price|
76
+ %li
77
+ %strong= t('workarea.admin.fixed_prices.currency')
78
+ #{fixed_price.currency} (#{fixed_price.currency.symbol})
79
+ - if fixed_price.country.present?
80
+ %li
81
+ %strong= t('workarea.admin.fixed_prices.country')
82
+ = fixed_price.country.name
83
+ %li
84
+ %strong= t('workarea.admin.fixed_prices.regular_price')
85
+ = number_to_currency fixed_price.regular
86
+ - if fixed_price.sale?
87
+ %li
88
+ %strong= t('workarea.admin.fixed_prices.sale_price')
89
+ = number_to_currency fixed_price.sale
90
+
91
+ %hr.card__hr
92
+ - if model.fixed_prices.size > 10
93
+ %li= t('workarea.admin.cards.more', amount: model.fixed_prices.size - 10)
94
+ = link_to pricing_sku_fixed_prices_path(model), class: 'card__button' do
95
+ %span.button.button--small= t('workarea.admin.pricing_skus.cards.fixed_prices.button')
96
+
97
+ .grid__cell
98
+ = render 'workarea/admin/timeline/card', timeline: model.timeline, active: local_assigns[:active]