vyapari 0.1.4 → 0.1.5dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/vyapari/sample_stock_bundle.csv +1 -0
  3. data/app/controllers/vyapari/admin/base_controller.rb +10 -0
  4. data/app/controllers/vyapari/admin/brands_controller.rb +99 -0
  5. data/app/controllers/vyapari/admin/categories_controller.rb +115 -0
  6. data/app/controllers/vyapari/admin/countries_controller.rb +2 -2
  7. data/app/controllers/vyapari/admin/dashboard_controller.rb +3 -1
  8. data/app/controllers/vyapari/admin/exchange_rates_controller.rb +2 -2
  9. data/app/controllers/vyapari/admin/products_controller.rb +79 -0
  10. data/app/controllers/vyapari/admin/regions_controller.rb +1 -1
  11. data/app/controllers/vyapari/admin/resource_controller.rb +1 -0
  12. data/app/controllers/vyapari/admin/stores_controller.rb +67 -0
  13. data/app/controllers/vyapari/admin/suppliers_controller.rb +67 -0
  14. data/app/controllers/vyapari/admin/terminals_controller.rb +150 -0
  15. data/app/controllers/vyapari/application_controller.rb +12 -0
  16. data/app/controllers/vyapari/store_manager/base_controller.rb +28 -0
  17. data/app/controllers/vyapari/store_manager/dashboard_controller.rb +30 -0
  18. data/app/controllers/vyapari/store_manager/resource_controller.rb +17 -0
  19. data/app/controllers/vyapari/store_manager/stock_bundles_controller.rb +206 -0
  20. data/app/controllers/vyapari/store_manager/stock_entries_controller.rb +161 -0
  21. data/app/controllers/vyapari/terminal_staff/base_controller.rb +29 -0
  22. data/app/controllers/vyapari/terminal_staff/dashboard_controller.rb +29 -0
  23. data/app/controllers/vyapari/terminal_staff/invoices_controller.rb +138 -0
  24. data/app/controllers/vyapari/terminal_staff/line_items_controller.rb +123 -0
  25. data/app/controllers/vyapari/terminal_staff/resource_controller.rb +17 -0
  26. data/app/controllers/vyapari/user_dashboard_controller.rb +31 -0
  27. data/app/models/brand.rb +63 -10
  28. data/app/models/category.rb +60 -16
  29. data/app/models/country.rb +27 -5
  30. data/app/models/exchange_rate.rb +31 -6
  31. data/app/models/image/brand_image.rb +3 -0
  32. data/app/models/image/category_image.rb +3 -0
  33. data/app/models/image/product_image.rb +3 -0
  34. data/app/models/invoice.rb +223 -0
  35. data/app/models/line_item.rb +206 -0
  36. data/app/models/product.rb +67 -13
  37. data/app/models/region.rb +26 -3
  38. data/app/models/stock_bundle.rb +249 -0
  39. data/app/models/stock_entry.rb +271 -0
  40. data/app/models/store.rb +216 -0
  41. data/app/models/supplier.rb +85 -0
  42. data/app/models/terminal.rb +158 -0
  43. data/app/models/vyapari/application_record.rb +4 -0
  44. data/app/uploaders/brand_image_uploader.rb +14 -0
  45. data/app/uploaders/category_image_uploader.rb +14 -0
  46. data/app/uploaders/product_image_uploader.rb +14 -0
  47. data/app/uploaders/stock_bundle_uploader.rb +10 -0
  48. data/app/views/layouts/kuppayam/_footer.html.erb +1 -1
  49. data/app/views/layouts/kuppayam/_sidebar.html.erb +45 -44
  50. data/app/views/layouts/vyapari/_store_manager_menu.html.erb +107 -0
  51. data/app/views/layouts/vyapari/_terminal_staff_menu.html.erb +103 -0
  52. data/app/views/layouts/vyapari/store_manager.html.erb +112 -0
  53. data/app/views/layouts/vyapari/terminal_staff.html.erb +116 -0
  54. data/app/views/vyapari/admin/brands/_form.html.erb +23 -0
  55. data/app/views/vyapari/admin/brands/_index.html.erb +89 -0
  56. data/app/views/vyapari/admin/brands/_row.html.erb +63 -0
  57. data/app/views/vyapari/admin/brands/_show.html.erb +104 -0
  58. data/app/views/vyapari/admin/brands/index.html.erb +48 -0
  59. data/app/views/vyapari/admin/categories/_form.html.erb +28 -0
  60. data/app/views/vyapari/admin/categories/_index.html.erb +101 -0
  61. data/app/views/vyapari/admin/categories/_row.html.erb +69 -0
  62. data/app/views/vyapari/admin/categories/_show.html.erb +115 -0
  63. data/app/views/vyapari/admin/{users → categories}/index.html.erb +8 -24
  64. data/app/views/vyapari/admin/countries/_index.html.erb +1 -1
  65. data/app/views/vyapari/admin/countries/index.html.erb +19 -3
  66. data/app/views/vyapari/admin/exchange_rates/_form.html.erb +3 -4
  67. data/app/views/vyapari/admin/exchange_rates/_index.html.erb +7 -7
  68. data/app/views/vyapari/admin/exchange_rates/_row.html.erb +3 -3
  69. data/app/views/vyapari/admin/exchange_rates/_show.html.erb +1 -0
  70. data/app/views/vyapari/admin/exchange_rates/index.html.erb +19 -3
  71. data/app/views/vyapari/admin/products/_form.html.erb +32 -0
  72. data/app/views/vyapari/admin/products/_index.html.erb +58 -0
  73. data/app/views/vyapari/admin/products/_row.html.erb +30 -0
  74. data/app/views/vyapari/admin/products/_show.html.erb +81 -0
  75. data/app/views/vyapari/admin/products/index.html.erb +48 -0
  76. data/app/views/vyapari/admin/regions/_index.html.erb +1 -1
  77. data/app/views/vyapari/admin/regions/index.html.erb +19 -3
  78. data/app/views/vyapari/admin/stores/_form.html.erb +37 -0
  79. data/app/views/vyapari/admin/stores/_index.html.erb +84 -0
  80. data/app/views/vyapari/admin/stores/_row.html.erb +55 -0
  81. data/app/views/vyapari/admin/stores/_show.html.erb +110 -0
  82. data/app/views/vyapari/admin/stores/index.html.erb +48 -0
  83. data/app/views/vyapari/admin/suppliers/_form.html.erb +32 -0
  84. data/app/views/vyapari/admin/suppliers/_index.html.erb +58 -0
  85. data/app/views/vyapari/admin/suppliers/_row.html.erb +30 -0
  86. data/app/views/vyapari/admin/suppliers/_show.html.erb +81 -0
  87. data/app/views/vyapari/admin/suppliers/index.html.erb +48 -0
  88. data/app/views/vyapari/admin/terminals/_form.html.erb +24 -0
  89. data/app/views/vyapari/admin/terminals/_index.html.erb +75 -0
  90. data/app/views/vyapari/admin/terminals/_row.html.erb +49 -0
  91. data/app/views/vyapari/admin/terminals/_show.html.erb +74 -0
  92. data/app/views/vyapari/store_manager/dashboard/index.html.erb +93 -0
  93. data/app/views/vyapari/store_manager/stock_bundles/_form.html.erb +99 -0
  94. data/app/views/vyapari/store_manager/stock_bundles/_index.html.erb +74 -0
  95. data/app/views/vyapari/store_manager/stock_bundles/_row.html.erb +44 -0
  96. data/app/views/vyapari/store_manager/stock_bundles/_show.html.erb +110 -0
  97. data/app/views/vyapari/store_manager/stock_bundles/create.html.erb +57 -0
  98. data/app/views/vyapari/store_manager/stock_bundles/index.html.erb +36 -0
  99. data/app/views/vyapari/store_manager/stock_bundles/update.html.erb +57 -0
  100. data/app/views/vyapari/store_manager/stock_entries/_form.html.erb +50 -0
  101. data/app/views/vyapari/store_manager/stock_entries/_index.html.erb +80 -0
  102. data/app/views/vyapari/store_manager/stock_entries/_row.html.erb +33 -0
  103. data/app/views/vyapari/store_manager/stock_entries/_show.html.erb +110 -0
  104. data/app/views/vyapari/store_manager/stock_entries/_stock_bundle.html.erb +61 -0
  105. data/app/views/vyapari/store_manager/stock_entries/index.html.erb +45 -0
  106. data/app/views/vyapari/terminal_staff/dashboard/_counts.html.erb +88 -0
  107. data/app/views/vyapari/terminal_staff/dashboard/_invoices.html.erb +37 -0
  108. data/app/views/vyapari/terminal_staff/dashboard/index.html.erb +36 -0
  109. data/app/views/vyapari/terminal_staff/invoices/_draft.html.erb +62 -0
  110. data/app/views/vyapari/terminal_staff/invoices/_form.html.erb +120 -0
  111. data/app/views/vyapari/terminal_staff/invoices/_index.html.erb +64 -0
  112. data/app/views/vyapari/terminal_staff/invoices/_row.html.erb +33 -0
  113. data/app/views/vyapari/terminal_staff/invoices/_show.html.erb +171 -0
  114. data/app/views/vyapari/terminal_staff/invoices/index.html.erb +37 -0
  115. data/app/views/vyapari/terminal_staff/invoices/new.js.erb +13 -0
  116. data/app/views/vyapari/terminal_staff/invoices/show.html.erb +1 -0
  117. data/app/views/vyapari/terminal_staff/line_items/_form.html.erb +40 -0
  118. data/app/views/vyapari/terminal_staff/line_items/_index.html.erb +94 -0
  119. data/app/views/vyapari/terminal_staff/line_items/create.js.erb +34 -0
  120. data/app/views/vyapari/terminal_staff/line_items/destroy.js.erb +25 -0
  121. data/app/views/vyapari/terminal_staff/stores/index.html.erb +24 -0
  122. data/app/views/vyapari/user_dashboard/index.html.erb +51 -0
  123. data/config/routes.rb +62 -5
  124. data/db/import_data/brands.csv +7 -0
  125. data/db/import_data/categories.csv +12 -0
  126. data/db/import_data/countries.csv +1 -0
  127. data/db/import_data/dummy/brands.csv +7 -0
  128. data/db/import_data/dummy/categories.csv +12 -0
  129. data/db/import_data/dummy/countries.csv +1 -0
  130. data/db/import_data/dummy/exchange_rates.csv +5 -0
  131. data/db/import_data/dummy/products-copy.csv +1 -0
  132. data/db/import_data/dummy/products.csv +1 -0
  133. data/db/import_data/dummy/products.xlsx +0 -0
  134. data/db/import_data/dummy/regions.csv +13 -0
  135. data/db/import_data/dummy/stores.csv +10 -0
  136. data/db/import_data/dummy/suppliers.csv +14 -0
  137. data/db/import_data/dummy/terminals.csv +11 -0
  138. data/db/import_data/exchange_rates.csv +5 -0
  139. data/db/import_data/regions.csv +13 -0
  140. data/db/import_data/stores.csv +3 -0
  141. data/db/import_data/suppliers.csv +14 -0
  142. data/db/import_data/terminals.csv +3 -0
  143. data/db/migrate/20170000000200_create_exchange_rates.rb +3 -2
  144. data/db/migrate/20170000000203_create_contacts.rb +22 -0
  145. data/db/migrate/20170000000204_create_bank_accounts.rb +21 -0
  146. data/db/migrate/20170000000205_create_suppliers.rb +18 -0
  147. data/db/migrate/20170000000206_create_stores.rb +21 -0
  148. data/db/migrate/20170000000207_create_terminals.rb +18 -0
  149. data/db/migrate/20170000000210_create_brands.rb +14 -0
  150. data/db/migrate/20170000000211_create_categories.rb +22 -0
  151. data/db/migrate/20170000000212_create_products.rb +29 -0
  152. data/db/migrate/20170000000213_create_invoices.rb +58 -0
  153. data/db/migrate/20170000000215_create_stock_bundles.rb +17 -0
  154. data/db/migrate/20170000000216_create_stock_entries.rb +20 -0
  155. data/db/sample_reports/products.xlsx +0 -0
  156. data/lib/tasks/vyapari/all.rake +73 -0
  157. data/lib/vyapari/version.rb +1 -1
  158. metadata +150 -15
  159. data/app/controllers/vyapari/admin/users_controller.rb +0 -130
  160. data/app/views/vyapari/admin/users/_form.html.erb +0 -39
  161. data/app/views/vyapari/admin/users/_index.html.erb +0 -101
  162. data/app/views/vyapari/admin/users/_row.html.erb +0 -72
  163. data/app/views/vyapari/admin/users/_show.html.erb +0 -199
  164. data/lib/tasks/vyapari_tasks.rake +0 -4
@@ -0,0 +1,99 @@
1
+ <% suppliers = Supplier.select("id, name").order("name ASC").all %>
2
+ <% sample_file_link = "/assets/vyapari/sample_stock_bundle.csv" %>
3
+
4
+ <%= form_for([:store_manager, @stock_bundle], :html => {:id=>"form_stock_bundle", :class=>"mb-0 form-horizontal", :stock_bundle => "form", :method => (@stock_bundle.new_record? ? :post : :put), multipart: true, :target => "iframe_document"}) do |f| %>
5
+
6
+ <div class="dx-warning mt-20" role="alert">
7
+ <p>
8
+ A <strong>Stock bundle</strong> is a collection of stock items you receive from a particular Supplier. To make it work for different suppliers, you should convert the excel / csv file you have received from the supplier to a common format so that the system undersand it.
9
+
10
+ <br><br>
11
+ <strong>Click here to view the
12
+ <%= link_to "Exmaple File", sample_file_link, target: "_blank" %>
13
+ format the system is expecting </strong>
14
+ <br><br>
15
+
16
+ The status of the Job Bunde will be <span class="ml-5 mt-5 label label-white">Pending</span> by default. You can verify it once again after uploading and can change the status to <span class="ml-5 mt-5 label label-success">Approved</span>. However, the system will not allow you to approve if it has any error. The error will be populated in an error file which the system will generate after parsing the uploaded file. It will be available for you to download once it is ready.
17
+
18
+ <br></br>
19
+
20
+ <span class="ml-5 mt-5 label label-danger">Pending</span> Stocks are not included in the reports and not shown on invoice line items.</li>
21
+ <li>You click on edit button in the list view against each stock bundle and reupload the corrected CSV file after rectifying the errors the system has pointed out.
22
+
23
+ <br></br>
24
+
25
+ <b>POINTS TO NOTE:</b>
26
+ <ul>
27
+ <li>Convert your .xlsx or .xls files to CSV format. You can do this easily with <b>Save As</b> Option in Microsoft Excel.</li>
28
+
29
+ <li>Create one <b>FILE</b> for one <b>SUPPLIER</b>.</li>
30
+
31
+ <li>CSV files can be created with Excel. However, do not use sheets / tabs as CSV has only one sheet always.</li>
32
+
33
+ <li>Upload one CSV file at a time (one each for a Supplier / Store combination).</li>
34
+
35
+ </ul>
36
+
37
+ <%= link_to(raw("<i class='fa fa-download mr-10'></i> Download the Sample CSV File"), sample_file_link, class: "btn btn-primary btn-only-hover", target: "_blank") %>
38
+
39
+ </p>
40
+ </div>
41
+
42
+ <% unless @stock_bundle.new_record? %>
43
+ <div class="alert alert-danger alert-dismissible mt-20 hidden" role="alert">
44
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
45
+ <p>
46
+ <b>Warning:</b>This will overwrite the stock entries.
47
+ </p>
48
+ </div>
49
+ <% end %>
50
+
51
+ <% if @store.warehouse? && suppliers.empty? %>
52
+ <div class="alert alert-danger alert-dismissible mt-20" role="alert">
53
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
54
+ <p>
55
+ <b>Warning:</b>You have not added any suppliers. Ask your administrator to add suppliers for the company so that you could upload stock you have received from those suppliers.
56
+ </p>
57
+ </div>
58
+ <% end %>
59
+
60
+ <div id="stock_bundle_form_error">
61
+ <%= @stock_bundle.errors[:base].to_sentence %>
62
+ </div>
63
+
64
+ <div class="form-inputs mb-30 mt-30">
65
+
66
+ <% if @stock_bundle && @stock_bundle.persisted? %>
67
+
68
+ <%= theme_form_group("Supplier", required: false, error_class: "error") do %>
69
+ <%= content_tag :div, @stock_bundle.supplier.try(:name) %>
70
+ <% end %>
71
+
72
+ <%= hidden_field_tag "stock_bundle[supplier_id]", @stock_bundle.supplier_id %>
73
+
74
+ <% else %>
75
+
76
+ <% options = {assoc_collection: suppliers, required: false, editable: true, assoc_display_method: :name} %>
77
+ <%= theme_form_assoc_group(@stock_bundle, :supplier_id, **options) %>
78
+
79
+ <% end %>
80
+
81
+ <%= theme_form_field(@stock_bundle, :name) %>
82
+
83
+ <%= theme_form_field(@stock_bundle, :file, html_options: {type: 'file'}, label: "Upload the Stock file in CSV format", param_name: "stock_bundle[file]") %>
84
+
85
+ </div>
86
+
87
+ <div>
88
+
89
+ <%= submit_tag("Save", :class=>"btn btn-primary pull-right ml-10") %>
90
+
91
+ <%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeLargeModal();", class: "pull-right ml-10 btn btn-white" %>
92
+
93
+ </div>
94
+ <%= clear_tag(10) %>
95
+
96
+ </div>
97
+
98
+ <% end %>
99
+
@@ -0,0 +1,74 @@
1
+ <div class="table-responsive">
2
+ <table class="table table-hover members-table middle-align">
3
+ <thead>
4
+ <tr>
5
+ <th style="text-align: center;width:60px">#</th>
6
+ <th>Name</th>
7
+ <th>Updated Date</th>
8
+ <th>Uploader</th>
9
+ <% if @store.warehouse? %>
10
+ <th>Supplier</th>
11
+ <% end %>
12
+ <!-- <th>Status</th> -->
13
+ <th style="text-align: center;">Actions</th>
14
+ </tr>
15
+ </thead>
16
+
17
+ <tbody>
18
+ <% @stock_bundles.each_with_index do |stock_bundle, i| %>
19
+
20
+ <% edit_link = edit_store_manager_stock_bundle_path(@store, stock_bundle) %>
21
+
22
+ <% delete_link = store_manager_stock_bundle_path(@store, stock_bundle) %>
23
+
24
+ <% show_link = store_manager_stock_bundle_path(@store, stock_bundle) %>
25
+
26
+ <% stock_entries_link = store_manager_stock_entries_path(@store, sb: @stock_bundle_id) %>
27
+
28
+ <tr id="tr_stock_bundle_<%= stock_bundle.id %>">
29
+
30
+ <th scope="row" style="text-align: center;">
31
+ <% if i < 0 %>
32
+ <i class="fa fa-check text-success"></i>
33
+ <% else %>
34
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
35
+ <% end %>
36
+ </th>
37
+
38
+ <td class="stock_bundle-name"><%= link_to stock_bundle.name, stock_entries_link, target: "_blank" %></td>
39
+
40
+ <td class="stock_bundle-name"><%= stock_bundle.uploaded_date.strftime("%m/%d/%Y") %></td>
41
+
42
+ <td class="stock_bundle-name"><%= stock_bundle.uploader.try(:display_name) %></td>
43
+
44
+ <% if @store.warehouse? %>
45
+ <td class="stock_bundle-name"><%= link_to stock_bundle.supplier.try(:name), stock_entries_link if stock_bundle.supplier %></td>
46
+ <% end %>
47
+
48
+ <td class="hidden-sm hidden-xs hidden">
49
+ <% status_hash = {approved: "success", pending: "default", errored: "danger"} %>
50
+ <span class="ml-5 mt-5 label label-<%= status_hash[stock_bundle.status.to_sym] %>"><%= stock_bundle.display_status %></span>
51
+ </td>
52
+
53
+ <td class="action-links" style="width:10%">
54
+
55
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Check Status"), show_link, :remote => true, class: "" %>
56
+
57
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit"), edit_link, :remote => true, class: "edit" %>
58
+
59
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, stock_bundle: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
60
+
61
+ </td>
62
+
63
+ </tr>
64
+ <% end %>
65
+ </tbody>
66
+ </table>
67
+ </div>
68
+
69
+ <div class="row">
70
+ <div class="col-sm-12">
71
+ <%= paginate_kuppayam(@stock_bundles) %>
72
+ </div>
73
+ </div>
74
+
@@ -0,0 +1,44 @@
1
+ <% edit_link = edit_store_manager_stock_bundle_path(@store, stock_bundle) %>
2
+
3
+ <% delete_link = store_manager_stock_bundle_path(@store, stock_bundle) %>
4
+
5
+ <% show_link = store_manager_stock_bundle_path(@store, stock_bundle) %>
6
+
7
+ <% stock_entries_link = store_manager_stock_entries_path(@store, sb: @stock_bundle_id) %>
8
+
9
+ <tr id="tr_stock_bundle_<%= stock_bundle.id %>">
10
+
11
+ <th scope="row" style="text-align: center;">
12
+ <% if i < 0 %>
13
+ <i class="fa fa-check text-success"></i>
14
+ <% else %>
15
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
16
+ <% end %>
17
+ </th>
18
+
19
+ <td class="stock_bundle-name"><%= link_to stock_bundle.display_file_name, stock_entries_link, target: "_blank" %></td>
20
+
21
+ <td class="stock_bundle-name"><%= stock_bundle.uploaded_date.strftime("%m/%d/%Y") %></td>
22
+
23
+ <td class="stock_bundle-name"><%= stock_bundle.uploader.try(:display_name) %></td>
24
+
25
+ <% if @store.warehouse? %>
26
+ <td class="stock_bundle-name"><%= link_to stock_bundle.supplier.try(:name), stock_entries_link if stock_bundle.supplier %></td>
27
+ <% end %>
28
+
29
+ <td class="hidden-sm hidden-xs hidden">
30
+ <% status_hash = {approved: "success", pending: "default", errored: "danger"} %>
31
+ <span class="ml-5 mt-5 label label-<%= status_hash[stock_bundle.status.to_sym] %>"><%= stock_bundle.display_status %></span>
32
+ </td>
33
+
34
+ <td class="action-links" style="width:10%">
35
+
36
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Check Status"), show_link, :remote => true, class: "" %>
37
+
38
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit"), edit_link, :remote => true, class: "edit" %>
39
+
40
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, stock_bundle: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
41
+
42
+ </td>
43
+
44
+ </tr>
@@ -0,0 +1,110 @@
1
+ <%
2
+
3
+ edit_link = edit_store_manager_stock_bundle_path(@store, @stock_bundle)
4
+
5
+ delete_link = store_manager_stock_bundles_path(@store, @stock_bundle)
6
+
7
+ view_stock_link = store_manager_stock_entries_path(@store, sb: @stock_bundle.id)
8
+
9
+ if @stock_bundle.file.file
10
+ download_original_file_link = download_original_file_store_manager_stock_bundle_url(@store, @stock_bundle)
11
+ end
12
+
13
+ if @stock_bundle.error_file.file
14
+ download_error_file_link = download_error_file_store_manager_stock_bundle_url(@store, @stock_bundle)
15
+ end
16
+
17
+ stock_entries_count = @stock_bundle.stock_entries.count
18
+
19
+ if @stock_bundle.error_summary.blank?
20
+ widget_class = "xe-counter-green"
21
+ widget_icon = "fa-check"
22
+ panel_heading = "Uploaded Successfully"
23
+ panel_class = "panel-success"
24
+ else
25
+ widget_class = "xe-counter-red"
26
+ widget_icon = "fa-exclamation-triangle"
27
+ panel_heading = "Parse Error"
28
+ panel_class = "panel-red"
29
+ end
30
+
31
+ %>
32
+
33
+ <%# main_app.url_for([:edit, scope, :image, id: image_object.id, imageable_id: object.id, imageable_type: object.class.to_s, image_type: image_object.class.name]) %>
34
+
35
+ <div id="div_stock_bundle_status">
36
+
37
+ <div class="row">
38
+
39
+ <div class="col-md-3 col-sm-12 col-xs-12" style="border-right:1px solid #f1f1f1;">
40
+
41
+ <div class="visible-sm visible-xs mt-50"></div>
42
+
43
+ <div class="xe-widget xe-vertical-counter xe-vertical-counter-primary" data-count=".num" data-from="0" data-to="442" data-suffix=" TB" data-duration="5">
44
+ <div class="xe-icon">
45
+ <i class="linecons-truck"></i>
46
+ </div>
47
+
48
+ <div class="xe-label">
49
+ <strong class="num"><%= stock_entries_count %></strong>
50
+ <span>Product Items</span>
51
+ </div>
52
+ </div>
53
+
54
+ <%= clear_tag(10) %>
55
+
56
+ <div class="visible-sm visible-xs mb-50"></div>
57
+
58
+ </div>
59
+
60
+ <div class="col-md-6 col-sm-12 col-xs-12" style="border-right:1px solid #f1f1f1;">
61
+
62
+ <div class="visible-sm visible-xs mt-50"></div>
63
+
64
+ <div class="xe-widget xe-counter <%= widget_class %>" data-count=".num" data-from="0" data-to="57" data-prefix="-," data-suffix="%" data-duration="5" data-easing="true" data-delay="1">
65
+ <div class="xe-icon">
66
+ <i class="<%= widget_icon %>"></i>
67
+ </div>
68
+ <div class="xe-label">
69
+ <strong class="num"><%= @stock_bundle.display_name %></strong>
70
+ <span><strong style="font-size:16px;"><%= @stock_bundle.store.try(:name) %></strong></span>
71
+ <span>Uploaded By: <%= @stock_bundle.uploader.try(:name) %></span>
72
+ </div>
73
+ </div>
74
+
75
+ <%= clear_tag(10) %>
76
+
77
+ <% unless @stock_bundle.error_summary.blank? %>
78
+ <div class="alert alert-danger alert-dismissible mt-20" role="alert">
79
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
80
+ <p><b>Error:</b> <%= @stock_bundle.error_summary %></p>
81
+ </div>
82
+ <% end %>
83
+
84
+ <div class="visible-sm visible-xs mb-50"></div>
85
+
86
+ </div>
87
+
88
+ <div class="col-md-3 col-sm-12 col-xs-12">
89
+
90
+ <%= link_to(raw("<i class='fa fa-edit mr-10'></i> View Stock Entries"), view_stock_link, class: "pull-left btn btn-secondary btn-block", target: "_blank") %>
91
+
92
+ <%= link_to(raw("<i class='fa fa-edit mr-10'></i> Re-Upload"), edit_link, class: "pull-left btn btn-primary btn-block btn-only-hover", remote: true) %>
93
+
94
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete this Stock Bundle"), delete_link, method: :delete, stock_bundle: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "pull-right btn btn-danger btn-block btn-only-hover" if @stock_bundle.can_be_deleted? && @current_user.super_admin? %>
95
+
96
+ <%= link_to(raw("<i class='fa fa-search mr-10'></i> Inspect errors"), download_error_file_link, class: "pull-left btn btn-block btn-primary") if @stock_bundle.error_file.try(:file) %>
97
+
98
+ <%= link_to(raw("<i class='fa fa-download mr-10'></i> Download Original File"), download_original_file_link, class: "pull-left btn btn-primary btn-block btn-only-hover") if @stock_bundle.file %>
99
+
100
+ <div class="visible-sm visible-xs mb-50"></div>
101
+
102
+ </div>
103
+
104
+ </div>
105
+
106
+ <%= link_to "Close", "#", onclick: "closeLargeModal();", class: "btn btn-primary pull-right" %>
107
+
108
+ <%= clear_tag %>
109
+
110
+ </div>
@@ -0,0 +1,57 @@
1
+ <%= content_for :javascript_footer do %>
2
+ <script type="text/javascript">
3
+
4
+ <% if @stock_bundle.errors.blank? %>
5
+
6
+ <% if @stock_bundle.error_summary.blank? %>
7
+
8
+ //var stockEntriesUrl = "<%= store_manager_stock_entries_url(@stock_bundle.store, sb: @stock_bundle.id) %>";
9
+ //window.parent.location.replace(stockEntriesUrl);
10
+
11
+ heading = "Stock Bundle Uploaded Successfully!";
12
+ bodyContent = "<%= escape_javascript(render(:partial=>"/vyapari/store_manager/stock_bundles/show")) %>";
13
+ window.parent.showLargeModal(heading, bodyContent, false);
14
+
15
+ // Showing Growl Like Message
16
+ //notifySuccess("<%= escape_javascript(@notification[:title]) %>", "<%= escape_javascript(@notification[:message]) %>");
17
+
18
+ <% else %>
19
+
20
+ heading = "Stock Bundle Uploaded with Errors";
21
+ bodyContent = "<%= escape_javascript(render(:partial=>"/vyapari/store_manager/stock_bundles/show")) %>";
22
+
23
+ window.parent.showLargeModal(heading, bodyContent, false);
24
+
25
+ // Showing Growl Like Message
26
+ //notifyError("<%= escape_javascript(@notification[:title]) %>", "<%= escape_javascript(@notification[:message]) %>");
27
+
28
+ <% end %>
29
+
30
+ // Inserting the row on top of the table and highlighting it
31
+ window.parent.$('#div_stock_bundle_index table > tbody').prepend("<%= escape_javascript(render(:partial=>"/vyapari/store_manager/stock_bundles/row", locals: {stock_bundle: @stock_bundle, i: -1})) %>");
32
+
33
+ window.parent.$("#tr_stock_bundle_<%= @stock_bundle.id %>").css("background-color", "#fffddd");
34
+
35
+ <% else %>
36
+
37
+ heading = "Upload Stock Bundle (CSV Format)";
38
+ bodyContent = "<%= escape_javascript(render(:partial=>"/vyapari/store_manager/stock_bundles/form")) %>";
39
+
40
+ window.parent.showLargeModal(heading, bodyContent);
41
+
42
+ <%
43
+ text = "You have few errors. All fields are mandatory."
44
+ error_message = content_tag(:div, text, class: "alert alert-danger")
45
+ %>
46
+
47
+ $("#stock_bundle_form_error", window.parent.document).html("<%= escape_javascript(error_message) %>");
48
+
49
+ $("#form_stock_bundle > div > div.panel-footer.clearfix > div > input", window.parent.document).replaceWith("<%= escape_javascript(theme_form_button(@stock_bundle)) %>");
50
+
51
+ <% end %>
52
+
53
+ $.rails.handleRemote($("a[data-remote]"));
54
+
55
+ </script>
56
+ <% end %>
57
+
@@ -0,0 +1,36 @@
1
+ <div class="row">
2
+
3
+ <div class="col-md-12">
4
+
5
+ <ul class="nav nav-tabs">
6
+ </ul>
7
+ <div class="tab-content">
8
+ <div class="tab-pane active">
9
+
10
+ <div id="div_stock_bundle_action_buttons">
11
+ <div class="row">
12
+ <div class="col-md-6">
13
+
14
+ <%= theme_button('Import Stock', 'plus', new_store_manager_stock_bundle_path(@store), classes: "pull-left", btn_type: "success") %>
15
+
16
+ <%= theme_button('Refresh', 'refresh', store_manager_stock_bundles_path(@store), classes: "pull-left ml-10", btn_type: "white") %>
17
+
18
+ </div>
19
+ <div class="col-md-6">
20
+ <%= search_form_kuppayam(StockBundle, store_manager_stock_bundles_path(@store), text: @filters[:query]) %>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ <%= clear_tag(10) %>
25
+
26
+ <div id="div_stock_bundle_index">
27
+ <%= render :partial=>"vyapari/store_manager/stock_bundles/index" %>
28
+ </div>
29
+ <%= clear_tag(10) %>
30
+
31
+ </div>
32
+ </div>
33
+
34
+ </div>
35
+
36
+ </div>
@@ -0,0 +1,57 @@
1
+ <%= content_for :javascript_footer do %>
2
+ <script type="text/javascript">
3
+
4
+ <% if @stock_bundle.errors.blank? %>
5
+
6
+ <% if @stock_bundle.error_summary.blank? %>
7
+
8
+ //var stockEntriesUrl = "<%= store_manager_stock_entries_url(@stock_bundle.store, sb: @stock_bundle.id) %>";
9
+ //window.parent.location.replace(stockEntriesUrl);
10
+
11
+ heading = "Stock Bundle Uploaded Successfully!";
12
+ bodyContent = "<%= escape_javascript(render(:partial=>"/vyapari/store_manager/stock_bundles/show")) %>";
13
+ window.parent.showLargeModal(heading, bodyContent, false);
14
+
15
+ // Showing Growl Like Message
16
+ //notifySuccess("<%= escape_javascript(@notification[:title]) %>", "<%= escape_javascript(@notification[:message]) %>");
17
+
18
+ <% else %>
19
+
20
+ heading = "Stock Bundle Uploaded with Errors";
21
+ bodyContent = "<%= escape_javascript(render(:partial=>"/vyapari/store_manager/stock_bundles/show")) %>";
22
+
23
+ window.parent.showLargeModal(heading, bodyContent, false);
24
+
25
+ // Showing Growl Like Message
26
+ //notifyError("<%= escape_javascript(@notification[:title]) %>", "<%= escape_javascript(@notification[:message]) %>");
27
+
28
+ <% end %>
29
+
30
+ // Inserting the row on top of the table and highlighting it
31
+ window.parent.$('#div_stock_bundle_index table > tbody').prepend("<%= escape_javascript(render(:partial=>"/vyapari/store_manager/stock_bundles/row", locals: {stock_bundle: @stock_bundle, i: -1})) %>");
32
+
33
+ window.parent.$("#tr_stock_bundle_<%= @stock_bundle.id %>").css("background-color", "#fffddd");
34
+
35
+ <% else %>
36
+
37
+ heading = "Upload Stock Bundle (CSV Format)";
38
+ bodyContent = "<%= escape_javascript(render(:partial=>"/vyapari/store_manager/stock_bundles/form")) %>";
39
+
40
+ window.parent.showLargeModal(heading, bodyContent);
41
+
42
+ <%
43
+ text = "You have few errors. All fields are mandatory."
44
+ error_message = content_tag(:div, text, class: "alert alert-danger")
45
+ %>
46
+
47
+ $("#stock_bundle_form_error", window.parent.document).html("<%= escape_javascript(error_message) %>");
48
+
49
+ $("#form_stock_bundle > div > div.panel-footer.clearfix > div > input", window.parent.document).replaceWith("<%= escape_javascript(theme_form_button(@stock_bundle)) %>");
50
+
51
+ <% end %>
52
+
53
+ $.rails.handleRemote($("a[data-remote]"));
54
+
55
+ </script>
56
+ <% end %>
57
+
@@ -0,0 +1,50 @@
1
+ <% suppliers = Supplier.select("id, name").order("name ASC").all %>
2
+
3
+ <%= form_for([:store_manager, @stock_entry], :html => {:id=>"form_stock_entry", :class=>"mb-0 form-horizontal", :stock_entry => "form", :method => (@stock_entry.new_record? ? :post : :put), :remote=>true}) do |f| %>
4
+
5
+ <% if suppliers.empty? %>
6
+ <div class="alert alert-danger alert-dismissible" role="alert">
7
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
8
+ <p>
9
+ <b>Warning:</b>You have not added any suppliers. Ask your administrator to add suppliers for the company so that you could upload stock you have received from those suppliers.
10
+ </p>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div id="stock_entry_form_error">
15
+ <%= @stock_entry.errors[:base].to_sentence %>
16
+ </div>
17
+
18
+ <div class="form-inputs mb-30 mt-30">
19
+
20
+ <% if @stock_bundle && @stock_bundle.persisted? %>
21
+
22
+ <%= theme_form_group("Supplier", required: true, error_class: "error") do %>
23
+ <%= content_tag :div, @stock_bundle.supplier.try(:name) %>
24
+ <% end %>
25
+ <%= hidden_field_tag "stock_bundle[supplier_id]", @stock_bundle.supplier_id %>
26
+
27
+ <% else %>
28
+
29
+ <% options = {assoc_collection: suppliers, required: true, editable: true, assoc_display_method: :name} %>
30
+ <%= theme_form_assoc_group(@stock_bundle, :supplier_id, **options) %>
31
+
32
+ <% end %>
33
+
34
+ <%= theme_form_field(@stock_bundle, :file, html_options: {type: 'file'}, label: "Upload the Stock file in CSV format", param_name: "stock_bundle[file]") %>
35
+
36
+ </div>
37
+
38
+ <div>
39
+
40
+ <%= submit_tag("Save", :class=>"btn btn-primary pull-right ml-10") %>
41
+
42
+ <%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeLargeModal();", class: "pull-right ml-10 btn btn-white" %>
43
+
44
+ </div>
45
+ <%= clear_tag(10) %>
46
+
47
+ </div>
48
+
49
+ <% end %>
50
+
@@ -0,0 +1,80 @@
1
+ <div class="table-responsive">
2
+ <table class="table table-hover members-table middle-align">
3
+ <thead>
4
+ <tr>
5
+ <th style="text-align: center;width:60px">#</th>
6
+ <th>Product Name</th>
7
+ <th style="width:15%;text-align: center;">EAN/SKU</th>
8
+ <th style="text-align: right;">PP</th>
9
+ <th style="text-align: right;">LP</th>
10
+ <th style="text-align: right;">SP</th>
11
+ <th style="text-align: right;">RP</th>
12
+ <th style="text-align: center;">Quantity</th>
13
+ <th>Status</th>
14
+ <th style="text-align: center;">Actions</th>
15
+ </tr>
16
+ </thead>
17
+
18
+ <tbody>
19
+ <% @stock_entries.each_with_index do |stock_entry, i| %>
20
+
21
+ <% edit_link = edit_store_manager_stock_entry_path(@store, stock_entry) %>
22
+
23
+ <% delete_link = store_manager_stock_entries_path(@store, stock_entry) %>
24
+
25
+ <tr id="tr_stock_entry_<%= stock_entry.id %>">
26
+
27
+ <th scope="row" style="text-align: center;">
28
+ <% if i < 0 %>
29
+ <i class="fa fa-check text-success"></i>
30
+ <% else %>
31
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
32
+ <% end %>
33
+ </th>
34
+
35
+ <td class="stock_entry-name"><%= link_to stock_entry.product.name, store_manager_stock_entries_path(@store, stock_entry), remote: true %></td>
36
+
37
+ <td class="stock_entry-name" style="text-align: center;"><%= link_to stock_entry.product.ean_sku, store_manager_stock_entries_path(@store, stock_entry), remote: true %></td>
38
+
39
+ <td class="stock_entry-name" style="text-align: right;">
40
+ <%= number_to_currency stock_entry.product.purchased_price, unit: "" %>
41
+ </td>
42
+
43
+ <td class="stock_entry-name" style="text-align: right;">
44
+ <%= number_to_currency stock_entry.product.landed_price, unit: "" %>
45
+ </td>
46
+
47
+ <td class="stock_entry-name" style="text-align: right;">
48
+ <%= number_to_currency stock_entry.product.selling_price, unit: "" %>
49
+ </td>
50
+
51
+ <td class="stock_entry-name" style="text-align: right;">
52
+ <%= number_to_currency stock_entry.product.retail_price, unit: "" %>
53
+ </td>
54
+
55
+ <td class="stock_entry-name" style="text-align: center;">
56
+ <%= stock_entry.quantity %>
57
+ </td>
58
+
59
+ <td class="stock_entry-name"><%= stock_entry.display_status %></td>
60
+
61
+ <td class="action-links" style="width:10%">
62
+
63
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit"), edit_link, :remote=>true, class: "edit" %>
64
+
65
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, stock_entry: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
66
+
67
+ </td>
68
+
69
+ </tr>
70
+ <% end %>
71
+ </tbody>
72
+ </table>
73
+ </div>
74
+
75
+ <div class="row">
76
+ <div class="col-sm-12">
77
+ <%= paginate_kuppayam(@stock_entries) %>
78
+ </div>
79
+ </div>
80
+
@@ -0,0 +1,33 @@
1
+ <% edit_link = edit_store_manager_stock_entry_path(@store, stock_entry) %>
2
+
3
+ <% delete_link = store_manager_stock_entries_path(@store, stock_entry) %>
4
+
5
+ <tr id="tr_stock_entry_<%= stock_entry.id %>">
6
+
7
+ <th scope="row" style="text-align: center;">
8
+ <% if i < 0 %>
9
+ <i class="fa fa-check text-success"></i>
10
+ <% else %>
11
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
12
+ <% end %>
13
+ </th>
14
+
15
+ <td class="stock_entry-name"><%= link_to stock_entry.id, store_manager_stock_entries_path(@store, stock_entry), remote: true %></td>
16
+
17
+ <td class="stock_entry-name"><%= link_to stock_entry.code, store_manager_stock_entries_path(@store, stock_entry), remote: true %></td>
18
+
19
+ <td class="stock_entry-name"><%= link_to stock_entry.display_stock_entry_type, store_manager_stock_entries_path(@store, stock_entry), remote: true %></td>
20
+
21
+ <td class="stock_entry-name"><%= link_to stock_entry.region.try(:name), store_manager_stock_entries_path(@store, stock_entry), remote: true %></td>
22
+
23
+ <td class="stock_entry-name"><%= link_to stock_entry.country.try(:name), store_manager_stock_entries_path(@store, stock_entry), remote: true %></td>
24
+
25
+ <td class="action-links" style="width:10%">
26
+
27
+ <%= link_to raw("<i class=\"linecons-pencil\"></i> Edit"), edit_link, :remote=>true, class: "edit" %>
28
+
29
+ <%= link_to raw("<i class=\"linecons-trash\"></i> Delete"), delete_link, method: :delete, stock_entry: "menuitem", tabindex: "-1", data: { confirm: 'Are you sure?' }, :remote=>true, class: "delete" %>
30
+
31
+ </td>
32
+
33
+ </tr>