{"version":3,"sources":["webpack:///./src/views/Exports.vue","webpack:///src/views/Exports.vue","webpack:///./src/views/Exports.vue?b9ee","webpack:///./src/views/Exports.vue?9e9b","webpack:///./src/views/Exports.vue?dd83","webpack:///./src/mixins/csv.js"],"names":["render","_vm","this","_c","_self","attrs","_v","slot","staticClass","staticStyle","name","_l","reports","report","key","id","class","length","_s","description","devicesStatus","scopedSlots","_u","fn","active","model","value","callback","$$v","$set","expression","devicesToReport","option","_e","on","$event","getCSVFromApi","addLog","staticRenderFns","permissions","reportsNames","planCapabilities","metaInfo","title","components","card","mixins","data","limitRoles","skipRoles","total","currentPage","allReports","capabilities","computed","findMembershipsInStore","memberships","query","companyId","isOwner","watch","created","methods","findMemberships","createAdminLog","$skip","$limit","skipMemberships","changePagination","user","action","deviceId","includeDevicesStatus","component","mapActions","findReport","createCsv","type","asExcel","currentCompany","userId","$store","getters","$sort","createdAt","moment","diff","toastMessage","showError","add","fromNow","showSuccess","answer","downloadUrl","crossHelper","openExternalLink"],"mappings":"yHAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACA,EAAG,SAAS,CAACE,MAAM,CAAC,GAAK,eAAe,CAACF,EAAG,aAAa,CAACA,EAAG,oBAAoB,CAACE,MAAM,CAAC,OAAS,KAAK,CAACJ,EAAIK,GAAG,oBAAoB,IAAI,GAAGH,EAAG,OAAO,CAACE,MAAM,CAAC,gBAAgB,0BAA0B,CAACF,EAAG,MAAM,CAACE,MAAM,CAAC,KAAO,QAAQE,KAAK,QAAQ,CAACJ,EAAG,MAAM,CAACA,EAAG,IAAI,CAACK,YAAY,kBAAkB,CAACP,EAAIK,GAAG,+HAA+HH,EAAG,MAAMA,EAAG,YAAY,CAACM,YAAY,CAAC,gBAAgB,OAAOJ,MAAM,CAAC,KAAO,eAAe,CAACF,EAAG,IAAI,CAACK,YAAY,mCAAmC,CAACL,EAAG,IAAI,CAACF,EAAIK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AiBH,EAAOC,aAAa,Q","file":"js/chunk-07177cb3.a70175c3.js","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',[_c('portal',{attrs:{\"to\":\"breadcrumb\"}},[_c('Breadcrumb',[_c('b-breadcrumb-item',{attrs:{\"active\":\"\"}},[_vm._v(\" Export data \")])],1)],1),_c('card',{attrs:{\"external-card\":\"material-card-content\"}},[_c('div',{attrs:{\"slot\":\"body\"},slot:\"body\"},[_c('div',[_c('p',{staticClass:\"has-margin-top\"},[_vm._v(\" Here you can export consolidated data that Boardgent have about your devices to analyze them in other tools like Excel. \")]),_c('br'),_c('b-message',{staticStyle:{\"margin-bottom\":\"8px\"},attrs:{\"type\":\"is-success\"}},[_c('p',{staticClass:\"center-vertically-action-button\"},[_c('b',[_vm._v(\"Tip:\")]),_vm._v(\" You can also export data from only one computer accessing that computer in the \"),_c('span',[_c('router-link',{staticClass:\"item-dropdown\",attrs:{\"to\":{ name: 'devices'}}},[_vm._v(\"Devices\")])],1),_vm._v(\" section. \")])]),_c('br'),_c('div',{attrs:{\"id\":\"app\"}},[_c('div',{staticClass:\"columns is-multiline\"},_vm._l((_vm.reports),function(report){return _c('div',{key:report.id,class:_vm.reports.length > 1 ? 'column is-half' : 'column is-full'},[_c('div',{staticClass:\"box\"},[_c('header',[_c('p',{staticClass:\"title is-4\"},[_vm._v(\" \"+_vm._s(report.name)+\" \")])]),_c('br'),_c('main',{staticClass:\"subtitle\"},[_vm._v(\" \"+_vm._s(report.description)+\" \")]),_c('footer',[_c('div',[(report.devicesStatus)?_c('b-dropdown',{attrs:{\"aria-role\":\"list\"},scopedSlots:_vm._u([{key:\"trigger\",fn:function({ active }){return [_c('b-button',{attrs:{\"icon-right\":active ? 'menu-up' : 'menu-down',\"label\":report.devicesStatus.name,\"type\":\"is-light\"}})]}}],null,true),model:{value:(report.devicesStatus),callback:function ($$v) {_vm.$set(report, \"devicesStatus\", $$v)},expression:\"report.devicesStatus\"}},_vm._l((_vm.devicesToReport),function(option){return _c('b-dropdown-item',{key:option.value.value,attrs:{\"aria-role\":\"listitem\",\"value\":option.value}},[_vm._v(\" \"+_vm._s(option.value.name)+\" \")])}),1):_vm._e()],1),_c('div',[_c('b-button',{staticClass:\"mr-2\",attrs:{\"type\":\"is-light\",\"icon-right\":\"microsoft-excel\"},on:{\"click\":function($event){_vm.getCSVFromApi(report.id, null, true, report.devicesStatus);\n _vm.addLog(report.id, true)}}},[_vm._v(\" Excel \")]),_c('b-button',{attrs:{\"type\":\"is-light\",\"icon-right\":\"file-delimited-outline\"},on:{\"click\":function($event){_vm.getCSVFromApi(report.id, null, false, report.devicesStatus);\n _vm.addLog(report.id, false)}}},[_vm._v(\" CSV \")])],1)])])])}),0)])],1)])])],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\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!./Exports.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!./Exports.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Exports.vue?vue&type=template&id=24133a18&\"\nimport script from \"./Exports.vue?vue&type=script&lang=js&\"\nexport * from \"./Exports.vue?vue&type=script&lang=js&\"\nimport style0 from \"./Exports.vue?vue&type=style&index=0&id=24133a18&prod&scope=true&lang=css&\"\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","export * from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--7-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--7-oneOf-1-2!../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Exports.vue?vue&type=style&index=0&id=24133a18&prod&scope=true&lang=css&\"","import moment from 'moment';\nimport { mapActions } from 'vuex';\nimport toastMessage from '@/helpers/toastMessage';\nimport crossHelper from '@/helpers/cross';\n\nexport default {\n name: 'CsvMixin',\n methods: {\n ...mapActions('reports-history', { findReport: 'find' }),\n ...mapActions('csv', { createCsv: 'find' }),\n async getCSVFromApi(type, deviceId, asExcel = false, devicesStatus) {\n const reports = await this.findReport({\n query: {\n companyId: this.currentCompany.id,\n userId: this.$store.getters['auth/user'].id,\n type,\n deviceId: deviceId || null,\n $sort: { createdAt: -1 },\n $limit: 1,\n },\n });\n\n if (reports.data.length > 0 && moment().diff(reports.data[0].createdAt, 'minutes') < 5) {\n toastMessage.showError(`You can request another ${type} report\n ${moment(reports.data[0].createdAt).add(5, 'minutes').fromNow()}`);\n } else {\n if (!deviceId) toastMessage.showSuccess('We will send you an email when the export is ready.');\n const answer = await this.createCsv({\n query: {\n companyId: this.currentCompany.id,\n userId: this.$store.getters['auth/user'].id,\n type,\n asExcel,\n deviceId: deviceId || null,\n devicesStatus,\n },\n });\n if (answer.downloadUrl) crossHelper.openExternalLink(answer.downloadUrl, false);\n }\n },\n },\n};\n"],"sourceRoot":""}