ish_manager 0.1.8.413 → 0.1.8.415

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/ish_manager/application.scss +1 -1
  3. data/app/assets/stylesheets/ish_manager/email.scss +11 -0
  4. data/app/controllers/ish_manager/application_controller.rb +1 -0
  5. data/app/controllers/ish_manager/email_actions_controller.rb +1 -1
  6. data/app/controllers/ish_manager/email_campaigns_controller.rb +1 -12
  7. data/app/controllers/ish_manager/email_templates_controller.rb +19 -1
  8. data/app/controllers/ish_manager/office_actions_controller.rb +85 -0
  9. data/app/mailers/ish_manager/office_mailer.rb +8 -0
  10. data/app/views/ish_manager/application/_main_header_admin.haml +10 -7
  11. data/app/views/ish_manager/email_actions/_form.haml +3 -3
  12. data/app/views/ish_manager/email_actions/index.haml +9 -9
  13. data/app/views/ish_manager/email_campaigns/_form.haml +1 -1
  14. data/app/views/ish_manager/email_campaigns/index.haml +5 -2
  15. data/app/views/ish_manager/email_templates/_form.haml +2 -2
  16. data/app/views/ish_manager/email_templates/_marketing_react_2.html.erb +749 -0
  17. data/app/views/ish_manager/email_templates/show.haml +3 -3
  18. data/app/views/ish_manager/office_actions/_form.haml +49 -0
  19. data/app/views/ish_manager/office_actions/edit.haml +7 -0
  20. data/app/views/ish_manager/office_actions/index.haml +38 -0
  21. data/app/views/ish_manager/office_actions/new.haml +9 -0
  22. data/app/views/ish_manager/office_actions/show.haml +11 -0
  23. data/app/views/ish_manager/scheduled_email_actions/index.haml +5 -6
  24. data/config/routes.rb +2 -0
  25. data/lib/tasks/office_tasks.rake +30 -1
  26. metadata +8 -1
@@ -6,8 +6,8 @@
6
6
  %h2.title
7
7
  = @email_template.slug
8
8
  = link_to '[~]', edit_email_template_path( @email_template )
9
- = link_to '[src ^]', '#'
10
- = link_to '[preview ^]', '#'
11
- = link_to '[use]', '#'
9
+ = link_to 'src', email_template_iframe_path(@email_template.slug), target: :_blank
10
+ -# = link_to '[preview ^]', '#'
11
+ -# = link_to '[use]', '#'
12
12
 
13
13
  %iframe{ src: email_template_iframe_path(@email_template.slug), width: '100%', height: '100%' }
@@ -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.415
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
@@ -417,6 +418,7 @@ files:
417
418
  - app/views/ish_manager/email_templates/_m20221201react.html.erb
418
419
  - app/views/ish_manager/email_templates/_m20221222merryxmas.html.erb
419
420
  - app/views/ish_manager/email_templates/_marketing_react_1.html
421
+ - app/views/ish_manager/email_templates/_marketing_react_2.html.erb
420
422
  - app/views/ish_manager/email_templates/_marketing_ror_1.html
421
423
  - app/views/ish_manager/email_templates/_marketing_ror_2.html.erb
422
424
  - app/views/ish_manager/email_templates/_marketing_wordpress_1.html
@@ -520,6 +522,11 @@ files:
520
522
  - app/views/ish_manager/newsitems/edit.haml
521
523
  - app/views/ish_manager/newsitems/index.haml
522
524
  - app/views/ish_manager/newsitems/new.haml
525
+ - app/views/ish_manager/office_actions/_form.haml
526
+ - app/views/ish_manager/office_actions/edit.haml
527
+ - app/views/ish_manager/office_actions/index.haml
528
+ - app/views/ish_manager/office_actions/new.haml
529
+ - app/views/ish_manager/office_actions/show.haml
523
530
  - app/views/ish_manager/office_mailer/morning_reminder.haml
524
531
  - app/views/ish_manager/office_mailer/render
525
532
  - app/views/ish_manager/office_mailer/test_email.html.haml