(window.webpackJsonp=window.webpackJsonp||[]).push([[126],{1567:function(e,t,r){"use strict";r.r(t);r(11),r(10),r(5),r(12),r(8),r(13);var c=r(59),n=r(1),o=(r(134),r(148),r(4),r(163),r(74));function l(object,e){var t=Object.keys(object);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(object);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(object,e).enumerable}))),t.push.apply(t,r)}return t}function d(e){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?l(Object(source),!0).forEach((function(t){Object(n.a)(e,t,source[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(source)):l(Object(source)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(source,t))}))}return e}var h={props:{racId:{type:Number,default:0,required:!0}},data:function(){return{checklist:[],checklistItems:[],fieldsChecklist:[{key:"numero",label:"Número",class:"align-middle"},{key:"descricao",label:"Descrição",class:"align-middle"},{key:"datInspecao",label:"Data Inspeção",class:"align-middle"},"itens_verificaveis"],fieldsChecklistItems:[{key:"estrutura.numero",label:"Número"},{key:"estrutura.descricao",label:"Descrição",class:"text-left"}]}},computed:d({},Object(o.c)({empresa:"empresa/empresaAtual",permissoesUser:"usuario/permissoes",moduloAtual:"appData/modulo"})),watch:{racId:{immediate:!0,handler:function(e){var t=this;return Object(c.a)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!e){r.next=5;break}return r.next=3,t.getCheckListByRacId();case 3:return r.next=5,t.getChecklistItemsByRacId();case 5:case"end":return r.stop()}}),r)})))()}}},methods:{goToChecklist:function(e){var t=this.$router.resolve({path:"/ambiental/fichas/checklist/".concat(e.id.idCheckList)});window.open(t.href,"_blank"),this.$bvModal.hide("modalChecklist")},getCheckListByRacId:function(){var e=this;this.loading=!0,this.$racService.getCheckListByRacId(this.empresa.sigla,this.racId).then((function(t){void 0===t.data&&null===t.data||e.checklist.push(d(d({},t.data),{},{_showDetails:!1}))})).catch((function(t){e.$notify({title:"Erro",text:t.response?t.response.data.message:t,type:"error"})})).finally((function(){e.loading=!1}))},getChecklistItemsByRacId:function(){var e=this;this.$racService.getChecklistItemsByRacId(this.empresa.sigla,this.racId).then((function(t){e.checklistItems=t.data,e.checklistItems&&e.checklistItems.length>0&&(e.checklistItems=e.checklistItems.sort((function(a,b){return a.estrutura.numero-b.estrutura.numero})))})).catch((function(t){e.$notify({title:"Erro",text:t.response?t.response.data.message:t,type:"error"})}))}}},m=r(37),component=Object(m.a)(h,(function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("b-card",[r("div",{staticClass:"mt-4",attrs:{slot:"header"},slot:"header"},[r("b-row",[r("b-col",{staticClass:"d-flex justify-content-start"},[r("fa-icon",{staticStyle:{"font-size":"1.5rem"},attrs:{icon:"check"}}),e._v(" "),r("h3",{staticClass:"ml-3"},[e._v("Checklist")])],1)],1)],1),e._v(" "),r("b-row",[r("b-table",{staticClass:"mt-2",staticStyle:{cursor:"pointer"},attrs:{striped:"",hover:"","show-empty":"",fields:e.fieldsChecklist,items:e.checklist,"empty-text":"Não há nenhuma Checklist referente a esta RAC."},on:{"row-clicked":function(t){return e.goToChecklist(e.checklist[0])}},scopedSlots:e._u([{key:"cell(itens_verificaveis)",fn:function(t){return[r("b-button",{staticClass:"mr-2 align-middle",attrs:{size:"sm"},on:{click:t.toggleDetails}},[e._v("\n          "+e._s(t.detailsShowing?"Ocultar":"Mostar")+" itens\n        ")])]}},{key:"row-details",fn:function(t){return[r("b-card",[r("b-table",{staticClass:"mt-2",attrs:{striped:"",hover:"","show-empty":"",fields:e.fieldsChecklistItems,items:e.checklistItems,"empty-text":"Não há itens verificáveis incluídos."}}),e._v(" "),r("b-button",{attrs:{size:"sm"},on:{click:t.toggleDetails}},[e._v("Ocultar itens")])],1)]}},{key:"cell(numero)",fn:function(t){return[e._v("\n        "+e._s(t.item.numero)+"\n      ")]}},{key:"cell(descricao)",fn:function(t){return[void 0!==t.item.descricao?r("div",[e._v("\n          "+e._s(t.item.descricao.length>400?t.item.descricao.substring(0,400)+"...":t.item.descricao)+"\n        ")]):e._e()]}},{key:"cell(datInspecao)",fn:function(t){return[e._v("\n        "+e._s(e._f("formatDate")(t.item.datInspecao))+"\n      ")]}}])})],1)],1)}),[],!1,null,null,null);t.default=component.exports}}]);
//# sourceMappingURL=f0c84ec-1.2.10.js.map