effective_qb_online 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/admin/qb_online_controller.rb +6 -1
- data/app/datatables/admin/effective_qb_items_datatable.rb +13 -0
- data/app/datatables/admin/effective_qb_receipts_datatable.rb +7 -0
- data/app/models/effective/qb_realm.rb +4 -0
- data/app/models/effective/qb_receipt.rb +3 -1
- data/app/models/effective/qb_sales_receipt.rb +4 -2
- data/app/views/admin/qb_online/_company.html.haml +3 -0
- data/app/views/admin/qb_online/index.html.haml +7 -2
- data/app/views/admin/qb_online/items.html.haml +5 -0
- data/config/routes.rb +1 -0
- data/lib/effective_qb_online/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7fc21efb0c22e83527301d73ea8361950ac6509df72473f6b508c02a4395033
|
4
|
+
data.tar.gz: d64a65682a39acda71d381395cf88075f8ac52d2675c1edd0056d417a8c082dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8906f78473bcdbd0f52968e7e5071296116bbdda9bb772fcc02c76bc6bf6d21cbe53767550687417b896cf0d171f63b3e7758526259777c4a709dc22d87640f4
|
7
|
+
data.tar.gz: 642358ce67927f0fd30dc7af890d082a35291fed20a0b8ef2497ebeec41dc88154d0ab4d278836cb56d63b1eed638f3be9620475c0c2bf19316473d212534b65
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Admin
|
2
|
+
class EffectiveQbItemsDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
col :name, label: 'QuickBooks Item Name'
|
5
|
+
col :id, label: 'QuickBooks Item Id'
|
6
|
+
end
|
7
|
+
|
8
|
+
collection do
|
9
|
+
EffectiveQbOnline.api.items_collection.values.flatten(1)
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -26,6 +26,13 @@ module Admin
|
|
26
26
|
col :status
|
27
27
|
col :result
|
28
28
|
|
29
|
+
col :order_items, label: 'Purchasable Qb Item Names' do |receipt|
|
30
|
+
receipt.order.purchasables.map do |purchasable|
|
31
|
+
purchasable_id_name = [purchasable.try(:qb_item_id), purchasable.try(:qb_item_name)].compact
|
32
|
+
content_tag(:div, purchasable_id_name.join(' or '), class: "col-resource_item")
|
33
|
+
end.join.html_safe
|
34
|
+
end
|
35
|
+
|
29
36
|
actions_col
|
30
37
|
end
|
31
38
|
|
@@ -79,7 +79,6 @@ module Effective
|
|
79
79
|
error!
|
80
80
|
end
|
81
81
|
|
82
|
-
true
|
83
82
|
end
|
84
83
|
|
85
84
|
def skip!
|
@@ -93,6 +92,9 @@ module Effective
|
|
93
92
|
|
94
93
|
def error!
|
95
94
|
errored!
|
95
|
+
EffectiveLogger.error(result, associated: self) if defined?(EffectiveLogger)
|
96
|
+
|
97
|
+
false
|
96
98
|
end
|
97
99
|
|
98
100
|
end
|
@@ -29,17 +29,19 @@ module Effective
|
|
29
29
|
purchasable = receipt_item.order_item.purchasable
|
30
30
|
raise("Expected a purchasable for Effective::OrderItem #{receipt_item.order_item.id}") unless purchasable.present?
|
31
31
|
|
32
|
+
# Either of these could match
|
33
|
+
purchasable_id_name = [purchasable.try(:qb_item_id), purchasable.try(:qb_item_name)].compact
|
34
|
+
|
32
35
|
# Find item by receipt item
|
33
36
|
item = items.find { |item| [item.id, item.name].include?(receipt_item.item_id) }
|
34
37
|
|
35
38
|
# Find item by purchasable qb_item_id and qb_item_name
|
36
39
|
item ||= begin
|
37
|
-
purchasable_id_name = [purchasable.try(:qb_item_id), purchasable.try(:qb_item_name)]
|
38
40
|
items.find { |item| ([item.id, item.name] & purchasable_id_name).present? }
|
39
41
|
end
|
40
42
|
|
41
43
|
if item.blank?
|
42
|
-
raise("Unknown
|
44
|
+
raise("Unknown Item #{purchasable_id_name.join(' or ')} from #{purchasable} (#{purchasable.class.name} ##{purchasable.id})")
|
43
45
|
end
|
44
46
|
|
45
47
|
receipt_item.update!(item_id: item.id)
|
@@ -32,6 +32,9 @@
|
|
32
32
|
.col= f.select :payment_method_id, api.payment_methods_collection, label: false
|
33
33
|
.col= f.save
|
34
34
|
|
35
|
+
%tr
|
36
|
+
%td Items
|
37
|
+
%td= link_to 'Quickbooks Items', effective_qb_online.admin_quickbooks_items_path
|
35
38
|
|
36
39
|
- if company_info.blank?
|
37
40
|
%table.table.table-sm
|
@@ -11,8 +11,13 @@
|
|
11
11
|
= card('Test Credentials') do
|
12
12
|
= render('test_credentials', api: api)
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
- if api.realm&.configured?
|
15
|
+
.mb-2
|
16
|
+
= collapse('Show Company Settings') do
|
17
|
+
= render('company', api: api)
|
18
|
+
- else
|
19
|
+
= card('Company') do
|
20
|
+
= render('company', api: api)
|
16
21
|
|
17
22
|
= card('Sales Receipts') do
|
18
23
|
.text-right.mb-2
|
data/config/routes.rb
CHANGED
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.
|
4
|
+
version: 0.1.7
|
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-
|
11
|
+
date: 2022-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -212,6 +212,7 @@ files:
|
|
212
212
|
- app/controllers/admin/qb_realms_controller.rb
|
213
213
|
- app/controllers/admin/qb_receipts_controller.rb
|
214
214
|
- app/controllers/effective/qb_oauth_controller.rb
|
215
|
+
- app/datatables/admin/effective_qb_items_datatable.rb
|
215
216
|
- app/datatables/admin/effective_qb_receipts_datatable.rb
|
216
217
|
- app/helpers/effective_qb_online_helper.rb
|
217
218
|
- app/jobs/qb_sync_order_job.rb
|
@@ -224,6 +225,7 @@ files:
|
|
224
225
|
- app/views/admin/qb_online/_connect.html.haml
|
225
226
|
- app/views/admin/qb_online/_test_credentials.html.haml
|
226
227
|
- app/views/admin/qb_online/index.html.haml
|
228
|
+
- app/views/admin/qb_online/items.html.haml
|
227
229
|
- app/views/admin/qb_receipts/_form.html.haml
|
228
230
|
- app/views/admin/qb_receipts/edit.html.haml
|
229
231
|
- app/views/admin/qb_receipts/new.html.haml
|