ish_manager 0.1.8.503 → 0.1.8.505

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: b7465feb8b71a19de0c55e39cbf14d4016792bdcd20f5c0d10ab90397defcffb
4
- data.tar.gz: 700d28696374331c9e7c8f3b1f87e74a13392c350a81e89588a4fdb48dfbb0bd
3
+ metadata.gz: 908f6d6ce27dbc1350b08012a104e71691b39108e4b01e0005ae36a65802626c
4
+ data.tar.gz: f2172c6fd2554c9ab133cd6041b2fa1b328a09356f8f177a54d44e56f52c8e84
5
5
  SHA512:
6
- metadata.gz: 29c2cd6c9c46744212e9f23b1b4e7890bd72da84783445270284c79c3b3d1ae06b91297c26d17695325be998daf30da7865162615274fc290533f2149843f209
7
- data.tar.gz: c4350008f57978f1e09b13ebc0340b8953c01735c9a28b1d9e351b5c1e66bcc5fbf5261dd68e89b9c128c1d0260180becf271954e9664d1263cf9b935696d525
6
+ metadata.gz: d6b6733574d3c87c0a0934cd354de908d511a8c46481e577a1fd32fe3b0126497fa69c8946613b2025576d47944e0f51f33c37dda8fed7e3c7c3de729cde70e7
7
+ data.tar.gz: 708286a7b172966900febcf9addd6798635354125e16de175eb3e0855f2c34a54bdd56daa69e711d254744a0533f42ca93cc0021b59859ecfe3768c29d24f697
@@ -60,15 +60,18 @@ $(document).ready(() => {
60
60
  out.push(val)
61
61
  })
62
62
 
63
+ let data = {
64
+ ids: out,
65
+ jwt_token: jwt_token,
66
+ emailtag: emailtag,
67
+ }
68
+ if ($("#is_move").prop('checked')) {
69
+ data.is_move = true
70
+ }
63
71
  $.ajax({
64
72
  url: action_path,
65
73
  type: 'POST',
66
- data: {
67
- ids: out,
68
- jwt_token: jwt_token,
69
- emailtag: emailtag,
70
-
71
- },
74
+ data: data,
72
75
  success: e => {
73
76
  logg((e||{}).responseText, 'Ok')
74
77
  location.reload()
@@ -4,6 +4,37 @@
4
4
 
5
5
  class IshManager::PricesController < IshManager::ApplicationController
6
6
 
7
+ def create
8
+ @price = Wco::Price.new params[:price].permit( :amount_cents, :interval, :product_id )
9
+ puts! @price, '@price'
10
+ authorize! :create, @price
11
+ if !params[:price][:interval].present?
12
+ @price.interval = nil
13
+ end
14
+ @product = Wco::Product.find @price.product_id
15
+ stripe_product = Stripe::Product.retrieve( @product.product_id )
16
+ price_hash = {
17
+ product: stripe_product.id,
18
+ unit_amount: @price.amount_cents,
19
+ currency: 'usd',
20
+ }
21
+ if @price.interval.present?
22
+ price_hash[:recurring] = { interval: @price.interval }
23
+ end
24
+ stripe_price = Stripe::Price.create( price_hash )
25
+ # puts! stripe_price, 'stripe_price'
26
+
27
+ flash_notice 'Created stripe price.'
28
+ @price.product = @product
29
+ @price.price_id = stripe_price[:id]
30
+ if @price.save
31
+ flash_notice @price
32
+ else
33
+ flash_alert @price
34
+ end
35
+ redirect_to controller: :products, action: :index
36
+ end
37
+
7
38
  def update
8
39
 
9
40
  # if !params[:price][:interval].present?
@@ -5,15 +5,12 @@ class IshManager::ProductsController < IshManager::ApplicationController
5
5
 
6
6
  # Alphabetized : )
7
7
 
8
+
9
+
8
10
  def create
9
11
  @product = Wco::Product.new params[:product].permit( :name )
10
- @price = Wco::Price.new params[:price].permit( :amount_cents, :interval )
11
12
  authorize! :create, @product
12
13
 
13
- if !params[:price][:interval].present?
14
- @price.interval = nil
15
- end
16
-
17
14
  stripe_product = Stripe::Product.create({ name: @product.name })
18
15
  # puts! stripe_product, 'stripe_product'
19
16
  flash_notice 'Created stripe product.'
@@ -24,26 +21,6 @@ class IshManager::ProductsController < IshManager::ApplicationController
24
21
  else
25
22
  flash_alert "Cannot create wco product: #{@product.errors.full_messages.join(', ')}."
26
23
  end
27
-
28
- price_hash = {
29
- product: stripe_product.id,
30
- unit_amount: @price.amount_cents,
31
- currency: 'usd',
32
- }
33
- if @price.interval.present?
34
- price_hash[:recurring] = { interval: @price.interval }
35
- end
36
- stripe_price = Stripe::Price.create( price_hash )
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
43
- else
44
- flash_alert @price
45
- end
46
-
47
24
  redirect_to action: :index
48
25
  end
49
26
 
@@ -37,6 +37,8 @@
37
37
 
38
38
  .bordered.inline-block
39
39
  = select_tag :emailtag, options_for_select(@emailtags_list)
40
+ = check_box_tag :is_move
41
+ %label move?
40
42
  %a.btn.add-tag-btn{ href: "javascript: void(0)", data: { url: "/api/email_conversations/addtag" } }
41
43
  %i.material-icons add
42
44
  Addtag
@@ -23,8 +23,8 @@
23
23
  -# = f.select :email, options_for_select([[nil,nil]] + @leadset.employees.map { |i| [ i.email, i.email ] } )
24
24
 
25
25
  .input-row
26
- %label item
27
- = select_tag 'invoice[items][][product_id]', options_for_select( @products_list ), class: 'products'
26
+ %label item (product)
27
+ = select_tag 'invoice[items][][product_id]', options_for_select( @products_list ), class: 'products select2'
28
28
 
29
29
  %label price
30
30
  = select_tag 'invoice[items][][price_id]'
@@ -15,12 +15,11 @@
15
15
  = render 'ish_manager/leads/index', leads: @employees
16
16
  %hr
17
17
 
18
- .row
19
- .col-md-6
20
- = render 'ish_manager/serverhosts/index', serverhosts: @leadset.serverhosts
21
-
22
- .col-md-6
23
- = render 'ish_manager/appliances/index', appliances: @leadset.appliances
18
+ -# .row
19
+ -# .col-md-6
20
+ -# = render 'ish_manager/serverhosts/index', serverhosts: @leadset.serverhosts
21
+ -# .col-md-6
22
+ -# = render 'ish_manager/appliances/index', appliances: @leadset.appliances
24
23
 
25
24
  .row
26
25
  .col-md-6
@@ -0,0 +1,10 @@
1
+
2
+ - url = price.new_record? ? prices_path : price_path( price )
3
+
4
+ .products--prices-form.inline-block
5
+ = form_for price, as: :price, url: url do |f|
6
+ = hidden_field_tag 'price[product_id]', price.product_id
7
+
8
+ %label amount cents
9
+ = f.number_field :amount_cents
10
+ = f.submit '>'
@@ -8,21 +8,23 @@
8
8
  %label Name
9
9
  = text_field_tag 'product[name]'
10
10
 
11
- .form-field
12
- %label Price in cents
13
- = text_field_tag 'price[amount_cents]'
14
-
15
- .form-field
16
- %label Recurring?
17
- = select_tag 'price[interval]', options_for_select(Wco::Price::INTERVALS)
11
+ -# .form-field
12
+ -# %label Price in cents
13
+ -# = text_field_tag 'price[amount_cents]'
18
14
 
19
15
  -# .form-field
20
- -# %label Stripe product_id
21
- -# = f.text_field :product_id
16
+ -# %label Recurring?
17
+ -# = select_tag 'price[interval]', options_for_select(Wco::Price::INTERVALS)
18
+
19
+ .form-field
20
+ %label Stripe product_id
21
+ -# = f.text_field :product_id
22
+ = product.product_id
22
23
 
23
24
  -# .form-field
24
25
  -# %label Stripe price_id
25
- -# = f.text_field :price_id
26
+ -# -# = f.text_field :price_id
27
+ -# = product.price_id
26
28
 
27
29
  .actions
28
30
  = f.submit 'Submit'
@@ -20,6 +20,9 @@
20
20
  - else
21
21
  = product.name
22
22
  %ul
23
+ %li
24
+ New price:
25
+ = render 'ish_manager/prices/form', price: Wco::Price.new({ product: product[:wco_product] })
23
26
  - product[:prices].each do |price_id, price|
24
27
  %li
25
28
  %span.gray= price.id
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.503
4
+ version: 0.1.8.505
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-03 00:00:00.000000000 Z
11
+ date: 2023-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -826,6 +826,7 @@ files:
826
826
  - app/views/ish_manager/photos/new.haml
827
827
  - app/views/ish_manager/photos/show.haml
828
828
  - app/views/ish_manager/photos/without_gallery.haml
829
+ - app/views/ish_manager/prices/_form.haml
829
830
  - app/views/ish_manager/products/_form.haml
830
831
  - app/views/ish_manager/products/_index_list.haml
831
832
  - app/views/ish_manager/products/_index_table.haml