stockor 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile.lock +38 -40
  4. data/client/skr/Extension.coffee +8 -9
  5. data/client/skr/components/address/Address.cjsx +51 -0
  6. data/client/skr/components/address/styles.scss +6 -0
  7. data/client/skr/index.js +1 -4
  8. data/client/skr/models/Customer.coffee +1 -1
  9. data/client/skr/models/GlAccount.coffee +11 -11
  10. data/client/skr/models/SalesOrder.coffee +0 -2
  11. data/client/skr/screens/Base.coffee +8 -2
  12. data/client/skr/screens/customer-maint/CustomerMaint.cjsx +58 -0
  13. data/client/skr/screens/customer-maint/index.js +1 -5
  14. data/client/skr/screens/customer-maint/index.scss +2 -0
  15. data/client/skr/screens/sales-order/index.js +1 -1
  16. data/client/skr/screens/sku-maint/index.js +1 -1
  17. data/client/skr/screens/vendor-maint/index.js +1 -1
  18. data/client/skr/styles.scss +23 -0
  19. data/coffeelint.json +49 -0
  20. data/config/screens.rb +41 -44
  21. data/db/migrate/20140322014401_create_skr_inventory_adjustments.rb +1 -1
  22. data/db/migrate/20140322223912_create_skr_sales_orders.rb +1 -2
  23. data/db/migrate/20140327202102_create_skr_purchase_orders.rb +1 -1
  24. data/db/migrate/20140327224000_create_skr_invoices.rb +1 -1
  25. data/db/migrate/20140330232810_create_skr_sku_qty_details_view.rb +2 -2
  26. data/db/migrate/20140400164729_create_skr_vouchers.rb +2 -6
  27. data/db/schema.sql +50 -1
  28. data/db/seed.rb +1 -1
  29. data/lib/skr/access_roles.rb +3 -2
  30. data/lib/skr/db/migration_helpers.rb +4 -0
  31. data/lib/skr/extension.rb +3 -2
  32. data/lib/skr/models/inventory_adjustment.rb +4 -0
  33. data/lib/skr/models/invoice.rb +6 -0
  34. data/lib/skr/models/purchase_order.rb +6 -2
  35. data/lib/skr/models/sales_order.rb +3 -3
  36. data/lib/skr/models/voucher.rb +6 -0
  37. data/lib/skr/version.rb +1 -1
  38. data/spec/skr/models/CustomerSpec.coffee +6 -12
  39. data/spec/skr/models/SalesOrderSpec.coffee +1 -1
  40. data/spec/skr/screens/CustomerMaint.coffee +1 -1
  41. data/spec/skr/screens/sales-order/SalesOrderSpec.coffee +1 -1
  42. data/spec/skr/screens/sku-maint/SkuMaintSpec.coffee +1 -1
  43. data/spec/skr/screens/vendor-maint/VendorMaintSpec.coffee +1 -1
  44. metadata +7 -5
  45. data/client/skr/components/address/Address.coffee +0 -20
  46. data/client/skr/screens/customer-maint/CustomerMaint.coffee +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f560ee8a3baf00f8132abaa16e7102af0a754628
4
- data.tar.gz: fc2279a4c83c7503f8ed05236ee15bb7a0c53f66
3
+ metadata.gz: 0a414367906d22c62241eefcdd7dd7e1222f5f14
4
+ data.tar.gz: 5c774edc4a5bebe21b462e00c815201a71bb8d8a
5
5
  SHA512:
6
- metadata.gz: 39612948c454591b7103a2528df39178141427af782c91e6f291a75772b467c2e535c2ce80b03060d56370ade3278ed7c621a9ca732f9e0d4b1040dfa9b40f48
7
- data.tar.gz: ad721dbe0d756b452385afb05309ad9667d257ddccf011adceab0e7526cfdea17e34f0651d83df77de8589a1d971926900f2c362346cf3ea1141af06875fb5d0
6
+ metadata.gz: a3e8300d12e447cf2dc450ee1e62949926e797327a8210b92bb7fea109860d5dd76a60fc123f190186c20eed38cb21be252984d912949109821afb7b98e753c1
7
+ data.tar.gz: 928f00055f0c0269c863169e08997c6501bc2b2f3fd4612eae934ffef4eed3361ef880f203f07250c65630a3991ed8eaa2cefa2243a2291a85a92ca83fc5bf35
data/.gitignore CHANGED
@@ -2,4 +2,5 @@ public/assets
2
2
  tmp/cache
3
3
  log/
4
4
  secrets.yml
5
+ .DS_Store
5
6
  pkg
data/Gemfile.lock CHANGED
@@ -1,12 +1,13 @@
1
1
  GIT
2
2
  remote: git://github.com/argosity/lanes.git
3
- revision: 3574e2186fff13c0bc6203ce1fd437f30142e500
3
+ revision: 208a0fafd5337b4299e2f123c97e8ddee6a19d32
4
4
  branch: master
5
5
  specs:
6
- lanes (0.1.9)
6
+ lanes (0.1.9.5)
7
7
  activerecord (~> 4.2)
8
8
  bcrypt (~> 3.1)
9
9
  closure-compiler (~> 1.1)
10
+ coffee-react (~> 3.0)
10
11
  coffee-script (~> 2.3)
11
12
  compass-import-once (~> 1.0)
12
13
  execjs (~> 2.2)
@@ -35,22 +36,22 @@ GIT
35
36
  PATH
36
37
  remote: .
37
38
  specs:
38
- stockor (0.1.8)
39
+ stockor (0.1.9)
39
40
  aasm (~> 4.1)
40
41
  lanes
41
42
 
42
43
  GEM
43
44
  remote: https://rubygems.org/
44
45
  specs:
45
- aasm (4.1.0)
46
- activemodel (4.2.1)
47
- activesupport (= 4.2.1)
46
+ aasm (4.2.0)
47
+ activemodel (4.2.3)
48
+ activesupport (= 4.2.3)
48
49
  builder (~> 3.1)
49
- activerecord (4.2.1)
50
- activemodel (= 4.2.1)
51
- activesupport (= 4.2.1)
50
+ activerecord (4.2.3)
51
+ activemodel (= 4.2.3)
52
+ activesupport (= 4.2.3)
52
53
  arel (~> 6.0)
53
- activesupport (4.2.1)
54
+ activesupport (4.2.3)
54
55
  i18n (~> 0.7)
55
56
  json (~> 1.7, >= 1.7.7)
56
57
  minitest (~> 5.1)
@@ -61,12 +62,12 @@ GEM
61
62
  builder (3.2.2)
62
63
  byebug (4.0.5)
63
64
  columnize (= 0.9.0)
64
- celluloid (0.16.0)
65
- timers (~> 4.0.0)
66
65
  childprocess (0.5.6)
67
66
  ffi (~> 1.0, >= 1.0.11)
68
67
  closure-compiler (1.1.11)
69
68
  coderay (1.1.0)
69
+ coffee-react (3.0.1)
70
+ execjs
70
71
  coffee-script (2.4.1)
71
72
  coffee-script-source
72
73
  execjs
@@ -75,16 +76,15 @@ GEM
75
76
  compass-import-once (1.0.5)
76
77
  sass (>= 3.2, < 3.5)
77
78
  crass (1.0.2)
78
- eventmachine (1.0.7)
79
79
  execjs (2.5.2)
80
80
  faker (1.4.3)
81
81
  i18n (~> 0.5)
82
- ffi (1.9.8)
82
+ ffi (1.9.10)
83
83
  formatador (0.2.5)
84
84
  growl (1.0.3)
85
- guard (2.12.5)
85
+ guard (2.12.8)
86
86
  formatador (>= 0.2.4)
87
- listen (~> 2.7)
87
+ listen (>= 2.7, <= 4.0)
88
88
  lumberjack (~> 1.0)
89
89
  nenv (~> 0.1)
90
90
  notiffany (~> 0.0)
@@ -92,7 +92,7 @@ GEM
92
92
  shellany (~> 0.0)
93
93
  thor (>= 0.18.1)
94
94
  guard-compat (1.2.1)
95
- guard-jasmine (2.0.5)
95
+ guard-jasmine (2.0.6)
96
96
  childprocess (~> 0.5)
97
97
  guard (~> 2.8)
98
98
  guard-compat (~> 1.2)
@@ -103,35 +103,32 @@ GEM
103
103
  guard-minitest (2.4.4)
104
104
  guard-compat (~> 1.2)
105
105
  minitest (>= 3.0)
106
- hashie (3.4.1)
106
+ hashie (3.4.2)
107
107
  hike (1.2.3)
108
- hitimes (1.2.2)
109
108
  i18n (0.7.0)
110
- jasmine (2.2.0)
111
- jasmine-core (~> 2.2)
109
+ jasmine (2.3.0)
110
+ jasmine-core (~> 2.3)
112
111
  phantomjs
113
112
  rack (>= 1.2.1)
114
113
  rake
115
- jasmine-core (2.2.0)
116
- json (1.8.2)
117
- listen (2.10.0)
118
- celluloid (~> 0.16.0)
114
+ jasmine-core (2.3.4)
115
+ json (1.8.3)
116
+ listen (3.0.1)
119
117
  rb-fsevent (>= 0.9.3)
120
118
  rb-inotify (>= 0.9)
121
119
  lumberjack (1.0.9)
122
- message_bus (1.0.9)
123
- eventmachine
120
+ message_bus (1.0.14)
124
121
  rack (>= 1.1.3)
125
122
  redis
126
123
  metaclass (0.0.4)
127
124
  method_source (0.8.2)
128
125
  mini_portile (0.6.2)
129
- minitest (5.6.0)
126
+ minitest (5.7.0)
130
127
  minitest-around (0.3.1)
131
128
  minitest (~> 5.0)
132
129
  mocha (1.1.0)
133
130
  metaclass (~> 0.0.1)
134
- multi_json (1.11.0)
131
+ multi_json (1.11.2)
135
132
  nenv (0.2.0)
136
133
  nokogiri (1.6.6.2)
137
134
  mini_portile (~> 0.6.0)
@@ -140,8 +137,8 @@ GEM
140
137
  notiffany (0.0.6)
141
138
  nenv (~> 0.1)
142
139
  shellany (~> 0.0)
143
- oj (2.12.4)
144
- pg (0.18.1)
140
+ oj (2.12.9)
141
+ pg (0.18.2)
145
142
  phantomjs (1.9.8.0)
146
143
  pry (0.10.1)
147
144
  coderay (~> 1.1.0)
@@ -150,9 +147,9 @@ GEM
150
147
  pry-byebug (3.1.0)
151
148
  byebug (~> 4.0)
152
149
  pry (~> 0.10)
153
- puma (2.11.2)
150
+ puma (2.11.3)
154
151
  rack (>= 1.1, < 2.0)
155
- rack (1.6.0)
152
+ rack (1.6.4)
156
153
  rack-protection (1.5.3)
157
154
  rack
158
155
  rack-test (0.6.3)
@@ -160,7 +157,7 @@ GEM
160
157
  rack_csrf (2.5.0)
161
158
  rack (>= 1.1.0)
162
159
  rake (10.4.2)
163
- rb-fsevent (0.9.4)
160
+ rb-fsevent (0.9.5)
164
161
  rb-inotify (0.9.5)
165
162
  ffi (>= 0.5.0)
166
163
  redis (3.2.1)
@@ -169,25 +166,23 @@ GEM
169
166
  crass (~> 1.0.1)
170
167
  nokogiri (>= 1.4.4)
171
168
  nokogumbo (= 1.2.0)
172
- sass (3.4.13)
169
+ sass (3.4.15)
173
170
  shellany (0.0.1)
174
171
  sinatra (1.4.6)
175
172
  rack (~> 1.4)
176
173
  rack-protection (~> 1.4)
177
174
  tilt (>= 1.3, < 3)
178
175
  slop (3.6.0)
179
- sprockets (2.12.3)
176
+ sprockets (2.12.4)
180
177
  hike (~> 1.2)
181
178
  multi_json (~> 1.0)
182
179
  rack (~> 1.0)
183
180
  tilt (~> 1.1, != 1.3.0)
184
- sprockets-helpers (1.1.0)
185
- sprockets (~> 2.0)
181
+ sprockets-helpers (1.2.1)
182
+ sprockets (>= 2.2)
186
183
  thor (0.19.1)
187
184
  thread_safe (0.3.5)
188
185
  tilt (1.4.1)
189
- timers (4.0.1)
190
- hitimes
191
186
  tzinfo (1.2.2)
192
187
  thread_safe (~> 0.1)
193
188
  yui-compressor (0.12.0)
@@ -206,3 +201,6 @@ DEPENDENCIES
206
201
  puma
207
202
  rake
208
203
  stockor!
204
+
205
+ BUNDLED WITH
206
+ 1.10.5
@@ -2,14 +2,13 @@ class Skr.Extension extends Lanes.Extensions.Base
2
2
 
3
3
  identifier: "skr"
4
4
 
5
- # This method is called when the extension is registered
6
- # Not all of Lanes will be available yet
7
- onRegistered: ->
8
-
9
5
  # Data that is provided by lib/skr/extension.rb's
10
6
  # client_bootstrap_data method ends up here
11
- setBootstrapData: (data)->
12
- Skr.Models.GlAccount.initialize(data)
13
-
14
- # All of lanes is loaded and it is in the process of booting
15
- onAvailable: ->
7
+ setBootstrapData: (data) ->
8
+ Skr.Models.GlAccount.initialize(
9
+ accounts: data.gl_accounts
10
+ default_ids: data.default_gl_account_ids,
11
+ )
12
+
13
+ rootComponent: (viewport) ->
14
+ Lanes.Workspace.Layout
@@ -0,0 +1,51 @@
1
+ class Skr.Components.Address extends Lanes.React.Component
2
+
3
+ propTypes:
4
+ model: Lanes.PropTypes.State.isRequired
5
+
6
+ renderTitle: ->
7
+ <BS.Row>
8
+ <BS.Col xs=12>
9
+ <h3 className="address-title">{@props.title}</h3>
10
+ </BS.Col>
11
+ </BS.Row>
12
+
13
+ render: ->
14
+ colProps = _.omit(@props, 'name')
15
+ colProps.className = _.classnames("address", @props.className)
16
+
17
+ <BS.Col {...colProps}>
18
+ {@renderTitle() if @props.title}
19
+ <BS.Row>
20
+ <BS.Col xs=12>
21
+ <LC.TextField name="name" model={@model} />
22
+ </BS.Col>
23
+ </BS.Row>
24
+ <BS.Row>
25
+ <BS.Col sm=6>
26
+ <LC.TextField name="phone" model={@model} />
27
+ </BS.Col>
28
+ <BS.Col sm=6>
29
+ <LC.TextField name="email" model={@model} />
30
+ </BS.Col>
31
+ </BS.Row>
32
+ <BS.Row>
33
+ <BS.Col md=6>
34
+ <LC.TextField name="line1" model={@model} />
35
+ </BS.Col>
36
+ <BS.Col md=6>
37
+ <LC.TextField name="line2" model={@model} />
38
+ </BS.Col>
39
+ </BS.Row>
40
+ <BS.Row>
41
+ <BS.Col md=7>
42
+ <LC.TextField name="city" model={@model} />
43
+ </BS.Col>
44
+ <BS.Col sm=8 md=3>
45
+ <LC.TextField name="state" model={@model} />
46
+ </BS.Col>
47
+ <BS.Col sm=4 md=2>
48
+ <LC.TextField name="postal_code" model={@model} />
49
+ </BS.Col>
50
+ </BS.Row>
51
+ </BS.Col>
@@ -0,0 +1,6 @@
1
+ .address {
2
+ .address-title {
3
+ margin-top: 10px;
4
+ border-bottom: 1px solid $input-border;
5
+ }
6
+ }
data/client/skr/index.js CHANGED
@@ -1,11 +1,8 @@
1
1
  //=require ./models/Base
2
- //=require ./views/Base
2
+
3
3
  //=require_tree ./models/mixins
4
4
  //=require_tree ./models
5
- //=require_tree ./views
6
5
  //=require_tree ./components
7
- //=require ./screens/Base
8
- //=require ./screens/mixins
9
6
  //=require ./Extension
10
7
 
11
8
  /*
@@ -3,7 +3,7 @@ class Skr.Models.Customer extends Skr.Models.Base
3
3
 
4
4
  props:
5
5
  id: {"type":"integer","required":true}
6
- code: {"type":"string","required":true}
6
+ code: {"type":"code","required":true}
7
7
  billing_address_id: {"type":"integer","required":true}
8
8
  shipping_address_id: {"type":"integer","required":true}
9
9
  terms_id: {"type":"integer","required":true}
@@ -1,20 +1,20 @@
1
1
  class Skr.Models.GlAccount extends Skr.Models.Base
2
2
 
3
- cacheDuration: [1,'day']
3
+ cacheDuration: [1, 'day']
4
4
 
5
5
  props:
6
- id: {"type":"integer","required":true}
7
- number: {"type":"string","required":true}
8
- name: {"type":"string","required":true}
9
- is_active: {"type":"boolean","required":true,"default":"true"}
6
+ id: {"type":"integer", "required":true}
7
+ number: {"type":"string", "required":true}
8
+ name: {"type":"string", "required":true}
9
+ is_active: {"type":"boolean", "required":true, "default":true}
10
10
 
11
11
  derived:
12
12
  combined_name:
13
- deps: ['number','name'], fn:->
14
- "#{@number}: #{@name}"
13
+ deps: ['number', 'name'], fn: ->
14
+ if @isNew() then "" else "#{@number}: #{@name}"
15
15
 
16
16
 
17
- @initialize: (data)->
18
- this.default_ids = data.default_gl_account_ids
19
- ms=Lanes.Vendor.Moment.duration(this::cacheDuration...).asMilliseconds()
20
- Lanes.Models.ServerCache.store(this::urlRoot(), data.gl_accounts, ms)
17
+ @initialize: (data) ->
18
+ this.default_ids = data.default_ids
19
+ ms = Lanes.Vendor.Moment.duration(this::cacheDuration...).asMilliseconds()
20
+ Lanes.Models.ServerCache.store(this::urlRoot(), data.accounts, ms)
@@ -1,6 +1,5 @@
1
1
  class Skr.Models.SalesOrder extends Skr.Models.Base
2
2
 
3
-
4
3
  props:
5
4
  id: {"type":"integer","required":true}
6
5
  visible_id: {"type":"integer","required":true}
@@ -14,7 +13,6 @@ class Skr.Models.SalesOrder extends Skr.Models.Base
14
13
  is_revised: {"type":"boolean","required":true,"default":"false"}
15
14
  hash_code: {"type":"string","required":true}
16
15
  ship_partial: {"type":"boolean","required":true,"default":"false"}
17
- is_complete: {"type":"boolean","required":true,"default":"false"}
18
16
  po_num: "string"
19
17
  notes: "string"
20
18
  options: "any"
@@ -1,3 +1,9 @@
1
- class Skr.Screens.Base extends Lanes.Screens.Base
1
+ Skr.Screens.Base = {
2
2
 
3
- abstractClass: true
3
+ # An extension point to modify the prototypes for screens
4
+ extend: (klass) ->
5
+ # Extend screen component with Lanes defaults,
6
+ # which will eventually call React.createClass
7
+ Lanes.React.Screen.extend(klass)
8
+
9
+ }
@@ -0,0 +1,58 @@
1
+ class Skr.Screens.CustomerMaint extends Lanes.React.Screen
2
+
3
+ dataObjects:
4
+ customer: ->
5
+ @props.customer || new Skr.Models.Customer
6
+ query: ->
7
+ new Lanes.Models.Query({
8
+ loadAssociations: ['billing_address', 'shipping_address']
9
+ modelClass: Skr.Models.Customer, fields: [
10
+ {id:'id', visible: false}
11
+ 'code', 'name', 'notes',
12
+ { id: 'open_balance', flex: 0.5, textAlign: 'center' }
13
+ ]
14
+ })
15
+
16
+ getInitialState: ->
17
+ commands: new Lanes.Screens.Commands(this, modelName: 'customer')
18
+
19
+ modelForAccess: 'customer'
20
+
21
+ render: ->
22
+ <div className="customer-maint">
23
+ <LC.Toolbar commands={@state.commands} />
24
+ <LC.ErrorDisplay model={@customer} />
25
+ <BS.Row>
26
+ <LC.RecordFinder ref="finder" sm=4 autoFocus
27
+ model={@customer}
28
+ commands={@state.commands}
29
+ query={@query} />
30
+ <LC.TextField sm=8 name="name" model={@customer} />
31
+ </BS.Row>
32
+ <BS.Row>
33
+ <LC.TextArea sm=12
34
+ name="notes"
35
+ model={@customer} />
36
+ </BS.Row>
37
+ <BS.Row>
38
+ <LC.SelectField sm=6
39
+ label="Receivables Account"
40
+ name="gl_receivables_account"
41
+ labelField="combined_name"
42
+ model={@customer} />
43
+ <LC.SelectField sm=6
44
+ label="Payment Terms"
45
+ name="terms"
46
+ labelField="code"
47
+ model={@customer} />
48
+ </BS.Row>
49
+ <BS.Row>
50
+ <LC.FieldSet sm=12 title="Address">
51
+ <Skr.Components.Address lg=6 title="Billing"
52
+ model={@customer.billing_address} />
53
+ <Skr.Components.Address lg=6 title="Shipping"
54
+ model={@customer.shipping_address} />
55
+ </LC.FieldSet>
56
+ </BS.Row>
57
+
58
+ </div>
@@ -1,5 +1 @@
1
- //= require_tree .
2
-
3
- /*
4
- Add additional requirement statements for other files that the screen uses
5
- */
1
+ //=require ./CustomerMaint
@@ -7,3 +7,5 @@
7
7
  Otherwise Lanes will continue to fetch an empty file whenever
8
8
  the screen is displayed
9
9
  */
10
+ @import "lanes/screens/styles";
11
+
@@ -1,4 +1,4 @@
1
- //= require_tree .
1
+ // require_tree .
2
2
 
3
3
  /*
4
4
  Add additional requirement statements for other files that the screen uses
@@ -1,4 +1,4 @@
1
- //= require_tree .
1
+ // require_tree .
2
2
 
3
3
  /*
4
4
  Add additional requirement statements for other files that the screen uses
@@ -1,4 +1,4 @@
1
- //= require_tree .
1
+ // require_tree .
2
2
 
3
3
  /*
4
4
  Add additional requirement statements for other files that the screen uses
@@ -1,4 +1,5 @@
1
1
  /* Enter styles for your application in scss format here */
2
+
2
3
  .header-top {
3
4
  .logo {
4
5
  display: inline-block;
@@ -9,3 +10,25 @@
9
10
  background: url(asset_path('images/skr/logo-sm.png')) no-repeat;
10
11
  }
11
12
  }
13
+
14
+
15
+ .record-finder-dialog {
16
+ min-height: 250px;
17
+ .clause {
18
+ .dropdown-menu {
19
+ min-width: 300px;
20
+ padding: 0.5rem;
21
+ .row {
22
+ margin-bottom: 5px;
23
+ }
24
+ input[type=radio] { margin-right: 0.5rem; }
25
+ }
26
+
27
+ }
28
+
29
+ .grid-component {
30
+ margin-top: 10px;
31
+ }
32
+ }
33
+
34
+ @import "components/address/styles.scss";
data/coffeelint.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "coffeelint": {
3
+ "transforms": [
4
+ "coffee-react-transform"
5
+ ]
6
+ },
7
+ "indentation": {
8
+ "level": "error",
9
+ "value": 4
10
+ },
11
+ "line_endings": {
12
+ "value": "unix",
13
+ "level": "error"
14
+ },
15
+ "arrow_spacing": {
16
+ "level": "error"
17
+ },
18
+ "no_empty_functions": {
19
+ "level": "error"
20
+ },
21
+ "no_empty_param_list": {
22
+ "level": "error"
23
+ },
24
+ "no_interpolation_in_single_quotes": {
25
+ "level": "error"
26
+ },
27
+ "no_throwing_strings": {
28
+ "level": "error"
29
+ },
30
+ "no_unnecessary_double_quotes": {
31
+ "level": "ignore"
32
+ },
33
+ "no_unnecessary_fat_arrows": {
34
+ "level": "error"
35
+ },
36
+ "prefer_english_operator": {
37
+ "level": "ignore"
38
+ },
39
+ "space_operators": {
40
+ "level": "error"
41
+ },
42
+ "spacing_after_comma": {
43
+ "level": "error"
44
+ },
45
+ "max_line_length": {
46
+ "value": 135,
47
+ "level": "error"
48
+ }
49
+ }
data/config/screens.rb CHANGED
@@ -1,52 +1,49 @@
1
1
  Lanes::Screen.define_group 'maint' do | group |
2
2
  group.title = "Maintenance"
3
3
  group.description = "Maintain records"
4
- group.icon = "icon-wrench"
4
+ group.icon = "pencil-square"
5
5
  end
6
-
7
6
  Lanes::Screen.define_group 'customer' do | group |
8
7
  group.title = "Customer"
9
- group.description = "Custoemr records"
10
- group.icon = "icon-wrench"
8
+ group.description = "Customer records"
9
+ group.icon = "heart"
11
10
  end
12
-
13
-
14
- Lanes::Screen.define "customer-maint" do | screen |
15
- screen.title = "Customer Maintenance"
16
- screen.icon = "icon-users"
17
- screen.group_id = "maint"
18
- screen.model_class = "Customer"
19
- screen.view_class = "Skr.Screens.CustomerMaint"
20
- screen.js = 'skr/screens/customer-maint.js'
21
- screen.css = 'skr/screens/customer-maint.css'
22
- end
23
-
24
- Lanes::Screen.define "sku-maint" do | screen |
25
- screen.title = "SKU Maintenance"
26
- screen.icon = "icon-gift"
27
- screen.group_id = "maint"
28
- screen.model_class = "Sku"
29
- screen.view_class = "Skr.Screens.SkuMaint"
30
- screen.js = "skr/screens/sku-maint.js"
31
- screen.css = "skr/screens/sku-maint.css"
32
- end
33
-
34
- Lanes::Screen.define "vendor-maint" do | screen |
35
- screen.title = "Vendor Maintenance"
36
- screen.icon = "icon-truck"
37
- screen.group_id = "maint"
38
- screen.model_class = "Vendor"
39
- screen.view_class = "Skr.Screens.VendorMaint"
40
- screen.js = "skr/screens/vendor-maint.js"
41
- screen.css = "skr/screens/vendor-maint.css"
42
- end
43
- Lanes::Screen.define "sales-order" do | screen |
44
- screen.title = "Sales Order"
45
- screen.description = ""
46
- screen.icon = ""
47
- screen.group_id = "customer"
48
- screen.model_class = "SalesOrder"
49
- screen.view_class = "Skr.Screens.SalesOrder"
50
- screen.js = "skr/screens/sales-order.js"
51
- screen.css = "skr/screens/sales-order.css"
11
+ Lanes::Screen.for_extension 'Skr' do | screens |
12
+ screens.define "customer-maint" do | screen |
13
+ screen.title = "Customer Maintenance"
14
+ screen.icon = "heartbeat"
15
+ screen.group_id = "maint"
16
+ screen.model_class = "Customer"
17
+ screen.view_class = "CustomerMaint"
18
+ screen.js = 'customer-maint.js'
19
+ screen.css = 'customer-maint.css'
20
+ end
21
+ # screens.define "sku-maint" do | screen |
22
+ # screen.title = "SKU Maintenance"
23
+ # screen.icon = "archive"
24
+ # screen.group_id = "maint"
25
+ # screen.model_class = "Sku"
26
+ # screen.view_class = "SkuMaint"
27
+ # screen.js = "sku-maint.js"
28
+ # screen.css = "sku-maint.css"
29
+ # end
30
+ # screens.define "vendor-maint" do | screen |
31
+ # screen.title = "Vendor Maintenance"
32
+ # screen.icon = "truck"
33
+ # screen.group_id = "maint"
34
+ # screen.model_class = "Vendor"
35
+ # screen.view_class = "Skr.Screens.VendorMaint"
36
+ # screen.js = "vendor-maint.js"
37
+ # screen.css = "vendor-maint.css"
38
+ # end
39
+ # screens.define "sales-order" do | screen |
40
+ # screen.title = "Sales Order"
41
+ # screen.description = ""
42
+ # screen.icon = "shopping-cart"
43
+ # screen.group_id = "customer"
44
+ # screen.model_class = "SalesOrder"
45
+ # screen.view_class = "Skr.Screens.SalesOrder"
46
+ # screen.js = "sales-order.js"
47
+ # screen.css = "sales-order.css"
48
+ # end
52
49
  end
@@ -5,9 +5,9 @@ class CreateSkrInventoryAdjustments < ActiveRecord::Migration
5
5
 
6
6
  create_skr_table "inventory_adjustments" do |t|
7
7
  t.skr_visible_id
8
+ t.skr_state
8
9
  t.skr_reference :location, null: false, single: true
9
10
  t.skr_reference :reason, null: false, to_table: 'ia_reasons'
10
- t.string "state", null: false
11
11
  t.text "description", null: false
12
12
  t.skr_track_modifications
13
13
  end
@@ -5,17 +5,16 @@ class CreateSkrSalesOrders < ActiveRecord::Migration
5
5
 
6
6
  create_skr_table "sales_orders" do |t|
7
7
  t.skr_visible_id
8
+ t.skr_state
8
9
  t.skr_reference :customer, single: true
9
10
  t.skr_reference :location, single: true
10
11
  t.skr_reference :shipping_address, to_table: 'addresses'
11
12
  t.skr_reference :billing_address, to_table: 'addresses'
12
13
  t.skr_reference :terms, to_table: 'payment_terms'
13
14
  t.date "order_date", null: false
14
- t.integer "state", null: false, limit: 2
15
15
  t.boolean "is_revised", null: false, default: false
16
16
  t.string "hash_code", null: false
17
17
  t.boolean "ship_partial", null: false, default: false
18
- t.boolean "is_complete", null: false, default: false
19
18
  t.string "po_num"
20
19
  t.text "notes"
21
20
  t.hstore "options", default: {}
@@ -5,11 +5,11 @@ class CreateSkrPurchaseOrders < ActiveRecord::Migration
5
5
 
6
6
  create_skr_table "purchase_orders" do |t|
7
7
  t.skr_visible_id
8
+ t.skr_state
8
9
  t.skr_reference :vendor, single: true
9
10
  t.skr_reference :location, single: true
10
11
  t.skr_reference :ship_addr, to_table: 'addresses'
11
12
  t.skr_reference :terms, to_table: 'payment_terms'
12
- t.integer "state", null: false, limit: 2
13
13
  t.boolean "is_revised", null: false, default: false
14
14
  t.date "order_date", null: false
15
15
  t.datetime "receiving_completed_at"
@@ -5,6 +5,7 @@ class CreateSkrInvoices < ActiveRecord::Migration
5
5
  def change
6
6
  create_skr_table "invoices" do |t|
7
7
  t.skr_visible_id
8
+ t.skr_state
8
9
  t.skr_reference :terms, to_table: 'payment_terms'
9
10
  t.skr_reference :customer, single: true
10
11
  t.skr_reference :location, single: true
@@ -13,7 +14,6 @@ class CreateSkrInvoices < ActiveRecord::Migration
13
14
  t.skr_reference :shipping_address, to_table: 'addresses'
14
15
  t.skr_reference :billing_address, to_table: 'addresses'
15
16
  t.skr_currency :amount_paid, null: false, default: 0.0
16
- t.string "state", null: false
17
17
  t.string "hash_code", null: false
18
18
  t.date "invoice_date", null: false
19
19
  t.string "po_num"
@@ -21,7 +21,7 @@ class CreateSkrSkuQtyDetailsView < ActiveRecord::Migration
21
21
  sum( ( sol.qty - sol.qty_canceled ) * sol.uom_size ) as qty
22
22
  from #{skr_prefix}so_lines sol
23
23
  join #{skr_prefix}sales_orders so on so.id = sol.sales_order_id
24
- and so.state not in (5,9) -- complete, canceled
24
+ and so.state not in (5,10) -- complete, canceled
25
25
  join #{skr_prefix}sku_locs sl on sl.id = sol.sku_loc_id
26
26
  join #{skr_prefix}skus s on s.id = sl.sku_id
27
27
  group by s.id
@@ -33,7 +33,7 @@ class CreateSkrSkuQtyDetailsView < ActiveRecord::Migration
33
33
  sum( ( pol.qty - pol.qty_canceled ) * pol.uom_size ) as qty
34
34
  from #{skr_prefix}po_lines pol
35
35
  join #{skr_prefix}purchase_orders po on po.id = pol.purchase_order_id
36
- and po.state not in (5,9) -- complete, canceled
36
+ and po.state not in (5,15) -- received, canceled
37
37
  join #{skr_prefix}sku_locs sl on sl.id = pol.sku_loc_id
38
38
  join #{skr_prefix}skus s on s.id = sl.sku_id
39
39
  group by s.id
@@ -5,16 +5,12 @@ class CreateSkrVouchers < ActiveRecord::Migration
5
5
 
6
6
  create_skr_table "vouchers" do |t|
7
7
  t.skr_visible_id
8
-
8
+ t.skr_state
9
9
  t.skr_reference :vendor, single: true, null: false
10
10
  t.skr_reference :purchase_order, single: true, null: true
11
-
12
11
  t.skr_reference :terms, to_table: 'payment_terms'
13
-
14
- t.string "state", null: false
12
+ t.date "confirmation_date", null: true # starts out as non-confirmed
15
13
  t.string "refno"
16
-
17
- t.date "confirmation_date", null: true # starts out as non-confirmed
18
14
  t.skr_track_modifications
19
15
  end
20
16
 
data/db/schema.sql CHANGED
@@ -530,7 +530,6 @@ CREATE TABLE skr_sales_orders (
530
530
  is_revised boolean DEFAULT false NOT NULL,
531
531
  hash_code character varying NOT NULL,
532
532
  ship_partial boolean DEFAULT false NOT NULL,
533
- is_complete boolean DEFAULT false NOT NULL,
534
533
  po_num character varying,
535
534
  notes text,
536
535
  options hstore DEFAULT ''::hstore,
@@ -1499,6 +1498,39 @@ CREATE SEQUENCE skr_vouchers_id_seq
1499
1498
  ALTER SEQUENCE skr_vouchers_id_seq OWNED BY skr_vouchers.id;
1500
1499
 
1501
1500
 
1501
+ --
1502
+ -- Name: testers; Type: TABLE; Schema: public; Owner: -; Tablespace:
1503
+ --
1504
+
1505
+ CREATE TABLE testers (
1506
+ id integer NOT NULL,
1507
+ name character varying,
1508
+ email character varying,
1509
+ visits text[] DEFAULT '{}'::text[],
1510
+ created_at timestamp without time zone NOT NULL,
1511
+ updated_at timestamp without time zone NOT NULL
1512
+ );
1513
+
1514
+
1515
+ --
1516
+ -- Name: testers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1517
+ --
1518
+
1519
+ CREATE SEQUENCE testers_id_seq
1520
+ START WITH 1
1521
+ INCREMENT BY 1
1522
+ NO MINVALUE
1523
+ NO MAXVALUE
1524
+ CACHE 1;
1525
+
1526
+
1527
+ --
1528
+ -- Name: testers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1529
+ --
1530
+
1531
+ ALTER SEQUENCE testers_id_seq OWNED BY testers.id;
1532
+
1533
+
1502
1534
  --
1503
1535
  -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1504
1536
  --
@@ -1716,6 +1748,13 @@ ALTER TABLE ONLY skr_vo_lines ALTER COLUMN id SET DEFAULT nextval('skr_vo_lines_
1716
1748
  ALTER TABLE ONLY skr_vouchers ALTER COLUMN id SET DEFAULT nextval('skr_vouchers_id_seq'::regclass);
1717
1749
 
1718
1750
 
1751
+ --
1752
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1753
+ --
1754
+
1755
+ ALTER TABLE ONLY testers ALTER COLUMN id SET DEFAULT nextval('testers_id_seq'::regclass);
1756
+
1757
+
1719
1758
  --
1720
1759
  -- Name: lanes_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1721
1760
  --
@@ -1972,6 +2011,14 @@ ALTER TABLE ONLY skr_vouchers
1972
2011
  ADD CONSTRAINT skr_vouchers_pkey PRIMARY KEY (id);
1973
2012
 
1974
2013
 
2014
+ --
2015
+ -- Name: testers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
2016
+ --
2017
+
2018
+ ALTER TABLE ONLY testers
2019
+ ADD CONSTRAINT testers_pkey PRIMARY KEY (id);
2020
+
2021
+
1975
2022
  --
1976
2023
  -- Name: index_lanes_users_on_role_names; Type: INDEX; Schema: public; Owner: -; Tablespace:
1977
2024
  --
@@ -2660,3 +2707,5 @@ INSERT INTO schema_migrations (version) VALUES ('20140422024010');
2660
2707
 
2661
2708
  INSERT INTO schema_migrations (version) VALUES ('20140615031600');
2662
2709
 
2710
+ INSERT INTO schema_migrations (version) VALUES ('20150220015108');
2711
+
data/db/seed.rb CHANGED
@@ -7,7 +7,7 @@ module Skr
7
7
  user = Lanes::User.where(login: 'admin').first
8
8
  if user.nil?
9
9
  user = Lanes::User.create!(name: "Admin", email: "admin@test.com",
10
- password: 'senal', password_confirmation: 'senal',
10
+ password: 'password', password_confirmation: 'password',
11
11
  login: 'admin', role_names: ['administrator'])
12
12
 
13
13
  end
@@ -19,8 +19,9 @@ module Lanes::Access
19
19
  Skr::PaymentTerm,
20
20
  Skr::Sku,
21
21
  Skr::SalesOrder
22
- lock_writes Skr::Sku, :gl_asset_account_id
23
- lock_writes Skr::Customer, :terms_id
22
+ lock_writes Skr::Customer, :terms
23
+ lock Skr::Sku, :gl_asset_account
24
+ lock Skr::Customer, :gl_receivables_account
24
25
  end
25
26
 
26
27
 
@@ -18,6 +18,10 @@ module Skr
18
18
  }
19
19
  end
20
20
 
21
+ def skr_state
22
+ column( :state, :integer, null: false, default: 0, limit: 2 )
23
+ end
24
+
21
25
  # track modifications
22
26
  def skr_track_modifications( create_only: false )
23
27
  column( :created_at, :datetime, :null=>false )
data/lib/skr/extension.rb CHANGED
@@ -5,9 +5,10 @@ module Skr
5
5
  class Extension < Lanes::Extensions::Definition
6
6
 
7
7
  identifier "skr"
8
- self.uses_pub_sub = true
8
+
9
9
  root_path Pathname.new(__FILE__).dirname.join("..","..").expand_path
10
- components "record-finder", "select-field"
10
+
11
+ components 'record-finder', 'select-field'
11
12
 
12
13
  def client_bootstrap_data(view)
13
14
  gl_accounts = Skr::GlAccount.all.as_json
@@ -19,6 +19,10 @@ module Skr
19
19
  delegate_and_export :location_code
20
20
  delegate_and_export :reason_code
21
21
 
22
+ enum state: {
23
+ pending: 0,
24
+ applied: 5
25
+ }
22
26
  state_machine do
23
27
  state :pending , :initial=>true
24
28
  state :applied
@@ -60,6 +60,12 @@ module Skr
60
60
  compose_query_using_detail_view( view: 'inv_details', join_to: 'invoice_id' )
61
61
  }, export: true
62
62
 
63
+ enum state: {
64
+ open: 0,
65
+ paid: 5,
66
+ partial: 10
67
+ }
68
+
63
69
  state_machine do
64
70
  state :open, initial: true
65
71
  state :paid
@@ -51,13 +51,17 @@ module Skr
51
51
  }
52
52
 
53
53
  enum state: {
54
- open: 1,
55
- received: 2
54
+ open: 0,
55
+ received: 5,
56
+ paid: 10,
57
+ canceled: 15
56
58
  }
57
59
 
58
60
  state_machine do
59
61
  state :open, initial: true
60
62
  state :received
63
+ state :paid
64
+ state :canceled
61
65
 
62
66
  event :mark_received do
63
67
  transitions from: :open, to: :received
@@ -90,9 +90,9 @@ module Skr
90
90
  end
91
91
 
92
92
  enum state: {
93
- open: 1,
94
- complete: 5,
95
- canceled: 9
93
+ open: 0,
94
+ complete: 5,
95
+ canceled: 10
96
96
  }
97
97
 
98
98
  state_machine do
@@ -36,6 +36,12 @@ module Skr
36
36
  where(['vouchers.state <> ? and payment_lines.id is null', 'pending']).includes(:payment_line)
37
37
  }
38
38
 
39
+ enum state: {
40
+ pending: 0,
41
+ confirmed: 5,
42
+ paid: 10
43
+ }
44
+
39
45
  state_machine do
40
46
  state :pending, initial: true
41
47
  state :confirmed
data/lib/skr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Skr
2
- VERSION='0.1.8'
2
+ VERSION='0.1.9'
3
3
  end
@@ -3,24 +3,18 @@ describe "Skr.Models.Customer", ->
3
3
  beforeEach ->
4
4
  Lanes.Test.ModelSaver.setUser('admin')
5
5
 
6
- it "can be instantiated", ->
6
+ xit "sends failure messages when code isn't set", (done) ->
7
7
  model = new Skr.Models.Customer()
8
- expect(model).toEqual(jasmine.any(Skr.Models.Customer))
9
-
10
-
11
- it "sends failure messages when code isn't set", (done)->
12
- model = new Skr.Models.Customer()
13
- Lanes.Test.ModelSaver.perform(model, done).then (save)->
14
- expect(save.error).toHaveBeenCalled()
8
+ Lanes.Test.ModelSaver.perform(model, done).then (save) ->
15
9
  expect(model.errors?.code).toContain("blank")
16
10
 
17
- it "saves when fields are set", (done)->
11
+ it "saves when fields are set", (done) ->
18
12
  model = new Skr.Models.Customer(
19
13
  code: "SPECTEST", name: "A Spec Test Customer"
20
- terms_id: 1,
14
+ terms: {code: 'SPECTESTER'}
21
15
  billing_address: { name: "Billing Address" }
22
16
  shipping_address: { name: "Shipping Address" }
23
17
  )
24
- Lanes.Test.ModelSaver.perform(model, done).then (save)->
25
- expect(save.error).not.toHaveBeenCalled()
18
+
19
+ Lanes.Test.ModelSaver.perform(model, done).then (save) ->
26
20
  expect(model.errors).toBeNull()
@@ -1,6 +1,6 @@
1
1
  describe "Skr.Models.SalesOrder", ->
2
2
 
3
- it "must have a customer to save", (done)->
3
+ xit "must have a customer to save", (done)->
4
4
  model = new Skr.Models.SalesOrder()
5
5
  Lanes.Test.ModelSaver.perform(model, done).then (save)->
6
6
  expect(save.error).toHaveBeenCalled()
@@ -2,6 +2,6 @@
2
2
 
3
3
  describe "CustomerMaint Screen Suite", ->
4
4
 
5
- it "can be instantiated", ->
5
+ xit "can be instantiated", ->
6
6
  view = new Skr.Screens.CustomerMaint()
7
7
  expect(view).toEqual(jasmine.any(Skr.Screens.CustomerMaint));
@@ -1,5 +1,5 @@
1
1
  describe "Skr.Screens.SalesOrder", ->
2
2
 
3
- it "can be instantiated", ->
3
+ xit "can be instantiated", ->
4
4
  view = new Skr.Screens.SalesOrder()
5
5
  expect(view).toEqual(jasmine.any(Skr.Screens.SalesOrder));
@@ -1,5 +1,5 @@
1
1
  describe "Skr.Screens.SkuMaint", ->
2
2
 
3
- it "can be instantiated", ->
3
+ xit "can be instantiated", ->
4
4
  view = new Skr.Screens.SkuMaint()
5
5
  expect(view).toEqual(jasmine.any(Skr.Screens.SkuMaint));
@@ -1,5 +1,5 @@
1
1
  describe "Skr.Screens.VendorMaint", ->
2
2
 
3
- it "can be instantiated", ->
3
+ xit "can be instantiated", ->
4
4
  view = new Skr.Screens.VendorMaint()
5
5
  expect(view).toEqual(jasmine.any(Skr.Screens.VendorMaint));
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stockor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Stitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-24 00:00:00.000000000 Z
11
+ date: 2015-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aasm
@@ -141,8 +141,9 @@ files:
141
141
  - client/images/skr/logo-sm.png
142
142
  - client/skr/Extension.coffee
143
143
  - client/skr/components/.gitkeep
144
- - client/skr/components/address/Address.coffee
144
+ - client/skr/components/address/Address.cjsx
145
145
  - client/skr/components/address/address.html
146
+ - client/skr/components/address/styles.scss
146
147
  - client/skr/index.js
147
148
  - client/skr/models/Address.coffee
148
149
  - client/skr/models/Base.coffee
@@ -182,7 +183,7 @@ files:
182
183
  - client/skr/screens/base/index.js
183
184
  - client/skr/screens/base/index.scss
184
185
  - client/skr/screens/base/layout.html
185
- - client/skr/screens/customer-maint/CustomerMaint.coffee
186
+ - client/skr/screens/customer-maint/CustomerMaint.cjsx
186
187
  - client/skr/screens/customer-maint/index.js
187
188
  - client/skr/screens/customer-maint/index.scss
188
189
  - client/skr/screens/customer-maint/layout.html
@@ -202,6 +203,7 @@ files:
202
203
  - client/skr/styles.scss
203
204
  - client/skr/views/.gitkeep
204
205
  - client/skr/views/Base.coffee
206
+ - coffeelint.json
205
207
  - config.ru
206
208
  - config/database.yml
207
209
  - config/lanes.rb
@@ -424,7 +426,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
424
426
  version: '0'
425
427
  requirements: []
426
428
  rubyforge_project:
427
- rubygems_version: 2.4.5
429
+ rubygems_version: 2.4.8
428
430
  signing_key:
429
431
  specification_version: 4
430
432
  summary: Stockor is a complete ERP system
@@ -1,20 +0,0 @@
1
- class Skr.Components.Address extends Lanes.Components.Base
2
-
3
-
4
- writeTemplateName: -> 'address'
5
-
6
- constructor: (options={})->
7
- super
8
- this.access = 'write'
9
- if @copyFrom = options.copyFrom
10
- this.bindCopyFrom()
11
- this.listenTo(this.copyFrom,'change:model', @bindCopyFrom )
12
-
13
- bindCopyFrom: ->
14
- old = this.copyFrom.changedAttributes()['model']
15
- this.stopListening( old, 'change', @applyChange ) if old
16
- this.listenTo(this.copyFrom.model,'change', @applyChange )
17
-
18
- applyChange: (model,value,field)->
19
- for name,value of model.changedAttributes()
20
- this.model.set(name,value) if this.model.get(name) == model.previous(name)
@@ -1,28 +0,0 @@
1
- class Skr.Screens.CustomerMaint extends Skr.Screens.Base
2
-
3
- mixins:[
4
- Lanes.Screens.Mixins.Editing
5
- ]
6
-
7
- useFormBindings: true
8
-
9
- subviews:
10
- terms:
11
- component: 'SelectField'
12
- model: 'model'
13
- options: { association: 'terms', mappings: { title: 'code' } }
14
- billaddr:
15
- component: 'Address'
16
- model: 'model.billing_address'
17
- options: { field_name: 'billing_address_id' }
18
- shipaddr:
19
- component: 'Address'
20
- model: 'model.shipping_address'
21
- options: ->{ copyFrom: this.billaddr, field_name: 'shipping_address_id' }
22
-
23
- finderOptions: ->
24
- modelClass: Skr.Models.Customer
25
- title: 'Find Customer',
26
- invalid_chars: Skr.Models.Mixins.CodeField.invalidChars
27
- withAssociations: ['billing_address', 'shipping_address', 'terms']
28
- fields: [ 'code', 'name', 'notes', 'credit_limit' ]