1"use strict";(self["webpackChunkdatacertify"]=self["webpackChunkdatacertify"]||[]).push([[344],{1321:function(t,e,r){r.d(e,{A:function(){return l}});var n=function(){var t=this,e=t._self._c;return e("v-dialog",{attrs:{"max-width":"500px",persistent:t.loading},model:{value:t.showing,callback:function(e){t.showing=e},expression:"showing"}},[e("v-card",[e("v-card-title",[t.newClient?[t._v(" Novo Cliente ")]:[t._v(" Edição de Cliente ")]],2),e("v-form",{ref:"clientForm",on:{submit:function(e){return e.preventDefault(),t.saveClient()}}},[e("v-card-text",{staticClass:"pb-2"},[e("v-text-field",{attrs:{label:"Nome Completo *",filled:"","hide-details":"auto",disabled:t.loading,rules:[t.$rules.required]},model:{value:t.client.name,callback:function(e){t.$set(t.client,"name",e)},expression:"client.name"}}),e("v-text-field",{staticClass:"mt-3",attrs:{label:"E-mail",filled:"","hide-details":"auto",disabled:t.loading,rules:[t.$rules.email]},model:{value:t.client.email,callback:function(e){t.$set(t.client,"email","string"===typeof e?e.trim():e)},expression:"client.email"}})],1),e("v-card-actions",{staticClass:"pb-4 pr-6"},[e("v-spacer"),e("v-btn",{attrs:{small:"",color:"secondary",text:"",disabled:t.loading,type:"reset"},on:{click:function(e){t.showing=!1}}},[t._v(" cancelar ")]),e("v-btn",{attrs:{small:"",color:"success",loading:t.loading,type:"submit"}},[t._v(" salvar ")])],1)],1)],1)],1)},o=[],i={name:"ClientFormDialog",data:function(){return{client:{},showing:!1,loading:!1,newClient:!1}},methods:{open:function(t){void 0==t?(this.client={},this.newClient=!0):(this.client=Object.assign({},t),this.newClient=!1),this.showing=!0},saveClient:function(){var t,e=this;this.$refs.clientForm.validate()?(this.loading=!0,t=this.newClient?this.$axios.post("/client",this.client,this.$store.state.orgParams):this.$axios.put("/client/".concat(this.client.id),this.client,this.$store.state.orgParams),t.then((function(t){e.newClient?e.$showMessage("success","Cliente cadastrado"):e.$showMessage("success","Cliente atualizado"),e.showing=!1,e.$emit("updated",t.data)})).catch((function(t){e.$showMessage("error","Erro ao salvar cliente")})).finally((function(){e.loading=!1}))):this.$showMessage("warning","Preencha os campos obrigatórios")}}},a=i,s=r(1656),c=(0,s.A)(a,n,o,!1,null,null,null),l=c.exports},8280:function(t,e,r){r.r(e),r.d(e,{default:function(){return K}});var n=function(){var t=this,e=t._self._c;return e("div",[e("v-row",{staticClass:"mx-3 mt-3 mb-3"},[e("v-spacer"),e("v-btn",{staticClass:"rounded-md",attrs:{color:"primary lighten-1 ",depressed:"",large:"",loading:t.loading},on:{click:function(e){return t.$refs.manageAccessCodeDialog.show()}}},[t._v(" Criar código de acesso ")])],1),e("v-data-table",{staticStyle:{cursor:"pointer"},attrs:{items:t.accessCodes,"fixed-header":"",headers:[{text:"Código",value:"code"},{text:"Criado por",value:"creator_name"},{text:"Titular",value:"client.name"},{text:"Status",value:"is_used"},{text:"Criado em",value:"created_datetime"}],height:t.contentHeight-68+"px",loading:t.loading,"disable-pagination":"","hide-default-footer":"","loading-text":"Carregando registros","no-data-text":"Nenhum registro encontrado"},on:{"click:row":function(e){return t.openAccessCodeDetails(e)}},scopedSlots:t._u([{key:"item.is_used",fn:function(r){var n=r.item;return[e("span",{class:n.is_used?"red--text":"primary--text",style:{fontWeight:"bold"},attrs:{small:""}},[t._v(" "+t._s(n.is_used?"Utilizado":"DisponÃvel")+" ")])]}},{key:"item.code",fn:function(r){var n=r.item;return[e("span",{style:{fontFamily:"monospace",fontWeight:"bold"},on:{click:function(e){return t.copyCode(n.code)}}},[t._v(" "+t._s(n.code)+" ")]),e("v-icon",{staticClass:"ml-2",staticStyle:{cursor:"pointer"},attrs:{small:""},on:{click:function(e){return t.copyCode(n.code)}}},[t._v(" mdi-content-copy ")]),n.is_valid?e("v-icon",{staticClass:"ml-2",staticStyle:{cursor:"pointer"},attrs:{small:""},on:{click:function(e){return e.stopPropagation(),t.openEmailDialog(n)}}},[t._v(" mdi-email-outline ")]):t._e()]}}],null,!0)}),e("ManageAccessCodeDialog",{ref:"manageAccessCodeDialog",on:{change:t.fetchAccessCodes}}),e("AccessCodeDetails",{ref:"AccessCodeDetails",on:{change:t.fetchAccessCodes}}),e("SendAccessCodeEmailDialog",{ref:"sendAccessCodeEmailDialog"})],1)},o=[],i=function(){var t=this,e=t._self._c;return e("v-dialog",{attrs:{"max-width":"600"},model:{value:t.dialog,callback:function(e){t.dialog=e},expression:"dialog"}},[e("v-card",[e("v-card-title",{staticClass:"headline font-weight-bold"},[t._v(" Código de Acesso "),e("v-spacer"),e("v-btn",{attrs:{icon:""},on:{click:function(e){return t.closeDialog()}}},[e("v-icon",[t._v("mdi-close")])],1)],1),e("v-card-text",[e("v-form",{ref:"form",on:{submit:function(t){t.preventDefault()}}},[e("v-row",{staticStyle:{"flex-wrap":"nowrap","align-items":"center"}},[e("v-col",{staticClass:"pa-0",staticStyle:{"max-width":"70%"}},[e("v-select",{staticStyle:{width:"100%"},attrs:{items:t.clients,"item-text":"name","return-object":"",label:"Selecione o Titular *",filled:"","hide-details":"auto",rules:[t.$rules.required],disabled:t.loadingClients||t.loading},model:{value:t.selectedClient,callback:function(e){t.selectedClient=e},expression:"selectedClient"}})],1),e("v-col",{staticClass:"pa-0 pl-3",staticStyle:{"max-width":"30%"}},[e("v-btn",{staticClass:"ma-0",staticStyle:{width:"100%"},attrs:{color:"primary",loading:t.loading},on:{click:function(e){return t.$refs.clientFormDialog.open()}}},[t._v(" Novo Titular ")])],1)],1),e("div",{staticClass:"mt-3"},[t._v(" Por favor, copie o código de acesso abaixo e envie-o ao titular para que ele possa realizar a captura da prova ")]),e("v-divider",{staticClass:"my-3"}),t.clientsError?e("div",[e("v-alert",{attrs:{type:"error",dense:"",text:""}}
1,[t._v(" Erro ao carregar titulares. "),e("v-btn",{attrs:{text:"",small:""},on:{click:t.fetchAccessCodes}},[t._v("Tentar novamente")])],1)],1):t._e(),t.filteredAccessCodes.length?e("div",[e("div",{staticClass:"font-weight-medium mb-2"},[t._v("Códigos de acesso existentes para este titular")]),e("div",{staticStyle:{"max-height":"200px",overflow:"auto"}},[e("v-list",{attrs:{dense:""}},t._l(t.filteredAccessCodes,(function(r){return e("v-list-item",{key:r.id||r.code},[e("v-list-item-content",[e("v-list-item-title",{staticClass:"font-weight-bold"},[t._v(" "+t._s(t.midTrace(r.code))+" ")])],1),e("v-list-item-action",[e("div",{staticClass:"d-flex"},[e("v-tooltip",{attrs:{top:""},scopedSlots:t._u([{key:"activator",fn:function(n){var o=n.on,i=n.attrs;return[e("v-btn",t._g(t._b({attrs:{icon:""},on:{click:function(e){return t.copyCode(r.code)}}},"v-btn",i,!1),o),[e("v-icon",[t._v("mdi-content-copy")])],1)]}}],null,!0)},[e("span",[t._v("Copiar Código de Acesso")])]),r.is_valid?e("v-tooltip",{attrs:{top:""},scopedSlots:t._u([{key:"activator",fn:function(n){var o=n.on,i=n.attrs;return[e("v-btn",t._g(t._b({attrs:{icon:""},on:{click:function(e){return t.openEmailDialog(r)}}},"v-btn",i,!1),o),[e("v-icon",[t._v("mdi-email-outline")])],1)]}}],null,!0)},[e("span",[t._v("Enviar Código de Acesso por E-mail")])]):t._e()],1)])],1)})),1)],1)]):t._e(),t.codeError?e("div",{staticClass:"mt-3"},[e("v-alert",{attrs:{type:"error",dense:"",text:""}},[t._v(" Erro ao gerar código de acesso. "),e("v-btn",{attrs:{text:"",small:""},on:{click:function(e){return t.fetchAccessCodes()}}},[t._v("Tentar novamente")])],1)],1):t._e()],1)],1),e("v-card-actions",{staticClass:"px-6 pb-6 pt-1"},[e("v-spacer"),e("v-btn",{attrs:{text:""},on:{click:function(e){return t.closeDialog()}}},[t._v("Cancelar")]),e("v-btn",{attrs:{color:"primary",loading:t.loading,disabled:!t.selectedClient||t.loading},on:{click:function(e){t.confirmSaveDialog=!0}}},[t._v(" Gerar Código de Acesso (1 Crédito) ")])],1)],1),e("v-dialog",{ref:"confirmDialog",attrs:{"max-width":"900"},model:{value:t.confirmSaveDialog,callback:function(e){t.confirmSaveDialog=e},expression:"confirmSaveDialog"}},[e("v-card",[e("v-card-title",{staticClass:"headline font-weight-bold"},[t._v(" Deseja realmente gerar um novo código de acesso? Isso consumirá 1 crédito ")]),e("v-card-text",[t._v(" O código de acesso pode ser utilizado apenas uma vez. Se necessário, você poderá cancelá-lo posteriormente. ")]),e("v-card-actions",{staticClass:"px-6 pb-6 pt-1"},[e("v-spacer"),e("v-btn",{attrs:{text:""},on:{click:function(e){t.confirmSaveDialog=!1}}},[t._v("Cancelar")]),e("v-btn",{attrs:{color:"primary"},on:{click:function(e){t.save(t.selectedClient),t.confirmSaveDialog=!1}}},[t._v(" Confirmar ")])],1)],1)],1),e("ClientFormDialog",{ref:"clientFormDialog",on:{updated:function(e){return t.newClientCreated(e)}}}),e("SendAccessCodeEmailDialog",{ref:"sendAccessCodeEmailDialog"})],1)},a=[],s=r(1321),c=function(){var t=this,e=t._self._c;return e("v-dialog",{attrs:{"max-width":"500px",persistent:t.loading},model:{value:t.showing,callback:function(e){t.showing=e},expression:"showing"}},[e("v-card",[e("v-card-title",[t._v("Deseja enviar o código de acesso por e-mail?")]),e("v-form",{ref:"form",on:{submit:function(e){return e.preventDefault(),t.sendEmail()}}},[e("v-card-text",{staticClass:"pb-2"},[e("div",{staticClass:"font-weight-medium mb-3"},[t._v(" Código: "+t._s(t.accessCode.code)+" ")]),e("v-text-field",{attrs:{label:"E-mail do titular *",filled:"","hide-details":"auto",disabled:t.loading,rules:[t.$rules.required,t.$rules.email],autofocus:""},model:{value:t.email,callback:function(e){t.email="string"===typeof e?e.trim():e},expression:"email"}})],1),e("v-card-actions",{staticClass:"pb-4 pr-6"},[e("v-spacer"),e("v-btn",{attrs:{text:"",small:"",color:"secondary",disabled:t.loading},on:{click:function(e){return t.close()}}},[t._v(" cancelar ")]),e("v-btn",{attrs:{small:"",color:"success",loading:t.loading,type:"submit"}},[t._v(" enviar e-mail ")])],1)],1)],1)],1)},l=[];function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function d(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var i=r&&r.prototype instanceof v?r:v,a=Object.create(i.prototype);return c(a,"_invoke",function(e,r,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}
vendor: 6,042 bytes, line 1
1for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=_(s,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new D(o||[])),!0),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h={};function v(){}function p(){}function g(){}var m={};c(m,i,(function(){return this}));var y=Object.getPrototypeOf,w=y&&y(y(S([])));w&&w!==r&&n.call(w,i)&&(m=w);var b=g.prototype=v.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,s){var c=f(t[o],t,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==u(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(d).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var o;c(this,"_invoke",(function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}),!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var i=f(o,e.i,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,h;var a=i.arg;return a?a.done?(r[e.r]=a.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,h):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function E(t){this.tryEntries.push(t)}function k(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function D(t){this.tryEntries=[[-1]],t.forEach(E,this),this.reset(!0)}function S(e){if(null!=e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(u(e)+" is not iterable")}return p.prototype=g,c(b,"constructor",g),c(g,"constructor",p),p.displayName=c(g,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,s,"GeneratorFunction")),t.prototype=Object.create(b),t},e.awrap=function(t){return{__await:t}},x(C.prototype),c(C.prototype,a,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(b),c(b,s,"Generator"),c(b,i,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,D.prototype={constructor:D,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){a.type="throw",a.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],s=this.prev,c=i[1],l=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=s){if(s<c)return this.method="next",this.arg=t,n(c),!0;if(s<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o[2],h):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),k(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;k(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r:r,n:n},"next"===this.method&&(this.arg=t),h}},e}function f(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function h(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){f(i,n,o,a,s,"next",t)}function s(t){f(i,n,o,a,s,"throw",t)}a(void 0)}))}}var v={name:"SendAccessCodeEmailDialog",data:function(){return{showing:!1,loading:!1,email:"",accessCode:{}}},methods:{open:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.accessCode=t||{},this.email=r||"",this.showing=!0,this.$nextTick((function(){return e.$refs.form&&e.$refs.form.resetValidation()}))},close:function(){this.showing=!1,this.email="",this.accessCode={}},sendEmail:function(){var t=this;return h(d().mark((function e(){return d().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t.$refs.form.validate()){e.next=3;break}
1return t.$showMessage("warning","Informe um e-mail válido"),e.abrupt("return");case 3:return t.loading=!0,e.prev=4,e.next=7,t.$axios.post("/access_codes/email",{email:t.email,code:t.accessCode.code,generated_by:t.accessCode.creator_name},t.$store.state.orgParams);case 7:t.$showMessage("success","E-mail enviado com sucesso"),t.close(),e.next=14;break;case 11:e.prev=11,e.t0=e["catch"](4),t.$showMessage("error","Não foi possÃvel enviar o e-mail");case 14:return e.prev=14,t.loading=!1,e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[4,11,14,17]])})))()}}},p=v,g=r(1656),m=(0,g.A)(p,c,l,!1,null,null,null),y=m.exports;function w(t){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(t)}function b(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */b=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var i=r&&r.prototype instanceof f?r:f,a=Object.create(i.prototype);return c(a,"_invoke",function(e,r,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=_(s,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=u(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new D(o||[])),!0),a}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d={};function f(){}function h(){}function v(){}var p={};c(p,i,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(S([])));m&&m!==r&&n.call(m,i)&&(p=m);var y=v.prototype=f.prototype=Object.create(p);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==w(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(d).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var o;c(this,"_invoke",(function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}),!0)}function _(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,_(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=u(o,e.i,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var a=i.arg;return a?a.done?(r[e.r]=a.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function E(t){this.tryEntries.push(t)}function k(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function D(t){this.tryEntries=[[-1]],t.forEach(E,this),this.reset(!0)}function S(e){if(null!=e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(w(e)+" is not iterable")}return h.prototype=v,c(y,"constructor",v),c(v,"constructor",h),h.displayName=c(v,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,s,"GeneratorFunction")),t.prototype=Object.create(y),t},e.awrap=function(t){return{__await:t}},x(C.prototype),c(C.prototype,a,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Prom
1ise);var a=new C(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(y),c(y,s,"Generator"),c(y,i,(function(){return this})),c(y,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=S,D.prototype={constructor:D,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){a.type="throw",a.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],s=this.prev,c=i[1],l=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=s){if(s<c)return this.method="next",this.arg=t,n(c),!0;if(s<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o[2],d):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),k(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;k(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:S(e),r:r,n:n},"next"===this.method&&(this.arg=t),d}},e}function x(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function C(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){x(i,n,o,a,s,"next",t)}function s(t){x(i,n,o,a,s,"throw",t)}a(void 0)}))}}var _={name:"ManageAcessCodeDialog",components:{ClientFormDialog:s.A,SendAccessCodeEmailDialog:y},data:function(){return{dialog:!1,loading:!1,loadingClients:!1,clientsError:!1,codeError:!1,selectedClient:null,clients:[],accessCodes:[],confirmSaveDialog:!1}},computed:{filteredAccessCodes:function(){var t=this;return this.selectedClient&&this.accessCodes?this.accessCodes.filter((function(e){return e.client&&e.client.id===t.selectedClient.id})):[]}},methods:{show:function(){this.dialog=!0,this.fetchClients(),this.fetchAccessCodes()},newClientCreated:function(t){this.fetchClients(),this.selectedClient=t},fetchClients:function(){var t=this;return C(b().mark((function e(){var r,n,o;return b().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.loadingClients=!0,t.clientsError=!1,e.prev=2,r=t.$store.state.organization.id,e.next=6,t.$axios.get("/clients?organization_id="+r);case 6:n=e.sent,t.clients=n.data||[],t.selectedClient&&(o=t.clients.find((function(e){return e.id===t.selectedClient.id})),o||(t.selectedClient=null)),e.next=15;break;case 11:e.prev=11,e.t0=e["catch"](2),t.clientsError=!0,t.$showMessage&&t.$showMessage("error","Erro ao carregar titulares");case 15:return e.prev=15,t.loadingClients=!1,e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[2,11,15,18]])})))()},closeDialog:function(){var t=this;return C(b().mark((function e(){return b().wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.selectedClient=null,t.accessCodes=[],t.loadingClients=!1,t.clientsError=!1,t.clients=[],t.codeError=!1,t.dialog=!1,t.$emit("change");case 8:case"end":return e.stop()}}),e)})))()},fetchAccessCodes:function(){var t=arguments,e=this;return C(b().mark((function r(){var n,o,i,a,s;return b().wrap((function(r){while(1)switch(r.prev=r.next){case 0:return n=t.length>0&&void 0!==t[0]?t[0]:100,o=t.length>1&&void 0!==t[1]?t[1]:0,e.loadingClients=!0,e.clientsError=!1,i=[],r.prev=5,a=e.$store.state.organization.id,r.next=9,e.$axios.get("/access_codes?only_actives=false&organization_id=".concat(a,"&limit=").concat(n,"&offset=").concat(o));case 9:s=r.sent,i=s.data||[],e.accessCodes=i,r.next=17;break;case 14:r.prev=14,r.t0=r["catch"](5),e.codeError=!0;case 17:return r.prev=17,e.loadingClients=!1,r.finish(17);case 20:return r.abrupt("return",i);case 21:case"end":return r.stop()}}),r,null,[[5,14,17,20]])})))()},confirmGenerateCodeDialog:function(){this.confirmSaveDialog=!0},save:function(t){var e=this;return C(b().mark((function r(){var n,o;return b().wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(e.loading=!0,e.codeError=!1,r.prev=2,e.$refs.form.validate()){r.next=6;break}return e.loading=!1,r.abrupt("return");case 6:return n=e.$store.state.organization.id,r.next=9,e.$axios.post("/access_codes?organization_id="+n+"&client_id="+t.id);case 9:return o=r.sent,r.next=12,e.fetchAccessCodes();case 12:e.$showMessage&&e.$showMessage("success","Código gerado com sucesso"),e.$refs.sendAccessCodeEmailDialog.open(o.data,t.email),r.next=20;break;case 16:r.prev=16,r.t0=r["catch"](2),e.codeError=!0,e.$showMessage&&e.$showMessage("error","Erro ao gerar código de acesso");case 20:return r.prev=20,e.loading=!1,r.finish(20);case 23:case"end":return r.stop()}}),r,null,[[2,16,20,23]])})))()},midTrace:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t?t.length<=8?t:t.substr(0,4)+"..."+t.substr(t.length-4,4):""},copyCode:function(t){var e=this;return C(b().mark((function r(){return b().wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,navigator.clipboard.writeText(t);case 3:e.$showMessage&&e.$showMessage("success","Código copiado para a área de transferência"),r.next=9;break;case 6:r.prev=6,r.t0=r["catch"](0),e.$showMessage&&e.$showMessage("error","Não foi possÃvel copiar o código");case 9:case"end":return r.stop()}}),r,null,[[0,6]])})))()},openEmailDialog:function(t){var e=(t.client||{}).email||(this.selectedClient||{}).email||"";this.$refs.sendAccessCodeEmailDialog.open(t,e)}},mounted:function(){this.fetchAccessCodes()}},E=_,k=(0,g.A)(E,i,a,!1,null,null,null),D=k.exports,S=function(){var t=this,e=t._self._c;return e("v-dialog",{attrs:{"max-width":"600"},model:{value:t.dialog,callback:function(e){t.dialog=e},expression:"dialog"}},[e("v-card",[e("v-card-title",{staticClass:"headline font-weight-bold"},[t._v(" Código de Acesso "),e("v-spacer"),e("v-btn",{attrs:{icon:""},on:{click:function(e){t.dialog=!1}}},[e("v-icon",[t._v("mdi-close")])],1)],1),e("v-card-text",[e("div",{staticClass:"info-row mb-2"},[e("div",{staticStyle:{background:"#f5f5f5",padding:"10px"}},[e("div",{staticStyle:{display:"flex","align-items":"center","justify-content":"space-between"}},[e("div",{staticStyle:{"font-weight":"bold",width:"120px"}},[t._v("Código:")]),e("div",{staticStyle:{flex:"1",display:"flex","align-items":"center","justify-content":"space-between"}},[e("div",{staticStyle:{"word-break":"break-all"}},[t._v(t._s(t.accessCode.code))]),e("v-btn",{attrs:{icon:"",small:""},on:{click:function(e){return t.copyCode(t.accessCode.code)}}},[e("v-icon",{attrs:{small:""}},[t._v("mdi-content-copy")])],1),t.accessCode.is_valid?e("v-btn",{attrs:{icon:"",small:""},on:{click:function(e){return t.openEmailDialog(t.accessCode)}}},[e("v-icon",{attrs:{small:""}},[t._v("mdi-email-outline")])],1):t._e()],1)])])]),e("div",{staticClass:"info-row mb-2"},[e("div",{staticStyle:{background:"#f5f5f5",padding:"10px"}},[e("div",{staticStyle:{display:"flex"}},[e("div",{staticStyle:{"font-weight":"bold",width:"120px"}},[t._v("Criado por:")]),e("div",[t._v(t._s(t.accessCode.creator_name||"-"))])])])]),e("div",{staticClass:"info-row mb-2"},[e("div",{staticStyle:{background:"#f5f5f5",padding:"10px"}},[e("div",{staticStyle:{display:"flex"}},[e("div",{staticStyle:{"font-weight":"bold",width:"120px"}},[t._v("Titular:")]),e("div",[t._v(t._s(t.accessCode.client.name||"Sem titular"))])])])]),e("div",{staticClass:"info-row mb-2"},[e("div",{staticStyle:{background:"#f5f5f5",padding:"10px"}},[e("div",{staticStyle:{display:"flex"}},[e("div",{staticStyle:{"font-weight":"bold",width:"120px"}},[t._v("Status:")]),e("div",[t._v(t._s(t.accessCode.is_used?"Utilizado":"DisponÃvel"))])])])]),e("div",{staticClass:"info-row mb-2"},[e("div",{staticStyle:{background:"#f5f5f5",padding:"10px"}},[e("div",{staticStyle:{display:"flex"}},[e("div",{staticStyle:{"font-weight":"bold",width:"120px"}},[t._v("Criado em:")]),e("div",[t._v(t._s(t.accessCode.created_datetime))])])])]),t.accessCode.is_used&&null!=t.accessCode.record_id?e("div",{staticClass:"mt-3"},[e("div",{staticStyle:{background:"#f5f5f5",padding:"10px"}},[e("div",{staticStyle:{display:"flex"}},[e("div",{staticStyle:{"font-weight":"bold",width:"102px"}}
1,[t._v("Registro:")]),e("v-btn",{attrs:{text:"",color:"primary"},on:{click:function(e){return t.openRecordDetails(t.accessCode.record_id)}}},[t._v("Ver Registro")])],1)])]):t._e()]),e("v-card-actions",{staticClass:"px-6 pb-6 pt-1"},[e("v-spacer"),e("v-btn",{attrs:{text:""},on:{click:function(e){t.dialog=!1}}},[t._v("Fechar")]),t.accessCode&&!t.accessCode.is_used?e("v-btn",{attrs:{color:"red",dark:""},on:{click:function(e){t.confirmDeleteDialog=!0}}},[e("v-icon",{attrs:{left:""}},[t._v("mdi-delete")]),t._v(" Deletar Código de Acesso ")],1):t._e()],1)],1),e("v-dialog",{attrs:{"max-width":"450"},model:{value:t.confirmDeleteDialog,callback:function(e){t.confirmDeleteDialog=e},expression:"confirmDeleteDialog"}},[e("v-card",[e("v-card-title",{staticClass:"headline font-weight-bold"},[t._v(" Deletar Código de Acesso ")]),e("v-card-text",[t._v(" Deseja realmente deletar este código de acesso? "),e("div",[t._v("Se optar por deletar, você receberá seu crédito de volta")])]),e("v-card-actions",{staticClass:"px-6 pb-6 pt-1"},[e("v-spacer"),e("v-btn",{attrs:{text:""},on:{click:function(e){t.confirmDeleteDialog=!1}}},[t._v("Cancelar")]),e("v-btn",{attrs:{color:"red",dark:""},on:{click:function(e){return t.deleteAccessCode(t.accessCode)}}},[t._v(" Deletar ")])],1)],1)],1),e("v-dialog",{attrs:{"max-width":"1400px"},model:{value:t.showingRecordDetails,callback:function(e){t.showingRecordDetails=e},expression:"showingRecordDetails"}},[e("RecordDetails",{ref:"recordDetails",attrs:{"min-height":"".concat(.85*t.$vuetify.breakpoint.height,"px"),showCaptcha:!1}})],1),e("SendAccessCodeEmailDialog",{ref:"sendAccessCodeEmailDialog"})],1)},$=[],A=r(505);function O(t){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O(t)}function j(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */j=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var i=r&&r.prototype instanceof f?r:f,a=Object.create(i.prototype);return c(a,"_invoke",function(e,r,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=x(s,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=u(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new E(o||[])),!0),a}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d={};function f(){}function h(){}function v(){}var p={};c(p,i,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==r&&n.call(m,i)&&(p=m);var y=v.prototype=f.prototype=Object.create(p);function w(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==O(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(d).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var o;c(this,"_invoke",(function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}),!0)}function x(e,r){var n=r.method,o=e.i[n];
vendor: 4,151 bytes, line 1
1if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,x(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=u(o,e.i,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var a=i.arg;return a?a.done?(r[e.r]=a.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function C(t){this.tryEntries.push(t)}function _(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function E(t){this.tryEntries=[[-1]],t.forEach(C,this),this.reset(!0)}function k(e){if(null!=e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(O(e)+" is not iterable")}return h.prototype=v,c(y,"constructor",v),c(v,"constructor",h),h.displayName=c(v,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,s,"GeneratorFunction")),t.prototype=Object.create(y),t},e.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new b(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(y),c(y,s,"Generator"),c(y,i,(function(){return this})),c(y,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=k,E.prototype={constructor:E,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(_),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){a.type="throw",a.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],s=this.prev,c=i[1],l=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=s){if(s<c)return this.method="next",this.arg=t,n(c),!0;if(s<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o[2],d):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),_(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;_(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:k(e),r:r,n:n},"next"===this.method&&(this.arg=t),d}},e}function P(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function T(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){P(i,n,o,a,s,"next",t)}function s(t){P(i,n,o,a,s,"throw",t)}a(void 0)}))}}var M={name:"AccessCodeDetails",components:{ClientFormDialog:s.A,RecordDetail
1s:A.A,SendAccessCodeEmailDialog:y},data:function(){return{loading:!1,dialog:!1,accessCode:{name:""},confirmDeleteDialog:!1,deletingCode:null,clients:[],clientsError:!1,loadingClients:!1,accessCodes:[],codeError:!1,showingRecordDetails:!1}},computed:{filteredAccessCodes:function(){var t=this;return this.selectedClient&&this.accessCodes?this.accessCodes.filter((function(e){return e.client&&e.client.id===t.selectedClient.id})):[]}},methods:{show:function(t){this.dialog=!0,this.accessCode=t,this.fetchClients(),this.fetchAccessCodes()},newClientCreated:function(t){this.fetchClients(),this.selectedClient=t},fetchClients:function(){var t=this;return T(j().mark((function e(){var r,n,o;return j().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.loadingClients=!0,t.clientsError=!1,e.prev=2,r=t.$store.state.organization.id,e.next=6,t.$axios.get("/clients?organization_id="+r);case 6:n=e.sent,t.clients=n.data||[],t.selectedClient&&(o=t.clients.find((function(e){return e.id===t.selectedClient.id})),o||(t.selectedClient=null)),e.next=15;break;case 11:e.prev=11,e.t0=e["catch"](2),t.clientsError=!0,t.$showMessage&&t.$showMessage("error","Erro ao carregar titulares");case 15:return e.prev=15,t.loadingClients=!1,e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[2,11,15,18]])})))()},closeDialog:function(){var t=this;return T(j().mark((function e(){return j().wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.selectedClient=null,t.accessCodes=[],t.loadingClients=!1,t.clientsError=!1,t.clients=[],t.codeError=!1,t.dialog=!1,t.$emit("change");case 8:case"end":return e.stop()}}),e)})))()},fetchAccessCodes:function(){var t=arguments,e=this;return T(j().mark((function r(){var n,o,i,a,s;return j().wrap((function(r){while(1)switch(r.prev=r.next){case 0:return n=t.length>0&&void 0!==t[0]?t[0]:100,o=t.length>1&&void 0!==t[1]?t[1]:0,e.loadingClients=!0,e.clientsError=!1,i=[],r.prev=5,a=e.$store.state.organization.id,r.next=9,e.$axios.get("/access_codes?only_actives=false&organization_id=".concat(a,"&limit=").concat(n,"&offset=").concat(o));case 9:s=r.sent,i=s.data||[],e.accessCodes=i,r.next=17;break;case 14:r.prev=14,r.t0=r["catch"](5),e.codeError=!0;case 17:return r.prev=17,e.loadingClients=!1,r.finish(17);case 20:return r.abrupt("return",i);case 21:case"end":return r.stop()}}),r,null,[[5,14,17,20]])})))()},confirmGenerateCodeDialog:function(){this.confirmSaveDialog=!0},save:function(t){var e=this;return T(j().mark((function r(){var n;return j().wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(e.loading=!0,e.codeError=!1,r.prev=2,e.$refs.form.validate()){r.next=6;break}return e.loading=!1,r.abrupt("return");case 6:return n=e.$store.state.organization.id,r.next=9,e.$axios.post("/access_codes?organization_id="+n+"&client_id="+t.id);case 9:return r.sent,r.next=12,e.fetchAccessCodes();case 12:e.$showMessage&&e.$showMessage("success","Código gerado com sucesso"),r.next=19;break;case 15:r.prev=15,r.t0=r["catch"](2),e.codeError=!0,e.$showMessage&&e.$showMessage("error","Erro ao gerar código de acesso");case 19:return r.prev=19,e.loading=!1,r.finish(19);case 22:case"end":return r.stop()}}),r,null,[[2,15,19,22]])})))()},midTrace:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t?t.length<=8?t:t.substr(0,4)+"..."+t.substr(t.length-4,4):""},copyCode:function(t){var e=this;return T(j().mark((function r(){return j().wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(r.prev=0,t){r.next=3;break}return r.abrupt("return");case 3:return r.next=5,navigator.clipboard.writeText(t);case 5:e.$showMessage&&e.$showMessage("success","Código copiado para a área de transferência"),r.next=11;break;case 8:r.prev=8,r.t0=r["catch"](0),e.$showMessage&&e.$showMessage("error","Não foi possÃvel copiar o código");case 11:case"end":return r.stop()}}),r,null,[[0,8]])})))()},openEmailDialog:function(t){this.$refs.sendAccessCodeEmailDialog.open(t,(t.client||{}).email||"")},formatDate:function(t){if(!t)return"-";try{var e=new Date(t);return e.toLocaleString()}catch(r){return t}},openRecordDetails:function(t){var e=this;
1console.log("openRecordDetails",t),this.showingRecordDetails=!0,this.$nextTick((function(){e.$refs.recordDetails.loadData(t)}))},deleteAccessCode:function(t){var e=this;return T(j().mark((function r(){var n,o;return j().wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(t){r.next=3;break}return e.confirmDeleteDialog=!1,r.abrupt("return");case 3:return e.loading=!0,e.confirmDeleteDialog=!1,r.prev=5,o=null===(n=e.$store.state.organization)||void 0===n?void 0:n.id,r.next=9,e.$axios.patch("/access_codes",null,{params:{organization_id:o,access_code_id:t.id},data:{id:t.id}});case 9:return r.next=11,e.fetchAccessCodes();case 11:e.closeDialog(),e.$showMessage&&e.$showMessage("success","Código deletado com sucesso"),r.next=18;break;case 15:r.prev=15,r.t0=r["catch"](5),e.$showMessage&&e.$showMessage("error","Erro ao deletar código: "+(r.t0&&r.t0.message?r.t0.message:r.t0));case 18:return r.prev=18,e.loading=!1,r.finish(18);case 21:case"end":return r.stop()}}),r,null,[[5,15,18,21]])})))()}},mounted:function(){this.fetchAccessCodes()}},G=M,N=(0,g.A)(G,S,$,!1,null,null,null),F=N.exports;function z(t){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},z(t)}function I(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */I=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function l(e,r,n,o){var i=r&&r.prototype instanceof f?r:f,a=Object.create(i.prototype);return c(a,"_invoke",function(e,r,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=x(s,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var l=u(e,r,n);if("normal"===l.type){if(o=n.done?4:2,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=4,n.method="throw",n.arg=l.arg)}}}(e,n,new E(o||[])),!0),a}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d={};function f(){}function h(){}function v(){}var p={};c(p,i,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==r&&n.call(m,i)&&(p=m);var y=v.prototype=f.prototype=Object.create(p);function w(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==z(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(d).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var o;c(this,"_invoke",(function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}),!0)}function x(e,r){var n=r.method,o=e.i[n];if(o===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,x(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=u(o,e.i,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var a=i.arg;return a?a.done?(r[e.r]=a.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function C(t){this.tryEntries.push(t)}function _(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function E(t){this.tryEntries=[[-1]],t.forEach(C,this),this.reset(!0)}function k(e){if(null!=e){var r=e[i];if(r)return r.call(e);
vendor: 4,333 bytes, line 1
1if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(z(e)+" is not iterable")}return h.prototype=v,c(y,"constructor",v),c(v,"constructor",h),h.displayName=c(v,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,s,"GeneratorFunction")),t.prototype=Object.create(y),t},e.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new b(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(y),c(y,s,"Generator"),c(y,i,(function(){return this})),c(y,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=k,E.prototype={constructor:E,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(_),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){a.type="throw",a.arg=e,r.next=t}for(var o=r.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],s=this.prev,c=i[1],l=i[2];if(-1===i[0])return n("end"),!1;if(!c&&!l)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=s){if(s<c)return this.method="next",this.arg=t,n(c),!0;if(s<l)return n(l),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=e&&e<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o[2],d):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),_(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var o=n.arg;_(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:k(e),r:r,n:n},"next"===this.method&&(this.arg=t),d}},e}function R(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function q(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){R(i,n,o,a,s,"next",t)}function s(t){R(i,n,o,a,s,"throw",t)}a(void 0)}))}}function Y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function H(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Y(Object(r),!0).forEach((function(e){U(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function U(t,e,r){return(e=V(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function V(t){var e=W(t,"string");return"symbol"==z(e)?e:e+""}function W(t,e){if("object"!=z(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=z(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}
1var L={name:"AccessCodes",components:{ManageAccessCodeDialog:D,AccessCodeDetails:F,SendAccessCodeEmailDialog:y},props:{contentHeight:{required:!0,type:Number}},data:function(){return{cardPadding:32,loading:!1,accessCodes:[],showingNewAccessCode:!1}},watch:{"$store.state.orgParams":function(){this.fetchAccessCodes()}},methods:{fetchAccessCodes:function(){var t=this;this.loading=!0,this.$axios.get("/access_codes?organization_id="+this.$store.state.organization.id+"&only_actives=false&limit=100&offset=0").then((function(e){t.accessCodes=e.data.map((function(e){return H(H({},e),{},{created_datetime:t.$utils.strToDateStr(e.created_datetime)})}))})).catch((function(e){console.log(e),t.$showMessage("error","Erro inesperado ao carregar registros")})).finally((function(){t.loading=!1}))},copyCode:function(t){var e=this;return q(I().mark((function r(){return I().wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,navigator.clipboard.writeText(t);case 3:e.$showMessage&&e.$showMessage("success","Código copiado para a área de transferência"),r.next=9;break;case 6:r.prev=6,r.t0=r["catch"](0),e.$showMessage&&e.$showMessage("error","Não foi possÃvel copiar o código");case 9:case"end":return r.stop()}}),r,null,[[0,6]])})))()},openAccessCodeDetails:function(t){this.$refs.AccessCodeDetails.show(t)},openEmailDialog:function(t){this.$refs.sendAccessCodeEmailDialog.open(t,(t.client||{}).email||"")}},mounted:function(){this.fetchAccessCodes()}},B=L,J=(0,g.A)(B,n,o,!1,null,null,null),K=J.exports}}]); 2//# sourceMappingURL=344-legacy.90ee71fe.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.