mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
More fixes
This commit is contained in:
committed by
Maikel Linke
parent
9b93102a96
commit
ca46359224
@@ -99,7 +99,7 @@ module Admin
|
||||
|
||||
def customer_params
|
||||
params.require(:customer).permit(
|
||||
:enterprise_id, :name, :email, :code, :tag_list,
|
||||
:enterprise_id, :first_name, :last_name, :email, :code, :tag_list,
|
||||
ship_address_attributes: PermittedAttributes::Address.attributes,
|
||||
bill_address_attributes: PermittedAttributes::Address.attributes,
|
||||
)
|
||||
|
||||
@@ -34,12 +34,12 @@ class Customer < ApplicationRecord
|
||||
|
||||
attr_accessor :gateway_recurring_payment_client_secret, :gateway_shop_id
|
||||
|
||||
private
|
||||
|
||||
def full_name
|
||||
"#{first_name} #{last_name}".strip
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def downcase_email
|
||||
email&.downcase!
|
||||
end
|
||||
|
||||
@@ -50,7 +50,8 @@
|
||||
|
||||
%table.index#customers
|
||||
%col.email{ width: "20%", 'ng-show' => 'columns.email.visible' }
|
||||
%col.name{ width: "20%", 'ng-show' => 'columns.name.visible' }
|
||||
%col.first_name{ width: "20%", 'ng-show' => 'columns.first_name.visible' }
|
||||
%col.last_name{ width: "20%", 'ng-show' => 'columns.last_name.visible' }
|
||||
%col.code{ width: "10%", 'ng-show' => 'columns.code.visible' }
|
||||
%col.tags{ width: "20%", 'ng-show' => 'columns.tags.visible' }
|
||||
%col.bill_address{ width: "10%", 'ng-show' => 'columns.bill_address.visible' }
|
||||
@@ -63,8 +64,10 @@
|
||||
-# %input{ :type => "checkbox", :name => 'toggle_bulk', 'ng-click' => 'toggleAllCheckboxes()', 'ng-checked' => "allBoxesChecked()" }
|
||||
%th.email{ 'ng-show' => 'columns.email.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('email')" }=t('admin.email')
|
||||
%th.name{ 'ng-show' => 'columns.name.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('name')" }=t('admin.name')
|
||||
%th.first_name{ 'ng-show' => 'columns.first_name.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('first_name')" }=t('admin.first_name')
|
||||
%th.last_name{ 'ng-show' => 'columns.last_name.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('last_name')" }=t('admin.last_name')
|
||||
%th.code{ 'ng-show' => 'columns.code.visible' }
|
||||
%a{ :href => '', 'ng-click' => "sorting.toggle('code')" }=t('admin.customers.index.code')
|
||||
%th.tags{ 'ng-show' => 'columns.tags.visible' }=t('admin.tags')
|
||||
@@ -78,8 +81,10 @@
|
||||
%td.email{ 'ng-show' => 'columns.email.visible'}
|
||||
%span{ 'ng-bind' => '::customer.email' }
|
||||
%span.guest-label{ 'ng-show' => 'customer.user_id == null' }= t('.guest_label')
|
||||
%td.name{ 'ng-show' => 'columns.name.visible'}
|
||||
%input{ type: 'text', name: 'name', ng: { model: 'customer.name' }, 'obj-for-update' => 'customer', 'attr-for-update' => 'name'}
|
||||
%td.first_name{ 'ng-show' => 'columns.first_name.visible'}
|
||||
%input{ type: 'text', name: 'first_name', ng: { model: 'customer.first_name' }, 'obj-for-update' => 'customer', 'attr-for-update' => 'name'}
|
||||
%td.name{ 'ng-show' => 'columns.last_name.visible'}
|
||||
%input{ type: 'text', name: 'last_name', ng: { model: 'customer.last_name' }, 'obj-for-update' => 'customer', 'attr-for-update' => 'name'}
|
||||
%td.code{ 'ng-show' => 'columns.code.visible' }
|
||||
%input{ type: 'text', name: 'code', ng: {model: 'customer.code', change: 'checkForDuplicateCodes()'}, "obj-for-update" => "customer", "attr-for-update" => "code" }
|
||||
%i.icon-warning-sign{ ng: {if: 'duplicate'} }
|
||||
|
||||
@@ -411,6 +411,8 @@ en_GB:
|
||||
ends_at: Ends At
|
||||
ends_on: Ends On
|
||||
name: Name
|
||||
first_name: First name
|
||||
last_name: Last name
|
||||
on_hand: In Stock
|
||||
on_demand: Unlimited
|
||||
on_demand?: Unlimited?
|
||||
|
||||
@@ -30,7 +30,8 @@ module OpenFoodNetwork
|
||||
node = 'admin.customers.index'
|
||||
{
|
||||
email: { name: I18n.t("admin.email"), visible: true },
|
||||
name: { name: I18n.t("admin.name"), visible: true },
|
||||
first_name: { name: I18n.t("admin.first_name"), visible: true },
|
||||
last_name: { name: I18n.t("admin.last_name"), visible: true },
|
||||
code: { name: I18n.t("#{node}.code"), visible: true },
|
||||
tags: { name: I18n.t("admin.tags"), visible: true },
|
||||
bill_address: { name: I18n.t("#{node}.bill_address"), visible: true },
|
||||
|
||||
@@ -177,7 +177,8 @@ describe 'Customers' do
|
||||
select2_select managed_distributor1.name, from: "shop_id"
|
||||
|
||||
within "tr#c_#{customer1.id}" do
|
||||
expect(find_field('name').value).to eq 'John Doe'
|
||||
expect(find_field('first_name').value).to eq 'John'
|
||||
expect(find_field('last_name').value).to eq 'Doe'
|
||||
|
||||
fill_in "code", with: "new-customer-code"
|
||||
expect(page).to have_css "input[name=code].update-pending"
|
||||
|
||||
Reference in New Issue
Block a user