import { FormSOP } from '../../libappsop/formsop';
|
import { ListSOP } from '../../libappsop/listsop';
|
import { DialogPostponementSpecification, DialogPostponementSpecificationFields } from '../dialogs/dialog.postponementspecification';
|
|
export class FormPostponementSettings extends FormSOP {
|
public listPostponementSpecifications = new ListPostponementSpecifications();
|
|
public constructor() {
|
super('FormPostponementSettings');
|
}
|
}
|
|
export class ListPostponementSpecifications extends ListSOP<DialogPostponementSpecification, ListPostponementSpecificationsColumn> {
|
public constructor() {
|
super('ListPostponementSpecification', new DialogPostponementSpecification());
|
|
// Set primary key column name(s), to display in error message when assert fails
|
this.rowPrimaryColumnNames = {'Sales segment': ''};
|
}
|
|
public async create(inputValues: DialogPostponementSpecificationFields): Promise<void> {
|
const [dlg] = await this.selectContextMenu(listPostponementSpecificationsContextMenuItem.Create);
|
await dlg.updateDialogValues(inputValues);
|
await dlg.clickOK();
|
}
|
}
|
|
export interface ListPostponementSpecificationsColumn {
|
'Sales segment'?: string;
|
Horizon?: string;
|
'Max postponement'?: string;
|
}
|
|
const listPostponementSpecificationsContextMenuItem = {
|
Create: { ContextMenu: 'listContextMenuPostponementSpecification', Name: 'MenuCreate', Label: 'Create' },
|
};
|
|
export { listPostponementSpecificationsContextMenuItem as ListPostponementSpecificationsContextMenuItem };
|
|
// Step description to re-use in spec file to prevent scriptor re-write each time
|
const stepPostponementSpecification = {
|
create: (fields: any): string => {
|
const arr: string[] = [];
|
for (const [key, value] of Object.entries(fields)) {
|
arr.push(`${key} = "${value}"`);
|
}
|
return `Create postponement specification with values: ${arr.join(', ')}.`;
|
},
|
};
|
|
export { stepPostponementSpecification as StepPostponementSpecification };
|