Browse Source

feat: add order detail modal template to ordering page

pull/92/head
Mahmut Gundogdu 5 years ago
parent
commit
56b4cba004
  1. 233
      apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json
  2. 5
      apps/angular/projects/ordering/src/lib/proxy/orders/models.ts
  3. 26
      apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts
  4. 19
      apps/angular/projects/ordering/src/pages/orders/orders.component.html
  5. 3
      apps/angular/projects/ordering/src/pages/orders/orders.component.ts

233
apps/angular/projects/ordering/src/lib/proxy/generate-proxy.json

@ -215,6 +215,67 @@
"allowAnonymous": null, "allowAnonymous": null,
"implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService"
}, },
"GetListPagedAsyncByInput": {
"uniqueName": "GetListPagedAsyncByInput",
"name": "GetListPagedAsync",
"httpMethod": "GET",
"url": "api/ordering/order/paged",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto, Volo.Abp.Ddd.Application.Contracts",
"type": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto",
"typeSimple": "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "input",
"name": "Sorting",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "ModelBinding",
"descriptorName": "input"
},
{
"nameOnMethod": "input",
"name": "SkipCount",
"jsonName": null,
"type": "System.Int32",
"typeSimple": "number",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "ModelBinding",
"descriptorName": "input"
},
{
"nameOnMethod": "input",
"name": "MaxResultCount",
"jsonName": null,
"type": "System.Int32",
"typeSimple": "number",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "ModelBinding",
"descriptorName": "input"
}
],
"returnValue": {
"type": "Volo.Abp.Application.Dtos.PagedResultDto<EShopOnAbp.OrderingService.Orders.OrderDto>",
"typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto<EShopOnAbp.OrderingService.Orders.OrderDto>"
},
"allowAnonymous": false,
"implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService"
},
"GetByOrderNoAsyncByOrderNo": { "GetByOrderNoAsyncByOrderNo": {
"uniqueName": "GetByOrderNoAsyncByOrderNo", "uniqueName": "GetByOrderNoAsyncByOrderNo",
"name": "GetByOrderNoAsync", "name": "GetByOrderNoAsync",
@ -252,11 +313,11 @@
"allowAnonymous": null, "allowAnonymous": null,
"implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService"
}, },
"UpdateAsyncByIdAndInput": { "SetAsCancelledAsyncByIdAndInput": {
"uniqueName": "UpdateAsyncByIdAndInput", "uniqueName": "SetAsCancelledAsyncByIdAndInput",
"name": "UpdateAsync", "name": "SetAsCancelledAsync",
"httpMethod": "PUT", "httpMethod": "POST",
"url": "api/ordering/order/{id}", "url": "api/ordering/order/{id}/set-as-cancelled",
"supportedVersions": [], "supportedVersions": [],
"parametersOnMethod": [ "parametersOnMethod": [
{ {
@ -269,9 +330,9 @@
}, },
{ {
"name": "input", "name": "input",
"typeAsString": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto, EShopOnAbp.OrderingService.Application.Contracts", "typeAsString": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto, EShopOnAbp.OrderingService.Application.Contracts",
"type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", "type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto",
"typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto",
"isOptional": false, "isOptional": false,
"defaultValue": null "defaultValue": null
} }
@ -293,8 +354,8 @@
"nameOnMethod": "input", "nameOnMethod": "input",
"name": "input", "name": "input",
"jsonName": null, "jsonName": null,
"type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", "type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto",
"typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto", "typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto",
"isOptional": false, "isOptional": false,
"defaultValue": null, "defaultValue": null,
"constraintTypes": null, "constraintTypes": null,
@ -303,10 +364,47 @@
} }
], ],
"returnValue": { "returnValue": {
"type": "EShopOnAbp.OrderingService.Orders.OrderDto", "type": "System.Void",
"typeSimple": "EShopOnAbp.OrderingService.Orders.OrderDto" "typeSimple": "System.Void"
}, },
"allowAnonymous": null, "allowAnonymous": false,
"implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService"
},
"SetAsShippedAsyncById": {
"uniqueName": "SetAsShippedAsyncById",
"name": "SetAsShippedAsync",
"httpMethod": "POST",
"url": "api/ordering/order/{id}/set-as-shipped",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "id",
"typeAsString": "System.Guid, System.Private.CoreLib",
"type": "System.Guid",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "id",
"name": "id",
"jsonName": null,
"type": "System.Guid",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null,
"constraintTypes": [],
"bindingSourceId": "Path",
"descriptorName": ""
}
],
"returnValue": {
"type": "System.Void",
"typeSimple": "System.Void"
},
"allowAnonymous": false,
"implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService" "implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService"
}, },
"CreateAsyncByInput": { "CreateAsyncByInput": {
@ -2098,7 +2196,39 @@
} }
] ]
}, },
"EShopOnAbp.OrderingService.Orders.UpdateOrderDto": { "Volo.Abp.Application.Dtos.PagedAndSortedResultRequestDto": {
"baseType": "Volo.Abp.Application.Dtos.PagedResultRequestDto",
"isEnum": false,
"enumNames": null,
"enumValues": null,
"genericArguments": null,
"properties": [
{
"name": "Sorting",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false
}
]
},
"Volo.Abp.Application.Dtos.PagedResultRequestDto": {
"baseType": "Volo.Abp.Application.Dtos.LimitedResultRequestDto",
"isEnum": false,
"enumNames": null,
"enumValues": null,
"genericArguments": null,
"properties": [
{
"name": "SkipCount",
"jsonName": null,
"type": "System.Int32",
"typeSimple": "number",
"isRequired": false
}
]
},
"Volo.Abp.Application.Dtos.LimitedResultRequestDto": {
"baseType": null, "baseType": null,
"isEnum": false, "isEnum": false,
"enumNames": null, "enumNames": null,
@ -2106,11 +2236,84 @@
"genericArguments": null, "genericArguments": null,
"properties": [ "properties": [
{ {
"name": "OrderStatusId", "name": "DefaultMaxResultCount",
"jsonName": null, "jsonName": null,
"type": "System.Int32", "type": "System.Int32",
"typeSimple": "number", "typeSimple": "number",
"isRequired": false "isRequired": false
},
{
"name": "MaxMaxResultCount",
"jsonName": null,
"type": "System.Int32",
"typeSimple": "number",
"isRequired": false
},
{
"name": "MaxResultCount",
"jsonName": null,
"type": "System.Int32",
"typeSimple": "number",
"isRequired": false
}
]
},
"Volo.Abp.Application.Dtos.PagedResultDto<T0>": {
"baseType": "Volo.Abp.Application.Dtos.ListResultDto<T>",
"isEnum": false,
"enumNames": null,
"enumValues": null,
"genericArguments": [
"T"
],
"properties": [
{
"name": "TotalCount",
"jsonName": null,
"type": "System.Int64",
"typeSimple": "number",
"isRequired": false
}
]
},
"Volo.Abp.Application.Dtos.ListResultDto<T0>": {
"baseType": null,
"isEnum": false,
"enumNames": null,
"enumValues": null,
"genericArguments": [
"T"
],
"properties": [
{
"name": "Items",
"jsonName": null,
"type": "[T]",
"typeSimple": "[T]",
"isRequired": false
}
]
},
"EShopOnAbp.OrderingService.Orders.SetAsCancelledDto": {
"baseType": null,
"isEnum": false,
"enumNames": null,
"enumValues": null,
"genericArguments": null,
"properties": [
{
"name": "PaymentRequestId",
"jsonName": null,
"type": "System.Guid",
"typeSimple": "string",
"isRequired": false
},
{
"name": "PaymentRequestStatus",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
"isRequired": false
} }
] ]
}, },

5
apps/angular/projects/ordering/src/lib/proxy/orders/models.ts

@ -57,6 +57,7 @@ export interface OrderItemDto extends EntityDto<string> {
units: number; units: number;
} }
export interface UpdateOrderDto { export interface SetAsCancelledDto {
orderStatusId: number; paymentRequestId?: string;
paymentRequestStatus?: string;
} }

26
apps/angular/projects/ordering/src/lib/proxy/orders/order.service.ts

@ -1,5 +1,6 @@
import type { GetMyOrdersInput, GetOrdersInput, OrderCreateDto, OrderDto, UpdateOrderDto } from './models'; import type { GetMyOrdersInput, GetOrdersInput, OrderCreateDto, OrderDto, SetAsCancelledDto } from './models';
import { RestService } from '@abp/ng.core'; import { RestService } from '@abp/ng.core';
import type { PagedAndSortedResultRequestDto, PagedResultDto } from '@abp/ng.core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
@Injectable({ @Injectable({
@ -31,6 +32,14 @@ export class OrderService {
}, },
{ apiName: this.apiName }); { apiName: this.apiName });
getListPaged = (input: PagedAndSortedResultRequestDto) =>
this.restService.request<any, PagedResultDto<OrderDto>>({
method: 'GET',
url: '/api/ordering/order/paged',
params: { sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount },
},
{ apiName: this.apiName });
getMyOrders = (input: GetMyOrdersInput) => getMyOrders = (input: GetMyOrdersInput) =>
this.restService.request<any, OrderDto[]>({ this.restService.request<any, OrderDto[]>({
method: 'GET', method: 'GET',
@ -47,13 +56,20 @@ export class OrderService {
}, },
{ apiName: this.apiName }); { apiName: this.apiName });
update = (id: string, input: UpdateOrderDto) => setAsCancelled = (id: string, input: SetAsCancelledDto) =>
this.restService.request<any, OrderDto>({ this.restService.request<any, void>({
method: 'PUT', method: 'POST',
url: `/api/ordering/order/${id}`, url: `/api/ordering/order/${id}/set-as-cancelled`,
body: input, body: input,
}, },
{ apiName: this.apiName }); { apiName: this.apiName });
setAsShipped = (id: string) =>
this.restService.request<any, void>({
method: 'POST',
url: `/api/ordering/order/${id}/set-as-shipped`,
},
{ apiName: this.apiName });
constructor(private restService: RestService) {} constructor(private restService: RestService) {}
} }

19
apps/angular/projects/ordering/src/pages/orders/orders.component.html

@ -10,7 +10,7 @@
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<ngx-datatable [rows]="(list$ | async)" default> <ngx-datatable [rows]="items" [count]="count" [list]="list" default>
<!-- TODO: localize column headers --> <!-- TODO: localize column headers -->
<ngx-datatable-column name="" [sortable]='false' prop="id" > <ngx-datatable-column name="" [sortable]='false' prop="id" >
<ng-template let-id="value" let-row="row" ngx-datatable-cell-template> <ng-template let-id="value" let-row="row" ngx-datatable-cell-template>
@ -27,16 +27,22 @@
<button <button
class="dropdown-item" class="dropdown-item"
(click)='openModal(row)' (click)='openModal(row)'
> >
{{ 'AbpOrdering::Detail' | abpLocalization }} {{ 'AbpOrdering::Detail' | abpLocalization }}
</button> </button>
<button <button
class="dropdown-item" class="dropdown-item"
(click)='openModal(row)' (click)='setAsShipped(row)'
> >
{{ 'AbpUi::Delete' | abpLocalization }} {{ 'AbpOrdering::SetAsShipped' | abpLocalization }}
</button> </button>
<!-- Todo: Add permissions -->
<button
class="dropdown-item"
(click)='setAsCancelled(row)'
>
{{ 'AbpOrdering::SetAsCancelled' | abpLocalization }}
</button>
</div> </div>
</div> </div>
</ng-template> </ng-template>
@ -53,9 +59,6 @@
</ng-template> </ng-template>
</ngx-datatable-column> </ngx-datatable-column>
<ngx-datatable-column name="OrderStatus" prop="orderStatus"></ngx-datatable-column> <ngx-datatable-column name="OrderStatus" prop="orderStatus"></ngx-datatable-column>
<ngx-datatable-column name="OrderStatus" prop="orderStatus"></ngx-datatable-column>
</ngx-datatable> </ngx-datatable>
</div> </div>
</div> </div>
@ -63,4 +66,4 @@
<lib-order-detail [visible]='isModalVisible' (visibleChange)='closeModal($event)' [order]='selectedOrder' > <lib-order-detail [visible]='isModalVisible' (visibleChange)='closeModal($event)' [order]='selectedOrder' >
</lib-order-detail> </lib-order-detail>

3
apps/angular/projects/ordering/src/pages/orders/orders.component.ts

@ -29,6 +29,7 @@ export class OrdersComponent implements OnInit {
}); });
} }
openModal(order: OrderViewModel) { openModal(order: OrderViewModel) {
if (!order){ if (!order){
return; return;
@ -60,7 +61,7 @@ export class OrdersComponent implements OnInit {
setAsCancelled(row: OrderViewModel){ setAsCancelled(row: OrderViewModel){
this.confirmationService this.confirmationService
.warn('AbpOrdering::WillSetAsCancelled', { key: '::AreYouSure', defaultValue: 'Are you sure?' }) .warn('AbpOrdering::WillSetAsCancelled', { key: '::AreYouSure', defaultValue: 'Are you sure?' })
.subscribe((status``) => { .subscribe((status) => {
if (status !== Confirmation.Status.confirm) { if (status !== Confirmation.Status.confirm) {
return; return;
} }

Loading…
Cancel
Save