diff --git a/apps/angular/projects/ordering/src/lib/index.ts b/apps/angular/projects/ordering/src/lib/index.ts
new file mode 100644
index 00000000..0186f742
--- /dev/null
+++ b/apps/angular/projects/ordering/src/lib/index.ts
@@ -0,0 +1,3 @@
+export * from './order-view-model';
+export * from './proxy';
+export * from './to-order-view-model';
diff --git a/apps/angular/projects/ordering/src/lib/order-view-model.ts b/apps/angular/projects/ordering/src/lib/order-view-model.ts
new file mode 100644
index 00000000..0fee9573
--- /dev/null
+++ b/apps/angular/projects/ordering/src/lib/order-view-model.ts
@@ -0,0 +1,5 @@
+import { OrderDto } from './proxy/orders';
+
+export interface OrderViewModel extends OrderDto {
+ orderTotal: number;
+}
diff --git a/apps/angular/projects/ordering/src/lib/to-order-view-model.ts b/apps/angular/projects/ordering/src/lib/to-order-view-model.ts
new file mode 100644
index 00000000..eadb2605
--- /dev/null
+++ b/apps/angular/projects/ordering/src/lib/to-order-view-model.ts
@@ -0,0 +1,8 @@
+import { OrderDto } from './proxy/orders';
+import { OrderViewModel } from './order-view-model';
+
+const mapItem = (x: OrderDto): OrderViewModel => {
+ const orderTotal = x.items?.reduce((acc, curr) => ( acc + (curr.unitPrice * curr.units)), 0) || 0;
+ return {...x, orderTotal};
+};
+export const toOrderViewModel = (orders: OrderDto[]) => orders.map(mapItem);
diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts
new file mode 100644
index 00000000..e6152131
--- /dev/null
+++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail-item/order-detail-item.component.ts
@@ -0,0 +1,21 @@
+import { Component, Input } from '@angular/core';
+
+@Component({
+ selector: 'lib-order-detail-item',
+ template: `
+
+ `,
+ styles: []
+})
+export class OrderDetailItemComponent {
+
+ @Input()
+ label = '';
+}
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 f1398c61..d802e87e 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,16 +1,67 @@
-
-
-
+
- Modal Title
+ Order Detail
- Modal content
+
+
+
+ #{{order.orderNo}}
+ {{order.orderStatus}}
+ {{order.buyer.name}}
+ {{order.buyer.email}}
+
+
+
+ {{address.description}}
+ {{address.street}}
+ {{address.zipCode}}
+ {{address.city}} / {{address.country}}
+
+
+ {{order.paymentMethod}}
+ {{order.orderTotal | currency}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{value | currency }}
+
+
+
+
+
+
+ {{value }} %
+
+
+
+
+ {{(row.units * row.unitPrice) | currency }}
+
+
+
+
+
+
+
-
diff --git a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts
index cbd0d0b9..0cda0a8f 100644
--- a/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts
+++ b/apps/angular/projects/ordering/src/pages/orders/order-detail/order-detail.component.ts
@@ -1,22 +1,17 @@
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
-import { OrderDto } from '../../../lib/proxy/orders';
+import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { OrderViewModel } from '../../../lib/order-view-model';
+import { environment } from '../../../../../../src/environments/environment';
@Component({
selector: 'lib-order-detail',
templateUrl: './order-detail.component.html'
})
-export class OrderDetailComponent implements OnInit {
-
+export class OrderDetailComponent {
+ modalOption = { size: 'xl' }
@Input()
visible: boolean;
@Input()
- order: OrderDto | undefined;
-
+ order: OrderViewModel | undefined;
+ mediaServerUrl = environment.mediaServerUrl;
@Output() readonly visibleChange = new EventEmitter();
-
- constructor() { }
-
- ngOnInit(): void {
- }
-
}
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 1e66c318..0501af0c 100644
--- a/apps/angular/projects/ordering/src/pages/orders/orders.component.html
+++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.html
@@ -4,36 +4,63 @@
+
+
+
+
+ {{ 'AbpUi::Actions' | abpLocalization }}
+
+
+
+ {{ 'AbpOrdering::Detail' | abpLocalization }}
+
+
+ {{ 'AbpUi::Delete' | abpLocalization }}
+
+
+
+
+
-
- {{ value | date }}
+ {{ value | date }}
-
-
-
-
- {{ 'AbpCatalog::Detail' | abpLocalization }}
-
+
+
+ {{ value | currency }}
-
-
+
-
-
+
+
+
+
+
+
+
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 cf83d309..3fb843c2 100644
--- a/apps/angular/projects/ordering/src/pages/orders/orders.component.ts
+++ b/apps/angular/projects/ordering/src/pages/orders/orders.component.ts
@@ -1,20 +1,73 @@
import { Component, OnInit } from '@angular/core';
-import { OrderDto, OrderService } from '../../lib/proxy/orders';
+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';
@Component({
selector: 'lib-orders',
templateUrl: './orders.component.html',
- styleUrls: ['./orders.component.css']
+ styleUrls: ['./orders.component.css'],
+ providers: [ListService],
})
export class OrdersComponent implements OnInit {
- constructor(private orderService: OrderService) { }
- list$ = this.orderService.getOrders({});
- selectedOrder: OrderDto | undefined;
+ constructor(private service: OrderService,
+ public list: ListService,
+ private confirmationService: ConfirmationService) { }
+ selectedOrder: OrderViewModel | undefined;
isModalVisible = false;
- ngOnInit(): void {}
+ items: OrderViewModel[];
+ count = 0;
+ ngOnInit(): void {
- openModal(id: string) {
+ const ordersStreamCreator = query => this.service.getListPaged(query);
+
+ this.list.hookToQuery(ordersStreamCreator).subscribe(response => {
+ this.items = toOrderViewModel(response.items);
+ this.count = response.totalCount;
+ });
+ }
+
+ openModal(order: OrderViewModel) {
+ if (!order){
+ return;
+ }
+ this.selectedOrder = order;
this.isModalVisible = true;
}
+
+ closeModal(isVisible: boolean){
+ if (isVisible){
+ return;
+ }
+ this.selectedOrder = null;
+ this.isModalVisible = false;
+ }
+
+ setAsShipped(row: OrderViewModel) {
+ this.confirmationService
+ .warn('AbpOrdering::WillSetAsShipped', { key: '::AreYouSure', defaultValue: 'Are you sure?' })
+ .subscribe((status) => {
+ if (status !== Confirmation.Status.confirm) {
+ return;
+ }
+ this.service.setAsShipped(row.id).subscribe(() => {
+ this.list.get();
+ });
+ });
+ }
+ setAsCancelled(row: OrderViewModel){
+ this.confirmationService
+ .warn('AbpOrdering::WillSetAsCancelled', { key: '::AreYouSure', defaultValue: 'Are you sure?' })
+ .subscribe((status``) => {
+ if (status !== Confirmation.Status.confirm) {
+ return;
+ }
+ this.service.setAsCancelled(row.id, { paymentRequestId: undefined, paymentRequestStatus: undefined}).subscribe(() => {
+ this.list.get();
+ });
+ })
+ ;
+ }
}
diff --git a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts
index 78ea50b9..fcc888c4 100644
--- a/apps/angular/projects/ordering/src/pages/orders/orders.module.ts
+++ b/apps/angular/projects/ordering/src/pages/orders/orders.module.ts
@@ -6,15 +6,19 @@ import { OrdersComponent } from './orders.component';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { CoreModule } from '@abp/ng.core';
import { OrderDetailComponent } from './order-detail/order-detail.component';
+import { OrderDetailItemComponent } from './order-detail/order-detail-item/order-detail-item.component';
+import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
@NgModule({
declarations: [
OrdersComponent,
- OrderDetailComponent
+ OrderDetailComponent,
+ OrderDetailItemComponent
],
imports: [
CommonModule,
+ NgbDropdownModule,
OrdersRoutingModule,
ThemeSharedModule,
CoreModule,
diff --git a/apps/angular/src/environments/environment.prod.ts b/apps/angular/src/environments/environment.prod.ts
index 9cc0851e..d54bc574 100644
--- a/apps/angular/src/environments/environment.prod.ts
+++ b/apps/angular/src/environments/environment.prod.ts
@@ -1,4 +1,4 @@
-import { Environment } from '@abp/ng.core';
+import { MyEnvironment } from './my-environment';
const baseUrl = 'http://localhost:4200';
@@ -22,8 +22,8 @@ export const environment = {
rootNamespace: 'EShopOnAbp',
},
},
- remoteEnv:{
- url: "/getEnvConfig",
- mergeStrategy:'deepmerge'
+ remoteEnv: {
+ url: '/getEnvConfig',
+ mergeStrategy: 'deepmerge'
}
-} as Environment;
+} as MyEnvironment;
diff --git a/apps/angular/src/environments/environment.ts b/apps/angular/src/environments/environment.ts
index d95bd122..23de1afb 100644
--- a/apps/angular/src/environments/environment.ts
+++ b/apps/angular/src/environments/environment.ts
@@ -1,4 +1,4 @@
-import { Environment } from '@abp/ng.core';
+import { MyEnvironment } from './my-environment';
const baseUrl = 'http://localhost:4200';
@@ -25,9 +25,12 @@ export const environment = {
url: 'https://localhost:44354',
rootNamespace: 'EShopOnAbp.CatalogService',
},
- Ordering:{
+ Ordering: {
url: "https://localhost:44356",
rootNamespace: 'EShopOnAbp.OrderingService',
}
},
-} as Environment;
+ mediaServerUrl:'https://localhost:44335'
+} as MyEnvironment;
+
+
diff --git a/apps/angular/src/environments/my-environment.ts b/apps/angular/src/environments/my-environment.ts
new file mode 100644
index 00000000..5bae69f1
--- /dev/null
+++ b/apps/angular/src/environments/my-environment.ts
@@ -0,0 +1,5 @@
+import { Environment } from '@abp/ng.core';
+
+export interface MyEnvironment extends Environment{
+ mediaServerUrl?: string;
+}
diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml
index 4b0bcd39..344b969e 100644
--- a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml
+++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml
@@ -13,7 +13,7 @@
@foreach (var order in Model.UserOrders)
{
- var orderTotalString = order.Items.Sum(q => q.UnitPrice).ToString("C", new CultureInfo("en-US"));
+ var orderTotalString = order.Items.Sum(q => q.UnitPrice * q.Units).ToString("C", new CultureInfo("en-US"));
string addressString = $"{order.Address.Street} {order.Address.ZipCode} \n {order.Address.City}/{order.Address.Country}";