spree_suppliers 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/Gemfile +22 -0
  2. data/LICENSE +26 -0
  3. data/README.md +80 -0
  4. data/Rakefile +31 -0
  5. data/Versionfile +9 -0
  6. data/app/assets/javascripts/admin/spree_suppliers.js +1 -0
  7. data/app/assets/javascripts/invoice_items.js.coffee +3 -0
  8. data/app/assets/javascripts/store/spree_suppliers.js +1 -0
  9. data/app/assets/javascripts/supplier_invoices.js.coffee +3 -0
  10. data/app/assets/javascripts/suppliers.js.coffee +3 -0
  11. data/app/assets/stylesheets/admin/spree_suppliers.css +3 -0
  12. data/app/assets/stylesheets/invoice_items.css.scss +3 -0
  13. data/app/assets/stylesheets/store/spree_suppliers.css +3 -0
  14. data/app/assets/stylesheets/supplier_invoices.css.scss +3 -0
  15. data/app/assets/stylesheets/suppliers.css.scss +4 -0
  16. data/app/controllers/admin/supplier_taxons_controller.rb +61 -0
  17. data/app/controllers/admin/suppliers_controller.rb +127 -0
  18. data/app/controllers/admin/vendor_overview_controller.rb +18 -0
  19. data/app/controllers/invoice_items_controller.rb +2 -0
  20. data/app/controllers/supplier_invoices_controller.rb +2 -0
  21. data/app/controllers/suppliers_controller.rb +15 -0
  22. data/app/models/invoice_item.rb +4 -0
  23. data/app/models/supplier.rb +8 -0
  24. data/app/models/supplier_invoice.rb +4 -0
  25. data/app/overrides/admin.rb +5 -0
  26. data/app/views/admin/orders/show.html.erb +34 -0
  27. data/app/views/admin/orders/user.html.erb +19 -0
  28. data/app/views/admin/products/_form.html.erb +114 -0
  29. data/app/views/admin/products/_suppliers_form.html.erb +4 -0
  30. data/app/views/admin/shared/_order_tabs_decide.html.erb +5 -0
  31. data/app/views/admin/shared/_vendor_order_tabs.html.erb +39 -0
  32. data/app/views/admin/supplier_taxons/_form.html.erb +23 -0
  33. data/app/views/admin/supplier_taxons/_taxon_table.html.erb +23 -0
  34. data/app/views/admin/supplier_taxons/available.js.erb +33 -0
  35. data/app/views/admin/supplier_taxons/edit.html.erb +11 -0
  36. data/app/views/admin/supplier_taxons/remove.html.erb +1 -0
  37. data/app/views/admin/supplier_taxons/select.js.erb +2 -0
  38. data/app/views/admin/supplier_taxons/selected.html.erb +18 -0
  39. data/app/views/admin/suppliers/_edit_form.html.erb +75 -0
  40. data/app/views/admin/suppliers/_edit_hours_form.html.erb +18 -0
  41. data/app/views/admin/suppliers/_form.html.erb +60 -0
  42. data/app/views/admin/suppliers/_hours_form.html.erb +11 -0
  43. data/app/views/admin/suppliers/_image_form.html.erb +11 -0
  44. data/app/views/admin/suppliers/_supplier.html.erb +24 -0
  45. data/app/views/admin/suppliers/_supplier_tabs.html.erb +12 -0
  46. data/app/views/admin/suppliers/_suppliers_table.html.erb +25 -0
  47. data/app/views/admin/suppliers/_upload_image.html.erb +14 -0
  48. data/app/views/admin/suppliers/available.js.erb +34 -0
  49. data/app/views/admin/suppliers/edit.html.erb +13 -0
  50. data/app/views/admin/suppliers/index.html.erb +97 -0
  51. data/app/views/admin/suppliers/line_items.html.erb +20 -0
  52. data/app/views/admin/suppliers/new.html.erb +13 -0
  53. data/app/views/admin/suppliers/remove.html.erb +1 -0
  54. data/app/views/admin/suppliers/select.html.erb +1 -0
  55. data/app/views/admin/suppliers/selected.html.erb +40 -0
  56. data/app/views/admin/suppliers/show.html.erb +2 -0
  57. data/app/views/admin/vendor_overview/index.html.erb +1 -0
  58. data/app/views/shared/_supplier_invoices.html.erb +47 -0
  59. data/app/views/suppliers/_supplier.html.erb +7 -0
  60. data/app/views/suppliers/_supplier_list.erb +13 -0
  61. data/app/views/suppliers/index.html.erb +13 -0
  62. data/app/views/suppliers/show.html.erb +11 -0
  63. data/app/views/suppliers/supplier_list.erb +11 -0
  64. data/config/routes.rb +37 -0
  65. data/db/migrate/20120131160039_create_suppliers.rb +8 -0
  66. data/db/migrate/20120131160855_add_fields_to_suppliers.rb +16 -0
  67. data/db/migrate/20120131161247_create_supplier_invoices.rb +12 -0
  68. data/db/migrate/20120131161610_create_invoice_items.rb +12 -0
  69. data/db/migrate/20120201160616_create_suppliers_taxons.rb +16 -0
  70. data/db/migrate/20120201170705_add_supplier_id_to_products.rb +5 -0
  71. data/db/seeds.rb +143 -0
  72. data/db/seeds/images/apple.gif +0 -0
  73. data/db/seeds/images/apple.jpg +0 -0
  74. data/db/seeds/images/banana.jpg +0 -0
  75. data/db/seeds/images/blueberry.jpg +0 -0
  76. data/db/seeds/images/cherries.jpg +0 -0
  77. data/db/seeds/images/chicken.jpg +0 -0
  78. data/db/seeds/images/cow.jpg +0 -0
  79. data/db/seeds/images/flower.jpg +0 -0
  80. data/db/seeds/images/goat.jpg +0 -0
  81. data/db/seeds/images/grapes.jpg +0 -0
  82. data/db/seeds/images/greenapple.jpg +0 -0
  83. data/db/seeds/images/greenbeans.jpg +0 -0
  84. data/db/seeds/images/indie_candy.jpg +0 -0
  85. data/db/seeds/images/orange.jpg +0 -0
  86. data/db/seeds/images/squash.jpg +0 -0
  87. data/db/seeds/images/stock_user.jpg +0 -0
  88. data/db/seeds/images/strawberry.jpg +0 -0
  89. data/db/seeds/images/watermelon.jpg +0 -0
  90. data/lib/generators/spree_suppliers/install/install_generator.rb +31 -0
  91. data/lib/spree_suppliers.rb +192 -0
  92. data/lib/spree_suppliers/engine.rb +24 -0
  93. data/lib/spree_suppliers_hooks.rb +19 -0
  94. data/script/rails +7 -0
  95. data/spec/spec_helper.rb +31 -0
  96. data/spree_suppliers.gemspec +24 -0
  97. data/test/fixtures/.gitkeep +0 -0
  98. data/test/fixtures/invoice_items.yml +13 -0
  99. data/test/fixtures/supplier_invoices.yml +13 -0
  100. data/test/fixtures/suppliers.yml +11 -0
  101. data/test/functional/.gitkeep +0 -0
  102. data/test/functional/invoice_items_controller_test.rb +7 -0
  103. data/test/functional/supplier_invoices_controller_test.rb +7 -0
  104. data/test/functional/suppliers_controller_test.rb +7 -0
  105. data/test/integration/.gitkeep +0 -0
  106. data/test/performance/browsing_test.rb +12 -0
  107. data/test/test_helper.rb +13 -0
  108. data/test/unit/helpers/invoice_items_helper_test.rb +4 -0
  109. data/test/unit/helpers/supplier_invoices_helper_test.rb +4 -0
  110. data/test/unit/helpers/suppliers_helper_test.rb +4 -0
  111. data/test/unit/invoice_item_test.rb +7 -0
  112. data/test/unit/supplier_invoice_test.rb +7 -0
  113. data/test/unit/supplier_test.rb +7 -0
  114. metadata +156 -37
@@ -0,0 +1,18 @@
1
+ <tr>
2
+ <td><h4><%= day %></h4></td>
3
+ <% outcome = @supplier.hours.first.send(day.downcase) %>
4
+ <% if outcome == "Closed" || outcome == "Information Unavailable" %>
5
+ <% if outcome == "Information Unavailable" %>
6
+ <% outcome = "Unavailable" %>
7
+ <% end %>
8
+ <td><%= select_tag "#{day}_closed", options_for_select(@closed, outcome) %></td>
9
+ <% else %>
10
+ <td><%= select_tag "#{day}_closed", options_for_select(@closed, "Open") %></td>
11
+ <% end %>
12
+ <td>From: <%= select_tag "#{day}_begin", options_for_select(@hours, find_hours(outcome)[0]) %></td>
13
+ <td><%= select_tag "#{day}_begin_mins", options_for_select(@minutes,find_minutes(outcome)[0]) %></td>
14
+ <td><%= select_tag "#{day}_begin_type", options_for_select(@periods,find_periods(outcome)[0]) %>, to</td>
15
+ <td><%= select_tag "#{day}_end", options_for_select(@hours,find_hours(outcome)[1]) %><td>
16
+ <td><%= select_tag "#{day}_end_mins", options_for_select(@minutes, find_minutes(outcome)[1]) %></td>
17
+ <td><%= select_tag "#{day}_end_type", options_for_select(@periods,find_periods(outcome)[1]) %></td>
18
+ </tr>
@@ -0,0 +1,60 @@
1
+ <table class="admin-report" width="545">
2
+ <tr>
3
+ <td valign="top">Company name:</td>
4
+ <td><%= f.text_field :title %></td>
5
+ </tr>
6
+ <tr>
7
+ <td valign="top">Company Description:</td>
8
+ <td><%= f.text_field :notes %></td>
9
+ </tr>
10
+ </table>
11
+
12
+ <h3>Information</h3>
13
+ <table class="admin-report" width="545">
14
+ <tr>
15
+ <td valign="top">Phone:</td>
16
+ <td><%= f.text_field :phone %></td>
17
+ </tr>
18
+ <tr>
19
+ <td valign="top">Fax:</td>
20
+ <td><%= f.text_field :fax %></td>
21
+ </tr>
22
+ <tr>
23
+ <td valign="top">Email:</td>
24
+ <td><%= f.text_field :email %></td>
25
+ </tr>
26
+ <tr>
27
+ <td valign="top">Facebook:</td>
28
+ <td><%= f.text_field :facebook %></td>
29
+ </tr>
30
+ <tr>
31
+ <td valign="top">Twitter:</td>
32
+ <td><%= f.text_field :twitter %></td>
33
+ </tr>
34
+ <tr>
35
+ <td valign="top">Website:</td>
36
+ <td><%= f.text_field :website %></td>
37
+ </tr>
38
+ </table>
39
+
40
+ <h3>Proprietor Information</h3>
41
+ <table class="admin-report" width="545">
42
+ <tr>
43
+ <td valign="top">Owner Name:</td>
44
+ <td><%= f.text_field :name %></td>
45
+ </tr>
46
+ </table>
47
+
48
+ <h3>Supplier Images</h3>
49
+ <%= f.fields_for :images do |image| %>
50
+ <% if !image.object.attachment_file_name.nil? %>
51
+ <span class="supplier_image">
52
+ <%= image_tag(image.object.attachment.url) %>
53
+ </span>
54
+ <% else %>
55
+ <p />
56
+ <h4><%= "Upload New Image" %></h4>
57
+ <%= image.file_field :attachment if image.object.attachment_file_name.nil? %>
58
+ <% end %>
59
+ <% end %>
60
+
@@ -0,0 +1,11 @@
1
+ <tr>
2
+ <td><h4><%= day %></h4></td>
3
+ <td><%= select_tag "#{day}_closed", "<option>Unavailable</option><option>Open</option><option>Closed</option>".html_safe %></td>
4
+ <td>From: <%= select_tag "#{day}_begin", "<option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option>".html_safe %></td>
5
+ <td><%= select_tag "#{day}_begin_mins", "<option>00</option><option>15</option><option>30</option><option>45</option>".html_safe %></td>
6
+ <td><%= select_tag "#{day}_begin_type", "<option>am</option><option>pm</option>".html_safe %>, to</td>
7
+ <td><%= select_tag "#{day}_end", "<option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option>".html_safe %></td>
8
+ <td><%= select_tag "#{day}_end_mins", "<option>00</option><option>15</option><option>30</option><option>45</option>".html_safe %></td>
9
+ <td><%= select_tag "#{day}_end_type", "<option>pm</option><option>am</option>".html_safe %></td>
10
+
11
+ </tr>
@@ -0,0 +1,11 @@
1
+ <%= f.fields_for :images do |a| %>
2
+ <%= a.label :image %>
3
+ <%= a.file_field :attachment %>
4
+ <% end %>
5
+
6
+ <% if @supplier %>
7
+ <% @supplier.images.each do |image| %>
8
+ <%= image_tag(image) %>
9
+ <% end %>
10
+ <% end %>
11
+
@@ -0,0 +1,24 @@
1
+ <h2>Supplier Info: <%= supplier.title %></h2>
2
+ <ul>
3
+ <li><b>Company name:</b> <%= supplier.title %></li>
4
+ <li><b>Vendor page:</b> <%= link_to supplier.title, supplier_path(supplier) %></li>
5
+ <li><b>Description:</b> <%= supplier.notes %></li>
6
+ <li><b>Phone:</b> <%= supplier.phone %></li>
7
+ <li><b>Fax:</b><%= supplier.fax %></li>
8
+ <li><b>Email:</b><%= supplier.email %></li>
9
+ <li><b>Facebook:</b><%= supplier.facebook %></li>
10
+ <li><b>Twitter:</b><%= supplier.twitter %></li>
11
+ <li><b>Website:</b><%= supplier.website %></li>
12
+ </ul>
13
+ <h2>Proprietor Info</h2>
14
+ <ul>
15
+ <li><b>Owner Name:</b><%= supplier.name %></li>
16
+ </ul>
17
+
18
+ <h2>Images</h2>
19
+ <% supplier.images.each do |image| %>
20
+ <ul>
21
+ <li><%= image_tag(image.attachment)%></li>
22
+ </ul>
23
+ <% end %>
24
+
@@ -0,0 +1,12 @@
1
+ <% content_for :sidebar do %>
2
+ <ul class="sidebar supplier-menu">
3
+ <%= hook :admin_supplier_tabs, {:current => current} do %>
4
+ <li<%== ' class="active"' if current == "Supplier Details" %>>
5
+ <%= link_to "Supplier Details", edit_admin_supplier_url(@supplier) %>
6
+ </li>
7
+ <li<%== ' class="active"' if current == "Taxons" %>>
8
+ <%= link_to t("taxons"), selected_admin_supplier_taxons_url(@supplier) %>
9
+ </li>
10
+ <% end %>
11
+ </ul>
12
+ <% end %>
@@ -0,0 +1,25 @@
1
+ <table class="index">
2
+ <thead>
3
+ <tr>
4
+ <th><%= t("supplier_name") %></th>
5
+ <th></th>
6
+ </tr>
7
+ </thead>
8
+ <tbody>
9
+ <% unless supplier.blank? %>
10
+ <tr id="<%= dom_id(supplier, :sel)%>">
11
+ <td><%= supplier.name %></td>
12
+ <td class="actions">
13
+ <%= image_tag "spinner.gif", :style => "display:none", :id => "#{dom_id(supplier, :rem_spinner)}" %>
14
+ <%= link_to_remote icon('delete') + ' ' + t('remove'),
15
+ {:url => remove_admin_product_supplier_url(@product, supplier),
16
+ :loading => "jQuery('##{dom_id(supplier, :rem_spinner)}').show()",
17
+ :update => 'selected-supplier',
18
+ :complete => "jQuery('##{dom_id(supplier, :sel)}').remove(); jQuery('##{dom_id(supplier, :rem_spinner)}').hide();"}, :class => 'iconlink' %>
19
+ </td>
20
+ </tr>
21
+ <% else %>
22
+ <tr><td colspan="3"><%= t('none') %>.</td></tr>
23
+ <% end %>
24
+ </tbody>
25
+ </table>
@@ -0,0 +1,14 @@
1
+ <table class="basic-table">
2
+ <h3>Company images</h3>
3
+ <tr>
4
+ <td><%= t("filename") %>:</td>
5
+ <td><%= f.file_field :attachment %></td>
6
+ </tr>
7
+ <tr>
8
+ <td><%= t("alt_text") %>:</td>
9
+ <td><%= f.text_field :alt, :value => "There is no image available" %></td>
10
+ </tr>
11
+ <tr>
12
+ <td><%= f.hidden_field :viewable_id, :value => @supplier.id %></td>
13
+ </tr>
14
+ </table>
@@ -0,0 +1,34 @@
1
+ <script type="text/javascript">
2
+ function displayRow(){
3
+ var row = document.getElementById("captionRow");
4
+ if (row.style.display == '') row.style.display = 'none';
5
+ else row.style.display = '';
6
+ }
7
+ </script>
8
+ <h4><%= t('available_suppliers') %></h4>
9
+ <table class="index">
10
+ <thead>
11
+ <tr>
12
+ <th><%= t("name") %></th>
13
+ <th><%= t("action") %></th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <% @available_suppliers.each do |supplier| %>
18
+ <tr id="<%= dom_id(supplier) %>">
19
+ <td><%= supplier.name %></td>
20
+ <td class="actions">
21
+ <%= image_tag "spinner.gif", :style => "display:none", :id => "#{dom_id(supplier, :spinner)}" %>
22
+ <%= link_to_remote icon('add') + ' ' + t('select'),
23
+ {:url => select_admin_product_supplier_path(@product, supplier),
24
+ :loading => "jQuery('##{dom_id(supplier, :spinner)}').show()",
25
+ :update => 'selected-supplier',
26
+ :complete => "jQuery('##{dom_id(supplier)}').remove(); jQuery('##{dom_id(supplier, :spinner)}').hide();"}, :class => 'iconlink' %>
27
+ </td>
28
+ </tr>
29
+ <% end %>
30
+ <% if @available_suppliers.empty? %>
31
+ <tr><td colspan="3"><%= t('no_match_found') %>.</td></tr>
32
+ <% end %>
33
+ </tbody>
34
+ </table>
@@ -0,0 +1,13 @@
1
+ <%= render :partial => 'admin/suppliers/supplier_tabs', :locals => {:current => "Supplier Details"} %>
2
+
3
+ <h1>Edit Supplier</h1>
4
+
5
+ <%= form_for @supplier, :url => object_url, :html => { :method => :put, :multipart => true } do |f| %>
6
+ <%= render :partial => "form", :locals => { :f => f } %>
7
+
8
+ <p class="form-buttons">
9
+ <%= button t("update") %>
10
+ <%= t('or') %> <%= link_to t("cancel"), "#", :id => "cancel_link" %>
11
+ </p>
12
+ <% end %>
13
+
@@ -0,0 +1,97 @@
1
+ <%= render :partial => 'admin/shared/configuration_menu' %>
2
+ <h1>
3
+ <%= t("suppliers") %>
4
+ </h1>
5
+ <% if current_user.has_role?("admin") %>
6
+ <div class='toolbar'>
7
+ <ul class='actions'>
8
+ <li id="new_product_link">
9
+ <%= button_link_to "New Supplier", new_admin_supplier_path %>
10
+ </li>
11
+ </ul>
12
+ <br class='clear' />
13
+ </div>
14
+ <table class="index" width="545">
15
+ <thead>
16
+ <tr>
17
+ <th>
18
+ <%= t("supplier_name") %>
19
+ </th>
20
+ <th>
21
+ <%= t("notes") %>
22
+ </th>
23
+ <th>
24
+ Actions
25
+ </th>
26
+ <th>
27
+ Featured
28
+ </th>
29
+ </tr>
30
+ </thead>
31
+ <tbody>
32
+ <% @suppliers.each do |supplier| %>
33
+ <tr class="<%= cycle('even', 'odd') %>">
34
+ <td>
35
+ <%= link_to supplier.title, edit_admin_supplier_path(supplier) %>
36
+ </td>
37
+ <td>
38
+ <%= truncate(supplier.notes, :length => 50) %>
39
+ </td>
40
+ <td class='actions'>
41
+ <%= link_to_edit supplier, :class => 'edit' %>
42
+ &nbsp;
43
+ <%= link_to_delete supplier %>
44
+ </td>
45
+ <td>
46
+ <% if supplier.featured %>
47
+ <%= link_to "Yes", admin_supplier_feature_path(supplier) %>
48
+ <% else %>
49
+ <%= link_to "No", admin_supplier_feature_path(supplier) %>
50
+ <% end %>
51
+ </td>
52
+ </tr><% end %>
53
+ </tbody>
54
+ </table>
55
+ <% else %>
56
+ <table class="index" width="545">
57
+ <thead>
58
+ <tr>
59
+ <th>
60
+ <%= t("supplier_name") %>
61
+ </th>
62
+ <th>
63
+ <%= t("notes") %>
64
+ </th>
65
+ <th>
66
+ Actions
67
+ </th>
68
+ <th>
69
+ Featured
70
+ </th>
71
+ </tr>
72
+ </thead>
73
+ <tbody>
74
+ <tr>
75
+ <td>
76
+ <%= link_to @supplier.title, edit_admin_supplier_path(@supplier) %>
77
+ </td>
78
+ <td>
79
+ <%= truncate(@supplier.notes, :length => 50) %>
80
+ </td>
81
+ <td class='actions'>
82
+ <%= link_to_edit @supplier, :class => 'edit' %>
83
+ </td>
84
+ <td>
85
+ <% if @supplier.featured %>
86
+ Yes
87
+ <% else %>
88
+ No
89
+ <% end %>
90
+ </td>
91
+ </tr>
92
+ </tbody>
93
+ </table>
94
+ <% end %>
95
+ <% if current_user.has_role?("admin") %>
96
+ <%= link_to t("new_supplier"), new_object_url %>
97
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <table class="index">
2
+ <tbody id='line-items'>
3
+ <tr>
4
+ <th><%= t('item_description') %></th>
5
+ <th class="supplier"><%= t('supplier_name') %></th>
6
+ <th class="price"><%= t('price') %></th>
7
+ <th class="qty"><%= t('qty') %></th>
8
+ <th class="total_display"><span><%= t('total') %></span></th>
9
+ </tr>
10
+ <% @order.line_items.each do |item| %>
11
+ <tr >
12
+ <td width="300"><%=item.variant.product.name-%> <%= "(" + variant_options(item.variant) + ")" unless item.variant .option_values.empty? %></td>
13
+ <td valign="top"><%=item.variant.product.supplier.name if item.variant.product.supplier -%></td>
14
+ <td valign="top"><%= number_to_currency item.price -%></td>
15
+ <td valign="top"><%=item.quantity-%></td>
16
+ <td valign="top" class="total_display"><span><%= number_to_currency (item.price * item.quantity)-%></span></td>
17
+ </tr>
18
+ <% end %>
19
+ </tbody>
20
+ </table>
@@ -0,0 +1,13 @@
1
+ <%= render :partial => 'admin/shared/configuration_menu' %>
2
+
3
+ <h1><%= t("new_supplier") %></h1>
4
+
5
+ <%= form_for @supplier, :url => collection_url, :html => { :multipart => true } do |f| %>
6
+ <%= render :partial => "form", :locals => { :f => f } %>
7
+
8
+ <p class="form-buttons">
9
+ <%= button t("new") %>
10
+ <%= t('or') %> <%= link_to t("cancel"), "#", :id => "cancel_link" %>
11
+ </p>
12
+ <% end %>
13
+
@@ -0,0 +1 @@
1
+ <%= render :partial => "suppliers_table", :locals => {:supplier => @supplier} %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "suppliers_table", :locals => {:supplier => @supplier} %>
@@ -0,0 +1,40 @@
1
+ <%= render :partial => 'admin/suppliers/supplier_tabs', :locals => {:current => "Taxons"} %>
2
+
3
+ <div id="selected-taxons">
4
+ <%= render :partial => "taxon_table", :locals => {:taxons => @taxons} %>
5
+ </div>
6
+
7
+ <%= form_tag('#') do %>
8
+ <label><%= t('search') %>:</label>
9
+ <input id="searchtext" size="25">
10
+ <% end %>
11
+
12
+ <%= javascript_tag do %>
13
+ function search_for_taxons(){
14
+ jQuery.ajax({
15
+ data: {q: jQuery("#searchtext").val() },
16
+ dataType: 'script',
17
+ success: function(request){
18
+ jQuery('#search_hits').html(request);
19
+ },
20
+ type: 'post',
21
+ url: '<%= available_admin_supplier_taxons_url(@supplier) %>'
22
+ });
23
+ }
24
+
25
+ jQuery("#searchtext").keypress(function (e) {
26
+ if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
27
+ search_for_taxons();
28
+
29
+ return false;
30
+ } else {
31
+ return true;
32
+ }
33
+ });
34
+
35
+ jQuery("#searchtext").delayedObserver(function() {
36
+ search_for_taxons();
37
+ }, 0.75);
38
+ <% end %>
39
+ <br/>
40
+ <div id="search_hits"></div>
@@ -0,0 +1,2 @@
1
+ <%= render :partial => "supplier", :locals => {:supplier => @supplier} %>
2
+ <%= link_to "Edit Profile", edit_admin_supplier_path(@supplier) %>
@@ -0,0 +1,47 @@
1
+
2
+ <% @invoices.each do |invoice| %>
3
+
4
+ <div class="supplier_invoice">
5
+ <h3><%= invoice.supplier.title %></h3>
6
+ <table class="index">
7
+ <tr>
8
+ <th>Product Name</th>
9
+ <th>Product price</th>
10
+ <th>Quantity</th>
11
+ <th>Totals</th>
12
+ </tr>
13
+
14
+ <% invoice.invoice_items.each do |item| %>
15
+ <tr bgcolor="#F9FFB9">
16
+ <td width="600px"><%= item.line_item.product.name %> <%= "(" + variant_options(item.line_item.variant) + ")" unless item.line_item.variant.option_values.empty? %></td>
17
+ <td width="150px"><%= number_to_currency(item.line_item.variant.price) %></td>
18
+ <td width="75px"><%= item.quantity %></td>
19
+ <td><%= number_to_currency(item.line_item.variant.price * item.quantity) %></td>
20
+ </tr>
21
+ <% end %>
22
+ <tr>
23
+ <td>Order-total</td>
24
+ <td></td>
25
+ <td></td>
26
+ <td><%= number_to_currency(invoice.invoice_total) %></td>
27
+ </tr>
28
+ <tr>
29
+ <td>-(fee)</td>
30
+ <td></td>
31
+ <td></td>
32
+ <td><%= number_to_currency(invoice.invoice_total * @fee) %></td>
33
+ </tr>
34
+ <tr>
35
+ <td>Sub-total</td>
36
+ <td></td>
37
+ <td></td>
38
+ <td><%= number_to_currency(invoice.invoice_total * (1 - @fee)) %></td>
39
+ </tr>
40
+
41
+ </table>
42
+ </div>
43
+ <% end %>
44
+
45
+
46
+
47
+