From 097012a904d71ef47bc938c3af6c3413c9f4ca1f Mon Sep 17 00:00:00 2001 From: Adrian Andersen Date: Wed, 9 Oct 2024 19:19:36 +0200 Subject: [PATCH] feat(branch-select): sort by branch name --- .../blc-branch-select/blc-branch-select.component.ts | 4 +++- .../customer-item-detail/customer-item-detail.component.ts | 4 +++- .../order-detail-card/order-detail-card.component.ts | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/bl-common/blc-branch/blc-branch-select/blc-branch-select.component.ts b/src/app/bl-common/blc-branch/blc-branch-select/blc-branch-select.component.ts index 22464d9b..6e6c8e35 100644 --- a/src/app/bl-common/blc-branch/blc-branch-select/blc-branch-select.component.ts +++ b/src/app/bl-common/blc-branch/blc-branch-select/blc-branch-select.component.ts @@ -24,7 +24,9 @@ export class BlcBranchSelectComponent implements OnInit { this.branchService .get() .then((branches: Branch[]) => { - this.branches = branches; + this.branches = branches.sort((a, b) => + a.name.localeCompare(b.name, "no") + ); this.selectAll(); }) .catch(() => { diff --git a/src/app/customer-item/customer-item-detail/customer-item-detail.component.ts b/src/app/customer-item/customer-item-detail/customer-item-detail.component.ts index 6c731692..618fd25f 100644 --- a/src/app/customer-item/customer-item-detail/customer-item-detail.component.ts +++ b/src/app/customer-item/customer-item-detail/customer-item-detail.component.ts @@ -52,7 +52,9 @@ export class CustomerItemDetailComponent implements OnInit { private async getAllBranches() { this._branchService.get().then((branches: Branch[]) => { - this.branches = branches; + this.branches = branches.sort((a, b) => + a.name.localeCompare(b.name, "no") + ); }); } diff --git a/src/app/order/order-detail/order-detail-card/order-detail-card.component.ts b/src/app/order/order-detail/order-detail-card/order-detail-card.component.ts index ac7a1ceb..af6deba0 100644 --- a/src/app/order/order-detail/order-detail-card/order-detail-card.component.ts +++ b/src/app/order/order-detail/order-detail-card/order-detail-card.component.ts @@ -42,7 +42,9 @@ export class OrderDetailCardComponent implements OnInit { private async getAllBranches() { this._branchService.get().then((branches: Branch[]) => { - this.branches = branches; + this.branches = branches.sort((a, b) => + a.name.localeCompare(b.name, "no") + ); }); }