smerp-quotation-engine 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +10 -0
  5. data/app/assets/config/smerp_quotation_engine_manifest.js +1 -0
  6. data/app/assets/stylesheets/smerp/quotation/engine/application.css +15 -0
  7. data/app/controllers/smerp/quotation/engine/application_controller.rb +9 -0
  8. data/app/controllers/smerp/quotation/engine/quotation_item_groups_controller.rb +70 -0
  9. data/app/controllers/smerp/quotation/engine/quotation_items_controller.rb +237 -0
  10. data/app/controllers/smerp/quotation/engine/quotation_product_categories_controller.rb +60 -0
  11. data/app/controllers/smerp/quotation/engine/quotation_products_controller.rb +60 -0
  12. data/app/controllers/smerp/quotation/engine/quotations_controller.rb +192 -0
  13. data/app/helpers/smerp/quotation/engine/application_helper.rb +29 -0
  14. data/app/helpers/smerp/quotation/engine/quotation_item_groups_helper.rb +4 -0
  15. data/app/helpers/smerp/quotation/engine/quotation_items_helper.rb +4 -0
  16. data/app/helpers/smerp/quotation/engine/quotation_product_categories_helper.rb +4 -0
  17. data/app/helpers/smerp/quotation/engine/quotation_products_helper.rb +4 -0
  18. data/app/helpers/smerp/quotation/engine/quotations_helper.rb +81 -0
  19. data/app/jobs/smerp/quotation/engine/application_job.rb +8 -0
  20. data/app/mailers/smerp/quotation/engine/application_mailer.rb +10 -0
  21. data/app/models/smerp/quotation/engine/application_record.rb +9 -0
  22. data/app/models/smerp/quotation/engine/quotation.rb +11 -0
  23. data/app/models/smerp/quotation/engine/quotation_item.rb +34 -0
  24. data/app/models/smerp/quotation/engine/quotation_item_group.rb +10 -0
  25. data/app/models/smerp/quotation/engine/quotation_product.rb +30 -0
  26. data/app/models/smerp/quotation/engine/quotation_product_category.rb +11 -0
  27. data/app/views/layouts/smerp/quotation/engine/application.html.erb +15 -0
  28. data/app/views/smerp/quotation/engine/_new_quotation_item_form.html.erb +48 -0
  29. data/app/views/smerp/quotation/engine/extended_calculators/extended_calculators.html.erb +36 -0
  30. data/app/views/smerp/quotation/engine/quotation_item_groups/_form.html.erb +17 -0
  31. data/app/views/smerp/quotation/engine/quotation_item_groups/_quotation_item_group.html.erb +2 -0
  32. data/app/views/smerp/quotation/engine/quotation_item_groups/edit.html.erb +10 -0
  33. data/app/views/smerp/quotation/engine/quotation_item_groups/index.html.erb +14 -0
  34. data/app/views/smerp/quotation/engine/quotation_item_groups/new.html.erb +9 -0
  35. data/app/views/smerp/quotation/engine/quotation_item_groups/show.html.erb +10 -0
  36. data/app/views/smerp/quotation/engine/quotation_items/_form.html.erb +53 -0
  37. data/app/views/smerp/quotation/engine/quotation_items/_product_item_form.html.erb +47 -0
  38. data/app/views/smerp/quotation/engine/quotation_items/_quotation_item.html.erb +17 -0
  39. data/app/views/smerp/quotation/engine/quotation_items/edit.html.erb +9 -0
  40. data/app/views/smerp/quotation/engine/quotation_items/index.html.erb +14 -0
  41. data/app/views/smerp/quotation/engine/quotation_items/new.html.erb +9 -0
  42. data/app/views/smerp/quotation/engine/quotation_items/new_product_item.html.erb +7 -0
  43. data/app/views/smerp/quotation/engine/quotation_items/show.html.erb +76 -0
  44. data/app/views/smerp/quotation/engine/quotation_product_categories/_form.html.erb +33 -0
  45. data/app/views/smerp/quotation/engine/quotation_product_categories/_quotation_product_category.html.erb +17 -0
  46. data/app/views/smerp/quotation/engine/quotation_product_categories/edit.html.erb +10 -0
  47. data/app/views/smerp/quotation/engine/quotation_product_categories/index.html.erb +14 -0
  48. data/app/views/smerp/quotation/engine/quotation_product_categories/new.html.erb +9 -0
  49. data/app/views/smerp/quotation/engine/quotation_product_categories/show.html.erb +10 -0
  50. data/app/views/smerp/quotation/engine/quotation_products/_form.html.erb +41 -0
  51. data/app/views/smerp/quotation/engine/quotation_products/_quotation_product.html.erb +9 -0
  52. data/app/views/smerp/quotation/engine/quotation_products/edit.html.erb +10 -0
  53. data/app/views/smerp/quotation/engine/quotation_products/index.html.erb +19 -0
  54. data/app/views/smerp/quotation/engine/quotation_products/new.html.erb +9 -0
  55. data/app/views/smerp/quotation/engine/quotation_products/show.html.erb +32 -0
  56. data/app/views/smerp/quotation/engine/quotations/_form.html.erb +49 -0
  57. data/app/views/smerp/quotation/engine/quotations/_new_group_form.html.erb +24 -0
  58. data/app/views/smerp/quotation/engine/quotations/_product_item_form.html.erb +47 -0
  59. data/app/views/smerp/quotation/engine/quotations/_quotation.html.erb +10 -0
  60. data/app/views/smerp/quotation/engine/quotations/_quotation_item.html.erb +96 -0
  61. data/app/views/smerp/quotation/engine/quotations/edit.html.erb +9 -0
  62. data/app/views/smerp/quotation/engine/quotations/extended_calculators.html.erb +36 -0
  63. data/app/views/smerp/quotation/engine/quotations/index.html.erb +21 -0
  64. data/app/views/smerp/quotation/engine/quotations/new.html.erb +9 -0
  65. data/app/views/smerp/quotation/engine/quotations/new_extended_calculator.html.erb +65 -0
  66. data/app/views/smerp/quotation/engine/quotations/new_product_item.html.erb +7 -0
  67. data/app/views/smerp/quotation/engine/quotations/show.html.erb +151 -0
  68. data/config/routes.rb +50 -0
  69. data/db/migrate/20220929020407_create_smerp_quotation_engine_quotation_products.rb +16 -0
  70. data/db/migrate/20220929041715_create_smerp_quotation_engine_quotation_product_categories.rb +12 -0
  71. data/db/migrate/20220929074438_link_product_to_item.rb +5 -0
  72. data/db/seeds.rb +36 -0
  73. data/lib/smerp/quotation/engine/engine.rb +40 -0
  74. data/lib/smerp/quotation/engine/version.rb +7 -0
  75. data/lib/smerp/quotation/engine.rb +10 -0
  76. data/lib/tasks/smerp/quotation/engine_tasks.rake +4 -0
  77. metadata +216 -0
@@ -0,0 +1,53 @@
1
+ <%= form_with(model: quotation_item) do |form| %>
2
+ <%#= form_for(:quotation_item, url: quotation_quotation_items_path(@quotation, quotation_item)) do |form| %>
3
+ <% if quotation_item.errors.any? %>
4
+ <div style="color: red">
5
+ <h2><%= pluralize(quotation_item.errors.count, "error") %> prohibited this quotation_item from being saved:</h2>
6
+
7
+ <ul>
8
+ <% quotation_item.errors.each do |error| %>
9
+ <li><%= error.full_message %></li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <% end %>
14
+
15
+ <%= form.hidden_field :quotation_id, value: @quotation.id %>
16
+ <% if not @parent.nil? %>
17
+ <%= form.hidden_field :parent_id, value: @parent.id %>
18
+ <% end %>
19
+
20
+ <table class="table">
21
+ <% if not @parent.nil? %>
22
+ <tr style="background-color: #8EFEC1">
23
+ <th>Parent Item : </th>
24
+ <td colspan="6"><%= @parent.name %></td>
25
+ </tr>
26
+ <% end %>
27
+
28
+ <tr>
29
+ <th>Name</th>
30
+ <th class="text-center">Quantity</th>
31
+ <th class="text-center">Unit</th>
32
+ <th class="text-center">Unit Price</th>
33
+ </tr>
34
+
35
+ <tr>
36
+ <td><%= form.text_field :name, class: "form-control" %></td>
37
+ <td><%= form.text_field :quantity, class: "form-control text-center" %></td>
38
+ <td><%= form.text_field :unit, class: "form-control text-center" %></td>
39
+ <td><%= form.text_field :unit_price, class: "form-control text-center" %></td>
40
+ </tr>
41
+
42
+ <tr>
43
+ <td></td>
44
+ <td></td>
45
+ <td></td>
46
+ <td class="text-end"><%= form.submit (quotation_item.new_record? ? "Create" : "Update"), class: "btn btn-primary" %></td>
47
+ </tr>
48
+
49
+
50
+ </table>
51
+
52
+
53
+ <% end %>
@@ -0,0 +1,47 @@
1
+ <%= form_with(model: quotation_item) do |form| %>
2
+ <%#= form_for(:quotation_item, url: quotation_quotation_items_path(@quotation, quotation_item)) do |form| %>
3
+ <% if quotation_item.errors.any? %>
4
+ <div style="color: red">
5
+ <h2><%= pluralize(quotation_item.errors.count, "error") %> prohibited this quotation_item from being saved:</h2>
6
+
7
+ <ul>
8
+ <% quotation_item.errors.each do |error| %>
9
+ <li><%= error.full_message %></li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <% end %>
14
+
15
+ <%= form.hidden_field :quotation_id, value: @quotation.id %>
16
+ <% if not @parent.nil? %>
17
+ <%= form.hidden_field :parent_id, value: @parent.id %>
18
+ <% end %>
19
+
20
+ <table class="table">
21
+ <% if not @parent.nil? %>
22
+ <tr style="background-color: #8EFEC1">
23
+ <th>Parent Item : </th>
24
+ <td colspan="6"><%= @parent.name %></td>
25
+ </tr>
26
+ <% end %>
27
+
28
+ <tr>
29
+ <th>Name</th>
30
+ <th class="text-center">Quantity</th>
31
+ </tr>
32
+
33
+ <tr>
34
+ <td><%= form.select :quotation_product_id, Smerp::Quotation::Engine::QuotationProduct.active_products.collect { |pr| [pr.name, pr.id] }, {}, class: "form-control" %></td>
35
+ <td><%= form.text_field :quantity, class: "form-control text-center" %></td>
36
+ </tr>
37
+
38
+ <tr>
39
+ <td></td>
40
+ <td class="text-end"><%= form.submit (quotation_item.new_record? ? "Create" : "Update"), class: "btn btn-primary" %></td>
41
+ </tr>
42
+
43
+
44
+ </table>
45
+
46
+
47
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <div id="<%= dom_id quotation_item %>">
2
+
3
+ <tr>
4
+ <th><%= quotation_item.name %></th>
5
+ <td><%= quotation_item.quantity %></td>
6
+ <td><%= quotation_item.unit %></td>
7
+ <td><%= currency(quotation_item.unit_price) %></td>
8
+ <td><%= currency(quotation_item.line_total) %></td>
9
+ <td><%= currency(quotation_item.discount) %></td>
10
+ <td><%= currency(quotation_item.line_total_after_discount) %></td>
11
+ <td><%= currency(quotation_item.tax) %></td>
12
+ <td><%= currency(quotation_item.line_total_with_tax) %></td>
13
+ <td></td>
14
+ </tr>
15
+
16
+
17
+ </div>
@@ -0,0 +1,9 @@
1
+ <h1>Editing quotation item</h1>
2
+
3
+ <%= render "form", quotation_item: @quotation_item %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Back", @quotation, class: "btn btn-secondary" %>
9
+ </div>
@@ -0,0 +1,14 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <h1>Quotation items</h1>
4
+
5
+ <div id="quotation_items">
6
+ <% @quotation_items.each do |quotation_item| %>
7
+ <%= render quotation_item %>
8
+ <p>
9
+ <%= link_to "Show this quotation item", quotation_item %>
10
+ </p>
11
+ <% end %>
12
+ </div>
13
+
14
+ <%= link_to "New quotation item", new_quotation_item_path %>
@@ -0,0 +1,9 @@
1
+ <h1>New quotation item</h1>
2
+
3
+ <%= render "form", quotation_item: @quotation_item %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Back", quotation_path(@quotation), class: "btn btn-secondary" %>
9
+ </div>
@@ -0,0 +1,7 @@
1
+
2
+ <h2>New Quotation Item from Product</h2>
3
+
4
+ <%= render "product_item_form", quotation_item: @quotation_item, quotation: @quotation %>
5
+
6
+ <%= link_back quotation_path(@quotation) %>
7
+
@@ -0,0 +1,76 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <table class="table">
4
+ <tr>
5
+ <th>Name</th>
6
+ <th>Quantity</th>
7
+ <th>Unit</th>
8
+ <th>Unit Price</th>
9
+ <th>Line Total</th>
10
+ <th>Discount</th>
11
+ <th>Line Total After Discount</th>
12
+ <th>Tax</th>
13
+ <th>Line Total With Tax</th>
14
+ </tr>
15
+
16
+ <tr>
17
+ <th><%= @quotation_item.name %></th>
18
+ <td class="text-end"><%= @quotation_item.quantity %></td>
19
+ <td class="text-start"><%= @quotation_item.unit %></td>
20
+ <td class="text-end"><%= currency(@quotation_item.unit_price) %></td>
21
+ <td class="text-end"><%= currency(@quotation_item.line_total) %></td>
22
+ <td class="text-end"><%= currency(@quotation_item.discount) %></td>
23
+ <td class="text-end"><%= currency(@quotation_item.line_total_after_discount) %></td>
24
+ <td class="text-end"><%= currency(@quotation_item.tax) %></td>
25
+ <td class="text-end"><%= currency(@quotation_item.line_total_with_tax) %></td>
26
+ </tr>
27
+
28
+ </table>
29
+
30
+ <div class="text-start">
31
+ <%= link_back quotation_path(@quotation_item.quotation) %>
32
+ <%= link_edit edit_quotation_quotation_item_path([@quotation_item.quotation, @quotation_item]) %>
33
+ <div class="pt-1">
34
+ <%= button_to "Destroy", @quotation_item, method: :delete, class: "btn btn-danger" %>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="pt-2">
39
+
40
+ <% if @quotation_item.children.length > 0 %>
41
+ <h4>Sub Items</h4>
42
+
43
+ <table class="table">
44
+ <tr>
45
+ <th>Name</th>
46
+ <th>Quantity</th>
47
+ <th>Unit</th>
48
+ <th>Unit Price</th>
49
+ <th>Line Total</th>
50
+ <th>Discount</th>
51
+ <th>Line Total After Discount</th>
52
+ <th>Tax</th>
53
+ <th>Line Total With Tax</th>
54
+ </tr>
55
+
56
+ <% @quotation_item.children.each do |c| %>
57
+ <tr>
58
+ <th><%= c.name %></th>
59
+ <td class="text-end"><%= c.quantity %></td>
60
+ <td class="text-start"><%= c.unit %></td>
61
+ <td class="text-end"><%= currency(c.unit_price) %></td>
62
+ <td class="text-end"><%= currency(c.line_total) %></td>
63
+ <td class="text-end"><%= currency(c.discount) %></td>
64
+ <td class="text-end"><%= currency(c.line_total_after_discount) %></td>
65
+ <td class="text-end"><%= currency(c.tax) %></td>
66
+ <td class="text-end"><%= currency(c.line_total_with_tax) %></td>
67
+ </tr>
68
+ <% end %>
69
+
70
+ </table>
71
+
72
+
73
+
74
+ <% end %>
75
+
76
+ </div>
@@ -0,0 +1,33 @@
1
+ <%= form_with(model: quotation_product_category) do |form| %>
2
+ <% if quotation_product_category.errors.any? %>
3
+ <div style="color: red">
4
+ <h2><%= pluralize(quotation_product_category.errors.count, "error") %> prohibited this quotation_product_category from being saved:</h2>
5
+
6
+ <ul>
7
+ <% quotation_product_category.errors.each do |error| %>
8
+ <li><%= error.full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <table class="table">
15
+ <tr>
16
+ <th>Name</th>
17
+ </tr>
18
+ <tr>
19
+ <td><%= form.text_field :name, class: "form-control" %></td>
20
+ </tr>
21
+ <tr>
22
+ <th>Notes</th>
23
+ </tr>
24
+ <tr>
25
+ <td><%= form.text_area :notes, class: "form-control" %></td>
26
+ </tr>
27
+ <tr>
28
+ <th><%= form.submit class: "btn btn-primary" %></th>
29
+ <td></td>
30
+ </tr>
31
+ </table>
32
+
33
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <div id="<%= dom_id quotation_product_category %>">
2
+ <p>
3
+ <strong>Name:</strong>
4
+ <%= quotation_product_category.name %>
5
+ </p>
6
+
7
+ <p>
8
+ <strong>Notes:</strong>
9
+ <%= quotation_product_category.notes %>
10
+ </p>
11
+
12
+ <p>
13
+ <strong>State:</strong>
14
+ <%= quotation_product_category.state %>
15
+ </p>
16
+
17
+ </div>
@@ -0,0 +1,10 @@
1
+ <h1>Editing quotation product category</h1>
2
+
3
+ <%= render "form", quotation_product_category: @quotation_product_category %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Show this quotation product category", @quotation_product_category %> |
9
+ <%= link_to "Back to quotation product categories", quotation_product_categories_path %>
10
+ </div>
@@ -0,0 +1,14 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <h1>Quotation product categories</h1>
4
+
5
+ <div id="quotation_product_categories">
6
+ <% @quotation_product_categories.each do |quotation_product_category| %>
7
+ <%= render quotation_product_category %>
8
+ <p>
9
+ <%= link_to "Show this quotation product category", quotation_product_category %>
10
+ </p>
11
+ <% end %>
12
+ </div>
13
+
14
+ <%= link_add new_quotation_product_category_path, "New Product Category" %>
@@ -0,0 +1,9 @@
1
+ <h1>New quotation product category</h1>
2
+
3
+ <%= render "form", quotation_product_category: @quotation_product_category %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Back to quotation product categories", quotation_product_categories_path, class: "btn btn-secondary" %>
9
+ </div>
@@ -0,0 +1,10 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <%= render @quotation_product_category %>
4
+
5
+ <div>
6
+ <%= link_to "Edit this quotation product category", edit_quotation_product_category_path(@quotation_product_category) %> |
7
+ <%= link_to "Back to quotation product categories", quotation_product_categories_path %>
8
+
9
+ <%= button_to "Destroy this quotation product category", @quotation_product_category, method: :delete %>
10
+ </div>
@@ -0,0 +1,41 @@
1
+ <%= form_with(model: quotation_product) do |form| %>
2
+ <% if quotation_product.errors.any? %>
3
+ <div style="color: red">
4
+ <h2><%= pluralize(quotation_product.errors.count, "error") %> prohibited this quotation_product from being saved:</h2>
5
+
6
+ <ul>
7
+ <% quotation_product.errors.each do |error| %>
8
+ <li><%= error.full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <table class="table">
15
+ <tr>
16
+ <th>Name</th>
17
+ <th>Category</th>
18
+ <th>Unit</th>
19
+ <th>Unit Price</th>
20
+ </tr>
21
+ <tr>
22
+ <td><%= form.text_field :name , class: "form-control" %></td>
23
+ <td><%= form.select :quotation_product_category_id, Smerp::Quotation::Engine::QuotationProductCategory.active_products.order(:name).collect { |pr| [pr.name, pr.id] }.unshift(["- Select one or add new first", nil]), {}, class: "form-control" %></td>
24
+ <td><%= form.text_field :unit , class: "form-control text-center" %></td>
25
+ <td><%= form.text_field :unit_price , class: "form-control text-center" %></td>
26
+ </tr>
27
+ <tr>
28
+ <th colspan="4">Notes</th>
29
+ </tr>
30
+ <tr>
31
+ <td colspan="4"><%= form.text_area :notes, class: "form-control" %></td>
32
+ </tr>
33
+ <tr>
34
+ <td><%= form.submit class: "btn btn-primary" %></td>
35
+ <td></td>
36
+ <td></td>
37
+ <td></td>
38
+ </tr>
39
+ </table>
40
+
41
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <div id="<%= dom_id quotation_product %>">
2
+
3
+ <tr>
4
+ <td><%= link_to quotation_product.name, quotation_product %></td>
5
+ <td><%= quotation_product.quotation_product_category.name %></td>
6
+ <td><%= quotation_product.state.titleize %></td>
7
+ </tr>
8
+
9
+ </div>
@@ -0,0 +1,10 @@
1
+ <h1>Editing quotation product</h1>
2
+
3
+ <%= render "form", quotation_product: @quotation_product %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Show this quotation product", @quotation_product %> |
9
+ <%= link_to "Back to quotation products", quotation_products_path %>
10
+ </div>
@@ -0,0 +1,19 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <h1>Quotation products</h1>
4
+
5
+ <div id="quotation_products">
6
+ <table class="table">
7
+ <tr>
8
+ <th>Name</th>
9
+ <th>Category</th>
10
+ <th>Status</th>
11
+ </tr>
12
+
13
+ <% @quotation_products.each do |quotation_product| %>
14
+ <%= render quotation_product %>
15
+ <% end %>
16
+ </table>
17
+ </div>
18
+
19
+ <%= link_add new_quotation_product_path, "New Product" %>
@@ -0,0 +1,9 @@
1
+ <h1>New Quotation Product</h1>
2
+
3
+ <%= render "form", quotation_product: @quotation_product %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_back quotation_products_path %>
9
+ </div>
@@ -0,0 +1,32 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <table class="table">
4
+ <tr>
5
+ <th>Name</th>
6
+ <th>Category</th>
7
+ <th>Unit</th>
8
+ <th>Unit Price</th>
9
+ <th>Status</th>
10
+ </tr>
11
+
12
+ <tr>
13
+ <td><%= @quotation_product.name %></td>
14
+ <td><%= @quotation_product.quotation_product_category.name %></td>
15
+ <td><%= @quotation_product.unit %></td>
16
+ <td><%= currency(@quotation_product.unit_price) %></td>
17
+ <td><%= @quotation_product.state.titleize %></td>
18
+ </tr>
19
+
20
+ <tr>
21
+ <th colspan="5">Notes</th>
22
+ </tr>
23
+ <tr>
24
+ <td colspan="5"><%= @quotation_product.notes %></td>
25
+ </tr>
26
+
27
+ </table>
28
+
29
+ <div>
30
+ <%= link_back quotation_products_path %>
31
+ <%= link_edit edit_quotation_product_path(@quotation_product) %>
32
+ </div>
@@ -0,0 +1,49 @@
1
+ <%= form_with(model: quotation) do |form| %>
2
+ <% if quotation.errors.any? %>
3
+ <div style="color: red">
4
+ <h2><%= pluralize(quotation.errors.count, "error") %> prohibited this quotation from being saved:</h2>
5
+
6
+ <ul>
7
+ <% quotation.errors.each do |error| %>
8
+ <li><%= error.full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="row pb-2">
15
+ <div class="col-2">Quotation ID</div>
16
+ <div class="col-10">
17
+ <% if quotation.state == "open" %>
18
+ <%= form.text_field :qid, class: "form-control", placeholder: "Quotation ID" %>
19
+ <% else %>
20
+ <%= quotation.qid %>
21
+ <% end %>
22
+ </div>
23
+ </div>
24
+
25
+ <div class="row pb-2">
26
+ <div class="col-2">Customer Name</div>
27
+ <div class="col-10"><%= form.text_field :name, class: "form-control", placeholder: "Customer name" %></div>
28
+ </div>
29
+
30
+ <div class="row pb-2">
31
+ <div class="col-2">Address</div>
32
+ <div class="col-10"><%= form.text_area :address, class: "form-control", placeholder: "Customer address" %></div>
33
+ </div>
34
+
35
+ <div class="row pb-2">
36
+ <div class="col-2">Attention To</div>
37
+ <div class="col-10"><%= form.text_field :attention_to, class: "form-control", placeholder: "Attention to" %></div>
38
+ </div>
39
+
40
+ <div class="row pb-2">
41
+ <div class="col-2">Quotation Date</div>
42
+ <div class="col-10"><%= form.date_field :qdate, class: "form-control" %></div>
43
+ </div>
44
+
45
+
46
+ <div>
47
+ <%= form.submit class: "btn btn-primary" %>
48
+ </div>
49
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <%= form_for([@quotation, @qig]) do |f| %>
2
+ <% if @qig.errors.any? %>
3
+ <div style="color: red">
4
+ <h2><%= pluralize(@qi.errors.count, "error") %> prohibited this quotation_item from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @qig.errors.each do |error| %>
8
+ <li><%= error.full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <%= f.hidden_field :quotation_id, value: @quotation.id %>
15
+
16
+ <div class="row pb-1">
17
+ <div class="col-1">Group Name : </div>
18
+ <div class="col-4"><%= f.text_field :name, class: "form-control" %></div>
19
+ </div>
20
+ <div>
21
+ <div class="col-12 right"><%= f.submit "Create Group" %></div>
22
+ </div>
23
+
24
+ <% end %>
@@ -0,0 +1,47 @@
1
+ <%= form_with(model: quotation_item) do |form| %>
2
+ <%#= form_for(:quotation_item, url: quotation_quotation_items_path(@quotation, quotation_item)) do |form| %>
3
+ <% if quotation_item.errors.any? %>
4
+ <div style="color: red">
5
+ <h2><%= pluralize(quotation_item.errors.count, "error") %> prohibited this quotation_item from being saved:</h2>
6
+
7
+ <ul>
8
+ <% quotation_item.errors.each do |error| %>
9
+ <li><%= error.full_message %></li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <% end %>
14
+
15
+ <%= form.hidden_field :quotation_id, value: @quotation.id %>
16
+ <% if not @parent.nil? %>
17
+ <%= form.hidden_field :parent_id, value: @parent.id %>
18
+ <% end %>
19
+
20
+ <table class="table">
21
+ <% if not @parent.nil? %>
22
+ <tr style="background-color: #8EFEC1">
23
+ <th>Parent Item : </th>
24
+ <td colspan="6"><%= @parent.name %></td>
25
+ </tr>
26
+ <% end %>
27
+
28
+ <tr>
29
+ <th>Name</th>
30
+ <th class="text-center">Quantity</th>
31
+ </tr>
32
+
33
+ <tr>
34
+ <td><%= form.select :quotation_product_id, Smerp::Quotation::Engine::QuotationProduct.active_products.collect { |pr| [pr.name, pr.id] }, {}, class: "form-control" %></td>
35
+ <td><%= form.text_field :quantity, class: "form-control text-center" %></td>
36
+ </tr>
37
+
38
+ <tr>
39
+ <td></td>
40
+ <td class="text-end"><%= form.submit (quotation_item.new_record? ? "Create" : "Update"), class: "btn btn-primary" %></td>
41
+ </tr>
42
+
43
+
44
+ </table>
45
+
46
+
47
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <div id="<%= dom_id quotation %>">
2
+
3
+ <tr>
4
+ <td><%= quotation.qid %></td>
5
+ <td><%= link_to quotation.name, quotation %></td>
6
+ <td class="text-center"><%= quotation.qdate.nil? ? "" : quotation.qdate.strftime("%d-%m-%Y (%a)") %></td>
7
+ <td><%= quotation.state.titleize %></td>
8
+ </tr>
9
+
10
+ </div>