{"version":3,"sources":["webpack:///./node_modules/core-js/modules/es.string.starts-with.js","webpack:///./src/views/devices/device/DeviceStock.vue?5e2d","webpack:///./src/views/devices/device/DeviceStock.vue?e1fd","webpack:///./src/services/stocks/stocks.service.ts","webpack:///./src/models/stocks/pointOfSaleStock.ts","webpack:///./node_modules/cache-loader/dist/cjs.js","webpack:///./src/views/devices/device/DeviceStock.vue?59d9","webpack:///./src/views/devices/device/DeviceStock.vue"],"names":["$","uncurryThis","getOwnPropertyDescriptor","f","toLength","toString","notARegExp","requireObjectCoercible","correctIsRegExpLogic","IS_PURE","un$StartsWith","startsWith","stringSlice","slice","min","Math","CORRECT_IS_REGEXP_LOGIC","MDN_POLYFILL_BUG","descriptor","String","prototype","writable","target","proto","forced","searchString","that","this","index","arguments","length","undefined","search","render","_vm","_h","$createElement","_c","_self","staticClass","attrs","currentPosName","slot","$auth","isAuthorized","roles","SuperAdmin","MerchantAdmin","GroupAdmin","on","refillStock","_v","_s","$t","_e","stockType","pointOfSaleStock","stockStatus","value","percentage","status","isHotPlanogram","planogram","generalStock","maxCapacity","lastUpdateDate","lastRefillDate","warningLevel","ref","staticRenderFns","StocksService","merchantId","posId","axios","get","endpoints","post","stocksService","PointOfSaleStock","lastRefill","DeviceStock","loaded","Planogram","$route","params","id","getPointOfSaleStock","$dates","getDateHourFormatted","$store","getters","PointsOfSaleGetters","GetCurrentPointOfSale","name","MerchantsGetters","GetSelectedMerchant","$router","push","Routes","MerchantDashboard","planogramType","PlanogramType","Hot","modalDialog","confirm","then","confirmresult","$spinner","showSpinner","$toaster","showSuccess","catch","showError","finally","removeSpinner","response","data","stock","Vue","__decorate","Ref","Watch","Component","components","BackNavigationToolbar","Card","CardContainer","Modal","KeyValue","PlanogramEditor","component"],"mappings":"kHACA,IAAIA,EAAI,EAAQ,QACZC,EAAc,EAAQ,QACtBC,EAA2B,EAAQ,QAAmDC,EACtFC,EAAW,EAAQ,QACnBC,EAAW,EAAQ,QACnBC,EAAa,EAAQ,QACrB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WACJ,EAAKI,SAASC,YAAY,kBAAkB,GAC5C,EAAKxB,yBAENyB,OAAM,WACL,EAAKF,SAASG,UAAU,iBAAiB,MAE1CC,SAAQ,WACP,EAAKN,SAASO,yBAtEM,iCA4EtB,WAAmB,WACzBvF,KAAKgF,SAASC,cACd/B,EACGH,IAAI/C,KAAK4C,WAAY5C,KAAK6C,OAC1BiC,MAAK,SAACU,GACL,EAAKrD,UAAYqD,EAASC,KAAKtD,UAC/B,EAAKN,iBAAmB2D,EAASC,KAAKC,SAEvCN,OAAM,WACL,EAAKF,SAASG,UAAU,iBAAiB,MAE1CC,SAAQ,WACP,EAAKhC,QAAS,EACd,EAAK0B,SAASO,uBAzFU,GAASI,QAGvCC,gBADCC,eAAI,gBACL,kCA2CAD,gBADCE,eAAM,eACP,sCA9CmBzC,EAAW,gBAV/B0C,eAAU,CACTC,WAAY,CACV,4BAA6BC,OAC7B,SAAUC,OACV,mBAAoBC,OACpB,UAAWC,OACX,cAAeC,OACf,qBAAsBC,WAGLjD,WCxEqZ,I,wBCQtakD,EAAY,eACd,EACAjG,EACAoC,GACA,EACA,KACA,WACA,MAIa,aAAA6D,E","file":"js/chunk-66e48230.d931ffd8.js","sourcesContent":["'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar toLength = require('../internals/to-length');\nvar toString = require('../internals/to-string');\nvar notARegExp = require('../internals/not-a-regexp');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');\nvar IS_PURE = require('../internals/is-pure');\n\n// eslint-disable-next-line es-x/no-string-prototype-startswith -- safe\nvar un$StartsWith = uncurryThis(''.startsWith);\nvar stringSlice = uncurryThis(''.slice);\nvar min = Math.min;\n\nvar CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');\n// https://github.com/zloirock/core-js/pull/702\nvar MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {\n var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');\n return descriptor && !descriptor.writable;\n}();\n\n// `String.prototype.startsWith` method\n// https://tc39.es/ecma262/#sec-string.prototype.startswith\n$({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {\n startsWith: function startsWith(searchString /* , position = 0 */) {\n var that = toString(requireObjectCoercible(this));\n notARegExp(searchString);\n var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));\n var search = toString(searchString);\n return un$StartsWith\n ? un$StartsWith(that, search, index)\n : stringSlice(that, index, index + search.length) === search;\n }\n});\n","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/cache-loader/dist/cjs.js??ref--1-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DeviceStock.vue?vue&type=style&index=0&id=32ab16c8&lang=scss&scoped=true&\"","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',{staticClass:\"stock\"},[_c('n-back-navigation-toolbar',{attrs:{\"title\":_vm.currentPosName}},[_c('div',{attrs:{\"slot\":\"actions\"},slot:\"actions\"},[_c('div',{staticClass:\"toolbar__filters\"},[(_vm.$auth.isAuthorized([_vm.$auth.roles.SuperAdmin, _vm.$auth.roles.MerchantAdmin , _vm.$auth.roles.GroupAdmin]))?_c('span',{staticClass:\"toolbar__action\",on:{\"click\":_vm.refillStock}},[_c('span',{staticClass:\"desktop-and-tablet\"},[_vm._v(_vm._s(_vm.$t('stocks.refill')))]),_c('i',{staticClass:\"icon-arrow-up\"})]):_vm._e()])])]),(_vm.loaded)?_c('n-card-container',[_c('n-card',{staticClass:\"stock__card\",attrs:{\"type\":\"s\"}},[_c('n-key-value',{attrs:{\"title\":\"stocks.stock-type\",\"value\":_vm.stockType}}),(!!_vm.pointOfSaleStock && !!_vm.pointOfSaleStock.stockStatus)?_c('n-key-value',{attrs:{\"title\":\"stocks.status\",\"properties\":{\n value: {\n percentage: _vm.pointOfSaleStock.stockStatus.percentage,\n status: _vm.pointOfSaleStock.stockStatus.status,\n },\n },\"component\":\"n-stock-widget\"}}):_vm._e(),(_vm.isHotPlanogram())?_c('n-key-value',{attrs:{\"title\":\"planogram.max-capacity\",\"value\":_vm.planogram.generalStock.maxCapacity}}):_vm._e(),(_vm.isHotPlanogram())?_c('n-key-value',{attrs:{\"title\":\"stocks.value\",\"value\":_vm.pointOfSaleStock.generalStock.value.toString()}}):_vm._e(),_c('n-key-value',{attrs:{\"title\":\"stocks.last-update\",\"value\":_vm.lastUpdateDate}}),_c('n-key-value',{attrs:{\"title\":\"stocks.last-refill\",\"value\":_vm.lastRefillDate}}),(_vm.isHotPlanogram())?_c('n-key-value',{attrs:{\"title\":\"planogram.warning-level\",\"value\":_vm.planogram.generalStock.warningLevel}}):_vm._e()],1),_c('n-card',{attrs:{\"type\":\"xxl\",\"title\":\"stocks.stock\"}},[_c('n-planogram-editor',{attrs:{\"planogram\":_vm.planogram,\"stock\":_vm.pointOfSaleStock}})],1)],1):_vm._e(),_c('n-modal',{ref:\"modalDialog\"})],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import axios from 'axios';\nimport * as endpoints from '@/services/endpoints.service';\n\nclass StocksService {\n\n public get(merchantId: string, posId: string) {\n return axios.get(endpoints.POS_STOCK(merchantId, posId));\n }\n\n public refillStock(merchantId: string, posId: string) {\n return axios.post(endpoints.REFILL_STOCK(merchantId, posId));\n }\n}\n\nexport const stocksService = new StocksService();\n","import { StockType } from '../points-of-sale/stockType';\nimport { PointOfSaleStockDetail } from './pointOfSaleStockDetail';\nimport { PointOfSaleStockLine } from './pointOfSaleStockLine';\n\nexport class PointOfSaleStock {\n public id!: string;\n public posId!: string;\n public lastUpdateDate: Date | undefined = undefined;\n public lastRefill: Date | undefined = undefined;\n public stockType!: StockType;\n public generalStock!: PointOfSaleStockDetail;\n public lines!: PointOfSaleStockLine[];\n}\n","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { Component, Ref, Vue, Watch } from 'vue-property-decorator';\nimport { MerchantsGetters } from '@/store/modules/merchants/enums';\nimport { PointsOfSaleGetters } from '@/store/modules/points-of-sale/enums';\nimport { Routes } from '@/router/routes';\nimport BackNavigationToolbar from '@/components/BackNavigationToolbar.vue';\nimport Card from '@/components/Card.vue';\nimport CardContainer from '@/components/CardContainer.vue';\nimport {stocksService} from '@/services/stocks/stocks.service';\nimport { PointOfSaleStock } from '@/models/stocks/pointOfSaleStock';\nimport KeyValue from '@/components/KeyValue.vue';\nimport PlanogramEditor from '@/components/planograms/PlanogramEditor.vue';\nimport { Planogram } from '@/models/planograms/planogram';\nimport Modal from '@/components/Modal.vue';\nimport { PlanogramType } from '@/models/planograms/planogramType';\n\n@Component({\n components: {\n 'n-back-navigation-toolbar': BackNavigationToolbar,\n 'n-card': Card,\n 'n-card-container': CardContainer,\n 'n-modal': Modal,\n 'n-key-value': KeyValue,\n 'n-planogram-editor': PlanogramEditor,\n },\n})\nexport default class DeviceStock extends Vue {\n\n @Ref('modalDialog')\n public readonly modalDialog!: Modal;\n\n public loaded: boolean = false;\n\n public planogram: Planogram = new Planogram();\n public pointOfSaleStock: PointOfSaleStock = new PointOfSaleStock();\n private posId!: string;\n\n public created() {\n this.posId = this.$route.params.id;\n this.getPointOfSaleStock();\n }\n\n public get stockType(): string {\n return this.$t(`stocks.stocktype.${this.pointOfSaleStock.stockType}`).toString();\n }\n\n public get lastUpdateDate(): string {\n if (!this.pointOfSaleStock.lastUpdateDate) {\n return this.$t('stocks.no-last-update').toString();\n }\n\n return this.$dates.getDateHourFormatted(this.pointOfSaleStock.lastUpdateDate as Date);\n }\n\n public get lastRefillDate(): string {\n if (!this.pointOfSaleStock.lastRefill) {\n return this.$t('stocks.no-last-refill').toString();\n }\n\n return this.$dates.getDateHourFormatted(this.pointOfSaleStock.lastRefill as Date);\n }\n\n get currentPosName(): string {\n return this.$store.getters[PointsOfSaleGetters.GetCurrentPointOfSale]\n .name as string;\n }\n\n get merchantId(): string {\n return this.$store.getters[MerchantsGetters.GetSelectedMerchant] as string;\n }\n\n @Watch('merchantId')\n public changedMerchantId(): void {\n if (!!this.merchantId) {\n this.$router.push({ name: Routes.MerchantDashboard });\n }\n }\n\n public isHotPlanogram(): boolean {\n return this.planogram.planogramType === PlanogramType.Hot;\n }\n\n public refillStock(): void {\n this.modalDialog.confirm('stocks.confirm-refill', 'stocks.refill')\n .then((confirmresult) => {\n if (confirmresult) {\n this.$spinner.showSpinner();\n stocksService.refillStock(this.merchantId, this.posId)\n .then(() => {\n this.$toaster.showSuccess('success.common', true);\n this.getPointOfSaleStock();\n })\n .catch(() => {\n this.$toaster.showError('errors.common', true);\n })\n .finally(() => {\n this.$spinner.removeSpinner();\n });\n }\n });\n }\n\n private getPointOfSaleStock() {\n this.$spinner.showSpinner();\n stocksService\n .get(this.merchantId, this.posId)\n .then((response) => {\n this.planogram = response.data.planogram as Planogram;\n this.pointOfSaleStock = response.data.stock as PointOfSaleStock;\n })\n .catch(() => {\n this.$toaster.showError('errors.common', true);\n })\n .finally(() => {\n this.loaded = true;\n this.$spinner.removeSpinner();\n });\n }\n}\n","import mod from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/ts-loader/index.js??ref--14-3!../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DeviceStock.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/ts-loader/index.js??ref--14-3!../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DeviceStock.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./DeviceStock.vue?vue&type=template&id=32ab16c8&scoped=true&\"\nimport script from \"./DeviceStock.vue?vue&type=script&lang=ts&\"\nexport * from \"./DeviceStock.vue?vue&type=script&lang=ts&\"\nimport style0 from \"./DeviceStock.vue?vue&type=style&index=0&id=32ab16c8&lang=scss&scoped=true&\"\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 \"32ab16c8\",\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""}