effective_products 0.0.2 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/admin/stamps_controller.rb +9 -0
  3. data/app/controllers/effective/ring_wizards_controller.rb +10 -0
  4. data/app/controllers/effective/stamp_wizards_controller.rb +10 -0
  5. data/app/datatables/admin/effective_rings_datatable.rb +4 -5
  6. data/app/datatables/admin/effective_stamps_datatable.rb +43 -0
  7. data/app/datatables/{effective_ring_payments_datatable.rb → effective_ring_wizards_datatable.rb} +5 -5
  8. data/app/datatables/effective_stamp_wizards_datatable.rb +36 -0
  9. data/app/helpers/effective_products_helper.rb +0 -1
  10. data/app/models/concerns/{effective_products_ring_payment.rb → effective_products_ring_wizard.rb} +27 -36
  11. data/app/models/concerns/effective_products_stamp_wizard.rb +139 -0
  12. data/app/models/effective/ring.rb +2 -24
  13. data/app/models/effective/ring_wizard.rb +7 -0
  14. data/app/models/effective/stamp.rb +69 -0
  15. data/app/models/effective/stamp_wizard.rb +7 -0
  16. data/app/views/admin/rings/_ring.html.haml +23 -15
  17. data/app/views/admin/stamps/_stamp.html.haml +53 -0
  18. data/app/views/effective/{ring_payments → ring_wizards}/_content.html.haml +0 -0
  19. data/app/views/effective/ring_wizards/_dashboard.html.haml +27 -0
  20. data/app/views/effective/{ring_payments → ring_wizards}/_layout.html.haml +0 -0
  21. data/app/views/effective/ring_wizards/_orders.html.haml +4 -0
  22. data/app/views/effective/ring_wizards/_ring.html.haml +40 -0
  23. data/app/views/effective/{rings/_fields.html.haml → ring_wizards/_ring_fields.html.haml} +25 -7
  24. data/app/views/effective/ring_wizards/_ring_wizard.html.haml +3 -0
  25. data/app/views/effective/ring_wizards/_summary.html.haml +31 -0
  26. data/app/views/effective/ring_wizards/billing.html.haml +15 -0
  27. data/app/views/effective/ring_wizards/checkout.html.haml +6 -0
  28. data/app/views/effective/{ring_payments → ring_wizards}/ring.html.haml +4 -4
  29. data/app/views/effective/{ring_payments → ring_wizards}/start.html.haml +1 -1
  30. data/app/views/effective/ring_wizards/submitted.html.haml +16 -0
  31. data/app/views/effective/ring_wizards/summary.html.haml +8 -0
  32. data/app/views/effective/stamp_wizards/_content.html.haml +10 -0
  33. data/app/views/effective/stamp_wizards/_dashboard.html.haml +27 -0
  34. data/app/views/effective/stamp_wizards/_layout.html.haml +3 -0
  35. data/app/views/effective/stamp_wizards/_orders.html.haml +4 -0
  36. data/app/views/effective/stamp_wizards/_stamp.html.haml +45 -0
  37. data/app/views/effective/stamp_wizards/_stamp_fields.html.haml +45 -0
  38. data/app/views/effective/stamp_wizards/_stamp_wizard.html.haml +3 -0
  39. data/app/views/effective/stamp_wizards/_summary.html.haml +31 -0
  40. data/app/views/effective/{ring_payments → stamp_wizards}/billing.html.haml +1 -1
  41. data/app/views/effective/{ring_payments → stamp_wizards}/checkout.html.haml +1 -1
  42. data/app/views/effective/stamp_wizards/stamp.html.haml +18 -0
  43. data/app/views/effective/stamp_wizards/start.html.haml +16 -0
  44. data/app/views/effective/{ring_payments → stamp_wizards}/submitted.html.haml +4 -3
  45. data/app/views/effective/{ring_payments → stamp_wizards}/summary.html.haml +2 -2
  46. data/config/effective_products.rb +4 -4
  47. data/config/routes.rb +11 -3
  48. data/db/migrate/01_create_effective_products.rb.erb +98 -1
  49. data/lib/effective_products/engine.rb +2 -1
  50. data/lib/effective_products/version.rb +1 -1
  51. data/lib/effective_products.rb +6 -6
  52. metadata +42 -21
  53. data/app/controllers/effective/ring_payments_controller.rb +0 -31
  54. data/app/models/effective/ring_payment.rb +0 -7
  55. data/app/views/effective/ring_payments/_dashboard.html.haml +0 -27
  56. data/app/views/effective/ring_payments/_orders.html.haml +0 -4
  57. data/app/views/effective/ring_payments/_ring.html.haml +0 -29
  58. data/app/views/effective/ring_payments/_ring_fields.html.haml +0 -4
  59. data/app/views/effective/ring_payments/_ring_payment.html.haml +0 -8
  60. data/app/views/effective/ring_payments/_summary.html.haml +0 -31
@@ -0,0 +1,27 @@
1
+ -# In progress payments
2
+ - existing = EffectiveProducts.RingWizard.in_progress.for(current_user).first
3
+ - datatable = EffectiveResources.best('EffectiveRingWizardsDatatable').new(self, namespace: :effective)
4
+
5
+ - if existing.present?
6
+ %h2 In Progress Ring Payments
7
+
8
+ %p Your payment for Professional Ring is incomplete
9
+
10
+ %p
11
+ Please
12
+ = link_to("Continue payment for #{existing}", effective_products.ring_wizard_build_path(existing, existing.next_step), 'data-turbolinks' => false, class: 'btn btn-primary')
13
+ or you can
14
+ = link_to('Abandon payment', effective_products.ring_wizard_path(existing), 'data-confirm': "Really delete #{existing}?", 'data-method': :delete, class: 'btn btn-danger')
15
+ to start over.
16
+
17
+ %hr
18
+
19
+ %h2 Ring Payments
20
+
21
+ - if datatable.present?
22
+ = render_simple_datatable(datatable)
23
+ - else
24
+ %p You have no past ring payments. When you do, we'll show them here.
25
+
26
+ - if existing.blank?
27
+ %p= link_to 'Order a Professional Ring', effective_products.new_ring_wizard_path, class: 'btn btn-primary'
@@ -0,0 +1,4 @@
1
+ - if ring_wizard.submit_order&.purchased?
2
+ .card.mb-4
3
+ .card-body
4
+ = render(ring_wizard.submit_order)
@@ -0,0 +1,40 @@
1
+ .card
2
+ .card-body
3
+ .row
4
+ .col-sm
5
+ %h5.card-title= ring_wizard.wizard_step_title(:ring)
6
+ .col-sm-auto.text-right
7
+ = link_to('Edit', wizard_path(:ring)) if edit_effective_wizard?
8
+
9
+ - ring = ring_wizard.ring
10
+ - owner = ring_wizard.owner
11
+
12
+ %table.table.table-sm
13
+ %tbody
14
+ %tr
15
+ %th Owner
16
+ %td
17
+ = owner.to_s
18
+ - if owner.try(:email).present?
19
+ %br
20
+ = mail_to(owner.email)
21
+
22
+ - if owner.try(:phone).present?
23
+ %br
24
+ = owner.phone
25
+
26
+ - if owner.try(:membership).try(:number).present?
27
+ %br
28
+ Member Number #{owner.membership.number}
29
+
30
+ %tr
31
+ %th Address
32
+ %td= ring.shipping_address.to_html
33
+
34
+ %tr
35
+ %th Metal
36
+ %td= ring.metal
37
+
38
+ %tr
39
+ %th Size
40
+ %td Size #{ring.size}
@@ -1,14 +1,29 @@
1
- %h2 Contact Information
2
1
 
3
- = f.text_field :first_name
4
- = f.text_field :last_name
5
- = f.email_field :email
6
- = f.phone_field :phone
7
- = f.static_field :member_number, value: f.object.owner&.membership&.number || 'None'
2
+ %h2 Member Information
8
3
 
9
- = effective_address_fields(f, :shipping)
4
+ - owner = f.object.owner
5
+
6
+ %p
7
+ = owner.to_s
8
+
9
+ - if owner.try(:email).present?
10
+ %br
11
+ = mail_to(owner.email)
12
+
13
+ - if owner.try(:phone).present?
14
+ %br
15
+ = owner.phone
16
+
17
+ - if owner.try(:membership).try(:number).present?
18
+ %br
19
+ Member Number #{owner.membership.number}
10
20
 
11
21
  %h2 Ring Information
22
+ %p
23
+ The 14k Yellow Gold and Sterling Silver rings will have the association's letters as well as your membership number engraved inside the band.
24
+ Titanium rings do not come engraved.
25
+
26
+ %p Please choose your desired metal and ring size:
12
27
 
13
28
  %table.table
14
29
  %thead
@@ -37,3 +52,6 @@
37
52
 
38
53
  = f.select :metal, Effective::Ring::METALS
39
54
  = f.select :size, Effective::Ring::TITANIUM_SIZES
55
+
56
+ %h2 Shipping Information
57
+ = effective_address_fields(f, :shipping)
@@ -0,0 +1,3 @@
1
+ .effective-ring-payment
2
+ - ring_wizard.render_steps.each do |partial|
3
+ = render "effective/ring_wizards/#{partial}", ring_wizard: ring_wizard, step: partial
@@ -0,0 +1,31 @@
1
+ = card('Ring Payment') do
2
+ - ring = ring_wizard.ring
3
+
4
+ %table.table.table-sm
5
+ %tbody
6
+ - if request.path.start_with?('/admin')
7
+ %tr
8
+ %th Owner
9
+ %td
10
+ - url = (polymorphic_admin_path(ring_wizard.owner) rescue "/admin/users/#{ring_wizard.owner.to_param}/edit")
11
+ = link_to(ring_wizard.owner, url)
12
+ - else
13
+ %tr
14
+ %th Owner
15
+ %td= ring_wizard.owner
16
+
17
+ - if ring_wizard.orders.present?
18
+ %tr
19
+ %th Order
20
+ %td
21
+ - ring_wizard.orders.each do |order|
22
+ = link_to(order, effective_orders.order_path(order))
23
+
24
+ - if ring_wizard.was_submitted?
25
+ %tr
26
+ %th Submitted
27
+ %td= ring_wizard.submitted_at.strftime('%F')
28
+
29
+ %tr
30
+ %th Issued
31
+ %td= ring.issued_at&.strftime('%F') || 'Not Issued'
@@ -0,0 +1,15 @@
1
+ = render 'layout' do
2
+ = render 'effective/ring_wizards/content', resource: resource
3
+
4
+ - raise('expected owner to respond to billing_address') unless resource.owner.respond_to?(:billing_address)
5
+
6
+ = card('Billing Address') do
7
+ %p Please enter your billing address
8
+
9
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
10
+ = f.hidden_field :id
11
+
12
+ = f.fields_for(:owner, f.object.owner) do |fu|
13
+ = effective_address_fields(fu, :billing)
14
+
15
+ = f.save 'Save and Continue'
@@ -0,0 +1,6 @@
1
+ = render 'layout' do
2
+ = render 'effective/ring_wizards/content', resource: resource
3
+
4
+ .card
5
+ .card-body
6
+ = render_checkout_step2(resource.submit_order, purchased_url: wizard_path(:submitted), deferred_url: wizard_path(:checkout), declined_url: wizard_path(:checkout))
@@ -1,5 +1,5 @@
1
1
  = render 'layout' do
2
- = render 'effective/ring_payments/content', resource: resource
2
+ = render 'effective/ring_wizards/content', resource: resource
3
3
 
4
4
  .card
5
5
  .card-body
@@ -7,12 +7,12 @@
7
7
  = f.hidden_field :id
8
8
 
9
9
  = f.fields_for :rings, (f.object.ring || f.object.build_ring) do |fr|
10
- = fr.hidden_field :ring_payment_id
11
- = fr.hidden_field :ring_payment_type
10
+ = fr.hidden_field :ring_wizard_id
11
+ = fr.hidden_field :ring_wizard_type
12
12
 
13
13
  = fr.hidden_field :owner_id
14
14
  = fr.hidden_field :owner_type
15
15
 
16
- = render('effective/ring_payments/ring_fields', f: fr)
16
+ = render('effective/ring_wizards/ring_fields', f: fr)
17
17
 
18
18
  = f.save 'Save and Continue'
@@ -1,5 +1,5 @@
1
1
  = render 'layout' do
2
- = render 'effective/ring_payments/content', resource: resource
2
+ = render 'effective/ring_wizards/content', resource: resource
3
3
 
4
4
  .card
5
5
  .card-body
@@ -0,0 +1,16 @@
1
+ = render 'layout' do
2
+ = render 'effective/ring_wizards/content', resource: resource
3
+
4
+ - raise('expected a submitted resource') unless resource.was_submitted?
5
+ - raise('expected a purchased resource submit_order') unless resource.submit_order&.purchased?
6
+
7
+ .alert.alert-warning.mb-4
8
+ Successfully paid on #{resource.submit_order.purchased_at.strftime('%F')}.
9
+
10
+ = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary mb-4'
11
+
12
+ = render 'effective/ring_wizards/summary', ring_wizard: resource
13
+ = render 'effective/ring_wizards/ring_wizard', ring_wizard: resource
14
+ = render 'effective/ring_wizards/orders', ring_wizard: resource
15
+
16
+ = link_to 'Return to Dashboard', root_path, class: 'btn btn-lg btn-primary'
@@ -0,0 +1,8 @@
1
+ = render 'layout' do
2
+ = render 'effective/ring_wizards/content', resource: resource
3
+
4
+ = render 'effective/ring_wizards/ring_wizard', ring_wizard: resource
5
+
6
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
+ = f.hidden_field :id
8
+ = f.submit 'Save and Continue', class: 'btn btn-primary'
@@ -0,0 +1,10 @@
1
+ - all_steps_content = resource.try(:rich_text_all_steps_content)
2
+ - step_content = resource.try("rich_text_#{step}_content")
3
+
4
+ - if all_steps_content.present?
5
+ .card.mb-4
6
+ .card-body= all_steps_content
7
+
8
+ - if step_content.present?
9
+ .card.mb-4
10
+ .card-body= step_content
@@ -0,0 +1,27 @@
1
+ -# In progress payments
2
+ - existing = EffectiveProducts.StampWizard.in_progress.for(current_user).first
3
+ - datatable = EffectiveResources.best('EffectiveStampWizardsDatatable').new(self, namespace: :effective)
4
+
5
+ - if existing.present?
6
+ %h2 In Progress Stamp Payments
7
+
8
+ %p Your payment for Professional Stamp is incomplete
9
+
10
+ %p
11
+ Please
12
+ = link_to("Continue payment for #{existing}", effective_products.stamp_wizard_build_path(existing, existing.next_step), 'data-turbolinks' => false, class: 'btn btn-primary')
13
+ or you can
14
+ = link_to('Abandon payment', effective_products.stamp_wizard_path(existing), 'data-confirm': "Really delete #{existing}?", 'data-method': :delete, class: 'btn btn-danger')
15
+ to start over.
16
+
17
+ %hr
18
+
19
+ %h2 Stamp Payments
20
+
21
+ - if datatable.present?
22
+ = render_simple_datatable(datatable)
23
+ - else
24
+ %p You have no past stamp payments. When you do, we'll show them here.
25
+
26
+ - if existing.blank?
27
+ %p= link_to 'Order a Professional Stamp', effective_products.new_stamp_wizard_path, class: 'btn btn-primary'
@@ -0,0 +1,3 @@
1
+ .row
2
+ .col-lg-3.mb-3= render_wizard_sidebar(resource)
3
+ .col-lg-9= yield
@@ -0,0 +1,4 @@
1
+ - if stamp_wizard.submit_order&.purchased?
2
+ .card.mb-4
3
+ .card-body
4
+ = render(stamp_wizard.submit_order)
@@ -0,0 +1,45 @@
1
+ .card
2
+ .card-body
3
+ .row
4
+ .col-sm
5
+ %h5.card-title= stamp_wizard.wizard_step_title(:stamp)
6
+ .col-sm-auto.text-right
7
+ = link_to('Edit', wizard_path(:stamp)) if edit_effective_wizard?
8
+
9
+ - stamp = stamp_wizard.stamp
10
+ - owner = stamp_wizard.owner
11
+
12
+ %table.table.table-sm
13
+ %tbody
14
+ %tr
15
+ %th Owner
16
+ %td
17
+ = owner.to_s
18
+ - if owner.try(:email).present?
19
+ %br
20
+ = mail_to(owner.email)
21
+
22
+ - if owner.try(:phone).present?
23
+ %br
24
+ = owner.phone
25
+
26
+ - if owner.try(:membership).try(:number).present?
27
+ %br
28
+ Member Number #{owner.membership.number}
29
+
30
+ %tr
31
+ %th Category
32
+ %td= stamp.category
33
+
34
+ - if stamp.shipping_address.present?
35
+ %tr
36
+ %th Address
37
+ %td= stamp.shipping_address.to_html
38
+
39
+ %tr
40
+ %th Name
41
+ %td= stamp.name
42
+
43
+ %tr
44
+ %th Name Confirmation
45
+ %td= stamp.name_confirmation
@@ -0,0 +1,45 @@
1
+ %h2 Contact Information
2
+
3
+ - owner = f.object.owner
4
+
5
+ %p
6
+ = owner.to_s
7
+
8
+ - if owner.try(:email).present?
9
+ %br
10
+ = mail_to(owner.email)
11
+
12
+ - if owner.try(:phone).present?
13
+ %br
14
+ = owner.phone
15
+
16
+ - if owner.try(:membership).try(:number).present?
17
+ %br
18
+ Member Number #{owner.membership.number}
19
+
20
+ %h2 Display Name
21
+ %p Please enter and confirm your name as it should appear on the Professional Stamp.
22
+
23
+ = f.text_field :name
24
+ = f.text_field :name_confirmation, hint: 'must match name'
25
+
26
+ %h2 Stamp Information
27
+
28
+ %table.table
29
+ %thead
30
+ %th Stamp
31
+ %th.order_price Cost
32
+ %tbody
33
+ %tr
34
+ %td Physical
35
+ %td.order_price $50.00 + GST
36
+ %tr
37
+ %td Digital-only
38
+ %td.order_price $25.00 + GST
39
+
40
+ %p Please select a stamp:
41
+
42
+ = f.select :category, Effective::Stamp::CATEGORIES
43
+
44
+ = f.show_if :category, 'Physical' do
45
+ = effective_address_fields(f, :shipping)
@@ -0,0 +1,3 @@
1
+ .effective-stamp-payment
2
+ - stamp_wizard.render_steps.each do |partial|
3
+ = render "effective/stamp_wizards/#{partial}", stamp_wizard: stamp_wizard, step: partial
@@ -0,0 +1,31 @@
1
+ = card('Stamp Payment') do
2
+ - stamp = stamp_wizard.stamp
3
+
4
+ %table.table.table-sm
5
+ %tbody
6
+ - if request.path.start_with?('/admin')
7
+ %tr
8
+ %th Owner
9
+ %td
10
+ - url = (polymorphic_admin_path(stamp_wizard.owner) rescue "/admin/users/#{stamp_wizard.owner.to_param}/edit")
11
+ = link_to(stamp_wizard.owner, url)
12
+ - else
13
+ %tr
14
+ %th Owner
15
+ %td= stamp_wizard.owner
16
+
17
+ - if stamp_wizard.orders.present?
18
+ %tr
19
+ %th Order
20
+ %td
21
+ - stamp_wizard.orders.each do |order|
22
+ = link_to(order, effective_orders.order_path(order))
23
+
24
+ - if stamp_wizard.was_submitted?
25
+ %tr
26
+ %th Submitted
27
+ %td= stamp_wizard.submitted_at.strftime('%F')
28
+
29
+ %tr
30
+ %th Issued
31
+ %td= stamp.issued_at&.strftime('%F') || 'Not Issued'
@@ -1,5 +1,5 @@
1
1
  = render 'layout' do
2
- = render 'effective/ring_payments/content', resource: resource
2
+ = render 'effective/stamp_wizards/content', resource: resource
3
3
 
4
4
  - raise('expected owner to respond to billing_address') unless resource.owner.respond_to?(:billing_address)
5
5
 
@@ -1,5 +1,5 @@
1
1
  = render 'layout' do
2
- = render 'effective/ring_payments/content', resource: resource
2
+ = render 'effective/stamp_wizards/content', resource: resource
3
3
 
4
4
  .card
5
5
  .card-body
@@ -0,0 +1,18 @@
1
+ = render 'layout' do
2
+ = render 'effective/stamp_wizards/content', resource: resource
3
+
4
+ .card
5
+ .card-body
6
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
+ = f.hidden_field :id
8
+
9
+ = f.fields_for :stamps, (f.object.stamp || f.object.build_stamp) do |fr|
10
+ = fr.hidden_field :stamp_wizard_id
11
+ = fr.hidden_field :stamp_wizard_type
12
+
13
+ = fr.hidden_field :owner_id
14
+ = fr.hidden_field :owner_type
15
+
16
+ = render('effective/stamp_wizards/stamp_fields', f: fr)
17
+
18
+ = f.save 'Save and Continue'
@@ -0,0 +1,16 @@
1
+ = render 'layout' do
2
+ = render 'effective/stamp_wizards/content', resource: resource
3
+
4
+ .card
5
+ .card-body
6
+ %p Welcome #{current_user}!
7
+
8
+ %p You are about to purchase a Professional Stamp.
9
+
10
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
11
+ = f.hidden_field :id
12
+
13
+ = f.hidden_field :owner_type
14
+ = f.hidden_field :owner_id
15
+
16
+ = f.save 'Save and Continue'
@@ -1,5 +1,5 @@
1
1
  = render 'layout' do
2
- = render 'effective/ring_payments/content', resource: resource
2
+ = render 'effective/stamp_wizards/content', resource: resource
3
3
 
4
4
  - raise('expected a submitted resource') unless resource.was_submitted?
5
5
  - raise('expected a purchased resource submit_order') unless resource.submit_order&.purchased?
@@ -9,7 +9,8 @@
9
9
 
10
10
  = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary mb-4'
11
11
 
12
- = render 'effective/ring_payments/ring_payment', ring_payment: resource
13
- = render 'effective/ring_payments/orders', ring_payment: resource
12
+ = render 'effective/stamp_wizards/summary', stamp_wizard: resource
13
+ = render 'effective/stamp_wizards/stamp_wizard', stamp_wizard: resource
14
+ = render 'effective/stamp_wizards/orders', stamp_wizard: resource
14
15
 
15
16
  = link_to 'Return to Dashboard', root_path, class: 'btn btn-lg btn-primary'
@@ -1,7 +1,7 @@
1
1
  = render 'layout' do
2
- = render 'effective/ring_payments/content', resource: resource
2
+ = render 'effective/stamp_wizards/content', resource: resource
3
3
 
4
- = render 'effective/ring_payments/ring_payment', ring_payment: resource
4
+ = render 'effective/stamp_wizards/stamp_wizard', stamp_wizard: resource
5
5
 
6
6
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
7
  = f.hidden_field :id
@@ -1,16 +1,16 @@
1
1
  EffectiveProducts.setup do |config|
2
2
  config.rings_table_name = :rings
3
- config.ring_payments_table_name = :ring_payments
3
+ config.ring_wizards_table_name = :ring_wizards
4
4
  config.stamps_table_name = :stamps
5
- config.stamp_payments_table_name = :stamp_payments
5
+ config.stamp_wizards_table_name = :stamp_wizards
6
6
 
7
7
  # Layout Settings
8
8
  # Configure the Layout per controller, or all at once
9
9
  # config.layout = { application: 'application', admin: 'admin' }
10
10
 
11
11
  # Payment Wizard Settings
12
- # config.ring_payments_class_name = 'Effective::RingPayment'
13
- # config.stamp_payments_class_name = 'Effective::StampPayment'
12
+ # config.ring_wizards_class_name = 'Effective::RingWizard'
13
+ # config.stamp_wizards_class_name = 'Effective::StampWizard'
14
14
 
15
15
  # Use effective roles. Not sure what this does yet.
16
16
  config.use_effective_roles = true
data/config/routes.rb CHANGED
@@ -7,17 +7,25 @@ end
7
7
  EffectiveProducts::Engine.routes.draw do
8
8
  # Public routes
9
9
  scope module: 'effective' do
10
- resources :ring_payments, only: [:new, :show, :destroy] do
11
- resources :build, controller: :ring_payments, only: [:show, :update]
10
+ resources :ring_wizards, name: :ring_wizard, only: [:new, :show, :destroy] do
11
+ resources :build, controller: :ring_wizards, only: [:show, :update]
12
+ end
13
+
14
+ resources :stamp_wizards, name: :stamp_wizard, only: [:new, :show, :destroy] do
15
+ resources :build, controller: :stamp_wizards, only: [:show, :update]
12
16
  end
13
17
  end
14
18
 
15
19
  namespace :admin do
16
- resources :ring_payments, except: [:new, :create, :show]
20
+ resources :ring_wizards, except: [:new, :create, :show]
17
21
 
18
22
  resources :rings, only: [:index, :show] do
19
23
  post :mark_as_issued, on: :member
20
24
  end
25
+
26
+ resources :stamps, only: [:index, :show] do
27
+ post :mark_as_issued, on: :member
28
+ end
21
29
  end
22
30
 
23
31
  end
@@ -1,4 +1,101 @@
1
- class CreateEffectiveProducts < ActiveRecord::Migration[6.0]
1
+ class CreateEffectiveProducts < ActiveRecord::Migration[6.1]
2
2
  def change
3
+ create_table :rings do |t|
4
+ t.integer :owner_id
5
+ t.string :owner_type
6
+
7
+ t.integer :ring_wizard_id
8
+ t.string :ring_wizard_type
9
+
10
+ t.integer :size
11
+ t.string :metal
12
+
13
+ t.datetime :issued_at
14
+
15
+ # Acts as purchasable
16
+ t.integer :purchased_order_id
17
+ t.integer :price
18
+ t.boolean :tax_exempt, default: false
19
+ t.string :qb_item_name
20
+
21
+ t.timestamps
22
+ end
23
+
24
+ create_table :ring_wizards do |t|
25
+ t.string :token
26
+
27
+ t.integer :owner_id
28
+ t.string :owner_type
29
+
30
+ t.integer :user_id
31
+ t.string :user_type
32
+
33
+ # Acts as Statused
34
+ t.string :status
35
+ t.text :status_steps
36
+
37
+ # Acts as Wizard
38
+ t.text :wizard_steps
39
+
40
+ # Dates
41
+ t.datetime :submitted_at
42
+
43
+ t.datetime :updated_at
44
+ t.datetime :created_at
45
+ end
46
+
47
+ add_index :ring_wizards, [:owner_id, :owner_type]
48
+ add_index :ring_wizards, :status
49
+ add_index :ring_wizards, :token
50
+
51
+ create_table :stamps do |t|
52
+ t.integer :owner_id
53
+ t.string :owner_type
54
+
55
+ t.integer :stamp_wizard_id
56
+ t.string :stamp_wizard_type
57
+
58
+ t.string :category
59
+ t.string :name
60
+ t.string :name_confirmation
61
+
62
+ t.datetime :issued_at
63
+
64
+ # Acts as purchasable
65
+ t.integer :purchased_order_id
66
+ t.integer :price
67
+ t.boolean :tax_exempt, default: false
68
+ t.string :qb_item_name
69
+
70
+ t.timestamps
71
+ end
72
+
73
+ create_table :stamp_wizards do |t|
74
+ t.string :token
75
+
76
+ t.integer :owner_id
77
+ t.string :owner_type
78
+
79
+ t.integer :user_id
80
+ t.string :user_type
81
+
82
+ # Acts as Statused
83
+ t.string :status
84
+ t.text :status_steps
85
+
86
+ # Acts as Wizard
87
+ t.text :wizard_steps
88
+
89
+ # Dates
90
+ t.datetime :submitted_at
91
+
92
+ t.datetime :updated_at
93
+ t.datetime :created_at
94
+ end
95
+
96
+ add_index :stamp_wizards, [:owner_id, :owner_type]
97
+ add_index :stamp_wizards, :status
98
+ add_index :stamp_wizards, :token
99
+
3
100
  end
4
101
  end
@@ -10,7 +10,8 @@ module EffectiveProducts
10
10
  # Include acts_as_addressable concern and allow any ActiveRecord object to call it
11
11
  initializer 'effective_products.active_record' do |app|
12
12
  ActiveSupport.on_load :active_record do
13
- ActiveRecord::Base.extend(EffectiveProductsRingPayment::Base)
13
+ ActiveRecord::Base.extend(EffectiveProductsRingWizard::Base)
14
+ ActiveRecord::Base.extend(EffectiveProductsStampWizard::Base)
14
15
  end
15
16
  end
16
17