import { Injectable } from '@angular/core'; import {BehaviorSubject, Observable, of, Subject} from 'rxjs'; import { AgGridUtils } from '@esp/esp-common'; // import { SENSE_CHECK_GRID } from 'libs/pages/demand-forecasting/sense-check/sense-check.const'; import { Router } from '@angular/router'; import { ModalService } from './modal.service'; import { filter } from 'lodash'; import {VOLATILITY_MODAL_DATA} from "./mockup"; // import { // LoadedGridData, // COMPARE_KEY, // } from 'libs/pages/demand-forecasting/sense-check/sense-check-detail/sense-check-detail.model'; @Injectable({ providedIn: 'root', }) export class AgGridService { private assignroutesgrid = { columnDefs: [ { field: 'measures', headerName: 'Measures', pinned: 'left', }, { field: '12/01/2019', cellStyle: { 'justify-content': 'flex-end', textAlign: 'right' }, }, { field: '01/01/2020', cellStyle: { 'justify-content': 'flex-end', textAlign: 'right' }, }, { field: '02/01/2020', cellStyle: { 'justify-content': 'flex-end', textAlign: 'right' }, }, { field: '03/01/2020', cellStyle: { 'justify-content': 'flex-end', textAlign: 'right' }, }, { field: '04/01/2020', cellStyle: { 'justify-content': 'flex-end', textAlign: 'right' }, }, { field: '05/01/2020', cellStyle: { 'justify-content': 'flex-end', textAlign: 'right' }, }, { field: '06/01/2020', cellStyle: { 'justify-content': 'flex-end', textAlign: 'right' }, }, { field: '07/01/2020', cellStyle: { 'justify-content': 'flex-end', textAlign: 'right' }, }, { field: '08/01/2020', cellStyle: { 'justify-content': 'flex-end', textAlign: 'right' }, }, ], rowData: [ { measures: 'Forecast Override', '12/01/2019': '123456', '01/01/2020': '123456', '02/01/2020': '123456', '03/01/2020': '123456', '04/01/2020': '123456', '05/01/2020': '123456', '06/01/2020': '123456', '07/01/2020': '123456', '08/01/2020': '123456', }, { measures: 'Consumption', '12/01/2019': '123456', '01/01/2020': '123456', '02/01/2020': '123456', '03/01/2020': '123456', '04/01/2020': '123456', '05/01/2020': '123456', '06/01/2020': '123456', '07/01/2020': '123456', '08/01/2020': '123456', }, { measures: 'Imputed Consumption', '12/01/2019': '123456', '01/01/2020': '123456', '02/01/2020': '123456', '03/01/2020': '123456', '04/01/2020': '123456', '05/01/2020': '123456', '06/01/2020': '123456', '07/01/2020': '123456', '08/01/2020': '123456', }, { measures: 'Consumption Forecast', '12/01/2019': '123456', '01/01/2020': '123456', '02/01/2020': '123456', '03/01/2020': '123456', '04/01/2020': '123456', '05/01/2020': '123456', '06/01/2020': '123456', '07/01/2020': '123456', '08/01/2020': '123456', }, { measures: 'Base Forecast', '12/01/2019': '123456', '01/01/2020': '123456', '02/01/2020': '123456', '03/01/2020': '123456', '04/01/2020': '123456', '05/01/2020': '123456', '06/01/2020': '123456', '07/01/2020': '123456', '08/01/2020': '123456', }, { measures: 'Promo Uplift', '12/01/2019': '', '01/01/2020': '', '02/01/2020': '', '03/01/2020': '', '04/01/2020': '', '05/01/2020': '', '06/01/2020': '', '07/01/2020': '', '08/01/2020': '', }, { measures: 'Planner Code Flag', '12/01/2019': '', '01/01/2020': '', '02/01/2020': '', '03/01/2020': '', '04/01/2020': '', '05/01/2020': '', '06/01/2020': '', '07/01/2020': '', '08/01/2020': '', }, { measures: 'Promo Flag', '12/01/2019': '', '01/01/2020': '', '02/01/2020': '', '03/01/2020': '', '04/01/2020': '', '05/01/2020': '', '06/01/2020': '', '07/01/2020': '', '08/01/2020': '', }, ], }; private assignroutes = new BehaviorSubject(this.assignroutesgrid); private alertGrid = { columnDefs: [ { field: 'date', headerName: 'Date', width: 134, }, { field: 'routeName', headerName: 'Route ID', width: 134, }, { field: 'materialId', headerName: 'Material ID', width: 141, }, { field: 'productDescription', headerName: 'Material Description', width: 141, }, { field: 'customer', headerName: 'Customer', width: 171, }, { field: 'locationDescription', headerName: 'Customer Description', width: 141, }, { field: 'trayCount', headerName: 'Tray Count', width: 141, }, { field: 'totalOrder', headerName: 'Order', width: 141, }, ], }; private foreCastRunGrid = { columnDefs: [ { field: 'checker', headerName: '', width: 48, checkboxSelection: true, headerCheckboxSelection: true, }, { field: 'name', headerName: 'Name', width: 353, }, { field: 'lastRunBy', headerName: 'Last Run By', width: 276, }, { field: 'lastRunOn', headerName: 'Last Run on', width: 219, }, { field: 'details', headerName: 'Details', width: 747, }, { field: 'status', headerName: 'Status', width: 127, }, { field: 'runLog', headerName: 'Run Log', width: 115, cellRenderer: params => AgGridUtils.runLogIconSet(params), cellStyle: { display: 'flex', justifyContent: 'center' }, }, ], rowData: [ { name: 'Live_run_20220-04-14T15:28:40.131Z', lastRunBy: 'mohit.dubey@antuit.com', lastRunOn: '2020-04- 15:28 CST', details: 'Modelld: Mohit Debey@antuit.com2020-04-14T15:28:40.131Z history_length', status: 'Forecasted', runLog: true, }, { name: 'Live_run_20220-04-14T16:30:40.131Z', lastRunBy: 'nocholas.wegman@antuit.com', lastRunOn: '2020-04- 15:28 CST', details: 'Modelld: Mohit Debey@antuit.com2020-04-14T15:28:40.131Z history_length', status: 'Forecasted', runLog: true, }, { name: 'Live_run_20220-04-14T15:28:40.131Z', lastRunBy: 'raghu.sarangarajan@antuit.com', lastRunOn: '2020-04- 15:28 CST', details: 'Modelld: Mohit Debey@antuit.com2020-04-14T15:28:40.131Z history_length', status: 'Forecasted', runLog: true, }, ], }; private senseCheckGrid = { columnDefs: [ { field: 'anomaly', headerName: '', width: 100, cellRenderer: params => AgGridUtils.anomalyIconSets(params), }, { field: 'product', headerName: 'Product', width: 110, }, { field: 'location', headerName: 'Location', width: 115, }, { field: 'channel', headerName: 'Channel', width: 115, }, { field: 'segment', headerName: 'Segment', width: 115, }, { field: 'classification', headerName: 'Classification', width: 145, }, { field: 'period', headerName: 'Period', width: 165, cellRenderer: 'agGroupCellRenderer', }, { field: 'forecast', headerName: 'Forecast', width: 115, }, { field: 'previous_forecast', headerName: 'Previous Forecast', width: 115, }, { field: 'lysp', headerName: 'Last Year Same Period', width: 145, }, { field: 'msp', headerName: 'Most Similar Period', width: 145, }, { field: 'volatility', headerName: 'Volatility', width: 125, }, { field: 'accuracy', headerName: 'Accuracy', width: 115, }, { field: 'previous_accuracy', headerName: 'Previous Accuracy', width: 115, }, { field: 'bias', headerName: 'Bias', width: 115, }, { field: 'previous_bias', headerName: 'Previous Bias', width: 115, }, { field: 'forecast_timestamp', headerName: 'Forecast Timestamp', width: 175, }, ], columnDefsDetails: [ { field: 'anomaly', headerName: '', width: 100, cellRenderer: params => AgGridUtils.anomalyIconSets(params), cellClass: 'grey-rows', }, { field: 'product', headerName: 'Product', width: 110, cellClass: 'grey-rows', }, { field: 'location', headerName: 'Location', width: 115, cellClass: 'grey-rows', }, { field: 'channel', headerName: 'Channel', width: 115, cellClass: 'grey-rows', }, { field: 'segment', headerName: 'Segment', width: 115, cellClass: 'grey-rows', }, { field: 'classification', headerName: 'Classification', width: 145, cellClass: 'grey-rows', }, { field: 'period', headerName: 'Period', width: 165, cellClass: 'grey-rows', }, { field: 'forecast', headerName: 'Forecast', width: 115, cellClass: 'grey-rows', }, { field: 'previous_forecast', headerName: 'Previous Forecast', width: 115, cellClass: 'grey-rows', }, { field: 'lysp', headerName: 'Last Year Same Period', width: 145, cellClass: 'grey-rows', }, { field: 'msp', headerName: 'Most Similar Period', width: 145, cellClass: 'grey-rows', }, { field: 'volatility', headerName: 'Volatility', width: 125, cellClass: 'grey-rows', }, { field: 'accuracy', headerName: 'Accuracy', width: 115, cellClass: 'grey-rows', }, { field: 'previous_accuracy', headerName: 'Previous Accuracy', width: 115, cellClass: 'grey-rows', }, { field: 'bias', headerName: 'Bias', width: 115, cellClass: 'grey-rows', }, { field: 'previous_bias', headerName: 'Previous Bias', width: 115, cellClass: 'grey-rows', }, { field: 'forecast_timestamp', headerName: 'Forecast Timestamp', width: 175, cellClass: 'grey-rows', }, ], rowData: [ { anomaly: true, product: 'P1', product_name: 'SN FS HLWN 10.59OZ 24CS ', location: 'L1', channel: 'C1', segment: 'No Touch', classification: 'AX', period: 'Apr - 2020', forecast: 1520, previous_forecast: 1480, lysp: 1420, msp: 1665, volatility: '5%', accuracy: '77%', previous_accuracy: '77%', bias: '77%', previous_bias: '77%', forecast_timestamp: '4/3/2020 16:20:20', fva: '8%', period_weekly: [ { anomaly: false, product: 'P2', product_name: 'SN FS HLWN 10.59OZ 24CS ', location: 'L1', channel: 'C1', segment: 'No Touch', classification: 'AX', period: '5-Apr', forecast: 1520, previous_forecast: 1480, lysp: 1420, msp: 1665, volatility: '5%', accuracy: '77%', previous_accuracy: '77%', bias: '77%', previous_bias: '77%', forecast_timestamp: '4/3/2020 16:20:20', fva: '8%', }, { anomaly: true, product: 'P2', product_name: 'SN FS HLWN 10.59OZ 24CS ', location: 'L1', channel: 'C1', segment: 'No Touch', classification: 'AX', period: '12-Apr', forecast: 1520, previous_forecast: 1480, lysp: 1420, msp: 1665, volatility: '5%', accuracy: '77%', previous_accuracy: '77%', bias: '77%', previous_bias: '77%', forecast_timestamp: '4/3/2020 16:20:20', fva: '8%', }, ], }, { anomaly: false, product: 'P1', product_name: 'SN FS HLWN 10.59OZ 24CS ', location: 'L1', channel: 'C1', segment: 'No Touch', classification: 'AX', period: 'May - 2020', forecast: 1520, previous_forecast: 1480, lysp: 1420, msp: 1665, volatility: '5%', accuracy: '77%', previous_accuracy: '77%', bias: '77%', previous_bias: '77%', forecast_timestamp: '4/3/2020 16:20:20', fva: '8%', period_weekly: [ { anomaly: false, product: 'P2', product_name: 'SN FS HLWN 10.59OZ 24CS ', location: 'L1', channel: 'C1', segment: 'No Touch', classification: 'AX', period: '6-May', forecast: 1520, previous_forecast: 1480, lysp: 1420, msp: 1665, volatility: '5%', accuracy: '77%', previous_accuracy: '77%', bias: '77%', previous_bias: '77%', forecast_timestamp: '4/3/2020 16:20:20', fva: '8%', }, { anomaly: false, product: 'P2', product_name: 'SN FS HLWN 10.59OZ 24CS ', location: 'L1', channel: 'C1', segment: 'No Touch', classification: 'AX', period: '13-May', forecast: 1520, previous_forecast: 1480, lysp: 1420, msp: 1665, volatility: '5%', accuracy: '77%', previous_accuracy: '77%', bias: '77%', previous_bias: '77%', forecast_timestamp: '4/3/2020 16:20:20', fva: '8%', }, ], }, ], }; private perpetualInventoryGridData = { columnDefs: [ { field: 'header', headerName: '', width: 100, }, { field: 'weekOne', headerName: 'Week 01 / Dec 31 - Jan 5', children: [ { headerName: '12/30', field: 'date' }, { headerName: '12/31', field: 'date' }, { headerName: '1/1', field: 'date' }, { headerName: '1/2', field: 'date' }, { headerName: '1/3', field: 'date' }, { headerName: '1/4', field: 'date' }, { headerName: '1/5', field: 'date' }, ], }, { field: 'weekTwo', headerName: 'Week 02 / Jan 6 - Jan 12', children: [ { headerName: '1/6', field: 'date' }, { headerName: '1/7', field: 'date' }, { headerName: '1/8', field: 'date' }, { headerName: '1/9', field: 'date' }, { headerName: '1/10', field: 'date' }, { headerName: '1/11', field: 'date' }, { headerName: '1/12', field: 'date' }, ], }, ], }; private senseCheckDetailsGridNames: string[] = ['Details']; // all the loaded grid names (NOTE: Hardcoded Details i.e; first grid name, for now) private columnDefs = new BehaviorSubject(this.senseCheckGrid); private senseCheckDetailsLoadedGrids = new BehaviorSubject(this.senseCheckDetailsGridNames); /* */ // load scenario grid data for row and column comparison // private loadScenarioGridData: LoadedGridData[] = [ // { // name: 'Curently Active Plan', // rowData: [ // { // measures: 'Forecast Override', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: true, // }, // { // measures: 'Consumption', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Imputed Consumption', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Consumption Forecast', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Base Forecast', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Promo Uplift', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'number', // edit: false, // }, // { // measures: 'Planner Code Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': 'active', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // { // measures: 'Promo Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': 'active', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // ], // }, // { // name: 'Previous Plan', // rowData: [ // { // measures: 'Forecast Override', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: true, // }, // { // measures: 'Consumption', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Imputed Consumption', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Consumption Forecast', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Base Forecast', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Promo Uplift', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'number', // edit: false, // }, // { // measures: 'Planner Code Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': 'active', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // { // measures: 'Promo Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': 'active', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // ], // }, // { // name: 'Warning Plan', // rowData: [ // { // measures: 'Forecast Override', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: true, // }, // { // measures: 'Consumption', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Imputed Consumption', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Consumption Forecast', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Base Forecast', // '12/01/2019': '123456', // '01/01/2020': '123456', // '02/01/2020': '123456', // '03/01/2020': '123456', // '04/01/2020': '123456', // '05/01/2020': '123456', // '06/01/2020': '123456', // '07/01/2020': '123456', // '08/01/2020': '123456', // type: 'number', // edit: false, // }, // { // measures: 'Promo Uplift', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'number', // edit: false, // }, // { // measures: 'Planner Code Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': 'active', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // { // measures: 'Promo Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': 'active', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // ], // }, // ]; // load scenario grid data for row # and column # comparison // private loadScenarioGridData_number: LoadedGridData[] = [ // { // name: 'Curently Active Plan', // rowData: [ // { // measures: 'Forecast Override', // '12/01/2019': '123', // '01/01/2020': '123', // '02/01/2020': '123', // '03/01/2020': '123', // '04/01/2020': '123', // '05/01/2020': '123', // '06/01/2020': '123', // '07/01/2020': '123', // '08/01/2020': '123', // type: 'number', // edit: true, // }, // { // measures: 'Consumption', // '12/01/2019': '-213', // '01/01/2020': '-213', // '02/01/2020': '-213', // '03/01/2020': '-213', // '04/01/2020': '-213', // '05/01/2020': '-213', // '06/01/2020': '-213', // '07/01/2020': '-213', // '08/01/2020': '-213', // type: 'number', // edit: false, // }, // { // measures: 'Imputed Consumption', // '12/01/2019': '123', // '01/01/2020': '123', // '02/01/2020': '123', // '03/01/2020': '123', // '04/01/2020': '123', // '05/01/2020': '123', // '06/01/2020': '123', // '07/01/2020': '123', // '08/01/2020': '123', // type: 'number', // edit: false, // }, // { // measures: 'Consumption Forecast', // '12/01/2019': '-213', // '01/01/2020': '-213', // '02/01/2020': '-213', // '03/01/2020': '-213', // '04/01/2020': '-213', // '05/01/2020': '-213', // '06/01/2020': '-213', // '07/01/2020': '-213', // '08/01/2020': '-213', // type: 'number', // edit: false, // }, // { // measures: 'Base Forecast', // '12/01/2019': '123', // '01/01/2020': '123', // '02/01/2020': '123', // '03/01/2020': '123', // '04/01/2020': '123', // '05/01/2020': '123', // '06/01/2020': '123', // '07/01/2020': '123', // '08/01/2020': '123', // type: 'number', // edit: false, // }, // { // measures: 'Promo Uplift', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'number', // edit: false, // }, // { // measures: 'Planner Code Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': 'active', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // { // measures: 'Promo Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': 'active', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // ], // }, // { // name: 'Previous Plan', // rowData: [ // { // measures: 'Forecast Override', // '12/01/2019': '123', // '01/01/2020': '123', // '02/01/2020': '123', // '03/01/2020': '123', // '04/01/2020': '123', // '05/01/2020': '123', // '06/01/2020': '123', // '07/01/2020': '123', // '08/01/2020': '123', // type: 'number', // edit: true, // }, // { // measures: 'Consumption', // '12/01/2019': '-213', // '01/01/2020': '-213', // '02/01/2020': '-213', // '03/01/2020': '-213', // '04/01/2020': '-213', // '05/01/2020': '-213', // '06/01/2020': '-213', // '07/01/2020': '-213', // '08/01/2020': '-213', // type: 'number', // edit: false, // }, // { // measures: 'Imputed Consumption', // '12/01/2019': '123', // '01/01/2020': '123', // '02/01/2020': '123', // '03/01/2020': '123', // '04/01/2020': '123', // '05/01/2020': '123', // '06/01/2020': '123', // '07/01/2020': '123', // '08/01/2020': '123', // type: 'number', // edit: false, // }, // { // measures: 'Consumption Forecast', // '12/01/2019': '-213', // '01/01/2020': '-213', // '02/01/2020': '-213', // '03/01/2020': '-213', // '04/01/2020': '-213', // '05/01/2020': '-213', // '06/01/2020': '-213', // '07/01/2020': '-213', // '08/01/2020': '-213', // type: 'number', // edit: false, // }, // { // measures: 'Base Forecast', // '12/01/2019': '123', // '01/01/2020': '123', // '02/01/2020': '123', // '03/01/2020': '123', // '04/01/2020': '123', // '05/01/2020': '123', // '06/01/2020': '123', // '07/01/2020': '123', // '08/01/2020': '123', // type: 'number', // edit: false, // }, // { // measures: 'Promo Uplift', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'number', // edit: false, // }, // { // measures: 'Planner Code Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': 'active', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // { // measures: 'Promo Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': 'active', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // ], // }, // { // name: 'Warning Plan', // rowData: [ // { // measures: 'Forecast Override', // '12/01/2019': '123', // '01/01/2020': '123', // '02/01/2020': '123', // '03/01/2020': '123', // '04/01/2020': '123', // '05/01/2020': '123', // '06/01/2020': '123', // '07/01/2020': '123', // '08/01/2020': '123', // type: 'number', // edit: true, // }, // { // measures: 'Consumption', // '12/01/2019': '-213', // '01/01/2020': '-213', // '02/01/2020': '-213', // '03/01/2020': '-213', // '04/01/2020': '-213', // '05/01/2020': '-213', // '06/01/2020': '-213', // '07/01/2020': '-213', // '08/01/2020': '-213', // type: 'number', // edit: false, // }, // { // measures: 'Imputed Consumption', // '12/01/2019': '123', // '01/01/2020': '123', // '02/01/2020': '123', // '03/01/2020': '123', // '04/01/2020': '123', // '05/01/2020': '123', // '06/01/2020': '123', // '07/01/2020': '123', // '08/01/2020': '123', // type: 'number', // edit: false, // }, // { // measures: 'Consumption Forecast', // '12/01/2019': '-213', // '01/01/2020': '-213', // '02/01/2020': '-213', // '03/01/2020': '-213', // '04/01/2020': '-213', // '05/01/2020': '-213', // '06/01/2020': '-213', // '07/01/2020': '-213', // '08/01/2020': '-213', // type: 'number', // edit: false, // }, // { // measures: 'Base Forecast', // '12/01/2019': '123', // '01/01/2020': '123', // '02/01/2020': '123', // '03/01/2020': '123', // '04/01/2020': '123', // '05/01/2020': '123', // '06/01/2020': '123', // '07/01/2020': '123', // '08/01/2020': '123', // type: 'number', // edit: false, // }, // { // measures: 'Promo Uplift', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'number', // edit: false, // }, // { // measures: 'Planner Code Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': 'active', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // { // measures: 'Promo Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': 'active', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // ], // }, // ]; private columnDefsAlert = new BehaviorSubject(this.alertGrid); private forecastSub = new BehaviorSubject(this.foreCastRunGrid); // load scenario grid data for row % and column % comparison // private loadScenarioGridData_percent: LoadedGridData[] = [ // { // name: 'Curently Active Plan', // rowData: [ // { // measures: 'Forecast Override', // '12/01/2019': '-1.23%', // '01/01/2020': '-1.23%', // '02/01/2020': '-1.23%', // '03/01/2020': '-1.23%', // '04/01/2020': '-1.23%', // '05/01/2020': '-1.23%', // '06/01/2020': '-1.23%', // '07/01/2020': '-1.23%', // '08/01/2020': '-1.23%', // type: 'number', // edit: true, // }, // { // measures: 'Consumption', // '12/01/2019': '3.21%', // '01/01/2020': '3.21%', // '02/01/2020': '3.21%', // '03/01/2020': '3.21%', // '04/01/2020': '3.21%', // '05/01/2020': '3.21%', // '06/01/2020': '3.21%', // '07/01/2020': '3.21%', // '08/01/2020': '3.21%', // type: 'number', // edit: false, // }, // { // measures: 'Imputed Consumption', // '12/01/2019': '-1.23%', // '01/01/2020': '-1.23%', // '02/01/2020': '-1.23%', // '03/01/2020': '-1.23%', // '04/01/2020': '-1.23%', // '05/01/2020': '-1.23%', // '06/01/2020': '-1.23%', // '07/01/2020': '-1.23%', // '08/01/2020': '-1.23%', // type: 'number', // edit: false, // }, // { // measures: 'Consumption Forecast', // '12/01/2019': '3.21%', // '01/01/2020': '3.21%', // '02/01/2020': '3.21%', // '03/01/2020': '3.21%', // '04/01/2020': '3.21%', // '05/01/2020': '3.21%', // '06/01/2020': '3.21%', // '07/01/2020': '3.21%', // '08/01/2020': '3.21%', // type: 'number', // edit: false, // }, // { // measures: 'Base Forecast', // '12/01/2019': '-1.23%', // '01/01/2020': '-1.23%', // '02/01/2020': '-1.23%', // '03/01/2020': '-1.23%', // '04/01/2020': '-1.23%', // '05/01/2020': '-1.23%', // '06/01/2020': '-1.23%', // '07/01/2020': '-1.23%', // '08/01/2020': '-1.23%', // type: 'number', // edit: false, // }, // { // measures: 'Promo Uplift', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'number', // edit: false, // }, // { // measures: 'Planner Code Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': 'active', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // { // measures: 'Promo Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': 'active', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // ], // }, // { // name: 'Previous Plan', // rowData: [ // { // measures: 'Forecast Override', // '12/01/2019': '-1.23%', // '01/01/2020': '-1.23%', // '02/01/2020': '-1.23%', // '03/01/2020': '-1.23%', // '04/01/2020': '-1.23%', // '05/01/2020': '-1.23%', // '06/01/2020': '-1.23%', // '07/01/2020': '-1.23%', // '08/01/2020': '-1.23%', // type: 'number', // edit: true, // }, // { // measures: 'Consumption', // '12/01/2019': '3.21%', // '01/01/2020': '3.21%', // '02/01/2020': '3.21%', // '03/01/2020': '3.21%', // '04/01/2020': '3.21%', // '05/01/2020': '3.21%', // '06/01/2020': '3.21%', // '07/01/2020': '3.21%', // '08/01/2020': '3.21%', // type: 'number', // edit: false, // }, // { // measures: 'Imputed Consumption', // '12/01/2019': '-1.23%', // '01/01/2020': '-1.23%', // '02/01/2020': '-1.23%', // '03/01/2020': '-1.23%', // '04/01/2020': '-1.23%', // '05/01/2020': '-1.23%', // '06/01/2020': '-1.23%', // '07/01/2020': '-1.23%', // '08/01/2020': '-1.23%', // type: 'number', // edit: false, // }, // { // measures: 'Consumption Forecast', // '12/01/2019': '3.21%', // '01/01/2020': '3.21%', // '02/01/2020': '3.21%', // '03/01/2020': '3.21%', // '04/01/2020': '3.21%', // '05/01/2020': '3.21%', // '06/01/2020': '3.21%', // '07/01/2020': '3.21%', // '08/01/2020': '3.21%', // type: 'number', // edit: false, // }, // { // measures: 'Base Forecast', // '12/01/2019': '-1.23%', // '01/01/2020': '-1.23%', // '02/01/2020': '-1.23%', // '03/01/2020': '-1.23%', // '04/01/2020': '-1.23%', // '05/01/2020': '-1.23%', // '06/01/2020': '-1.23%', // '07/01/2020': '-1.23%', // '08/01/2020': '-1.23%', // type: 'number', // edit: false, // }, // { // measures: 'Promo Uplift', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'number', // edit: false, // }, // { // measures: 'Planner Code Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': 'active', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // { // measures: 'Promo Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': 'active', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // ], // }, // { // name: 'Warning Plan', // rowData: [ // { // measures: 'Forecast Override', // '12/01/2019': '-1.23%', // '01/01/2020': '-1.23%', // '02/01/2020': '-1.23%', // '03/01/2020': '-1.23%', // '04/01/2020': '-1.23%', // '05/01/2020': '-1.23%', // '06/01/2020': '-1.23%', // '07/01/2020': '-1.23%', // '08/01/2020': '-1.23%', // type: 'number', // edit: true, // }, // { // measures: 'Consumption', // '12/01/2019': '3.21%', // '01/01/2020': '3.21%', // '02/01/2020': '3.21%', // '03/01/2020': '3.21%', // '04/01/2020': '3.21%', // '05/01/2020': '3.21%', // '06/01/2020': '3.21%', // '07/01/2020': '3.21%', // '08/01/2020': '3.21%', // type: 'number', // edit: false, // }, // { // measures: 'Imputed Consumption', // '12/01/2019': '-1.23%', // '01/01/2020': '-1.23%', // '02/01/2020': '-1.23%', // '03/01/2020': '-1.23%', // '04/01/2020': '-1.23%', // '05/01/2020': '-1.23%', // '06/01/2020': '-1.23%', // '07/01/2020': '-1.23%', // '08/01/2020': '-1.23%', // type: 'number', // edit: false, // }, // { // measures: 'Consumption Forecast', // '12/01/2019': '3.21%', // '01/01/2020': '3.21%', // '02/01/2020': '3.21%', // '03/01/2020': '3.21%', // '04/01/2020': '3.21%', // '05/01/2020': '3.21%', // '06/01/2020': '3.21%', // '07/01/2020': '3.21%', // '08/01/2020': '3.21%', // type: 'number', // edit: false, // }, // { // measures: 'Base Forecast', // '12/01/2019': '-1.23%', // '01/01/2020': '-1.23%', // '02/01/2020': '-1.23%', // '03/01/2020': '-1.23%', // '04/01/2020': '-1.23%', // '05/01/2020': '-1.23%', // '06/01/2020': '-1.23%', // '07/01/2020': '-1.23%', // '08/01/2020': '-1.23%', // type: 'number', // edit: false, // }, // { // measures: 'Promo Uplift', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'number', // edit: false, // }, // { // measures: 'Planner Code Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': 'active', // '05/01/2020': '', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // { // measures: 'Promo Flag', // '12/01/2019': '', // '01/01/2020': '', // '02/01/2020': '', // '03/01/2020': '', // '04/01/2020': '', // '05/01/2020': 'active', // '06/01/2020': '', // '07/01/2020': '', // '08/01/2020': '', // type: 'icon', // edit: false, // }, // ], // }, // ]; private perpetualInventory = new BehaviorSubject(this.perpetualInventoryGridData); cast = this.columnDefs.asObservable(); castAlert = this.columnDefsAlert.asObservable(); castLoadedGrids = this.senseCheckDetailsLoadedGrids.asObservable(); castForeCast = this.forecastSub.asObservable(); perpetualInvCast = this.perpetualInventory.asObservable(); castAssignRoutes = this.assignroutes.asObservable(); constructor(private router: Router, private modalService: ModalService) {} /** * Prepares new column definitions appended side by side * @param columns - original column array * @param columnNumber - no of columns to be created for each column * @param prefix - string to be prexfixed to each column field * @returns returns new column definitions array */ prepareModifiedColumns(columns: any[], columnNumber: number, prefix: string): any[] { const newCols = []; let newColumnObj: any = {}; columns.forEach(column => { for (let i = 0; i <= columnNumber; i++) { newColumnObj = { ...column }; newColumnObj.headerName = column.headerName || column.field; newColumnObj.field = prefix + i + newColumnObj.field; newColumnObj.cellClass = `${prefix}${i}-cell`; newColumnObj.headerClass = `${prefix}${i}-cell`; newCols.push(newColumnObj); } }); return newCols; } /** * fetches the selected scenario grid data * @param name selected Scenario names */ // getScenarioGridData(name: string[], compareString: COMPARE_KEY): Observable { // let data; // switch (compareString) { // case 'row': // case 'column': // data = filter(this.loadScenarioGridData, val => name.indexOf(val.name) !== -1); // break; // case 'row_percent': // case 'column_percent': // data = filter(this.loadScenarioGridData_percent, val => name.indexOf(val.name) !== -1); // break; // case 'row_number': // case 'column_number': // data = filter(this.loadScenarioGridData_number, val => name.indexOf(val.name) !== -1); // break; // default: // data = filter(this.loadScenarioGridData, val => name.indexOf(val.name) !== -1); // } // return of(data); // } cellClickedEvent(params) { switch (params.colDef.field) { case 'anomaly': // if (params.event.screenX <= SENSE_CHECK_GRID.anomaly_high && params.event.screenX >= SENSE_CHECK_GRID.anomaly_low) { // } else if ( // params.event.screenX <= SENSE_CHECK_GRID.share_high && // params.event.screenX >= SENSE_CHECK_GRID.share_low // ) { // } break; case 'volatility': const tableData = VOLATILITY_MODAL_DATA; this.modalService.openTableModal({ class: 'modal-table-custom', initialState: tableData }); break; } } }