ish_manager 0.1.8.458 → 0.1.8.460

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/ish_manager/appliances.scss +27 -0
  3. data/app/assets/stylesheets/ish_manager/application.scss +2 -1
  4. data/app/assets/stylesheets/ish_manager/leadsets.scss +14 -0
  5. data/app/controllers/ish_manager/appliance_tmpls_controller.rb +36 -0
  6. data/app/controllers/ish_manager/appliances_controller.rb +55 -0
  7. data/app/controllers/ish_manager/application_controller.rb +1 -0
  8. data/app/controllers/ish_manager/invoices_controller.rb +27 -1
  9. data/app/controllers/ish_manager/iro_option_gets_controller.rb +21 -23
  10. data/app/controllers/ish_manager/serverhosts_controller.rb +60 -0
  11. data/app/views/ish_manager/appliance_tmpls/_form.haml +14 -0
  12. data/app/views/ish_manager/appliance_tmpls/index.haml +14 -0
  13. data/app/views/ish_manager/appliances/_form.haml +15 -0
  14. data/app/views/ish_manager/appliances/_index.haml +21 -0
  15. data/app/views/ish_manager/appliances/edit.haml +5 -0
  16. data/app/views/ish_manager/appliances/index.haml +4 -0
  17. data/app/views/ish_manager/application/_main_header_admin.haml +18 -0
  18. data/app/views/ish_manager/email_templates/_marketing_node_1.html.erb +676 -0
  19. data/app/views/ish_manager/invoices/index.haml +4 -4
  20. data/app/views/ish_manager/invoices/new_pdf.haml +15 -0
  21. data/app/views/ish_manager/invoices/new_stripe.haml +38 -0
  22. data/app/views/ish_manager/iro_watches/index.haml +17 -5
  23. data/app/views/ish_manager/iro_watches/max_pain.haml +2 -0
  24. data/app/views/ish_manager/leads/show.haml +3 -1
  25. data/app/views/ish_manager/leadsets/show.haml +10 -3
  26. data/app/views/ish_manager/serverhosts/_form.haml +29 -0
  27. data/app/views/ish_manager/serverhosts/_index.haml +21 -0
  28. data/app/views/ish_manager/serverhosts/edit.haml +4 -0
  29. data/app/views/ish_manager/serverhosts/index.haml +8 -0
  30. data/app/views/ish_manager/user_profiles/_form.haml +4 -0
  31. data/config/routes.rb +9 -6
  32. metadata +35 -4
  33. data/app/views/ish_manager/invoices/new.haml +0 -7
  34. /data/app/views/ish_manager/invoices/{_form.haml → _form.haml-trash} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42443ac595bb611c6e4dcd495212dea118197ce3d5cd736c4ffc13ff7672915f
4
- data.tar.gz: 20b76203f7e205e0421a856bd832e5ae98e061552c59aeb33b76ba994663c736
3
+ metadata.gz: c0498ed69f95e0d6288430dd6ced049a417cd722797088e1ce0617607f499519
4
+ data.tar.gz: 5872bfac3ad36bc95f39444c0e68c11ca3ad8cc1cac61d8efff39698b5d7db35
5
5
  SHA512:
6
- metadata.gz: 91a07f1df419c2fce93601e0b35f48233f414ffc2a7f18d78019afa9d875a1417e5db42ba24d96be2aea66cc05a9ce472b25b0ba98cbe9d9ca3b6d6f34960bdb
7
- data.tar.gz: 1cf8ed0befe718c28f386243798a4465e90a44abda909794a41842b32abf13d7c2383abee35fa47f5960b62406edef4bc382942da9bdeb3601d95064cf3878a4
6
+ metadata.gz: e609d728478fee75c7e3bb4f79f4be0c45164a5cde5388d6b493baeb7a491ba7af295221a40d091294e9f7463cfaf5647e83ba44323e1b8ea588571e29c70f2c
7
+ data.tar.gz: effb1d3a11fdf9b3e7dd93595433e2fea6cdd0fde18f17240fdfd3bddbb8ae3e35b6b3fef368ea18bf8c164e63de972c9525f92d6ffe7f8899a489af5e10b1e6
@@ -0,0 +1,27 @@
1
+
2
+ .appliances-index {
3
+ .items {
4
+
5
+ display: flex;
6
+ flex-wrap: wrap;
7
+
8
+ margin: 0;
9
+ padding: 0;
10
+
11
+ > * {
12
+ margin-right: 10px;
13
+ margin-bottom: 10px;
14
+
15
+ width: 300px;
16
+ max-width: 300px;
17
+
18
+ display: inline-block;
19
+ border: 1px solid blue;
20
+ border-radius: 5px;
21
+ background: #ccf;
22
+
23
+ }
24
+ }
25
+ }
26
+
27
+
@@ -5,16 +5,17 @@
5
5
  * require ish_manager/vendor/summernote-bs4.min
6
6
  *
7
7
  *= require_self
8
+ *= require ish_manager/appliances
8
9
  *= require ish_manager/email_contexts
9
10
  *= require ish_manager/email_conversations
10
11
  *= require ish_manager/email_messages
11
12
  *= require ish_manager/email_templates
12
13
  *= require ish_manager/email
13
- *
14
14
  *= require ish_manager/galleries
15
15
  *= require ish_manager/iro
16
16
  *= require ish_manager/iro1
17
17
  *= require ish_manager/leads_leadsets
18
+ *= require ish_manager/leadsets
18
19
  *= require ish_manager/maps
19
20
  *= require ish_manager/markers
20
21
  *= require ish_manager/office
@@ -0,0 +1,14 @@
1
+
2
+ .leadsets-show {
3
+ .serverhosts--index {
4
+ li.leadset_id {
5
+ display: none;
6
+ }
7
+
8
+ .appliances--index {
9
+ li.serverhost {
10
+ display: none;
11
+ }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,36 @@
1
+
2
+ class ::IshManager::ApplianceTmplsController < IshManager::ApplicationController
3
+
4
+ before_action :set_lists
5
+
6
+ def create
7
+ @appliance_tmpl = Wco::ApplianceTmpl.new params[:appliance].permit!
8
+ authorize! :create, @appliance_tmpl
9
+
10
+ flag = @appliance_tmpl.save
11
+ if flag
12
+ flash[:notice] = 'Success.'
13
+ redirect_to action: :index
14
+ else
15
+ flash[:alert] = "Cannot create appliance tmplate: #{@appliance_tmpl.errors.full_messages.join(', ')}."
16
+ render action: :index
17
+ end
18
+ end
19
+
20
+ def index
21
+ authorize! :index, Wco::ApplianceTmpl
22
+ @appliance_tmpls = Wco::ApplianceTmpl.all
23
+ end
24
+
25
+ ##
26
+ ## private
27
+ ##
28
+ private
29
+
30
+ def set_lists
31
+ super
32
+ @new_appliance_tmpl = Wco::ApplianceTmpl.new
33
+ end
34
+
35
+ end
36
+
@@ -0,0 +1,55 @@
1
+
2
+ class ::IshManager::AppliancesController < IshManager::ApplicationController
3
+
4
+ before_action :set_lists, only: %i| edit update |
5
+
6
+ # def create
7
+ # @appliance_tmpl = Wco::ApplianceTmpl.new params[:appliance].permit!
8
+ # authorize! :create, @appliance_tmpl
9
+ # flag = @appliance_tmpl.save
10
+ # if flag
11
+ # flash[:notice] = 'Success.'
12
+ # redirect_to action: :index
13
+ # else
14
+ # flash[:alert] = "Cannot create appliance tmplate: #{@appliance_tmpl.errors.full_messages.join(', ')}."
15
+ # render action: :index
16
+ # end
17
+ # end
18
+
19
+
20
+ def edit
21
+ authorize! :edit, @appliance
22
+ end
23
+
24
+ def index
25
+ authorize! :index, Wco::Appliance
26
+ @appliances = Wco::Appliance.all
27
+ end
28
+
29
+ def update
30
+ authorize! :edit, @appliance
31
+ flag = @appliance.update_attributes( params[:appliance].permit! )
32
+ if flag
33
+ flash[:notice] = "Successfully updated appliance #{@appliance.name}."
34
+ redirect_to controller: :leadsets, action: :show, id: @appliance.leadset_id
35
+ # redirect_to request.referrer ? request.referrer : { action: :edit, id: @appliance.id }
36
+ else
37
+ flash[:alert] = "Cannot update appliance: #{@appliance.errors.full_messages.join(', ')}."
38
+ render action: :edit, id: @appliance.id
39
+ end
40
+ end
41
+
42
+
43
+ ##
44
+ ## private
45
+ ##
46
+ private
47
+
48
+ def set_lists
49
+ super
50
+ @appliance = Wco::Appliance.find params[:id]
51
+ @these_serverhosts_list = @appliance.leadset.serverhosts.map { |i| [ i.name, i.id] }
52
+ end
53
+
54
+ end
55
+
@@ -92,6 +92,7 @@ class IshManager::ApplicationController < ActionController::Base
92
92
  @locations_list = ::Gameui::Map.list
93
93
  @maps_list = ::Gameui::Map.list # @TODO: missing nonpublic!
94
94
  @office_actions_list = [[nil,nil]] + Office::Action.all.map { |a| [ a.slug, a.id ] }
95
+ @option_watches_list = [nil] + Iro::OptionWatch.where({ kind: Iro::OptionWatch::KIND_GET_CHAINS }).order_by({ ticket: :desc }).map( &:ticker )
95
96
  @profiles_list = Ish::UserProfile.list
96
97
  @reports_list = Report.all.list
97
98
  @tags_list = [[nil,nil]] + WpTag.all.map { |t| [ t.name, t.id ] }
@@ -3,6 +3,26 @@ class ::IshManager::InvoicesController < IshManager::ApplicationController
3
3
 
4
4
  before_action :set_lists
5
5
 
6
+ def create_pdf
7
+ @invoice = Ish::Invoice.new
8
+ authorize! :new, @invoice
9
+
10
+ pdf = Prawn::Document.new
11
+ pdf.text "Job Summary."
12
+
13
+ filename = "a-summary.pdf"
14
+ path = Rails.root.join 'tmp', filename
15
+ pdf.render_file path
16
+ data = File.read path
17
+ File.delete(path) if File.exist?(path)
18
+
19
+ send_data( data, { :filename => filename,
20
+ :disposition => params[:disposition] ? params[:disposition] : :attachment,
21
+ :type => 'application/pdf'
22
+ })
23
+ end
24
+
25
+ ## #create_stripe()
6
26
  def create
7
27
  @invoice = Ish::Invoice.new params[:invoice].permit!
8
28
  authorize! :create, @invoice
@@ -43,7 +63,13 @@ class ::IshManager::InvoicesController < IshManager::ApplicationController
43
63
  @invoices = @invoices.includes( :payments )
44
64
  end
45
65
 
46
- def new
66
+ def new_pdf
67
+ authorize! :new, @invoice
68
+ @leadset = Leadset.find params[:leadset_id]
69
+ @products_list = Wco::Product.list
70
+ end
71
+
72
+ def new_stripe
47
73
  authorize! :new, @invoice
48
74
  @leadset = Leadset.find params[:leadset_id]
49
75
  @products_list = Wco::Product.list
@@ -17,34 +17,32 @@ class ::IshManager::IroOptionGetsController < IshManager::ApplicationController
17
17
  end
18
18
 
19
19
  def max_pain
20
- @ticker = params[:ticker]
21
- @date = params[:date].to_time.to_i
22
-
23
- ## 1689364800000
24
- ## Fri, 14 Jul 2023 15:00:00.000000000 CDT -05:00
25
-
26
20
  authorize! :max_pain, Iro::Iro
21
+ @ticker = params[:ticker]
27
22
 
28
23
  @expirationDate = ( params[:date].to_date + 15.hours ).to_time.to_i * 1000 # '1689364800000'
29
24
  # expirationDate = '1689969600000'
30
25
  # expirationDate = '1690574400000'
31
26
  @all_items = {}
32
27
 
33
- calls_sql = "select distinct symbol, strikePrice, putCall, openInterest
28
+ calls_sql = " select distinct putCall, symbol, strikePrice, openInterest, max(created_at)
34
29
  from iro_option_price_items
35
30
  where expirationDate = #{@expirationDate} and putCall = 'CALL' and ticker = '#{@ticker}'
36
- group by symbol, strikePrice, putCall
37
- order by putCall, strikePrice, created_at desc;"
31
+ group by putCall, symbol, strikePrice, openInterest
32
+ order by strikePrice, max(created_at) desc; "
38
33
  @calls_items = []
39
34
  @calls_array = ActiveRecord::Base.connection.execute(calls_sql)
40
35
  calls_subtotal = 0
41
36
  @calls_array.each do |_item|
37
+ # puts! _item, 'item'
42
38
  item = {
43
- symbol: _item[0],
44
- strikePrice: _item[1],
45
- putCall: _item[2],
46
- oi: _item[3],
39
+ putCall: _item[0],
40
+ symbol: _item[1],
41
+ strikePrice: _item[2],
42
+ oi: _item[3],
43
+ created_at: _item[4],
47
44
  }
45
+ # puts! item, 'item'
48
46
  item[:subtotal] = item[:strikePrice] * 100 * item[:oi]
49
47
  calls_subtotal = calls_subtotal + item[:subtotal]
50
48
  item[:total] = calls_subtotal
@@ -60,27 +58,27 @@ class ::IshManager::IroOptionGetsController < IshManager::ApplicationController
60
58
  @all_items[item[:strikePrice]][:subtotal] = @all_items[item[:strikePrice]][:subtotal] + calls_subtotal
61
59
  end
62
60
 
63
- puts_sql = "select distinct symbol, strikePrice, putCall, openInterest
64
- from iro_option_price_items
65
- where expirationDate = #{@expirationDate} and putCall = 'PUT' and ticker = '#{@ticker}'
66
- group by symbol, strikePrice, putCall
67
- order by putCall, strikePrice, created_at desc;"
61
+ puts_sql = "select putCall, symbol, strikePrice, openInterest, created_at
62
+ from iro_option_price_items
63
+ where expirationDate = #{@expirationDate} and putCall = 'PUT' and ticker = '#{@ticker}'
64
+ group by putCall, symbol, strikePrice, openInterest, created_at
65
+ order by putCall, strikePrice, created_at desc;"
68
66
  @puts_items = []
69
67
  @puts_array = ActiveRecord::Base.connection.execute(puts_sql)
70
68
  puts_subtotal = 0
71
69
  @puts_array.each do |_item|
72
70
  item = {
73
- symbol: _item[0],
74
- strikePrice: _item[1],
75
- putCall: _item[2],
76
- oi: _item[3],
71
+ putCall: _item[0],
72
+ symbol: _item[1],
73
+ strikePrice: _item[2],
74
+ oi: _item[3],
75
+ created_at: _item[4],
77
76
  }
78
77
  item[:subtotal] = item[:strikePrice] * 100 * item[:oi]
79
78
  puts_subtotal = puts_subtotal + item[:subtotal]
80
79
  item[:total] = puts_subtotal
81
80
  puts! item, 'item'
82
81
  @puts_items.push( item )
83
-
84
82
  @all_items[item[:strikePrice]] ||= {
85
83
  subtotal: 0,
86
84
  strikePrice: item[:strikePrice],
@@ -0,0 +1,60 @@
1
+
2
+ class ::IshManager::ServerhostsController < IshManager::ApplicationController
3
+
4
+ # before_action :set_lists
5
+
6
+ def create
7
+ @serverhost = Wco::Serverhost.new params[:serverhost].permit!
8
+ authorize! :create, @serverhost
9
+
10
+ flag = @serverhost.save
11
+ if flag
12
+ flash[:notice] = 'Success.'
13
+ redirect_to action: :index
14
+ else
15
+ flash[:alert] = "Cannot create serverhost: #{@serverhost.errors.full_messages.join(', ')}."
16
+ render action: :index
17
+ end
18
+ end
19
+
20
+ def edit
21
+ @serverhost = Wco::Serverhost.find params[:id]
22
+ authorize! :edit, @serverhost
23
+ end
24
+
25
+ def index
26
+ authorize! :index, Wco::Serverhost
27
+ @serverhosts = Wco::Serverhost.all
28
+ @new_serverhost = Wco::Serverhost.new
29
+ end
30
+
31
+ def update
32
+ @serverhost = Wco::Serverhost.find params[:id]
33
+ authorize! :update, @serverhost
34
+ flag = @serverhost.update_attributes params[:serverhost].permit!
35
+ if flag
36
+ flash[:notice] = "Success."
37
+ redirect_to action: :index
38
+ else
39
+ flash[:alert] = "Cannot update serverhost: #{@serverhost.errors.full_messages.join(', ')}."
40
+ render action: :edit
41
+ end
42
+ end
43
+
44
+
45
+
46
+ ##
47
+ ## private
48
+ ##
49
+ private
50
+
51
+ # def set_lists
52
+ # super
53
+ # @new_serverhost = Wco::Serverhost.new
54
+ # puts! @new_serverhost.class, 'ze'
55
+ # puts! @new_serverhost, '@new_serverhost'
56
+ # @new_serverhost.name = 'some name'
57
+ # end
58
+
59
+ end
60
+
@@ -0,0 +1,14 @@
1
+
2
+ - url = appliance_tmpl.new_record? ? appliance_tmpls_path : appliance_tmpls_path( appliance_tmpl )
3
+
4
+ .appliance-tmpls--form
5
+ = form_for appliance_tmpl, as: :appliance, url: url do |f|
6
+ .input-field
7
+ = f.label :kind
8
+ = f.text_field :kind
9
+ .input-field
10
+ = f.label :image
11
+ = f.text_field :image
12
+
13
+ .actions
14
+ = f.submit 'Submit'
@@ -0,0 +1,14 @@
1
+
2
+ .appliance-tmpls-index.max-width
3
+ %h5 Appliance Templates
4
+ %hr
5
+
6
+ %ul
7
+ - @appliance_tmpls.each do |i|
8
+ %li
9
+ %ul
10
+ %li <b>Kind:</b> #{i.kind}
11
+ %li <b>Image:</b> #{i.image}
12
+
13
+ %hr
14
+ = render 'form', :appliance_tmpl => @new_appliance_tmpl
@@ -0,0 +1,15 @@
1
+
2
+ - url = appliance.new_record? ? appliances_path : appliance_path( appliance )
3
+
4
+ .appliances--form
5
+ = form_for appliance, url: url, as: :appliance do |f|
6
+ .field
7
+ = f.label :name
8
+ = f.text_field :name
9
+
10
+ .field
11
+ = f.label :serverhost
12
+ = f.select :serverhost, options_for_select( @these_serverhosts_list, selected: appliance.serverhost ), {}, class: :select2
13
+
14
+ .actions
15
+ = f.submit 'Submit'
@@ -0,0 +1,21 @@
1
+
2
+ .appliances--index
3
+ %h5 Appliances (#{appliances.length})
4
+ - if appliances.present?
5
+ %hr
6
+ %ul.items
7
+ - appliances.each do |i|
8
+ %li
9
+ %ul
10
+ %li.name <b>name:</b> #{i.name} #{link_to '[~]', edit_appliance_path(i)}
11
+ %li.kind <b>kind:</b> #{i.kind}
12
+ %li.leadset_id <b>leadset_id:</b> #{i.leadset_id}
13
+
14
+ %li.serverhost
15
+ <b>serverhost:</b>
16
+ - if i.serverhost
17
+ #{ link_to i.serverhost.name, serverhost_path(i.serverhost) }
18
+ - else
19
+ <no-serverhost>
20
+ %li.host <b>host:</b> #{i.host}
21
+ -# %li.inspect= i.inspect
@@ -0,0 +1,5 @@
1
+
2
+ .appliances-edit.max-width
3
+
4
+ %h5 Edit appliance
5
+ = render 'form', appliance: @appliance
@@ -0,0 +1,4 @@
1
+
2
+ .appliances-index.max-width
3
+ = render 'index', appliances: @appliances
4
+
@@ -108,10 +108,28 @@
108
108
 
109
109
  .c
110
110
 
111
+ %i.fa.fa-compress.collapse-expand#collapseHeaderWco
112
+ Wasya Co Rb
113
+ .a
114
+ %ul
115
+ %li
116
+ = link_to 'ApplianceTmpl\'s', appliance_tmpls_path
117
+ %li
118
+ = link_to 'Appliance\'s', appliances_path
119
+ %li
120
+ = link_to 'Serverhost\'s', serverhosts_path
121
+ .c
122
+
123
+
124
+
111
125
  %i.fa.fa-compress.collapse-expand#collapseHeaderIro
112
126
  Iro Wor
113
127
  .a
114
128
  %ul
129
+ -# %li
130
+ -# = form_tag iro_watches_path, method: :get do
131
+ -# -# = select_get :ticker, options_for_select( @option_watches_list )
132
+ -# = link_to '[+]', new_iro_watch_path
115
133
 
116
134
  %li
117
135
  = link_to 'Watches', iro_watches_path