rawbotz 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +9 -0
- data/README.md +185 -0
- data/Rakefile +29 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config.ru +9 -0
- data/exe/debug/test_mail +15 -0
- data/exe/rawbotz +39 -0
- data/exe/rawbotz_import_links +74 -0
- data/exe/rawbotz_maintenance.sh +57 -0
- data/exe/rawbotz_process_order +86 -0
- data/exe/rawbotz_process_order_queue +80 -0
- data/exe/rawbotz_stock_update +84 -0
- data/exe/rawbotz_update_local_products +48 -0
- data/exe/rawbotz_update_remote_products +160 -0
- data/lib/rawbotz/app.rb +84 -0
- data/lib/rawbotz/cli/order_result_table.rb +57 -0
- data/lib/rawbotz/datapolate.rb +42 -0
- data/lib/rawbotz/helpers/flash_helper.rb +13 -0
- data/lib/rawbotz/helpers/icon_helper.rb +40 -0
- data/lib/rawbotz/helpers/resource_link_helper.rb +45 -0
- data/lib/rawbotz/local_shop.rb +12 -0
- data/lib/rawbotz/mail_template.rb +29 -0
- data/lib/rawbotz/option_parser.rb +37 -0
- data/lib/rawbotz/order_processor.rb +92 -0
- data/lib/rawbotz/product_updater.rb +89 -0
- data/lib/rawbotz/public/Chart.min.js +14 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/HELP-US-OUT.txt +7 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/css/font-awesome.css +2086 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/css/font-awesome.min.css +4 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/fonts/FontAwesome.otf +0 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/fonts/fontawesome-webfont.eot +0 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/fonts/fontawesome-webfont.svg +655 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/fonts/fontawesome-webfont.ttf +0 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/fonts/fontawesome-webfont.woff +0 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/fonts/fontawesome-webfont.woff2 +0 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/animated.less +34 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/bordered-pulled.less +25 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/core.less +12 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/fixed-width.less +6 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/font-awesome.less +17 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/icons.less +697 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/larger.less +13 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/list.less +19 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/mixins.less +26 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/path.less +15 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/rotated-flipped.less +20 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/stacked.less +20 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/less/variables.less +708 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_animated.scss +34 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_bordered-pulled.scss +25 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_core.scss +12 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_fixed-width.scss +6 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_icons.scss +697 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_larger.scss +13 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_list.scss +19 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_mixins.scss +26 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_path.scss +15 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_rotated-flipped.scss +20 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_stacked.scss +20 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/_variables.scss +708 -0
- data/lib/rawbotz/public/font-awesome-4.5.0/scss/font-awesome.scss +17 -0
- data/lib/rawbotz/public/jquery-2.2.0.min.js +4 -0
- data/lib/rawbotz/public/jui/external/jquery/jquery.js +9789 -0
- data/lib/rawbotz/public/jui/images/ui-icons_444444_256x240.png +0 -0
- data/lib/rawbotz/public/jui/images/ui-icons_555555_256x240.png +0 -0
- data/lib/rawbotz/public/jui/images/ui-icons_777620_256x240.png +0 -0
- data/lib/rawbotz/public/jui/images/ui-icons_777777_256x240.png +0 -0
- data/lib/rawbotz/public/jui/images/ui-icons_cc0000_256x240.png +0 -0
- data/lib/rawbotz/public/jui/images/ui-icons_ffffff_256x240.png +0 -0
- data/lib/rawbotz/public/jui/index.html +513 -0
- data/lib/rawbotz/public/jui/jquery-ui.css +1225 -0
- data/lib/rawbotz/public/jui/jquery-ui.js +16617 -0
- data/lib/rawbotz/public/jui/jquery-ui.min.css +7 -0
- data/lib/rawbotz/public/jui/jquery-ui.min.js +13 -0
- data/lib/rawbotz/public/jui/jquery-ui.structure.css +833 -0
- data/lib/rawbotz/public/jui/jquery-ui.structure.min.css +5 -0
- data/lib/rawbotz/public/jui/jquery-ui.theme.css +410 -0
- data/lib/rawbotz/public/jui/jquery-ui.theme.min.css +5 -0
- data/lib/rawbotz/public/pure-min.css +11 -0
- data/lib/rawbotz/public/rawbotz.css +60 -0
- data/lib/rawbotz/public/rawbotz.js +96 -0
- data/lib/rawbotz/public/rawbotz_ajax_product_link.js +64 -0
- data/lib/rawbotz/remote_shop.rb +21 -0
- data/lib/rawbotz/routes/non_remote_orders.rb +45 -0
- data/lib/rawbotz/routes/orders.rb +76 -0
- data/lib/rawbotz/routes/product_links.rb +68 -0
- data/lib/rawbotz/routes/products.rb +104 -0
- data/lib/rawbotz/routes/remote_shop.rb +37 -0
- data/lib/rawbotz/routes/suppliers.rb +36 -0
- data/lib/rawbotz/routes.rb +9 -0
- data/lib/rawbotz/version.rb +3 -0
- data/lib/rawbotz/views/_hide_unhide_button.haml +11 -0
- data/lib/rawbotz/views/_menu.haml +20 -0
- data/lib/rawbotz/views/index.haml +1 -0
- data/lib/rawbotz/views/layout.haml +55 -0
- data/lib/rawbotz/views/maintenance/menu.haml +25 -0
- data/lib/rawbotz/views/maintenance.haml +150 -0
- data/lib/rawbotz/views/order/_head.haml +24 -0
- data/lib/rawbotz/views/order/_item_table.haml +44 -0
- data/lib/rawbotz/views/order/new.haml +22 -0
- data/lib/rawbotz/views/order/non_remote.haml +42 -0
- data/lib/rawbotz/views/order/packlist.haml +14 -0
- data/lib/rawbotz/views/order/view.haml +79 -0
- data/lib/rawbotz/views/orders/index.haml +40 -0
- data/lib/rawbotz/views/orders/menu.haml +24 -0
- data/lib/rawbotz/views/orders/non_remotes.haml +8 -0
- data/lib/rawbotz/views/product/_stock_sales_plot.haml +60 -0
- data/lib/rawbotz/views/product/link_to.haml +29 -0
- data/lib/rawbotz/views/product/view.haml +64 -0
- data/lib/rawbotz/views/products/_link_table.haml +38 -0
- data/lib/rawbotz/views/products/index.haml +36 -0
- data/lib/rawbotz/views/products/link_wizard.haml +48 -0
- data/lib/rawbotz/views/products/links.haml +65 -0
- data/lib/rawbotz/views/products/menu.haml +27 -0
- data/lib/rawbotz/views/products/table.haml +20 -0
- data/lib/rawbotz/views/products/table_with_linking.haml +30 -0
- data/lib/rawbotz/views/remote_cart/index.haml +30 -0
- data/lib/rawbotz/views/remote_order/view.haml +35 -0
- data/lib/rawbotz/views/remote_orders/index.haml +20 -0
- data/lib/rawbotz/views/remote_product/view.haml +90 -0
- data/lib/rawbotz/views/remote_products/_table.haml +15 -0
- data/lib/rawbotz/views/remote_products/index.haml +30 -0
- data/lib/rawbotz/views/supplier/view.haml +63 -0
- data/lib/rawbotz/views/suppliers/index.haml +13 -0
- data/lib/rawbotz/views/thin_layout.haml +32 -0
- data/lib/rawbotz/views/widgets/_ajax_link.haml +5 -0
- data/lib/rawbotz/views/widgets/_link.haml +6 -0
- data/lib/rawbotz/views/widgets/_link_line.haml +15 -0
- data/lib/rawbotz.rb +77 -0
- data/rawbotz.gemspec +33 -0
- metadata +327 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
.icon#headicon
|
2
|
+
= settings_icon
|
3
|
+
|
4
|
+
.pure-u-1
|
5
|
+
.pure-menu.pure-menu-horizontal#submenu
|
6
|
+
%small
|
7
|
+
%center
|
8
|
+
%ul.pure-menu-list
|
9
|
+
%li.pure-menu-item
|
10
|
+
%a.pure-menu-link(href="/maintenance")
|
11
|
+
%i(class="fa fa-question")
|
12
|
+
Info
|
13
|
+
%li.pure-menu-item
|
14
|
+
%a.pure-menu-link(href="/products/links")
|
15
|
+
= link_icon
|
16
|
+
Product Linking
|
17
|
+
%li.pure-menu-item
|
18
|
+
%a.pure-menu-link(href="/products/link_wizard")
|
19
|
+
%i(class="fa fa-magic")
|
20
|
+
Link Wizard
|
21
|
+
%li.pure-menu-item
|
22
|
+
%a.pure-menu-link(href="/suppliers")
|
23
|
+
%i(class="fa fa-globe")
|
24
|
+
Suppliers
|
25
|
+
|
@@ -0,0 +1,150 @@
|
|
1
|
+
.icon#headicon
|
2
|
+
= settings_icon
|
3
|
+
|
4
|
+
= haml "maintenance/menu".to_sym
|
5
|
+
|
6
|
+
%h1 Maintenance
|
7
|
+
|
8
|
+
%h2 Info
|
9
|
+
|
10
|
+
%h3 Remote Shop
|
11
|
+
%center
|
12
|
+
%small
|
13
|
+
%table.pure-table.settings
|
14
|
+
%tr
|
15
|
+
%td
|
16
|
+
%b Name
|
17
|
+
%td
|
18
|
+
= settings.supplier_name
|
19
|
+
%tr
|
20
|
+
%td
|
21
|
+
%b URI
|
22
|
+
%td
|
23
|
+
= settings.conf["remote_shop"]["base_uri"]
|
24
|
+
%tr
|
25
|
+
%td
|
26
|
+
%b Account
|
27
|
+
%td
|
28
|
+
= settings.conf["remote_shop"]["user"]
|
29
|
+
|
30
|
+
%h3 Local Shop Database (mysql)
|
31
|
+
%center
|
32
|
+
%small
|
33
|
+
%table.pure-table.settings
|
34
|
+
%tr
|
35
|
+
%td
|
36
|
+
%b Host
|
37
|
+
%td
|
38
|
+
= settings.conf["host"]
|
39
|
+
%tr
|
40
|
+
%td
|
41
|
+
%b Port
|
42
|
+
%td
|
43
|
+
= settings.conf["port"]
|
44
|
+
%tr
|
45
|
+
%td
|
46
|
+
%b Name
|
47
|
+
%td
|
48
|
+
= settings.conf["database"]
|
49
|
+
|
50
|
+
%h3 Rawbotz Database
|
51
|
+
%center
|
52
|
+
%small
|
53
|
+
%table.pure-table.settings
|
54
|
+
%tr
|
55
|
+
%td
|
56
|
+
%b Path
|
57
|
+
%td
|
58
|
+
= settings.conf["default"]["database"]
|
59
|
+
|
60
|
+
%h3 Mail
|
61
|
+
%center
|
62
|
+
%small
|
63
|
+
%table.pure-table.settings
|
64
|
+
%tr
|
65
|
+
%td
|
66
|
+
%b To
|
67
|
+
%td
|
68
|
+
= settings.conf["mail"]["to"]
|
69
|
+
%tr
|
70
|
+
%td
|
71
|
+
%b From
|
72
|
+
%td
|
73
|
+
= settings.conf["mail"]["from"]
|
74
|
+
%tr
|
75
|
+
%td
|
76
|
+
%b Host
|
77
|
+
%td
|
78
|
+
= settings.conf["mail"]["host"]
|
79
|
+
%tr
|
80
|
+
%td
|
81
|
+
%b Port
|
82
|
+
%td
|
83
|
+
= settings.conf["mail"]["port"]
|
84
|
+
|
85
|
+
%h2 Actions
|
86
|
+
.pure-u-1-5
|
87
|
+
.pure-u-3-5
|
88
|
+
.pure-menu.pure-menu-horizontal#menu
|
89
|
+
%center
|
90
|
+
%ul.pure-menu-list
|
91
|
+
%li.pure-menu-item
|
92
|
+
%a.pure-menu-link(href="/")
|
93
|
+
%i(class="fa fa-puzzle-refresh")
|
94
|
+
Refresh/Import remote
|
95
|
+
%li.pure-menu-item
|
96
|
+
%a.pure-menu-link(href="/")
|
97
|
+
%i(class="fa fa-import")
|
98
|
+
Maintenance...
|
99
|
+
%li.pure-menu-item
|
100
|
+
%a.pure-menu-link(href="/")
|
101
|
+
%i(class="fa fa-import")
|
102
|
+
Trigger Order
|
103
|
+
.pure-u-1-5
|
104
|
+
|
105
|
+
%h2 Systems Information
|
106
|
+
|
107
|
+
Version #{Rawbotz::VERSION}.
|
108
|
+
|
109
|
+
Built on top of
|
110
|
+
|
111
|
+
%dl
|
112
|
+
%dt
|
113
|
+
%a(href="http://sinatrarb.com") Sinatra
|
114
|
+
%dd
|
115
|
+
Minimal Web Application Framework how it should be done, Ruby.
|
116
|
+
|
117
|
+
%dt
|
118
|
+
%a(href="http://haml.info") Haml
|
119
|
+
%dd
|
120
|
+
Write less but better HTML.
|
121
|
+
|
122
|
+
%dt
|
123
|
+
%a(href="http://rubyonrails.org") ActiveRecord
|
124
|
+
%dd
|
125
|
+
Popular ORM from the Ruby on Rails universe
|
126
|
+
|
127
|
+
%dt
|
128
|
+
%a(href="http://purecss.io") Pure CSS framework
|
129
|
+
%dd
|
130
|
+
Small but solid CSS framework.
|
131
|
+
|
132
|
+
%dt
|
133
|
+
%a(href="https://fortawesome.github.io/Font-Awesome") Font Awesome
|
134
|
+
%dd
|
135
|
+
(Font) Awesome icons.
|
136
|
+
|
137
|
+
%dt
|
138
|
+
%a(href="http://chartjs.org") Chart.js
|
139
|
+
%dd
|
140
|
+
For JavaScript Charts.
|
141
|
+
|
142
|
+
%dt
|
143
|
+
%a(href="http://jquery.com") jQuery
|
144
|
+
%dd
|
145
|
+
For JavaScript.
|
146
|
+
|
147
|
+
%dt
|
148
|
+
%a(href="https://jqueryui.com") jQuery UI
|
149
|
+
%dd
|
150
|
+
For JavaScript UI goodies.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
%h2 General
|
2
|
+
%dl
|
3
|
+
%dt
|
4
|
+
Supplier
|
5
|
+
%dd
|
6
|
+
= order.supplier.try(:name)
|
7
|
+
%dt
|
8
|
+
Created at
|
9
|
+
%dd
|
10
|
+
= order.created_at
|
11
|
+
%dt
|
12
|
+
Updated at
|
13
|
+
%dd
|
14
|
+
= order.updated_at
|
15
|
+
%dt
|
16
|
+
State
|
17
|
+
%dd
|
18
|
+
= order.state
|
19
|
+
|
20
|
+
%h2 Content
|
21
|
+
= order.order_items.count
|
22
|
+
Items.
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
%table.pure-table.pure-table-bordered
|
3
|
+
%thead
|
4
|
+
%tr
|
5
|
+
%th Product ID
|
6
|
+
%th Product Name
|
7
|
+
%th Stock (at time of Order)
|
8
|
+
%th Min Stock
|
9
|
+
%th Order
|
10
|
+
%th Packsize
|
11
|
+
%th Stock/Sales history
|
12
|
+
%tbody
|
13
|
+
- order_items.each do |order_item|
|
14
|
+
%tr
|
15
|
+
%td
|
16
|
+
- if order_item.local_product
|
17
|
+
= order_item.local_product.product_id
|
18
|
+
- else
|
19
|
+
No local product!
|
20
|
+
%td
|
21
|
+
= local_product_link order_item.local_product
|
22
|
+
%td= order_item.current_stock
|
23
|
+
%td= order_item.min_stock
|
24
|
+
%td
|
25
|
+
- if order_item.remote_product_id.present?
|
26
|
+
%input.qty(name="item_#{order_item.id}" size="1" value="#{order_item.num_wished}")
|
27
|
+
%button.pure-button.order-none
|
28
|
+
%i.fa.fa-remove
|
29
|
+
- packsize = order_item.local_product.packsize
|
30
|
+
- if packsize
|
31
|
+
%button.pure-button.plus-pack(data-packsize="#{packsize}")
|
32
|
+
%i.fa.fa-plus-square
|
33
|
+
%i.fa.fa-cube
|
34
|
+
%button.pure-button.minus-pack(data-packsize="#{packsize}")
|
35
|
+
%i.fa.fa-minus-square
|
36
|
+
%i.fa.fa-cube
|
37
|
+
-#(last time X)
|
38
|
+
- else
|
39
|
+
No remote product
|
40
|
+
%td= order_item.local_product.packsize
|
41
|
+
%td
|
42
|
+
- stock_url = "/product/#{order_item.local_product.id}/stock_sales_plot"
|
43
|
+
%a.stock_show_action{:href => "", :data => {url: stock_url, product: order_item.local_product.name}}
|
44
|
+
Show Stock/Sale data
|
@@ -0,0 +1,22 @@
|
|
1
|
+
%h1 New Order
|
2
|
+
|
3
|
+
%form.pure-form.pure-form-aligned(action="" method="post")
|
4
|
+
%input(type="hidden" name="_method" value="put")
|
5
|
+
|
6
|
+
:javascript
|
7
|
+
$(function() {
|
8
|
+
$( "#tabs" ).tabs();
|
9
|
+
});
|
10
|
+
|
11
|
+
#tabs
|
12
|
+
%ul
|
13
|
+
%li
|
14
|
+
%a(href="#under_min")Under min
|
15
|
+
%li
|
16
|
+
%a(href="#tabs-2")all
|
17
|
+
%li
|
18
|
+
%a(href="#tabs-2")ordered
|
19
|
+
%li
|
20
|
+
%a(href="#tabs-3")ignored
|
21
|
+
#under_min
|
22
|
+
= haml "order/_item_table".to_sym, locals: { order: @order}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
= haml "orders/menu".to_sym
|
2
|
+
|
3
|
+
%h1 Non-Remote Order for supplier #{@supplier.name}
|
4
|
+
|
5
|
+
%center
|
6
|
+
%form.pure-form(action="" method="post")
|
7
|
+
%input(name="supplier_id" type="hidden" value="#{@supplier.id}")
|
8
|
+
%table.pure-table
|
9
|
+
%thead
|
10
|
+
%tr
|
11
|
+
%th Name
|
12
|
+
%th Qty
|
13
|
+
%th Packsize
|
14
|
+
-#%th Stock and Sales
|
15
|
+
%tbody
|
16
|
+
- @products.find_each do |product|
|
17
|
+
%tr
|
18
|
+
%td
|
19
|
+
= product_link product
|
20
|
+
%td
|
21
|
+
%input.qty(name="item_#{product.id}" size="2")
|
22
|
+
- if product.packsize.present?
|
23
|
+
%button.pure-button.plus-pack(data-packsize="#{product.packsize}")
|
24
|
+
%i.fa.fa-plus-square
|
25
|
+
%i.fa.fa-cube
|
26
|
+
%button.pure-button.minus-pack(data-packsize="#{product.packsize}")
|
27
|
+
%i.fa.fa-minus-square
|
28
|
+
%i.fa.fa-cube
|
29
|
+
%button.pure-button.order-none
|
30
|
+
%i.fa.fa-remove
|
31
|
+
%td
|
32
|
+
- if product.packsize.present?
|
33
|
+
= product.packsize
|
34
|
+
- else
|
35
|
+
%i.fa.fa-ban
|
36
|
+
|
37
|
+
|
38
|
+
%br
|
39
|
+
%center
|
40
|
+
%button.pure-button.pure-button-primary
|
41
|
+
%i.fa.fa-envelope
|
42
|
+
Send me the mail!
|
@@ -0,0 +1,14 @@
|
|
1
|
+
%h2 Order #{@order.supplier} from #{@order.created_at}
|
2
|
+
|
3
|
+
%table.pure-table.pure-table-striped
|
4
|
+
%thead
|
5
|
+
%tr
|
6
|
+
%th Product
|
7
|
+
%th Shelve
|
8
|
+
%th Quantity
|
9
|
+
%tbody
|
10
|
+
- @order.order_items.where("num_ordered > 0").sort_by{|i| i.local_product.name}.each do |p|
|
11
|
+
%tr
|
12
|
+
%td=p.local_product.name
|
13
|
+
%td=p.local_product.shelve_nr
|
14
|
+
%td=p.num_ordered
|
@@ -0,0 +1,79 @@
|
|
1
|
+
= haml "orders/menu".to_sym
|
2
|
+
|
3
|
+
%h1 View Order
|
4
|
+
|
5
|
+
#modal-plot.modal-plot
|
6
|
+
|
7
|
+
= haml "order/_head".to_sym, locals: {order: @order}
|
8
|
+
|
9
|
+
- if @order.state == "new"
|
10
|
+
%form.pure-form.pure-form-aligned(action="" method="post")
|
11
|
+
-#%input(type="hidden" name="_method" value="put")
|
12
|
+
|
13
|
+
:javascript
|
14
|
+
$(function() {
|
15
|
+
$( "#tabs" ).tabs();
|
16
|
+
});
|
17
|
+
|
18
|
+
#tabs
|
19
|
+
- supplier_name = settings.supplier
|
20
|
+
- understocked_items = @order.order_items.select{|i| i.local_product.supplier==supplier_name && i.num_wished.nil?}
|
21
|
+
- unordered_items = []
|
22
|
+
- ordered_items = @order.order_items.select{|i| i.num_wished.present? && i.num_wished != 0}
|
23
|
+
- ignored_items = @order.order_items.select{|i| i.local_product.supplier==supplier_name && i.num_wished == 0}
|
24
|
+
- other_items = []
|
25
|
+
- all_items = []
|
26
|
+
%ul
|
27
|
+
%li
|
28
|
+
%a(href="#under_min")undecided [#{understocked_items.count}]
|
29
|
+
%li
|
30
|
+
%a(href="#ordered")ordered [#{ordered_items.count}]
|
31
|
+
%li
|
32
|
+
%a(href="#ignored")ignored [#{ignored_items.count}]
|
33
|
+
%li
|
34
|
+
%a(href="#more")more
|
35
|
+
#under_min
|
36
|
+
= haml "order/_item_table".to_sym, locals: {order_items: understocked_items}
|
37
|
+
#ordered
|
38
|
+
= haml "order/_item_table".to_sym, locals: {order_items: ordered_items}
|
39
|
+
#ignored
|
40
|
+
= haml "order/_item_table".to_sym, locals: {order_items: ignored_items}
|
41
|
+
#more
|
42
|
+
%p
|
43
|
+
Add another item?
|
44
|
+
%br
|
45
|
+
%h2 Action
|
46
|
+
%center
|
47
|
+
(Find remote order? Delete?)
|
48
|
+
%button.pure-button.pure-button-secondary(name="action" value="save")
|
49
|
+
Save
|
50
|
+
%button.pure-button.pure-button-primary(name="action" value="order")
|
51
|
+
Order!
|
52
|
+
%button.pure-button.pure-button-primary(name="action" value="delete")
|
53
|
+
Delete
|
54
|
+
- else
|
55
|
+
%table.pure-table
|
56
|
+
%thead
|
57
|
+
%tr
|
58
|
+
%th
|
59
|
+
Item
|
60
|
+
%th
|
61
|
+
Wished Qty
|
62
|
+
%th
|
63
|
+
Ordered Qty
|
64
|
+
%th
|
65
|
+
Stock at time
|
66
|
+
%tbody
|
67
|
+
- @order.order_items.find_each do |item|
|
68
|
+
%tr
|
69
|
+
%td
|
70
|
+
= local_product_link item.local_product
|
71
|
+
%td
|
72
|
+
=item.num_wished
|
73
|
+
%td
|
74
|
+
=item.num_ordered
|
75
|
+
%td
|
76
|
+
=item.current_stock
|
77
|
+
%h2 Action
|
78
|
+
(Find remote order? Delete?)
|
79
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
= haml "orders/menu".to_sym
|
2
|
+
|
3
|
+
%h1 Orders
|
4
|
+
|
5
|
+
- if Order.current.present?
|
6
|
+
%a(href="/order/#{Order.current.id}")
|
7
|
+
Current Order
|
8
|
+
- else
|
9
|
+
%a(href="/order/new") New Order
|
10
|
+
|
11
|
+
%br
|
12
|
+
- if @orders.count > 0
|
13
|
+
%br
|
14
|
+
|
15
|
+
%table.pure-table
|
16
|
+
%thead
|
17
|
+
%tr
|
18
|
+
%th Date
|
19
|
+
%th Number of Items
|
20
|
+
%th Action
|
21
|
+
%th State
|
22
|
+
%tbody
|
23
|
+
- @orders.each do |order|
|
24
|
+
%tr
|
25
|
+
%td=order.created_at
|
26
|
+
%td
|
27
|
+
= order.order_items.count
|
28
|
+
(
|
29
|
+
= order.order_items.processible.count
|
30
|
+
)
|
31
|
+
%td
|
32
|
+
%a.pure-button(href="/order/#{order.id}")
|
33
|
+
%i.fa.fa-eye
|
34
|
+
View
|
35
|
+
- if order.state == "ordered"
|
36
|
+
%a.pure-button(href="/order/#{order.id}/packlist")
|
37
|
+
%i.fa.fa-paper
|
38
|
+
Packlist
|
39
|
+
|
40
|
+
%td=order.state
|
@@ -0,0 +1,24 @@
|
|
1
|
+
.icon#headicon
|
2
|
+
= order_icon
|
3
|
+
|
4
|
+
.pure-u-1
|
5
|
+
.pure-menu.pure-menu-horizontal#submenu
|
6
|
+
%small
|
7
|
+
%center
|
8
|
+
%ul.pure-menu-list
|
9
|
+
%li.pure-menu-item
|
10
|
+
%a.pure-menu-link(href="/orders")
|
11
|
+
= index_icon
|
12
|
+
Orders
|
13
|
+
%li.pure-menu-item
|
14
|
+
%a.pure-menu-link(href="/order/new")
|
15
|
+
%i(class="fa fa-plus")
|
16
|
+
New or current
|
17
|
+
%li.pure-menu-item
|
18
|
+
%a.pure-menu-link(href="/orders/non_remote")
|
19
|
+
%i(class="fa fa-envelope-o")
|
20
|
+
Other Suppliers
|
21
|
+
%li.pure-menu-item
|
22
|
+
%a.pure-menu-link(href="/remote_orders")
|
23
|
+
%i(class="fa fa-globe")
|
24
|
+
Remote
|
@@ -0,0 +1,60 @@
|
|
1
|
+
%div
|
2
|
+
%div
|
3
|
+
%div
|
4
|
+
%canvas(id="canvas" height="450" width="800")
|
5
|
+
|
6
|
+
- sales_value = ->(h) { h[:sales].to_i }
|
7
|
+
:javascript
|
8
|
+
//Chart.defaults.global.multiTooltipTemplate = "<%= datasetLabel %>: <%= value %>";
|
9
|
+
Chart.defaults.global.hover.mode = 'label';
|
10
|
+
Chart.defaults.global.tooltips.mode = 'label';
|
11
|
+
|
12
|
+
var salesData = {
|
13
|
+
labels : [#{plot_data.values.map{|v| "'#{v[:label].to_s}'"}.join(',')}],
|
14
|
+
datasets : [
|
15
|
+
{
|
16
|
+
label: "Product sales",
|
17
|
+
fill: false,
|
18
|
+
lineTension: 0.2,
|
19
|
+
borderColor: "rgba(75,192,142,1)",
|
20
|
+
borderCapStyle: 'round',
|
21
|
+
pointBorderColor: "rgba(75,142,112,1)",
|
22
|
+
pointBackgroundColor: "#fff",
|
23
|
+
pointBorderWidth: 1,
|
24
|
+
pointHoverRadius: 8,
|
25
|
+
pointHoverBackgroundColor: "rgba(75,192,192,1)",
|
26
|
+
pointHoverBorderColor: "rgba(220,220,220,1)",
|
27
|
+
pointHoverBorderWidth: 2,
|
28
|
+
pointRadius: 2,
|
29
|
+
pointHitRadius: 10,
|
30
|
+
data : [#{plot_data.values.map(&sales_value).join(',')}]
|
31
|
+
},
|
32
|
+
{
|
33
|
+
label: "Product stock",
|
34
|
+
fill: true,
|
35
|
+
lineTension: 0.2,
|
36
|
+
backgroundColor: "rgba(175,155,155,0.4)",
|
37
|
+
borderColor: "rgba(105,112,172,1)",
|
38
|
+
borderCapStyle: 'round',
|
39
|
+
pointBorderColor: "rgba(155,152,182,1)",
|
40
|
+
pointBackgroundColor: "#fff",
|
41
|
+
pointBorderWidth: 1,
|
42
|
+
pointHoverRadius: 8,
|
43
|
+
pointHoverBackgroundColor: "rgba(99,102,152,1)",
|
44
|
+
pointHoverBorderColor: "rgba(210,210,210,1)",
|
45
|
+
pointHoverBorderWidth: 2,
|
46
|
+
pointRadius: 2,
|
47
|
+
pointHitRadius: 10,
|
48
|
+
data : [#{plot_data.values.map{|v| v[:stock].nil? ? 'null' : v[:stock].to_i}.join(',')}]
|
49
|
+
/*data : [#{plot_data.values.map{|v| v[:stock].to_i}.join(',')}]*/
|
50
|
+
}
|
51
|
+
]
|
52
|
+
}
|
53
|
+
|
54
|
+
var ctx = document.getElementById("canvas").getContext("2d");
|
55
|
+
window.myLine = new Chart(ctx, {
|
56
|
+
type: 'line',
|
57
|
+
data: salesData,
|
58
|
+
options: {},
|
59
|
+
responsive: true,
|
60
|
+
});
|
@@ -0,0 +1,29 @@
|
|
1
|
+
= haml "products/menu".to_sym
|
2
|
+
|
3
|
+
%h1 Link "#{@product.name}" to ...
|
4
|
+
|
5
|
+
:javascript
|
6
|
+
$(function() {
|
7
|
+
$( "#tabs" ).tabs();
|
8
|
+
});
|
9
|
+
|
10
|
+
#tabs
|
11
|
+
%ul
|
12
|
+
- if !@product.link_suggestions.empty?
|
13
|
+
%li
|
14
|
+
%a(href="#tab_suggestions") Suggestions
|
15
|
+
%li
|
16
|
+
%a(href="#tab_unlinked") Unlinked
|
17
|
+
%li
|
18
|
+
%a(href="#tab_linked") Linked
|
19
|
+
- if !@product.link_suggestions.empty?
|
20
|
+
#tab_suggestions
|
21
|
+
%h2 Suggestions
|
22
|
+
= haml "products/_link_table".to_sym, locals: {products: @product.link_suggestions }
|
23
|
+
#tab_unlinked
|
24
|
+
%h2 Unlinked Remote Products
|
25
|
+
= haml "products/_link_table".to_sym, locals: {products: @remote_products.unlinked}
|
26
|
+
#tab_linked
|
27
|
+
%h2 Already Linked Remote Products
|
28
|
+
= haml "products/_link_table".to_sym, locals: {products: @remote_products.linked}
|
29
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
= haml "products/menu".to_sym
|
2
|
+
|
3
|
+
%h1= @product.name
|
4
|
+
|
5
|
+
%form.pure-form.pure-form-aligned(action="" method="post")
|
6
|
+
%input(type="hidden" name="_method" value="put")
|
7
|
+
%fieldset
|
8
|
+
.pure-control-group
|
9
|
+
%label(for="product_id") Product ID
|
10
|
+
%input#product_id(type="text" readonly value="#{@product.product_id}")
|
11
|
+
.pure-control-group
|
12
|
+
%label(for="product_page") Product Page (Shop frontend)
|
13
|
+
- frontend_url = Rawbotz::LocalShop.product_page_frontend(@product, settings.conf)
|
14
|
+
%a(href="#{frontend_url}" target="blank")
|
15
|
+
= frontend_url
|
16
|
+
.pure-control-group
|
17
|
+
%label(for="product_page") Product Page (Shop backend)
|
18
|
+
- backend_url = Rawbotz::LocalShop.product_page_backend(@product, settings.conf)
|
19
|
+
%a(href="#{backend_url}" target="blank")
|
20
|
+
= backend_url
|
21
|
+
.pure-control-group
|
22
|
+
%label(for="supplier") Supplier
|
23
|
+
= @product.supplier.try(:name)
|
24
|
+
.pure-control-group
|
25
|
+
%label(for="supplier") Remote Product
|
26
|
+
- if @product.remote_product.nil?
|
27
|
+
%a(href="/product/#{@product.id}/link") Link to ...
|
28
|
+
- else
|
29
|
+
= remote_product_link @product
|
30
|
+
.pure-control-group
|
31
|
+
%label(for="packsize") Pack size
|
32
|
+
= @product.packsize
|
33
|
+
.pure-control-group
|
34
|
+
%label(for="shelve") Shelve
|
35
|
+
= @product.shelve_nr
|
36
|
+
|
37
|
+
%h2 Actions
|
38
|
+
- if !@product.remote_product.present?
|
39
|
+
= haml "widgets/_link".to_sym, locals: {local_product: @product, redirect_to: 'product'}
|
40
|
+
%br
|
41
|
+
= haml :"_hide_unhide_button", locals: {product: @product}
|
42
|
+
|
43
|
+
- if @plot_data.any?
|
44
|
+
.pure-g
|
45
|
+
.pure-u-1-1
|
46
|
+
%h2 Stock and Sales Values (30 days)
|
47
|
+
.pure-u-2-5
|
48
|
+
%table.pure-table
|
49
|
+
%thead
|
50
|
+
%tr
|
51
|
+
%th Date
|
52
|
+
%th Qty in Stock
|
53
|
+
%th Qty Sold
|
54
|
+
%tbody
|
55
|
+
- @plot_data.values.each do |s|
|
56
|
+
%tr{:class => s[:stock].to_i <= 0 ? "empty-stock" : ""}
|
57
|
+
%td= s[:label]
|
58
|
+
%td= s[:stock]
|
59
|
+
%td= s[:sales]
|
60
|
+
|
61
|
+
.pure-u-3-5
|
62
|
+
= haml :"product/_stock_sales_plot", locals: {plot_data: @plot_data}
|
63
|
+
-#%h2 Orders
|
64
|
+
-#= product.order_items.order ... link
|
@@ -0,0 +1,38 @@
|
|
1
|
+
%table.pure-table.pure-table-striped
|
2
|
+
%thead
|
3
|
+
%tr
|
4
|
+
%th Product Name
|
5
|
+
%th Product ID
|
6
|
+
%th Supplier
|
7
|
+
%th Action
|
8
|
+
%tbody
|
9
|
+
-# find_each does not work on link_suggestions array
|
10
|
+
- products.each do |product|
|
11
|
+
%tr
|
12
|
+
%td= product.name
|
13
|
+
%td= product.product_id
|
14
|
+
%td= product.supplier.try(:name)
|
15
|
+
%td
|
16
|
+
%form.pure-form.pure-form-aligned(action="" method="post")
|
17
|
+
%input(type="hidden" name="remote_product_id" value="#{product.id}")
|
18
|
+
- if @product.remote_product.nil?
|
19
|
+
- if product.local_product
|
20
|
+
Currently linked to #{product.local_product.name}
|
21
|
+
%button.pure-button.pure-button-primary(type="submit")
|
22
|
+
= link_icon
|
23
|
+
Set link
|
24
|
+
- else
|
25
|
+
%button.pure-button.pure-button-primary(type="submit")
|
26
|
+
= link_icon
|
27
|
+
Create link
|
28
|
+
- else
|
29
|
+
-#Currently linked to #{product_link @prod
|
30
|
+
- if product.local_product
|
31
|
+
Currently already linked to #{product.local_product.name}
|
32
|
+
%button.pure-button.pure-button-error(type="submit")
|
33
|
+
= link_icon
|
34
|
+
Set Link
|
35
|
+
- else
|
36
|
+
%button.pure-button.pure-button-error(type="submit")
|
37
|
+
= link_icon
|
38
|
+
Set Link
|