import { DateTimeSelectorSOP } from '../../libappsop/datetimeselectorsop';
|
import { DialogSOP } from '../../libappsop/dialogsop';
|
import { DropDownListSOP } from '../../libappsop/dropdownlistsop';
|
import { EditFieldSOP } from '../../libappsop/editfieldsop';
|
|
export interface DialogFulfillmentTargetFields {
|
Name?: string;
|
SalesSegment?: string;
|
Product?: string;
|
StockingPoint?: string;
|
Start?: string;
|
End?: string;
|
TargetPercentage?: string;
|
}
|
|
/**
|
* Create/edit fulfillment target dialog.
|
*/
|
export class DialogFulfillmentTarget extends DialogSOP<DialogFulfillmentTargetFields> {
|
public readonly efName = new EditFieldSOP('EditFieldName');
|
public readonly ddlSalesSegment = new DropDownListSOP('DropDownListSalesSegment');
|
public readonly ddlProduct = new DropDownListSOP('DropDownListProduct');
|
public readonly ddlStockingPoint = new DropDownListSOP('DropDownListStockingPoint');
|
public readonly dtsStart = new DateTimeSelectorSOP('DateSelectorStart');
|
public readonly dtsEnd = new DateTimeSelectorSOP('DateSelectorEnd');
|
public readonly efTargetPercentage = new EditFieldSOP('EditFieldTargetPercentage');
|
|
public constructor() {
|
super('DialogCreateEditFulfillmentTarget');
|
|
// Set UI element mapping to pair the UI name to the UI element for use in DialogSOP to find the UI object to set value or verify value
|
// This prevents each new Dialog to duplicate code just to set/verify UI element value
|
this._uiMap.set('Name', this.efName);
|
this._uiMap.set('SalesSegment', this.ddlSalesSegment);
|
this._uiMap.set('Product', this.ddlProduct);
|
this._uiMap.set('StockingPoint', this.ddlStockingPoint);
|
this._uiMap.set('Start', this.dtsStart);
|
this._uiMap.set('End', this.dtsEnd);
|
this._uiMap.set('TargetPercentage', this.efTargetPercentage);
|
}
|
}
|
|
/**
|
* Expected tooltip for OK button when disabled.
|
*/
|
export const okButtonDisabledTooltip = {
|
// Partial prefix indicates precondition defined partially thus use partial match when verifying.
|
partialMustHaveName: (): string => 'Fulfillment target must have a name.',
|
partialMustLargerZero: (target: string): string => `Target percentage (${target}) must be larger than 0 and smaller than or equal to 100.`,
|
partialMustUnique: (): string => 'Fulfillment target must be unique by product, stocking point, salessegment, start and end.',
|
};
|