effective_qb_online 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 61b15060db97ed61ab2e8109eed9e355dd40bce896c45b48c7e3f4e5fb12bc31
4
- data.tar.gz: 43ca4dc7e414119fc41e69773a65cbf070dc695957aeedf2b22bc83c19735447
3
+ metadata.gz: f20c50a036b10136d52f4c052b16abf5e555cfbe8502babb3b6ceb0922194a42
4
+ data.tar.gz: 7d45f23076d1678691b6d1f1cfd86331048ae9d40c2020c871ad0567257b3770
5
5
  SHA512:
6
- metadata.gz: 8d40e89ef96686f96688eb3c2550653cc92dfcad64b1b8068e91af864a88adaedf5af754e230ac85a2a828796c58bbcf83724f7f60ac9776f3178f7f4f982aba
7
- data.tar.gz: 6648b00a54b0b5a5018614687116d53b7ad9e53dbad705b3abcac4049c50434f6b2d8684c64e30a28daead8cd337bc4e67839d5a9535989ab7d43c31024bc59b
6
+ metadata.gz: c2d817cd48f01bae89b467c06b4bd48cb14912698db983947051d083dfae9c07f29502247b6a78deaf602c00288f17525b3737988cfdd94cf64f8bcedbcc9e9e
7
+ data.tar.gz: 1ffdebaa33b29ba09c0ee322449894b37e7e5c565e4ea5a528a255b53f190728cb9f3b6d62ba3ea4716d70ff1eebc7ed0e7faf754d63178a155d188bc638aa81
@@ -41,6 +41,14 @@ module Effective
41
41
  )
42
42
  end
43
43
 
44
+ def api_error
45
+ begin
46
+ company_info.present?; nil
47
+ rescue => e
48
+ return e.message
49
+ end
50
+ end
51
+
44
52
  # Singular
45
53
  def company_info
46
54
  with_service('CompanyInfo') { |service| service.fetch_by_id(realm.realm_id) }
@@ -67,10 +75,20 @@ module Effective
67
75
  items
68
76
  .reject { |item| item.type == 'Category' }
69
77
  .sort_by { |item| [item.type, item.name] }
70
- .map { |item| [item.name, item.id, item.type] }
78
+ .map { |item| [item.name, item.id, {'data-html': item_html(item)}, item.type] }
71
79
  .group_by(&:last)
72
80
  end
73
81
 
82
+ def item_html(item)
83
+ details = [
84
+ ("##{item.id}"),
85
+ (item.sku if item.sku.present?),
86
+ (item.description if item.description.present?)
87
+ ].compact.join(', ')
88
+
89
+ "<span>#{item.name}</span> <small>(#{details})</small>"
90
+ end
91
+
74
92
  def payment_methods
75
93
  with_service('PaymentMethod') { |service| service.all }
76
94
  end
@@ -1,32 +1,46 @@
1
- %table.table.table-sm
2
- - company_info = api.company_info
3
-
4
- %tbody
5
- %tr
6
- %td Name
7
- %td= company_info.company_name
8
-
9
- %tr
10
- %td Country
11
- %td= company_info.country
12
-
13
- %tr
14
- %td QuickBooks Online
15
- %td
16
- = link_to('Revoke Access and Disconnect', effective_qb_online.revoke_quickbooks_oauth_path, class: 'btn btn-sm btn-danger', 'data-method': 'delete', 'data-confirm': 'Really disconnect from QuickBooks Online?')
17
-
18
- %tr
19
- %td Deposit to Account
20
- %td
21
- = effective_form_with(model: [:admin, api.realm], engine: true) do |f|
22
- .row
23
- .col= f.select :deposit_to_account_id, api.accounts_collection, grouped: true, label: false
24
- .col= f.save
25
-
26
- %tr
27
- %td Payment Method
28
- %td
29
- = effective_form_with(model: [:admin, api.realm], engine: true) do |f|
30
- .row
31
- .col= f.select :payment_method_id, api.payment_methods_collection, label: false
32
- .col= f.save
1
+ - company_info = (api.company_info rescue nil)
2
+
3
+ - if company_info.present?
4
+ %table.table.table-sm
5
+ %tbody
6
+ %tr
7
+ %td Name
8
+ %td= company_info.company_name
9
+
10
+ %tr
11
+ %td Country
12
+ %td= company_info.country
13
+
14
+ %tr
15
+ %td QuickBooks Online
16
+ %td
17
+ = link_to('Revoke Access and Disconnect', effective_qb_online.revoke_quickbooks_oauth_path, class: 'btn btn-sm btn-danger', 'data-method': 'delete', 'data-confirm': 'Really disconnect from QuickBooks Online?')
18
+
19
+ %tr
20
+ %td Deposit to Account
21
+ %td
22
+ = effective_form_with(model: [:admin, api.realm], engine: true) do |f|
23
+ .row
24
+ .col= f.select :deposit_to_account_id, api.accounts_collection, grouped: true, label: false
25
+ .col= f.save
26
+
27
+ %tr
28
+ %td Payment Method
29
+ %td
30
+ = effective_form_with(model: [:admin, api.realm], engine: true) do |f|
31
+ .row
32
+ .col= f.select :payment_method_id, api.payment_methods_collection, label: false
33
+ .col= f.save
34
+
35
+
36
+ - if company_info.blank?
37
+ %table.table.table-sm
38
+ %tbody
39
+ %tr
40
+ %td QuickBooks API Error
41
+ %td= api.api_error
42
+
43
+ %tr
44
+ %td QuickBooks Online
45
+ %td
46
+ = link_to('Revoke Access and Disconnect', effective_qb_online.revoke_quickbooks_oauth_path, class: 'btn btn-sm btn-danger', 'data-method': 'delete', 'data-confirm': 'Really disconnect from QuickBooks Online?')
@@ -35,6 +35,6 @@
35
35
 
36
36
  = existing || fi.object.order_item_qb_name || '-'
37
37
 
38
- %td= fi.select :item_id, items_collection, grouped: true, label: false
38
+ %td= fi.select :item_id, items_collection, grouped: true, label: false, template: :html
39
39
 
40
40
  = f.submit 'Save and Sync'
@@ -1,3 +1,3 @@
1
1
  module EffectiveQbOnline
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
@@ -1,4 +1,4 @@
1
- module EffectiveMemberships
1
+ module EffectiveQbOnline
2
2
  module Generators
3
3
  class InstallGenerator < Rails::Generators::Base
4
4
  include Rails::Generators::Migration
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_qb_online
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-15 00:00:00.000000000 Z
11
+ date: 2022-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails