{"version":3,"sources":["webpack:///src/components/UI/LinkPrint.vue","webpack:///./src/components/UI/LinkPrint.vue","webpack:///./src/components/UI/LinkPrint.vue?068d","webpack:///./src/components/UI/LinkPrint.vue?798a","webpack:///./src/components/UI/LinkPrint.vue?26db"],"names":["name","props","type","String","required","id","openInModal","Boolean","default","components","data","showModal","isLoading","methods","openModal","closeModal","print","_this","_asyncToGenerator","_regenerator","m","_callee","response","linkSource","pdfBlob","blobUrl","link","t","_t","w","_context","n","a","proposalProvider","getProposalPdf","catch","finally","v","reservationProvider","getReservationPdf","invoiceProvider","getInvoicePdf","feeinvoiceProvider","getFeeInvoicePdf","concat","dataURItoBlob","URL","createObjectURL","document","createElement","target","href","click","remove","setTimeout","window","revokeObjectURL","clearTimeout","dataURI","byteString","atob","split","mimeString","ab","ArrayBuffer","length","ia","Uint8Array","i","charCodeAt","bb","Blob","render","_vm","_c","_self","staticClass","on","class","attrs","icon","domProps","textContent","_s","$t","staticRenderFns","_withStripped"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA;AACA;AACA;AACA;AACA;AACe;EACfA,IAAA;EACAC,KAAA;IACAC,IAAA;MACAA,IAAA,EAAAC,MAAA;MACAC,QAAA;IACA;IAEAC,EAAA;MACAH,IAAA,EAAAC,MAAA;MACAC,QAAA;IACA;IAEAE,WAAA;MACAJ,IAAA,EAAAK,OAAA;MACAC,OAAA;IACA;EACA;EAEAC,UAAA;IACA;EAAA,CACA;EAEAC,IAAA,WAAAA,KAAA;IACA;MACAC,SAAA;MACAC,SAAA;IACA;EACA;EAEAC,OAAA;IACAC,SAAA,WAAAA,UAAA;MACA,KAAAH,SAAA;IACA;IAEAI,UAAA,WAAAA,WAAA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,mHAAU;AAC1B,EAAE,sFAAM;AACR,EAAE,uGAAM;AACR,EAAE,gHAAe;AACjB;AACA;AACA;AACA;;AAEA;;AAEA;AACA,IAAI,KAAU,EAAE,YAiBf;AACD;AACe,gF;;;;;;;;;;;;;ACtCf;AAAiS,CAAgB,2UAAG,EAAC,C;;;;;;;;;;;;;ACArT;AAAA;AAAA;AAAA;AAAA","file":"js/444.js?id=a723a24fb7f9a27ba89a","sourcesContent":["<template>\n  <a\n    class=\"has-icon has-text-link\"\n    @click=\"() => { print() }\"\n  >\n    <span\n      class=\"icon\"\n      :class=\"{'is-loading': isLoading }\"\n    >\n      <font-awesome-icon :icon=\"['far', 'print']\" />\n    </span>\n    <span v-text=\"$t('Form.Control.Print')\"></span>\n    <!-- <ModalPrint\n      v-if=\"showModal\"\n      :showModal=\"showModal\"\n      :onCloseFunc=\"closeModal\"\n      :type=\"type\"\n      :id=\"id\"\n    /> -->\n  </a>\n</template>\n\n<script>\nimport feeinvoiceProvider from '@/providers/feeinvoice'\nimport proposalProvider from '@/providers/proposal'\nimport reservationProvider from '@/providers/reservation'\nimport invoiceProvider from '@/providers/invoice'\n// import ModalPrint from '@/components/UI/ModalPrint'\nexport default {\n  name: 'Print',\n  props: {\n    type: {\n      type: String,\n      required: true,\n    },\n\n    id: {\n      type: String,\n      required: true,\n    },\n\n    openInModal: {\n      type: Boolean,\n      default: false,\n    },\n  },\n\n  components: {\n    // ModalPrint,\n  },\n\n  data() {\n    return {\n      showModal: false,\n      isLoading: false,\n    }\n  },\n\n  methods: {\n    openModal() {\n      this.showModal = true\n    },\n\n    closeModal() {\n      this.showModal = false\n    },\n\n    async print() {\n      if (this.isLoading) { return }\n      this.isLoading = true\n      let response = null\n\n      switch (this.type) {\n        case 'proposal':\n          response = await proposalProvider.methods\n            .getProposalPdf(this.id)\n            .catch()\n            .finally(() => {\n              this.isLoading = false;\n            })\n          break\n        case 'reservation':\n          response = await reservationProvider.methods\n            .getReservationPdf(this.id)\n            .catch()\n            .finally(() => {\n              this.isLoading = false;\n            })\n          break\n        case 'invoice':\n          response = await invoiceProvider.methods\n            .getInvoicePdf(this.id)\n            .catch()\n            .finally(() => {\n              this.isLoading = false;\n            })\n          break\n        case 'feeinvoice':\n          response = await feeinvoiceProvider.methods\n            .getFeeInvoicePdf(this.id)\n            .catch()\n            .finally(() => {\n              this.isLoading = false;\n            })\n          break\n\n        default:\n          break\n      }\n\n      const linkSource = `data:application/pdf;base64,${response.data}`\n      const pdfBlob = this.dataURItoBlob(linkSource)\n      const blobUrl = URL.createObjectURL(pdfBlob)\n\n      const link = document.createElement('a')\n      link.target = '_blank'\n      link.href = blobUrl\n      link.click()\n      link.remove()\n      let t = setTimeout(() => {\n        window.URL.revokeObjectURL(blobUrl)\n        clearTimeout(t)\n      }, 20)\n\n      this.isLoading = false\n    },\n\n    dataURItoBlob(dataURI) {\n      const byteString = atob(dataURI.split(',')[1])\n      const mimeString = dataURI\n        .split(',')[0]\n        .split(':')[1]\n        .split(';')[0]\n\n      // write the bytes of the string to an ArrayBuffer\n      const ab = new ArrayBuffer(byteString.length)\n      const ia = new Uint8Array(ab)\n      for (let i = 0; i < byteString.length; i++) {\n        ia[i] = byteString.charCodeAt(i)\n      }\n\n      // write the ArrayBuffer to a blob, and you're done\n      const bb = new Blob([ab], { type: mimeString })\n      return bb\n    },\n  },\n}\n</script>\n\n<style lang=\"scss\" scoped></style>\n","var render = function render() {\n  var _vm = this,\n    _c = _vm._self._c\n  return _c(\n    \"a\",\n    {\n      staticClass: \"has-icon has-text-link\",\n      on: {\n        click: () => {\n          _vm.print()\n        },\n      },\n    },\n    [\n      _c(\n        \"span\",\n        { staticClass: \"icon\", class: { \"is-loading\": _vm.isLoading } },\n        [_c(\"font-awesome-icon\", { attrs: { icon: [\"far\", \"print\"] } })],\n        1\n      ),\n      _c(\"span\", {\n        domProps: { textContent: _vm._s(_vm.$t(\"Form.Control.Print\")) },\n      }),\n    ]\n  )\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","import { render, staticRenderFns } from \"./LinkPrint.vue?vue&type=template&id=c2984df0&scoped=true\"\nimport script from \"./LinkPrint.vue?vue&type=script&lang=js\"\nexport * from \"./LinkPrint.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  \"c2984df0\",\n  null\n  \n)\n\n/* hot reload */\nif (module.hot) {\n  var api = require(\"/github/workspace/node_modules/vue-hot-reload-api/dist/index.js\")\n  api.install(require('vue'))\n  if (api.compatible) {\n    module.hot.accept()\n    if (!api.isRecorded('c2984df0')) {\n      api.createRecord('c2984df0', component.options)\n    } else {\n      api.reload('c2984df0', component.options)\n    }\n    module.hot.accept(\"./LinkPrint.vue?vue&type=template&id=c2984df0&scoped=true\", function () {\n      api.rerender('c2984df0', {\n        render: render,\n        staticRenderFns: staticRenderFns\n      })\n    })\n  }\n}\ncomponent.options.__file = \"src/components/UI/LinkPrint.vue\"\nexport default component.exports","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LinkPrint.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LinkPrint.vue?vue&type=script&lang=js\"","export * from \"-!../../../node_modules/cache-loader/dist/cjs.js?{\\\"cacheDirectory\\\":\\\"node_modules/.cache/vue-loader\\\",\\\"cacheIdentifier\\\":\\\"d2a26fb4-vue-loader-template\\\"}!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LinkPrint.vue?vue&type=template&id=c2984df0&scoped=true\""],"sourceRoot":""}