import { EditField } from '../../e2elib/lib/src/pageobjects/editfield.component';
|
import { DialogBase } from '../../libappbase/dialogbase';
|
import { DateTimeSelectorSOP } from '../../libappsop/datetimeselectorsop';
|
import { DropDownListSOP } from '../../libappsop/dropdownlistsop';
|
import { DropDownStringListSOP } from '../../libappsop/dropdownstringlistsop';
|
|
export class DialogInventoryCost extends DialogBase {
|
public ddlAccount = new DropDownListSOP('DropDownListAccount');
|
public ddlCostDriver = new DropDownStringListSOP('DropDownStringListCostDriver');
|
public ddlProduct = new DropDownListSOP('DropDownListProduct');
|
public ddlStockingPoint = new DropDownListSOP('DropDownListStockingPoint');
|
public dtsStart = new DateTimeSelectorSOP('DateSelectorCostStart');
|
public efCost = new EditField('EditFieldCost');
|
|
public constructor() {
|
super('DialogCreateEditInventoryCost', 'btnOk', 'btnCancel');
|
}
|
|
/**
|
* Update field value in the dialog.
|
*
|
* @param account Account field value
|
* @param costDriver Cost driver field value
|
* @param product Product field value
|
* @param stockingPoint Stocking point field value
|
* @param startDate Start field value
|
* @param cost Cost field value
|
*/
|
public async updateDialog(account?: string, costDriver?: string, product?: string, stockingPoint?: string, startDate?: Date, cost?: number): Promise<void> {
|
if (account !== undefined) {
|
await this.ddlAccount.selectItemSOP(account);
|
}
|
if (costDriver !== undefined) {
|
await this.ddlCostDriver.selectItem(costDriver);
|
}
|
if (product !== undefined) {
|
await this.ddlProduct.selectItemSOP(product);
|
}
|
if (stockingPoint !== undefined) {
|
await this.ddlStockingPoint.selectItemSOP(stockingPoint);
|
}
|
if (startDate !== undefined) {
|
await this.dtsStart.setDate(startDate);
|
}
|
if (cost !== undefined) {
|
await this.efCost.sendInput(cost.toString());
|
}
|
}
|
|
/**
|
* OK button is enabled, click on it to close dialog.
|
*
|
* @returns True = button is enabled; False = button is disabled.
|
*/
|
public async closeDialog(): Promise<boolean> {
|
const canClickOK = await this.clickOK();
|
return canClickOK;
|
}
|
}
|