spina-shop 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/config/spina_shop_manifest.js +0 -0
  6. data/app/assets/fonts/montserrat-bold.ttf +0 -0
  7. data/app/assets/fonts/montserrat-italic.ttf +0 -0
  8. data/app/assets/fonts/montserrat-medium.ttf +0 -0
  9. data/app/assets/fonts/montserrat-regular.ttf +0 -0
  10. data/app/assets/fonts/montserrat-semibold.ttf +0 -0
  11. data/app/assets/images/spina/shop/delete-big-confirm.png +0 -0
  12. data/app/assets/images/spina/shop/delete-big.png +0 -0
  13. data/app/assets/javascripts/spina/shop/admin/app.infinitescroll.js.coffee +23 -0
  14. data/app/assets/javascripts/spina/shop/admin/customers.coffee +27 -0
  15. data/app/assets/javascripts/spina/shop/admin/orders.coffee +18 -0
  16. data/app/assets/javascripts/spina/shop/admin/product_bundles.coffee +15 -0
  17. data/app/assets/javascripts/spina/shop/admin/product_categories.coffee +15 -0
  18. data/app/assets/javascripts/spina/shop/admin/products.coffee +88 -0
  19. data/app/assets/javascripts/spina/shop/admin/shop.js +10 -0
  20. data/app/assets/stylesheets/spina/shop/admin/_customers.sass +10 -0
  21. data/app/assets/stylesheets/spina/shop/admin/_forms.sass +191 -0
  22. data/app/assets/stylesheets/spina/shop/admin/_product_bundles.sass +12 -0
  23. data/app/assets/stylesheets/spina/shop/admin/_status_dots.sass +16 -0
  24. data/app/assets/stylesheets/spina/shop/admin/_tables.sass +2 -0
  25. data/app/assets/stylesheets/spina/shop/admin/_tooltips.sass +31 -0
  26. data/app/assets/stylesheets/spina/shop/admin/shop.css.sass +11 -0
  27. data/app/controllers/spina/shop/admin/admin_controller.rb +8 -0
  28. data/app/controllers/spina/shop/admin/customer_accounts_controller.rb +38 -0
  29. data/app/controllers/spina/shop/admin/customers_controller.rb +67 -0
  30. data/app/controllers/spina/shop/admin/discounts_controller.rb +65 -0
  31. data/app/controllers/spina/shop/admin/gift_cards_controller.rb +65 -0
  32. data/app/controllers/spina/shop/admin/invoices_controller.rb +12 -0
  33. data/app/controllers/spina/shop/admin/order_items_controller.rb +36 -0
  34. data/app/controllers/spina/shop/admin/orders/packing_slips_controller.rb +27 -0
  35. data/app/controllers/spina/shop/admin/orders/shipping_labels_controller.rb +19 -0
  36. data/app/controllers/spina/shop/admin/orders_controller.rb +123 -0
  37. data/app/controllers/spina/shop/admin/product_reviews_controller.rb +17 -0
  38. data/app/controllers/spina/shop/admin/products/product_bundles_controller.rb +62 -0
  39. data/app/controllers/spina/shop/admin/products/stock_forecasts_controller.rb +15 -0
  40. data/app/controllers/spina/shop/admin/products/stock_level_adjustments_controller.rb +33 -0
  41. data/app/controllers/spina/shop/admin/products_controller.rb +135 -0
  42. data/app/controllers/spina/shop/admin/reports_controller.rb +33 -0
  43. data/app/controllers/spina/shop/admin/settings/product_categories_controller.rb +45 -0
  44. data/app/controllers/spina/shop/admin/settings/product_category_properties_controller.rb +49 -0
  45. data/app/controllers/spina/shop/admin/settings/sales_categories_controller.rb +14 -0
  46. data/app/controllers/spina/shop/admin/settings/shop_controller.rb +9 -0
  47. data/app/controllers/spina/shop/admin/settings/tax_groups_controller.rb +47 -0
  48. data/app/controllers/spina/shop/admin/variants_controller.rb +8 -0
  49. data/app/jobs/spina/shop/in_stock_reminder_job.rb +17 -0
  50. data/app/jobs/spina/shop/invoice_report_job.rb +23 -0
  51. data/app/jobs/spina/shop/payments_report_job.rb +23 -0
  52. data/app/mailers/spina/shop/customer_account_mailer.rb +32 -0
  53. data/app/mailers/spina/shop/export_mailer.rb +22 -0
  54. data/app/mailers/spina/shop/in_stock_reminder_mailer.rb +22 -0
  55. data/app/mailers/spina/shop/order_mailer.rb +32 -0
  56. data/app/models/concerns/spina/shop/preferable.rb +27 -0
  57. data/app/models/concerns/spina/shop/tax_rateable.rb +11 -0
  58. data/app/models/spina/shop/address.rb +19 -0
  59. data/app/models/spina/shop/application_record.rb +5 -0
  60. data/app/models/spina/shop/bundled_product.rb +6 -0
  61. data/app/models/spina/shop/campaign.rb +4 -0
  62. data/app/models/spina/shop/collectable.rb +8 -0
  63. data/app/models/spina/shop/country.rb +5 -0
  64. data/app/models/spina/shop/customer.rb +60 -0
  65. data/app/models/spina/shop/customer_account.rb +15 -0
  66. data/app/models/spina/shop/customer_group.rb +9 -0
  67. data/app/models/spina/shop/delivery_option.rb +27 -0
  68. data/app/models/spina/shop/discount.rb +39 -0
  69. data/app/models/spina/shop/discount_action.rb +16 -0
  70. data/app/models/spina/shop/discount_rule.rb +17 -0
  71. data/app/models/spina/shop/discounts/actions/percent_off.rb +17 -0
  72. data/app/models/spina/shop/discounts/rules/all_orders.rb +13 -0
  73. data/app/models/spina/shop/discounts/rules/collection.rb +14 -0
  74. data/app/models/spina/shop/discounts/rules/order_total.rb +17 -0
  75. data/app/models/spina/shop/discounts_order.rb +6 -0
  76. data/app/models/spina/shop/favorite.rb +8 -0
  77. data/app/models/spina/shop/gift_card.rb +53 -0
  78. data/app/models/spina/shop/gift_cards_order.rb +6 -0
  79. data/app/models/spina/shop/in_stock_reminder.rb +7 -0
  80. data/app/models/spina/shop/invoice.rb +49 -0
  81. data/app/models/spina/shop/invoice_line.rb +13 -0
  82. data/app/models/spina/shop/number_sequence.rb +19 -0
  83. data/app/models/spina/shop/order.rb +222 -0
  84. data/app/models/spina/shop/order/billing.rb +85 -0
  85. data/app/models/spina/shop/order/state_machine_transitions.rb +106 -0
  86. data/app/models/spina/shop/order_attachment.rb +9 -0
  87. data/app/models/spina/shop/order_item.rb +101 -0
  88. data/app/models/spina/shop/order_transition.rb +5 -0
  89. data/app/models/spina/shop/product.rb +227 -0
  90. data/app/models/spina/shop/product_bundle.rb +51 -0
  91. data/app/models/spina/shop/product_bundle_part.rb +13 -0
  92. data/app/models/spina/shop/product_category.rb +18 -0
  93. data/app/models/spina/shop/product_category_property.rb +14 -0
  94. data/app/models/spina/shop/product_collection.rb +8 -0
  95. data/app/models/spina/shop/product_image.rb +18 -0
  96. data/app/models/spina/shop/product_item.rb +93 -0
  97. data/app/models/spina/shop/product_part.rb +13 -0
  98. data/app/models/spina/shop/product_relation.rb +6 -0
  99. data/app/models/spina/shop/product_review.rb +22 -0
  100. data/app/models/spina/shop/property_option.rb +16 -0
  101. data/app/models/spina/shop/sales_category.rb +43 -0
  102. data/app/models/spina/shop/sales_category_code.rb +20 -0
  103. data/app/models/spina/shop/shop_review.rb +19 -0
  104. data/app/models/spina/shop/stock_level_adjustment.rb +17 -0
  105. data/app/models/spina/shop/tax_group.rb +62 -0
  106. data/app/models/spina/shop/tax_rate.rb +20 -0
  107. data/app/models/spina/shop/zone.rb +11 -0
  108. data/app/pdfs/spina/shop/invoice_pdf.rb +114 -0
  109. data/app/pdfs/spina/shop/packing_slip_pdf.rb +74 -0
  110. data/app/presenters/spina/shop/invoice_presenter.rb +30 -0
  111. data/app/services/spina/shop/allocate_stock.rb +42 -0
  112. data/app/services/spina/shop/cache_order.rb +47 -0
  113. data/app/services/spina/shop/change_stock_level.rb +38 -0
  114. data/app/services/spina/shop/country_importer.rb +14 -0
  115. data/app/services/spina/shop/customer_generator.rb +32 -0
  116. data/app/services/spina/shop/deallocate_stock.rb +17 -0
  117. data/app/services/spina/shop/invoice_generator.rb +72 -0
  118. data/app/services/spina/shop/invoice_number_generator.rb +10 -0
  119. data/app/services/spina/shop/invoices_pdfs_exporter.rb +22 -0
  120. data/app/services/spina/shop/order_number_generator.rb +10 -0
  121. data/app/services/spina/shop/payments_excel_exporter.rb +41 -0
  122. data/app/services/spina/shop/store_address.rb +23 -0
  123. data/app/state_machines/spina/shop/order_state_machine.rb +116 -0
  124. data/app/uploaders/spina/shop/exports_uploader.rb +9 -0
  125. data/app/views/layouts/spina/shop/admin/settings/shop.html.haml +16 -0
  126. data/app/views/layouts/spina/shop/mail.html.erb +1 -0
  127. data/app/views/spina/admin/hooks/shop/_head.html.haml +2 -0
  128. data/app/views/spina/admin/hooks/shop/_primary_navigation.html.haml +31 -0
  129. data/app/views/spina/admin/hooks/shop/_settings_secondary_navigation.html.haml +2 -0
  130. data/app/views/spina/admin/page_partables/shop/product_bundle_parts/_form.html.haml +6 -0
  131. data/app/views/spina/admin/page_partables/shop/product_parts/_form.html.haml +6 -0
  132. data/app/views/spina/admin/structure_partables/shop/product_parts/_form.html.haml +3 -0
  133. data/app/views/spina/shop/admin/customer_accounts/_form.html.haml +32 -0
  134. data/app/views/spina/shop/admin/customer_accounts/edit.html.haml +1 -0
  135. data/app/views/spina/shop/admin/customers/_address_fields.html.haml +46 -0
  136. data/app/views/spina/shop/admin/customers/_customer.html.haml +11 -0
  137. data/app/views/spina/shop/admin/customers/_form.html.haml +67 -0
  138. data/app/views/spina/shop/admin/customers/edit.html.haml +1 -0
  139. data/app/views/spina/shop/admin/customers/index.html.haml +52 -0
  140. data/app/views/spina/shop/admin/customers/index.js.erb +4 -0
  141. data/app/views/spina/shop/admin/customers/new.html.haml +1 -0
  142. data/app/views/spina/shop/admin/customers/show.html.haml +121 -0
  143. data/app/views/spina/shop/admin/discounts/_form.html.haml +60 -0
  144. data/app/views/spina/shop/admin/discounts/edit.html.haml +1 -0
  145. data/app/views/spina/shop/admin/discounts/fields/_all_orders.html.haml +0 -0
  146. data/app/views/spina/shop/admin/discounts/fields/_discount_action_fields.html.haml +8 -0
  147. data/app/views/spina/shop/admin/discounts/fields/_discount_rule_fields.html.haml +0 -0
  148. data/app/views/spina/shop/admin/discounts/index.html.haml +36 -0
  149. data/app/views/spina/shop/admin/discounts/new.html.haml +1 -0
  150. data/app/views/spina/shop/admin/gift_cards/_form.html.haml +28 -0
  151. data/app/views/spina/shop/admin/gift_cards/_gift_card.html.haml +17 -0
  152. data/app/views/spina/shop/admin/gift_cards/index.html.haml +37 -0
  153. data/app/views/spina/shop/admin/gift_cards/index.js.erb +4 -0
  154. data/app/views/spina/shop/admin/gift_cards/new.html.haml +1 -0
  155. data/app/views/spina/shop/admin/gift_cards/show.html.haml +46 -0
  156. data/app/views/spina/shop/admin/order_items/_modal.html.haml +18 -0
  157. data/app/views/spina/shop/admin/order_items/new.js.erb +2 -0
  158. data/app/views/spina/shop/admin/orders/_form.html.haml +159 -0
  159. data/app/views/spina/shop/admin/orders/_order.html.haml +22 -0
  160. data/app/views/spina/shop/admin/orders/edit.html.haml +1 -0
  161. data/app/views/spina/shop/admin/orders/index.html.haml +78 -0
  162. data/app/views/spina/shop/admin/orders/index.js.erb +4 -0
  163. data/app/views/spina/shop/admin/orders/new.html.haml +1 -0
  164. data/app/views/spina/shop/admin/orders/show.html.haml +338 -0
  165. data/app/views/spina/shop/admin/product_reviews/_product_review.html.haml +22 -0
  166. data/app/views/spina/shop/admin/product_reviews/index.html.haml +29 -0
  167. data/app/views/spina/shop/admin/product_reviews/index.js.erb +4 -0
  168. data/app/views/spina/shop/admin/products/_form.html.haml +259 -0
  169. data/app/views/spina/shop/admin/products/_new_product_modal.html.haml +15 -0
  170. data/app/views/spina/shop/admin/products/_price_exception_fields.html.haml +11 -0
  171. data/app/views/spina/shop/admin/products/_product.html.haml +36 -0
  172. data/app/views/spina/shop/admin/products/edit.html.haml +1 -0
  173. data/app/views/spina/shop/admin/products/index.html.haml +73 -0
  174. data/app/views/spina/shop/admin/products/index.js.erb +4 -0
  175. data/app/views/spina/shop/admin/products/new.html.haml +1 -0
  176. data/app/views/spina/shop/admin/products/new_by_category.js.erb +1 -0
  177. data/app/views/spina/shop/admin/products/product_bundles/_bundled_products_fields.html.haml +11 -0
  178. data/app/views/spina/shop/admin/products/product_bundles/_form.html.haml +64 -0
  179. data/app/views/spina/shop/admin/products/product_bundles/edit.html.haml +1 -0
  180. data/app/views/spina/shop/admin/products/product_bundles/index.html.haml +42 -0
  181. data/app/views/spina/shop/admin/products/product_bundles/new.html.haml +1 -0
  182. data/app/views/spina/shop/admin/products/properties/_property_fields.html.haml +37 -0
  183. data/app/views/spina/shop/admin/products/stock_forecasts/_product.html.haml +49 -0
  184. data/app/views/spina/shop/admin/products/stock_forecasts/show.html.haml +47 -0
  185. data/app/views/spina/shop/admin/products/stock_forecasts/show.js.erb +4 -0
  186. data/app/views/spina/shop/admin/products/stock_level_adjustments/_form.html.haml +37 -0
  187. data/app/views/spina/shop/admin/products/stock_level_adjustments/_history.html.haml +30 -0
  188. data/app/views/spina/shop/admin/products/stock_level_adjustments/index.js.erb +1 -0
  189. data/app/views/spina/shop/admin/products/stock_level_adjustments/new.js.erb +1 -0
  190. data/app/views/spina/shop/admin/reports/index.html.haml +23 -0
  191. data/app/views/spina/shop/admin/settings/product_categories/_form.html.haml +18 -0
  192. data/app/views/spina/shop/admin/settings/product_categories/_product_category.html.haml +3 -0
  193. data/app/views/spina/shop/admin/settings/product_categories/_property_fields.html.haml +77 -0
  194. data/app/views/spina/shop/admin/settings/product_categories/edit.html.haml +1 -0
  195. data/app/views/spina/shop/admin/settings/product_categories/index.html.haml +3 -0
  196. data/app/views/spina/shop/admin/settings/product_categories/show.html.haml +24 -0
  197. data/app/views/spina/shop/admin/settings/product_category_properties/_property_options_fields.html.haml +11 -0
  198. data/app/views/spina/shop/admin/settings/product_category_properties/edit_options.html.haml +16 -0
  199. data/app/views/spina/shop/admin/settings/sales_categories/_sales_category.html.haml +17 -0
  200. data/app/views/spina/shop/admin/settings/sales_categories/index.html.haml +1 -0
  201. data/app/views/spina/shop/admin/settings/tax_groups/_form.html.haml +19 -0
  202. data/app/views/spina/shop/admin/settings/tax_groups/_tax_group.html.haml +21 -0
  203. data/app/views/spina/shop/admin/settings/tax_groups/index.html.haml +1 -0
  204. data/app/views/spina/shop/admin/settings/tax_groups/new.js.erb +1 -0
  205. data/app/views/spina/shop/admin/shared/_locale_switcher.html.haml +9 -0
  206. data/app/views/spina/shop/customer_account_mailer/forgot_password.html.erb +1 -0
  207. data/app/views/spina/shop/customer_account_mailer/forgot_password.txt.erb +1 -0
  208. data/app/views/spina/shop/export_mailer/exported.html.erb +2 -0
  209. data/app/views/spina/shop/in_stock_reminder_mailer/reminder.html.erb +1 -0
  210. data/app/views/spina/shop/in_stock_reminder_mailer/reminder.txt.erb +1 -0
  211. data/app/views/spina/shop/order_mailer/confirmation.html.erb +5 -0
  212. data/app/views/spina/shop/order_mailer/confirmation.txt.erb +5 -0
  213. data/app/views/spina/shop/order_mailer/shipped.html.erb +1 -0
  214. data/app/views/spina/shop/order_mailer/shipped.txt.erb +1 -0
  215. data/config/initializers/kaminari_monkey_patch.rb +15 -0
  216. data/config/locales/en.yml +214 -0
  217. data/config/locales/nl.yml +452 -0
  218. data/config/routes.rb +92 -0
  219. data/db/countries.txt +252 -0
  220. data/db/migrate/10_create_spina_shop_products_without_items.rb +23 -0
  221. data/db/migrate/1_create_spina_shop_tables.rb +518 -0
  222. data/db/migrate/20170701135207_create_spina_shop_bundled_products.rb +11 -0
  223. data/db/migrate/20170717125930_add_stock_enabled_to_spina_shop_products.rb +5 -0
  224. data/db/migrate/20170718084146_add_editable_sku_to_spina_shop_products.rb +5 -0
  225. data/db/migrate/20170718084626_add_deletable_to_spina_shop_products.rb +5 -0
  226. data/db/migrate/20170719082531_rename_column_order_picked_at_in_spina_shop_orders.rb +5 -0
  227. data/db/migrate/20170719112920_create_spina_shop_order_attachments.rb +15 -0
  228. data/db/migrate/20170719184125_add_price_exceptions_to_spina_shop_products.rb +5 -0
  229. data/db/migrate/20170720133304_add_vat_id_to_spina_shop_customers.rb +5 -0
  230. data/db/migrate/20170731082027_add_price_includes_tax_to_spina_shop_products.rb +5 -0
  231. data/db/migrate/20170731132620_add_reverse_charge_vat_to_spina_shop_tax_rates.rb +5 -0
  232. data/db/migrate/20170731150630_add_vat_id_to_spina_shop_invoices.rb +5 -0
  233. data/db/migrate/20170801093935_add_price_includes_tax_to_spina_shop_delivery_options.rb +5 -0
  234. data/db/migrate/20170814092924_add_business_to_spina_shop_orders.rb +6 -0
  235. data/db/migrate/20170815080839_rename_vat_reverse_charge_column_on_tax_rates.rb +5 -0
  236. data/db/migrate/20170815081018_add_business_to_spina_shop_tax_rates.rb +5 -0
  237. data/db/migrate/20170817075706_add_archived_to_spina_shop_products.rb +5 -0
  238. data/db/migrate/20170824175231_add_metadata_to_photos.rb +7 -0
  239. data/db/migrate/20170829085402_add_business_to_spina_shop_sales_category_codes.rb +5 -0
  240. data/db/migrate/20170911121034_add_trend_to_spina_shop_products.rb +5 -0
  241. data/db/migrate/20171106122225_add_editable_fields_to_spina_shop_product_category_properties.rb +6 -0
  242. data/db/migrate/20171106122537_create_property_options.rb +19 -0
  243. data/db/migrate/20171118110256_add_promotional_price_to_spina_shop_products.rb +6 -0
  244. data/db/migrate/2_create_spina_shop_tax_rates.rb +15 -0
  245. data/db/migrate/3_create_spina_shop_zones.rb +9 -0
  246. data/db/migrate/4_add_tax_rateable_to_spina_shop_tax_rates.rb +9 -0
  247. data/db/migrate/5_add_type_to_spina_shop_zones.rb +5 -0
  248. data/db/migrate/6_add_code_to_spina_shop_zones.rb +5 -0
  249. data/db/migrate/7_create_spina_shop_product_collections.rb +16 -0
  250. data/db/migrate/8_create_spina_shop_sales_category_codes.rb +13 -0
  251. data/db/migrate/9_create_spina_shop_customer_groups.rb +11 -0
  252. data/lib/generators/spina/shop/install_generator.rb +44 -0
  253. data/lib/spina/shop.rb +24 -0
  254. data/lib/spina/shop/admin_helpers.rb +49 -0
  255. data/lib/spina/shop/engine.rb +27 -0
  256. data/lib/spina/shop/errors/empty_order.rb +6 -0
  257. data/lib/spina/shop/errors/order_already_received.rb +6 -0
  258. data/lib/spina/shop/railtie.rb +31 -0
  259. data/lib/spina/shop/simple_linear_regression.rb +36 -0
  260. data/lib/spina/shop/version.rb +5 -0
  261. data/lib/spina/shop/view_helpers.rb +11 -0
  262. data/lib/tasks/spina/shop.rake +32 -0
  263. metadata +627 -0
@@ -0,0 +1,4 @@
1
+ $("<%=j render partial: 'gift_card', collection: @gift_cards %>").appendTo($(".infinite-table table tbody"));
2
+
3
+ // Update pagination link
4
+ $('.pagination').html("<%=j link_to_next_page @gift_cards, 'Next' %>").infiniteScroll();
@@ -0,0 +1,46 @@
1
+ %header#header
2
+ .breadcrumbs
3
+ = render_breadcrumbs separator: '<div class="divider"></div>'
4
+
5
+ .table-container
6
+ %table.table
7
+ %tr
8
+ %th= Spina::Shop::GiftCard.human_attribute_name :value
9
+ %td= number_to_currency @gift_card.value
10
+
11
+ %tr
12
+ %th= Spina::Shop::GiftCard.human_attribute_name :remaining_balance
13
+ %td= number_to_currency @gift_card.remaining_balance
14
+
15
+ %tr
16
+ %th= Spina::Shop::GiftCard.human_attribute_name :created_at
17
+ %td=l @gift_card.created_at, format: :long
18
+
19
+ %tr
20
+ %th= Spina::Shop::GiftCard.human_attribute_name :expires_at
21
+ %td=l @gift_card.expires_at, format: :long
22
+
23
+ .table-container
24
+ %table.table.table-clickable
25
+ %thead
26
+ %tr
27
+ %th
28
+ %th= Spina::Shop::Order.human_attribute_name(:order_number)
29
+ %th= Spina::Shop::Customer.model_name.human
30
+ %th= Spina::Shop::Order.human_attribute_name(:received_at)
31
+ %th= Spina::Shop::Order.human_attribute_name(:shipped_at)
32
+ %th.text-right= Spina::Shop::Order.human_attribute_name(:total)
33
+ %th
34
+
35
+ %tbody
36
+ - if @gift_card.orders.received.any?
37
+ = render partial: 'spina/shop/admin/orders/order', collection: @gift_card.orders.sorted.received
38
+
39
+ - else
40
+ %tr
41
+ %td{colspan: 7}
42
+ %p.text-center.text-muted
43
+ %em=t 'spina.shop.gift_cards.no_orders_yet'
44
+
45
+ - if @gift_card.orders.none?
46
+ .pull-right= link_to t('spina.shop.gift_cards.delete'), spina.shop_admin_gift_card_path(@gift_card), method: :delete, class: 'button button-link button-danger', data: {confirm: t('spina.shop.gift_cards.delete_confirmation')}, style: 'padding-right: 0'
@@ -0,0 +1,18 @@
1
+ .modal
2
+ %header
3
+ = link_to '#', data: {dismiss: "modal"} do
4
+ = icon('cross')
5
+ %h3=t 'spina.shop.orders.add_product'
6
+
7
+ = form_for @order_item, url: spina.shop_admin_order_order_items_path(@order) do |f|
8
+ = f.hidden_field :orderable_type, value: "Spina::Shop::Product"
9
+
10
+ %section
11
+ = f.select :quantity, options_for_select(1..100), {}, class: 'select2'
12
+ = f.select :orderable_id, options_for_select([[f.object.orderable.try(:name), f.object.orderable.try(:id)]], f.object.orderable_id), {include_blank: t('spina.shop.products.select_blank')}, class: 'select-products', style: 'width: 100%'
13
+
14
+ %footer
15
+ = link_to t('spina.cancel'), '#', data: {dismiss: 'modal'}
16
+ = button_tag type: :submit, class: 'primary' do
17
+ %i.icon.icon-plus{style: 'margin-right: 4px'}
18
+ =t 'spina.shop.products.new'
@@ -0,0 +1,2 @@
1
+ $("<%=j render 'modal' %>").modal()
2
+ $('.modal').enhanceProducts();
@@ -0,0 +1,159 @@
1
+ = form_for @order, url: @order.new_record? ? spina.shop_admin_orders_path : spina.shop_admin_order_path(@order) do |f|
2
+ %header#header
3
+ #header_actions
4
+ = button_tag type: :submit, class: 'button button-primary' do
5
+ = icon('check')
6
+ =t ('spina.shop.orders.save')
7
+
8
+ .breadcrumbs= render_breadcrumbs separator: '<div class="divider"></div>'
9
+
10
+ .sidebar-form
11
+ .sidebar-form-content
12
+ .well
13
+ .sidebar-form-group
14
+ .sidebar-form-label
15
+ = Spina::Shop::Order.human_attribute_name(:note)
16
+
17
+ .sidebar-form-control
18
+ ~ f.text_area :note, placeholder: Spina::Shop::Order.human_attribute_name(:note)
19
+
20
+ .sidebar-form-group
21
+ .sidebar-form-label
22
+ = Spina::Shop::Order.human_attribute_name(:delivery_option)
23
+
24
+ .sidebar-form-control
25
+ ~ f.select :delivery_option_id, options_for_select(Spina::Shop::DeliveryOption.all.map{|o| [o.name, o.id]}), {}, class: 'select2', style: 'width: 100%'
26
+
27
+ .sidebar-form-group
28
+ .sidebar-form-label
29
+ = Spina::Shop::Order.human_attribute_name(:payment_method)
30
+
31
+ .sidebar-form-control
32
+ ~ f.text_field :payment_method
33
+
34
+ .well
35
+ .sidebar-form-group
36
+ .sidebar-form-label
37
+ = Spina::Shop::Order.human_attribute_name :first_name
38
+
39
+ .sidebar-form-control
40
+ = f.text_field :first_name, placeholder: Spina::Shop::Order.human_attribute_name(:first_name)
41
+
42
+ .sidebar-form-group
43
+ .sidebar-form-label
44
+ = Spina::Shop::Order.human_attribute_name :last_name
45
+
46
+ .sidebar-form-control
47
+ = f.text_field :last_name, placeholder: Spina::Shop::Order.human_attribute_name(:last_name)
48
+
49
+ .sidebar-form-group
50
+ .sidebar-form-label
51
+ = Spina::Shop::Order.human_attribute_name :email
52
+
53
+ .sidebar-form-control
54
+ = f.text_field :email, placeholder: Spina::Shop::Order.human_attribute_name(:email)
55
+
56
+ .sidebar-form-group
57
+ .sidebar-form-label
58
+ = Spina::Shop::Order.human_attribute_name :phone
59
+
60
+ .sidebar-form-control
61
+ = f.text_field :phone, placeholder: Spina::Shop::Order.human_attribute_name(:phone)
62
+
63
+ .sidebar-form-group
64
+ .sidebar-form-label
65
+ = Spina::Shop::Order.human_attribute_name :company
66
+
67
+ .sidebar-form-control
68
+ = f.text_field :company, placeholder: Spina::Shop::Order.human_attribute_name(:company)
69
+
70
+ .well
71
+ .sidebar-form-group
72
+ .sidebar-form-label
73
+ = Spina::Shop::Order.human_attribute_name :billing_street1
74
+ .sidebar-form-control
75
+ = f.text_field :billing_street1, placeholder: Spina::Shop::Order.human_attribute_name(:billing_street1), style: 'padding-bottom: 0px; height: 40px'
76
+ %br/
77
+ = f.text_field :billing_street2, placeholder: Spina::Shop::Order.human_attribute_name(:billing_street2), style: 'padding-top: 0px; padding-bottom: 0px; height: 30px'
78
+
79
+ .sidebar-form-group
80
+ .sidebar-form-label
81
+ = Spina::Shop::Order.human_attribute_name :billing_house_number
82
+ .sidebar-form-control
83
+ = f.text_field :billing_house_number
84
+
85
+ .sidebar-form-group
86
+ .sidebar-form-label
87
+ = Spina::Shop::Order.human_attribute_name :billing_house_number_addition
88
+ .sidebar-form-control
89
+ = f.text_field :billing_house_number_addition
90
+
91
+ .sidebar-form-group
92
+ .sidebar-form-label
93
+ = Spina::Shop::Order.human_attribute_name :billing_postal_code
94
+ .sidebar-form-control
95
+ = f.text_field :billing_postal_code
96
+
97
+ .sidebar-form-group
98
+ .sidebar-form-label
99
+ = Spina::Shop::Order.human_attribute_name :billing_city
100
+ .sidebar-form-control
101
+ = f.text_field :billing_city
102
+
103
+ .sidebar-form-group
104
+ .sidebar-form-label
105
+ = Spina::Shop::Order.human_attribute_name :billing_country
106
+ .sidebar-form-control
107
+ = f.select :billing_country_id, options_for_select(Spina::Shop::Country.order(:name).map{|c| [c.name, c.id]}, f.object.billing_country_id), {prompt: true}, class: 'select2', style: 'width: 100%'
108
+
109
+ .well
110
+ .sidebar-form-group
111
+ .sidebar-form-label
112
+ = Spina::Shop::Order.human_attribute_name :separate_delivery_address
113
+ .sidebar-form-control
114
+ = f.check_box :separate_delivery_address, data: {switch: true, toggle: '#delivery_address'}
115
+
116
+ .well#delivery_address
117
+ .sidebar-form-group
118
+ .sidebar-form-label
119
+ = Spina::Shop::Order.human_attribute_name :delivery_name
120
+ .sidebar-form-control
121
+ = f.text_field :delivery_name, placeholder: Spina::Shop::Order.human_attribute_name(:delivery_name)
122
+
123
+ .sidebar-form-group
124
+ .sidebar-form-label
125
+ = Spina::Shop::Order.human_attribute_name :delivery_street1
126
+ .sidebar-form-control
127
+ = f.text_field :delivery_street1, placeholder: Spina::Shop::Order.human_attribute_name(:delivery_street1), style: 'padding-bottom: 0px; height: 40px'
128
+ %br/
129
+ = f.text_field :delivery_street2, placeholder: Spina::Shop::Order.human_attribute_name(:delivery_street2), style: 'padding-top: 0px; padding-bottom: 0px; height: 30px'
130
+
131
+ .sidebar-form-group
132
+ .sidebar-form-label
133
+ = Spina::Shop::Order.human_attribute_name :delivery_house_number
134
+ .sidebar-form-control
135
+ = f.text_field :delivery_house_number
136
+
137
+ .sidebar-form-group
138
+ .sidebar-form-label
139
+ = Spina::Shop::Order.human_attribute_name :delivery_house_number_addition
140
+ .sidebar-form-control
141
+ = f.text_field :delivery_house_number_addition
142
+
143
+ .sidebar-form-group
144
+ .sidebar-form-label
145
+ = Spina::Shop::Order.human_attribute_name :delivery_postal_code
146
+ .sidebar-form-control
147
+ = f.text_field :delivery_postal_code
148
+
149
+ .sidebar-form-group
150
+ .sidebar-form-label
151
+ = Spina::Shop::Order.human_attribute_name :delivery_city
152
+ .sidebar-form-control
153
+ = f.text_field :delivery_city
154
+
155
+ .sidebar-form-group
156
+ .sidebar-form-label
157
+ = Spina::Shop::Order.human_attribute_name :delivery_country
158
+ .sidebar-form-control
159
+ = f.select :delivery_country_id, options_for_select(Spina::Shop::Country.order(:name).map{|c| [c.name, c.id]}, f.object.delivery_country_id), {prompt: true}, class: 'select2', style: 'width: 100%'
@@ -0,0 +1,22 @@
1
+ %tr
2
+ %td{style: 'width: 70px'}
3
+ .form-checkbox{style: 'width: 20px'}
4
+ = check_box_tag 'order_ids[]', order.id
5
+ %label
6
+ %td= link_to order.number, spina.shop_admin_order_path(order), class: 'table-link'
7
+ %td= order.billing_name
8
+ %td
9
+ - if order.received_at.present?
10
+ =l order.received_at, format: "%d %B %Y"
11
+ %td
12
+ - if order.shipped_at.present?
13
+ =l order.shipped_at, format: "%d %B %Y"
14
+ %td.nowrap.text-right
15
+ = number_to_currency order.total
16
+ %td{style: 'width: 200px'}
17
+ .progress{class: "progress-bar-#{order.status_css_class}"}
18
+ .progress-bar
19
+ - 5.times do
20
+ .progress-bar-divider
21
+ .progress-bar-inner{style: "width: #{order.status_progress}%"}
22
+ .progress-label=t "spina.shop.orders.states.#{order.current_state}"
@@ -0,0 +1 @@
1
+ = render 'form'
@@ -0,0 +1,78 @@
1
+ %header#header
2
+ .breadcrumbs
3
+ .pull-right{style: "height: 0px"}
4
+ = link_to spina.new_shop_admin_order_path, class: 'button button-mini icon-only' do
5
+ %i.icon.icon-plus{style: 'vertical-align: bottom'}
6
+ = render_breadcrumbs separator: '<div class="divider"></div>'
7
+
8
+ %nav#secondary
9
+ %ul
10
+ %li{class: ('active' if action_name == 'index')}
11
+ = link_to t('spina.shop.orders.title'), spina.shop_admin_orders_path
12
+ %li{class: ('active' if action_name == 'to_process')}
13
+ = link_to t('spina.shop.orders.to_process'), spina.to_process_shop_admin_orders_path
14
+ %li{class: ('active' if action_name == 'failed')}
15
+ = link_to t('spina.shop.orders.failed'), spina.failed_shop_admin_orders_path
16
+
17
+ = search_form_for @q, url: spina.shop_admin_orders_path, html: {class: 'filter-form'} do |f|
18
+ .filter-form-simple
19
+ .filter-form-input
20
+ = f.text_field :first_name_or_last_name_or_company_cont, placeholder: t('spina.search')
21
+ = link_to 'geavanceerd', '#', class: 'filter-form-advanced-link'
22
+
23
+ = button_tag type: :submit, class: 'button button-primary icon-only' do
24
+ = icon('search')
25
+
26
+ .filter-form-advanced
27
+ .filter-form-advanced-group
28
+ .filter-form-label
29
+ ID
30
+
31
+ .filter-form-control
32
+ .input-group
33
+ = f.text_field :id_gteq, placeholder: 'min'
34
+ = f.text_field :id_lteq, placeholder: 'max'
35
+
36
+ .filter-form-advanced-group
37
+ .filter-form-label
38
+ = Spina::Shop::Order.human_attribute_name(:received_at)
39
+
40
+ .filter-form-control
41
+ .input-group
42
+ = f.text_field :received_at_gteq, value: (l(f.object.received_at_gteq, format: '%d-%m-%Y') if f.object.received_at_gteq), placeholder: 'min', class: 'datepicker'
43
+ = f.text_field :received_at_lteq, value: (l(f.object.received_at_lteq, format: '%d-%m-%Y') if f.object.received_at_lteq), placeholder: 'max', class: 'datepicker'
44
+
45
+ = form_tag spina.transition_shop_admin_orders_path, method: :put do
46
+ .pull-right{style: 'display: inline-block; position: fixed; top: 78px; right: 22px; z-index: 10', data: {dropdown: true}}
47
+ = link_to '#', class: 'button button-link', data: {trigger: 'dropdown', target: '#actions'} do
48
+ =t 'spina.shop.orders.actions'
49
+ %i.icon.icon-caret-down{style: 'margin-right: 0'}
50
+
51
+ %ul#actions.align-right
52
+ %li= button_tag t('spina.shop.orders.start_preparing_html'), type: :submit, name: 'transition_to', value: 'order_picking'
53
+ %li= button_tag t('spina.shop.orders.ship_order_html'), type: :submit, name: 'transition_to', value: 'shipped'
54
+ %li.divider
55
+ %li= button_tag t('spina.shop.orders.start_preparing_and_ship_html'), type: :submit, name: 'transition_to', value: 'order_prepared_and_shipped'
56
+
57
+ .table-container.infinite-table
58
+ %table.table.table-clickable
59
+ %thead
60
+ %tr
61
+ %th
62
+ %th= sort_link [:spina, @q], :id, Spina::Shop::Order.human_attribute_name(:order_number), {}, class: 'table-sort'
63
+ %th= sort_link [:spina, @q], :last_name, Spina::Shop::Customer.model_name.human, {}, class: 'table-sort'
64
+ %th= sort_link [:spina, @q], :received_at, Spina::Shop::Order.human_attribute_name(:received_at), {}, class: 'table-sort'
65
+ %th= sort_link [:spina, @q], :shipped_at, Spina::Shop::Order.human_attribute_name(:shipped_at), {}, class: 'table-sort'
66
+ %th.text-right= Spina::Shop::Order.human_attribute_name(:total)
67
+ %th
68
+
69
+ %tbody
70
+ - if @orders.any?
71
+ = render partial: 'order', collection: @orders.to_a.uniq
72
+ - else
73
+ %tr
74
+ %td{colspan: 8}
75
+ %p.text-center
76
+ %em.text-muted= 'spina.shop.orders.no_orders'
77
+
78
+ .pagination= link_to_next_page @orders, "Next"
@@ -0,0 +1,4 @@
1
+ $("<%=j render partial: 'order', collection: @orders.to_a.uniq %>").appendTo($(".infinite-table table tbody"));
2
+
3
+ // Update pagination link
4
+ $('.pagination').html("<%=j link_to_next_page @orders, 'Next' %>").infiniteScroll();
@@ -0,0 +1 @@
1
+ = render 'form'
@@ -0,0 +1,338 @@
1
+ %header#header
2
+ .pull-right
3
+ - if @order.order_attachments.any?
4
+ %div{style: 'display: inline-block', data: {dropdown: true}}
5
+ = link_to '#', class: 'button', data: {trigger: 'dropdown', target: '#attachments'} do
6
+ = Spina::Shop::Order.human_attribute_name(:order_attachments)
7
+ %i.icon.icon-caret-down{style: 'margin-right: 0'}
8
+
9
+ %ul#attachments.align-right
10
+ - @order.order_attachments.each do |order_attachment|
11
+ %li
12
+ = link_to attachment_url(order_attachment, :attachment), target: :blank do
13
+ = order_attachment.name
14
+ %br/
15
+ %small.text-muted
16
+ .pull-right= number_to_human_size order_attachment.attachment_size
17
+ = order_attachment.attachment_content_type
18
+
19
+ = link_to t('spina.edit'), spina.edit_shop_admin_order_path(@order), class: 'button'
20
+
21
+ - if @order.in_state?(:confirming, :received)
22
+ = link_to t('spina.shop.orders.cancel_order_html'), spina.cancel_shop_admin_order_path(@order), method: :post, class: 'button', data: {confirm: t('spina.shop.orders.cancel_order_confirmation_html')}
23
+
24
+ - if @order.in_state?(:confirming)
25
+ = link_to t('spina.shop.orders.receive_order_html'), spina.receive_shop_admin_order_path(@order), method: :post, class: 'button button-primary', data: {confirm: t('spina.shop.orders.receive_order_confirmation_html')}
26
+
27
+ - if @order.in_state?(:received)
28
+ = link_to t('spina.shop.orders.pay_order_html'), spina.pay_shop_admin_order_path(@order), method: :post, class: 'button button-primary', data: {confirm: t('spina.shop.orders.pay_order_confirmation_html')}
29
+
30
+ - if @order.in_state?(:paid)
31
+ = link_to t('spina.shop.orders.start_preparing_html'), spina.shop_admin_order_packing_slip_path(@order), method: :post, class: 'button button-primary'
32
+
33
+ - if @order.in_state?(:preparing)
34
+ - if @order.requires_shipping?
35
+ = link_to t('spina.shop.orders.ship_order_html'), spina.shop_admin_order_shipping_label_path(@order), method: :post, class: 'button button-primary', data: {confirm: t('spina.shop.orders.ship_order_confirmation_html')}
36
+ - else
37
+ = link_to t('spina.shop.orders.order_picked_up'), spina.order_picked_up_shop_admin_order_path(@order), method: :post, class: 'button button-primary'
38
+
39
+ - if @order.in_state?(:shipped)
40
+ = link_to t('spina.shop.orders.states.delivered'), spina.delivered_shop_admin_order_path(@order), method: :post, class: 'button button-primary'
41
+
42
+ .breadcrumbs= render_breadcrumbs separator: '<div class="divider"></div>'
43
+
44
+ %nav#secondary.tabs
45
+ %ul
46
+ %li.active
47
+ = link_to '#order' do
48
+ = Spina::Shop::Order.model_name.human
49
+ %li
50
+ = link_to '#history' do
51
+ =t 'spina.shop.orders.history'
52
+
53
+ .tab-content.active#order
54
+
55
+ .wizard-steps
56
+ - if @order.cancelled?
57
+ .wizard-step.error
58
+ .wizard-step-circle
59
+ .wizard-step-label=t 'spina.shop.orders.states.cancelled'
60
+ .wizard-step-connector
61
+
62
+ - elsif @order.failed?
63
+ .wizard-step.error
64
+ .wizard-step-circle
65
+ .wizard-step-label=t 'spina.shop.orders.states.failed'
66
+ .wizard-step-connector
67
+
68
+ - else
69
+ .wizard-step{class: ('done' if @order.received?)}
70
+ .wizard-step-circle
71
+ = icon("shop")
72
+ .wizard-step-label=t 'spina.shop.orders.states.received'
73
+ .wizard-step-connector
74
+
75
+ - if @order.received? && @order.failed?
76
+ .wizard-step.error
77
+ .wizard-step-circle
78
+ .wizard-step-label=t 'spina.shop.orders.states.failed'
79
+ .wizard-step-connector
80
+
81
+ - else
82
+ .wizard-step{class: ('done' if @order.paid?)}
83
+ .wizard-step-circle
84
+ = icon("mail")
85
+ .wizard-step-label=t 'spina.shop.orders.states.paid'
86
+ .wizard-step-connector
87
+
88
+ - unless @order.pos?
89
+ .wizard-step{class: ('done' if @order.order_prepared_at.present?)}
90
+ .wizard-step-circle
91
+ = icon("dots")
92
+ .wizard-step-label=t 'spina.shop.orders.states.order_preparing'
93
+ .wizard-step-connector
94
+
95
+ - if @order.requires_shipping?
96
+ .wizard-step{class: ('done' if @order.shipped_at.present?)}
97
+ .wizard-step-circle
98
+ = icon("mail")
99
+ .wizard-step-label{style: 'white-space: nowrap'}=t 'spina.shop.orders.states.shipped'
100
+ .wizard-step-connector
101
+
102
+ .wizard-step{class: ('done' if @order.delivered_at.present?)}
103
+ .wizard-step-circle
104
+ = icon("home")
105
+ .wizard-step-label=t 'spina.shop.orders.states.delivered'
106
+ .wizard-step-connector
107
+
108
+ - else
109
+ .wizard-step{class: ('done' if @order.picked_up_at.present?)}
110
+ .wizard-step-circle
111
+ = icon("shop")
112
+ .wizard-step-label=t 'spina.shop.orders.states.picked_up'
113
+ .wizard-step-connector
114
+
115
+ .divider-container
116
+ %hr.divider/
117
+
118
+ .information-tables
119
+ .information-table
120
+ %table
121
+ - if @order.billing_name.present?
122
+ %tr
123
+ %th= Spina::Shop::Order.human_attribute_name(:billing_name)
124
+ %td
125
+ - if @order.customer
126
+ = link_to @order.billing_name, spina.shop_admin_customer_path(@order.customer)
127
+ - else
128
+ = @order.billing_name
129
+ - if @order.email.present?
130
+ %tr
131
+ %th= Spina::Shop::Order.human_attribute_name(:email)
132
+ %td
133
+ = link_to @order.email, @order.email
134
+
135
+ - if @order.phone.present?
136
+ %tr
137
+ %th= Spina::Shop::Order.human_attribute_name(:phone)
138
+ %td= @order.phone
139
+
140
+ - if @order.received_at.present?
141
+ %tr
142
+ %th= Spina::Shop::Order.human_attribute_name(:received_at)
143
+ %td
144
+ =l @order.received_at, format: '%d %B %Y'
145
+ %br/
146
+ =l @order.received_at, format: '%H:%M'
147
+ %small.text-muted=l @order.received_at, format: '%Z'
148
+
149
+ - if @order.ip_address.present?
150
+ %tr
151
+ %th= Spina::Shop::Order.human_attribute_name(:ip_address)
152
+ %td
153
+ = @order.ip_address
154
+
155
+ .information-table
156
+ %table
157
+ - if @order.invoices.any?
158
+ %tr
159
+ %th= Spina::Shop::Invoice.model_name.human count: @order.invoices.count
160
+ %td
161
+ - @order.invoices.each do |invoice|
162
+ = link_to invoice.invoice_number, spina.shop_admin_invoice_path(invoice, format: :pdf)
163
+
164
+ %tr
165
+ %th= Spina::Shop::Order.human_attribute_name(:billing_address)
166
+ %td
167
+ = @order.billing_name
168
+ %br/
169
+ = [@order.billing_street1.presence, @order.billing_street2.presence].compact.join('<br />').html_safe
170
+ = "#{@order.billing_house_number}#{@order.billing_house_number_addition}"
171
+ %br/
172
+ = [@order.billing_postal_code, @order.billing_city].join(', ')
173
+ %br/
174
+ = @order.billing_country.name
175
+
176
+ - if @order.gift_card.present?
177
+ %tr
178
+ %th= Spina::Shop::Order.human_attribute_name(:gift_card)
179
+ %td
180
+ = @order.gift_card.readable_code
181
+ %br/
182
+ = number_to_currency @order.gift_card_amount
183
+
184
+ - if @order.payment_method.present?
185
+ %tr
186
+ %th= Spina::Shop::Order.human_attribute_name(:payment_method)
187
+ %td
188
+ =t "spina.shop.orders.payment_methods.#{@order.payment_method}"
189
+ - if @order.paid_at.present?
190
+ %br/
191
+ =l @order.paid_at, format: "%d %B %Y"
192
+ %br/
193
+ =l @order.paid_at, format: "%H:%M"
194
+ %small.text-muted=l @order.paid_at, format: '%Z'
195
+
196
+ - if @order.cancelled_at.present?
197
+ %tr
198
+ %th=t 'spina.shop.orders.states.cancelled'
199
+ %td
200
+ =l @order.cancelled_at, format: "%d %B %Y"
201
+ %br/
202
+ =l @order.cancelled_at, format: "%H:%M"
203
+ %small.text-muted=l @order.cancelled_at, format: '%Z'
204
+
205
+ - if @order.failed_at.present?
206
+ %tr
207
+ %th=t 'spina.shop.orders.states.failed'
208
+ %td
209
+ =l @order.failed_at, format: "%d %B %Y"
210
+ %br/
211
+ =l @order.failed_at, format: "%H:%M"
212
+ %small.text-muted=l @order.failed_at, format: '%Z'
213
+
214
+ .information-table
215
+ %table
216
+ - if @order.discount.present?
217
+ %tr
218
+ %th= Spina::Shop::Order.human_attribute_name(:discount)
219
+ %td
220
+ = @order.discount.description
221
+ %tr
222
+ %th= Spina::Shop::Discount.human_attribute_name(:code)
223
+ %td= @order.discount.code
224
+
225
+ %tr
226
+ %th= Spina::Shop::Order.human_attribute_name(:delivery_address)
227
+ %td
228
+ = @order.delivery_name
229
+ %br/
230
+ = @order.delivery_address
231
+ %br/
232
+ = [@order.delivery_postal_code, @order.delivery_city].join(', ')
233
+
234
+ - if @order.delivery_tracking_ids.present?
235
+ %tr
236
+ %th= Spina::Shop::Order.human_attribute_name(:delivery_tracking_ids)
237
+ %td= @order.delivery_tracking_ids.join("<br />").html_safe
238
+
239
+ %tr
240
+ %th= Spina::Shop::Order.human_attribute_name(:weight)
241
+ %td
242
+ = @order.total_weight
243
+ gr
244
+
245
+ - if @order.shipped_at.present?
246
+ %tr
247
+ %th= Spina::Shop::Order.human_attribute_name(:shipped_at)
248
+ %td=l @order.shipped_at, format: "%d %B %Y"
249
+
250
+ - if @order.delivered_at.present?
251
+ %tr
252
+ %th= Spina::Shop::Order.human_attribute_name(:delivered_at)
253
+ %td=l @order.delivered_at, format: "%d %B %Y"
254
+
255
+ .divider-container
256
+ %hr.divider/
257
+
258
+ - if @order.note.present?
259
+ %label= Spina::Shop::Order.human_attribute_name(:note)
260
+ = preserve "<p style='white-space: pre'>#{@order.note}</p>".html_safe
261
+ .divider-container
262
+ %hr.divider/
263
+
264
+ .table-container
265
+ %table.table
266
+ %thead
267
+ %tr
268
+ %th.text-right
269
+ %th= Spina::Shop::Product.model_name.human
270
+ %th.text-right= Spina::Shop::OrderItem.human_attribute_name(:price)
271
+ %th.text-right= Spina::Shop::OrderItem.human_attribute_name(:total)
272
+ - if @order.building?
273
+ %th
274
+
275
+ %tbody
276
+ - @order.order_items.includes(:orderable).each do |order_item|
277
+ %tr
278
+ %td.text-right= "#{order_item.quantity} &times;".html_safe
279
+ %td
280
+ = link_to order_item.description, spina.shop_admin_product_path(order_item.orderable), class: 'table-link'
281
+ %td.text-right= number_to_currency order_item.unit_price
282
+ %td.text-right
283
+ - if order_item.discount_amount > 0
284
+ .text-muted{style: 'text-decoration: line-through'}= number_to_currency order_item.total_without_discount
285
+
286
+ = number_to_currency order_item.total
287
+ - if @order.building?
288
+ %td{style: 'width: 32px'}
289
+ = link_to spina.shop_admin_order_order_item_path(@order, order_item), class: 'button button-link button-mini icon-only', data: {method: :delete} do
290
+ = icon('trash')
291
+
292
+ - if @order.building?
293
+ %tr
294
+ %td{colspan: 5}
295
+ = link_to spina.new_shop_admin_order_order_item_path(@order), class: 'button button-link button-block text-center button-mini table-link', data: {remote: true} do
296
+ = icon('plus')
297
+ =t 'spina.shop.orders.add_product'
298
+
299
+ %tr
300
+ %td.text-right{colspan: 4}
301
+ %strong{style: 'margin-right: 12px'}= Spina::Shop::Order.human_attribute_name(:order_total)
302
+ = number_to_currency @order.order_total
303
+ - if @order.building?
304
+ %td
305
+
306
+ %tr
307
+ %td.text-right{colspan: 4}
308
+ %strong{style: 'margin-right: 12px'}= Spina::Shop::Order.human_attribute_name(:delivery_price)
309
+ = number_to_currency @order.delivery_price
310
+ - if @order.building?
311
+ %td
312
+
313
+ %tr
314
+ %td.text-right{colspan: 4}
315
+ %strong{style: 'margin-right: 12px'}= Spina::Shop::Order.human_attribute_name(:total)
316
+ = number_to_currency @order.total
317
+ - if @order.building?
318
+ %td
319
+
320
+ .tab-content#history
321
+ .table-container
322
+ %table.table
323
+ %tr
324
+ %th= t("spina.shop.orders.states.building")
325
+ %td=l @order.created_at, format: :long
326
+ %td.text-right= @order.billing_name
327
+ %td.text-muted.text-right= @order.ip_address
328
+
329
+ - @order.order_transitions.each do |transition|
330
+ %tr
331
+ %th= t("spina.shop.orders.states.#{transition.to_state}")
332
+ %td=l transition.created_at, format: :long
333
+
334
+ - if transition.metadata.present?
335
+ %td.text-right= transition.metadata["user"]
336
+ %td.text-muted.text-right= transition.metadata['ip_address']
337
+ - else
338
+ %td{colspan: 2}