{"version":3,"sources":["webpack:///./src/assets/graphics/document.svg","webpack:///./src/pages/certificates.vue?5be7","webpack:///./src/pages/certificates.vue","webpack:///./src/domain/composables/use-certificates.js","webpack:///src/pages/certificates.vue","webpack:///./src/pages/certificates.vue?0ff2","webpack:///./src/pages/certificates.vue?3f29","webpack:///./src/assets/graphics/warning.svg"],"names":["module","exports","render","_vm","this","_c","_self","staticClass","_v","_s","$tr","isLoading","certificates","length","_l","item","index","key","attrs","require","name","on","$event","download","link","status","again","id","_e","staticRenderFns","useCertificates","statusNew","statusAgain","async","getCertificates","eventId","userId","api","getExistingApiInstance","params","filter","entityId","i18n","locale","data","getMany","againCertificates","attr","file_path","update","components","mounted","methods","console","window","open","BASE_URL","focus","component"],"mappings":"qGAAAA,EAAOC,QAAU,IAA0B,6B,kCCA3C,W,yCCAA,IAAIC,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACE,YAAY,gBAAgB,CAACF,EAAG,OAAO,CAACE,YAAY,QAAQ,CAACF,EAAG,KAAK,CAACE,YAAY,cAAc,CAACJ,EAAIK,GAAGL,EAAIM,GAAGN,EAAIO,IAAI,kCAAoCP,EAAIQ,WAAcR,EAAIS,aAAaC,OAAuNR,EAAG,MAAM,CAACE,YAAY,aAAa,CAACF,EAAG,KAAK,CAACE,YAAY,aAAaJ,EAAIW,GAAIX,EAAIS,cAAc,SAASG,EAAKC,GAAO,OAAOX,EAAG,KAAK,CAACY,IAAID,EAAMT,YAAY,aAAa,CAACF,EAAG,MAAM,CAACE,YAAY,qBAAqBW,MAAM,CAAC,IAAMC,EAAQ,WAAqCd,EAAG,MAAM,CAACE,YAAY,sBAAsB,CAACF,EAAG,KAAK,CAACE,YAAY,mBAAmB,CAACJ,EAAIK,GAAGL,EAAIM,GAAGM,EAAKK,SAASf,EAAG,SAAS,CAACE,YAAY,sBAAsBW,MAAM,CAAC,KAAO,UAAU,KAAO,SAASG,GAAG,CA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C,KACAC,sDACA,UAEAC,WC1GsV,I,wBCQlVC,EAAY,eACd,EACAxD,EACA2B,GACA,EACA,KACA,KACA,MAIa,aAAA6B,E,gCCnBf1D,EAAOC,QAAU,IAA0B,4B","file":"js/chunk-29073c42.441ef145.js","sourcesContent":["module.exports = __webpack_public_path__ + \"img/document.4905cf72.svg\";","export * from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--9-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--9-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--9-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--9-oneOf-1-3!../../node_modules/style-resources-loader/lib/index.js??ref--9-oneOf-1-4!../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./certificates.vue?vue&type=style&index=0&id=07dbc147&prod&lang=scss&\"","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"certificates\"},[_c('Card',{staticClass:\"card\"},[_c('h1',{staticClass:\"card-title\"},[_vm._v(_vm._s(_vm.$tr('profile.certificates.title')))]),(!_vm.isLoading && !_vm.certificates.length)?_c('div',{staticClass:\"card-warning\"},[_c('img',{staticClass:\"card-item__preview\",attrs:{\"src\":require(\"@/assets/graphics/warning.svg\")}}),_c('p',[_vm._v(_vm._s(_vm.$tr('profile.certificates.warning')))])]):_c('div',{staticClass:\"card-list\"},[_c('ul',{staticClass:\"card-list\"},_vm._l((_vm.certificates),function(item,index){return _c('li',{key:index,staticClass:\"card-item\"},[_c('img',{staticClass:\"card-item__preview\",attrs:{\"src\":require(\"@/assets/graphics/document.svg\")}}),_c('div',{staticClass:\"card-item__content\"},[_c('h4',{staticClass:\"card-item__name\"},[_vm._v(_vm._s(item.name))]),_c('Button',{staticClass:\"card-item__download\",attrs:{\"type\":\"primary\",\"size\":\"small\"},on:{\"click\":function($event){return _vm.download(item.link)}}},[_vm._v(\" \"+_vm._s(_vm.$tr('document.action.download'))+\" \")]),(item.status !== 3)?_c('Button',{staticClass:\"card-item__again\",attrs:{\"type\":\"primary\",\"size\":\"small\"},on:{\"click\":function($event){return _vm.again(item.id)}}},[_vm._v(\" \"+_vm._s(_vm.$tr('document.action.recreate'))+\" \")]):_vm._e()],1)])}),0)])])],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import i18n from '@/plugins/i18n'\nimport { getExistingApiInstance } from '@/api'\n\nexport default function useCertificates() {\n  const statusNew = 0\n  const statusAgain = 3\n\n  async function getCertificates(eventId, userId) {\n    const api = getExistingApiInstance()\n    const params = {\n      filter: {\n        entityId: eventId,\n        userId: userId,\n        status: [statusNew, statusAgain],\n        'template.lang': i18n.locale,\n      },\n    }\n    const { data } = await api.certificates.getMany(params)\n\n    return data\n  }\n\n  async function againCertificates(id) {\n    const api = getExistingApiInstance()\n    const attr = {\n      file_path: null,\n    }\n    const { data } = await api.certificates.update(id, attr)\n\n    return data\n  }\n\n  return {\n    getCertificates,\n    againCertificates,\n  }\n}\n","<template>\n  <div class=\"certificates\">\n    <Card class=\"card\">\n      <h1 class=\"card-title\">{{ $tr('profile.certificates.title') }}</h1>\n      <div v-if=\"!isLoading && !certificates.length\" class=\"card-warning\">\n        <img src=\"@/assets/graphics/warning.svg\" class=\"card-item__preview\" />\n        <p>{{ $tr('profile.certificates.warning') }}</p>\n      </div>\n      <div v-else class=\"card-list\">\n        <ul class=\"card-list\">\n          <li\n            v-for=\"(item, index) in certificates\"\n            :key=\"index\"\n            class=\"card-item\"\n          >\n            <img\n              src=\"@/assets/graphics/document.svg\"\n              class=\"card-item__preview\"\n            />\n            <div class=\"card-item__content\">\n              <h4 class=\"card-item__name\">{{ item.name }}</h4>\n              <!--              <div class=\"card-status\">-->\n              <!--                  <span class=\"card-status__again\" v-if=\"item.status === 3\">Ожидает модерации</span>-->\n              <!--                  <span class=\"card-status__new\" v-else>Сертификат готов</span>-->\n              <!--              </div>-->\n              <Button\n                type=\"primary\"\n                size=\"small\"\n                class=\"card-item__download\"\n                @click=\"download(item.link)\"\n              >\n                {{ $tr('document.action.download') }}\n              </Button>\n              <Button\n                v-if=\"item.status !== 3\"\n                type=\"primary\"\n                size=\"small\"\n                class=\"card-item__again\"\n                @click=\"again(item.id)\"\n              >\n                {{ $tr('document.action.recreate') }}\n              </Button>\n            </div>\n          </li>\n        </ul>\n      </div>\n    </Card>\n  </div>\n</template>\n\n<script>\nimport useCertificates from '@/domain/composables/use-certificates'\nimport { BASE_URL } from '@/api/api-instance.js'\n\nexport default {\n  components: {},\n  data() {\n    return {\n      certificates: null,\n      isLoading: false,\n    }\n  },\n  mounted() {\n    this.getCertificates()\n  },\n  methods: {\n    async fetchCertificateList() {\n      const eventId = this.$store.getters['event/currentEventId']\n      const userId = this.$store.state.auth.userId\n      this.certificates = await useCertificates().getCertificates(\n        eventId,\n        userId,\n      )\n\n      console.log('++++', this.certificates)\n    },\n\n    async getCertificates() {\n      this.isLoading = true\n      try {\n        await this.fetchCertificateList()\n      } catch (e) {\n        console.error(e)\n      } finally {\n        this.isLoading = false\n      }\n    },\n\n    async again(id) {\n      const res = await useCertificates().againCertificates(id)\n\n      if (res.data) {\n        this.$Message.success(this.$tr('profile.certificates.reissued'))\n      } else {\n        this.$Message.error(this.$tr('header.titles.error'))\n      }\n\n      await this.fetchCertificateList()\n    },\n\n    download(link) {\n      window\n        .open(\n          BASE_URL + 'api/v1/certificate/generate/download?link=' + link,\n          '_blank',\n        )\n        .focus()\n    },\n  },\n}\n</script>\n\n<style lang=\"scss\">\n@import '~@/styles/pages/certificates.scss';\n</style>\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../node_modules/thread-loader/dist/cjs.js!../../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!./certificates.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../node_modules/thread-loader/dist/cjs.js!../../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!./certificates.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./certificates.vue?vue&type=template&id=07dbc147&\"\nimport script from \"./certificates.vue?vue&type=script&lang=js&\"\nexport * from \"./certificates.vue?vue&type=script&lang=js&\"\nimport style0 from \"./certificates.vue?vue&type=style&index=0&id=07dbc147&prod&lang=scss&\"\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  null,\n  null\n  \n)\n\nexport default component.exports","module.exports = __webpack_public_path__ + \"img/warning.7a3b1534.svg\";"],"sourceRoot":""}