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: 'product', collection: @products.to_a.uniq %>").appendTo($(".infinite-table table tbody"));
2
+
3
+ // Update pagination link
4
+ $('.pagination').html("<%=j link_to_next_page @products, 'Next' %>").infiniteScroll();
@@ -0,0 +1 @@
1
+ = render 'form'
@@ -0,0 +1 @@
1
+ $("<%=j render 'new_product_modal' %>").modal();
@@ -0,0 +1,11 @@
1
+ .sidebar-form-group{style: 'padding-right: 0'}
2
+ .sidebar-form-control{style: 'flex: none; padding-right: 10px'}
3
+ = f.select :quantity, options_for_select((1..50).map{|i| ["#{i} x", i]}, f.object.quantity), {}, class: 'select2', style: 'width: 70px'
4
+
5
+ .sidebar-form-control
6
+ = f.select :product_id, options_for_select([[f.object.product.try(:name), f.object.product.try(:id)]], f.object.product_id), {include_blank: t('spina.shop.products.select_blank')}, class: 'select-products', style: 'width: 100%'
7
+
8
+ .sidebar-form-delete
9
+ = f.hidden_field :_destroy
10
+ = link_to '#', class: 'remove_fields remove_product_fields button button-link' do
11
+ = icon('trash')
@@ -0,0 +1,64 @@
1
+ = form_for @product_bundle, url: @product_bundle.new_record? ? spina.shop_admin_product_bundles_path : spina.shop_admin_product_bundle_path(@product_bundle) do |f|
2
+
3
+ %header#header
4
+ #header_actions
5
+ = button_tag type: :submit, class: 'button button-primary' do
6
+ = icon('check')
7
+ Opslaan
8
+
9
+ .breadcrumbs= render_breadcrumbs separator: '<div class="divider"></div>'
10
+
11
+ .sidebar-form
12
+ .sidebar-form-content
13
+ .well
14
+ .sidebar-form-group
15
+ .sidebar-form-label
16
+ = Spina::Shop::ProductBundle.human_attribute_name :name
17
+ .sidebar-form-control
18
+ = f.text_field :name, placeholder: Spina::Shop::ProductBundle.human_attribute_name(:name)
19
+
20
+ .well
21
+ = f.fields_for :bundled_products do |ff|
22
+ = render 'bundled_products_fields', f: ff
23
+
24
+ = link_to_add_product_fields f, :bundled_products do
25
+ = icon('plus')
26
+ =t 'spina.shop.product_bundles.add_bundled_product'
27
+
28
+ .sidebar-form-sidebar
29
+ #productImageUploader.sidebar-form-images
30
+ = f.fields_for :product_images, f.object.product_images.ordered do |image_builder|
31
+ - if image_builder.object.file.present?
32
+ .sidebar-form-image{data: {id: image_builder.object.id}}>
33
+ = image_tag attachment_url(image_builder.object, :file, :fill, 320, 240)
34
+ = image_builder.hidden_field :id
35
+ = image_builder.hidden_field :position, class: 'product-image-position'
36
+ = image_builder.check_box :_destroy, style: 'display: none'
37
+ = link_to '#', style: "position: absolute; bottom: 0; right: 0" do
38
+ = image_tag 'spina/shop/delete-big.png'
39
+ = image_tag 'spina/shop/delete-big-confirm.png'
40
+ .sidebar-form-image-overlay
41
+
42
+ = f.attachment_field :product_images_files, direct: true, multiple: true, presigned: true, class: "sidebar-form-image-dropzone"
43
+
44
+ .form-group
45
+ .form-label
46
+ = Spina::Shop::ProductBundle.human_attribute_name :price
47
+
48
+ .form-control{data: {form_prepend: '€'}}
49
+ .input-group
50
+ = f.text_field :price, value: number_with_precision(f.object.price, precision: 2)
51
+ .select-dropdown{style: "min-width: 120px"}
52
+ = f.select :tax_group_id, options_for_select(Spina::Shop::TaxGroup.all.map{|t| [t.name, t.id]}, f.object.tax_group_id)
53
+
54
+ .form-group
55
+ .form-label
56
+ = Spina::Shop::ProductBundle.human_attribute_name :sales_category
57
+
58
+ .form-control
59
+ .select-dropdown{style: 'width: 100%'}
60
+ = f.select :sales_category_id, options_for_select(Spina::Shop::SalesCategory.all.map{|c| [c.name, c.id]}, f.object.sales_category_id)
61
+
62
+ - unless @product_bundle.new_record?
63
+ .pull-right
64
+ = link_to 'Verwijderen', spina.shop_admin_product_bundle_path(@product_bundle), data: {method: :delete, confirm: "Weet je het zeker?"}, class: 'button button-danger button-link'
@@ -0,0 +1,42 @@
1
+ %header#header
2
+ .breadcrumbs
3
+ .pull-right{style: "height: 0px"}
4
+ = link_to spina.new_shop_admin_product_bundle_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
11
+ = link_to spina.shop_admin_products_path do
12
+ =t 'spina.shop.products.title'
13
+
14
+ %li
15
+ = link_to spina.archived_shop_admin_products_path do
16
+ =t 'spina.shop.products.archived_title'
17
+
18
+ %li.active
19
+ = link_to spina.shop_admin_product_bundles_path do
20
+ Productbundels
21
+
22
+ .table-container
23
+ %table.table.table-clickable
24
+ %thead
25
+ %tr
26
+ %th Bundel
27
+ %th Inhoud
28
+ %th.text-right Prijs
29
+
30
+ %tbody
31
+ - @product_bundles.each do |product_bundle|
32
+ %tr
33
+ %td
34
+ = link_to product_bundle.name, spina.shop_admin_product_bundle_path(product_bundle), class: 'table-link'
35
+ %td
36
+ = product_bundle.bundled_products.sum(:quantity)
37
+ producten
38
+ %td.text-right
39
+ %em.text-muted{style: 'text-decoration: line-through'}
40
+ = number_to_currency product_bundle.original_price
41
+ &nbsp;
42
+ = number_to_currency product_bundle.price
@@ -0,0 +1,37 @@
1
+ .sidebar-form-group
2
+ .sidebar-form-label
3
+ = property.label
4
+
5
+ .sidebar-form-control{data: {form: {append: property.append, prepend: property.prepend}}}
6
+ - case property.field_type
7
+ - when 'select'
8
+ = f.select property.name, options_for_select(property.property_options.map{|option| [option.label, option.name]}, (object.properties[property.name] if object.properties.present?)), {include_blank: ('–' unless property.multiple), include_hidden: false}, class: 'select2', multiple: property.multiple, style: 'width: 100%'
9
+ - when 'product'
10
+ = f.select property.name, [], {}, class: 'select-products', multiple: property.multiple, style: 'width: 100%'
11
+ - when 'textarea'
12
+ %trix-toolbar.clearfix{ id: "#{property.name}_toolbar", data: { trix_editor_id: "#{property.name}_editor" }}
13
+ .button-groups
14
+ .button-group
15
+ %button.button.button-small{ type: 'button', tabindex: -1, title: 'Bold', data: { trix_attribute: 'bold', trix_key: 'b' }}
16
+ .icon.icon-bold
17
+ %button.button.button-small{ type: 'button', tabindex: -1, title: 'Italic', data: { trix_attribute: 'italic', trix_key: 'i' }}
18
+ .icon.icon-italic
19
+ %button.button.button-small{ type: 'button', tabindex: -1, title: 'Bullets', data: { trix_attribute: 'bullet' }}
20
+ .icon.icon-list-ul
21
+ %trix-editor.text-input{input: property.name, toolbar: "#{property.name}_toolbar", id: "#{property.name}_editor", placeholder: property.label}
22
+ = f.hidden_field property.name, id: property.name, value: object.properties.try(property.name)
23
+ - when 'image'
24
+ - image = Spina::Photo.find_by(id: object.properties.try(property.name))
25
+ = link_to spina.photo_select_admin_photos_path(property.name, selected_photo_id: object.properties.try(property.name), hidden_field_id: "#{property.name}_image_id"), remote: true, class: 'media_picker clearfix' do
26
+ .placeholder
27
+ %span.button.button-small.button-round
28
+ %i.icon.icon-dots
29
+ =t 'spina.pages.photo_picker'
30
+
31
+ - if image.present?
32
+ .image= image_tag image.file.thumb
33
+
34
+ = f.hidden_field property.name, value: object.properties.try(property.name), data: {hidden_field_id: "#{property.name}_image_id"}
35
+
36
+ - else
37
+ = f.text_field property.name, placeholder: property.label, value: (object.properties[property.name] if object.properties.present?)
@@ -0,0 +1,49 @@
1
+ - afgelopen_30_days = product.stock_level_adjustments.sales.where('spina_shop_stock_level_adjustments.created_at > ?', 30.days.ago).sum(:adjustment) * -1
2
+ %tr
3
+ %td.align-center{style: 'width: 30px'}
4
+ = image_tag attachment_url(product.product_images.first, :file, :fit, 30, 30, fallback: ''), style: 'vertical-align: middle; margin: -10px 0'
5
+ %td
6
+ = link_to product.name, spina.shop_admin_product_path(product)
7
+ %td= product.supplier
8
+ %td.text-right
9
+ - if product.stock_level < 4
10
+ .text-danger= product.stock_level
11
+ - else
12
+ .text-success= product.stock_level
13
+ %td.text-right
14
+ = afgelopen_30_days
15
+ %td.text-right
16
+ = product.coming_30_days
17
+ %td.text-right
18
+ - if product.restock_date <= Date.today
19
+ Vandaag
20
+ - else
21
+ over
22
+ - if product.restock_date == Date.tomorrow
23
+ 1 dag
24
+ - else
25
+ = time_ago_in_words(product.restock_date)
26
+ %td.align-right
27
+ - if product.active?
28
+ - if !product.archived?
29
+ - if product.stock_enabled?
30
+ - if product.in_stock?
31
+ - if product.can_expire? && product.expiration_date.present? && product.expiration_date < 2.months.from_now
32
+ - if product.expiration_date < Date.today
33
+ .status-dot.status-dot-danger{data: {tooltip: t('spina.shop.products.expired')}}
34
+ - else
35
+ .status-dot.status-dot-warning{data: {tooltip: t('spina.shop.products.almost_expired')}}
36
+ - else
37
+ - if product.stock_level > 4
38
+ .status-dot.status-dot-success
39
+ - else
40
+ .status-dot.status-dot-warning{data: {tooltip: "Voorraad laag"}}
41
+ - else
42
+ .status-dot.status-dot-danger{data: {tooltip: t('spina.shop.products.out_of_stock')}}
43
+ - else
44
+ .status-dot.status-dot-success
45
+ - else
46
+ .status-dot
47
+ - else
48
+ .status-dot
49
+
@@ -0,0 +1,47 @@
1
+ %header#header
2
+ .breadcrumbs
3
+ = render_breadcrumbs separator: '<div class="divider"></div>'
4
+
5
+ %nav#secondary
6
+ %ul
7
+ %li{class: ("active" if action_name == "index")}
8
+ = link_to spina.shop_admin_products_path do
9
+ =t 'spina.shop.products.title'
10
+
11
+ %li{class: ("active" if action_name == "archived")}
12
+ = link_to spina.archived_shop_admin_products_path do
13
+ =t 'spina.shop.products.archived_title'
14
+
15
+ %li
16
+ = link_to spina.shop_admin_product_bundles_path do
17
+ = Spina::Shop::ProductBundle.model_name.human count: 2
18
+
19
+ %li.active
20
+ = link_to spina.shop_admin_stock_forecast_path do
21
+ Voorraad
22
+
23
+ .table-container.infinite-table
24
+ %table.table.table-clickable
25
+ %thead
26
+ %tr
27
+ %th
28
+ %th Naam
29
+ %th Leverancier
30
+ %th.text-right
31
+ = link_to spina.shop_admin_stock_forecast_path(order: 'stock_level', direction: params[:direction] == 'asc' ? 'desc' : 'asc') do
32
+ Voorraad
33
+ %th.text-right{style: 'white-space: nowrap'} Verkoop<br /><small>afgelopen 30 dagen</small>
34
+ %th.text-right{style: 'white-space: nowrap'}
35
+ = link_to spina.shop_admin_stock_forecast_path(order: 'coming_30_days', direction: params[:direction] == 'asc' ? 'desc' : 'asc') do
36
+ Schatting verkoop<br /><small>komende 30 dagen</small>
37
+ %th.text-right
38
+ = link_to spina.shop_admin_stock_forecast_path(order: 'restock_date', direction: params[:direction] == 'asc' ? 'desc' : 'asc') do
39
+ Schatting inkoop<br /><small>minimale voorraad bereikt</small>
40
+ / %th.text-right
41
+ / %th.text-right
42
+ %th
43
+
44
+ %tbody
45
+ = render partial: "product", collection: @products
46
+
47
+ .pagination= link_to_next_page @products, 'Next'
@@ -0,0 +1,4 @@
1
+ $("<%=j render partial: 'product', collection: @products.to_a.uniq %>").appendTo($(".infinite-table table tbody"));
2
+
3
+ // Update pagination link
4
+ $('.pagination').html("<%=j link_to_next_page @products, 'Next' %>").infiniteScroll();
@@ -0,0 +1,37 @@
1
+ .modal
2
+ %header
3
+ = link_to '#', data: {dismiss: "modal"} do
4
+ = icon('cross')
5
+ %h3 Hoeveel stuks?
6
+
7
+ = form_for @stock_level_adjustment, url: @stock_level_adjustment.new_record? ? spina.shop_admin_product_stock_level_adjustments_path(@product) : spina.shop_admin_product_stock_level_adjustment_path(@product, @stock_level_adjustement) do |f|
8
+
9
+ %section
10
+ .form-group
11
+ = f.number_field :adjustment
12
+
13
+ - if @product.in_stock_reminders.any?
14
+ .form-checkbox{style: 'margin-top: 10px'}
15
+ = check_box_tag :send_in_stock_reminders
16
+ = label_tag :send_in_stock_reminders do
17
+ = t('spina.shop.products.send_in_stock_reminders')
18
+ %span.text-muted{style: "margin-left: 8px"}
19
+ = icon('mail')
20
+ = "#{@product.in_stock_reminders.count}"
21
+
22
+ - if @product.can_expire?
23
+ .form-title.text-muted Verloopdatum
24
+ %br/
25
+
26
+ .input-group
27
+ .select-dropdown
28
+ = f.select :expiration_month, options_for_select((1..12).map {|m| [I18n.l(DateTime.parse(Date::MONTHNAMES[m]), format: "%B"), m]}), prompt: "Kies een maand"
29
+
30
+ .select-dropdown
31
+ = f.select :expiration_year, options_for_select(Date.today.year..8.years.from_now.year), prompt: "Kies een jaar"
32
+
33
+ %footer
34
+ = link_to 'Annuleren', '#', data: {dismiss: 'modal'}
35
+ = button_tag type: :submit, class: 'primary' do
36
+ %i.icon.icon-plus{style: 'margin-right: 4px'}
37
+ Voorraad bijwerken
@@ -0,0 +1,30 @@
1
+ .modal
2
+ %header
3
+ = link_to '#', data: {dismiss: "modal"} do
4
+ = icon('cross')
5
+ %h3 Historie voorraad #{@product.name}
6
+
7
+ %section{style: 'padding-top: 0; padding-bottom: 0'}
8
+ .table-container
9
+ %table.table{style: 'margin: 0'}
10
+ %thead
11
+ %tr
12
+ %th Adjustment
13
+ %th Note
14
+ %th Added on
15
+ %th.text-right Expiration date
16
+
17
+ - @stock_level_adjustments.order(created_at: :desc).each do |adjustment|
18
+ %tr
19
+ %td
20
+ - if adjustment.adjustment > 0
21
+ .text-success= adjustment.adjustment
22
+ - else
23
+ .text-danger= adjustment.adjustment
24
+
25
+ %td= adjustment.description
26
+ %td=l adjustment.created_at, format: "%d-%m-%Y"
27
+ %td.text-muted.text-right= adjustment.expiration_date if adjustment.adjustment > 0
28
+
29
+ %footer
30
+ = link_to 'Sluiten', '#', data: {dismiss: 'modal'}, style: 'width: 100%'
@@ -0,0 +1 @@
1
+ $("<%=j render 'history' %>").modal();
@@ -0,0 +1 @@
1
+ $("<%=j render 'form' %>").modal();
@@ -0,0 +1,23 @@
1
+ %header#header
2
+ .breadcrumbs
3
+ = render_breadcrumbs separator: '<div class="divider"></div>'
4
+
5
+ .well
6
+ = form_with url: spina.shop_admin_reports_path, method: :post do |f|
7
+ .form-group
8
+ .select-dropdown{style: 'width: 100%'}
9
+ = f.select :report_type, options_for_select([['Facturen', 'invoices'], ['Betalingen', 'payments']])
10
+
11
+ .form-group
12
+ %label.form-label Begindatum
13
+ = f.text_field :start_date, placeholder: "Start date", value: f.object.try(:start_date) || l(Date.today.beginning_of_month, format: '%d-%m-%Y'), class: 'datepicker'
14
+
15
+ .form-group
16
+ %label.form-label Einddatum
17
+ = f.text_field :end_date, placeholder: "End date", value: f.object.try(:end_date) || l(Date.today.end_of_month, format: '%d-%m-%Y'), class: 'datepicker'
18
+
19
+ .form-group
20
+ %label.form-label Email naar:
21
+ = f.text_field :email, placeholder: "Email", value: f.object.try(:email) || current_account.email
22
+
23
+ = f.submit "Genereer rapportage", class: 'button button-primary'
@@ -0,0 +1,18 @@
1
+ = form_for [:admin, :settings, @product_category] do |f|
2
+ %header#header
3
+ .breadcrumbs= render_breadcrumbs separator: '<div class="divider"></div>'
4
+
5
+ #header_actions
6
+ %button.button.button-primary{type: 'submit'}
7
+ = icon('check')
8
+ =t 'spina.save'
9
+
10
+ .sidebar-form
11
+ .sidebar-form-content
12
+ .well
13
+ .sidebar-form-group
14
+ .sidebar-form-label
15
+ = Spina::ProductCategory.human_attribute_name :name
16
+
17
+ .sidebar-form-control
18
+ = f.text_field :name, placeholder: Spina::ProductCategory.human_attribute_name(:name)
@@ -0,0 +1,3 @@
1
+ %tr
2
+ %td= link_to product_category.name, spina.shop_admin_settings_product_category_path(product_category), class: 'table-link'
3
+ %td= product_category.products.count
@@ -0,0 +1,77 @@
1
+ .well
2
+ .sidebar-form-group
3
+ .sidebar-form-label
4
+ Name
5
+
6
+ .sidebar-form-control
7
+ = f.text_field :name
8
+
9
+ .sidebar-form-group
10
+ .sidebar-form-label
11
+ Label
12
+
13
+ .sidebar-form-control
14
+ = f.text_field :label
15
+
16
+ .sidebar-form-group
17
+ .sidebar-form-label
18
+ Property type
19
+
20
+ .sidebar-form-control
21
+ = f.text_field :property_type
22
+
23
+ .sidebar-form-group
24
+ .sidebar-form-label
25
+ Field type
26
+
27
+ .sidebar-form-control
28
+ = f.text_field :field_type
29
+
30
+ .sidebar-form-group
31
+ .sidebar-form-label
32
+ Minimum
33
+
34
+ .sidebar-form-control
35
+ = f.text_field :minimum
36
+
37
+ .sidebar-form-group
38
+ .sidebar-form-label
39
+ Maximum
40
+
41
+ .sidebar-form-control
42
+ = f.text_field :maximum
43
+
44
+ .sidebar-form-group
45
+ .sidebar-form-label
46
+ Prepend
47
+
48
+ .sidebar-form-control
49
+ = f.text_field :prepend
50
+
51
+ .sidebar-form-group
52
+ .sidebar-form-label
53
+ Append
54
+
55
+ .sidebar-form-control
56
+ = f.text_field :append
57
+
58
+ .sidebar-form-group
59
+ .sidebar-form-label
60
+ Options
61
+
62
+ .sidebar-form-control
63
+ = f.text_field :options
64
+
65
+ .sidebar-form-group
66
+ .sidebar-form-label
67
+ Multiple
68
+
69
+ .sidebar-form-control
70
+ = f.check_box :multiple, data: {switch: true}
71
+
72
+ .sidebar-form-group
73
+ .sidebar-form-label
74
+ Required
75
+
76
+ .sidebar-form-control
77
+ = f.check_box :required, data: {switch: true}