diff --git a/app/overrides/spree/admin/shipping_methods/form.rb b/app/overrides/spree/admin/shipping_methods/form.rb new file mode 100644 index 00000000..09f933a9 --- /dev/null +++ b/app/overrides/spree/admin/shipping_methods/form.rb @@ -0,0 +1,24 @@ +module Spree + module Admin + module ShippingMethods + class Form + Deface::Override.new( + virtual_path: 'spree/admin/shipping_methods/_form', + name: 'Add vendor selection in shipping method form', + insert_bottom: 'div[data-hook="admin_shipping_method_form_fields"]', + text: <<-HTML + <% if current_spree_user.respond_to?(:has_spree_role?) && current_spree_user.has_spree_role?(:admin) %> +
+ <%= f.field_container :vendor, class: ['form-group'] do %> + <%= f.label :vendor_id, Spree.t(:vendor) %> + <%= f.collection_select(:vendor_id, Spree::Vendor.all, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %> + <%= f.error_message_on :vendor %> + <% end %> +
+ <% end %> + HTML + ) + end + end + end +end \ No newline at end of file diff --git a/app/overrides/spree/admin/stock_locations/form.rb b/app/overrides/spree/admin/stock_locations/form.rb new file mode 100644 index 00000000..da62cf42 --- /dev/null +++ b/app/overrides/spree/admin/stock_locations/form.rb @@ -0,0 +1,24 @@ +module Spree + module Admin + module StockLocations + class Form + Deface::Override.new( + virtual_path: 'spree/admin/stock_locations/_form', + name: 'Add vendor field in stock locations form', + insert_bottom: 'div[data-hook="admin_stock_locations_form_fields"]', + text: <<-HTML + <% if current_spree_user.respond_to?(:has_spree_role?) && current_spree_user.has_spree_role?(:admin) %> +
+ <%= f.field_container :vendor, class: ['form-group'] do %> + <%= f.label :vendor_id, Spree.t(:vendor) %> + <%= f.collection_select(:vendor_id, Spree::Vendor.all, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %> + <%= f.error_message_on :vendor %> + <% end %> +
+ <% end %> + HTML + ) + end + end + end +end \ No newline at end of file