ish_manager 0.1.8.413 → 0.1.8.414

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: ac60f7cd88786021285d1497b25f91540c45f639d1912ef070eb3329f2e1f15e
4
- data.tar.gz: 21a8968131ae5f0075c774f3ad27cfdc0fe9d2927c0150f8c3d28f3366e03ef1
3
+ metadata.gz: 5ad6332705588cd6755bfb1bc2523291c5fa58240f548f7b7d0596123b280918
4
+ data.tar.gz: 4fdb537240ff5f95220dc2337f8e2dd49bf3d2cdc05b8ffee7eada2e660d53d6
5
5
  SHA512:
6
- metadata.gz: 7b4ea92b7f2208a3c80a2a4d478e29582ea2fd5aa37b99afdae807b6b8003f6fc21e0afef66d4ffb72195e25e4993e5ad2a7311b5be1ac2f6e5fa540235aadb6
7
- data.tar.gz: 5195f3b41ac7dd1568878ef9ec5de62dbfde500ca3844ffe75e0f211b3f5433c724d1a9ead3578fd7508e4e3f71037513d9bea3945085539dd6d246b7a4ed0ad
6
+ metadata.gz: feadba78e9e42914933a39332d4f8bdb377c1b75e1d5b61e72511c03f99617b4f8e9b0c396c0e181edf5e3ed4e4a8c72d95bb7034e206a3d8714cb8677ea5102
7
+ data.tar.gz: 2b6cbd12bfbdd15717f0400a4ed97e58960ae10668a376a95b95a598f39a64a532296e84a4ce44db4719f3627e2296e0771a9a55985de35165da12ecd0c9b33f
@@ -359,7 +359,7 @@ textarea.large {
359
359
  flex-wrap: wrap;
360
360
 
361
361
  li {
362
- margin: 0 0 10px 0;
362
+ margin: 0 10px 10px 0;
363
363
  display: inline-block;
364
364
  min-width: 220px;
365
365
 
@@ -53,3 +53,14 @@
53
53
  }
54
54
  }
55
55
 
56
+ .scheduled-emails-index {
57
+ .items {
58
+ display: flex;
59
+ flex-wrap: wrap;
60
+
61
+ .Card {
62
+ margin: 0 10px 10px 0;
63
+ padding: 10px;
64
+ }
65
+ }
66
+ }
@@ -81,6 +81,7 @@ class IshManager::ApplicationController < ActionController::Base
81
81
  @leadsets_list = Leadset.list
82
82
  @locations_list = ::Gameui::Map.list
83
83
  @maps_list = ::Gameui::Map.list # @TODO: missing nonpublic!
84
+ @office_actions_list = [[nil,nil]] + Office::Action.all.map { |a| [ a.slug, a.id ] }
84
85
  @profiles_list = Ish::UserProfile.list
85
86
  @reports_list = Report.all.list
86
87
  @user_profiles_list = Ish::UserProfile.list
@@ -42,7 +42,7 @@ class ::IshManager::EmailActionsController < IshManager::ApplicationController
42
42
  params[:email_action][:ties_attributes].delete( k )
43
43
  end
44
44
  if v[:to_delete] == "1"
45
- Actie.find( v[:id] ).delete
45
+ EActie.find( v[:id] ).delete
46
46
  params[:email_action][:ties_attributes].delete( k )
47
47
  end
48
48
  end
@@ -27,18 +27,7 @@ class ::IshManager::EmailCampaignsController < IshManager::ApplicationController
27
27
  def do_send
28
28
  @campaign = Ish::EmailCampaign.find params[:id]
29
29
  authorize! :send, @campaign
30
- @campaign.leads.each do |lead|
31
- tmpl = @campaign.email_template
32
-
33
- ctx = Ctx.create!({
34
- email_template: tmpl,
35
- send_at: Time.now,
36
- lead_id: lead.id,
37
- from_email: tmpl.from_email,
38
- subject: tmpl.subject,
39
- })
40
- end
41
-
30
+ @campaign.do_send
42
31
  end
43
32
 
44
33
  def show
@@ -0,0 +1,85 @@
1
+
2
+ class ::IshManager::OfficeActionsController < IshManager::ApplicationController
3
+
4
+ before_action :set_lists
5
+
6
+ ## Alphabetized : )
7
+
8
+ def create
9
+ @new_office_action = Office::Action.new params[:office_action].permit!
10
+ authorize! :create, @new_office_action
11
+ flag = @new_office_action.save
12
+ if flag
13
+ flash[:notice] = "Created OAction."
14
+ redirect_to action: 'index'
15
+ else
16
+ flash[:alert] = "Cannot create OAction: #{@new_office_action.errors.full_messages.join(', ')}."
17
+ render action: 'new'
18
+ end
19
+ end
20
+
21
+ def edit
22
+ @act = @office_action = Office::Action.find( params[:id] )
23
+ @act.ties.push Office::ActionTie.new( next_office_action_id: nil )
24
+ authorize! :edit, @act
25
+ end
26
+
27
+ def index
28
+ @office_actions = Office::Action.all
29
+
30
+ authorize! :index, @new_office_action
31
+ end
32
+
33
+ def new
34
+ authorize! :new, @new_office_action
35
+ end
36
+
37
+ def show
38
+ @act = @office_action = Office::Action.find( params[:id] )
39
+ authorize! :show, @act
40
+ end
41
+
42
+ ## def create; update; end
43
+ ## def upsert; update; end
44
+ def update
45
+ if params[:id]
46
+ @act = @office_action = Office::Action.find( params[:id] )
47
+ else
48
+ @act = @office_action = Office::Action.new
49
+ end
50
+ authorize! :upsert, @act
51
+
52
+ if params[:office_action][:ties_attributes]
53
+ params[:office_action][:ties_attributes].each do |k, v|
54
+ if !v[:next_office_action_id].present?
55
+ params[:office_action][:ties_attributes].delete( k )
56
+ end
57
+ if v[:to_delete] == "1"
58
+ EActie.find( v[:id] ).delete
59
+ params[:office_action][:ties_attributes].delete( k )
60
+ end
61
+ end
62
+ end
63
+
64
+ flag = @act.update_attributes( params[:office_action].permit! )
65
+ if flag
66
+ flash[:notice] = 'Success'
67
+ redirect_to action: 'index'
68
+ else
69
+ flash[:alert] = "No luck: #{@act.errors.full_messages.join(', ')}. #{@act.ties.map { |t| t.errors.full_messages.join(', ') }.join(' | ') }"
70
+ render action: 'edit'
71
+ end
72
+
73
+ end
74
+
75
+ ##
76
+ ## private
77
+ ##
78
+ private
79
+
80
+ def set_lists
81
+ @new_office_action = Office::Action.new
82
+ super
83
+ end
84
+
85
+ end
@@ -56,24 +56,24 @@
56
56
  = link_to "#{WpTag::INBOX} (#{Office::EmailConversation.in_emailtag(WpTag::INBOX).length})", email_conversations_in_path(WpTag::INBOX)
57
57
  = link_to '[+]', new_email_context_path
58
58
  %li
59
- = link_to "Templates (#{Ish::EmailTemplate.all.count})", email_templates_path
59
+ = link_to "Tmpls (#{Ish::EmailTemplate.all.count})", email_templates_path
60
60
  = link_to '[+]', new_email_template_path
61
61
  %li
62
- = link_to "Companies (#{Leadset.kept.length})", leadsets_path
62
+ = link_to "Co's (#{Leadset.kept.length})", leadsets_path
63
63
  = link_to '[+]', new_leadset_path
64
64
 
65
65
 
66
66
  %li
67
- = link_to "Email Actions (#{Office::EmailAction.all.length})", email_actions_path
67
+ = link_to "EActions (#{Office::EmailAction.count})", email_actions_path
68
68
  = link_to '[+]', new_email_action_path
69
69
  %ul
70
70
  %li
71
71
  = link_to "Filters (#{Office::EmailFilter.active.length})", email_filters_path
72
72
  = link_to '[+]', new_email_filter_path
73
73
  %li
74
- = link_to "Contexts (#{Ctx.notsent.length})", notsent_email_contexts_path
74
+ = link_to "Ctxs (#{Ctx.notsent.length})", notsent_email_contexts_path
75
75
  = link_to '[+]', new_email_context_path
76
- = link_to 'summary', email_contexts_summary_path( format: :csv )
76
+ = link_to '[csv]', email_contexts_summary_path( format: :csv )
77
77
 
78
78
  %li
79
79
  = link_to "Leads (#{Lead.kept.length})", leads_path
@@ -81,13 +81,16 @@
81
81
  %li
82
82
  = link_to "Schs (#{Sch.active.length})", scheduled_email_actions_path
83
83
  = link_to '[+]', new_scheduled_email_action_path
84
+
84
85
  %ul
85
86
  %li &nbsp;
86
87
  %li &nbsp;
87
88
  %li
88
- = link_to 'Campaigns', email_campaigns_path
89
+ = link_to "Campaigns (#{Ish::EmailCampaign.count})", email_campaigns_path
89
90
  = link_to '[+]', new_email_campaign_path
90
- %li &nbsp;
91
+ %li
92
+ = link_to "OActions (#{Office::Action.count})", office_actions_path
93
+ = link_to '[+]', new_office_action_path
91
94
 
92
95
  .c
93
96
 
@@ -1,6 +1,6 @@
1
1
 
2
- - act = email_action
3
- - url = email_action.new_record? ? email_actions_path : email_action_path( email_action )
2
+ - eact = email_action
3
+ - url = email_action.new_record? ? email_actions_path : email_action_path( email_action )
4
4
 
5
5
  .email-actions--form
6
6
 
@@ -19,7 +19,7 @@
19
19
  -# = f.text_area :descr
20
20
  .field.flex-row
21
21
  %label Template
22
- = f.select :email_template_id, options_for_select( @email_templates_list, selected: act.email_template_id ), {}, class: 'select2'
22
+ = f.select :email_template_id, options_for_select( @email_templates_list, selected: eact.email_template_id ), {}, class: 'select2'
23
23
 
24
24
  .col-md-6
25
25
  .field
@@ -11,22 +11,22 @@
11
11
  %th= check_box_tag 'abba'
12
12
  %th
13
13
  %th slug
14
- %th descr
15
14
  %th next actions
16
- - @email_actions.each do |act|
15
+ - @email_actions.each do |eact|
17
16
  %tr
18
17
  %td= check_box_tag 'abba'
19
- %td= link_to '[~]', edit_email_action_path( act )
20
- %td= link_to act.slug, email_action_path( act )
21
- %td= act.descr
22
- -# %td= act.lead&.email
18
+ %td= link_to '[~]', edit_email_action_path( eact )
19
+ %td
20
+ -# = link_to eact.slug, email_action_path( eact )
21
+ = eact.slug
22
+ .em.small= eact.descr
23
23
  %td
24
24
  %ul
25
- - act.ties.map do |next_a|
25
+ - eact.ties.map do |next_a|
26
26
  %li
27
27
  .a= next_a.next_at_exe
28
28
  .a
29
- - if next_a.next_email_action.slug == act.slug
29
+ - if next_a.next_email_action.slug == eact.slug
30
30
  (same)
31
31
  = next_a.next_email_action.slug
32
- -# %li= link_to next_a.next_email_action.slug, edit_email_action_path( next_a.next_email_action )
32
+
@@ -21,7 +21,7 @@
21
21
 
22
22
  .field
23
23
  = f.label "From"
24
- = f.select :from_email, options_for_select(Ish::EmailContext.from_email_list, selected: campaign.from_email)
24
+ = f.select :from_email, options_for_select(Ish::EmailContext.from_email_list, selected: campaign.from_email), {}, class: 'select2'
25
25
 
26
26
  .actions
27
27
  = f.submit 'Submit'
@@ -5,6 +5,9 @@
5
5
  Email Campaigns (#{@campaigns.length})
6
6
  = link_to '[+]', new_email_campaign_path
7
7
 
8
- - @campaigns.each do |c|
9
- = link_to c.slug, email_campaign_path(c)
8
+ %ul
9
+ - @campaigns.each do |c|
10
+ %li
11
+ = link_to c.slug, email_campaign_path(c)
12
+ = link_to '[~]', edit_email_campaign_path(c)
10
13
 
@@ -0,0 +1,49 @@
1
+
2
+ - oact = office_action
3
+ - url = office_action.new_record? ? office_actions_path : office_action_path( office_action )
4
+
5
+ .office-actions--form
6
+
7
+ = form_for office_action, url: url, as: :office_action, :html => { :multipart => true } do |f|
8
+ .row
9
+ .col-sm-6
10
+ = f.submit :submit
11
+
12
+ .row
13
+ .col-md-6
14
+ .field
15
+ %label Slug
16
+ = f.text_field :slug
17
+
18
+ .flex-row
19
+ %label State
20
+ = f.select :state, options_for_select(::Office::Action::STATES, selected: oact.state )
21
+ .field
22
+ = f.label :perform_at
23
+ = f.text_field :perform_at
24
+
25
+ .field
26
+ %label Action Exe
27
+ = f.text_area :action_exe, class: 'large'
28
+
29
+ .col-md-6
30
+ .field
31
+ %label Next Office Actions
32
+ .eg rand(1..5).business_days.from_now.to_date + rand(8..16).hours + rand(1..59).minutes
33
+ %br
34
+
35
+ = f.fields_for :ties do |next_f|
36
+ .flex-row.field
37
+ = next_f.label :next_at_exe
38
+ = next_f.text_field :next_at_exe, class: 'flex-grow'
39
+ .flex-row.field
40
+ = next_f.label :to_delete
41
+ = next_f.check_box :to_delete
42
+ = next_f.select :next_office_action_id, options_for_select( @office_actions_list, selected: next_f.object.next_office_action_id ), { }, { class: 'select2' }
43
+ %br
44
+
45
+ .row
46
+ .col-sm-6
47
+ = f.submit :submit
48
+
49
+
@@ -0,0 +1,7 @@
1
+
2
+ .office-actions-edit.padded
3
+ .header
4
+ %h2.title Edit Office Action
5
+
6
+ = render 'form', office_action: @act
7
+
@@ -0,0 +1,38 @@
1
+
2
+ .office-actions-index.padded
3
+
4
+ .header
5
+ %h2.title
6
+ Office Actions
7
+ = link_to '[+]', new_office_action_path
8
+
9
+ %table.bordered
10
+ %tr
11
+ %th= check_box_tag 'abba'
12
+ %th
13
+ %th state
14
+ %th slug
15
+ %th perform at
16
+ %th exe
17
+ %th next actions
18
+ - @office_actions.each do |oact|
19
+ %tr
20
+ %td= check_box_tag 'abba'
21
+ %td= link_to '[~]', edit_office_action_path( oact )
22
+ %td= oact.state
23
+ %td
24
+ -# = link_to oact.slug, office_action_path( oact )
25
+ = oact.slug
26
+ .em.small= oact.descr
27
+ %td= oact.perform_at
28
+ %td= oact.action_exe
29
+ %td
30
+ %ul
31
+ - oact.ties.map do |next_a|
32
+ %li
33
+ .a= next_a.next_at_exe
34
+ .a
35
+ - if next_a.next_office_action.slug == oact.slug
36
+ (same)
37
+ = next_a.next_office_action.slug
38
+
@@ -0,0 +1,9 @@
1
+
2
+ -# padded b/c eval(next_time_at) is long
3
+
4
+ .office-actions-new.padded
5
+ .header
6
+ %h2.title
7
+ New Office Action
8
+
9
+ = render 'form', office_action: @new_office_action
@@ -0,0 +1,11 @@
1
+
2
+ .office-actions-show.max-width
3
+ .header
4
+ .title Office Action #{@act.id}
5
+
6
+ %ul
7
+ - @act.ties.map do |next_a|
8
+ %li
9
+ .a <b>Next act:</b> #{"(same)" if next_a.next_office_action.slug == @act.slug} #{next_a.next_office_action.slug}
10
+ .a <b>Next at exe:</b> #{next_a.next_at_exe}
11
+ .a <b>Eval'ed:</b> #{eval( next_a.next_at_exe )}
@@ -1,24 +1,23 @@
1
1
 
2
- .scheduled-emails-index.max-width
2
+ .scheduled-emails-index.padded
3
3
  .header
4
4
  %h2
5
5
  Scheduled Email Actions
6
6
  -# (#{Sch.kept.count})
7
7
  (#{Sch.all.count})
8
8
  = link_to '[+]', new_scheduled_email_action_path
9
- .header
10
- Time now: #{Time.now.strftime('%Y-%m-%d %l:%M%P')}
11
9
 
12
10
  .items
13
11
  - @scheduled_email_actions.each do |sch|
14
- .item
12
+ .item.Card
15
13
  .flex-row
16
14
  .gray= sch.id
17
15
  = link_to '[~]', edit_scheduled_email_action_path(sch)
18
16
 
19
17
  %ul
20
- %li <b>Act:</b> #{link_to sch.email_action.slug, edit_email_action_path(sch.email_action)}
18
+ %li <b>EAct:</b> #{link_to sch.email_action.slug, edit_email_action_path(sch.email_action)}
21
19
  %li <b>Tmpl:</b> #{sch.email_action.email_template.slug}
22
- %li <b>Lead:</b> #{link_to sch.lead.email, lead_path(sch.lead) }
20
+ - if sch.lead_id
21
+ %li <b>Lead:</b> #{link_to sch.lead.email, lead_path(sch.lead) }
23
22
  %li <b>State:</b> #{sch.state}
24
23
  %li <b>Perform at:</b> #{sch.perform_at.in_time_zone}
data/config/routes.rb CHANGED
@@ -108,6 +108,8 @@ IshManager::Engine.routes.draw do
108
108
 
109
109
  resources :newsitems
110
110
 
111
+ resources :office_actions
112
+
111
113
  resources :photos
112
114
  resources :payments
113
115
 
@@ -18,6 +18,34 @@ namespace :office do
18
18
  end
19
19
  end
20
20
 
21
+ desc 'office actions exe, rolling perform'
22
+ task oacts: :environment do
23
+ while true do
24
+
25
+ ## send and roll
26
+ Office::Action.active.where({ :perform_at.lte => Time.now }).each do |oact|
27
+
28
+ oact.update({
29
+ perform_at: nil,
30
+ # state: OAct::STATE_INACTIVE, ## @TODO: remove, they remain active but non-perform.
31
+ })
32
+ eval( oact.action_exe )
33
+ oact.ties.each do |tie|
34
+ next_oact = tie.next_office_action
35
+ next_oact.perform_at = eval(tie.next_at_exe)
36
+ next_oact.state = OAct::STATE_ACTIVE
37
+ next_oact.save!
38
+ end
39
+
40
+ print '+'
41
+ end
42
+
43
+ duration = Rails.env.production? ? 360 : 15 # 6 minutes or 15 seconds
44
+ sleep duration
45
+ print '.'
46
+ end
47
+ end
48
+
21
49
  ## 2023-04-02 _vp_ Continue.
22
50
  desc "send emails"
23
51
  task ctxs: :environment do
@@ -30,7 +58,8 @@ namespace :office do
30
58
  print '^'
31
59
  end
32
60
 
33
- sleep 60 # seconds
61
+ duration = Rails.env.production? ? 120 : 15 # 2 minutes or 15 seconds
62
+ sleep duration
34
63
  print '.'
35
64
  end
36
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.413
4
+ version: 0.1.8.414
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -307,6 +307,7 @@ files:
307
307
  - app/controllers/ish_manager/markers_controller.rb
308
308
  - app/controllers/ish_manager/meetings_controller.rb
309
309
  - app/controllers/ish_manager/newsitems_controller.rb
310
+ - app/controllers/ish_manager/office_actions_controller.rb
310
311
  - app/controllers/ish_manager/payments_controller.rb
311
312
  - app/controllers/ish_manager/photos_controller.rb
312
313
  - app/controllers/ish_manager/reports_controller.rb
@@ -520,6 +521,11 @@ files:
520
521
  - app/views/ish_manager/newsitems/edit.haml
521
522
  - app/views/ish_manager/newsitems/index.haml
522
523
  - app/views/ish_manager/newsitems/new.haml
524
+ - app/views/ish_manager/office_actions/_form.haml
525
+ - app/views/ish_manager/office_actions/edit.haml
526
+ - app/views/ish_manager/office_actions/index.haml
527
+ - app/views/ish_manager/office_actions/new.haml
528
+ - app/views/ish_manager/office_actions/show.haml
523
529
  - app/views/ish_manager/office_mailer/morning_reminder.haml
524
530
  - app/views/ish_manager/office_mailer/render
525
531
  - app/views/ish_manager/office_mailer/test_email.html.haml