Add custom fields to invoice, odergroup, supplier and user

This commit is contained in:
Patrick Gansterer 2017-10-12 20:50:40 +02:00
parent 72b5a5ca82
commit 75deec9f06
13 changed files with 48 additions and 7 deletions

View file

@ -5,6 +5,7 @@
= f.input :contact_person
= f.input :contact_phone
= f.input :contact_address
= render 'shared/custom_form_fields', f: f, type: :ordergroup
.fold-line
= f.input :break_start, as: :date_picker, label: Ordergroup.human_attribute_name('break')
= f.input :break_end, as: :date_picker, label: Ordergroup.human_attribute_name('break_until')

View file

@ -2,6 +2,7 @@
%p= t('.first_paragraph', url: link_to(t('.here'), new_invite_path(id: @workgroup.id), remote: true)).html_safe
= simple_form_for [:admin, @workgroup] do |f|
- captured = capture do
= render 'shared/custom_form_fields', f: f, type: :workgroup
%h4= t 'admin.access_to'
= f.input :role_suppliers
= f.input :role_article_meta

View file

@ -22,6 +22,7 @@
= f.input :amount, as: :string
= f.input :deposit, as: :string
= f.input :deposit_credit, as: :string
= render 'shared/custom_form_fields', f: f, type: :invoice
= f.input :attachment, as: :file, hint: t('.attachment_hint')
- if f.object.attachment_data.present?
= f.input :delete_attachment, as: :boolean

View file

@ -0,0 +1,7 @@
- if FoodsoftConfig[:custom_fields] && FoodsoftConfig[:custom_fields][type]
= f.simple_fields_for :custom_fields, defaults: { required: false } do |s|
- FoodsoftConfig[:custom_fields][type].each do |options|
- options = options.deep_symbolize_keys
- name = options.delete(:name)
- value = f.object.settings.custom_fields[name]
= s.input name, options.deep_merge(input_html: {value:value})

View file

@ -19,10 +19,11 @@
= ogf.input :contact_address, label: t('activerecord.attributes.ordergroup.contact_address'), required: false,
input_html: { title: address_hint, data: {toggle: 'tooltip', placement: 'right'} }
= render 'shared/custom_form_fields', f: f, type: :user
= f.simple_fields_for :settings_attributes do |s|
= s.simple_fields_for :profile, defaults: { inline_label: true } do |profile|
= profile.input 'language', as: :select, collection: available_locales, required: false, selected: f.object.settings.profile['language']
.settings
.settings-group
= s.simple_fields_for :profile, defaults: { inline_label: true } do |profile|

View file

@ -18,6 +18,7 @@
= f.input :order_howto, as: :text, input_html: {rows: 5}
= f.input :note, as: :text, input_html: {rows: 5}
= f.input :min_order_quantity
= render 'shared/custom_form_fields', f: f, type: :supplier
- if @supplier.shared_supplier
= f.input :shared_sync_method, collection: shared_sync_method_collection(@supplier.shared_supplier), input_html: {class: 'input-xlarge'}, include_blank: false, disabled: @supplier.shared_supplier.shared_sync_methods.count < 2
.form-actions