rawbotz 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rawbotz/public/rawbotz.css +33 -0
- data/lib/rawbotz/public/rawbotz.js +16 -2
- data/lib/rawbotz/version.rb +1 -1
- data/lib/rawbotz/views/index.haml +14 -0
- data/lib/rawbotz/views/order/_item_table.haml +22 -22
- data/lib/rawbotz/views/order/non_remote.haml +8 -11
- data/lib/rawbotz/views/product/view.haml +1 -1
- data/lib/rawbotz/views/products/index.haml +2 -0
- data/lib/rawbotz/views/products/table.haml +11 -6
- data/lib/rawbotz/views/supplier/view.haml +83 -54
- data/lib/rawbotz/views/widgets/_qty_wished_input.haml +14 -0
- data/lib/rawbotz/views/widgets/_stock_sales.haml +4 -0
- data/lib/rawbotz.rb +2 -1
- data/rawbotz.gemspec +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 402f796c506cac2364cab880d48e8181c69cf8d0
|
4
|
+
data.tar.gz: c2b42f12e6c8eea8f23e5e7037f53fb15136130c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 453857bee3be25903bf77b984cf137b2e28ff59539478b9773ba077bcfaac4b3f08f15d68ae2fa2b5081a3b65cc9b54d3086cf030fe09afc659c76ce1e9d97e5
|
7
|
+
data.tar.gz: 60662be5fae280a77f09ac2ee953cfb9d3b4a72bfe97864c437024077533d7c2f054d6bc58dc502eebea18a19bd79b3889280ab96ef318ff661774126a003541
|
@@ -57,4 +57,37 @@ th {
|
|
57
57
|
.float_ul li a {
|
58
58
|
width: 10em;
|
59
59
|
float: left;
|
60
|
+
}
|
61
|
+
.center {
|
62
|
+
text-align: center;
|
63
|
+
}
|
64
|
+
.huge-icon {
|
65
|
+
font-size: 500%;
|
66
|
+
color: #444;
|
67
|
+
}
|
68
|
+
.huge-icon:hover {
|
69
|
+
color: #246;
|
70
|
+
}
|
71
|
+
.wished_qty_input {
|
72
|
+
display: table-row;
|
73
|
+
}
|
74
|
+
.wished_qty_input input.qty {
|
75
|
+
width: 3em;
|
76
|
+
display: table-cell;
|
77
|
+
}
|
78
|
+
.wished_qty_input .packsize-buttons {
|
79
|
+
display: table-cell;
|
80
|
+
/*font-size: 50%;*/
|
81
|
+
padding-left: 0px;
|
82
|
+
padding-top: 0px;
|
83
|
+
padding-bottom: 0px;
|
84
|
+
padding-right: 5px;
|
85
|
+
vertical-align: middle;
|
86
|
+
}
|
87
|
+
.wished_qty_input .minus-pack, .wished_qty_input .plus-pack {
|
88
|
+
font-size: 50%;
|
89
|
+
display: block;
|
90
|
+
}
|
91
|
+
.wished_qty_input .order-none {
|
92
|
+
display: table-cell;
|
60
93
|
}
|
@@ -33,7 +33,10 @@ $(document).ready(function() {
|
|
33
33
|
// For Non-Remote Order Forms: add a pack
|
34
34
|
$("button.plus-pack").click(function(e) {
|
35
35
|
e.preventDefault();
|
36
|
-
|
36
|
+
|
37
|
+
input_id = $(this).data("reference_input_id");
|
38
|
+
inputField = $('#' + input_id);
|
39
|
+
|
37
40
|
current = parseInt(inputField.val());
|
38
41
|
if (isNaN(current)) {
|
39
42
|
current = 0;
|
@@ -49,7 +52,9 @@ $(document).ready(function() {
|
|
49
52
|
// For Non-Remote Order Forms: subtract a pack
|
50
53
|
$("button.minus-pack").click(function(e) {
|
51
54
|
e.preventDefault();
|
52
|
-
|
55
|
+
|
56
|
+
input_id = $(this).data("reference_input_id");
|
57
|
+
inputField = $("#" + input_id);
|
53
58
|
current = parseInt(inputField.val());
|
54
59
|
if (isNaN(current)) {
|
55
60
|
current = 0;
|
@@ -92,5 +97,14 @@ $(document).ready(function() {
|
|
92
97
|
$('#modal-plot').load(url);
|
93
98
|
$('#modal-plot').dialog("open");
|
94
99
|
});
|
100
|
+
|
101
|
+
// Fill order item input with last value
|
102
|
+
$("button.reorder").click(function(e) {
|
103
|
+
e.preventDefault();
|
104
|
+
var order_item_id = $(e.target).data('order_item_id');
|
105
|
+
var num_wished = $(e.target).data('num_wished');
|
106
|
+
$("#item_" + order_item_id).val(num_wished);
|
107
|
+
});
|
108
|
+
|
95
109
|
});
|
96
110
|
|
data/lib/rawbotz/version.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
%table.pure-table.pure-table-bordered
|
3
3
|
%thead
|
4
4
|
%tr
|
5
|
-
%th Product ID
|
6
|
-
%th Product Name
|
7
|
-
%th Stock (at time
|
8
|
-
%th
|
9
|
-
%th
|
10
|
-
|
11
|
-
%th Stock/Sales history
|
5
|
+
%th(style="width: 5%;") Product ID
|
6
|
+
%th(style="width: 50%;") Product Name
|
7
|
+
%th(style="width: 10%;") Stock (at order- time) / min stock
|
8
|
+
%th(style="width: 20%;") Order
|
9
|
+
%th(style="width: 5%;")
|
10
|
+
%i.fa.fa-cube
|
11
|
+
%th(style="width: 10%;") Stock/ Sales history
|
12
12
|
%tbody
|
13
13
|
- order_items.each do |order_item|
|
14
14
|
%tr
|
@@ -19,26 +19,26 @@
|
|
19
19
|
No local product!
|
20
20
|
%td
|
21
21
|
= local_product_link order_item.local_product
|
22
|
-
%td
|
23
|
-
|
22
|
+
%td
|
23
|
+
= order_item.current_stock
|
24
|
+
\/
|
25
|
+
= order_item.min_stock
|
26
|
+
- last_order_item = order_item.order_item_same_product(order_item.updated_at).first
|
27
|
+
- if last_order_item.present? && last_order_item.num_wished
|
28
|
+
%br
|
29
|
+
%button.pure-button.reorder(data-order_item_id="#{order_item.id}" data-num_wished="#{last_order_item.num_wished}")
|
30
|
+
= last_order_item.order.updated_at.strftime("%Y-%m-%d")
|
31
|
+
%br
|
32
|
+
= last_order_item.num_wished
|
33
|
+
\/
|
34
|
+
= last_order_item.num_ordered
|
24
35
|
%td
|
25
36
|
- if order_item.remote_product_id.present?
|
26
|
-
|
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)
|
37
|
+
= haml "widgets/_qty_wished_input".to_sym, locals: {product: order_item.local_product}
|
38
38
|
- else
|
39
39
|
No remote product
|
40
40
|
%td= order_item.local_product.packsize
|
41
41
|
%td
|
42
42
|
- stock_url = "/product/#{order_item.local_product.id}/stock_sales_plot"
|
43
43
|
%a.stock_show_action{:href => "", :data => {url: stock_url, product: order_item.local_product.name}}
|
44
|
-
|
44
|
+
Stock/Sales
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
%h1 Non-Remote Order for supplier #{@supplier.name}
|
4
4
|
|
5
|
+
#modal-plot.modal-plot
|
6
|
+
|
5
7
|
%center
|
6
8
|
%form.pure-form(action="" method="post")
|
7
9
|
%input(name="supplier_id" type="hidden" value="#{@supplier.id}")
|
@@ -11,28 +13,23 @@
|
|
11
13
|
%th Name
|
12
14
|
%th Qty
|
13
15
|
%th Packsize
|
14
|
-
|
16
|
+
%th Stock/ Sales
|
15
17
|
%tbody
|
16
18
|
- @products.find_each do |product|
|
17
19
|
%tr
|
18
20
|
%td
|
19
21
|
= product_link product
|
20
22
|
%td
|
21
|
-
|
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
|
23
|
+
= haml "widgets/_qty_wished_input".to_sym, locals: {product: product}
|
31
24
|
%td
|
32
25
|
- if product.packsize.present?
|
33
26
|
= product.packsize
|
34
27
|
- else
|
35
28
|
%i.fa.fa-ban
|
29
|
+
%td
|
30
|
+
- stock_url = "/product/#{product.id}/stock_sales_plot"
|
31
|
+
%a.stock_show_action{:href => "", :data => {url: stock_url, product: product.name}}
|
32
|
+
Stock/Sales
|
36
33
|
|
37
34
|
|
38
35
|
%br
|
@@ -7,14 +7,19 @@
|
|
7
7
|
Product ID
|
8
8
|
%th
|
9
9
|
Supplier
|
10
|
-
|
11
|
-
|
10
|
+
%th
|
11
|
+
Stock/ Sales
|
12
12
|
%tbody
|
13
13
|
- products.each do |product|
|
14
14
|
%tr
|
15
15
|
%td
|
16
16
|
= product_link product
|
17
|
-
%td
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
%td
|
18
|
+
= product.product_id
|
19
|
+
%td
|
20
|
+
= supplier_link product.supplier
|
21
|
+
%td
|
22
|
+
= haml "widgets/_stock_sales".to_sym, locals: {product: product}
|
23
|
+
- stock_url = "/product/#{product.id}/stock_sales_plot"
|
24
|
+
%a.stock_show_action{:href => "", :data => {url: stock_url, product: product.name}}
|
25
|
+
Stock/Sales
|
@@ -5,59 +5,88 @@
|
|
5
5
|
|
6
6
|
%h2 Supplier #{@supplier.name}
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
%label(for="email") E-Mail address
|
13
|
-
%input#email(name="email" type="email" value="#{@supplier.email}")
|
8
|
+
:javascript
|
9
|
+
$(function() {
|
10
|
+
$( "#tabs" ).tabs();
|
11
|
+
});
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
#tabs
|
14
|
+
%ul
|
15
|
+
%li
|
16
|
+
%a(href="#tab_products")
|
17
|
+
= products_icon
|
18
|
+
Products
|
19
|
+
%li
|
20
|
+
%a(href="#tab_orders")
|
21
|
+
= order_icon
|
22
|
+
Orders
|
23
|
+
%li
|
24
|
+
%a(href="#tab_order_settings")
|
25
|
+
= settings_icon
|
26
|
+
Order Settings
|
27
|
+
#tab_products
|
28
|
+
%h2 Products of #{@supplier.name}
|
29
|
+
= haml "products/table".to_sym, locals: {products: @supplier.local_products.all}
|
30
|
+
#tab_orders
|
31
|
+
%h2 Orders of #{@supplier.name}
|
32
|
+
- @supplier.orders.find_each do |order|
|
33
|
+
= order.id
|
34
|
+
#tab_order_settings
|
35
|
+
%h2 Settings for #{@supplier.name}
|
18
36
|
|
19
|
-
.pure-
|
20
|
-
%
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
37
|
+
%form.pure-form.pure-form-aligned(action="" method="post")
|
38
|
+
%input(type="hidden" name="_method" value="put")
|
39
|
+
%fieldset
|
40
|
+
.pure-control-group
|
41
|
+
%label(for="email") E-Mail address
|
42
|
+
%input#email(name="email" type="email" value="#{@supplier.email}")
|
43
|
+
|
44
|
+
.pure-control-group
|
45
|
+
%label(for="order_template") Order Template
|
46
|
+
%textarea#order_template(name="order_template" value="#{@supplier.order_template}" rows="10" cols="80")~ @supplier.order_template
|
47
|
+
|
48
|
+
.pure-control-group
|
49
|
+
%button.pure-button.pure-button-primary
|
50
|
+
%i.fa.fa-save
|
51
|
+
Save
|
52
|
+
%h3 Help
|
53
|
+
.pure-control-group
|
54
|
+
%em
|
55
|
+
How to fill out templates:
|
56
|
+
.pure-control-group
|
57
|
+
See the example template in the following textarea. The line starting with a star (*) will be repeated. A list of supported symbols can be found below.
|
58
|
+
%br
|
59
|
+
%textarea#example_order_template(name="example_order_template" readonly rows="10" cols="80")
|
60
|
+
:preserve
|
61
|
+
SUBJECT=Order NAME
|
62
|
+
|
63
|
+
Dear NAME,
|
64
|
+
|
65
|
+
We will order
|
66
|
+
|
67
|
+
* PRODUCTCODE QTY (NUM_PACKS of PACKSIZE) PRODUCTNAME
|
68
|
+
|
69
|
+
Thank you,
|
70
|
+
|
71
|
+
us.
|
72
|
+
%br
|
73
|
+
Following symbols are supported:
|
74
|
+
%br
|
75
|
+
%dl
|
76
|
+
%dt SUBJECT=
|
77
|
+
%dd will be subject of the mail (and NOT included in mail itself)
|
78
|
+
%dt NAME
|
79
|
+
%dd will be replaced by this suppliers name
|
80
|
+
%dt *
|
81
|
+
%dd the line starting with a star will be iterated over with every product
|
82
|
+
%dt PRODUCTCODE
|
83
|
+
%dd the product code as stored in magento
|
84
|
+
%dt QTY
|
85
|
+
%dd quantity ordered
|
86
|
+
%dt NUM_PACKS
|
87
|
+
%dd quantity ordered (in packs of PACKSIZE)
|
88
|
+
%dt PACKSIZE
|
89
|
+
%dd packsize as stored in magento
|
90
|
+
%dt PRODUCTNAME
|
91
|
+
%dd the products name
|
92
|
+
%br
|
@@ -0,0 +1,14 @@
|
|
1
|
+
.wished_qty_input
|
2
|
+
- input_id = "item_#{product.id}"
|
3
|
+
%input.qty(id=input_id name=input_id size="2")
|
4
|
+
- packsize = product.packsize
|
5
|
+
- if packsize.present?
|
6
|
+
.packsize-buttons
|
7
|
+
%button.pure-button.plus-pack(data-packsize=packsize data-reference_input_id=input_id)
|
8
|
+
%i.fa.fa-plus-square
|
9
|
+
%i.fa.fa-cube
|
10
|
+
%button.pure-button.minus-pack(data-packsize=packsize data-reference_input_id=input_id)
|
11
|
+
%i.fa.fa-minus-square
|
12
|
+
%i.fa.fa-cube
|
13
|
+
%button.pure-button.order-none
|
14
|
+
%i.fa.fa-remove
|
data/lib/rawbotz.rb
CHANGED
@@ -4,12 +4,13 @@ require "rawbotz/local_shop"
|
|
4
4
|
require "rawbotz/order_processor"
|
5
5
|
require "rawbotz/datapolate"
|
6
6
|
require "rawbotz/product_updater"
|
7
|
-
require "rawbotz/routes"
|
8
7
|
require "rawbotz/mail_template"
|
9
8
|
|
10
9
|
require 'rawgento_models'
|
11
10
|
require 'rawgento_db'
|
12
11
|
|
12
|
+
require "rawbotz/routes"
|
13
|
+
|
13
14
|
require 'ostruct'
|
14
15
|
require 'yaml'
|
15
16
|
require 'pony'
|
data/rawbotz.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency "sinatra", '~> 1.4'
|
23
23
|
spec.add_dependency 'pony', '~> 1.11'
|
24
24
|
spec.add_dependency 'haml', '~> 4.0'
|
25
|
-
spec.add_dependency "rawgento_models", '~> 0.2.
|
25
|
+
spec.add_dependency "rawgento_models", '~> 0.2.3'
|
26
26
|
spec.add_dependency "rawgento_db", "~> 0.1.1"
|
27
27
|
spec.add_dependency "magento_remote"
|
28
28
|
spec.add_dependency "terminal-table", '~> 1.5'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rawbotz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Wolfsteller
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.2.
|
61
|
+
version: 0.2.3
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.2.
|
68
|
+
version: 0.2.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rawgento_db
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -298,6 +298,8 @@ files:
|
|
298
298
|
- lib/rawbotz/views/widgets/_ajax_link.haml
|
299
299
|
- lib/rawbotz/views/widgets/_link.haml
|
300
300
|
- lib/rawbotz/views/widgets/_link_line.haml
|
301
|
+
- lib/rawbotz/views/widgets/_qty_wished_input.haml
|
302
|
+
- lib/rawbotz/views/widgets/_stock_sales.haml
|
301
303
|
- rawbotz.gemspec
|
302
304
|
homepage: https://rawliving-germany.github.io/rawbotz/
|
303
305
|
licenses:
|