Getting a Record of Order Items

Upon clicking an order record, smoothly transition the user to a dedicated section or page displaying the lineitems associated with that order.

Request URL: https://api.eng-dev-1.trilloapps.com/ds/function/shared/GetOrderItems

Payload:

Preview:

Item Record Overview

  • Design the item record screen to provide a concise overview. Include key information, such as:

    • Name

    • Item Description

    • Code

    • Weight

    • Quantity

Back To Order Record Button

  • Maintain a clear and easily navigable path back to the order records screen, allowing users to switch between order and item records effortlessly.

Search Order Item By Name

  • Implement search options to help users quickly find specific item records based on item names.

Item Record Code Snippet

getItemLists(start: number, size: number, orderId: string) {
   this.bLoader= true;
   let body = {
     orderId: orderId,
     start: start,
     size: size,
   }
   this.dataService.GetItemList(body).subscribe({
     next: (result: any) => {
       console.log("error")
       if (result.status === "success") {
         this.items = result.data.items;
         this.totalSize = result.data.totalData
         this.bLoader = false
         this.temp = [...this.items]
       }


     },
     error: (error) => {
       console.error(" ERROR ==> ", error);
     },
     complete: () => { },
   }
   )
 }

Code Description

This TypeScript function, getItemLists, is designed to retrieve a list of items for a specific order from a data service. Here's a breakdown of its functionality:

Loading Indicator

  • Sets this.bLoader to true, indicating that data is being loaded.

Request Body Preparation

  • Creates a body object containing orderId, start, and size properties based on the provided parameters.

API Request

  • Calls the GetItemList method of this.dataService to get a list of items for the specified order.

  • Subscribes to the observable returned by the GetItemList method.

Response Handling

In the next callback:

  • Logs "error" to the console (seems to be a debugging statement).

  • Checks if the response status is "success."

  • If successful, updates the local this.items with the item data from the response (result.data.items).

  • Sets this.totalSize to the total data size from the response (result.data.totalData).

  • Sets this.bLoader to false, indicating the end of the loading process.

  • Creates a copy of the item list in this.temp.

Error Handling

In the error callback:

  • Logs the error to the console using console.error.

Last updated