From 98662a1a968e378d427e03498ea797e9d9ea2219 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Wed, 16 Mar 2022 14:26:00 +0300 Subject: [PATCH] feat: add order detail page localization and permission --- .../ordering/config/src/enums/policy-names.ts | 9 +++-- .../ordering/config/src/enums/route-names.ts | 2 +- .../config/src/providers/route.provider.ts | 3 +- .../order-detail/order-detail.component.html | 34 +++++++++---------- .../src/pages/orders/orders.component.html | 9 +++-- .../src/pages/orders/orders.component.ts | 6 ++++ .../Localization/OrderingService/en.json | 15 +++++++- 7 files changed, 49 insertions(+), 29 deletions(-) diff --git a/apps/angular/projects/ordering/config/src/enums/policy-names.ts b/apps/angular/projects/ordering/config/src/enums/policy-names.ts index 6ddc7800..28b6edd3 100644 --- a/apps/angular/projects/ordering/config/src/enums/policy-names.ts +++ b/apps/angular/projects/ordering/config/src/enums/policy-names.ts @@ -1,7 +1,6 @@ export const enum eOrderingPolicyNames { - Ordering = 'CatalogService.Products', - - ProductManagementCreate = 'CatalogService.Products.Create', - ProductManagementUpdate = 'CatalogService.Products.Update', - ProductManagementDelete = 'CatalogService.Products.Delete', + ordering = 'OrderingService.Orders', + detail = 'OrderingService.Orders.Orders', + setAsShipped = 'OrderingService.Orders.SetAsShipped', + setAsCancelled = 'OrderingService.Products.SetAsCancelled', } diff --git a/apps/angular/projects/ordering/config/src/enums/route-names.ts b/apps/angular/projects/ordering/config/src/enums/route-names.ts index 4d3606c8..6dc09b1f 100644 --- a/apps/angular/projects/ordering/config/src/enums/route-names.ts +++ b/apps/angular/projects/ordering/config/src/enums/route-names.ts @@ -1,3 +1,3 @@ export const enum eOrderingRouteNames { - Ordering = 'OrderingService::Menu:OrderManagement' + ordering = 'OrderingService::Menu:OrderManagement' } diff --git a/apps/angular/projects/ordering/config/src/providers/route.provider.ts b/apps/angular/projects/ordering/config/src/providers/route.provider.ts index 9a9848b5..1e892f2d 100644 --- a/apps/angular/projects/ordering/config/src/providers/route.provider.ts +++ b/apps/angular/projects/ordering/config/src/providers/route.provider.ts @@ -12,8 +12,9 @@ export function configureRoutes(routesService: RoutesService) { routesService.add([ { path: '/ordering', - name: eOrderingRouteNames.Ordering, + name: eOrderingRouteNames.ordering, layout: eLayoutType.application, + requiredPolicy: eOrderingPolicyNames.ordering, parentName: null, iconClass: 'bi bi-collection-fill', }, diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html index d802e87e..55a26904 100644 --- a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.html @@ -1,18 +1,18 @@ -

Order Detail

+

{{"OrderingService::ModalTitle" | abpLocalization }}

- #{{order.orderNo}} - {{order.orderStatus}} - {{order.buyer.name}} - {{order.buyer.email}} + #{{order.orderNo}} + {{order.orderStatus}} + {{order.buyer.name}} + {{order.buyer.email}} - + {{address.description}}
{{address.street}}
@@ -20,35 +20,33 @@ {{address.city}} / {{address.country}}
- {{order.paymentMethod}} - {{order.orderTotal | currency}} - + {{order.paymentMethod}} + {{order.orderTotal | currency}}



- - + + - + - - + + {{value | currency }} - - - + + {{value }} % - + {{(row.units * row.unitPrice) | currency }} diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.html b/apps/angular/projects/ordering/src/pages/orders/orders.component.html index 56eb9405..e50f6daf 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.html +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html @@ -27,21 +27,24 @@
diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts index 9a180d7d..723d6bd9 100644 --- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts +++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts @@ -3,6 +3,7 @@ import { OrderService } from '../../lib/proxy/orders'; import { OrderViewModel, toOrderViewModel } from '../../lib'; import { Confirmation, ConfirmationService } from '@abp/ng.theme.shared'; import { ListService } from '@abp/ng.core'; +import { eOrderingPolicyNames } from '@eshoponabp/ordering/config'; @Component({ selector: 'lib-orders', @@ -18,6 +19,11 @@ export class OrdersComponent implements OnInit { isModalVisible = false; items: OrderViewModel[]; count = 0; + permissions = { + detail: eOrderingPolicyNames.ordering, + setAsShipped: eOrderingPolicyNames.setAsShipped, + setAsCancelled: eOrderingPolicyNames.setAsCancelled, + }; ngOnInit(): void { diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json index 57abdfc2..1d50a6c6 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json +++ b/services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Localization/OrderingService/en.json @@ -15,8 +15,21 @@ "DisplayName:OrderNo": "Order No", "DisplayName:OrderDate": "Order Date", - "DisplayName:OrderTotal": "Total", + "DisplayName:OrderTotal": "Order Total", "DisplayName:OrderStatus": "Order Status", + + "DisplayName:ProductId": "Product Id", + "DisplayName:ProductName": "Product Name", + "DisplayName:PictureUrl": "Picture", + "DisplayName:Units": "Unit", + "DisplayName:UnitPrice": "Unit Price", + "DisplayName:Discount": "Discount", + "DisplayName:TotalPrice": "Total Price", + "DisplayName:BuyerName": "Buyer Name", + "DisplayName:BuyerEmail": "Buyer E-mail", + "DisplayName:Address": "Address", + "DisplayName:PaymentMethod": "Payment Method", + "DisplayName:Total": "Total", "Permission:Orders.SetAsCancelled": "Set As Cancelled", "Permission:Orders.SetAsShipped": "Set As Shipped" }