Skip to content

Commit

Permalink
feat(admin-ui): Filter Customer list by customer last name
Browse files Browse the repository at this point in the history
Relates to #572
  • Loading branch information
michaelbromley committed Apr 9, 2021
1 parent 690dfa7 commit 6df325b
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 39 deletions.
26 changes: 13 additions & 13 deletions packages/admin-ui/i18n-coverage.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"generatedOn": "2021-04-08T14:39:29.656Z",
"lastCommit": "ce147dc13e139be6d734016f43f7abeed9fac8d9",
"generatedOn": "2021-04-09T14:18:31.239Z",
"lastCommit": "97642e71b1f39150975152147114d992cca22b0a",
"translationStatus": {
"cs": {
"tokenCount": 773,
"translatedCount": 753,
"translatedCount": 751,
"percentage": 97
},
"de": {
"tokenCount": 773,
"translatedCount": 731,
"percentage": 95
"translatedCount": 729,
"percentage": 94
},
"en": {
"tokenCount": 773,
Expand All @@ -19,33 +19,33 @@
},
"es": {
"tokenCount": 773,
"translatedCount": 456,
"translatedCount": 454,
"percentage": 59
},
"fr": {
"tokenCount": 773,
"translatedCount": 690,
"translatedCount": 688,
"percentage": 89
},
"pl": {
"tokenCount": 773,
"translatedCount": 549,
"translatedCount": 547,
"percentage": 71
},
"pt_BR": {
"tokenCount": 773,
"translatedCount": 749,
"translatedCount": 747,
"percentage": 97
},
"zh_Hans": {
"tokenCount": 773,
"translatedCount": 531,
"percentage": 69
"translatedCount": 529,
"percentage": 68
},
"zh_Hant": {
"tokenCount": 773,
"translatedCount": 531,
"percentage": 69
"translatedCount": 529,
"percentage": 68
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@
<vdr-ab-left>
<input
type="text"
name="searchTerm"
[formControl]="searchTerm"
name="emailSearchTerm"
[formControl]="emailSearchTerm"
[placeholder]="'customer.search-customers-by-email' | translate"
class="search-input ml3"
/>
<input
type="text"
name="lastNameSearchTerm"
[formControl]="lastNameSearchTerm"
[placeholder]="'customer.search-customers-by-last-name' | translate"
class="search-input ml3"
/>
</vdr-ab-left>
<vdr-ab-right>
<vdr-action-bar-items locationId="customer-list"></vdr-action-bar-items>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
NotificationService,
} from '@vendure/admin-ui/core';
import { SortOrder } from '@vendure/common/lib/generated-shop-types';
import { EMPTY } from 'rxjs';
import { debounceTime, switchMap, takeUntil } from 'rxjs/operators';
import { EMPTY, merge } from 'rxjs';
import { debounceTime, filter, switchMap, takeUntil } from 'rxjs/operators';

@Component({
selector: 'vdr-customer-list',
Expand All @@ -21,7 +21,8 @@ import { debounceTime, switchMap, takeUntil } from 'rxjs/operators';
export class CustomerListComponent
extends BaseListComponent<GetCustomerList.Query, GetCustomerList.Items>
implements OnInit {
searchTerm = new FormControl('');
emailSearchTerm = new FormControl('');
lastNameSearchTerm = new FormControl('');
constructor(
private dataService: DataService,
router: Router,
Expand All @@ -39,7 +40,10 @@ export class CustomerListComponent
take,
filter: {
emailAddress: {
contains: this.searchTerm.value,
contains: this.emailSearchTerm.value,
},
lastName: {
contains: this.lastNameSearchTerm.value,
},
},
sort: {
Expand All @@ -52,8 +56,12 @@ export class CustomerListComponent

ngOnInit() {
super.ngOnInit();
this.searchTerm.valueChanges
.pipe(debounceTime(250), takeUntil(this.destroy$))
merge(this.emailSearchTerm.valueChanges, this.lastNameSearchTerm.valueChanges)
.pipe(
filter(value => 2 < value.length || value.length === 0),
debounceTime(250),
takeUntil(this.destroy$),
)
.subscribe(() => this.refresh());
}

Expand Down
4 changes: 2 additions & 2 deletions packages/admin-ui/src/lib/static/i18n-messages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"details": "Detaily",
"disabled": "Vypnuto",
"discard-changes": "Zrušit změny",
"display-custom-fields": "Zobrazit extra pole",
"edit": "Upravit",
"edit-field": "Upravit pole",
"edit-note": "Upravit poznámku",
Expand All @@ -194,7 +193,6 @@
"extension-running-in-separate-window": "Rozšíření běží v novém okně",
"filter": "",
"guest": "Host",
"hide-custom-fields": "Skrýt extra pole",
"items-per-page-option": "{ count } na stránku",
"language": "Jazyk",
"launch-extension": "Spustit rozšíření",
Expand Down Expand Up @@ -297,6 +295,7 @@
"remove-customers-from-group-success": "Odebrán: {customerCount, plural, one {1 zákazník} other {{customerCount} zákazníci/zákazníků}} z \"{ groupName }\"",
"remove-from-group": "Odebrat ze skupiny",
"search-customers-by-email": "Hledat podle e-mailové adresy",
"search-customers-by-last-name": "",
"select-customer": "",
"set-as-default-billing-address": "Nastavit jako výchozí fakturační adresu",
"set-as-default-shipping-address": "Nastavit jako výchozí dodací adresu",
Expand Down Expand Up @@ -677,6 +676,7 @@
"refund-with-amount": "Refundovat {amount}",
"refunded-count": "{count} {count, plural, one {položka} other {položky}} refundovány",
"removed-items": "Odebrané položky",
"search-by-customer-last-name": "",
"search-by-order-code": "Hledat na základě kódu objednávky",
"select-state": "Vyberte stav",
"set-fulfillment-state": "Označit jako {state}",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-ui/src/lib/static/i18n-messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"details": "Details",
"disabled": "Deaktiviert",
"discard-changes": "Änderungen verwerfen",
"display-custom-fields": "Benutzerdefinierte Felder anzeigen",
"edit": "Bearbeiten",
"edit-field": "Feld bearbeiten",
"edit-note": "Notiz bearbeiten",
Expand All @@ -194,7 +193,6 @@
"extension-running-in-separate-window": "Die Erweiterung läuft in einem separaten Fenster",
"filter": "Filter",
"guest": "Gast",
"hide-custom-fields": "Benutzerdefinierte Felder ausblenden",
"items-per-page-option": "{ count } pro Seite",
"language": "Sprache",
"launch-extension": "Erweiterung starten",
Expand Down Expand Up @@ -297,6 +295,7 @@
"remove-customers-from-group-success": "{customerCount, plural, one {Kunde} other {{customerCount} Kunden}} aus \"{ groupName }\" entfernt",
"remove-from-group": "Aus dieser Gruppe entfernen",
"search-customers-by-email": "Suche nach E-Mail-Adresse",
"search-customers-by-last-name": "",
"select-customer": "Kunde auswählen",
"set-as-default-billing-address": "Als Standard-Rechnungsadresse festlegen",
"set-as-default-shipping-address": "Als Standard-Versandadresse festlegen",
Expand Down Expand Up @@ -677,6 +676,7 @@
"refund-with-amount": "Rückzahlung {amount}",
"refunded-count": "{count} {count, plural, one {Artikel} other {Artikel}} erstattet",
"removed-items": "Entfernte Artikel",
"search-by-customer-last-name": "",
"search-by-order-code": "Suche nach Bestellnummer",
"select-state": "Status auswählen",
"set-fulfillment-state": "Abwicklungsstatus wählen",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-ui/src/lib/static/i18n-messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"details": "Details",
"disabled": "Disabled",
"discard-changes": "Discard changes",
"display-custom-fields": "Display custom fields",
"edit": "Edit",
"edit-field": "Edit field",
"edit-note": "Edit note",
Expand All @@ -194,7 +193,6 @@
"extension-running-in-separate-window": "Extension is running in a separate window",
"filter": "Filter",
"guest": "Guest",
"hide-custom-fields": "Hide custom fields",
"items-per-page-option": "{ count } per page",
"language": "Language",
"launch-extension": "Launch extension",
Expand Down Expand Up @@ -297,6 +295,7 @@
"remove-customers-from-group-success": "Removed {customerCount, plural, one {1 customer} other {{customerCount} customers}} from \"{ groupName }\"",
"remove-from-group": "Remove from this group",
"search-customers-by-email": "Search by email address",
"search-customers-by-last-name": "Search by last name",
"select-customer": "Select customer",
"set-as-default-billing-address": "Set as default billing",
"set-as-default-shipping-address": "Set as default shipping",
Expand Down Expand Up @@ -677,6 +676,7 @@
"refund-with-amount": "Refund {amount}",
"refunded-count": "{count} {count, plural, one {item} other {items}} refunded",
"removed-items": "Removed items",
"search-by-customer-last-name": "Search by customer last name",
"search-by-order-code": "Search by order code",
"select-state": "Select state",
"set-fulfillment-state": "Mark as {state}",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-ui/src/lib/static/i18n-messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"details": "Detalles",
"disabled": "Deshabilitado",
"discard-changes": "Descartar cambios",
"display-custom-fields": "Mostrar campos personalizados",
"edit": "Editar",
"edit-field": "Editar campo",
"edit-note": "Editar nota",
Expand All @@ -194,7 +193,6 @@
"extension-running-in-separate-window": "La extensión se está ejecutando en una nueva ventana",
"filter": "",
"guest": "Invitado",
"hide-custom-fields": "Ocultar campos personalizados",
"items-per-page-option": "{ count } por página",
"language": "Idioma",
"launch-extension": "Ejecutar extensión",
Expand Down Expand Up @@ -297,6 +295,7 @@
"remove-customers-from-group-success": "",
"remove-from-group": "",
"search-customers-by-email": "",
"search-customers-by-last-name": "",
"select-customer": "",
"set-as-default-billing-address": "Seleccionar como dirección de facturación por defecto",
"set-as-default-shipping-address": "Seleccionar como dirección de envío por defecto",
Expand Down Expand Up @@ -677,6 +676,7 @@
"refund-with-amount": "",
"refunded-count": "",
"removed-items": "",
"search-by-customer-last-name": "",
"search-by-order-code": "",
"select-state": "",
"set-fulfillment-state": "",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-ui/src/lib/static/i18n-messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"details": "Détails",
"disabled": "Desactiver",
"discard-changes": "Annuler les changements",
"display-custom-fields": "Affichier les champs personnalisés",
"edit": "Editer",
"edit-field": "Editer champ",
"edit-note": "Editer note",
Expand All @@ -194,7 +193,6 @@
"extension-running-in-separate-window": "Extension fonctionne dans une fenêtre à part",
"filter": "",
"guest": "Invité",
"hide-custom-fields": "Cacher les champs personnalisés",
"items-per-page-option": "{ count } par page",
"language": "Langue",
"launch-extension": "Lancer extension",
Expand Down Expand Up @@ -297,6 +295,7 @@
"remove-customers-from-group-success": "Retrait {customerCount, plural, one {d'un client} other {de {customerCount} clients}} de \"{ groupName }\"",
"remove-from-group": "Retirer de ce groupe",
"search-customers-by-email": "Chercher par adresse email",
"search-customers-by-last-name": "",
"select-customer": "",
"set-as-default-billing-address": "Etablir en tant qu'adresse de facturation par défaut",
"set-as-default-shipping-address": "Etablir en tant qu'adresse de livraison par défaut",
Expand Down Expand Up @@ -677,6 +676,7 @@
"refund-with-amount": "Rembourser {amount}",
"refunded-count": "{count} {count, plural, one {article remboursé} other {articles remboursés}}",
"removed-items": "",
"search-by-customer-last-name": "",
"search-by-order-code": "Chercher par numéro de commande",
"select-state": "",
"set-fulfillment-state": "Marquer {state}",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-ui/src/lib/static/i18n-messages/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"details": "",
"disabled": "Wyłączony",
"discard-changes": "Odrzuć zmiany",
"display-custom-fields": "Wyświetl pola dodatkowe",
"edit": "Edytuj",
"edit-field": "Edytuj pole",
"edit-note": "",
Expand All @@ -194,7 +193,6 @@
"extension-running-in-separate-window": "Rozszerzenie jest włączone w innym oknie",
"filter": "",
"guest": "Gość",
"hide-custom-fields": "Ukryj pola dodatkowe",
"items-per-page-option": "{ count } na stronę",
"language": "Język",
"launch-extension": "Uruchom rozszerzenie",
Expand Down Expand Up @@ -297,6 +295,7 @@
"remove-customers-from-group-success": "",
"remove-from-group": "",
"search-customers-by-email": "Szukaj przez email",
"search-customers-by-last-name": "",
"select-customer": "",
"set-as-default-billing-address": "Ustaw jako domyślny adres rozliczeniowy",
"set-as-default-shipping-address": "Ustaw jako domyślny adres wysyłki",
Expand Down Expand Up @@ -677,6 +676,7 @@
"refund-with-amount": "Zwróć {amount}",
"refunded-count": "{count} {count, plural, one {zamówienie} other {zamówień}} zwrócono",
"removed-items": "",
"search-by-customer-last-name": "",
"search-by-order-code": "Szukaj po numerze zamówienia",
"select-state": "",
"set-fulfillment-state": "",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-ui/src/lib/static/i18n-messages/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"details": "Detalhes",
"disabled": "Desabilitado",
"discard-changes": "Descartar modificações",
"display-custom-fields": "Exibir campos personalizados",
"edit": "Editar",
"edit-field": "Editar campo",
"edit-note": "Editar nota",
Expand All @@ -194,7 +193,6 @@
"extension-running-in-separate-window": "A extensão está sendo executada em uma janela separada",
"filter": "Filtro",
"guest": "Convidado",
"hide-custom-fields": "Ocultar campos personalizados",
"items-per-page-option": "{ count } por página",
"language": "Idioma",
"launch-extension": "Iniciar extensão",
Expand Down Expand Up @@ -297,6 +295,7 @@
"remove-customers-from-group-success": "Excluído {customerCount, plural, one {1 customer} other {{customerCount} customers}} from \"{ groupName }\"",
"remove-from-group": "Excluir deste grupo",
"search-customers-by-email": "Busca por email",
"search-customers-by-last-name": "",
"select-customer": "",
"set-as-default-billing-address": "Definir como cobrança padrão",
"set-as-default-shipping-address": "Definir como remessa padrão",
Expand Down Expand Up @@ -677,6 +676,7 @@
"refund-with-amount": "Reembolso {amount}",
"refunded-count": "{count} {count, plural, one {item} other {items}} reembolsado",
"removed-items": "Itens removidos",
"search-by-customer-last-name": "",
"search-by-order-code": "Buscar por código do pedido",
"select-state": "Selecionar estado",
"set-fulfillment-state": "Marcar como {state}",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin-ui/src/lib/static/i18n-messages/zh_Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"details": "",
"disabled": "禁用",
"discard-changes": "放弃修改",
"display-custom-fields": "显示客户化字段",
"edit": "编辑",
"edit-field": "编辑域",
"edit-note": "",
Expand All @@ -194,7 +193,6 @@
"extension-running-in-separate-window": "扩展已在另一个窗口启动",
"filter": "",
"guest": "游客",
"hide-custom-fields": "隐藏客户化字段",
"items-per-page-option": "每页显示 { count } 条",
"language": "语言",
"launch-extension": "启动扩展插件",
Expand Down Expand Up @@ -297,6 +295,7 @@
"remove-customers-from-group-success": "",
"remove-from-group": "",
"search-customers-by-email": "输入要搜索的客户邮件地址",
"search-customers-by-last-name": "",
"select-customer": "",
"set-as-default-billing-address": "设置为默认账单地址",
"set-as-default-shipping-address": "设置为默认邮寄地址",
Expand Down Expand Up @@ -677,6 +676,7 @@
"refund-with-amount": "退款金额{amount}",
"refunded-count": "{count}个商品已退款",
"removed-items": "",
"search-by-customer-last-name": "",
"search-by-order-code": "输入要搜索的订单编号",
"select-state": "",
"set-fulfillment-state": "",
Expand Down
Loading

0 comments on commit 6df325b

Please sign in to comment.