webpackJsonp([1],{ /***/ 6349: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_PdvReport_vue__ = __webpack_require__(6445); /* empty harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_1646faa0_hasScoped_true_transformToRequire_video_src_poster_source_src_img_src_image_xlink_href_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_PdvReport_vue__ = __webpack_require__(6545); var disposed = false function injectStyle (ssrContext) { if (disposed) return __webpack_require__(6531) } var normalizeComponent = __webpack_require__(2) /* script */ /* template */ /* template functional */ var __vue_template_functional__ = false /* styles */ var __vue_styles__ = injectStyle /* scopeId */ var __vue_scopeId__ = "data-v-1646faa0" /* moduleIdentifier (server only) */ var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_PdvReport_vue__["a" /* default */], __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_1646faa0_hasScoped_true_transformToRequire_video_src_poster_source_src_img_src_image_xlink_href_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_PdvReport_vue__["a" /* default */], __vue_template_functional__, __vue_styles__, __vue_scopeId__, __vue_module_identifier__ ) Component.options.__file = "src/components/reports/pdv/pdv-unique/PdvReport.vue" /* hot reload */ if (false) {(function () { var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), false) if (!hotAPI.compatible) return module.hot.accept() if (!module.hot.data) { hotAPI.createRecord("data-v-1646faa0", Component.options) } else { hotAPI.reload("data-v-1646faa0", Component.options) } module.hot.dispose(function (data) { disposed = true }) })()} /* harmony default export */ __webpack_exports__["default"] = (Component.exports); /***/ }), /***/ 6445: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__ = __webpack_require__(5); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_extends__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_extends___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_extends__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_vuex__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__IncomeChart_vue__ = __webpack_require__(300); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__SalesPerEvent_vue__ = __webpack_require__(6533); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__SalesPerPayment_vue__ = __webpack_require__(6539); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_moment__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_moment__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_axios__ = __webpack_require__(9); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_axios___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_axios__); // // // // // // // // // // // // // // /* harmony default export */ __webpack_exports__["a"] = ({ components: { IncomeChart: __WEBPACK_IMPORTED_MODULE_4__IncomeChart_vue__["a" /* default */], SalesPerPayment: __WEBPACK_IMPORTED_MODULE_6__SalesPerPayment_vue__["a" /* default */], SalesPerEvent: __WEBPACK_IMPORTED_MODULE_5__SalesPerEvent_vue__["a" /* default */] }, data: function data() { return { loading: true, loading2: true, time: null, chart: {}, products: null, payments: null, title: '', hasTax: false }; }, computed: __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_extends___default()({}, Object(__WEBPACK_IMPORTED_MODULE_3_vuex__["c" /* mapGetters */])(['evento']), { isSite: function isSite() { return this.title && this.title.toLowerCase().includes('site'); } }), methods: { getChartData: function getChartData() { var _this = this; var period = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Total'; return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator___default()( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee() { var now, sevenDaysAgo, params, dates; return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: now = __WEBPACK_IMPORTED_MODULE_7_moment___default()().format('YYYY-MM-DD HH:mm:ss'); sevenDaysAgo = void 0; params = { codigo_evento: _this.evento.codigo, codigo_pdv: _this.$route.params.idPv }; if (typeof period === 'number') { sevenDaysAgo = __WEBPACK_IMPORTED_MODULE_7_moment___default()(now, 'YYYY-MM-DD HH:mm:ss').subtract(period, 'days').format('YYYY-MM-DD '); params = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_extends___default()({}, params, { min_data: sevenDaysAgo, max_data: now }); } else if (typeof period === 'string' && period !== 'Total') { dates = period.split('/'); params = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_extends___default()({}, params, { min_data: dates[0], max_data: dates[1] }); } _this.time = params; _this.getProducts(params); _this.getPayments(params); __WEBPACK_IMPORTED_MODULE_8_axios___default.a.get('panel/reports/sales/detailed/pdv', { params: params }).then(function (resp) { _this.chart = resp.data; _this.title = resp.data.pdv_name; _this.hasTax = !!resp.data.revenue_tax; }).catch(function () { _this.$store.dispatch('openSnackbar', { message: 'Ops, não foi possível exibir o gráfico da receita.', color: 'error' }); }); case 8: case 'end': return _context.stop(); } } }, _callee, _this); }))(); }, getProducts: function getProducts(params) { var _this2 = this; this.loading = true; __WEBPACK_IMPORTED_MODULE_8_axios___default.a.get('panel/reports/sales/detailed/products', { params: params }).then(function (resp) { _this2.products = resp.data; }).finally(function () { _this2.loading = false; }); }, getPayments: function getPayments(params) { var _this3 = this; return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator___default()( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee2() { return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _this3.loading2 = true; __WEBPACK_IMPORTED_MODULE_8_axios___default.a.get('panel/reports/sales/detailed/payment-methods', { params: params }).then(function (resp) { _this3.payments = resp.data; }).finally(function () { _this3.loading2 = false; }); case 2: case 'end': return _context2.stop(); } } }, _callee2, _this3); }))(); } } }); /***/ }), /***/ 6446: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys__ = __webpack_require__(12); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys__); // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ __webpack_exports__["a"] = ({ props: ['products', 'loading', 'isSite', 'hasTax'], data: function data() { return { siteHeaders: [{ text: 'Produto', value: 'nome_tipo' }, { text: 'Qtd.', value: 'total', align: 'right' }, { text: 'Ingressos', value: 'valor_ingressos', align: 'right' }], headers: [{ text: 'Produto', value: 'nome_tipo' }, { text: 'Qtd.', value: 'total', align: 'right' }, { text: 'Taxa', value: 'tax', align: 'right' }, { text: 'Ingressos', value: 'valor_ingressos', align: 'right' }] }; }, computed: { groups: function groups() { if (this.products) { return this.products; } else { return []; } } }, updated: function updated() { var _this = this; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default()(this.$refs.table.openCache).forEach(function (g) { _this.$refs.table.openCache[g] = false; }); }, methods: { groupTickets: function groupTickets(group) { var _this2 = this; var tickets = { units: 0, value: 0, tax: 0 }; this.products.forEach(function (item) { if (item.nome === group) { tickets.units += Number(item.total); tickets.tax += Number(item.valor_conveniencia); tickets.value += _this2.isSite ? item.valor_ingressos : item.valor_total; } }); return tickets; }, colorTd: function colorTd(state) { return state ? 'grey lighten-2 pointer' : 'group'; } } }); /***/ }), /***/ 6447: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_values__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_values___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_values__); // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ __webpack_exports__["a"] = ({ props: ['products', 'loading', 'isSite', 'hasTax'], data: function data() { return { siteHeaders: [{ text: 'Forma de Pagamento', value: 'name' }, { text: 'Ingressos', value: 'value', width: '20%', align: 'right' }], headers: [{ text: 'Forma de Pagamento', value: 'name' }, { text: 'Taxa', value: 'tax', width: '20%', align: 'right' }, { text: 'Ingressos', value: 'value', width: '20%', align: 'right' }] }; }, computed: { payments: function payments() { var _this = this; if (this.products) { var obj = {}; this.products.forEach(function (product) { product.formas_pagamento.forEach(function (paymentOption) { if (!obj[paymentOption.forma_pagamento]) obj[paymentOption.forma_pagamento] = { name: paymentOption.forma_pagamento, value: 0, tax: 0 }; obj[paymentOption.forma_pagamento].value += _this.isSite ? paymentOption.valor_ingressos : paymentOption.valor; obj[paymentOption.forma_pagamento].tax += paymentOption.valor_conveniencia; }); }); return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_values___default()(obj) ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_values___default()(obj) : []; } else return []; } } }); /***/ }), /***/ 6531: /***/ (function(module, exports, __webpack_require__) { // style-loader: Adds some css to the DOM by adding a