ish_manager 0.1.8.464 → 0.1.8.466
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/ish_manager/application.js +1 -0
- data/app/assets/javascripts/ish_manager/invoices.js +29 -0
- data/app/controllers/ish_manager/invoices_controller.rb +18 -5
- data/app/views/ish_manager/invoices/_index_list.haml +1 -0
- data/app/views/ish_manager/invoices/new_stripe.haml +13 -4
- data/app/views/ish_manager/invoices/show.haml +8 -4
- data/app/views/ish_manager/leadsets/show.haml +1 -0
- data/config/routes.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a683cfef772c003347453411d5e573a99e0e728dd991e8f8992fe6aa1f513cb
|
4
|
+
data.tar.gz: cc083c29d80e582b0419d54416a795ea526786361486a615e445fc3e052439c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05ca4a618c3395a1342c7a4707b81fa0e19d5718f3e97b113c93964bda85639936eed2a965ed392ea494bf52c8e215b30e80c969b552f5df0efdeed5efbfd352
|
7
|
+
data.tar.gz: 43657b8c0a70855ad030dfb4438a28b9558ad88aba7e3bd57f8fc75ffb737ae2db5347f6a6d8037b99fdf1bd0915de3560217cb6dec69f1215ac0c55d1b00fa8
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
$(document).ready(function () {
|
4
|
+
|
5
|
+
const jwt_token = $("#Config").data('jwt-token')
|
6
|
+
logg(jwt_token, 'jwt_token')
|
7
|
+
|
8
|
+
if ($(".invoices-new").length) {
|
9
|
+
|
10
|
+
$("select[name='invoice[items][][product_id]']").on('change', function(ev) {
|
11
|
+
var productId = ev.target.value
|
12
|
+
logg(productId, 'productId')
|
13
|
+
|
14
|
+
$.get(`/api/products/${productId}.json?jwt_token=${jwt_token}`, function(_data) {
|
15
|
+
logg(_data, '_data')
|
16
|
+
|
17
|
+
$('select[name="invoice[items][][price_id]"]').empty();
|
18
|
+
// $('select[name="invoice[items][][price_id]"]').append($("<option disabled=true selected=true></option>").attr("value", '').text('Choose a price...')
|
19
|
+
$.each(_data.prices, function(_, item) {
|
20
|
+
$('select[name="invoice[items][][price_id]"]').append($("<option></option>").attr("value", item.id).text(item.name));
|
21
|
+
})
|
22
|
+
})
|
23
|
+
})
|
24
|
+
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
})
|
29
|
+
|
@@ -64,7 +64,8 @@ class ::IshManager::InvoicesController < IshManager::ApplicationController
|
|
64
64
|
pending_invoice_items_behavior: 'exclude',
|
65
65
|
})
|
66
66
|
params[:invoice][:items].each do |item|
|
67
|
-
stripe_price = Wco::
|
67
|
+
stripe_price = Wco::Price.find( item[:price_id] ).price_id
|
68
|
+
puts! stripe_price, 'stripe_price'
|
68
69
|
invoice_item = Stripe::InvoiceItem.create({
|
69
70
|
customer: @invoice.leadset.customer_id,
|
70
71
|
price: stripe_price,
|
@@ -72,14 +73,18 @@ class ::IshManager::InvoicesController < IshManager::ApplicationController
|
|
72
73
|
quantity: item[:quantity],
|
73
74
|
})
|
74
75
|
end
|
75
|
-
Stripe::Invoice.
|
76
|
+
Stripe::Invoice.finalize_invoice( stripe_invoice[:id] )
|
77
|
+
if params[:do_send]
|
78
|
+
Stripe::Invoice.send_invoice(stripe_invoice[:id])
|
79
|
+
flash_notice "Scheduled to send the invoice via stripe."
|
80
|
+
end
|
76
81
|
@invoice.update_attributes({ invoice_id: stripe_invoice[:id] })
|
77
82
|
|
78
83
|
if @invoice.save
|
79
|
-
|
84
|
+
flash_notice "Created the invoice."
|
80
85
|
redirect_to action: :show, id: @invoice.id
|
81
86
|
else
|
82
|
-
|
87
|
+
flash_alert "Cannot create invoice: #{@invoice.errors.messages}"
|
83
88
|
render :new
|
84
89
|
end
|
85
90
|
end
|
@@ -108,12 +113,20 @@ class ::IshManager::InvoicesController < IshManager::ApplicationController
|
|
108
113
|
def email_send
|
109
114
|
@invoice = Ish::Invoice.find params[:id]
|
110
115
|
authorize! :send_email, @invoice
|
111
|
-
out = ::IshManager::LeadsetMailer.monthly_invoice( @invoice.id )
|
116
|
+
out = ::IshManager::LeadsetMailer.monthly_invoice( @invoice.id.to_s )
|
112
117
|
Rails.env.production? ? out.deliver_later : out.deliver_now
|
113
118
|
flash_notice "Scheduled to send an email."
|
114
119
|
redirect_to controller: :leadsets, action: :show, id: @invoice.leadset_id
|
115
120
|
end
|
116
121
|
|
122
|
+
def send_stripe
|
123
|
+
@invoice = Ish::Invoice.find params[:id]
|
124
|
+
authorize! :send_stripe, @invoice
|
125
|
+
Stripe::Invoice.send_invoice( @invoice.invoice_id )
|
126
|
+
flash_notice "Scheduled to send the invoice."
|
127
|
+
redirect_to action: :show, id: @invoice.id
|
128
|
+
end
|
129
|
+
|
117
130
|
def show
|
118
131
|
@invoice = Ish::Invoice.find params[:id]
|
119
132
|
authorize! :show, @invoice
|
@@ -22,10 +22,13 @@
|
|
22
22
|
-# - else
|
23
23
|
-# = f.select :email, options_for_select([[nil,nil]] + @leadset.employees.map { |i| [ i.email, i.email ] } )
|
24
24
|
|
25
|
-
.input-
|
25
|
+
.input-row
|
26
26
|
%label item
|
27
|
-
= select_tag 'invoice[items][][product_id]', options_for_select( @products_list )
|
28
|
-
|
27
|
+
= select_tag 'invoice[items][][product_id]', options_for_select( @products_list ), class: 'products'
|
28
|
+
|
29
|
+
%label price
|
30
|
+
= select_tag 'invoice[items][][price_id]'
|
31
|
+
|
29
32
|
%label quantity
|
30
33
|
= number_field_tag 'invoice[items][][quantity]'
|
31
34
|
|
@@ -37,5 +40,11 @@
|
|
37
40
|
-# %label Description
|
38
41
|
-# = f.text_area :description
|
39
42
|
|
40
|
-
|
43
|
+
.input-field
|
44
|
+
%label Send now?
|
45
|
+
= check_box_tag :do_send
|
46
|
+
|
47
|
+
.actions
|
48
|
+
|
49
|
+
= f.submit 'Create', data: { confirm: 'Are you sure?' }
|
41
50
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
- i = @invoice
|
3
3
|
|
4
4
|
.invoices-show.max-width
|
5
|
-
%h5 Invoice ##{
|
5
|
+
%h5 Invoice ##{i.number}
|
6
6
|
|
7
7
|
%ul
|
8
8
|
%li email: #{i.email}
|
@@ -10,10 +10,14 @@
|
|
10
10
|
%li invoice_id: #{i.invoice_id}
|
11
11
|
%li items: #{i.items}
|
12
12
|
|
13
|
-
= @invoice.inspect
|
13
|
+
-# = @invoice.inspect
|
14
14
|
|
15
15
|
%hr
|
16
|
+
%h5
|
17
|
+
Stripe Invoice
|
18
|
+
= link_to 'pdf', @stripe_invoice[:invoice_pdf], target: :_blank
|
19
|
+
.inline-block= button_to 'stripe-send', send_invoice_stripe_path( i.id ), data: { confirm: 'Are you sure?' }
|
16
20
|
|
17
|
-
%pre
|
18
|
-
|
21
|
+
-# %pre
|
22
|
+
-# = @stripe_invoice.inspect
|
19
23
|
|
@@ -28,6 +28,7 @@
|
|
28
28
|
Invoices (#{@leadset.invoices.length})
|
29
29
|
= link_to '[+stripe]', new_invoice_stripe_path({ leadset_id: @leadset.id })
|
30
30
|
= link_to '[+pdf]', new_invoice_pdf_path({ leadset_id: @leadset.id })
|
31
|
+
|
31
32
|
= render 'ish_manager/invoices/index_list', invoices: @invoices
|
32
33
|
|
33
34
|
= form_tag create_monthly_invoice_for_leadset_path({ leadset_id: @leadset.id }) do
|
data/config/routes.rb
CHANGED
@@ -31,6 +31,7 @@ IshManager::Engine.routes.draw do
|
|
31
31
|
post 'invoices/create-stripe', to: 'invoices#create_stripe', as: :create_invoice_stripe
|
32
32
|
get 'invoices/new_pdf', to: 'invoices#new_pdf', as: :new_invoice_pdf
|
33
33
|
get 'invoices/new_stripe', to: 'invoices#new_stripe', as: :new_invoice_stripe
|
34
|
+
post 'invoices/:id/send-stripe', to: 'invoices#send_stripe', as: :send_invoice_stripe
|
34
35
|
resources :invoices
|
35
36
|
|
36
37
|
get 'iro_positins/roll_prep/:id', to: 'iro_purses#roll_prep', as: :iro_roll_prep
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ish_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.466
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -279,6 +279,7 @@ files:
|
|
279
279
|
- app/assets/javascripts/ish_manager/email_conversations.js
|
280
280
|
- app/assets/javascripts/ish_manager/email_templates.js
|
281
281
|
- app/assets/javascripts/ish_manager/galleries.js
|
282
|
+
- app/assets/javascripts/ish_manager/invoices.js
|
282
283
|
- app/assets/javascripts/ish_manager/iro.js
|
283
284
|
- app/assets/javascripts/ish_manager/iro0.js
|
284
285
|
- app/assets/javascripts/ish_manager/leads.js
|