solidus_bling 3.4.5 → 3.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96ae26320b68f766dc44bb621d62ea6588edca4942dd652e27f9db773b3746a7
|
4
|
+
data.tar.gz: 3cc77c798db3a3e13fae2af0825d3ab9f1c11b9cec025873d7858a47bbb8ad75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e84e85d97a04a3515d3dda9d97e46f8fe947bf15590d315f4fef2a4972d3804c903244e074e041e270d635015db561a1c72a62514ad7de8d25ca5ffeef3bce2e
|
7
|
+
data.tar.gz: 4cf11ba85c9efe1315a498ef9bde72528ee84de38c4768ee416d2bc222adf9897ebb50def3d382e5cd21728441cbaa41f361af7d8c25df31a7ae362b69053d50
|
@@ -38,9 +38,11 @@ module Spree
|
|
38
38
|
def edit
|
39
39
|
@payment_methods = ::Spree::PaymentMethod.all.pluck(:name, :id)
|
40
40
|
@shipping_methods = ::Spree::ShippingMethod.all.pluck(:name, :id)
|
41
|
+
@sellers = @bling_account.sellers.actives.order(:name).pluck(:name, :id)
|
41
42
|
end
|
42
43
|
|
43
44
|
def update
|
45
|
+
@bling_account.sellers.find_by_id(params[:account]["default_seller"]).update(default: true)
|
44
46
|
@bling_account.update account_params
|
45
47
|
redirect_to edit_admin_solidus_bling_account_path(@bling_account.id)
|
46
48
|
end
|
@@ -2,8 +2,8 @@ module SolidusBling
|
|
2
2
|
class Seller < ApplicationRecord
|
3
3
|
validates :name, presence: true
|
4
4
|
validates :external_id, presence: true
|
5
|
-
|
6
5
|
belongs_to :account
|
6
|
+
after_save :falsify_all_others
|
7
7
|
|
8
8
|
def self.upsert_sellers account
|
9
9
|
account.check_token
|
@@ -30,5 +30,9 @@ module SolidusBling
|
|
30
30
|
sellers_inactive = where(external_id: ids_sellers_inactive)
|
31
31
|
sellers_inactive.update_all(active: false)
|
32
32
|
end
|
33
|
+
|
34
|
+
def falsify_all_others
|
35
|
+
self.class.where("id != ?", id).update(default: false) if default
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
@@ -119,16 +119,20 @@
|
|
119
119
|
<% end %>
|
120
120
|
</fieldset>
|
121
121
|
|
122
|
-
|
123
|
-
<
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
<
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
122
|
+
<% if @sellers %>
|
123
|
+
<fieldset class="no-border-top text-center">
|
124
|
+
<legend>
|
125
|
+
Vendedor padrão
|
126
|
+
</legend>
|
127
|
+
<div class="col-12 col-md-6 mx-auto">
|
128
|
+
<div class="field">
|
129
|
+
<%= form.select "default_seller", @sellers, {selected: ::SolidusBling::Seller.default&.id, include_blank: true }, { class: "custom-select fullwidth" } %>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
</fieldset>
|
134
|
+
<% end %>
|
135
|
+
|
132
136
|
|
133
137
|
|
134
138
|
<div class="form-buttons filter-actions actions" data-hook="buttons">
|