Add the ability to show ID on backoffice customer screen

The customer ID is needed for the customer account transaction api
This commit is contained in:
Gaetan Craig-Riou
2026-03-01 14:01:48 +11:00
parent b9b91620ef
commit 597c0590ed
3 changed files with 6 additions and 0 deletions

View File

@@ -48,6 +48,7 @@
%input.red{ type: "button", value: t(:save_changes), "ng-click": "submitAll(customers_form)", "ng-disabled": "!hasUnsavedChanges()" }
%table.index#customers{ 'ng-show' => '!RequestMonitor.loading && filteredCustomers.length > 0' }
%col.id{ width: "5%", 'ng-show' => 'columns.id.visible' }
%col.email{ width: "20%", 'ng-show' => 'columns.email.visible' }
%col.first_name{ width: "20%", 'ng-show' => 'columns.first_name.visible' }
%col.last_name{ width: "20%", 'ng-show' => 'columns.last_name.visible' }
@@ -61,6 +62,7 @@
%tr{ "ng-controller": "ColumnsCtrl" }
-# %th.bulk
-# %input{ :type => "checkbox", :name => 'toggle_bulk', 'ng-click' => 'toggleAllCheckboxes()', 'ng-checked' => "allBoxesChecked()" }
%th.id{ 'ng-show' => 'columns.id.visible' }=t('admin.customers.index.id')
%th.email{ 'ng-show' => 'columns.email.visible' }
%a{ :href => '', 'ng-click' => "sorting.toggle('email')" }=t('admin.email')
%th.first_name{ 'ng-show' => 'columns.first_name.visible' }
@@ -78,6 +80,8 @@
%tr.customer{ 'ng-repeat' => "customer in filteredCustomers = ( customers | filter:quickSearch | orderBy: sorting.predicate:sorting.reverse ) | limitTo:customerLimit track by customer.id", 'ng-class-even' => "'even'", 'ng-class-odd' => "'odd'", :id => "c_{{customer.id}}" }
-# %td.bulk
-# %input{ :type => "checkbox", :name => 'bulk', 'ng-model' => 'customer.checked' }
%td.id{ 'ng-show' => 'columns.id.visible'}
%span{ 'ng-bind' => '::customer.id' }
%td.email{ 'ng-show' => 'columns.email.visible'}
%span{ 'ng-bind' => '::customer.email' }
%span.guest-label{ 'ng-show' => 'customer.user_id == null' }= t('.guest_label')

View File

@@ -892,6 +892,7 @@ en:
guest_label: "Guest checkout"
credit_owed: "Credit Owed"
balance_due: "Balance Due"
id: Id
destroy:
has_associated_subscriptions: "Delete failed: This customer has active subscriptions. Cancel them first."
customer_account_transaction:

View File

@@ -29,6 +29,7 @@ module OpenFoodNetwork
def customers_index_columns
node = 'admin.customers.index'
{
id: { name: I18n.t("#{node}.id"), visible: false },
email: { name: I18n.t("admin.email"), visible: true },
first_name: { name: I18n.t("admin.first_name"), visible: true },
last_name: { name: I18n.t("admin.last_name"), visible: true },