@k3imagine/item-search
v1.2.11
Published
To implement the item-search module into an Angular project, you will need to:
Downloads
27
Keywords
Readme
ItemSearch
To implement the item-search module into an Angular project, you will need to:
Install
To install the package, run: npm i @k3imagine/item-search
Setup:
Include the library in your module
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ItemSearchModule } from '@k3imagine/item-search'; // <-- import it
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, ItemSearchModule], // <-- and include it
bootstrap: [AppComponent],
})
export class MyAppModule {}
Usage:
<lib-item-search
#itemSearch
mode="quantity"
[title]="The title of the popup"
[confirmButtonText]="add / close button"
[useMockDataWheninDev]="true"
(onCloseModal)="closeItemsSearch($event)">
</lib-item-search>
The property 'useMockDataWheninDev' only comes into effect when running in
dev mode. If set to 'true', mock data will be used. If its set to 'false',
then you can use the gateway running locally to return the data.
InterCompany ItemSearch
InterCompany fetches the cost prices from the intercompany price list.
To enable send the following properties in <lib-item-search> tag.
[transferPriceType]="transferDetail.transferType"
[fromShopId]="transferDetail.fromShopId"
[toShopId]="transferDetail.toShopId"
The transferPriceType would be 1 from the following enum:
export enum TransferPriceTypeEnum {
priceFromItemCost = 0,
priceFromPriceList = 1 //Use InterCompany Price
}
Master Item Select
Usage:
<lib-master-item-select
[showPopup]="showPopup"
[title]="The title of the popup"
[confirmButtonText]="add / close button"
[useMockDataWheninDev]="false"
(onCloseModal)="closeItemsSearch($event)"
> </lib-master-item-select>
To show the popup just set the boolean [showPopup] = true
NOTE: You should always set the 'showPopup' property back to false via the
(onCloseModal) event.
The model that is passed back via the (onCloseModal) event is a number array
of masterItemId's e.g [1,2,3,4].
If the form is cancelled then we pass back null.