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,22 @@
1
+ %tr
2
+ %td
3
+ .form-checkbox{style: 'width: 20px'}
4
+ = check_box_tag 'product_review_ids[]', product_review.id
5
+ %label
6
+ %td
7
+ = product_review.author
8
+ %small= product_review.email
9
+ %td
10
+ %strong= product_review.review_summary
11
+ %br/
12
+ = product_review.review
13
+ %td.text-right
14
+ .progress{style: 'width: 120px'}
15
+ .progress-bar
16
+ - 10.times do
17
+ .progress-bar-divider
18
+
19
+ .progress-bar-inner{style: "width: #{product_review.score * 10}%"}
20
+
21
+ .progress-label
22
+ = product_review.score
@@ -0,0 +1,29 @@
1
+ = form_tag spina.delete_multiple_shop_admin_product_reviews_path, method: :delete do
2
+ %header#header
3
+ #header_actions
4
+ = button_tag type: :submit, class: 'button button-link' do
5
+ = icon('trash')
6
+ = t('spina.shop.delete_selected')
7
+
8
+ .breadcrumbs
9
+ = render_breadcrumbs separator: '<div class="divider"></div>'
10
+
11
+ .table-container.infinite-table
12
+ %table.table.table-clickable
13
+ %thead
14
+ %tr
15
+ %th
16
+ %th.nowrap= Spina::Shop::ProductReview.human_attribute_name(:author)
17
+ %th.nowrap= Spina::Shop::ProductReview.human_attribute_name(:review)
18
+ %th.nowrap.text-right= Spina::Shop::ProductReview.human_attribute_name(:score)
19
+
20
+ %tbody
21
+ - if @product_reviews.any?
22
+ = render partial: 'product_review', collection: @product_reviews
23
+ - else
24
+ %tr
25
+ %td{colspan: 4}
26
+ %p.text-center
27
+ %em.text-muted= 'spina.shop.product_reviews.no_reviews'
28
+
29
+ .pagination= link_to_next_page @product_reviews, "Next"
@@ -0,0 +1,4 @@
1
+ $("<%=j render partial: 'product_review', collection: @product_reviews %>").appendTo($(".infinite-table table tbody"));
2
+
3
+ // Update pagination link
4
+ $('.pagination').html("<%=j link_to_next_page @product_reviews, 'Next' %>").infiniteScroll();
@@ -0,0 +1,259 @@
1
+ = form_for @product, url: @product.new_record? ? spina.shop_admin_products_path : spina.shop_admin_product_path(@product) do |f|
2
+ = hidden_field_tag :locale, @locale
3
+ = f.hidden_field :product_category_id
4
+
5
+ %header#header
6
+ .breadcrumbs= render_breadcrumbs separator: '<div class="divider"></div>'
7
+
8
+ = render 'spina/shop/admin/shared/locale_switcher' unless @product.new_record?
9
+
10
+ #header_actions
11
+ - if f.object.product_images.any?
12
+ %div{style: 'display: inline-block', data: {dropdown: true}}
13
+ = link_to '#', class: 'button', data: {trigger: 'dropdown', target: '#attachments'} do
14
+ Download
15
+ %i.icon.icon-caret-down{style: 'margin-right: 0'}
16
+
17
+ %ul#attachments.align-right
18
+ - f.object.product_images.each do |product_image|
19
+ %li
20
+ = link_to attachment_url(product_image, :file), target: :blank do
21
+ Afbeelding
22
+
23
+ %button.button.button-primary{type: 'submit'}
24
+ = icon('check')
25
+ =t 'spina.shop.products.save'
26
+
27
+ - if @product.errors.any?
28
+ - content_for :notifications do
29
+ .notification.notification-danger.animated.fadeInRight
30
+ = icon('exclamation')
31
+ .notification-message
32
+ = Spina::Shop::Product.human_attribute_name :cannot_be_created
33
+ %small
34
+ - @product.errors.full_messages.each do |message|
35
+ = message
36
+ %br/
37
+ = link_to '#', data: {close_notification: true} do
38
+ = icon('cross')
39
+
40
+ .sidebar-form
41
+ - Globalize.with_locale(@locale) do
42
+ .sidebar-form-content
43
+ .well
44
+ .sidebar-form-group
45
+ .sidebar-form-label
46
+ = Spina::Shop::Product.human_attribute_name :name
47
+
48
+ .sidebar-form-control
49
+ = f.text_field :name, placeholder: Spina::Shop::Product.human_attribute_name(:name), value: f.object.name
50
+
51
+ .sidebar-form-group
52
+ .sidebar-form-label
53
+ = Spina::Shop::Product.human_attribute_name :sku
54
+
55
+ .sidebar-form-control
56
+ = f.text_field :sku, placeholder: Spina::Shop::Product.human_attribute_name(:sku), disabled: !@product.editable_sku
57
+
58
+ .well
59
+ .sidebar-form-group
60
+ .sidebar-form-control
61
+ %trix-toolbar.clearfix{ id: "product_description_toolbar", data: { trix_editor_id: "product_description_editor" }}
62
+ .button-groups
63
+ .button-group
64
+ %button.button.button-small{ type: 'button', tabindex: -1, title: 'Bold', data: { trix_attribute: 'bold', trix_key: 'b' }}
65
+ .icon.icon-bold
66
+ %button.button.button-small{ type: 'button', tabindex: -1, title: 'Italic', data: { trix_attribute: 'italic', trix_key: 'i' }}
67
+ .icon.icon-italic
68
+ %button.button.button-small{ type: 'button', tabindex: -1, title: 'Bullets', data: { trix_attribute: 'bullet' }}
69
+ .icon.icon-list-ul
70
+ %trix-editor.text-input{input: "product_description", toolbar: "product_description_toolbar", id: "product_description_editor", placeholder: Spina::Shop::Product.human_attribute_name(:description)}
71
+ = f.hidden_field :description, id: 'product_description'
72
+
73
+ - if @product_category.present?
74
+ .well
75
+ = f.fields_for :properties do |property_builder|
76
+ - @product_category.product_properties.includes(property_options: :translations).each do |property|
77
+ = render partial: 'spina/shop/admin/products/properties/property_fields', locals: {f: property_builder, property: property, object: @product}
78
+
79
+ .well
80
+ .sidebar-form-group
81
+ .sidebar-form-label
82
+ = Spina::Shop::Product.human_attribute_name :must_be_of_age_to_buy
83
+ .sidebar-form-control
84
+ = f.check_box :must_be_of_age_to_buy, data: {switch: true}
85
+
86
+ .well
87
+ .sidebar-form-group
88
+ .sidebar-form-label
89
+ = Spina::Shop::Product.human_attribute_name :supplier
90
+ .sidebar-form-control
91
+ = f.text_field :supplier, placeholder: Spina::Shop::Product.human_attribute_name(:supplier)
92
+
93
+ .well
94
+ - if Spina::Shop::ProductCollection.any?
95
+ .sidebar-form-group
96
+ .sidebar-form-label
97
+ = Spina::Shop::Product.human_attribute_name :product_collections
98
+
99
+ .sidebar-form-control
100
+ = f.select :product_collection_ids, options_for_select(Spina::Shop::ProductCollection.pluck(:name, :id), f.object.product_collection_ids), {}, class: 'select2', multiple: true, style: 'width: 100%'
101
+
102
+ .sidebar-form-group
103
+ .sidebar-form-label
104
+ = Spina::Shop::Product.human_attribute_name :related_products
105
+
106
+ .sidebar-form-control
107
+ = f.select :related_product_ids, options_for_select(f.object.related_products.map{|p| [p.name, p.id]}, f.object.related_product_ids), {}, class: 'select-products', multiple: true, style: 'width: 100%'
108
+
109
+ .well
110
+ .sidebar-form-group
111
+ .sidebar-form-label
112
+ = Spina::Shop::Product.human_attribute_name :seo_title
113
+ .sidebar-form-control
114
+ = f.text_field :seo_title, placeholder: Spina::Shop::Product.human_attribute_name(:seo_title)
115
+
116
+ .sidebar-form-group
117
+ .sidebar-form-label
118
+ = Spina::Shop::Product.human_attribute_name :seo_description
119
+ .sidebar-form-control
120
+ = f.text_field :seo_description, placeholder: Spina::Shop::Product.human_attribute_name(:seo_description)
121
+
122
+ .sidebar-form-group
123
+ .sidebar-form-label
124
+ = Spina::Shop::Product.human_attribute_name :materialized_path
125
+ .sidebar-form-control
126
+ = f.text_field :materialized_path, disabled: true
127
+
128
+ .sidebar-form-sidebar
129
+ #productImageUploader.sidebar-form-images
130
+ = f.fields_for :product_images, f.object.product_images.ordered do |image_builder|
131
+ - if image_builder.object.file.present?
132
+ .sidebar-form-image{data: {id: image_builder.object.id}}>
133
+ = image_tag attachment_url(image_builder.object, :file, :fit, 320, 240)
134
+ = image_builder.hidden_field :id
135
+ = image_builder.hidden_field :position, class: 'product-image-position'
136
+ = image_builder.check_box :_destroy, style: 'display: none'
137
+ = link_to '#', style: "position: absolute; bottom: 0; right: 0" do
138
+ = image_tag 'spina/shop/delete-big.png'
139
+ = image_tag 'spina/shop/delete-big-confirm.png'
140
+ .sidebar-form-image-overlay
141
+
142
+ = f.attachment_field :product_images_files, direct: true, multiple: true, presigned: true, class: "sidebar-form-image-dropzone"
143
+
144
+ .form-group
145
+ .form-label
146
+ = Spina::Shop::Product.human_attribute_name :active
147
+
148
+ .form-control
149
+ = f.check_box :active, data: {switch: true}
150
+
151
+ .form-group
152
+ .form-label
153
+ = Spina::Shop::Product.human_attribute_name :base_price
154
+
155
+ .form-control{data: {form_prepend: t('number.currency.format.unit')}}
156
+ .input-group
157
+ = f.text_field :base_price, value: number_with_precision(f.object.base_price, precision: 2)
158
+ .select-dropdown
159
+ = f.select :price_includes_tax, options_for_select([['incl.', true], ['excl.', false]], f.object.price_includes_tax)
160
+ .select-dropdown{style: "min-width: 120px"}
161
+ = f.select :tax_group_id, options_for_select(Spina::Shop::TaxGroup.all.map{|t| [t.name, t.id]}, f.object.tax_group_id)
162
+
163
+ .form-group
164
+ .form-label
165
+ = Spina::Shop::Product.human_attribute_name :promotional_price
166
+
167
+ .form-control{data: {form_prepend: t('number.currency.format.unit')}}
168
+ = f.text_field :promotional_price, value: number_with_precision(f.object.promotional_price, precision: 2)
169
+
170
+ - if Spina::Shop::CustomerGroup.any?
171
+ .form-group{style: 'margin-bottom: 40px'}
172
+ .form-label
173
+ = Spina::Shop::Product.human_attribute_name :price_exceptions
174
+
175
+ - @product.price_exceptions['customer_groups'].try(:each) do |price_exception|
176
+ = render partial: 'price_exception_fields', locals: {f: f, price_exception: price_exception}
177
+
178
+ = link_to_add_price_exception f do
179
+ = icon('plus')
180
+
181
+ .form-group
182
+ .form-label
183
+ = Spina::Shop::Product.human_attribute_name :sales_category
184
+
185
+ .form-control
186
+ .select-dropdown{style: 'width: 100%'}
187
+ = f.select :sales_category_id, options_for_select(Spina::Shop::SalesCategory.all.map{|c| [c.name, c.id]}, f.object.sales_category_id)
188
+
189
+ .form-group
190
+ .form-label
191
+ = Spina::Shop::Product.human_attribute_name :cost_price
192
+
193
+ .form-control{data: {form_prepend: '€'}}
194
+ = f.text_field :cost_price, value: number_with_precision(f.object.cost_price, precision: 2)
195
+
196
+ .form-group
197
+ .form-label
198
+ = Spina::Shop::Product.human_attribute_name :stock_enabled
199
+
200
+ .form-control
201
+ = f.check_box :stock_enabled, data: {switch: true}
202
+
203
+ .form-group
204
+ .form-label
205
+ .pull-right.text-muted{style: 'font-weight: 400'}=l(f.object.expiration_date, format: '%B \'%y') if f.object.expiration_date
206
+ = Spina::Shop::Product.human_attribute_name :can_expire
207
+
208
+ .form-control
209
+ = f.check_box :can_expire, data: {switch: true}
210
+
211
+ - if f.object.stock_enabled?
212
+ - unless f.object.new_record?
213
+ .form-group
214
+ .form-label
215
+ %small= link_to t('spina.shop.products.stock_history'), spina.shop_admin_product_stock_level_adjustments_path(f.object), class: 'text-muted pull-right', data: {remote: true}
216
+ = Spina::Shop::Product.human_attribute_name :stock_level
217
+
218
+ .form-control
219
+ .pull-right{style: 'position: absolute; right: 10px;top: 11px; font-size: 14px'}
220
+ = link_to t('spina.shop.products.adjust_stock'), spina.new_shop_admin_product_stock_level_adjustment_path(f.object), data: {remote: true}
221
+ = text_field_tag :stock_level, f.object.stock_level, disabled: true
222
+
223
+ .form-group
224
+ .form-label
225
+ = Spina::Shop::Product.human_attribute_name :location
226
+
227
+ .form-control
228
+ = f.text_field :location, placeholder: Spina::Shop::Product.human_attribute_name(:location)
229
+
230
+ .form-group
231
+ .form-label
232
+ = Spina::Shop::Product.human_attribute_name :weight
233
+
234
+ .form-control{data: {form_append: 'gr'}}
235
+ = f.text_field :weight, value: number_with_precision(f.object.weight, precision: 3, strip_insignificant_zeros: true)
236
+
237
+ .form-group
238
+ .form-label
239
+ = Spina::Shop::Product.human_attribute_name :ean
240
+
241
+ .form-control
242
+ = f.text_field :ean, placeholder: Spina::Shop::Product.human_attribute_name(:ean)
243
+
244
+ .form-group
245
+ .form-label
246
+ = Spina::Shop::Product.human_attribute_name :supplier_reference
247
+
248
+ .form-control
249
+ = f.text_field :supplier_reference, placeholder: Spina::Shop::Product.human_attribute_name(:supplier_reference)
250
+
251
+ - unless @product.new_record?
252
+ .pull-right
253
+ - if @product.archived?
254
+ = link_to t('spina.shop.products.unarchive'), spina.unarchive_shop_admin_product_path(@product), method: :post, class: 'button button-link'
255
+ - else
256
+ = link_to t('spina.shop.products.archive'), spina.archive_shop_admin_product_path(@product), method: :post, class: 'button button-link', data: {confirm: t('spina.shop.products.archive_confirmation', name: @product.name)}
257
+
258
+ - if @product.deletable
259
+ = link_to t('spina.shop.products.delete'), spina.shop_admin_product_path(@product), method: :delete, class: 'button button-link button-danger', data: {confirm: t('spina.shop.products.delete_confirmation', name: @product.name)}, style: 'padding-right: 0'
@@ -0,0 +1,15 @@
1
+ .modal
2
+ %header
3
+ = link_to '#', data: {dismiss: "modal"} do
4
+ = icon('cross')
5
+ %h3=t 'spina.shop.products.new_by_category_title_html'
6
+
7
+ = form_tag spina.new_shop_admin_product_path, method: :get do
8
+ %section
9
+ .select-dropdown{style: 'width: 100%'}= select_tag :product_category_id, options_for_select(@product_categories.map{|c| [c.name, c.id]}), include_blank: t('spina.commerce.product_categories.no_categories')
10
+
11
+ %footer
12
+ = link_to t('spina.cancel'), '#', data: {dismiss: 'modal'}
13
+ = button_tag type: :submit, class: 'primary' do
14
+ %i.icon.icon-plus{style: 'margin-right: 4px'}
15
+ =t 'spina.shop.products.new'
@@ -0,0 +1,11 @@
1
+ .form-control{style: 'margin-bottom: 20px', data: {form_prepend: t('number.currency.format.unit')}}
2
+ .input-group
3
+ = f.text_field 'price_exceptions[customer_groups][][price]', value: number_with_precision(price_exception["price"], precision: 2), placeholder: Spina::Shop::Product.human_attribute_name(:price)
4
+
5
+ .select-dropdown{style: "min-width: 100px"}= select_tag 'product[price_exceptions[customer_groups][][price_includes_tax]]', options_for_select([['incl. btw', true], ['excl. btw', false]], price_exception["price_includes_tax"])
6
+
7
+ .select-dropdown{style: 'width: 100%'}= select_tag 'product[price_exceptions[customer_groups][][customer_group_id]]', options_for_select(Spina::Shop::CustomerGroup.all.map{|g|[g.name, g.id]}, price_exception["customer_group_id"]), prompt: t('spina.shop.products.choose_customer_group')
8
+
9
+ = link_to '#', class: 'button button-link remove_price_exception', style: "margin: 0; padding-right: 0" do
10
+ = icon('trash')
11
+ =t 'spina.delete'
@@ -0,0 +1,36 @@
1
+ %tr{class: ('text-muted' if !product.active? || product.archived?)}
2
+ %td.align-center{style: 'width: 30px'}
3
+ = image_tag attachment_url(product.product_images.first, :file, :fit, 30, 30, fallback: ''), style: 'vertical-align: middle; margin: -10px 0'
4
+ %td
5
+ = link_to product.name, spina.shop_admin_product_path(product), class: 'table-link'
6
+ %td.align-right
7
+ - if product.promotion?
8
+ %small{style: 'text-decoration: line-through'}= number_to_currency product.base_price
9
+ = number_to_currency product.price
10
+ %td.align-right
11
+ = product.location
12
+ %td.align-right
13
+ = product.stock_level if product.stock_enabled?
14
+ %td.align-right
15
+ =l product.expiration_date, format: '%B \'%y' if product.can_expire? && product.expiration_date.present?
16
+ %td.align-right
17
+ - if product.active?
18
+ - if !product.archived?
19
+ - if product.stock_enabled?
20
+ - if product.in_stock?
21
+ - if product.can_expire? && product.expiration_date.present? && product.expiration_date < 2.months.from_now
22
+ - if product.expiration_date < Date.today
23
+ .status-dot.status-dot-danger{data: {tooltip: t('spina.shop.products.expired')}}
24
+ - else
25
+ .status-dot.status-dot-warning{data: {tooltip: t('spina.shop.products.almost_expired')}}
26
+ - else
27
+ .status-dot.status-dot-success
28
+ - else
29
+ .status-dot.status-dot-danger{data: {tooltip: t('spina.shop.products.out_of_stock')}}
30
+ - else
31
+ .status-dot.status-dot-success
32
+ - else
33
+ .status-dot
34
+ - else
35
+ .status-dot
36
+
@@ -0,0 +1 @@
1
+ = render 'form'
@@ -0,0 +1,73 @@
1
+ %header#header
2
+ .breadcrumbs
3
+ .pull-right{style: "height: 0px"}
4
+ = link_to spina.new_by_category_shop_admin_products_path, class: 'button button-mini icon-only', data: {remote: true} 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 spina.shop_admin_products_path do
12
+ =t 'spina.shop.products.title'
13
+
14
+ %li{class: ("active" if action_name == "archived")}
15
+ = link_to spina.archived_shop_admin_products_path do
16
+ =t 'spina.shop.products.archived_title'
17
+
18
+ %li
19
+ = link_to spina.shop_admin_product_bundles_path do
20
+ = Spina::Shop::ProductBundle.model_name.human count: 2
21
+
22
+ %li
23
+ = link_to spina.shop_admin_stock_forecast_path do
24
+ Voorraad
25
+
26
+ = search_form_for @q, url: (action_name == "index" ? spina.shop_admin_products_path : spina.archived_shop_admin_products_path), html: {class: 'filter-form'} do |f|
27
+ .filter-form-simple
28
+ .filter-form-input
29
+ = f.text_field :sku_or_translations_name_cont, style: 'box-sizing: border-box', placeholder: 'Filter op naam of SKU'
30
+ = link_to 'geavanceerd', '#', class: 'filter-form-advanced-link'
31
+
32
+ = button_tag type: :submit, class: 'button button-primary icon-only' do
33
+ = icon('search')
34
+
35
+ .filter-form-advanced
36
+ .filter-form-advanced-group
37
+ .filter-form-label
38
+ ID
39
+
40
+ .filter-form-control
41
+ .input-group
42
+ = f.text_field :id_gteq, placeholder: 'min'
43
+ = f.text_field :id_lteq, placeholder: 'max'
44
+
45
+ - @product_category_properties.each do |property|
46
+ .filter-form-advanced-group
47
+ .filter-form-label
48
+ = property.label
49
+ .filter-form-control
50
+ - if property.field_type == 'select'
51
+ - options = options_for_select(property.property_options.map{|option| [option.label, option.name]}, params[:filters].try(:[], property.name))
52
+ = select_tag "filters[#{property.name}]", options, class: 'select2', style: 'width: 100%', multiple: true
53
+ - else
54
+ .input-group
55
+ = number_field_tag "filters[#{property.name}][min]", params[:filters].try(:[], property.name).try(:[], 'min'), placeholder: 'min'
56
+ = number_field_tag "filters[#{property.name}][max]", params[:filters].try(:[], property.name).try(:[], 'max'), placeholder: 'max'
57
+
58
+ .table-container.infinite-table
59
+ %table.table.table-clickable
60
+ %thead
61
+ %tr
62
+ %th
63
+ %th= sort_link [:spina, @q], :translations_name, Spina::Shop::Product.human_attribute_name(:name), {}, class: 'table-sort'
64
+ %th{style: 'text-align: right'}= sort_link [:spina, @q], :price, Spina::Shop::Product.human_attribute_name(:price), {}, class: 'table-sort'
65
+ %th{style: 'text-align: right'}= sort_link [:spina, @q], :location, Spina::Shop::Product.human_attribute_name(:location), {}, class: 'table-sort'
66
+ %th{style: 'text-align: right'}= sort_link [:spina, @q], :stock_level, ['stock_enabled desc', :stock_level], Spina::Shop::Product.human_attribute_name(:stock_level), {}, class: 'table-sort'
67
+ %th.align-right= sort_link [:spina, @q], :expiration_date, Spina::Shop::Product.human_attribute_name(:expiration_date), {}, class: 'table-sort'
68
+ %th
69
+
70
+ %tbody
71
+ = render partial: "product", collection: @products
72
+
73
+ .pagination= link_to_next_page @products, 'Next'