import { Form } from '../../e2elib/lib/src/pageobjects/form.component'; 
 | 
import { MatrixEditorSOP } from '../../libappsop/matrixeditorsop'; 
 | 
import { QUtils } from '../../e2elib/lib/src/main/qutils.class'; 
 | 
import { DialogSmartPlan } from '../dialogs/dialog.smartplan'; 
 | 
import { DataMatrixProductPlanningAttributeName } from '../data/data.supplyplanning'; 
 | 
  
 | 
export class FormProductPlanning extends Form { 
 | 
  public meProductPlanning = new MatrixEditorProductPlanning(); 
 | 
  
 | 
  public constructor() { 
 | 
    super('FormPlanning'); 
 | 
  } 
 | 
  
 | 
  /** 
 | 
   * Get background color of demand cell for the product in the period 
 | 
   * 
 | 
   * @param productID Product name or index of row 
 | 
   * @param date Date in string format: dd-Mon-yyyy eg: 1-Jan-2020 
 | 
   */ 
 | 
  public async getDemandBackgroundColor(productID: string | number, date: string): Promise<string> { 
 | 
    const cell = await this.meProductPlanning.getCell(productID, DataMatrixProductPlanningAttributeName.TotalDemand, date); 
 | 
    return QUtils.getCssStyle(cell.element, 'background-color'); 
 | 
  } 
 | 
} 
 | 
  
 | 
export class MatrixEditorProductPlanning extends MatrixEditorSOP<DialogSmartPlan> { 
 | 
  public static readonly title = 'Product plannings'; 
 | 
  
 | 
  public constructor() { 
 | 
    super('MatrixEditorProductPlanning', 'matrixeditorContextMenuProductPlanning', new DialogSmartPlan()); 
 | 
  } 
 | 
  
 | 
  /** 
 | 
   * Set total supply value on the specific cell 
 | 
   * 
 | 
   * @param rowID Product name or index of row 
 | 
   * @param date Date in string format: dd-Mon-yyyy eg: 1-Jan-2020 - Column 
 | 
   * @param value Value to be set 
 | 
   */ 
 | 
  public async setTotalSupply(rowID: string | number, date: string, value: number): Promise<void> { 
 | 
    const cell = await this.getCell(rowID, DataMatrixProductPlanningAttributeName.TotalSupply, date); 
 | 
    await cell.sendInput(value.toString()); 
 | 
  } 
 | 
  
 | 
  /** 
 | 
   * Open and return Smart Plan dialog by rightclick on desired cell and choosing Smart Plan context menu item 
 | 
   * 
 | 
   * @param rowID Product name or index of row 
 | 
   * @param date Date in string format: dd-Mon-yyyy eg: 1-Jan-2020 
 | 
   * @returns Dialog Smart Plan 
 | 
   */ 
 | 
  public async startSettingSmartPlanDirection(rowID: string | number, date: string): Promise<DialogSmartPlan> { 
 | 
    const [dlg] = await this.rightClickCellSelectContextmenu(MatrixEditorProductPlanningContextMenuItem.SmartPlan, rowID, DataMatrixProductPlanningAttributeName.TotalSupply, date); 
 | 
    return dlg; 
 | 
  } 
 | 
} 
 | 
  
 | 
export enum MatrixEditorProductPlanningContextMenuItem { 
 | 
  SmartPlan = 'MenuSmartPlan', 
 | 
} 
 |