opensteam 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. data/CHANGELOG +53 -0
  2. data/README.rdoc +19 -10
  3. data/generators/opensteam/opensteam_generator.rb +27 -3
  4. data/generators/opensteam/templates/app/controllers/admin/configurations_controller.rb +85 -0
  5. data/generators/opensteam/templates/app/controllers/admin/inventories_controller.rb +1 -1
  6. data/generators/opensteam/templates/app/controllers/admin/invoices_controller.rb +35 -4
  7. data/generators/opensteam/templates/app/controllers/admin/orders_controller.rb +5 -4
  8. data/generators/opensteam/templates/app/controllers/admin/shipments_controller.rb +6 -3
  9. data/generators/opensteam/templates/app/controllers/admin/shipping_rate_groups_controller.rb +76 -0
  10. data/generators/opensteam/templates/app/controllers/admin/tax_groups_controller.rb +124 -0
  11. data/generators/opensteam/templates/app/controllers/admin/tax_rules_controller.rb +19 -0
  12. data/generators/opensteam/templates/app/controllers/admin/tax_zones_controller.rb +118 -0
  13. data/generators/opensteam/templates/app/controllers/admin/users_controller.rb +1 -1
  14. data/generators/opensteam/templates/app/controllers/admin_controller.rb +20 -0
  15. data/generators/opensteam/templates/app/controllers/carts_controller.rb +118 -0
  16. data/generators/opensteam/templates/app/controllers/checkout_controller.rb +119 -79
  17. data/generators/opensteam/templates/app/controllers/profile_controller.rb +2 -4
  18. data/generators/opensteam/templates/app/controllers/searches_controller.rb +1 -1
  19. data/generators/opensteam/templates/app/controllers/user_sessions_controller.rb +2 -1
  20. data/generators/opensteam/templates/app/controllers/users_controller.rb +10 -3
  21. data/generators/opensteam/templates/app/helpers/admin_helper.rb +15 -1
  22. data/generators/opensteam/templates/app/helpers/checkout_helper.rb +38 -0
  23. data/generators/opensteam/templates/app/helpers/webshop_helper.rb +6 -1
  24. data/generators/opensteam/templates/app/models/zone.rb +18 -0
  25. data/generators/opensteam/templates/app/views/admin/_menu.html.erb +18 -0
  26. data/generators/opensteam/templates/app/views/admin/catalog.html.erb +2 -3
  27. data/generators/opensteam/templates/app/views/admin/configurations/edit.html.erb +20 -0
  28. data/generators/opensteam/templates/app/views/admin/configurations/index.html.erb +22 -0
  29. data/generators/opensteam/templates/app/views/admin/configurations/new.html.erb +19 -0
  30. data/generators/opensteam/templates/app/views/admin/configurations/show.html.erb +13 -0
  31. data/generators/opensteam/templates/app/views/admin/filters/_filter.html.erb +1 -1
  32. data/generators/opensteam/templates/app/views/admin/index.html.erb +0 -19
  33. data/generators/opensteam/templates/app/views/admin/inventories/edit.html.erb +10 -6
  34. data/generators/opensteam/templates/app/views/admin/inventories/new.html.erb +5 -0
  35. data/generators/opensteam/templates/app/views/admin/inventories/show.html.erb +10 -6
  36. data/generators/opensteam/templates/app/views/admin/invoices/_invoice.html.erb +1 -0
  37. data/generators/opensteam/templates/app/views/admin/invoices/_invoice_fields.html.erb +52 -0
  38. data/generators/opensteam/templates/app/views/admin/invoices/new.html.erb +9 -37
  39. data/generators/opensteam/templates/app/views/admin/invoices/show.html.erb +10 -36
  40. data/generators/opensteam/templates/app/views/admin/invoices/show.pdf.prawn +59 -0
  41. data/generators/opensteam/templates/app/views/admin/order_config.html.erb +5 -0
  42. data/generators/opensteam/templates/app/views/admin/order_items/_item_entry.html.erb +9 -0
  43. data/generators/opensteam/templates/app/views/admin/order_items/_items_table.html.erb +16 -0
  44. data/generators/opensteam/templates/app/views/admin/orders/_order.html.erb +9 -9
  45. data/generators/opensteam/templates/app/views/admin/orders/_orders.html.erb +1 -1
  46. data/generators/opensteam/templates/app/views/admin/orders/show.html.erb +25 -9
  47. data/generators/opensteam/templates/app/views/admin/payment_types.html.erb +27 -0
  48. data/generators/opensteam/templates/app/views/admin/payments/_credit_card_payment.html.erb +26 -0
  49. data/generators/opensteam/templates/app/views/admin/payments/_credit_card_payment_info.html.erb +15 -0
  50. data/generators/opensteam/templates/app/views/admin/payments/_direct_debit_payment.html.erb +5 -0
  51. data/generators/opensteam/templates/app/views/admin/shipments/new.html.erb +45 -30
  52. data/generators/opensteam/templates/app/views/admin/shipments/show.html.erb +3 -3
  53. data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/_payment_addition.html.erb +12 -0
  54. data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/_rate.html.erb +16 -0
  55. data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/edit.html.erb +63 -0
  56. data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/index.html.erb +28 -0
  57. data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/new.html.erb +60 -0
  58. data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/show.html.erb +13 -0
  59. data/generators/opensteam/templates/app/views/admin/system.html.erb +5 -0
  60. data/generators/opensteam/templates/app/views/admin/tax_groups/_attributes.html.erb +11 -0
  61. data/generators/opensteam/templates/app/views/admin/tax_groups/_tax_groups.html.erb +17 -0
  62. data/generators/opensteam/templates/app/views/admin/tax_groups/_tax_groups_row.html.erb +12 -0
  63. data/generators/opensteam/templates/app/views/admin/tax_groups/_tax_rule.html.erb +14 -0
  64. data/generators/opensteam/templates/app/views/admin/tax_groups/edit.html.erb +26 -0
  65. data/generators/opensteam/templates/app/views/admin/tax_groups/index.html.erb +8 -0
  66. data/generators/opensteam/templates/app/views/admin/tax_groups/new.html.erb +27 -0
  67. data/generators/opensteam/templates/app/views/admin/tax_groups/show.html.erb +28 -0
  68. data/generators/opensteam/templates/app/views/admin/tax_zones/_attributes.html.erb +18 -0
  69. data/generators/opensteam/templates/app/views/admin/tax_zones/_tax_zone_row.html.erb +13 -0
  70. data/generators/opensteam/templates/app/views/admin/tax_zones/_tax_zones.html.erb +11 -0
  71. data/generators/opensteam/templates/app/views/admin/tax_zones/edit.html.erb +16 -0
  72. data/generators/opensteam/templates/app/views/admin/tax_zones/index.html.erb +16 -0
  73. data/generators/opensteam/templates/app/views/admin/tax_zones/new.html.erb +14 -0
  74. data/generators/opensteam/templates/app/views/admin/tax_zones/show.html.erb +15 -0
  75. data/generators/opensteam/templates/app/views/admin/users.html.erb +0 -1
  76. data/generators/opensteam/templates/app/views/admin/users/show.html.erb +10 -0
  77. data/generators/opensteam/templates/app/views/administration_mailer/order_customer.erb +1 -1
  78. data/generators/opensteam/templates/app/views/carts/_cart.html.erb +7 -0
  79. data/generators/opensteam/templates/app/views/carts/_cart_content.html.erb +45 -0
  80. data/generators/opensteam/templates/app/views/carts/create.rjs +3 -0
  81. data/generators/opensteam/templates/app/views/{cart → carts}/index.html.erb +0 -0
  82. data/generators/opensteam/templates/app/views/carts/update.rjs +11 -0
  83. data/generators/opensteam/templates/app/views/checkout/_address.html.erb +42 -0
  84. data/generators/opensteam/templates/app/views/checkout/_customer.html.erb +31 -0
  85. data/generators/opensteam/templates/app/views/checkout/_edit_checkout.html.erb +42 -0
  86. data/generators/opensteam/templates/app/views/checkout/_new_checkout.html.erb +44 -0
  87. data/generators/opensteam/templates/app/views/checkout/_shipping_buttons.html.erb +8 -0
  88. data/generators/opensteam/templates/app/views/checkout/edit.html.erb +7 -0
  89. data/generators/opensteam/templates/app/views/checkout/new.html.erb +11 -0
  90. data/generators/opensteam/templates/app/views/checkout/outro.html.erb +1 -4
  91. data/generators/opensteam/templates/app/views/checkout/show.html.erb +63 -0
  92. data/generators/opensteam/templates/app/views/common/_header_admin.html.erb +5 -0
  93. data/generators/opensteam/templates/app/views/layouts/admin.html.erb +28 -12
  94. data/generators/opensteam/templates/app/views/layouts/profile.html.erb +2 -2
  95. data/generators/opensteam/templates/app/views/layouts/webshop.html.erb +5 -4
  96. data/generators/opensteam/templates/app/views/payment/_advance_payment_payment.html.erb +1 -0
  97. data/generators/opensteam/templates/app/views/payment/_credit_card_payment.html.erb +37 -0
  98. data/generators/opensteam/templates/app/views/payment/_credit_card_payment_confirmation.html.erb +20 -0
  99. data/generators/opensteam/templates/app/views/payment/_direct_debit_payment.html.erb +5 -0
  100. data/generators/opensteam/templates/app/views/payment/_direct_debit_payment_confirmation.html.erb +5 -0
  101. data/generators/opensteam/templates/app/views/profile/index.html.erb +1 -1
  102. data/generators/opensteam/templates/app/views/profile/infos/edit.html.erb +20 -12
  103. data/generators/opensteam/templates/app/views/profile/infos/edit_password.html.erb +16 -12
  104. data/generators/opensteam/templates/app/views/profile/orders/_order.html.erb +1 -1
  105. data/generators/opensteam/templates/app/views/profile/orders/show.html.erb +10 -7
  106. data/generators/opensteam/templates/app/views/webshop/_inventory_content.html.erb +1 -0
  107. data/generators/opensteam/templates/app/views/webshop/show.html.erb +3 -1
  108. data/generators/opensteam/templates/config/initializers/init_states.rb +13 -24
  109. data/generators/opensteam/templates/config/initializers/opensteam.rb +41 -0
  110. data/generators/opensteam/templates/config/initializers/opensteam_model_tables.rb +49 -10
  111. data/generators/opensteam/templates/config/initializers/opensteam_security.rb +8 -0
  112. data/generators/opensteam/templates/config/initializers/payment_process.rb +37 -0
  113. data/generators/opensteam/templates/db/migrate/20080609095723_create_addresses.rb +8 -2
  114. data/generators/opensteam/templates/db/migrate/20080609095726_create_inventories.rb +6 -3
  115. data/generators/opensteam/templates/db/migrate/20080609095728_create_order_items.rb +12 -1
  116. data/generators/opensteam/templates/db/migrate/20080609095729_create_orders.rb +8 -12
  117. data/generators/opensteam/templates/db/migrate/20080609095730_create_payment_types.rb +2 -0
  118. data/generators/opensteam/templates/db/migrate/20080714131513_create_invoices.rb +2 -1
  119. data/generators/opensteam/templates/db/migrate/20080714131650_create_shipments.rb +3 -1
  120. data/generators/opensteam/templates/db/migrate/20080808075247_create_containers.rb +30 -0
  121. data/generators/opensteam/templates/db/migrate/20080808083011_create_container_items.rb +25 -0
  122. data/generators/opensteam/templates/db/migrate/20080812102727_create_tax_zones.rb +16 -0
  123. data/generators/opensteam/templates/db/migrate/20080812102858_create_tax_rules.rb +15 -0
  124. data/generators/opensteam/templates/db/migrate/20080812102956_create_tax_groups.rb +14 -0
  125. data/generators/opensteam/templates/db/migrate/20080831181436_create_configurations.rb +15 -0
  126. data/generators/opensteam/templates/db/migrate/20080903131506_create_payments.rb +22 -0
  127. data/generators/opensteam/templates/db/migrate/20080904133625_create_payment_transactions.rb +24 -0
  128. data/generators/opensteam/templates/db/migrate/20080916102341_create_zones.rb +19 -0
  129. data/generators/opensteam/templates/db/migrate/20080916134340_create_region_shipping_rates.rb +18 -0
  130. data/generators/opensteam/templates/db/migrate/20080916134523_create_shipping_rate_groups.rb +18 -0
  131. data/generators/opensteam/templates/db/migrate/20080916135226_create_shipping_payment_additions.rb +20 -0
  132. data/generators/opensteam/templates/db/migrate/20080916135228_init_opensteam_config.rb +60 -0
  133. data/generators/opensteam/templates/public/images/opensteam_black.jpg +0 -0
  134. data/generators/opensteam/templates/public/images/pdf.png +0 -0
  135. data/generators/opensteam/templates/public/images/shader.png +0 -0
  136. data/generators/opensteam/templates/public/index.html +1 -0
  137. data/generators/opensteam/templates/public/javascripts/opensteam.js +21 -21
  138. data/generators/opensteam/templates/public/stylesheets/opensteam_admin.css +291 -0
  139. data/generators/opensteam/templates/public/stylesheets/opensteam_white.css +47 -11
  140. data/generators/opensteam/templates/tasks/opensteam.rake +2 -12
  141. data/generators/opensteam/templates/test/fixtures/addresses.yml +26 -0
  142. data/generators/opensteam/templates/test/fixtures/configurations.yml +29 -0
  143. data/generators/opensteam/templates/test/fixtures/inventories.yml +32 -15
  144. data/generators/opensteam/templates/test/fixtures/profiles.yml +21 -0
  145. data/generators/opensteam/templates/test/fixtures/region_shipping_rates.yml +33 -0
  146. data/generators/opensteam/templates/test/fixtures/shipping_payment_additions.yml +91 -0
  147. data/generators/opensteam/templates/test/fixtures/shipping_rate_groups.yml +25 -0
  148. data/generators/opensteam/templates/test/fixtures/tax_groups.yml +13 -0
  149. data/generators/opensteam/templates/test/fixtures/tax_rules.yml +29 -0
  150. data/generators/opensteam/templates/test/fixtures/tax_zones.yml +33 -0
  151. data/generators/opensteam/templates/test/fixtures/users.yml +26 -0
  152. data/generators/opensteam/templates/test/fixtures/zones.yml +2707 -0
  153. data/generators/opensteam/templates/test/functional/carts_controller_test.rb +103 -0
  154. data/generators/opensteam/templates/test/test_helper.rb +38 -0
  155. data/generators/opensteam/templates/test/unit/container_test.rb +71 -0
  156. data/generators/opensteam/templates/test/unit/order_test.rb +93 -0
  157. data/generators/opensteam/templates/test/unit/payment_test.rb +220 -0
  158. data/generators/opensteam/templates/test/unit/product_test.rb +158 -0
  159. data/generators/opensteam/templates/vendor/plugins/prawnto/.gitignore +3 -0
  160. data/generators/opensteam/templates/vendor/plugins/prawnto/MIT-LICENSE +20 -0
  161. data/generators/opensteam/templates/vendor/plugins/prawnto/README +12 -0
  162. data/generators/opensteam/templates/vendor/plugins/prawnto/Rakefile +22 -0
  163. data/generators/opensteam/templates/vendor/plugins/prawnto/init.rb +6 -0
  164. data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto.rb +13 -0
  165. data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto/action_controller.rb +47 -0
  166. data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto/template_handler/base.rb +75 -0
  167. data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto/template_handler/raw.rb +54 -0
  168. data/generators/opensteam/templates/vendor/plugins/prawnto/tasks/prawnto_tasks.rake +4 -0
  169. data/generators/opensteam/templates/vendor/plugins/prawnto/test/action_controller_test.rb +36 -0
  170. data/generators/opensteam/templates/vendor/plugins/prawnto/test/base_template_handler_test.rb +58 -0
  171. data/generators/opensteam/templates/vendor/plugins/prawnto/test/raw_template_handler_test.rb +163 -0
  172. data/generators/opensteam/templates/vendor/plugins/prawnto/test/template_handler_test_mocks.rb +83 -0
  173. data/generators/opensteam_product/templates/views/admin/_attributes.html.erb +8 -3
  174. data/generators/opensteam_product/templates/views/admin/_inventories.html.erb +2 -0
  175. data/lib/opensteam.rb +0 -1
  176. data/lib/opensteam/base.rb +2 -1
  177. data/lib/opensteam/checkout.rb +3 -12
  178. data/lib/opensteam/config.rb +50 -2
  179. data/lib/opensteam/container.rb +196 -0
  180. data/lib/opensteam/extension_base.rb +19 -1
  181. data/lib/opensteam/finder.rb +1 -1
  182. data/lib/opensteam/helpers/config_table_helper.rb +18 -6
  183. data/lib/opensteam/initializer.rb +24 -4
  184. data/lib/opensteam/inventory_base.rb +6 -1
  185. data/lib/opensteam/invoice_base.rb +12 -13
  186. data/lib/opensteam/money.rb +230 -0
  187. data/lib/opensteam/order_base.rb +122 -48
  188. data/lib/opensteam/payment.rb +225 -0
  189. data/lib/opensteam/payment/advance_payment.rb +34 -0
  190. data/lib/opensteam/payment/credit_card_payment.rb +217 -0
  191. data/lib/opensteam/payment/direct_debit_payment.rb +53 -0
  192. data/lib/opensteam/product_base.rb +48 -12
  193. data/lib/opensteam/security.rb +54 -0
  194. data/lib/opensteam/shipment_base.rb +214 -6
  195. data/lib/opensteam/shopping_cart.rb +20 -300
  196. data/lib/opensteam/state_logic.rb +5 -3
  197. data/lib/opensteam/state_machine.rb +8 -3
  198. data/lib/opensteam/user_base.rb +48 -6
  199. data/lib/opensteam/version.rb +1 -1
  200. metadata +122 -16
  201. data/generators/opensteam/templates/app/controllers/cart_controller.rb +0 -94
  202. data/generators/opensteam/templates/app/views/admin/orders/_event.html.erb +0 -5
  203. data/generators/opensteam/templates/app/views/admin/orders/_order_item.html.erb +0 -10
  204. data/generators/opensteam/templates/app/views/cart/_cart.html.erb +0 -8
  205. data/generators/opensteam/templates/app/views/cart/_cart_content.html.erb +0 -20
  206. data/generators/opensteam/templates/app/views/cart/update.rjs +0 -1
  207. data/generators/opensteam/templates/app/views/checkout/payment.html.erb +0 -8
  208. data/generators/opensteam/templates/app/views/checkout/shipping.html.erb +0 -45
  209. data/generators/opensteam/templates/app/views/checkout/show_cart.html.erb +0 -13
  210. data/generators/opensteam/templates/app/views/checkout/update_cart_content.rjs +0 -2
  211. data/generators/opensteam/templates/app/views/profile/orders/_order_item.html.erb +0 -10
  212. data/generators/opensteam/templates/db/migrate/20080609095725_create_dummy_users.rb +0 -21
  213. data/lib/opensteam/cart_base.rb +0 -227
@@ -11,44 +11,16 @@
11
11
  <%= error_messages_for :invoice %>
12
12
  <%= error_messages_for :address %>
13
13
 
14
+ <% form_for :invoice, @invoice, :url => { :action => 'create', :controller => 'invoices' },
15
+ :html => { :id => "new_invoice", :method => 'post' } do |f| %>
16
+ <%= f.hidden_field :order_id %>
14
17
 
15
-
16
- <% form_for :invoice, @nivoice, :url => { :action => 'create', :controller => 'invoices' }, :html => { :method => 'post' } do |f| %>
17
-
18
- <% fields_for :address, @invoice.address do |a| %>
19
- <p>Street<br />
20
- <%= a.text_field :street %>
21
- </p>
22
- <p>Postal<br />
23
- <%= a.text_field :postal %>
24
- </p>
25
- <p>City<br />
26
- <%= a.text_field :city %>
27
- </p>
28
- <p>Land<br />
29
- <%= a.text_field :land %>
30
- </p>
31
- <% end %>
32
-
33
- <p>Comment<br />
34
- <%= f.text_area :comment, :rows => 5%>
35
- </p>
36
- <p>Price<br />
37
- <%= f.text_field :price, :rows => 5%>
38
- </p>
39
- <% fields_for :order_items, nil do |a| %>
40
- <p>Select Order Items
41
- <ul>
42
- <% for oi in @order.order_items.select { |s| s.invoice == nil } %>
43
- <li> <%= a.check_box "#{oi.id}", {} , 1, 0 %> <%=h oi.inventory.product.name %> (<%=h oi.inventory.product.class %>)
44
- | <%- unless oi.inventory.properties.empty? -%><b>Configuration:</b> <%=h oi.inventory.properties.collect(&:name) * "," %><%- end -%>
45
- | <%=h oi.quantity %> | <%=h oi.quantity * oi.inventory.price %></li>
46
- <% end %>
47
- </ul>
48
- </p>
49
- <% end %>
50
-
51
-
18
+ <%= render :partial => "admin/invoices/invoice_fields", :object => f %>
52
19
 
53
20
  <%= submit_tag "save" %>
54
21
  <% end %>
22
+
23
+
24
+ <%= observe_form :new_invoice,
25
+ :url => { :action => :update_price }
26
+ %>
@@ -6,50 +6,24 @@
6
6
  <% end %>
7
7
  <% end %>
8
8
 
9
- <h2>Shipment # <%= @invoice.id %></h2>
9
+ <h2>Invoice # <%= @invoice.id %></h2>
10
10
  <div id="invoice_information">
11
-
12
- <p>
13
- <b>State</b>:
14
- <%- form_for :invoice, @invoice, :url => { :action => 'update', :controller => 'invoices' }, :html => { :method => 'put' } do |f| -%>
15
- <%= f.select :state, Invoice.available_states.collect(&:name).collect(&:to_s) %>
16
- <%= submit_tag "update" %>
17
- <%- end -%>
18
- </p>
19
- <p>
20
- <b>CreatedAt</b>: <%=h @invoice.created_at %>
21
- </p>
22
11
  <p>
12
+ <b>CreatedAt</b>: <%=h @invoice.created_at %><br />
23
13
  <b>UpdatedAt</b>: <%=h @invoice.updated_at %>
24
14
  </p>
25
15
  <p>
26
- <b>Sent to:</b><br />
27
- <%= render :partial => "admin/address", :object => @invoice.address %>
16
+ <b>Comment</b>: <%=h @invoice.comment %>
28
17
  </p>
29
18
  <p>
30
- <b>Comment</b>: <%=h @invoice.comment %>
19
+ <b>Amount:</b> <%=h @invoice.price %>
31
20
  </p>
32
21
  </div>
22
+ <div id="billing_information">
23
+ <h3>Address</h3>
24
+ <%= render :partial => "admin/address", :object => @invoice.address %>
25
+ </div>
33
26
  <div id="invoice_order_items">
34
- <p>
35
- <b>OrderItems</b>
36
- <br />
37
- <ul>
38
- <% for oi in @invoice.order_items %>
39
- <li> <%=h oi.inventory.product.name %> (<%=h oi.inventory.product.class %>)
40
- | <%- unless oi.inventory.properties.empty? -%><b>Configuration:</b> <%=h oi.inventory.properties.collect(&:name) * "," %><%- end -%>
41
- | <%=h oi.quantity %> | <%=h oi.quantity * oi.inventory.price %></li>
42
- <% end %>
43
- </ul>
44
- </p>
45
- </div>
46
-
47
- <div id="invoice_history" class="sub_content_box" style="">
48
- <h3>History</h3>
49
- <ul>
50
- <% for h in @invoice.history %>
51
- <li><%=h h.message %> (<%=h ordinalized_time( h.created_at ) %>)</li>
52
- <% end %>
53
- </ul>
54
-
27
+ <h3>Order Items</h3>
28
+ <%= render :partial => "admin/order_items/items_table", :object => @invoice %>
55
29
  </div>
@@ -0,0 +1,59 @@
1
+ pdf.image RAILS_ROOT + '/public/images/opensteam_store_logo.jpg', :scale => 0.3
2
+
3
+ pdf.text "Invoice ##{@invoice.id}, Order ##{@order.id}", :size => 25, :align => :center
4
+ pdf.stroke_horizontal_rule
5
+
6
+ pdf.text "\n\n"
7
+
8
+ pdf.text "Customer Information", :style => :bold
9
+ pdf.text "\n"
10
+ pdf.text "Email: #{@order.customer.email}", :size => 8
11
+ pdf.text "Firstname: #{@order.customer.firstname}", :size => 8
12
+ pdf.text "Lastname: #{@order.customer.lastname}", :size => 8
13
+ pdf.text "\n\n"
14
+ pdf.text "Shipping Information", :style => :bold
15
+ pdf.text "\n"
16
+ pdf.font.size(8) do
17
+ pdf.text "Shipping Type: #{@order.shipping_type}"
18
+ pdf.text "\n"
19
+ pdf.text "Address", :style => :bold, :size => 8
20
+ pdf.text @order.shipping_address.to_a
21
+ end
22
+
23
+ pdf.text "\n\n"
24
+
25
+ pdf.text "Billing Information", :style => :bold
26
+ pdf.text "\n"
27
+ pdf.font.size(8) do
28
+ pdf.text "Payment Type: #{Opensteam::Payment::Base[ @order.payment_type ].display_name}"
29
+ pdf.text "\n"
30
+ pdf.text "Address", :style => :bold, :size => 8
31
+ pdf.text @order.payment_address.to_a
32
+ end
33
+
34
+ pdf.text "\n\n"
35
+
36
+ pdf.text "Order Items", :style => :bold
37
+ pdf.text "\n"
38
+ pdf.table( @invoice.items.collect { |i|
39
+ [ i.item.id, i.item.name, i.item.product.class, i.item.properties.join(","), i.quantity, i.price, i.tax, i.total_price ] } +
40
+ [ [ "", "Total Netto Price", "", "", "", "", "", @invoice.items.collect(&:total_price).sum - @invoice.items.collect(&:tax).sum ],
41
+ [ "", "Total Tax", "", "", "", "", "", @invoice.items.collect(&:tax).sum ],
42
+ [ "", "Shipping Rate", "", "", "", "", "", @order.shipping_rate ],
43
+ [ "", "", "", "", "", "", "", "" ],
44
+ [ "", "Total Price", "", "", "", "", "", @invoice.price + @order.shipping_rate ]
45
+ ],
46
+ :font_size => 7,
47
+ :horizontal_padding => 10,
48
+ :vertical_padding => 3,
49
+ :row_colors => ["FFFFFF", "DDDDDD" ],
50
+ :border_width => 1,
51
+ :position => :left,
52
+ :headers => ["ID","Name", "Class", "Information", "Quantity", "Single Price", "Tax", "Total Price"] )
53
+
54
+
55
+ pdf.text "\n\n"
56
+
57
+ pdf.text "Comment", :style => :bold
58
+ pdf.text "\n"
59
+ pdf.text @invoice.comment, :size => 8
@@ -0,0 +1,5 @@
1
+ <ul>
2
+ <li><%= link_to "Tax Zones", admin_tax_zones_path %></li>
3
+ <li><%= link_to "Tax Groups", admin_tax_groups_path %></li>
4
+ <li><%= link_to "Shipping Rate Groups", admin_shipping_rate_groups_path %></li>
5
+ </ul>
@@ -0,0 +1,9 @@
1
+ <tr>
2
+ <td><%= item_entry.item.id %></td>
3
+ <td><%= item_entry.item.product.name %> (<%= item_entry.item.product.class.to_s %>)</td>
4
+ <td><%= item_entry.item.properties.collect(&:name).join(", ") %></td>
5
+ <td><%= item_entry.price %></td>
6
+ <td><%= item_entry.tax %> (<%= get_rate_for( item_entry, @order.shipping_address.country ) %>)</td>
7
+ <td><%= item_entry.quantity %></td>
8
+ <td><%= item_entry.total_price %></td>
9
+ </tr>
@@ -0,0 +1,16 @@
1
+ <table>
2
+ <thead>
3
+ <tr>
4
+ <th>#</th>
5
+ <th>Name (Class)</th>
6
+ <th>Information</th>
7
+ <th>Price</th>
8
+ <th>Tax</th>
9
+ <th>Quantity</th>
10
+ <th>Total Price</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <%= render :partial => "admin/order_items/item_entry", :collection => items_table.items %>
15
+ </tbody>
16
+ </table>
@@ -1,11 +1,11 @@
1
1
  <tr class="<%= cycle('odd','even') %>">
2
- <td><%=h order.id %></td>
3
- <td><%=h order.order_items.size %></td>
4
- <td><%= link_to order.customer.email, admin_user_path( order.customer ) %></td>
5
- <td><%=h order.shipping_address.to_s %></td>
6
- <td><%=h order.shipping_address.to_s %></td>
7
- <td><%=h order.state %></td>
8
- <td><%=h ordinalized_time order.created_at %></td>
9
- <td><%=h ordinalized_time order.updated_at %></td>
10
- <td><%= link_to "show", admin_order_path( order ) %></td>
2
+ <td><%=h order.id %></td>
3
+ <td><%=h order.items.size %></td>
4
+ <td><%= link_to order.customer.email, admin_user_path( order.customer ) %></td>
5
+ <td><%=h order.shipping_address.to_s %></td>
6
+ <td><%=h order.shipping_address.to_s %></td>
7
+ <td><%=h order.state %></td>
8
+ <td><%=h ordinalized_time order.created_at %></td>
9
+ <td><%=h ordinalized_time order.updated_at %></td>
10
+ <td><%= link_to "show", admin_order_path( order ) %></td>
11
11
  </tr>
@@ -3,7 +3,7 @@
3
3
  <% osteam_sort_table Opensteam::OrderBase::Order do |t| %>
4
4
  <%= t.table_header do |column|
5
5
  url = { :controller => "admin/orders", :action => 'index', :sort => column.id }
6
- url[:customer_id] = @customer.id if @customer
6
+ url[:user_id] = @customer.id if @customer
7
7
 
8
8
  link_to_remote( column.name, :url => url, :update => id, :method => 'get' )
9
9
  end %>
@@ -1,15 +1,17 @@
1
1
  <% content_for :admin_sidebar do %>
2
2
  <% admin_sidebar_links do %>
3
3
  <%= admin_sidebar_link "Information", "#", :function => "toggle_admin_display('order_customer');" %>
4
+ <%= admin_sidebar_link "Payment", "#", :function => "toggle_admin_display('order_payment');" %>
4
5
  <%= admin_sidebar_link "Shipments", "#", :function => "toggle_admin_display('order_shipments');" %>
5
- <%= admin_sidebar_link "Invoices", "#", :function => "toggle_admin_display('order_invoices');" %>
6
6
  <%= admin_sidebar_link "Order Items", "#", :function => "toggle_admin_display('order_order_items');" %>
7
7
  <%= admin_sidebar_link "History", "#", :function => "toggle_admin_display('order_history');" %>
8
8
  <% end%>
9
9
  <% end %>
10
10
 
11
11
  <h2>Order # <%= @order.id %></h2>
12
- <h3>State: <%= @order.state %></h3>
12
+ <b>State:</b> <%=h @order.state %><br />
13
+ <b>Payment State:</b> <%= @order.payments.first.state unless @order.payments.empty? %><br />
14
+ <b>Shipments States:</b> <%= @order.shipments.collect(&:state).join(", ") %><br />
13
15
 
14
16
  <% @order.events.select { |s| s =~ /^view_link_to_/ }.each do |o| %>
15
17
  <% o =~ /^view_link_to_(.+)$/ %>
@@ -24,10 +26,9 @@
24
26
 
25
27
  <div id="order_shipments" class="sub_content_box" style="display:none;">
26
28
  <h3>Shipments</h3>
27
-
28
- <%# unless @order.finished? %>
29
- <%# = link_to "Create Shipment", :controller => 'shipments', :action => 'new', :order_id => @order.id %>
30
- <%# end %>
29
+ <b>Shipping Type:</b> <%= @order.shipping_type %><br />
30
+ <b>Shipping Rate:</b> <%= @order.shipping_rate %><br />
31
+ <br />
31
32
  <%= render :partial => "admin/shipments/shipments", :object => @order.shipments,
32
33
  :locals => { :id => "order_shipments_table" } %>
33
34
  </div>
@@ -38,17 +39,32 @@
38
39
  :locals => { :id => "order_invoices_table" } %>
39
40
  </div>
40
41
 
42
+ <div id="order_payment" style="display:none;" class="sub_content_box" >
43
+ <h3>Payment</h3>
44
+
45
+ <h4>Information</h4>
46
+ <%- unless @order.payments.empty? -%>
47
+ <%= render :partial => "admin/payments/#{@order.payments.first.class.payment_id}_payment", :object => @order.payments.first %>
48
+ <%- end -%>
49
+ <h4>Invoices</h4>
50
+ <%= render :partial => "admin/invoices/invoices", :object => @order.invoices,
51
+ :locals => { :id => "order_invoices_table" } %>
52
+
53
+ </div>
54
+
41
55
  <div id="order_order_items" class="sub_content_box" style="display:none;">
42
56
  <h3>Order Items</h3>
43
- <b>Total Price</b>: <%=h @order.order_items.collect(&:inventory).collect(&:price).sum %>
44
- <%= render :partial => "order_item", :collection => @order.order_items %>
57
+ <b>Total Price</b>: <%=h @order.total_price %>
58
+ <div id="order_items_table">
59
+ <%= render :partial => "admin/order_items/items_table", :object => @order %>
60
+ </div>
45
61
  </div>
46
62
 
47
63
  <div id="order_history" class="sub_content_box" style="display:none;">
48
64
  <h3>History</h3>
49
65
  <ul>
50
66
  <% for h in @order.history %>
51
- <li><%=h h.message %> (<%=h ordinalized_time h.created_at %>)</li>
67
+ <li><%=h h.message %> (<%=h ordinalized_time( h.created_at )%>)</li>
52
68
  <% end %>
53
69
  </ul>
54
70
 
@@ -0,0 +1,27 @@
1
+ <h2>Payment Types</h2>
2
+ <table>
3
+ <thead>
4
+ <tr>
5
+ <th>#</th>
6
+ <th>Name</th>
7
+ <th>Description</th>
8
+ <th>Class</th>
9
+ <th>Active?</th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <% for payment_type in @payment_types %>
14
+ <tr>
15
+ <td><%=h payment_type.id %></td>
16
+ <td><%=h payment_type.name %></td>
17
+ <td><%=h payment_type.klass.classify.constantize.display_name %></td>
18
+ <td><%=h payment_type.klass %></td>
19
+ <td>
20
+ <% form_tag toggle_admin_payment_type_path( payment_type ) do %>
21
+ <%= image_submit_tag( payment_type.active? ? "tick.png" : "cross.png" ) %>
22
+ <% end %>
23
+
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
@@ -0,0 +1,26 @@
1
+ <% payment = credit_card_payment %>
2
+ <p>
3
+ <b><u>Type:</u></b> <%= payment.class.display_name %>
4
+ </p>
5
+ <p>
6
+ <b>State:</b> <%=h payment.state %><br />
7
+ <b>Test?:</b> <%=h payment.test %><br />
8
+ <b>Amount:</b> <%=h payment.amount %><br />
9
+ <b>Description:</b> <%=h payment.description %><br />
10
+ <b>Message</b> <%=h payment.message %><br />
11
+ </p>
12
+ <h4>CreditCard</h4>
13
+ <b>Number:</b> <%= payment.data[:number] %><br />
14
+ <b>Name: </b> <%= payment.data[:first_name] %> <%= payment.data[:last_name] %><br />
15
+
16
+ <ul>
17
+ <% for transaction in payment.transactions %>
18
+ <li><b><u><%= transaction.action %></u></b><br />
19
+ <b>Amount:</b> <%= transaction.amount %><br />
20
+ <b>Success:</b> <%= transaction.success %><br />
21
+ <b>Test:</b> <%= transaction.test %><br />
22
+ <b>Message:</b> <%= transaction.message %><br />
23
+ <b>Reference:</b> <%= transaction.reference %><br />
24
+ </li>
25
+ <% end %>
26
+ </ul>
@@ -0,0 +1,15 @@
1
+ <% payment = credit_card_payment_info %>
2
+ <p>
3
+ <b><u>Type:</u></b> <%= payment.class.display_name %>
4
+ </p>
5
+ <p>
6
+ <b>State:</b> <%=h payment.state %><br />
7
+ <b>Test?:</b> <%=h payment.test %><br />
8
+ <b>Amount:</b> <%=h payment.amount %><br />
9
+ <b>Description:</b> <%=h payment.description %><br />
10
+ <b>Message</b> <%=h payment.message %><br />
11
+ </p>
12
+ <h4>CreditCard</h4>
13
+ <b>Number:</b> <%= payment.data[:number] %><br />
14
+ <b>Name: </b> <%= payment.data[:first_name] %> <%= payment.data[:last_name] %><br />
15
+
@@ -0,0 +1,5 @@
1
+ .... Direct Debit....
2
+ <br />
3
+ <br />
4
+ <br />
5
+ not yet implemented....
@@ -1,9 +1,9 @@
1
1
  <% content_for :admin_sidebar do %>
2
- <% admin_sidebar_links do %>
3
- <%= admin_sidebar_link "Show Order", admin_order_path( @order ) %>
4
- <%= admin_sidebar_link "Show Order Shipments", admin_order_shipments_path %>
5
- <%= admin_sidebar_link "Show Order Invoices", admin_order_invoices_path %>
6
- <% end %>
2
+ <% admin_sidebar_links do %>
3
+ <%= admin_sidebar_link "Show Order", admin_order_path( @order ) %>
4
+ <%= admin_sidebar_link "Show Order Shipments", admin_order_shipments_path %>
5
+ <%= admin_sidebar_link "Show Order Invoices", admin_order_invoices_path %>
6
+ <% end %>
7
7
  <% end %>
8
8
 
9
9
  <h2>New Shipment</h2>
@@ -16,36 +16,51 @@
16
16
  <% form_for :shipment, @shipment, :url => { :action => 'create', :controller => 'shipments' }, :html => { :method => 'post' } do |f| %>
17
17
 
18
18
  <% fields_for :address, @shipment.address do |a| %>
19
- <p>Street<br />
20
- <%= a.text_field :street %>
21
- </p>
22
- <p>Postal<br />
23
- <%= a.text_field :postal %>
19
+
20
+ <% field_set_tag do %>
21
+ <p>
22
+ <%= a.label :street %>
23
+ <%= a.text_field :street %>
24
+ </p>
25
+ <p>
26
+ <%= a.label :postal %>
27
+ <%= a.text_field :postal %>
28
+ </p>
29
+ <p>
30
+ <%= a.label :city %>
31
+ <%= a.text_field :city %>
32
+ </p>
33
+ <p>
34
+ <%= a.label :country %>
35
+ <%= a.text_field :country %>
36
+ </p>
37
+ <% end %>
38
+ <% end %>
39
+
40
+ <% field_set_tag do %>
41
+ <p>
42
+ <%= f.label :shipping_rate %>
43
+ <%= f.text_field :shipping_rate, :size => 5 %>
24
44
  </p>
25
- <p>City<br />
26
- <%= a.text_field :city %>
45
+ <p>
46
+ <%= f.label :comment %>
47
+ <%= f.text_area :comment, :rows => 5%>
27
48
  </p>
28
- <p>Land<br />
29
- <%= a.text_field :land %>
49
+ <% end %>
50
+
51
+ <% fields_for :order_items, nil do |a| %>
52
+ <p>Select Order Items
53
+ <ul>
54
+ <% for oi in @order.items.select { |s| s.shipment == nil } %>
55
+ <li> <%= a.check_box "#{oi.id}", {} , 1, 0 %> <%= a.label oi.id, oi.product.name %> (<%=h oi.product.class %>)
56
+ | <%- unless oi.properties.empty? -%><b>Configuration:</b> <%=h oi.properties.collect(&:name) * "," %><%- end -%>
57
+ | <%=h oi.quantity %> | <%=h oi.quantity * oi.price %></li>
58
+ <% end %>
59
+ </ul>
30
60
  </p>
31
61
  <% end %>
32
62
 
33
- <p>Comment<br />
34
- <%= f.text_area :comment, :rows => 5%>
35
- </p>
36
- <% fields_for :order_items, nil do |a| %>
37
- <p>Select Order Items
38
- <ul>
39
- <% for oi in @order.order_items.select { |s| s.shipment == nil } %>
40
- <li> <%= a.check_box "#{oi.id}", {} , 1, 0 %> <%=h oi.inventory.product.name %> (<%=h oi.inventory.product.class %>)
41
- | <%- unless oi.inventory.properties.empty? -%><b>Configuration:</b> <%=h oi.inventory.properties.collect(&:name) * "," %><%- end -%>
42
- | <%=h oi.quantity %> | <%=h oi.quantity * oi.inventory.price %></li>
43
- <% end %>
44
- </ul>
45
- </p>
46
- <% end %>
47
-
48
-
63
+
49
64
 
50
65
  <%= submit_tag "save" %>
51
66
  <% end %>