spree_drop_ship 3.1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/Gemfile +9 -0
  4. data/LICENSE +21 -0
  5. data/README.md +116 -0
  6. data/Rakefile +15 -0
  7. data/Versionfile +6 -0
  8. data/app/assets/javascripts/spree/backend/spree_drop_ship.js +2 -0
  9. data/app/assets/javascripts/spree/frontend/spree_drop_ship.js +1 -0
  10. data/app/assets/stylesheets/spree/backend/spree_drop_ship.scss +22 -0
  11. data/app/assets/stylesheets/spree/frontend/spree_drop_ship.css +3 -0
  12. data/app/controllers/ckeditor/attachment_files_controller_decorator.rb +20 -0
  13. data/app/controllers/ckeditor/pictures_controller_decorator.rb +17 -0
  14. data/app/controllers/spree/admin/drop_ship_settings_controller.rb +19 -0
  15. data/app/controllers/spree/admin/products_controller_decorator.rb +19 -0
  16. data/app/controllers/spree/admin/shipments_controller.rb +47 -0
  17. data/app/controllers/spree/admin/stock_locations_controller_decorator.rb +14 -0
  18. data/app/controllers/spree/admin/suppliers_controller.rb +32 -0
  19. data/app/controllers/spree/api/v1/stock_locations_controller_decorator.rb +18 -0
  20. data/app/controllers/spree/base_controller_decorator.rb +23 -0
  21. data/app/mailers/spree/drop_ship_order_mailer.rb +13 -0
  22. data/app/mailers/spree/supplier_mailer.rb +12 -0
  23. data/app/models/ckeditor/asset_decorator.rb +5 -0
  24. data/app/models/spree/drop_ship_configuration.rb +17 -0
  25. data/app/models/spree/order_decorator.rb +27 -0
  26. data/app/models/spree/payment_decorator.rb +7 -0
  27. data/app/models/spree/product_decorator.rb +32 -0
  28. data/app/models/spree/shipment_decorator.rb +39 -0
  29. data/app/models/spree/stock/splitter/drop_ship.rb +42 -0
  30. data/app/models/spree/stock_location_decorator.rb +18 -0
  31. data/app/models/spree/supplier.rb +117 -0
  32. data/app/models/spree/supplier_ability.rb +28 -0
  33. data/app/models/spree/supplier_variant.rb +6 -0
  34. data/app/models/spree/user_decorator.rb +11 -0
  35. data/app/models/spree/variant_decorator.rb +24 -0
  36. data/app/models/spree.rb +5 -0
  37. data/app/overrides/spree/admin/products/_form/converted_admin_product_form_right.html.erb.deface +5 -0
  38. data/app/overrides/spree/admin/products/index/override_rows.html.erb.deface +22 -0
  39. data/app/overrides/spree/admin/shared/sub_menu/_configuration/add_drop_ship_settings.html.erb.deface +3 -0
  40. data/app/overrides/spree/admin/stock_locations/_form/add_supplier.html.erb.deface +12 -0
  41. data/app/overrides/spree/admin/stock_movements/_form/fix_bootstrap_form.html.erb.deface +11 -0
  42. data/app/overrides/spree/layouts/admin/add_profile_admin_tabs.html.erb.deface +8 -0
  43. data/app/overrides/spree/layouts/admin/converted_admin_tabs.html.erb.deface +18 -0
  44. data/app/views/spree/admin/drop_ship_settings/edit.html.erb +21 -0
  45. data/app/views/spree/admin/shared/_header.html.erb +24 -0
  46. data/app/views/spree/admin/shipments/edit.html.erb +24 -0
  47. data/app/views/spree/admin/shipments/index.html.erb +95 -0
  48. data/app/views/spree/admin/suppliers/_form.html.erb +69 -0
  49. data/app/views/spree/admin/suppliers/edit.html.erb +22 -0
  50. data/app/views/spree/admin/suppliers/index.html.erb +71 -0
  51. data/app/views/spree/admin/suppliers/new.html.erb +17 -0
  52. data/app/views/spree/drop_ship_order_mailer/supplier_order.html.erb +119 -0
  53. data/app/views/spree/shared/unauthorized.erb +1 -0
  54. data/app/views/spree/supplier_mailer/welcome.html.erb +53 -0
  55. data/config/locales/en.yml +89 -0
  56. data/config/locales/es.yml +133 -0
  57. data/config/routes.rb +9 -0
  58. data/db/migrate/20121006073854_create_suppliers.rb +20 -0
  59. data/db/migrate/20130216070944_product_belongs_to_supplier.rb +6 -0
  60. data/db/migrate/20130405005502_stock_locations_belongs_to_supplier.rb +6 -0
  61. data/db/migrate/20130405011127_user_belongs_to_supplier.rb +6 -0
  62. data/db/migrate/20130428063053_add_balanced_token_to_suppliers.rb +7 -0
  63. data/db/migrate/20130510181443_add_supplier_id_to_ckeditor_assets.rb +8 -0
  64. data/db/migrate/20130606220913_add_permalink_to_suppliers.rb +6 -0
  65. data/db/migrate/20140323170638_add_supplier_commission_to_shipments.rb +5 -0
  66. data/db/migrate/20140416184616_migrate_payment_and_commission.rb +7 -0
  67. data/db/migrate/20140529041325_create_spree_supplier_variants.rb +15 -0
  68. data/lib/generators/spree_drop_ship/install/install_generator.rb +30 -0
  69. data/lib/spree_drop_ship/engine.rb +31 -0
  70. data/lib/spree_drop_ship/factories.rb +93 -0
  71. data/lib/spree_drop_ship.rb +6 -0
  72. data/lib/tasks/spree_sample.rake +72 -0
  73. data/script/rails +7 -0
  74. data/spec/features/admin/orders_spec.rb +12 -0
  75. data/spec/features/admin/products_spec.rb +25 -0
  76. data/spec/features/admin/return_authorizations_spec.rb +7 -0
  77. data/spec/features/admin/settings_spec.rb +33 -0
  78. data/spec/features/admin/shipments_spec.rb +80 -0
  79. data/spec/features/admin/stock_management_spec.rb +153 -0
  80. data/spec/features/admin/stock_spec.rb +98 -0
  81. data/spec/features/admin/suppliers_spec.rb +126 -0
  82. data/spec/models/spree/order_decorator_spec.rb +54 -0
  83. data/spec/models/spree/payment_decorator_spec.rb +7 -0
  84. data/spec/models/spree/product_decorator_spec.rb +13 -0
  85. data/spec/models/spree/shipment_decorator_spec.rb +47 -0
  86. data/spec/models/spree/stock/splitter/drop_ship_spec.rb +62 -0
  87. data/spec/models/spree/stock_location_decorator_spec.rb +33 -0
  88. data/spec/models/spree/supplier_ability_spec.rb +172 -0
  89. data/spec/models/spree/supplier_spec.rb +123 -0
  90. data/spec/models/spree/supplier_variant_spec.rb +5 -0
  91. data/spec/models/spree/user_decorator_spec.rb +17 -0
  92. data/spec/models/spree/variant_decorator_spec.rb +7 -0
  93. data/spec/spec_helper.rb +79 -0
  94. data/spec/support/integration_helpers.rb +15 -0
  95. data/spree_drop_ship.gemspec +42 -0
  96. metadata +411 -0
@@ -0,0 +1,17 @@
1
+ <% content_for :page_actions do %>
2
+ <%= button_link_to Spree.t('back_to_suppliers'), spree.admin_suppliers_path, icon: 'arrow-left' %>
3
+ <% end %>
4
+
5
+ <% content_for :page_title do %>
6
+ <%= Spree.t('new_supplier') %>
7
+ <% end %>
8
+
9
+ <%= render 'spree/shared/error_messages', target: @object%>
10
+
11
+ <%= form_for [:admin, @object] do |f| %>
12
+ <%= render "form", form: f %>
13
+ <%# render 'create' and 'cancel' buttons %>
14
+ <div class="col-md-8">
15
+ <%= render :partial => 'spree/admin/shared/new_resource_links' %>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,119 @@
1
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
2
+ <tbody>
3
+ <tr>
4
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
5
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #e0e0e0">
6
+ <tbody>
7
+ <tr>
8
+ <td valign="top">
9
+ <figure id="logo" data-hook><%= link_to image_tag(Spree::Config[:logo]), spree.root_url %></figure>
10
+ </td>
11
+ </tr>
12
+ <tr>
13
+ <td valign="top">
14
+ <h1 style="font-size:22px;font-weight:normal;line-height:22px;"><%= Spree.t('drop_ship_order_mailer.
15
+ supplier_order.hello', name: @supplier.name ) %></h1>
16
+ <p style="font-size:12px;line-height:16px;margin:0">
17
+ An order has been placed. Please confirm the shipment details, and <%= link_to 'update the shipment', spree.edit_admin_shipment_url(@shipment) %> once it has shipped.
18
+ </p>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <td>
23
+ <h2 style="font-size:18px;font-weight:normal;">Reference Number: <%= @shipment.number %></h2>
24
+ <h4 style="font-size:14px;font-weight:normal;">Placed on: <%= @shipment.created_at.strftime('%A %b %e, %Y at %l:%M%p %Z') %></h4>
25
+ </td>
26
+ </tr>
27
+ <tr>
28
+ <td>
29
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
30
+ <thead>
31
+ <tr>
32
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px;padding:5px 9px 6px 9px;line-height:1em">Shipping Information:</th>
33
+ <th width="10"></th>
34
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px;padding:5px 9px 6px 9px;line-height:1em">Shipping Method:</th>
35
+ </tr>
36
+ </thead>
37
+ <tbody>
38
+ <tr>
39
+ <td valign="top" style="font-size:12px;padding:7px 9px 9px 9px;border-left:1px solid #eaeaea;border-bottom:1px solid #eaeaea;border-right:1px solid #eaeaea">
40
+ <%= @shipment.order.ship_address.firstname %> <%= @shipment.order.ship_address.lastname %><br/>
41
+ <%= @shipment.order.ship_address.address1 %><br/>
42
+ <% unless @shipment.order.ship_address.address2.blank? %><%= @shipment.order.ship_address.address2 %><br/><% end %>
43
+ <%= @shipment.order.ship_address.city %>, <%= @shipment.order.ship_address.state.name %> <%= @shipment.order.ship_address.zipcode %><br/>
44
+ <%= @shipment.order.ship_address.country.name %><br/>
45
+ T: <a href="tel:<%= @shipment.order.ship_address.phone %>" value="<%= @shipment.order.ship_address.phone %>" target="_blank"><%= @shipment.order.ship_address.phone %></a>
46
+ </td>
47
+ <td>&nbsp;</td>
48
+ <td valign="top" style="font-size:12px;padding:7px 9px 9px 9px;border-left:1px solid #eaeaea;border-bottom:1px solid #eaeaea;border-right:1px solid #eaeaea">
49
+ <%= @shipment.shipping_method.name %><br/>
50
+ </td>
51
+ </tr>
52
+ </tbody>
53
+ </table>
54
+ <br>
55
+ <table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #eaeaea">
56
+ <thead>
57
+ <tr>
58
+ <th align="left" bgcolor="#EAEAEA" style="font-size:13px;padding:3px 9px">Item</th>
59
+ <th align="left" bgcolor="#EAEAEA" style="font-size:13px;padding:3px 9px">Sku</th>
60
+ <th align="center" bgcolor="#EAEAEA" style="font-size:13px;padding:3px 9px">Qty</th>
61
+ <th align="right" bgcolor="#EAEAEA" style="font-size:13px;padding:3px 9px">Subtotal</th>
62
+ </tr>
63
+ </thead>
64
+ <tbody bgcolor="#F6F6F6">
65
+ <% @shipment.line_items.each do |line_item| %>
66
+ <tr>
67
+ <td align="left" valign="top" style="font-size:11px;padding:3px 9px;border-bottom:1px dotted #cccccc">
68
+ <strong style="font-size:11px"><%= line_item.variant.name %></strong>
69
+ </td>
70
+ <td align="left" valign="top" style="font-size:11px;padding:3px 9px;border-bottom:1px dotted #cccccc"><%= line_item.variant.sku %></td>
71
+ <td align="center" valign="top" style="font-size:11px;padding:3px 9px;border-bottom:1px dotted #cccccc"><%= line_item.quantity %></td>
72
+ <td align="right" valign="top" style="font-size:11px;padding:3px 9px;border-bottom:1px dotted #cccccc">
73
+ <span><%= line_item.display_amount %></span>
74
+ </td>
75
+ </tr>
76
+ <% end %>
77
+ </tbody>
78
+ <tbody>
79
+ <tr>
80
+ <td colspan="3" align="right" style="padding:3px 9px">
81
+ Subtotal
82
+ </td>
83
+ <td align="right" style="padding:3px 9px">
84
+ <span><%= @shipment.display_item_cost %></span>
85
+ </td>
86
+ </tr>
87
+ <tr>
88
+ <td colspan="3" align="right" style="padding:3px 9px">
89
+ Shipping &amp; Handling
90
+ </td>
91
+ <td align="right" style="padding:3px 9px">
92
+ <span><%= @shipment.display_final_price %></span>
93
+ </td>
94
+ </tr>
95
+ <tr>
96
+ <td colspan="3" align="right" style="padding:3px 9px">
97
+ <strong>Grand Total</strong>
98
+ </td>
99
+ <td align="right" style="padding:3px 9px">
100
+ <strong><span><%= @shipment.display_final_price_with_items %></span></strong>
101
+ </td>
102
+ </tr>
103
+ </tbody>
104
+ </table>
105
+ </td>
106
+ </tr>
107
+ <tr>
108
+ <td bgcolor="#EAEAEA" align="center" style="background:#eaeaea;text-align:center">
109
+ <center>
110
+ <p style="font-size:12px;margin:0"><%= raw Spree.t('drop_ship_order_mailer.supplier_order.thank_you_again', name: Spree::Store.current.name) %></p>
111
+ </center>
112
+ </td>
113
+ </tr>
114
+ </tbody>
115
+ </table>
116
+ </td
117
+ </tr>
118
+ </tbody>
119
+ </table>
@@ -0,0 +1 @@
1
+ <%= Spree.t(:authorization_failure) %>
@@ -0,0 +1,53 @@
1
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
2
+ <tbody>
3
+ <tr>
4
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
5
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #e0e0e0">
6
+ <tbody>
7
+ <tr>
8
+ <td valign="top">
9
+ <h1><%= link_to Spree::Store.current.name, spree.root_url %></h1>
10
+ </td>
11
+ </tr>
12
+ <tr>
13
+ <td valign="top">
14
+ <h1 style="font-size:22px;font-weight:normal;line-height:22px;"><%= Spree.t('supplier_mailer.welcome.hello', name: @supplier.name ) %></h1>
15
+ <p style="font-size:12px;line-height:16px;">
16
+ <%= Spree.t('supplier_mailer.welcome.manage_your_account' ) %>
17
+ <%= link_to Spree.t('supplier_mailer.welcome.logging_into_your_account'), spree.login_url, target: '_blank' %>
18
+ </p>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <td>
23
+ <h2 style="font-size:18px;font-weight:normal;"><%= Spree.t('supplier_mailer.welcome.please_verify_your_information') %></h2>
24
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
25
+ <thead>
26
+ <tr>
27
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px;padding:5px 9px 6px 9px;line-height:1em"><%= Spree.t('supplier_mailer.welcome.supplier_information') %></th>
28
+ </tr>
29
+ </thead>
30
+ <tbody>
31
+ <tr>
32
+ <td valign="top" style="font-size:12px;padding:7px 9px 9px 9px;border-left:1px solid #eaeaea;border-bottom:1px solid #eaeaea;border-right:1px solid #eaeaea">
33
+ <b><%= Spree.t(:name) %>:</b> <%= @supplier.name %><br/>
34
+ <b><%= Spree.t(:email) %>:</b> <%= mail_to @supplier.email %><br/>
35
+ </td>
36
+ </tr>
37
+ </tbody>
38
+ </table>
39
+ </td>
40
+ </tr>
41
+ <tr>
42
+ <td bgcolor="#EAEAEA" align="center" style="background:#eaeaea;text-align:center">
43
+ <center>
44
+ <p style="font-size:12px;margin:0"><%= raw Spree.t('supplier_mailer.welcome.thank_you_again', name: Spree::Store.current.name) %></p>
45
+ </center>
46
+ </td>
47
+ </tr>
48
+ </tbody>
49
+ </table>
50
+ </td>
51
+ </tr>
52
+ </tbody>
53
+ </table>
@@ -0,0 +1,89 @@
1
+ en:
2
+ activerecord:
3
+ attributes:
4
+ spree/supplier:
5
+ commission_flat_rate: Commission Flat Rate
6
+ commission_percentage: Commission Percentage
7
+ name: Name
8
+ tax_id: TAX ID
9
+ url: URL
10
+ errors:
11
+ models:
12
+ spree/supplier:
13
+ attributes:
14
+ url:
15
+ invalid: is invalid. Please be sure to include include 'http://'
16
+ not_responding: 'is invalid, not responding or redirecting to another location'
17
+ spree:
18
+ admin:
19
+ drop_ship_settings:
20
+ update:
21
+ success: Drop ship settings successfully updated.
22
+ orders:
23
+ edit:
24
+ approve_drop_ship_orders: Approve Drop Ship Orders
25
+ resend_drop_ship_orders: Resend Drop Ship Orders
26
+ drop_ship_order_approval_confirmation: This will send an email notification to each supplier. Continue?
27
+ show:
28
+ approve_drop_ship_orders: Approve Drop Ship Orders
29
+ resend_drop_ship_orders: Resend Drop Ship Orders
30
+ drop_ship_order_approval_confirmation: This will send an email notification to each supplier. Continue?
31
+ back_to_orders_list: Back To Orders List
32
+ back_to_suppliers: Back To Suppliers
33
+ business: Business
34
+ cancel: Cancel
35
+ company_info: Company Info
36
+ confirm_order: Confirm Order
37
+ contact_address: Contact Address
38
+ drop_ship: Drop Ship
39
+ drop_ship_order_mailer:
40
+ supplier_order:
41
+ hello: "Hello %{name},"
42
+ subject: "%{name} Drop Shipment #%{number}"
43
+ thank_you_again: "Thank you again for your business, <b>%{name}</b>"
44
+ drop_ship_order_number: "Drop Ship Order #%{number}"
45
+ drop_ship_orders: Drop Ship Orders
46
+ drop_ship_settings: Drop Ship Settings
47
+ editing_supplier: Editing Supplier
48
+ individual: Individual
49
+ listing_suppliers: Listing Suppliers
50
+ manage: Manage
51
+ must_be_logged_in: 'Must Be Logged In'
52
+ name: Name
53
+ new_supplier: New Supplier
54
+ or: or
55
+ order_state:
56
+ active: Active
57
+ completed: Completed
58
+ confirmed: Confirmed
59
+ delivered: Delivered
60
+ resend_order_to_supplier: Resend Order To Supplier
61
+ save: Save
62
+ search: Search
63
+ send_order_to_supplier: Send Order To Supplier
64
+ shared:
65
+ unauthorized:
66
+ explained: You are not authorized to access this page.
67
+ unauthorized: Unauthorized
68
+ show_only_incomplete_orders: Show Only Incomplete Orders
69
+ signup: Sign Up
70
+ signup_to_become_a_supplier: 'Sign Up To Become A Supplier'
71
+ supplier: Supplier
72
+ supplier_details: Supplier Details
73
+ supplier_info: Supplier Info
74
+ supplier_information: Supplier Information
75
+ supplier_mailer:
76
+ welcome:
77
+ hello: "Hello %{name},"
78
+ logging_into_your_account: logging into your account.
79
+ manage_your_account: You may now manage your profile and inventory by
80
+ subject: 'Thank you for signing up. Please verify your information.'
81
+ thank_you_again: "Thank you again for your business, <b>%{name}</b>"
82
+ thank_you_for_signing_up: Thank you for signing up to be a drop ship supplier.
83
+ supplier_registration:
84
+ already_signed_up: "You've already signed up to become a supplier."
85
+ create:
86
+ invalid_password: Invalid password please sign in or sign up.
87
+ success: Thank you for signing up!
88
+ supplier_signup: Supplier Sign Up
89
+ suppliers: Suppliers
@@ -0,0 +1,133 @@
1
+ es:
2
+ activerecord:
3
+ attributes:
4
+ spree/supplier:
5
+ commission_flat_rate: Tarifa fija de comisión
6
+ commission_percentage: Porcentaje de comisión
7
+ name: Nombre
8
+ tax_id: TAX ID
9
+ url: URL
10
+ address1: Dirección
11
+ address2: Dirección (continuación)
12
+ city: Ciudad
13
+ commission: Comisión
14
+ country: País
15
+ email: Email
16
+ state: Estado
17
+ active: Activo
18
+ url: URL
19
+ zipcode: Código Postal(ZipCode)
20
+ supplier_info: Información de proveedor
21
+ supplier_signup: Registro de proveedor
22
+ suppliers: Proveedores
23
+ spree/shipment:
24
+ created_at: Creado
25
+ number: Número
26
+ state: Estatus
27
+ item_cost: Costo ítem
28
+ cost: Costo
29
+ total_tax: Total impuesto
30
+ final_price: Precio final
31
+ supplier_commission: Comisión Proveedor
32
+ errors:
33
+ models:
34
+ spree/supplier:
35
+ attributes:
36
+ url:
37
+ invalid: es inválido. Por favor asegúrece que 'http://' esté incluido
38
+ not_responding: 'es inválido, no responde o ha redireccionado a otra url'
39
+ drop_ship_order_number: "Drop Ship Orden #%{number}"
40
+ drop_ship_orders: Drop Ship Ordenes
41
+ drop_ship_settings: Drop Ship Configuración
42
+ must_be_logged_in: 'Debe Estar Autenticado'
43
+ signup: Registro
44
+ signup_to_become_a_supplier: 'Autentíquese para ser un Proveedor'
45
+ spree:
46
+ admin:
47
+ drop_ship_settings:
48
+ update:
49
+ success: Configuración Drop ship actualizada correctamente
50
+ orders:
51
+ drop_ship_order_order_header:
52
+ drop_ship_order_ids: DSO IDs
53
+ edit:
54
+ approve_drop_ship_orders: Ordenes aprobadas por el proveedor
55
+ resend_drop_ship_orders: Reenviar ordenes al proveedor
56
+ drop_ship_order_approval_confirmation: Se le enviará una notificación por correo electrónico a cada proveedor. ¿Desea continuar?
57
+ show:
58
+ approve_drop_ship_orders: Ordene aprobadas por el proveedor
59
+ resend_drop_ship_orders: Reenviar ordenes al proveedor
60
+ drop_ship_order_approval_confirmation: Se le enviará una notificación por correo electrónico a cada proveedor. ¿Desea continuar?
61
+ suppliers:
62
+ edit:
63
+ back_to_suppliers: Regresar a los proveedores
64
+ new:
65
+ new_supplier: Nuevo Proveedor
66
+ form:
67
+ supplier_details: Detalles del Proveedor
68
+ supplier_address: Dirección del Proveedor
69
+ drop_ship_orders:
70
+ deliver:
71
+ error: "La orden %{number} no pudo ser enviada al proveedor."
72
+ success: "La orden %{number} fue enviada al proveedor."
73
+ orders_sent: Todas las ordenes fueron enviadas a los proveedores
74
+ orders_not_sent: Algunas o todas las ordenes no pudieron ser enviadas. Por favor contacte directamente al proveedor.
75
+ back_to_orders_list: Regresar a las ordenes
76
+ back_to_suppliers: Regresar a los proveedores
77
+ business: Negocio
78
+ cancel: Cancelar
79
+ company_info: Informacion de la compañia
80
+ confirm_order: Confirmar Orden
81
+ contact_address: Dirección de contacto
82
+ drop_ship: Drop Ship
83
+ editing_supplier: Editar proveedor
84
+ default_commission_flat_rate: Comision por defecto
85
+ default_commission_percentage: Porcentaje de comision por defecto
86
+ automatically_deliver_orders_to_supplier: Enviar orden automaticamente a los proveedores
87
+ send_supplier_email: Enviar correo al proveedor
88
+ individual: Individual
89
+ listing_suppliers: Lista de proveedores
90
+ manage: Gestionar
91
+ name: Nombre
92
+ or: ó
93
+ suppliers: Proveedores
94
+ listing_shipments: 'Lista de envíos'
95
+ order_state:
96
+ active: Activo
97
+ completed: Completado
98
+ confirmed: Confirmado
99
+ delivered: Entregado
100
+ resend_order_to_supplier: Reenviar orden al proveedor.
101
+ save: Guardar
102
+ search: Buscar
103
+ send_order_to_supplier: Enviar orden al proveedor.
104
+ show_only_incomplete_orders: Solo mostrar ordenes incompletas
105
+ supplier: Proveedor
106
+ supplier_information: Información del proveedor
107
+ drop_ship_order_mailer:
108
+ supplier_order:
109
+ hello: "Hola %{name},"
110
+ subject: "%{name} Orden al proveedor #%{number}"
111
+ thank_you_again: "Gracias nuevamente por su negocio, <b>%{name}</b>"
112
+ shared:
113
+ unauthorized:
114
+ explained: Usted no está autorizado a acceder a esta página.
115
+ unauthorized: No autorizado
116
+ supplier_mailer:
117
+ welcome:
118
+ hello: "Hola %{name},"
119
+ check_your_status: Puede revisar el estado de su pedido por
120
+ logging_into_your_account: Autentíquese.
121
+ once_your_request_is_approved: Una vez que su pedido sea aprobado podrá gestionar su inventario.
122
+ subject: 'Gracias por autenticarse. Por favor verifique la información.'
123
+ thank_you_again: "Gracias nuevamente por su negocio, <b>%{name}</b>"
124
+ thank_you_for_signing_up: Gracias por autenticarse para ser un proveedor.
125
+ suppliers:
126
+ already_signed_up: "Ya está autenticado para convertirse en un proveedor."
127
+ create:
128
+ success: Gracias por autenticarse!
129
+ supplier_registration:
130
+ already_signed_up: "Ya inicio sesión como proveedor."
131
+ create:
132
+ invalid_password: Clave incorrecta por favor inicie sesion.
133
+ success: Gracias por registrarse!
data/config/routes.rb ADDED
@@ -0,0 +1,9 @@
1
+ Spree::Core::Engine.add_routes do
2
+
3
+ namespace :admin do
4
+ resource :drop_ship_settings
5
+ resources :shipments
6
+ resources :suppliers
7
+ end
8
+
9
+ end
@@ -0,0 +1,20 @@
1
+ class CreateSuppliers < ActiveRecord::Migration
2
+
3
+ def change
4
+ create_table :spree_suppliers do |t|
5
+ t.boolean :active, default: false, null: false
6
+ t.references :address
7
+ t.decimal :commission_flat_rate, :precision => 8, :scale => 2, :default => 0.0, :null => false
8
+ t.float :commission_percentage, default: 0.0, null: false
9
+ t.string :email
10
+ t.string :name
11
+ t.string :url
12
+ t.datetime :deleted_at
13
+ t.timestamps
14
+ end
15
+ add_index :spree_suppliers, :address_id
16
+ add_index :spree_suppliers, :deleted_at
17
+ add_index :spree_suppliers, :active
18
+ end
19
+
20
+ end
@@ -0,0 +1,6 @@
1
+ class ProductBelongsToSupplier < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_products, :supplier_id, :integer
4
+ add_index :spree_products, :supplier_id
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ class StockLocationsBelongsToSupplier < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_stock_locations, :supplier_id, :integer
4
+ add_index :spree_stock_locations, :supplier_id
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ class UserBelongsToSupplier < ActiveRecord::Migration
2
+ def change
3
+ add_column Spree.user_class.table_name, :supplier_id, :integer
4
+ add_index Spree.user_class.table_name, :supplier_id
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ class AddBalancedTokenToSuppliers < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_suppliers, :tax_id, :string
4
+ add_column :spree_suppliers, :token, :string
5
+ add_index :spree_suppliers, :token
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ class AddSupplierIdToCkeditorAssets < ActiveRecord::Migration
2
+ if table_exists?(:ckeditor_assets)
3
+ def change
4
+ add_column :ckeditor_assets, :supplier_id, :integer
5
+ add_index :ckeditor_assets, :supplier_id
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ class AddPermalinkToSuppliers < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_suppliers, :slug, :string
4
+ add_index :spree_suppliers, :slug, unique: true
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddSupplierCommissionToShipments < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_shipments, :supplier_commission, :decimal, precision: 8, scale: 2, default: 0.0, null: false
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ class MigratePaymentAndCommission < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_payments, :payable_id, :integer
4
+ add_column :spree_payments, :payable_type, :string
5
+ add_index :spree_payments, [:payable_id, :payable_type]
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ class CreateSpreeSupplierVariants < ActiveRecord::Migration
2
+ def change
3
+ create_table :spree_supplier_variants do |t|
4
+ t.belongs_to :supplier, index: true
5
+ t.belongs_to :variant, index: true
6
+ t.decimal :cost
7
+
8
+ t.timestamps
9
+ end
10
+ Spree::Product.where.not(supplier_id: nil).each do |product|
11
+ product.add_supplier! product.supplier_id
12
+ end
13
+ remove_column :spree_products, :supplier_id
14
+ end
15
+ end
@@ -0,0 +1,30 @@
1
+ module SpreeDropShip
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ class_option :auto_run_migrations, :type => :boolean, :default => false
5
+
6
+ def add_javascripts
7
+ # append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/spree_drop_ship\n"
8
+ append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/spree_drop_ship\n"
9
+ end
10
+
11
+ def add_stylesheets
12
+ # inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/spree_drop_ship\n", :before => /\*\//, :verbose => true
13
+ inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/spree_drop_ship\n", :before => /\*\//, :verbose => true
14
+ end
15
+
16
+ def add_migrations
17
+ run 'bundle exec rake railties:install:migrations FROM=spree_drop_ship'
18
+ end
19
+
20
+ def run_migrations
21
+ run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask 'Would you like to run the migrations now? [Y/n]')
22
+ if run_migrations
23
+ run 'bundle exec rake db:migrate'
24
+ else
25
+ puts 'Skipping rake db:migrate, don\'t forget to run it!'
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ module SpreeDropShip
2
+ class Engine < Rails::Engine
3
+ require 'spree/core'
4
+ isolate_namespace Spree
5
+ engine_name 'spree_drop_ship'
6
+
7
+ config.autoload_paths += %W(#{config.root}/lib)
8
+
9
+ # use rspec for tests
10
+ config.generators do |g|
11
+ g.test_framework :rspec
12
+ end
13
+
14
+ initializer 'spree_drop_ship.custom_splitters', after: 'spree.register.stock_splitters' do |app|
15
+ app.config.spree.stock_splitters << Spree::Stock::Splitter::DropShip
16
+ end
17
+
18
+ initializer "spree_drop_ship.preferences", before: :load_config_initializers do |app|
19
+ SpreeDropShip::Config = Spree::DropShipConfiguration.new
20
+ end
21
+
22
+ def self.activate
23
+ Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
24
+ Rails.configuration.cache_classes ? require(c) : load(c)
25
+ end
26
+ Spree::Ability.register_ability(Spree::SupplierAbility)
27
+ end
28
+
29
+ config.to_prepare &method(:activate).to_proc
30
+ end
31
+ end