(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{"6OZL":function(t,e,o){"use strict";o.r(e),o.d(e,"ForecastsModule",function(){return m});var n=o("SVse"),i=o("iInd"),r=o("8Y7J"),a=o("Iab2"),s=o("IheW"),c=o("s7LF"),l=o("EApP"),d=o("u47x"),p=o("eZAi");function b(t,e){if(1&t){const t=r.Tb();r.Sb(0,"tr",23),r.Sb(1,"td",24),r.Nb(2,"input",25),r.Rb(),r.Sb(3,"td",26),r.Sb(4,"button",27),r.cc("click",function(){r.zc(t);const o=e.index,n=r.ec();return n.Download(o,n.StaticReportsList.controls[o].get("FILENAME").value)}),r.Nb(5,"i",28),r.Rb(),r.Rb(),r.Sb(6,"td",26),r.Sb(7,"button",29),r.cc("click",function(){r.zc(t);const o=e.index,n=r.ec();return n.Delete(o,n.StaticReportsList.controls[o].get("FILENAME").value)}),r.Nb(8,"i",30),r.Rb(),r.Rb(),r.Rb()}2&t&&r.mc("formGroupName",e.index)}let g=(()=>{class t{constructor(t,e,o,n,i,a,c){this.fb=t,this.router=e,this.http=o,this.toastr=n,this.interactivityChecker=i,this.staticReportsService=a,this.platformId=c,this.onUploadFinished=new r.n,this.UploadFile=(t,e)=>{0!==t.length&&this.staticReportsService.UploadFile(t,e,"Forecasts","ForecastReports").subscribe(t=>{t.type===s.d.UploadProgress?this.progress=Math.round(100*t.loaded/t.total):t.type===s.d.Response&&(this.message="Upload success.",this.onUploadFinished.emit(t.body)),this.GetAllFiles(),this.StaticRports.reset()})},this.CreateForecastsForm()}CreateForecastsForm(){const t=[];for(let e=0;e<12;e++)t.push(this.StaticReports());this.ForecastsForm=this.fb.group({StaticRports:this.fb.group({FILENAME:[""]}),StaticReportsList:this.fb.array(t)})}StaticReports(){return this.fb.group({DOWNLOADFILE:[""],FILENAME:[""]})}get StaticRports(){return this.ForecastsForm.get("StaticRports")}get StaticReportsList(){return this.ForecastsForm.get("StaticReportsList")}ngOnInit(){this.GetAllFiles()}GetAllFiles(){this.staticReportsService.StaticReportDetails("Forecasts","ForecastReports").subscribe(t=>{if(this.FileName=t,this.FileName.length>0){const t=this.ForecastsForm.controls.StaticReportsList;for(let e=0;e<this.FileName.length;e++)t.at(+e).get("DOWNLOADFILE").setValue(this.FileName[e].FileNameWithOutExtension),t.at(+e).get("FILENAME").setValue(this.FileName[e].FileName),e>=11&&e<this.FileName.length-1&&this.StaticReportsList.push(this.StaticReports())}})}Delete(t,e){const o=this.ForecastsForm.controls.StaticReportsList;for(let n=0;n<o.length;n++)if(t==n){e&&this.staticReportsService.Delete("Forecasts","ForecastReports",e).subscribe(e=>{null==e&&(this.StaticReportsList.removeAt(t),this.toastr.warning("Deleted Successfully","Forecasts"),this.StaticReportsList.push(this.StaticReports()))},t=>{console.log(t)});break}}Download(t,e){const o=this.ForecastsForm.controls.StaticReportsList;for(let n=0;n<o.length;n++)if(t==n){e&&this.staticReportsService.DownloadFile("Forecasts","ForecastReports",e).subscribe(t=>{let o=new Blob([t],{type:"application/pdf"});const n=window.URL.createObjectURL(o);"application/pdf"===t.type?window.open(n,"_blank"):a.saveAs(o,e)});break}}keyevent(t){t.preventDefault();const e=Array.prototype.slice.call(document.querySelectorAll("input")),o=[];if(Array.isArray(o)&&!o.length)for(let n=0;n<e.length;n++)this.interactivityChecker.isFocusable(e[n])&&o.push(e[n]);if(13===t.keyCode||40===t.keyCode){const t=o[o.indexOf(document.activeElement)+1];t&&(t.focus(),t.select())}else if(38===t.keyCode){const t=o[o.indexOf(document.activeElement)-1];t&&(t.focus(),t.select())}}}return t.\u0275fac=function(e){return new(e||t)(r.Mb(c.c),r.Mb(i.e),r.Mb(s.b),r.Mb(l.b),r.Mb(d.d),r.Mb(p.a),r.Mb(r.B))},t.\u0275cmp=r.Gb({type:t,selectors:[["forecastsreport"]],hostBindings:function(t,e){1&t&&r.cc("keyup",function(t){return e.keyevent(t)},!1,r.yc)},outputs:{onUploadFinished:"onUploadFinished"},decls:24,vars:3,consts:[[1,"container-fluid"],["autocomplete","off",3,"formGroup"],[1,"row"],[1,"col-md-11"],[1,"shadow-sm","card","no-padding"],[1,"card-body","no-padding"],[1,"row",2,"padding-bottom","0px"],[1,"col-md-12"],["formGroupName","StaticRports"],[1,"row","no-padding","mb-2"],[1,"col-sm-8",2,"padding-right","5px"],["type","text","formControlName","FILENAME","id","FILENAME","placeholder","New File Name",1,"form-control","form-control-sm","bg-white"],[1,"col-sm-4","no-padding","text-right"],[1,"upload-button","btn","blue-gradient","btn-block","btn-rounded","px-1","mr-1",3,"disabled"],[1,"fa","fa-upload"],["type","file",3,"change"],["file",""],[1,"shadow-sm","card"],[1,"card-body"],[1,"tableFixHead"],[1,"table-responsive-sm","fix-table"],["formArrayName","StaticReportsList",1,"table","table-sm","table-borderless"],[3,"formGroupName",4,"ngFor","ngForOf"],[3,"formGroupName"],[1,"no-padding;"],["type","text","formControlName","DOWNLOADFILE",1,"form-control","form-control-sm","no-border",2,"padding-left","15px"],[1,"no-padding;",2,"width","30px"],["type","button",1,"my-btn-height","btn","blue-gradient","btn-block","btn-rounded","px-1",3,"click"],["aria-hidden","true","title","Download",1,"fa","fa-download"],["type","button",1,"my-btn-height","btn","peach-gradient","btn-block","btn-rounded","px-1",3,"click"],["title","Delete",1,"fa","fa-trash"]],template:function(t,e){if(1&t){const t=r.Tb();r.Sb(0,"div",0),r.Sb(1,"form",1),r.Sb(2,"div",2),r.Sb(3,"div",3),r.Sb(4,"div",4),r.Sb(5,"div",5),r.Sb(6,"div",6),r.Sb(7,"div",7),r.Sb(8,"div",8),r.Sb(9,"div",9),r.Sb(10,"div",10),r.Nb(11,"input",11),r.Rb(),r.Sb(12,"div",12),r.Sb(13,"button",13),r.Nb(14,"i",14),r.Sb(15,"input",15,16),r.cc("change",function(){r.zc(t);const o=r.wc(16);return e.UploadFile(o.files,e.StaticRports.get("FILENAME").value)}),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Sb(17,"div",17),r.Sb(18,"div",18),r.Sb(19,"div",19),r.Sb(20,"div",20),r.Sb(21,"table",21),r.Sb(22,"tbody"),r.Ic(23,b,9,1,"tr",22),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb()}2&t&&(r.yb(1),r.mc("formGroup",e.ForecastsForm),r.yb(12),r.mc("disabled",""===e.StaticRports.get("FILENAME").value||null===e.StaticRports.get("FILENAME").value),r.yb(10),r.mc("ngForOf",e.StaticReportsList.controls))},directives:[c.t,c.m,c.g,c.h,c.a,c.l,c.e,c.b,n.m],styles:['.row[_ngcontent-%COMP%]{padding:10px}.card[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;margin:10px 0}.card-body[_ngcontent-%COMP%]{flex:1 1 auto;min-height:1px;padding:1px}button[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:14px}.action-buttons[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:5px}.font-label[_ngcontent-%COMP%]{font-size:12px}.btn-height[_ngcontent-%COMP%]{height:30px;width:100px}.btn-height[_ngcontent-%COMP%], .my-btn-height[_ngcontent-%COMP%]{font-size:12px;padding:0;color:#fff}.my-btn-height[_ngcontent-%COMP%]{height:28px;width:30px;margin-top:0}.upload-button[_ngcontent-%COMP%]{height:30px;overflow:hidden;position:relative;width:120px;color:#fff;padding-top:3px}.upload-button[_ngcontent-%COMP%]:after{content:" Add New File";color:#fff;font-size:14px;text-align:center}.upload-button[_ngcontent-%COMP%] input[type=file][_ngcontent-%COMP%]{font-size:14px;left:0;opacity:0;position:absolute;top:0;padding-top:0}table[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{font-size:12px;font-weight:700;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;text-transform:uppercase}input[_ngcontent-%COMP%]::-moz-placeholder{color:#c0bdbd;font-weight:300;text-transform:capitalize}input[_ngcontent-%COMP%]::placeholder{color:#c0bdbd;font-weight:300;text-transform:capitalize}.fix-table[_ngcontent-%COMP%]{height:350px;overflow-y:auto;width:100%}.tableFixHead[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{position:-webkit-sticky;position:sticky;top:0}thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:1px!important;height:32px!important;font-weight:400;vertical-align:middle}.table-borderless[_ngcontent-%COMP%] td[_ngcontent-%COMP%], tr[_ngcontent-%COMP%] .table-borderless[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{border:0}tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]{height:22px}table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%], tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]{padding:0!important}.no-padding[_ngcontent-%COMP%]{padding:0}.no-border[_ngcontent-%COMP%]{border:0;border-color:#fff}.right-padding[_ngcontent-%COMP%]{padding-right:10px;font-weight:400}.z-depth-1a[_ngcontent-%COMP%]{box-shadow:0 2px 5px 0 rgba(55,161,255,.26),0 4px 12px 0 rgba(121,155,254,.25)}.btn[_ngcontent-%COMP%]:hover, .z-depth-1-half[_ngcontent-%COMP%]{box-shadow:0 5px 11px 0 rgba(85,182,255,.28),0 4px 15px 0 rgba(36,133,255,.15)}']}),t})();const f=[{path:"",data:{title:"Forecasts"},children:[{path:"",redirectTo:"ForecastsComponent",pathMatch:"full"},{path:"",component:(()=>{class t{constructor(){}ngOnInit(){}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275cmp=r.Gb({type:t,selectors:[["app-forecasts"]],decls:13,vars:0,consts:[[1,"row"],[1,"col-md-10","offset-1"],[1,"shadow-sm","card","h-100"],[1,"card-body"],[1,"mega-ul"],[1,"custom-dropdown",2,"width","330px","text-align","center"],[1,"col-md-8","offset-2"],[1,"d-flex","justify-content-center"],[1,"col-md-6"]],template:function(t,e){1&t&&(r.Sb(0,"div",0),r.Sb(1,"div",1),r.Sb(2,"div",2),r.Sb(3,"div",3),r.Sb(4,"ul",4),r.Sb(5,"li",5),r.Sb(6,"a"),r.Kc(7,"Forecasts"),r.Rb(),r.Rb(),r.Rb(),r.Sb(8,"div",6),r.Nb(9,"forecastsreport"),r.Rb(),r.Sb(10,"div",7),r.Sb(11,"div",8),r.Nb(12,"router-outlet"),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb(),r.Rb())},directives:[g,i.i],styles:[".mega-ul[_ngcontent-%COMP%]{background:#bc1135;padding:1px;font-weight:700;font-size:18px}.row[_ngcontent-%COMP%]{margin-right:10px;margin-left:10px;margin-top:10px}.card-body[_ngcontent-%COMP%]{flex:1 1 auto;min-height:520px;max-height:520px;padding-left:5px;padding-right:5px;padding-bottom:4px}.h-100[_ngcontent-%COMP%]{border:1px dotted #c22}.custom-dropdown[_ngcontent-%COMP%]{display:inline-block;padding:10px;margin-right:10px;border-radius:10px}.custom-dropdown[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:#fff;text-decoration:none}.custom-dropdown[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:active{color:#e78080;text-decoration:none}"]}),t})(),data:{title:"Forecasts"}}]}];let u=(()=>{class t{}return t.\u0275mod=r.Kb({type:t}),t.\u0275inj=r.Jb({factory:function(e){return new(e||t)},imports:[[i.h.forChild(f)],i.h]}),t})();var h=o("H8qh");let m=(()=>{class t{}return t.\u0275mod=r.Kb({type:t}),t.\u0275inj=r.Jb({factory:function(e){return new(e||t)},imports:[[n.c,u,h.a]]}),t})()},Iab2:function(t,e,o){var n,i;void 0===(i="function"==typeof(n=function(){"use strict";function e(t,e,o){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){a(n.response,e,o)},n.onerror=function(){console.error("could not download file")},n.send()}function o(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch(t){}return 200<=e.status&&299>=e.status}function n(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(e){var o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(o)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,r=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=i.saveAs||("object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!r?function(t,r,a){var s=i.URL||i.webkitURL,c=document.createElement("a");c.download=r=r||t.name||"download",c.rel="noopener","string"==typeof t?(c.href=t,c.origin===location.origin?n(c):o(c.href)?e(t,r,a):n(c,c.target="_blank")):(c.href=s.createObjectURL(t),setTimeout(function(){s.revokeObjectURL(c.href)},4e4),setTimeout(function(){n(c)},0))}:"msSaveOrOpenBlob"in navigator?function(t,i,r){if(i=i||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(function(t,e){return void 0===e?e={autoBom:!1}:"object"!=typeof e&&(console.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}(t,r),i);else if(o(t))e(t,i,r);else{var a=document.createElement("a");a.href=t,a.target="_blank",setTimeout(function(){n(a)})}}:function(t,o,n,a){if((a=a||open("","_blank"))&&(a.document.title=a.document.body.innerText="downloading..."),"string"==typeof t)return e(t,o,n);var s="application/octet-stream"===t.type,c=/constructor/i.test(i.HTMLElement)||i.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||s&&c||r)&&"undefined"!=typeof FileReader){var d=new FileReader;d.onloadend=function(){var t=d.result;t=l?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),a?a.location.href=t:location=t,a=null},d.readAsDataURL(t)}else{var p=i.URL||i.webkitURL,b=p.createObjectURL(t);a?a.location=b:location.href=b,a=null,setTimeout(function(){p.revokeObjectURL(b)},4e4)}});i.saveAs=a.saveAs=a,t.exports=a})?n.apply(e,[]):n)||(t.exports=i)}}]);