import { DropDownListSOP } from '../../../libappsop/dropdownlistsop';
|
import { LabelSOP } from '../../../libappsop/labelsop';
|
import { NumberPickerSOP } from '../../../libappsop/numberpickersop';
|
import { PanelSOP } from '../../../libappsop/panelsop';
|
|
/**
|
* Panel period in left navigation panel.
|
* Set the period specification to filter forms data as well as set number of past and future periods to display.
|
*/
|
export class PanelPeriod extends PanelSOP {
|
public lblStartOfPlanning = new LabelSOP('LabelStartOfPlanning');
|
public ddlPeriodGranularity = new DropDownListSOP('DropDownListNavPeriodSpecification');
|
public nmpNumFuturePeriods = new NumberPickerSOP('NumberPickerShowFuture');
|
public nmpNumHistoricalPeriods = new NumberPickerSOP('NumberPickerShowPast');
|
|
public constructor() {
|
super('PanelNavPeriod');
|
}
|
|
/**
|
* Set number of future periods to be shown in the app (direct edit the number picker text field).
|
*
|
* @param numPeriods Number of periods to show.
|
*/
|
public async setNumFuturePeriods(numPeriods: string): Promise<void> {
|
await this.nmpNumFuturePeriods.setValue(numPeriods);
|
}
|
|
/**
|
* Set number of historical periods to be shown in the app (direct edit the number picker text field).
|
*
|
* @param numPeriods Number of periods to show.
|
*/
|
public async setNumHistoricalPeriods(numPeriods: string): Promise<void> {
|
await this.nmpNumHistoricalPeriods.setValue(numPeriods);
|
}
|
|
/**
|
* Set the period specification to be used to filter the app.
|
* Use the enum provided in data.period.ts which includes the system period specification named 'Planning periods'.
|
*
|
* @param periodSpecification Period specification to select.
|
*/
|
public async setPeriodGranularity(periodSpecification: string): Promise<void> {
|
await this.ddlPeriodGranularity.selectItemSOP(periodSpecification);
|
}
|
}
|
|
// Step description to re-use in spec file to prevent scriptor re-write each time
|
const stepNavigationPanelPeriod = {
|
setNumFuturePeriods: (numFuturePeriods: number): string => `In left Navigation panel (Period panel), set number future periods = ${numFuturePeriods}.`,
|
setNumHistoricalPeriods: (numHistoricalPeriods: number): string => `In left Navigation panel (Period panel), set number historical periods = ${numHistoricalPeriods}.`,
|
setPeriodGranularity: (periodSpecName: string): string => `In left Navigation panel (Period panel), select period granularity = '${periodSpecName}'.`,
|
};
|
|
export { stepNavigationPanelPeriod as StepNavigationPanelPeriod };
|