solidus_bling 2.0.3 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/admin/accounts_controller.rb +9 -3
- data/app/models/solidus_bling/account.rb +4 -4
- data/app/models/solidus_bling/payment_method.rb +2 -0
- data/app/models/solidus_bling/seller.rb +3 -0
- data/app/models/solidus_bling/shipping_method.rb +2 -0
- data/app/views/spree/admin/accounts/_form.html.erb +13 -9
- data/app/views/spree/admin/accounts/edit.html.erb +3 -1
- data/lib/solidus_bling/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a1eeddb2480fc6c8c413632d68a9474a8861221a2696d686b855e815cabca27
|
4
|
+
data.tar.gz: 6a9654d237829e34477e9a975c80f66a60dad7756f894f4d9c316b0a416e50ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dc19ff8328d031b59baa44c5cb42fbf9ff9e004f8e751ffe4eb7044a7fac234d0315df516fd519492d6a24f100714ec8e97c76d9f88503a0e356f29c8189ed7
|
7
|
+
data.tar.gz: f82406fc7f2de27d9476ead0d9a4a48873509cfa8aa95312b30c1242503de200421fd2f82385f0f2d2366fcc845193e5a19e328910a4ece17d7d5a2d3d10fca0
|
@@ -18,8 +18,14 @@ module Spree
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def create
|
21
|
-
bling_account = SolidusBling::Account.
|
22
|
-
|
21
|
+
bling_account = SolidusBling::Account.new account_params.merge(name: "Bling")
|
22
|
+
if bling_account.save
|
23
|
+
flash[:success] = "Conta criada com sucesso"
|
24
|
+
redirect_to admin_accounts_path
|
25
|
+
else
|
26
|
+
flash[:error] = bling_account.errors.full_messages.join("\n")
|
27
|
+
redirect_to new_admin_account_path
|
28
|
+
end
|
23
29
|
end
|
24
30
|
|
25
31
|
def edit
|
@@ -27,7 +33,7 @@ module Spree
|
|
27
33
|
@payment_methods = ::Spree::PaymentMethod.all.pluck(:name, :id)
|
28
34
|
@shipping_methods = ::Spree::ShippingMethod.all.pluck(:name, :id)
|
29
35
|
@products_count = @bling_account.products.count
|
30
|
-
@last_update = SolidusBling::Event.where(method: "products_updated").max.created_at
|
36
|
+
@last_update = SolidusBling::Event.where(method: "products_updated").max.try(:created_at)
|
31
37
|
end
|
32
38
|
|
33
39
|
def update
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module SolidusBling
|
2
2
|
class Account < ApplicationRecord
|
3
|
-
has_many :payment_methods
|
4
|
-
has_many :shipping_methods
|
5
|
-
has_many :products
|
6
|
-
has_many :sellers
|
3
|
+
has_many :payment_methods, dependent: :destroy
|
4
|
+
has_many :shipping_methods, dependent: :destroy
|
5
|
+
has_many :products, dependent: :destroy
|
6
|
+
has_many :sellers, dependent: :destroy
|
7
7
|
accepts_nested_attributes_for :payment_methods, :shipping_methods, :sellers
|
8
8
|
end
|
9
9
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<%= form_with model: bling_account, url: form_url do |form| %>
|
2
|
+
<h6>Dados da conta</h6>
|
2
3
|
<div>
|
3
4
|
<%= form.label :app_name, "Nome do Aplicativo: " %>
|
4
5
|
<%= form.text_field :app_name %>
|
@@ -34,25 +35,28 @@
|
|
34
35
|
<%= form.text_field :incoming_category_id %>
|
35
36
|
</div>
|
36
37
|
|
37
|
-
<div>
|
38
|
-
|
39
|
-
|
38
|
+
<div style="margin: 10px 0">
|
39
|
+
<h6>Métodos de Pagamento</h6>
|
40
|
+
<%= form.fields_for :payment_methods do |payment_form| %>
|
41
|
+
<div>
|
40
42
|
<%= payment_form.select :spree_payment_method_id, @payment_methods %>
|
41
43
|
<%= payment_form.text_field :external_id %>
|
42
|
-
|
44
|
+
</div>
|
43
45
|
<% end %>
|
44
46
|
</div>
|
45
47
|
|
46
|
-
<div>
|
47
|
-
|
48
|
-
|
48
|
+
<div style="margin: 10px 0">
|
49
|
+
<h6>Métodos de Envio</h6>
|
50
|
+
<%= form.fields_for :shipping_methods do |shipping_form| %>
|
51
|
+
<div>
|
49
52
|
<%= shipping_form.select :spree_shipping_method_id, @shipping_methods %>
|
50
53
|
<%= shipping_form.text_field :alias %>
|
51
|
-
|
54
|
+
</div>
|
52
55
|
<% end %>
|
53
56
|
</div>
|
54
57
|
|
55
|
-
<div>
|
58
|
+
<div style="margin: 10px 0">
|
59
|
+
<h6>Vendedores</h6>
|
56
60
|
<% bling_account.sellers.each do |seller| %>
|
57
61
|
<%= form.fields_for :sellers do |seller_form| %>
|
58
62
|
<%= seller_form.label :name, "Nome do Vendedor: " %>
|
@@ -3,7 +3,9 @@
|
|
3
3
|
{confirm: "Deseja baixar os produtos?" } %>
|
4
4
|
<span>Produtos baixados: <%= @products_count %></span>
|
5
5
|
<br>
|
6
|
-
|
6
|
+
<% if @last_update.present? %>
|
7
|
+
<span>Ultima atualização: <%= @last_update.strftime("%d/%m/%Y %H:%M") %> </span>
|
8
|
+
<% end %>
|
7
9
|
</div>
|
8
10
|
|
9
11
|
<%= render "form", bling_account: @bling_account, form_url: admin_account_path(@bling_account.id) %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_bling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ulysses-bull
|
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
- !ruby/object:Gem::Version
|
200
200
|
version: '0'
|
201
201
|
requirements: []
|
202
|
-
rubygems_version: 3.4.
|
202
|
+
rubygems_version: 3.4.19
|
203
203
|
signing_key:
|
204
204
|
specification_version: 4
|
205
205
|
summary: Solidus extension to integrate with the Bling
|