{"version":3,"sources":["webpack:///./src/entity/Ppe/PlanHeader.ts","webpack:///./src/services/PpeDropDowns.ts"],"names":["i18n_setup_1","require","PlanHeader","_createClass","_classCallCheck","exports","STATUS_LIST","value","text","DROP_DOWN_STATUS_LIST","getDropDownStatusList","length","push","forEach","el","i18n","t","SOURCE","LEVEL","axios_1","tslib_1","__importDefault","DropDownItem_1","General_1","MainVar_1","mainVar","TARGET_CUSTOMER_1_LIST","TARGET_CUSTOMER_2_LIST","MECHANICS_LIST","MODALITY_LIST","PRODUCT_CONFIRMATION_LIST","BRAND_LIST","VARIANT_LIST","PRODUCT_LIST","ForceAllDropDownList","General","GetDropdownList","TARGET_CUSTOMER_1","_context","sent","next","TARGET_CUSTOMER_2","MECHANICS","MODALITY","PRODUCT_CONFIRMATION","stop","_callee","SyncPpeDropdowns","firstLoad","_context2","MainVar","GetAsync","ForceAllProductList","previousMainVar","dropDownListLastUpdate","translationsLastUpdate","lastEndpointCheck","IsRecent","_callee2","GetDropDownListBySource","source","selectOptions","_context3","t0","abrupt","_callee3","GetProductListByLevel","BRAND","_context4","VARIANT","PRODUCT","_callee4","level","product","_context5","default","post","GetApiUrl","withCredentials","response","data","prev","_callee5","GetProductDropDownValues","productList","productItem","DropDownItem","productDropDownList","_context6","e","idDropDownItem","code4","itemText","desc4","filter","s","code5","desc5","idProduct","productDescription","SetOptionsDropDown","t1","_callee6","GetDropdownCountriesForUser","subsidiaryOnly","arguments","undefined","country","countryList","endpoint","_context7","get","responseType","element","idCountry","name","HandleError","this","_callee7"],"mappings":"2OACA,IAAAA,EAAAC,EAAA,QAQaC,EAAUC,GAAA,SAAAD,IAAAE,EAAA,KAAAF,MAAvBG,EAAAH,aAyCaG,EAAAC,YAA0B,CAAC,CACpCC,MAAO,EACPC,KAAM,gBAEV,CACID,MAAO,EACPC,KAAM,gBAEV,CACID,MAAO,EACPC,KAAM,gBAEV,CACID,MAAO,EACPC,KAAM,gBAEV,CACID,MAAO,EACPC,KAAM,gBAEV,CACID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MAKTwC,EAASC,KAAM,CAAF8B,EAAAtE,KAAA,SAOT,OANHuC,EAASC,KAAKnE,SAAS,SAAAoG,GACnBN,EAAU,IAAIrF,EAAAgE,aACdqB,EAAQjB,eAAiBuB,EAAQC,UACjCP,EAAQf,SAAWqB,EAAQE,KAE3BP,EAAYhG,KAAK+F,MAClBG,EAAA9C,OAAA,SACIzC,EAAAY,QAAQiE,mBAAmBQ,IAAY,QAAAE,EAAAtE,KAAA,iBAGpB,OAHoBsE,EAAA7B,KAAA,GAAA6B,EAAA/C,GAAA+C,EAAA,YAGlDvF,EAAAY,QAAQiF,YAAWN,EAAA/C,GAAKsD,MAAMP,EAAA9C,OAAA,SACvB,MAAI,yBAAA8C,EAAAjE,UAAAyE,EAAA,mBAhKnBjH,EAAA6B,uBAQA7B,EAAA0C,mBAyBA1C,EAAAsD,0BA+BAtD,EAAA+C,sBAMA/C,EAAA6D,wBAcA7D,EAAA8E,2BAkDA9E,EAAAkG","file":"js/chunk-818f8cc6.d3009870.js","sourcesContent":["import { UnitOfMeasurement } from './UnitOfMeasurement';\r\nimport { i18n } from \"@/i18n/i18n-setup\";\r\nimport { PlanDetail } from \"./PlanDetail\";\r\nimport { PlanAuthorization } from \"./PlanAuthorization\";\r\nimport { PlanTarget } from \"./PlanTarget\";\r\nimport { IPlanProducts } from \"@/interfaces/IPlanProduct\";\r\nimport { PlanAttachment } from \"./PlanAttachment\";\r\nimport { PlanFinal } from \"./PlanFinal\";\r\n\r\nexport class PlanHeader {\r\n public id: string;\r\n public numericId: number;\r\n public number: string;\r\n public sapCode: string;\r\n public description: string;\r\n public creator: string;\r\n public idCountryFrom: string;\r\n public mrkMngSign: string;\r\n public cnyMngSign: string;\r\n public mrkHeadSign: string;\r\n public placeDate: string;\r\n public status: number;\r\n public currentVersion: [];\r\n public countryFromName: string;\r\n public titleDescription: string;\r\n public planStartDate: Date;\r\n public planEndDate: Date;\r\n public targetStatusDescription: string;\r\n public finalStatusDescription: string;\r\n public statusDescription: string;\r\n public allBrandsDetail: boolean;\r\n public isExpiredWithoutEvalutaion: boolean;\r\n public isCountryManager: boolean;\r\n public isPromotionRequester: boolean;\r\n public isExpired: boolean;\r\n public idUnit: string;\r\n public isImported: boolean;\r\n\r\n public detail: PlanDetail;\r\n public target: PlanTarget;\r\n public final: PlanFinal;\r\n public authorization: PlanAuthorization;\r\n public unitOfMeasurement : UnitOfMeasurement;\r\n\r\n public productsIncluded: Array;\r\n public productsExcluded: Array;\r\n public productsCostAllocation: Array;\r\n public attachments: Array;\r\n}\r\n\r\nexport const STATUS_LIST: Array = [{\r\n value: 1,\r\n text: \"PPE.STATUS_1\"\r\n},\r\n{\r\n value: 2,\r\n text: \"PPE.STATUS_2\"\r\n},\r\n{\r\n value: 3,\r\n text: \"PPE.STATUS_3\"\r\n},\r\n{\r\n value: 4,\r\n text: \"PPE.STATUS_4\"\r\n},\r\n{\r\n value: 5,\r\n text: \"PPE.STATUS_5\"\r\n},\r\n{\r\n value: -1,\r\n text: \"PPE.STATUS_REFUSED\"\r\n},\r\n{\r\n value: -2,\r\n text: \"PPE.STATUS_EXPIRED\"\r\n}];\r\n\r\nlet DROP_DOWN_STATUS_LIST: Array = [];\r\n\r\nexport function getDropDownStatusList(): Array {\r\n if(DROP_DOWN_STATUS_LIST.length == 0) {\r\n DROP_DOWN_STATUS_LIST.push({ value: null, text: \"\" });\r\n\r\n STATUS_LIST.forEach(function (el) {\r\n DROP_DOWN_STATUS_LIST.push({ value: el.value, text: i18n.t(el.text) as string});\r\n });\r\n }\r\n return DROP_DOWN_STATUS_LIST;\r\n}","import axios from \"axios\";\r\nimport { DropDownItem } from \"./DropDownItem\";\r\nimport { General } from \"./General\";\r\nimport { MainVar } from \"@/entity/MainVar\";\r\nimport { IPlanProducts } from \"@/interfaces/IPlanProduct\";\r\n\r\nclass SelectOption {\r\n value: string;\r\n text: string;\r\n\r\n constructor(\r\n value?: string,\r\n text?: string, \r\n ) {\r\n this.value = value;\r\n this.text = text; \r\n }\r\n}\r\n\r\nexport enum SOURCE {\r\n TARGET_CUSTOMER_1 = \"PPE_TARGET_CUSTOMER_1\",\r\n TARGET_CUSTOMER_2 = \"PPE_TARGET_CUSTOMER_2\",\r\n MECHANICS = \"PPE_MECHANICS\",\r\n MODALITY = \"PPE_MODALITY\",\r\n PRODUCT_CONFIRMATION = \"PPE_PRODUCT_CONFIRMATION\"\r\n}\r\n\r\nexport enum LEVEL {\r\n BRAND = 1,\r\n VARIANT = 2,\r\n PRODUCT = 3\r\n}\r\n\r\nlet TARGET_CUSTOMER_1_LIST: Array = [];\r\nlet TARGET_CUSTOMER_2_LIST: Array = [];\r\nlet MECHANICS_LIST: Array = [];\r\nlet MODALITY_LIST: Array = [];\r\nlet PRODUCT_CONFIRMATION_LIST: Array = [];\r\n\r\nlet BRAND_LIST: Array = [];\r\nlet VARIANT_LIST: Array = [];\r\nlet PRODUCT_LIST: Array = [];\r\n\r\nlet mainVar: MainVar;\r\n\r\nexport async function ForceAllDropDownList() {\r\n TARGET_CUSTOMER_1_LIST = await General.GetDropdownList(SOURCE.TARGET_CUSTOMER_1);\r\n TARGET_CUSTOMER_2_LIST = await General.GetDropdownList(SOURCE.TARGET_CUSTOMER_2);\r\n MECHANICS_LIST = await General.GetDropdownList(SOURCE.MECHANICS);\r\n MODALITY_LIST = await General.GetDropdownList(SOURCE.MODALITY);\r\n PRODUCT_CONFIRMATION_LIST = await General.GetDropdownList(SOURCE.PRODUCT_CONFIRMATION);\r\n}\r\n\r\nexport async function SyncPpeDropdowns() {\r\n let firstLoad: boolean = false;\r\n if(mainVar == null) {\r\n mainVar = new MainVar();\r\n await mainVar.GetAsync();\r\n firstLoad = true;\r\n }\r\n \r\n if(firstLoad) {\r\n await ForceAllProductList();\r\n await ForceAllDropDownList();\r\n } else {\r\n let previousMainVar = new MainVar();\r\n previousMainVar.dropDownListLastUpdate = mainVar.dropDownListLastUpdate;\r\n previousMainVar.translationsLastUpdate = mainVar.translationsLastUpdate;\r\n previousMainVar.lastEndpointCheck = mainVar.lastEndpointCheck;\r\n\r\n await mainVar.GetAsync();\r\n if(mainVar.IsRecent(previousMainVar)) { \r\n await ForceAllProductList();\r\n await ForceAllDropDownList();\r\n }\r\n }\r\n}\r\n\r\nexport async function GetDropDownListBySource(source:string): Promise {\r\n let selectOptions: Array = [];\r\n\r\n await SyncPpeDropdowns();\r\n\r\n switch(source) {\r\n case SOURCE.TARGET_CUSTOMER_1: {\r\n selectOptions = TARGET_CUSTOMER_1_LIST;\r\n break;\r\n }\r\n case SOURCE.TARGET_CUSTOMER_2: {\r\n selectOptions = TARGET_CUSTOMER_2_LIST;\r\n break;\r\n }\r\n case SOURCE.MECHANICS: {\r\n selectOptions = MECHANICS_LIST;\r\n break;\r\n }\r\n case SOURCE.MODALITY: {\r\n selectOptions = MODALITY_LIST;\r\n break;\r\n }\r\n case SOURCE.PRODUCT_CONFIRMATION: {\r\n selectOptions = PRODUCT_CONFIRMATION_LIST;\r\n break;\r\n }\r\n }\r\n\r\n return selectOptions;\r\n}\r\n\r\nexport async function ForceAllProductList() {\r\n BRAND_LIST = await GetProductListByLevel(LEVEL.BRAND);\r\n VARIANT_LIST = await GetProductListByLevel(LEVEL.VARIANT);\r\n PRODUCT_LIST = await GetProductListByLevel(LEVEL.PRODUCT);\r\n}\r\n\r\nexport async function GetProductListByLevel(level: number): Promise> {\r\n try {\r\n let product = {} as IPlanProducts;\r\n let response = await axios.post(General.GetApiUrl('/api/ppe/GetProductDropDownValues?level=' + level)\r\n ,product\r\n ,{ withCredentials: true });\r\n if(response.data) {\r\n return response.data;\r\n }\r\n } catch(ex) {\r\n return null;\r\n }\r\n}\r\n\r\nexport async function GetProductDropDownValues(product: IPlanProducts, level: number): Promise {\r\n try {\r\n let productList: Array = [];\r\n let productItem: DropDownItem = new DropDownItem();\r\n let productDropDownList: DropDownItem[] = [];\r\n\r\n await SyncPpeDropdowns();\r\n\r\n switch(level) {\r\n case LEVEL.BRAND: {\r\n productList = BRAND_LIST;\r\n\r\n productList.forEach(e => {\r\n productItem = new DropDownItem();\r\n productItem.idDropDownItem = e.code4;\r\n productItem.itemText = e.desc4;\r\n \r\n productDropDownList.push(productItem);\r\n });\r\n break;\r\n }\r\n case LEVEL.VARIANT: {\r\n productList = VARIANT_LIST.filter(s => (!product.code4 || s.code4 === product.code4));\r\n productList.forEach(e => {\r\n productItem = new DropDownItem();\r\n productItem.idDropDownItem = e.code5;\r\n productItem.itemText = e.desc5;\r\n \r\n productDropDownList.push(productItem);\r\n });\r\n break;\r\n }\r\n case LEVEL.PRODUCT: {\r\n productList = PRODUCT_LIST.filter(s => (!product.code4 || s.code4 === product.code4)\r\n && (!product.code5 || s.code5 === product.code5));\r\n productList.forEach(e => {\r\n productItem = new DropDownItem();\r\n productItem.idDropDownItem = e.idProduct;\r\n productItem.itemText = e.productDescription;\r\n \r\n productDropDownList.push(productItem);\r\n });\r\n }\r\n }\r\n return General.SetOptionsDropDown(productDropDownList);\r\n } catch(ex) {\r\n return null;\r\n }\r\n}\r\n\r\nexport async function GetDropdownCountriesForUser(subsidiaryOnly: boolean = false): Promise> {\r\n try{\r\n let country: DropDownItem = new DropDownItem();\r\n let countryList: DropDownItem[] = [];\r\n let endpoint: string = \"/api/ppe/GetCountriesForUser\";\r\n\r\n if(subsidiaryOnly)\r\n endpoint = endpoint + \"?subsidiaryOnly=true\";\r\n\r\n let response = await axios.get(\r\n General.GetApiUrl(endpoint),{\r\n responseType: \"json\",\r\n withCredentials: true\r\n });\r\n if(response.data) {\r\n response.data.forEach( element => {\r\n country = new DropDownItem();\r\n country.idDropDownItem = element.idCountry;\r\n country.itemText = element.name;\r\n\r\n countryList.push(country);\r\n });\r\n return General.SetOptionsDropDown(countryList);\r\n }\r\n } catch(ex) {\r\n General.HandleError(ex, this);\r\n return null;\r\n }\r\n}"],"sourceRoot":""}