import { PanelBase } from '../../libappbase/panelbase';
|
import { DialogSOP } from '../../libappsop/dialogsop';
|
import { DropDownListSOP } from '../../libappsop/dropdownlistsop';
|
import { EditFieldSOP } from '../../libappsop/editfieldsop';
|
import { DateTimeSelectorSOP } from '../../libappsop/datetimeselectorsop';
|
import { CheckboxSOP } from '../../libappsop/checkboxsop';
|
import { RadioButtonSOP } from '../../libappsop/radiobuttonsop';
|
|
export interface DialogUnitFields {
|
Name?: string;
|
Parent?: string;
|
CapacityType?: string;
|
StartEnabled?: string;
|
Start?: string;
|
EndEnabled?: string;
|
End?: string;
|
// Advanced tab fields
|
BatchEditShiftPatternOpt?: string;
|
ShiftPatternOpt?: string;
|
}
|
|
export class DialogUnit extends DialogSOP<DialogUnitFields> {
|
public static readonly title = 'Unit';
|
|
public ddlParent = new DropDownListSOP('selParentUnit');
|
public efName = new EditFieldSOP('EditFieldName');
|
public rbgCapacityType = new RadioButtonSOP('RadioButtonGroupCapacityType');
|
public pnlGeneral = new PanelBase('PanelGeneral');
|
public pnlAdvanced = new PanelBase('PanelAdvanced');
|
public cbHasStart = new CheckboxSOP('CheckboxHasStart');
|
public cbHasEnd = new CheckboxSOP('CheckboxHasEnd');
|
public dtsStart = new DateTimeSelectorSOP('dsStart');
|
public dtsEnd = new DateTimeSelectorSOP('dsEnd');
|
// Advanced tab fields
|
public cbBatchEditShiftPatternOpt = new CheckboxSOP('CheckBoxBatchEditUseShiftPatternOptimization');
|
public cbShiftPatternOpt = new CheckboxSOP('CheckboxUseShiftPatternOptimization');
|
|
public constructor() {
|
super('DialogCreateEditUnit');
|
|
// 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('Parent', this.ddlParent);
|
this._uiMap.set('CapacityType', this.rbgCapacityType);
|
this._uiMap.set('StartEnabled', this.cbHasStart);
|
this._uiMap.set('Start', this.dtsStart);
|
this._uiMap.set('EndEnabled', this.cbHasEnd);
|
this._uiMap.set('End', this.dtsEnd);
|
// Advanced tab fields
|
this._uiMap.set('BatchEditShiftPatternOpt', this.cbBatchEditShiftPatternOpt);
|
this._uiMap.set('ShiftPatternOpt', this.cbShiftPatternOpt);
|
}
|
}
|
|
/**
|
* Expected tooltip for OK button when disabled.
|
*/
|
export const okButtonDisabledTooltip = {
|
// Partial prefix indicates precondition defined partially thus use partial match when verifying.
|
partialEndLaterThanStart: (startDate: string, endDate: string): string => `End (${endDate}) must be later than start (${startDate}).`,
|
};
|