From d2011b63906b73cb44ea80cdde8e580b70a9ded8 Mon Sep 17 00:00:00 2001 From: Bello Babakolo Date: Sat, 31 Aug 2024 19:14:02 +0100 Subject: [PATCH] chore: refactor order-items components --- .../order-items/order-item.component.html | 75 +++++++++++++++++++ .../order-items/order-item.component.ts | 21 ++++++ .../modules/ui/src/lib/modules-ui.module.ts | 2 + 3 files changed, 98 insertions(+) create mode 100644 packages/modules/ui/src/lib/components/molecules/order-items/order-item.component.html create mode 100644 packages/modules/ui/src/lib/components/molecules/order-items/order-item.component.ts diff --git a/packages/modules/ui/src/lib/components/molecules/order-items/order-item.component.html b/packages/modules/ui/src/lib/components/molecules/order-items/order-item.component.html new file mode 100644 index 00000000..63bb5a2f --- /dev/null +++ b/packages/modules/ui/src/lib/components/molecules/order-items/order-item.component.html @@ -0,0 +1,75 @@ +
+
+

{{ item.product?.product?.name }}

+
+ +
+ +
+
+ +
[Qty: {{ item.quantity }}]
+ +
+ {{ item.productId }} +
+
'No variant': {{ item.variantId }}
+ + +

+ Price: {{ item.unitPrice?.currency || 'EUR' }} + {{ item.unitPrice?.regularPrice }} +

+ + +
+ + + + +
+
diff --git a/packages/modules/ui/src/lib/components/molecules/order-items/order-item.component.ts b/packages/modules/ui/src/lib/components/molecules/order-items/order-item.component.ts new file mode 100644 index 00000000..6078c775 --- /dev/null +++ b/packages/modules/ui/src/lib/components/molecules/order-items/order-item.component.ts @@ -0,0 +1,21 @@ +import { + ChangeDetectionStrategy, + Component, + EventEmitter, + Input, + Output, +} from '@angular/core'; + +import { IoRestorecommerceOrderItem } from '@console-core/graphql'; + +@Component({ + selector: 'rc-order-item', + templateUrl: './order-item.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class RcOrderItemComponent { + @Input({ required: true }) + item!: IoRestorecommerceOrderItem; + + @Output() openEditItemModal = new EventEmitter(); +} diff --git a/packages/modules/ui/src/lib/modules-ui.module.ts b/packages/modules/ui/src/lib/modules-ui.module.ts index c8f4e69b..37be965b 100644 --- a/packages/modules/ui/src/lib/modules-ui.module.ts +++ b/packages/modules/ui/src/lib/modules-ui.module.ts @@ -50,6 +50,7 @@ import { RcProductVariantsComponent, RcProductImagesComponent, } from './components/molecules'; +import { RcOrderItemComponent } from './components/molecules/order-items/order-item.component'; import { RcAppComponent, RcSignUpComponent, @@ -166,6 +167,7 @@ const molecules = [ RcProductVariantComponent, RcProductVariantsComponent, RcProductImagesComponent, + RcOrderItemComponent, ]; const organisms = [