"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[9811],{6452:function(t,e,s){s.r(e),s.d(e,{default:function(){return v}});var r=function(){var t=this,e=t._self._c;return e("Modal",{ref:"modal",attrs:{autoOpen:!0,fullHeight:!0},on:{closed:function(e){return t.$emit("closed")}}},[e("div",{staticClass:"uk-padding-small"},[e("h4",{staticClass:"uk-margin-remove"},[t._v(" Отчеты ")])]),e("div",{staticClass:"uk-padding-small",staticStyle:{"flex-grow":"1","min-height":"1px",overflow:"auto",position:"relative"}},[null===t.reports?e("loader"):t.reports.length?e("ul",{staticClass:"pos-list"},t._l(t.reports,(function(s,r){return e("li",{key:r,staticClass:"pos-list-item"},[e("div",{staticClass:"pos-list-item-status",class:{success:"done"===s.status,warning:"error"===s.status}}),e("div",{staticClass:"pos-list-item-body"},[e("div",{staticClass:"pos-list-item-body-content"},[e("h5",{staticStyle:{margin:"0"}},[t._v(t._s(s.name))]),s.description?e("div",[t._v(t._s(s.description))]):t._e(),e("div",{staticClass:"flex-row"},["done"===s.status?e("div",{staticStyle:{padding:"10px"}},[e("a",{attrs:{href:s.url,target:"_blank"}},[t._v("Скачать")])]):t._e(),s.hasError?e("div",{staticStyle:{padding:"10px"}},[e("a",{on:{click:function(e){return e.preventDefault(),t.showErrors(s)}}},[t._v("Показать ошибки")])]):t._e(),e("div",{staticStyle:{padding:"10px"}},[e("a",{attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.deleteReport(s)}}},[t._v("Удалить")])])]),t.displayedError===s.id?e("textarea",{staticClass:"uk-textarea",staticStyle:{width:"100%",height:"250px",margin:"5px"},attrs:{readonly:""},domProps:{value:s.reportResult.errorMessage}}):t._e()]),e("div",{staticClass:"pos-list-item-body-footer"},[e("ul",{staticClass:"pos-list-item-body-meta"},[e("li",{staticClass:"pos-list-item-body-meta-item"},[e("div",[e("div",{staticClass:"pos-list-item-body-meta-item--key"},[t._v(" Дата: ")]),e("div",{staticClass:"pos-list-item-body-meta-item--val"},[t._v(" "+t._s(s.created)+" ")])])]),e("li",{staticClass:"pos-list-item-body-meta-item"},[e("div",[e("div",{staticClass:"pos-list-item-body-meta-item--key"},[t._v(" Состояние: ")]),e("div",{staticClass:"pos-list-item-body-meta-item--val"},[t._v(" "+t._s(s.statusStr)+" ")])])])])])])])})),0):e("h3",[t._v("Отчеты не найдены")])],1)])},a=[],i=s(3216),l=s(1576),o=s.n(l),n=s(4989),d={name:"ModalReportsGateway",components:{Modal:()=>s.e(8362).then(s.bind(s,2215)),Loader:()=>s.e(8326).then(s.bind(s,1259))},data(){return{reportsRaw:null,states:{created:"создается",querying:"подготовка данных",processing:"обработка",done:"готов",error:"ошибка"},displayedError:null}},computed:{reports(){return this.reportsRaw?this.reportsRaw.map((t=>({...t,name:t.info.NAME,url:(0,n.A)(i.$W.reporterSvc,"download/"+t.id+"/"),created:this.convTime(t.created),statusStr:this.states[t.status],hasError:!!t?.reportResult?.errorMessage}))):null}},mounted(){this.interval=setInterval((()=>{this.reload()}),1e4),this.reload()},beforeDestroy(){this.interval&&(clearInterval(this.interval),this.interval=null)},methods:{async reload(){let t=await i.FH.gateway.serverHttp("GET","reports/list");this.reportsRaw=t.reports},async deleteReport(t){await i.FH.gateway.serverHttp("POST","reports/remove",{reportRunId:t.id}),await this.reload()},convTime(t){return t?o()(t).local().format("DD.MM.YYYY HH:mm"):"--"},showErrors(t){this.displayedError===t.id?this.displayedError=null:this.displayedError=t.id},nl2br(t){return t.replace(/(?:\r\n|\r|\n)/g,"<br/>")}}},p=d,c=s(1656),u=(0,c.A)(p,r,a,!1,null,null,null),v=u.exports}}]);
//# sourceMappingURL=ModalReportsGateway.ece5237a.js.map