ish_manager 0.1.8.461 → 0.1.8.463
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/stylesheets/ish_manager/application.scss +2 -0
- data/app/assets/stylesheets/ish_manager/products.scss +9 -0
- data/app/assets/stylesheets/ish_manager/subscriptions.scss +6 -0
- data/app/controllers/ish_manager/application_controller.rb +20 -0
- data/app/controllers/ish_manager/invoices_controller.rb +96 -1
- data/app/controllers/ish_manager/leadsets_controller.rb +3 -1
- data/app/controllers/ish_manager/prices_controller.rb +15 -0
- data/app/controllers/ish_manager/products_controller.rb +54 -26
- data/app/controllers/ish_manager/subscriptions_controller.rb +51 -22
- data/app/views/ish_manager/appliances/_index.haml +2 -1
- data/app/views/ish_manager/application/_alerts_notices.haml +12 -2
- data/app/views/ish_manager/application/_main_header_admin.haml +2 -1
- data/app/views/ish_manager/galleries/index_titles.haml +1 -1
- data/app/views/ish_manager/invoices/_index_list.haml +6 -0
- data/app/views/ish_manager/invoices/_index_table.haml +20 -0
- data/app/views/ish_manager/invoices/index.haml +1 -29
- data/app/views/ish_manager/invoices/new_pdf.haml +4 -1
- data/app/views/ish_manager/leadsets/show.haml +33 -6
- data/app/views/ish_manager/meetings/index.haml +1 -1
- data/app/views/ish_manager/payments/index.haml +1 -1
- data/app/views/ish_manager/products/_form.haml +4 -4
- data/app/views/ish_manager/products/_index_list.haml +10 -0
- data/app/views/ish_manager/products/_index_table.haml +20 -0
- data/app/views/ish_manager/products/index.haml +19 -15
- data/app/views/ish_manager/serverhosts/_index.haml +1 -2
- data/app/views/ish_manager/subscriptions/_form.haml +10 -2
- data/app/views/ish_manager/subscriptions/index.haml +15 -3
- data/app/views/ish_manager/subscriptions/new.haml +1 -1
- data/app/views/ish_manager/subscriptions/new_stripe.haml +4 -0
- data/app/views/ish_manager/subscriptions/new_wco.haml +4 -0
- data/app/views/ish_manager/subscriptions/show.haml +4 -0
- data/config/routes.rb +5 -0
- metadata +25 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e3d19cd10fe96e5cb993413b121bc44c107cd793ca8280f193d18a5967b6fd1
|
4
|
+
data.tar.gz: 8269b21b2d010573fbb04ea80282e96507a5bc01bbf98c98e0cdd46157d3c1e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d623e2070e7f1f933960fc4c71aad603e77a6391aa7886e9a22b610d3c7c76d89e184aa346d8096f2416234d85623a4c59b58caa78ec3fb0b7b9bb19ef488c32
|
7
|
+
data.tar.gz: 58fe7332a16091c22fb181fd76f6c33cfeb44093d52196f198f5bf01dc66ef749566539c09646269799bd5002c4e3512031fbded7968d5090dcdafa7332600be
|
@@ -20,8 +20,10 @@
|
|
20
20
|
*= require ish_manager/markers
|
21
21
|
*= require ish_manager/office
|
22
22
|
*= require ish_manager/pagination
|
23
|
+
*= require ish_manager/products
|
23
24
|
*= require ish_manager/photos
|
24
25
|
*= require ish_manager/scheduled_email_actions
|
26
|
+
*= require ish_manager/subscriptions
|
25
27
|
*= require ish_manager/tags
|
26
28
|
*= require ish_manager/user_profiles
|
27
29
|
*= require ish_manager/videos
|
@@ -50,6 +50,26 @@ class IshManager::ApplicationController < ActionController::Base
|
|
50
50
|
JWT.encode(payload, Rails.application.secrets.secret_key_base.to_s)
|
51
51
|
end
|
52
52
|
|
53
|
+
def flash_alert what
|
54
|
+
flash[:alert] ||= []
|
55
|
+
if String == what.class
|
56
|
+
str = what
|
57
|
+
else
|
58
|
+
str = "Cannot create/update #{what.class.name}: #{what.errors.full_messages.join(', ')} ."
|
59
|
+
end
|
60
|
+
flash[:alert] << str
|
61
|
+
end
|
62
|
+
|
63
|
+
def flash_notice what
|
64
|
+
flash[:notice] ||= []
|
65
|
+
if String == what.class
|
66
|
+
str = what
|
67
|
+
else
|
68
|
+
str = "Created/updated #{what.class.name} ."
|
69
|
+
end
|
70
|
+
flash[:notice] << str
|
71
|
+
end
|
72
|
+
|
53
73
|
def my_truthy? which
|
54
74
|
["1", "t", "T", "true"].include?( which )
|
55
75
|
end
|
@@ -1,14 +1,109 @@
|
|
1
|
+
require 'prawn'
|
2
|
+
require 'prawn/table'
|
1
3
|
|
2
4
|
class ::IshManager::InvoicesController < IshManager::ApplicationController
|
3
5
|
|
4
6
|
before_action :set_lists
|
5
7
|
|
8
|
+
def create_monthly_pdf
|
9
|
+
@leadset = Leadset.find params[:leadset_id]
|
10
|
+
authorize! :create_monthly_invoice_pdf, @leadset
|
11
|
+
|
12
|
+
@invoice = Ish::Invoice.where({ leadset_id: @leadset.id, month_on: params[:month_on] }).first
|
13
|
+
if @invoice
|
14
|
+
flash_alert "Already created this invoice."
|
15
|
+
redirect_to controller: :leadsets, action: :show, id: @leadset.id
|
16
|
+
return
|
17
|
+
end
|
18
|
+
|
19
|
+
@invoice = Ish::Invoice.create({ leadset_id: @leadset.id, month_on: params[:month_on] })
|
20
|
+
|
21
|
+
@pdf = @invoice.generate_monthly_invoice params[:month_on]
|
22
|
+
filename = "invoice-#{@invoice.number}.pdf"
|
23
|
+
path = Rails.root.join 'tmp', filename
|
24
|
+
@pdf.render_file path
|
25
|
+
data = File.read path
|
26
|
+
File.delete(path) if File.exist?(path)
|
27
|
+
|
28
|
+
send_data( data, { :filename => filename,
|
29
|
+
:disposition => params[:disposition] ? params[:disposition] : :attachment,
|
30
|
+
:type => 'application/pdf'
|
31
|
+
})
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
## @TODO: obsolete, remove
|
36
|
+
##
|
6
37
|
def create_pdf
|
7
38
|
@invoice = Ish::Invoice.new
|
8
39
|
authorize! :new, @invoice
|
9
40
|
|
41
|
+
tree_img_url = "#{Rails.root.join('public')}/tree-1.jpg"
|
42
|
+
wasya_co_logo_url = "#{Rails.root.join('public')}/259x66-WasyaCo-logo.png"
|
43
|
+
|
10
44
|
pdf = Prawn::Document.new
|
11
|
-
|
45
|
+
|
46
|
+
pdf.canvas do
|
47
|
+
pdf.image tree_img_url, at: [ 0, 792 ], width: 612
|
48
|
+
|
49
|
+
pdf.fill_color 'ffffff'
|
50
|
+
pdf.transparent( 0.75 ) do
|
51
|
+
pdf.fill_rectangle [0, 792], 612, 792
|
52
|
+
end
|
53
|
+
pdf.fill_color '000000'
|
54
|
+
|
55
|
+
pdf.image wasya_co_logo_url, at: [252, 720], width: 108 ## 1.5"
|
56
|
+
|
57
|
+
pdf.bounding_box( [0.75*72, 9.25*72], width: 3.25*72, height: 0.75*72 ) do
|
58
|
+
pdf.text "From:"
|
59
|
+
pdf.text "Wasya Co"
|
60
|
+
pdf.text "(415) 948-0368"
|
61
|
+
end
|
62
|
+
|
63
|
+
pdf.bounding_box( [4.5*72, 9.25*72], width: 3.25*72, height: 0.75*72 ) do
|
64
|
+
pdf.text "Stats:"
|
65
|
+
pdf.text "Date: #{ '2023-09-07' }"
|
66
|
+
pdf.text "Invoice # #{ '111' }"
|
67
|
+
end
|
68
|
+
|
69
|
+
pdf.bounding_box( [0.75*72, 8.25*72], width: 3.25*72, height: 0.75*72 ) do
|
70
|
+
pdf.text "To:"
|
71
|
+
pdf.text "Creen Enterprise"
|
72
|
+
end
|
73
|
+
|
74
|
+
pdf.bounding_box( [4.5*72, 8.25*72], width: 3.25*72, height: 0.75*72 ) do
|
75
|
+
pdf.text "Notes:"
|
76
|
+
pdf.text "Support & various, for the month of August '23."
|
77
|
+
end
|
78
|
+
|
79
|
+
pdf.move_down 20
|
80
|
+
|
81
|
+
pdf.table([
|
82
|
+
[ 'Description', 'Type', 'Hours', 'Subtotal' ],
|
83
|
+
[ 'Part 2/2', 'indep. proj.', '-', '$3,501' ],
|
84
|
+
], {
|
85
|
+
position: :center,
|
86
|
+
width: 7.5*72,
|
87
|
+
cell_style: {
|
88
|
+
inline_format: true,
|
89
|
+
borders: [ :bottom ]
|
90
|
+
},
|
91
|
+
} )
|
92
|
+
|
93
|
+
pdf.table([
|
94
|
+
[ 'Total' ],
|
95
|
+
[ '$3,501' ],
|
96
|
+
], {
|
97
|
+
position: 7*72,
|
98
|
+
width: 1*72,
|
99
|
+
cell_style: {
|
100
|
+
inline_format: true,
|
101
|
+
borders: [ :bottom ]
|
102
|
+
},
|
103
|
+
} )
|
104
|
+
|
105
|
+
pdf.text_box "Thank you!", at: [ 3.25*72, 1.25*72 ], width: 2*72, height: 1*72, align: :center
|
106
|
+
end
|
12
107
|
|
13
108
|
filename = "a-summary.pdf"
|
14
109
|
path = Rails.root.join 'tmp', filename
|
@@ -57,7 +57,9 @@ class ::IshManager::LeadsetsController < IshManager::ApplicationController
|
|
57
57
|
@email_contexts[lead.email] = lead.email_contexts
|
58
58
|
end
|
59
59
|
|
60
|
-
@employees
|
60
|
+
@employees = @leadset.employees.page( params[:leads_page] ).per( current_profile.per_page )
|
61
|
+
@subscriptions = @leadset.subscriptions
|
62
|
+
@invoices = @leadset.invoices
|
61
63
|
end
|
62
64
|
|
63
65
|
def update
|
@@ -3,37 +3,48 @@ class IshManager::ProductsController < IshManager::ApplicationController
|
|
3
3
|
|
4
4
|
before_action :set_lists
|
5
5
|
|
6
|
-
#
|
6
|
+
# Alphabetized : )
|
7
7
|
|
8
8
|
def create
|
9
|
-
@product = Wco::Product.new params[:product].permit
|
9
|
+
@product = Wco::Product.new params[:product].permit( :name )
|
10
|
+
@price = Wco::Price.new params[:price].permit( :amount_cents, :interval )
|
10
11
|
authorize! :create, @product
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
if !params[:price][:interval].present?
|
14
|
+
@price.interval = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
stripe_product = Stripe::Product.create({ name: @product.name })
|
18
|
+
# puts! stripe_product, 'stripe_product'
|
19
|
+
flash_notice 'Created stripe product.'
|
20
|
+
@product.product_id = stripe_product[:id]
|
21
|
+
|
22
|
+
if @product.save
|
23
|
+
flash_notice 'Created wco product.'
|
24
|
+
else
|
25
|
+
flash_alert "Cannot create wco product: #{@product.errors.full_messages.join(', ')}."
|
26
|
+
end
|
14
27
|
|
15
28
|
price_hash = {
|
16
|
-
product:
|
17
|
-
unit_amount:
|
18
|
-
currency:
|
29
|
+
product: stripe_product.id,
|
30
|
+
unit_amount: @price.amount_cents,
|
31
|
+
currency: 'usd',
|
19
32
|
}
|
20
|
-
if
|
21
|
-
price_hash[:recurring] = { interval:
|
33
|
+
if @price.interval.present?
|
34
|
+
price_hash[:recurring] = { interval: @price.interval }
|
22
35
|
end
|
23
36
|
stripe_price = Stripe::Price.create( price_hash )
|
24
|
-
puts! stripe_price, 'stripe_price'
|
25
|
-
|
26
|
-
@product
|
27
|
-
@
|
28
|
-
|
29
|
-
|
30
|
-
if flag
|
31
|
-
flash[:notice] = 'Created the product.'
|
32
|
-
redirect_to action: :index
|
37
|
+
# puts! stripe_price, 'stripe_price'
|
38
|
+
flash_notice 'Created stripe price.'
|
39
|
+
@price.product = @product
|
40
|
+
@price.price_id = stripe_price[:id]
|
41
|
+
if @price.save
|
42
|
+
flash_notice @price
|
33
43
|
else
|
34
|
-
|
35
|
-
render action: :index
|
44
|
+
flash_alert @price
|
36
45
|
end
|
46
|
+
|
47
|
+
redirect_to action: :index
|
37
48
|
end
|
38
49
|
|
39
50
|
def destroy
|
@@ -60,25 +71,42 @@ class IshManager::ProductsController < IshManager::ApplicationController
|
|
60
71
|
|
61
72
|
def index
|
62
73
|
authorize! :index, Wco::Product
|
63
|
-
@stripe_products = {}
|
64
74
|
|
65
|
-
|
66
|
-
Stripe.api_version = '2020-08-27'
|
75
|
+
@stripe_products = {}
|
67
76
|
@_stripe_products = Stripe::Product.list().data
|
68
|
-
@_stripe_prices
|
77
|
+
@_stripe_prices = Stripe::Price.list().data
|
69
78
|
|
70
79
|
@_stripe_products.each do |sp|
|
71
80
|
@stripe_products[sp[:id]] = sp
|
72
81
|
@stripe_products[sp[:id]][:prices] ||= {}
|
73
82
|
end
|
74
83
|
@_stripe_prices.each do |price|
|
75
|
-
|
84
|
+
begin
|
85
|
+
@stripe_products[price[:product]][:prices][price[:id]] = price
|
86
|
+
rescue Exception
|
87
|
+
nil
|
88
|
+
end
|
76
89
|
end
|
77
90
|
|
78
|
-
@
|
91
|
+
@wco_products = Wco::Product.all.includes( :prices )
|
92
|
+
@wco_products.each do |item|
|
93
|
+
if @stripe_products[item[:product_id]]
|
94
|
+
@stripe_products[item[:product_id]][:wco_product] = item
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
## 2023-09-07 @TODO: move to model:
|
99
|
+
## @wco_prices_hash = Wco::Price.all.hash_by( :price_id )
|
100
|
+
##
|
101
|
+
@wco_prices_hash = {}
|
102
|
+
@wco_prices = Wco::Price.all
|
103
|
+
@wco_prices.each do |item|
|
104
|
+
@wco_prices_hash[item[:price_id]] = item
|
105
|
+
end
|
79
106
|
|
80
107
|
end
|
81
108
|
|
109
|
+
|
82
110
|
def show
|
83
111
|
authorize! :show, @product
|
84
112
|
@product = Wco::Product.find params[:id]
|
@@ -5,42 +5,51 @@ class IshManager::SubscriptionsController < IshManager::ApplicationController
|
|
5
5
|
|
6
6
|
## Alphabetized : )
|
7
7
|
|
8
|
+
##
|
9
|
+
## A stripe subscription is currently single-item only.
|
10
|
+
##
|
8
11
|
def create
|
9
12
|
@subscription = Wco::Subscription.new params[:subscription].permit!
|
10
13
|
authorize! :create, @subscription
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
15
|
+
@subscription.leadset_id = Leadset.where({ customer_id: params[:subscription][:customer_id] }).first&.id
|
16
|
+
@subscription.price = Wco::Price.find_by price_id: params[:subscription][:price_id]
|
17
|
+
@subscription.product = @subscription.price.product
|
18
|
+
|
19
|
+
if params[:is_stripe]
|
20
|
+
payment_methods = Stripe::Customer.list_payment_methods( params[:subscription][:customer_id] ).data
|
21
|
+
params = {
|
22
|
+
customer: params[:subscription][:customer_id],
|
23
|
+
default_payment_method: payment_methods[0][:id],
|
24
|
+
items: [
|
25
|
+
{ price: params[:subscription][:price_id],
|
26
|
+
quantity: params[:subscription][:quantity],
|
27
|
+
},
|
28
|
+
],
|
29
|
+
}
|
30
|
+
@stripe_subscription = Stripe::Subscription.create( params )
|
31
|
+
flash_notice @stripe_subscription
|
32
|
+
end
|
25
33
|
|
26
34
|
|
27
35
|
flag = @subscription.save
|
28
36
|
if flag
|
29
|
-
|
37
|
+
flash_notice @subscription
|
30
38
|
redirect_to action: :show, id: @subscription.id
|
31
39
|
else
|
32
|
-
|
33
|
-
|
40
|
+
flash_alert @subscription
|
41
|
+
redirect_to action: :new
|
34
42
|
end
|
35
43
|
end
|
36
44
|
|
45
|
+
|
37
46
|
def index
|
38
47
|
authorize! :index, Wco::Subscription
|
39
48
|
|
40
49
|
@stripe_customers = Stripe::Customer.list().data
|
41
50
|
@stripe_subscriptions = Stripe::Subscription.list().data
|
42
51
|
|
43
|
-
@customers = {}
|
52
|
+
@customers = {} ## still stripe customers
|
44
53
|
customer_ids = @stripe_customers.map &:id
|
45
54
|
@leadsets = Leadset.where( :customer_id.in => customer_ids )
|
46
55
|
@leadsets.each do |i|
|
@@ -54,8 +63,10 @@ class IshManager::SubscriptionsController < IshManager::ApplicationController
|
|
54
63
|
@customers[i[:customer_id]][:profiles] ||= []
|
55
64
|
@customers[i[:customer_id]][:profiles].push( i )
|
56
65
|
end
|
57
|
-
|
58
66
|
# puts! @customers, '@customers'
|
67
|
+
|
68
|
+
@wco_subscriptions = Wco::Subscription.all
|
69
|
+
|
59
70
|
end
|
60
71
|
|
61
72
|
def new
|
@@ -63,6 +74,16 @@ class IshManager::SubscriptionsController < IshManager::ApplicationController
|
|
63
74
|
authorize! :new, @subscription
|
64
75
|
end
|
65
76
|
|
77
|
+
def new_stripe
|
78
|
+
@subscription = Wco::Subscription.new
|
79
|
+
authorize! :new, @subscription
|
80
|
+
end
|
81
|
+
|
82
|
+
def new_wco
|
83
|
+
@subscription = Wco::Subscription.new
|
84
|
+
authorize! :new, @subscription
|
85
|
+
end
|
86
|
+
|
66
87
|
def show
|
67
88
|
@subscription = Wco::Subscription.find params[:id]
|
68
89
|
authorize! :show, @subscription
|
@@ -75,11 +96,19 @@ class IshManager::SubscriptionsController < IshManager::ApplicationController
|
|
75
96
|
|
76
97
|
def set_lists
|
77
98
|
super
|
78
|
-
@products_list
|
79
|
-
leadsets = Leadset.where( "customer_id IS NOT NULL"
|
80
|
-
profiles = ::Ish::UserProfile.where( :customer_id.ne => nil ).map { |i| [ "profile
|
99
|
+
@products_list = Wco::Product.list
|
100
|
+
leadsets = Leadset.where( "customer_id IS NOT NULL" ).map { |i| [ "leadset // #{i.company_url} (#{i.email})", i.customer_id ] }
|
101
|
+
profiles = ::Ish::UserProfile.where( :customer_id.ne => nil ).map { |i| [ "profile // #{i.email}", i.customer_id ] }
|
81
102
|
@customer_ids_list = leadsets + profiles
|
82
|
-
@price_ids_list
|
103
|
+
@price_ids_list = Wco::Product.all.includes( :prices ).map do |i|
|
104
|
+
price = i.prices[0]
|
105
|
+
if price&.price_id
|
106
|
+
puts! price.interval, 'price.interval'
|
107
|
+
[ "#{i.name} // $#{price.amount_cents.to_f/100}/#{price.interval||'onetime'}", price.price_id ]
|
108
|
+
else
|
109
|
+
[ "#{i.name} - no price!!!", nil ]
|
110
|
+
end
|
111
|
+
end
|
83
112
|
end
|
84
113
|
|
85
114
|
end
|
@@ -1,12 +1,22 @@
|
|
1
1
|
|
2
2
|
.row.max-width
|
3
3
|
.col-sm-12
|
4
|
-
- if notice
|
4
|
+
- if notice&.class == String
|
5
5
|
.notice
|
6
6
|
= notice
|
7
7
|
.close [x]
|
8
|
-
- if
|
8
|
+
- if notice&.class == Array
|
9
|
+
- notice.each do |i|
|
10
|
+
.notice
|
11
|
+
= i
|
12
|
+
.close [x]
|
13
|
+
- if alert&.class == String
|
9
14
|
.alert
|
10
15
|
= alert
|
11
16
|
.close [x]
|
17
|
+
- if alert&.class == Array
|
18
|
+
- alert.each do |i|
|
19
|
+
.alert
|
20
|
+
= i
|
21
|
+
.close [x]
|
12
22
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
.invoices--index-table
|
3
|
+
%table.bordered.data-table
|
4
|
+
%thead
|
5
|
+
%tr
|
6
|
+
%th
|
7
|
+
%th Email
|
8
|
+
%th Number
|
9
|
+
%th Amount
|
10
|
+
%th Amount Paid
|
11
|
+
%th Created At
|
12
|
+
%tbody
|
13
|
+
- invoices.each do |i|
|
14
|
+
%tr
|
15
|
+
%td= link_to "View", invoice_path( i )
|
16
|
+
%td= i.email
|
17
|
+
%td= i.number
|
18
|
+
%td= i.amount_cents
|
19
|
+
%td= i.paid_amount_cents
|
20
|
+
%td= i.created_at.to_s[0..10]
|
@@ -1,31 +1,3 @@
|
|
1
1
|
|
2
2
|
.invoices-index.max-width
|
3
|
-
|
4
|
-
|
5
|
-
%h5
|
6
|
-
Invoices
|
7
|
-
-# = link_to '[+]', new_invoice_path
|
8
|
-
|
9
|
-
-# .row
|
10
|
-
-# .col.s12.col.m6.col-md-offset-3
|
11
|
-
-# = render 'form', :invoice => @new_invoice
|
12
|
-
%hr
|
13
|
-
|
14
|
-
%table#dataTable
|
15
|
-
%thead
|
16
|
-
%tr
|
17
|
-
%th
|
18
|
-
%th Email
|
19
|
-
%th Number
|
20
|
-
%th Amount
|
21
|
-
%th Amount Paid
|
22
|
-
%th Created At
|
23
|
-
%tbody
|
24
|
-
- @invoices.each do |i|
|
25
|
-
%tr
|
26
|
-
%td= link_to "View", invoice_path( i )
|
27
|
-
%td= i.email
|
28
|
-
%td= i.number
|
29
|
-
%td= i.amount_cents
|
30
|
-
%td= i.paid_amount_cents
|
31
|
-
%td= i.created_at.to_s[0..10]
|
3
|
+
= render 'index_table', invoices: @invoices
|
@@ -3,9 +3,12 @@
|
|
3
3
|
|
4
4
|
.row
|
5
5
|
.col.s12.col.m6.col-md-offset-3
|
6
|
+
|
6
7
|
%h5 New PDF Invoice for `#{link_to @leadset&.name, leadset_path(@leadset)}`:
|
7
8
|
= form_for @new_invoice, as: :invoice, url: create_invoice_pdf_path do |f|
|
8
|
-
|
9
|
+
.input-field
|
10
|
+
%label Email
|
11
|
+
= f.text_field :email
|
9
12
|
.input-field
|
10
13
|
invoice month, description
|
11
14
|
.input-field
|
@@ -9,14 +9,11 @@
|
|
9
9
|
%li <b>Email:</b> #{@leadset.email}
|
10
10
|
%li <b>company_url</b>: #{@leadset.company_url}
|
11
11
|
%li <b>customer_id</b>: #{@leadset.customer_id}
|
12
|
-
%li
|
13
|
-
= link_to invoices_path({ leadset_id: @leadset.id }) do
|
14
|
-
Invoices
|
15
|
-
(#{@leadset.invoices.length})
|
16
|
-
= link_to '[+stripe]', new_invoice_stripe_path({ leadset_id: @leadset.id })
|
17
|
-
= link_to '[+pdf]', new_invoice_pdf_path({ leadset_id: @leadset.id })
|
18
12
|
|
13
|
+
|
14
|
+
%h5.collapse-expand#leads Leads
|
19
15
|
= render 'ish_manager/leads/index', leads: @employees
|
16
|
+
%hr
|
20
17
|
|
21
18
|
.row
|
22
19
|
.col-md-6
|
@@ -24,3 +21,33 @@
|
|
24
21
|
|
25
22
|
.col-md-6
|
26
23
|
= render 'ish_manager/appliances/index', appliances: @leadset.appliances
|
24
|
+
|
25
|
+
.row
|
26
|
+
.col-md-6
|
27
|
+
%h5.collapse-expand#invoicesList
|
28
|
+
Invoices (#{@leadset.invoices.length})
|
29
|
+
= link_to '[+stripe]', new_invoice_stripe_path({ leadset_id: @leadset.id })
|
30
|
+
= link_to '[+pdf]', new_invoice_pdf_path({ leadset_id: @leadset.id })
|
31
|
+
= render 'ish_manager/invoices/index_list', invoices: @invoices
|
32
|
+
|
33
|
+
= form_tag create_monthly_invoice_for_leadset_path({ leadset_id: @leadset.id }) do
|
34
|
+
%label Create invoice for month
|
35
|
+
= text_field_tag 'month_on'
|
36
|
+
= submit_tag 'Submit', data: { confirm: 'Are you sure?' }
|
37
|
+
%hr
|
38
|
+
|
39
|
+
.col-md-6
|
40
|
+
%h5.collapse-expand#subscriptionsList
|
41
|
+
Subscriptions (#{@subscriptions.length})
|
42
|
+
= link_to '[+wco]', new_wco_subscription_path({ customer_id: @leadset.customer_id })
|
43
|
+
%table.bordered
|
44
|
+
%thead
|
45
|
+
%tr
|
46
|
+
%th Name
|
47
|
+
%th Price
|
48
|
+
- @subscriptions.each do |i|
|
49
|
+
%tr
|
50
|
+
%td= i.product.name
|
51
|
+
%td= i.price
|
52
|
+
%hr
|
53
|
+
|
@@ -2,19 +2,19 @@
|
|
2
2
|
- url = product.new_record? ? products_path : product_path( product )
|
3
3
|
|
4
4
|
.products--form
|
5
|
-
= form_for product,
|
5
|
+
= form_for product, url: url do |f|
|
6
6
|
|
7
7
|
.form-field
|
8
8
|
%label Name
|
9
|
-
=
|
9
|
+
= text_field_tag 'product[name]'
|
10
10
|
|
11
11
|
.form-field
|
12
12
|
%label Price in cents
|
13
|
-
=
|
13
|
+
= text_field_tag 'price[amount_cents]'
|
14
14
|
|
15
15
|
.form-field
|
16
16
|
%label Recurring?
|
17
|
-
=
|
17
|
+
= select_tag 'price[interval]', options_for_select(Wco::Price::INTERVALS)
|
18
18
|
|
19
19
|
-# .form-field
|
20
20
|
-# %label Stripe product_id
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
%ol
|
3
|
+
- products.each do |product|
|
4
|
+
%li
|
5
|
+
= link_to '[~]', edit_product_path( product )
|
6
|
+
#{product.name} // $#{product.price_cents.to_f/100}/#{product.interval.presence || 'onetime'}
|
7
|
+
- if product.product_id
|
8
|
+
.ml-5 <b>product_id:</b> #{product.product_id}
|
9
|
+
- if product.price_id
|
10
|
+
.ml-5 <b>price_id:</b> #{product.price_id}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
.products--index-table
|
3
|
+
%table.bordered.data-table
|
4
|
+
%thead
|
5
|
+
%tr
|
6
|
+
%th.name Name
|
7
|
+
%th.prices Prices
|
8
|
+
|
9
|
+
- products.each do |product|
|
10
|
+
%tr
|
11
|
+
%td.p-2
|
12
|
+
= link_to '[~]', edit_product_path( product )
|
13
|
+
= product.name
|
14
|
+
.gray= product.product_id
|
15
|
+
%td.p-2
|
16
|
+
%ul
|
17
|
+
- product.prices.each do |price|
|
18
|
+
%li
|
19
|
+
$#{ price.amount_cents.to_f/100 } / #{price.interval}
|
20
|
+
.gray= price.price_id
|
@@ -1,7 +1,12 @@
|
|
1
1
|
|
2
2
|
.products-index.max-width
|
3
3
|
|
4
|
-
|
4
|
+
.a
|
5
|
+
%h5 New Product:
|
6
|
+
= render 'ish_manager/products/form', product: Wco::Product.new
|
7
|
+
%hr
|
8
|
+
|
9
|
+
%h5.collapse-expand#stripeProducts
|
5
10
|
Stripe Products (#{@stripe_products.length}):
|
6
11
|
-# = link_to '[+]', new_product_path
|
7
12
|
%ol
|
@@ -10,24 +15,23 @@
|
|
10
15
|
= link_to '[~]', edit_product_path( product.id )
|
11
16
|
.inline-block= button_to '[x]', product_path( product.id ), :method => :delete, :data => { :confirm => 'Are you sure?' }
|
12
17
|
%span.gray= product.id
|
13
|
-
|
18
|
+
- if product[:wco_product]
|
19
|
+
= link_to product.name, product_path( product )
|
20
|
+
- else
|
21
|
+
= product.name
|
14
22
|
%ul
|
15
23
|
- product[:prices].each do |price_id, price|
|
16
24
|
%li
|
17
25
|
%span.gray= price.id
|
18
|
-
$#{price[:unit_amount].to_f/100}/#{(price[:recurring]||{})[:interval]||'onetime'}
|
19
|
-
|
20
|
-
|
26
|
+
- price_str = "$#{ price[:unit_amount].to_f/100 }/#{ (price[:recurring]||{})[:interval]||'onetime' }"
|
27
|
+
- if @wco_prices_hash[price.id]
|
28
|
+
= link_to price_str, price_path( @wco_prices_hash[price.id] )
|
29
|
+
- else
|
30
|
+
= price_str
|
21
31
|
%hr
|
22
32
|
|
23
|
-
%h5
|
24
|
-
|
33
|
+
%h5.collapse-expand#wcoProducts
|
34
|
+
Wco::Products (#{@wco_products.length}):
|
35
|
+
= render 'index_table', products: @wco_products
|
36
|
+
-# = render 'index_list', products: @wco_products
|
25
37
|
|
26
|
-
%hr
|
27
|
-
%h5 Wco::Product's (#{@products.length})
|
28
|
-
%ul
|
29
|
-
- @products.each do |product|
|
30
|
-
%li
|
31
|
-
= link_to '[~]', edit_product_path( product )
|
32
|
-
#{product.name} // $#{product.price_cents.to_f/100}/#{product.interval.presence || 'onetime'}
|
33
|
-
[ #{product.product_id}, #{product.price_id} ]
|
@@ -1,7 +1,6 @@
|
|
1
1
|
|
2
2
|
.serverhosts--index
|
3
3
|
%h5 Serverhosts (#{serverhosts.length})
|
4
|
-
%hr
|
5
4
|
|
6
5
|
%ul.items
|
7
6
|
- serverhosts.each do |i|
|
@@ -18,4 +17,4 @@
|
|
18
17
|
%li.nginx_root <b>nginx_root:</b> #{i.nginx_root}
|
19
18
|
%li.appliances
|
20
19
|
= render 'ish_manager/appliances/index', appliances: i.appliances
|
21
|
-
|
20
|
+
%hr
|
@@ -8,9 +8,17 @@
|
|
8
8
|
%label Product (price):
|
9
9
|
= f.select :price_id, options_for_select(@price_ids_list, selected: subscription.price_id), {}, class: :select2
|
10
10
|
|
11
|
+
.input-group
|
12
|
+
%label Quantity:
|
13
|
+
= f.number_field :quantity
|
14
|
+
|
11
15
|
.input-group
|
12
16
|
%label Customer/Leadset
|
13
|
-
= f.select :customer_id, options_for_select(@customer_ids_list, selected: subscription.customer_id), {}, class: :select2
|
17
|
+
= f.select :customer_id, options_for_select(@customer_ids_list, selected: params[:customer_id] || subscription.customer_id), {}, class: :select2
|
18
|
+
|
19
|
+
.input-group
|
20
|
+
%label Create a stripe subscription?
|
21
|
+
= check_box_tag :is_stripe
|
14
22
|
|
15
23
|
.actions
|
16
|
-
= f.submit 'Submit'
|
24
|
+
= f.submit 'Submit', data: { confirm: 'Are you sure?' }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
.container.subscriptions-index.padded
|
3
|
+
%p.collapse-expand#rowStripe Stripe
|
3
4
|
.row
|
4
|
-
|
5
5
|
.col-md-6
|
6
6
|
%h5 Stripe Customers
|
7
7
|
%ul
|
@@ -16,11 +16,10 @@
|
|
16
16
|
- @stripe_subscriptions.each do |sub|
|
17
17
|
- if sub.customer == customer.id
|
18
18
|
%li= sub.items.data[0].plan.product
|
19
|
-
|
20
19
|
.col-md-6
|
21
20
|
%h5
|
22
21
|
Stripe Subscriptions
|
23
|
-
= link_to '[+]',
|
22
|
+
= link_to '[+]', new_stripe_subscription_path
|
24
23
|
%ul
|
25
24
|
- @stripe_subscriptions.each do |sub|
|
26
25
|
%li
|
@@ -33,4 +32,17 @@
|
|
33
32
|
%li leadsets: #{ @customers[sub[:customer]][:leadsets]&.map { |i| "#{i[:id]} - #{i[:email]}" } }
|
34
33
|
- if @customers[sub[:customer]] && @customers[sub[:customer]][:profiles]
|
35
34
|
%li profiles: #{ @customers[sub[:customer]][:profiles]&.map { |i| "#{i[:id]} - #{i[:email]}" } }
|
35
|
+
%hr
|
36
|
+
|
37
|
+
%p.collapse-expand#rowWco WasyaCo
|
38
|
+
.row
|
39
|
+
.col-md-6
|
40
|
+
Customers (leadsets)
|
41
|
+
.col-md-6
|
42
|
+
%h5
|
43
|
+
Subscriptions
|
44
|
+
= link_to '[+]', new_wco_subscription_path
|
45
|
+
%ul
|
46
|
+
- @wco_subscriptions.each do |item|
|
47
|
+
%li= item.inspect
|
36
48
|
|
data/config/routes.rb
CHANGED
@@ -25,6 +25,7 @@ IshManager::Engine.routes.draw do
|
|
25
25
|
|
26
26
|
get 'image_assets', to: 'image_assets#index', as: :image_assets
|
27
27
|
|
28
|
+
post 'invoices/create-monthly-for/:leadset_id', to: 'invoices#create_monthly_pdf', as: :create_monthly_invoice_for_leadset
|
28
29
|
post 'invoices/create-pdf', to: 'invoices#create_pdf', as: :create_invoice_pdf
|
29
30
|
post 'invoices/create-stripe', to: 'invoices#create_stripe', as: :create_invoice_stripe
|
30
31
|
get 'invoices/new_pdf', to: 'invoices#new_pdf', as: :new_invoice_pdf
|
@@ -122,12 +123,16 @@ IshManager::Engine.routes.draw do
|
|
122
123
|
|
123
124
|
resources :photos
|
124
125
|
resources :payments
|
126
|
+
resources :prices
|
125
127
|
resources :products
|
126
128
|
|
127
129
|
resources :reports
|
128
130
|
|
129
131
|
resources :serverhosts
|
130
132
|
resources :scheduled_email_actions
|
133
|
+
|
134
|
+
get 'subscriptions/new_stripe', to: 'subscriptions#new_stripe', as: :new_stripe_subscription
|
135
|
+
get 'subscriptions/new_wco', to: 'subscriptions#new_wco', as: :new_wco_subscription
|
131
136
|
resources :subscriptions
|
132
137
|
|
133
138
|
resources :user_profiles do
|
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.463
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -234,6 +234,20 @@ dependencies:
|
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: 2.4.0
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: prawn-table
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: 0.2.1
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - "~>"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: 0.2.1
|
237
251
|
description: Description of IshManager.
|
238
252
|
email:
|
239
253
|
- piousbox@gmail.com
|
@@ -456,7 +470,9 @@ files:
|
|
456
470
|
- app/assets/stylesheets/ish_manager/office.scss
|
457
471
|
- app/assets/stylesheets/ish_manager/pagination.scss
|
458
472
|
- app/assets/stylesheets/ish_manager/photos.scss
|
473
|
+
- app/assets/stylesheets/ish_manager/products.scss
|
459
474
|
- app/assets/stylesheets/ish_manager/scheduled_email_actions.scss
|
475
|
+
- app/assets/stylesheets/ish_manager/subscriptions.scss
|
460
476
|
- app/assets/stylesheets/ish_manager/tags.scss
|
461
477
|
- app/assets/stylesheets/ish_manager/trash/pagination.scss
|
462
478
|
- app/assets/stylesheets/ish_manager/user_profiles.scss
|
@@ -495,6 +511,7 @@ files:
|
|
495
511
|
- app/controllers/ish_manager/office_actions_controller.rb
|
496
512
|
- app/controllers/ish_manager/payments_controller.rb
|
497
513
|
- app/controllers/ish_manager/photos_controller.rb
|
514
|
+
- app/controllers/ish_manager/prices_controller.rb
|
498
515
|
- app/controllers/ish_manager/products_controller.rb
|
499
516
|
- app/controllers/ish_manager/reports_controller.rb
|
500
517
|
- app/controllers/ish_manager/scheduled_email_actions_controller.rb
|
@@ -665,6 +682,8 @@ files:
|
|
665
682
|
- app/views/ish_manager/galleries/show.haml
|
666
683
|
- app/views/ish_manager/image_assets/index.haml
|
667
684
|
- app/views/ish_manager/invoices/_form.haml-trash
|
685
|
+
- app/views/ish_manager/invoices/_index_list.haml
|
686
|
+
- app/views/ish_manager/invoices/_index_table.haml
|
668
687
|
- app/views/ish_manager/invoices/index.haml
|
669
688
|
- app/views/ish_manager/invoices/new_pdf.haml
|
670
689
|
- app/views/ish_manager/invoices/new_stripe.haml
|
@@ -758,6 +777,8 @@ files:
|
|
758
777
|
- app/views/ish_manager/photos/show.haml
|
759
778
|
- app/views/ish_manager/photos/without_gallery.haml
|
760
779
|
- app/views/ish_manager/products/_form.haml
|
780
|
+
- app/views/ish_manager/products/_index_list.haml
|
781
|
+
- app/views/ish_manager/products/_index_table.haml
|
761
782
|
- app/views/ish_manager/products/edit.haml
|
762
783
|
- app/views/ish_manager/products/index.haml
|
763
784
|
- app/views/ish_manager/products/show.haml
|
@@ -782,6 +803,8 @@ files:
|
|
782
803
|
- app/views/ish_manager/subscriptions/_form.haml
|
783
804
|
- app/views/ish_manager/subscriptions/index.haml
|
784
805
|
- app/views/ish_manager/subscriptions/new.haml
|
806
|
+
- app/views/ish_manager/subscriptions/new_stripe.haml
|
807
|
+
- app/views/ish_manager/subscriptions/new_wco.haml
|
785
808
|
- app/views/ish_manager/subscriptions/show.haml
|
786
809
|
- app/views/ish_manager/trash/email_campaigns-trash/_form.haml
|
787
810
|
- app/views/ish_manager/trash/email_campaigns-trash/edit.haml
|