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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81bcca5d73862da12d5eb4ed197377f0866bae8c
4
- data.tar.gz: 903e12e32aade0a32acc87310d820b574e6edf0e
3
+ metadata.gz: 402f796c506cac2364cab880d48e8181c69cf8d0
4
+ data.tar.gz: c2b42f12e6c8eea8f23e5e7037f53fb15136130c
5
5
  SHA512:
6
- metadata.gz: 081bc679e520975b5df4541200295bf9925798cacbad4246582b998c539a3bb1a3cc8a561bd6d36ce8b6e58955405094eb613fb82492de5229313fd4077888a7
7
- data.tar.gz: c20fd92925a37221f111e5156ef9f9db0da466e4469f0002869a1422e8eed9924bfbe4dd23cc5d06f9052f7716e2cddc7264ce537ecf8652087499a8ee3dab7a
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
- inputField = $(this).siblings("input");
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
- inputField = $(this).siblings("input");
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
 
@@ -1,3 +1,3 @@
1
1
  module Rawbotz
2
- VERSION = "0.1.2".freeze
2
+ VERSION = "0.1.3".freeze
3
3
  end
@@ -1 +1,15 @@
1
1
  %h1 Welcome at Rawbotz
2
+
3
+ #main-threes.pure-g
4
+ .pure-u-1-3.center
5
+ %i.fa.fa-shopping-cart.huge-icon
6
+ %br
7
+ Order
8
+ .pure-u-1-3.center
9
+ %i.fa.fa-cubes.huge-icon
10
+ %br
11
+ Products
12
+ .pure-u-1-3.center
13
+ %i.fa.fa-truck.huge-icon
14
+ %br
15
+ Supplier
@@ -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 of Order)
8
- %th Min Stock
9
- %th Order
10
- %th Packsize
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= order_item.current_stock
23
- %td= order_item.min_stock
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
- %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)
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
- Show Stock/Sale data
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
- -#%th Stock and Sales
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
- %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
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
@@ -20,7 +20,7 @@
20
20
  = backend_url
21
21
  .pure-control-group
22
22
  %label(for="supplier") Supplier
23
- = @product.supplier.try(:name)
23
+ = supplier_link @product.supplier
24
24
  .pure-control-group
25
25
  %label(for="supplier") Remote Product
26
26
  - if @product.remote_product.nil?
@@ -2,6 +2,8 @@
2
2
 
3
3
  %h1 Products by Supplier
4
4
 
5
+ #modal-plot.modal-plot
6
+
5
7
  :javascript
6
8
  $(function() {
7
9
  $( "#tabs" ).tabs();
@@ -7,14 +7,19 @@
7
7
  Product ID
8
8
  %th
9
9
  Supplier
10
- -#%th
11
- -# Last Stock
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= product.product_id
18
- %td= product.supplier.try(:name)
19
- -#%td
20
- -# %a(href="") Show modal
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
- %form.pure-form.pure-form-aligned(action="" method="post")
9
- %input(type="hidden" name="_method" value="put")
10
- %fieldset
11
- .pure-control-group
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
- .pure-control-group
16
- %label(for="order_template") Order Template
17
- %textarea#order_template(name="order_template" value="#{@supplier.order_template}" rows="10" cols="80")~ @supplier.order_template
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-control-group
20
- %button.pure-button.pure-button-primary
21
- %i.fa.fa-save
22
- Save
23
- %h3 Help
24
- .pure-control-group
25
- %em
26
- How to fill out templates:
27
- .pure-control-group
28
- 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.
29
- %br
30
- %textarea#example_order_template(name="example_order_template" readonly rows="10" cols="80")
31
- :preserve
32
- SUBJECT=Order NAME
33
-
34
- Dear NAME,
35
-
36
- We will order
37
-
38
- * PRODUCTCODE QTY (QTY_PACKS of PACKSIZE) PRODUCTNAME
39
-
40
- Thank you,
41
-
42
- us.
43
- %br
44
- Following symbols are supported:
45
- %br
46
- %dl
47
- %dt SUBJECT=
48
- %dd will be subject of the mail (and NOT included in mail itself)
49
- %dt NAME
50
- %dd will be replaced by this suppliers name
51
- %dt *
52
- %dd the line starting with a star will be iterated over with every product
53
- %dt PRODUCTCODE
54
- %dd the product code as stored in magento
55
- %dt QTY
56
- %dd quantity ordered
57
- %dt QTY_PACKS
58
- %dd quantity ordered (in packs of PACKSIZE)
59
- %dt PACKSIZE
60
- %dd packsize as stored in magento
61
- %dt PRODUCTNAME
62
- %dd the products name
63
- %br
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
@@ -0,0 +1,4 @@
1
+ - stock_url = "/product/#{product.id}/stock_sales_plot"
2
+ %a.stock_show_action{:href => "", :data => {url: stock_url,
3
+ product: product.name}}
4
+
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.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.2
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-07 00:00:00.000000000 Z
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.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.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: