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,
"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": {
"uniqueName": "GetByOrderNoAsyncByOrderNo",
"name": "GetByOrderNoAsync",
@ -252,11 +313,11 @@
"allowAnonymous": null,
"implementFrom": "EShopOnAbp.OrderingService.Orders.IOrderAppService"
},
"UpdateAsyncByIdAndInput": {
"uniqueName": "UpdateAsyncByIdAndInput",
"name": "UpdateAsync",
"httpMethod": "PUT",
"url": "api/ordering/order/{id}",
"SetAsCancelledAsyncByIdAndInput": {
"uniqueName": "SetAsCancelledAsyncByIdAndInput",
"name": "SetAsCancelledAsync",
"httpMethod": "POST",
"url": "api/ordering/order/{id}/set-as-cancelled",
"supportedVersions": [],
"parametersOnMethod": [
{
@ -269,9 +330,9 @@
},
{
"name": "input",
"typeAsString": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto, EShopOnAbp.OrderingService.Application.Contracts",
"type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto",
"typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto",
"typeAsString": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto, EShopOnAbp.OrderingService.Application.Contracts",
"type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto",
"typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto",
"isOptional": false,
"defaultValue": null
}
@ -293,8 +354,8 @@
"nameOnMethod": "input",
"name": "input",
"jsonName": null,
"type": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto",
"typeSimple": "EShopOnAbp.OrderingService.Orders.UpdateOrderDto",
"type": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto",
"typeSimple": "EShopOnAbp.OrderingService.Orders.SetAsCancelledDto",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
@ -303,10 +364,47 @@
}
],
"returnValue": {
"type": "EShopOnAbp.OrderingService.Orders.OrderDto",
"typeSimple": "EShopOnAbp.OrderingService.Orders.OrderDto"
"type": "System.Void",
"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"
},
"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,
"isEnum": false,
"enumNames": null,
@ -2106,11 +2236,84 @@
"genericArguments": null,
"properties": [
{
"name": "OrderStatusId",
"name": "DefaultMaxResultCount",
"jsonName": null,
"type": "System.Int32",
"typeSimple": "number",
"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;
}
export interface UpdateOrderDto {
orderStatusId: number;
export interface SetAsCancelledDto {
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 type { PagedAndSortedResultRequestDto, PagedResultDto } from '@abp/ng.core';
import { Injectable } from '@angular/core';
@Injectable({
@ -31,6 +32,14 @@ export class OrderService {
},
{ 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) =>
this.restService.request<any, OrderDto[]>({
method: 'GET',
@ -47,13 +56,20 @@ export class OrderService {
},
{ apiName: this.apiName });
update = (id: string, input: UpdateOrderDto) =>
this.restService.request<any, OrderDto>({
method: 'PUT',
url: `/api/ordering/order/${id}`,
setAsCancelled = (id: string, input: SetAsCancelledDto) =>
this.restService.request<any, void>({
method: 'POST',
url: `/api/ordering/order/${id}/set-as-cancelled`,
body: input,
},
{ 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) {}
}

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

@ -10,7 +10,7 @@
</div>
</div>
<div class="card-body">
<ngx-datatable [rows]="(list$ | async)" default>
<ngx-datatable [rows]="items" [count]="count" [list]="list" default>
<!-- TODO: localize column headers -->
<ngx-datatable-column name="" [sortable]='false' prop="id" >
<ng-template let-id="value" let-row="row" ngx-datatable-cell-template>
@ -27,16 +27,22 @@
<button
class="dropdown-item"
(click)='openModal(row)'
>
{{ 'AbpOrdering::Detail' | abpLocalization }}
</button>
<button
class="dropdown-item"
(click)='openModal(row)'
(click)='setAsShipped(row)'
>
{{ 'AbpUi::Delete' | abpLocalization }}
{{ 'AbpOrdering::SetAsShipped' | abpLocalization }}
</button>
<!-- Todo: Add permissions -->
<button
class="dropdown-item"
(click)='setAsCancelled(row)'
>
{{ 'AbpOrdering::SetAsCancelled' | abpLocalization }}
</button>
</div>
</div>
</ng-template>
@ -53,9 +59,6 @@
</ng-template>
</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>
</div>
</div>
@ -63,4 +66,4 @@
<lib-order-detail [visible]='isModalVisible' (visibleChange)='closeModal($event)' [order]='selectedOrder' >
</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) {
if (!order){
return;
@ -60,7 +61,7 @@ export class OrdersComponent implements OnInit {
setAsCancelled(row: OrderViewModel){
this.confirmationService
.warn('AbpOrdering::WillSetAsCancelled', { key: '::AreYouSure', defaultValue: 'Are you sure?' })
.subscribe((status``) => {
.subscribe((status) => {
if (status !== Confirmation.Status.confirm) {
return;
}

Loading…
Cancel
Save