(window.webpackJsonp=window.webpackJsonp||[]).push([[395],{2210:function(e,n,r){"use strict";r.r(n);r(25),r(23),r(4),r(40),r(31),r(17),r(5),r(41),r(43),r(32);function t(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return o(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(e,n)}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var i=0,t=function(){};return{s:t,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,l=!0,d=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return l=e.done,e},e:function(e){d=!0,c=e},f:function(){try{l||null==r.return||r.return()}finally{if(d)throw c}}}}function o(e,n){(null==n||n>e.length)&&(n=e.length);for(var i=0,r=new Array(n);i<n;i++)r[i]=e[i];return r}var c={name:"CorrespondenciaRelacionamentos",props:{correspondencia:{type:Object,default:function(){},required:!0}},data:function(){return{fields:[{key:"tipo",label:"Tipo"},{key:"relacao",label:"Relação"}],relacoes:[],referencias:[],treeData:[{id:0,name:"root"}]}},watch:{correspondencia:function(){this.findRelacoes(this.correspondencia.empresa.sigla,this.correspondencia.id.idCorrespondencia),this.findReferencias(this.correspondencia.empresa.sigla,this.correspondencia.id.idCorrespondencia)}},methods:{findRelacoes:function(e,n){var r=this;this.$correspondenciaService.findRelacoes(e,n).then((function(e){r.relacoes=e.data}))},findReferencias:function(e,n){var r=this;this.treeData=[{id:0,name:"root",children:[]}],this.$correspondenciaService.findReferencias(e,n).then((function(n){r.referencias=n.data;var o,c=t(r.referencias);try{for(c.s();!(o=c.n()).done;){var l=o.value,d={id:l.id.sequencia,name:l.referencia.id.idCorrespondencia};r.treeData[0].children.push(d),r.internalIterateReferencias(e,l.idCorrespReferencia,d)}}catch(e){c.e(e)}finally{c.f()}r.treeData[0].name="Cartas ("+r.referencias.length+")"}))},getDescricaoRelacao:function(e){return"PLT"===e.tipo?e.pleito.descricao:"LIC"===e.tipo?e.licenca.nroLicenca+" - "+e.licenca.descricao:"OBR"===e.tipo?e.obrigacao.descricao:""},internalIterateReferencias:function(e,n,r){this.$correspondenciaService.findReferencias(e,n).then((function(e){var n,o=t(e.data);try{for(o.s();!(n=o.n()).done;){var c=n.value,l={id:c.id.sequencia,name:c.referencia.id.idCorrespondencia};void 0===r.children&&(r.children=[]),r.children.push(l)}}catch(e){o.e(e)}finally{o.f()}}))}}},l=r(42),component=Object(l.a)(c,(function(){var e=this,n=e.$createElement,r=e._self._c||n;return r("div",[r("b-row",[r("b-col",{attrs:{cols:"12"}},[r("b-card",{staticClass:"mt-3"},[r("div",{staticClass:"mt-3 d-flex justify-content-between",attrs:{slot:"header"},slot:"header"},[r("h3",{staticClass:"ml-1"},[e._v("Relacionamentos")]),e._v(" "),r("b-button",{staticClass:"mx-2 rounded",attrs:{size:"sm",variant:"primary"}},[r("fa-icon",{attrs:{icon:"file"}}),r("span",{staticClass:"ml-2"},[e._v("Adicionar")])],1)],1),e._v(" "),r("b-row",[r("b-col",{attrs:{md:"12"}},[r("b-tree-view",{ref:"tree",attrs:{data:e.treeData,"nodes-draggable":!1,"context-menu":!1,"context-menu-items":[]}}),e._v(" "),r("b-table",{attrs:{responsive:"",items:e.relacoes,fields:e.fields,"empty-text":"Não há relacionamentos com este ID"},scopedSlots:e._u([{key:"cell(relacao)",fn:function(n){return[e._v("\n                "+e._s(e.getDescricaoRelacao(n.item))+"\n              ")]}}])})],1)],1)],1)],1)],1)],1)}),[],!1,null,null,null);n.default=component.exports}}]);
//# sourceMappingURL=528dbe4-1.2.11.js.map