{"version":3,"sources":["webpack:///./src/pages/Billing/Billing.html","webpack:///./src/services/billingReportGenerator.ts","webpack:///./src/pages/Billing/Billing.vue","webpack:///./src/pages/Billing/Billing.vue?f957","webpack:///./src/pages/Billing/Billing.vue?a811","webpack:///./src/pages/Billing/index.ts","webpack:///./src/services/pdfGenerator.ts","webpack:///./src/consts/billingDates.ts","webpack:///./src/pages/Billing/Billing.scss?ab65","webpack:///./src/pages/BillingAccount/BillingAccount.scss?c857","webpack:///./src/pages/BillingAccount/BillingAccount.html","webpack:///./src/pages/BillingAccount/BillingAccount.vue","webpack:///./src/pages/BillingAccount/BillingAccount.vue?0db6","webpack:///./src/pages/BillingAccount/BillingAccount.vue?5d0c","webpack:///./src/pages/BillingAccount/index.ts"],"names":["staticClass","_c","attrs","name","_vm","isLoading","billingDates","model","value","callback","pickedDate","defaultTableStyle","theme","styles","lineColor","lineWidth","showHead","generatePdfBillingReport","monthBillingData","year","month","doc","jsPDF","_objectSpread","a4Options","marginX","fullMonthYearString","getFullMonthYearString","cursorY","setFont","setFontSize","text","concat","billingText","billingTextWidth","getTextWidth","_step","_iterator","_createForOfIteratorHelper","s","n","done","_doc$lastAutoTable","monthBilling","yearMonthString","getYearMonthString","tableBillingData","billingData","filter","bd","caseInternalIds","length","map","type","billingType","number","toString","cases","join","autoTable","startY","head","body","columnStyles","cellWidth","lastAutoTable","finalY","err","e","f","groupedBillingData","groupBy","flatMap","mbd","summaryData","keys","k","b","push","sum","sd","tableWidth","applyPlugin","BillingAccount","_Vue","_inherits","_super","_createSuper","_this","_classCallCheck","headers","width","_createClass","key","get","this","set","dateString","date","Date","getFullYear","getMonth","setYearAndMonth","loadMonthBillingData","casesCount","errors","showErrors","billingReportGenerator","monthYearString","save","Vue","__decorate","Watch","Component","components","DynamicTitle","SideFilter","methods","billingModule","mapActions","BillingActions","LoadMonthBillingData","mapMutations","BillingMutation","SetYearAndMonth","notificationsModule","NotificationsActions","NotifyError","computed","mapGetters","BillingGetters","MonthBillingData","IsLoading","Year","Month","Errors","component","staticRenderFns","Billing","widthA4","heightA4","unit","format","PrintFromHtmlA4","src","filename","margin","arguments","undefined","orientation","html","autoPaging","windowWidth","then","minMonth","maxMonth","isBilling","loadAccountInfo","_bill","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_this2","wrap","_context","prev","next","makeRequest","billingAccountApi","createBillings","val","stop","bill","apply","billingAccountModule","BillingAccountActions","LoadAccountInfo","BillingAccountMutation","accountInfo","BillingAccountGetters","AccountInfo"],"mappings":"2MAA+GA,aAAqB,IAAGC,EAAG,KAAgBC,EAAK,EAAC,S,OAAC,QAAQ,C,YAAoB,W,GAAGC,MAAM,C,YAAmB,W,CAAM,EAAC,gBAAC,OAAKC,MAAIC,UAAmCH,SAAM,EAAC,eAAkB,iBAAoGF,YAAY,UAAM,MAAM,CAAOA,cAAY,MAA6DA,OAAW,EAAC,uBAAmB,Y,OAAM,EAAC,UAAke,OAAle,S,YAAS,QAAgB,UAAE,YAAY,oBAAyGE,GAAK,GAAC,8B,YAAWE,oB,MAAY,CAAgE,yBAA0C,4EAAG,MAAI,CAAcA,QAAIC,EAAS,QAA+GL,MAAY,4BAAQ,eAACE,sBAAM,GAAC,eAAW,OAAmB,MAAID,EAAG,WAAgB,IAAD,EAAC,0FAACD,YAAY,SAAYE,MAAM,CAAC,OAAO,GAAQ,MAAQ,a,CAAsC,SAAUI,C,YAAsB,YAAoB,MAAC,CAACC,KAAM,QAACC,MAAOJ,MAAgBK,MAAS,aAAAA,S,IAAoBC,eAAc,yBAAC,GAAwB,OAAIT,MAAG,EAAOA,WAAYC,SAAM,YAAC,aAAiB,GAA8C,WAAUE,gBAAiB,EAAC,iB,MAAC,CAA0B,gBAAIA,SAAqC,IAA9B,mBAAwB,OAC/7C,qBAGD,I,qbCIMO,EAAoB,CACtBC,MAAO,QACPC,OAAQ,CACJC,UAAW,CAAC,EAAG,EAAG,GAClBC,UAAW,GAEfC,SAAU,aAKd,SAASC,EACLC,EACAC,EACAC,GAEA,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AsBC,mBAExCF,OAAqBrD,aAAa,CACjCpB,gBAAiB4E,OAAuBtD,mBAGhDI,SAAU+C,OAAqB9C,WAAW,CACtCkD,YAAaC,OAAsBC,YACnChL,UAAW+K,OAAsBhD,UACjCjH,KAAMiK,OAAsB/C,KAC5BjH,MAAOgK,OAAsB9C,MAC7B7B,OAAQ2E,OAAsB7C,YAGjBpD,WCjCsY,I,wBCQvZqD,EAAY,eACd,EACA,EACAC,GACA,EACA,KACA,WACA,MAIa,EAAAD,E,QClBArD","file":"js/billing.7f743bf6.js","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"wrapper\"},[_c('div',{staticClass:\"content\"},[_c('DynamicTitle',{attrs:{\"title\":\"Billing\",\"elements\":[{name: 'Billing', selected: true}]}}),(_vm.isLoading)?_c('v-progress-linear',{attrs:{\"indeterminate\":\"\"}}):_vm._e(),_vm._l((_vm.monthBillingData),function(monthBilling){return (!_vm.isLoading)?_c('div',{staticClass:\"mb-6\"},[_c('div',{staticClass:\"v-text-subtitle1\"},[_vm._v(\" Created month: \"),_c('v-chip',{staticClass:\"indigo--text ml-2\",attrs:{\"color\":\"blue lighten-5\"}},[_vm._v(\" \"+_vm._s(_vm.getYearMonthString(monthBilling.year, monthBilling.month - 1))+\" \")])],1),_c('v-data-table',{attrs:{\"headers\":_vm.headers,\"items\":_vm.getMonthBillingTableItems(monthBilling.billingData),\"hide-default-footer\":\"\",\"disable-sort\":\"\"}})],1):_vm._e()}),(!_vm.isLoading && _vm.monthBillingData.length === 0)?_c('div',[_vm._v(\" No data available \")]):_vm._e()],2),_c('SideFilter',{staticClass:\"filter\",attrs:{\"locked\":\"\",\"label\":\"Calendar\"}},[_c('v-date-picker',{staticClass:\"mt-2 mb-4\",attrs:{\"type\":\"month\",\"width\":\"400\",\"min\":_vm.billingDates.minMonth,\"max\":_vm.billingDates.maxMonth,\"show-current\":false},model:{value:(_vm.pickedDate),callback:function ($$v) {_vm.pickedDate=$$v},expression:\"pickedDate\"}}),_c('div',[_c('v-btn',{attrs:{\"color\":\"primary\",\"disabled\":_vm.monthBillingData.length === 0,\"loading\":_vm.isLoading},on:{\"click\":_vm.downloadReport}},[_vm._v(\" PDF Invoice \")])],1)],1)],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import jsPDF from \"jspdf\";\r\nimport { applyPlugin, Table, UserOptions } from \"jspdf-autotable\";\r\nimport autoTable from \"jspdf-autotable\";\r\nimport { MonthBillingData } from \"../models/billing/MonthBillingData\";\r\nimport { a4Options } from \"./pdfGenerator\";\r\nimport { getFullMonthYearString, getYearMonthString } from \"./dateFormatUtils\";\r\nimport { groupBy, keys, sum } from \"lodash\";\r\n\r\nconst defaultTableStyle = {\r\n theme: \"plain\" as UserOptions[\"theme\"],\r\n styles: {\r\n lineColor: [0, 0, 0] as [number, number, number],\r\n lineWidth: 1\r\n },\r\n showHead: \"everyPage\" as UserOptions[\"showHead\"]\r\n};\r\n\r\napplyPlugin(jsPDF);\r\n\r\nfunction generatePdfBillingReport(\r\n monthBillingData: MonthBillingData[],\r\n year: number,\r\n month: number\r\n): jsPDF {\r\n const doc = new jsPDF({ ...a4Options }) as jsPDF & {\r\n lastAutoTable?: Table;\r\n };\r\n const marginX = 40;\r\n const fullMonthYearString = getFullMonthYearString(year, month);\r\n\r\n let cursorY = 60;\r\n doc.setFont(\"times\", \"normal\", \"bold\");\r\n doc.setFontSize(18);\r\n doc.text(`Billing Cases ${fullMonthYearString}`, marginX, cursorY);\r\n cursorY += 25;\r\n\r\n doc.setFont(\"times\", \"normal\", \"normal\");\r\n doc.setFontSize(12);\r\n const billingText = \"Billing Month: \";\r\n const billingTextWidth = doc.getTextWidth(billingText);\r\n doc.text(billingText, marginX, cursorY);\r\n doc.setFont(\"times\", \"normal\", \"bold\");\r\n doc.text(fullMonthYearString, marginX + billingTextWidth, cursorY);\r\n cursorY += 35;\r\n\r\n for (const monthBilling of monthBillingData) {\r\n const yearMonthString = getYearMonthString(\r\n monthBilling.year,\r\n monthBilling.month - 1\r\n );\r\n doc.text(`Creation Month: ${yearMonthString}`, marginX, cursorY);\r\n cursorY += 2;\r\n\r\n const tableBillingData = monthBilling.billingData\r\n .filter((bd) => bd.caseInternalIds.length > 0)\r\n .map((bd) => ({\r\n type: bd.billingType,\r\n number: bd.caseInternalIds.length.toString(),\r\n cases: bd.caseInternalIds.join(\", \")\r\n }));\r\n autoTable(doc, {\r\n ...defaultTableStyle,\r\n startY: cursorY,\r\n head: [{ type: \"Type\", number: \"Number\", cases: \"Cases\" }],\r\n body: tableBillingData,\r\n columnStyles: {\r\n type: { cellWidth: 120 },\r\n number: { cellWidth: 90 },\r\n cases: { cellWidth: \"auto\" }\r\n }\r\n });\r\n if (doc.lastAutoTable?.finalY) cursorY = doc.lastAutoTable.finalY + 20;\r\n }\r\n\r\n const groupedBillingData = groupBy(\r\n monthBillingData.flatMap((mbd) => mbd.billingData),\r\n (bd) => bd.billingType\r\n );\r\n\r\n const summaryData = keys(groupedBillingData).map((k) => ({\r\n type: k,\r\n number: groupedBillingData[k].flatMap((b) => b.caseInternalIds).length\r\n }));\r\n summaryData.push({\r\n type: \"Total\",\r\n number: sum(summaryData.flatMap((sd) => sd.number))\r\n });\r\n autoTable(doc, {\r\n ...defaultTableStyle,\r\n startY: cursorY,\r\n head: [{ type: \"Type (IFM)\", number: \"Number of Cases\" }],\r\n body: summaryData,\r\n tableWidth: 300\r\n });\r\n\r\n return doc;\r\n}\r\n\r\nexport default {\r\n generatePdfBillingReport\r\n};\r\n","\r\nimport Vue from \"vue\";\r\nimport { Component, Watch } from \"vue-property-decorator\";\r\nimport DynamicTitle from \"@/components/DynamicTitle\";\r\nimport SideFilter from \"@/components/SideFilter\";\r\nimport { billingModule } from \"@/store/modules/billing\";\r\nimport { BillingActions } from \"@/store/modules/billing/actions\";\r\nimport { BillingGetters } from \"@/store/modules/billing/getters\";\r\nimport { notificationsModule } from \"@/store/modules/notifications\";\r\nimport { NotificationsActions } from \"@/store/modules/notifications/actions\";\r\nimport { BillingMutation } from \"@/store/modules/billing/mutations\";\r\nimport {\r\n getYearMonthString,\r\n getFullMonthYearString\r\n} from \"@/services/dateFormatUtils\";\r\nimport billingDates from \"@/consts/billingDates\";\r\nimport { MonthBillingData } from \"@/models/billing/MonthBillingData\";\r\nimport { BillingData } from \"@/models/billing/BillingData\";\r\nimport billingReportGenerator from \"@/services/billingReportGenerator\";\r\nimport { BillingTableItem } from \"@/models/billing/billingTableItem\";\r\n\r\n@Component({\r\n components: { DynamicTitle, SideFilter },\r\n methods: {\r\n ...billingModule.mapActions({\r\n loadMonthBillingData: BillingActions.LoadMonthBillingData\r\n }),\r\n ...billingModule.mapMutations({\r\n setYearAndMonth: BillingMutation.SetYearAndMonth\r\n }),\r\n ...notificationsModule.mapActions({\r\n showErrors: NotificationsActions.NotifyError\r\n })\r\n },\r\n computed: billingModule.mapGetters({\r\n monthBillingData: BillingGetters.MonthBillingData,\r\n isLoading: BillingGetters.IsLoading,\r\n year: BillingGetters.Year,\r\n month: BillingGetters.Month,\r\n errors: BillingGetters.Errors\r\n })\r\n})\r\nexport default class BillingAccount extends Vue {\r\n readonly monthBillingData!: MonthBillingData[];\r\n readonly isLoading!: boolean;\r\n readonly year!: number;\r\n readonly month!: number;\r\n readonly errors!: string[];\r\n\r\n readonly headers = [\r\n { text: \"Type\", value: \"billingType\", width: 360 },\r\n { text: \"Number of cases\", value: \"casesCount\", width: 140 },\r\n { text: \"Cases\", value: \"cases\" }\r\n ];\r\n readonly billingDates = billingDates;\r\n\r\n readonly loadMonthBillingData!: () => Promise;\r\n readonly setYearAndMonth!: (value: { year: number; month: number }) => void;\r\n readonly showErrors!: (errors: string[] | string) => void;\r\n readonly getYearMonthString = getYearMonthString;\r\n\r\n get pickedDate(): string {\r\n return this.getYearMonthString(this.year, this.month - 1);\r\n }\r\n\r\n set pickedDate(dateString: string) {\r\n const date = new Date(dateString);\r\n const year = date.getFullYear();\r\n const month = date.getMonth() + 1;\r\n this.setYearAndMonth({ year, month });\r\n this.loadMonthBillingData();\r\n }\r\n\r\n getMonthBillingTableItems(billingData: BillingData[]): BillingTableItem[] {\r\n return billingData.map((bd) => ({\r\n billingType: bd.billingType,\r\n casesCount: bd.caseInternalIds.length,\r\n cases: bd.caseInternalIds.join(\", \")\r\n }));\r\n }\r\n\r\n created(): void {\r\n this.loadMonthBillingData();\r\n }\r\n\r\n @Watch(\"errors\")\r\n onErrors(errors: string[]): void {\r\n this.showErrors(errors);\r\n }\r\n\r\n downloadReport(): void {\r\n const doc = billingReportGenerator.generatePdfBillingReport(\r\n this.monthBillingData,\r\n this.year,\r\n this.month - 1\r\n );\r\n const monthYearString = getFullMonthYearString(\r\n this.year,\r\n this.month - 1\r\n );\r\n doc.save(`IFM Billing Report ${monthYearString}`);\r\n }\r\n}\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--15-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Billing.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--15-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Billing.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./Billing.html?vue&type=template&id=137299fc&scoped=true&\"\nimport script from \"./Billing.vue?vue&type=script&lang=ts&\"\nexport * from \"./Billing.vue?vue&type=script&lang=ts&\"\nimport style0 from \"./Billing.scss?vue&type=style&index=0&id=137299fc&prod&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 \"137299fc\",\n null\n \n)\n\nexport default component.exports","import Billing from \"./Billing.vue\";\r\nexport default Billing;\r\n","import jsPDF, { jsPDFOptions } from \"jspdf\";\r\n\r\nconst widthA4 = 595.28;\r\nconst heightA4 = 841.89;\r\n\r\nexport const a4Options: jsPDFOptions = {\r\n unit: \"pt\",\r\n format: [widthA4, heightA4]\r\n};\r\n\r\nexport function PrintFromHtmlA4(\r\n src: string | HTMLElement,\r\n filename: string,\r\n margin = 0\r\n): void {\r\n const doc = new jsPDF({ ...a4Options, orientation: \"portrait\" });\r\n if (src) {\r\n doc.html(src, {\r\n autoPaging: \"text\",\r\n margin: [margin, margin, margin, margin],\r\n width: widthA4 - 2 * margin,\r\n windowWidth: widthA4 - 2 * margin\r\n }).then(() => doc.save(filename));\r\n }\r\n}\r\n","import { getYearMonthString } from \"@/services/dateFormatUtils\";\r\n\r\nconst minMonth = \"2020-01\";\r\n\r\nconst date = new Date();\r\nconst maxMonth = getYearMonthString(date.getFullYear(), date.getMonth());\r\n\r\nexport default {\r\n minMonth,\r\n maxMonth\r\n};\r\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!./Billing.scss?vue&type=style&index=0&id=137299fc&prod&lang=scss&scoped=true&\"","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!./BillingAccount.scss?vue&type=style&index=0&id=61228e0e&prod&lang=scss&scoped=true&\"","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"wrapper\"},[_c('div',{staticClass:\"content\"},[_c('DynamicTitle',{attrs:{\"title\":\"Billing\",\"elements\":[{name: 'Account', selected: true}]}}),(_vm.isLoading)?_c('v-progress-linear',{attrs:{\"indeterminate\":\"\"}}):_vm._e(),_vm._l((_vm.accountInfo.billingSummaries),function(billingSummary){return (!_vm.isLoading)?_c('div',{staticClass:\"mb-6\"},[_c('div',{staticClass:\"v-text-subtitle1\"},[_vm._v(\" Created month: \"),_c('v-chip',{staticClass:\"indigo--text ml-2\",attrs:{\"color\":\"blue lighten-5\"}},[_vm._v(\" \"+_vm._s(_vm.getYearMonthString(billingSummary.year, billingSummary.month - 1))+\" \")])],1),_c('v-data-table',{attrs:{\"headers\":_vm.headers,\"items\":billingSummary.billingSummaryUnits,\"hide-default-footer\":\"\",\"disable-sort\":\"\"}})],1):_vm._e()})],2),_c('SideFilter',{staticClass:\"filter\",attrs:{\"locked\":\"\",\"label\":\"Calendar\"}},[_c('v-date-picker',{staticClass:\"mt-2 mb-4\",attrs:{\"type\":\"month\",\"width\":\"400\",\"min\":_vm.billingDates.minMonth,\"max\":_vm.billingDates.maxMonth,\"show-current\":false},model:{value:(_vm.pickedDate),callback:function ($$v) {_vm.pickedDate=$$v},expression:\"pickedDate\"}}),_c('div',[_c('v-btn',{attrs:{\"color\":\"warning\",\"disabled\":!_vm.accountInfo.isBillingPossible,\"loading\":_vm.isLoading || _vm.isBilling},on:{\"click\":_vm.bill}},[_vm._v(\" Bill month \")])],1)],1)],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\r\nimport Vue from \"vue\";\r\nimport { Component } from \"vue-property-decorator\";\r\nimport billingAccountApi from \"@/api/billingAccountApi\";\r\nimport DynamicTitle from \"@/components/DynamicTitle\";\r\nimport SideFilter from \"@/components/SideFilter\";\r\nimport { AccountInfo } from \"@/models/billingAccount/AccountInfo\";\r\nimport { billingAccountModule } from \"@/store/modules/billingAccount\";\r\nimport { BillingAccountActions } from \"@/store/modules/billingAccount/actions\";\r\nimport { BillingAccountGetters } from \"@/store/modules/billingAccount/getters\";\r\nimport { BillingAccountMutation } from \"@/store/modules/billingAccount/mutations\";\r\nimport { makeRequest } from \"@/services/requestUtils\";\r\nimport { getYearMonthString } from \"@/services/dateFormatUtils\";\r\nimport billingDates from \"@/consts/billingDates\";\r\n\r\n@Component({\r\n components: { DynamicTitle, SideFilter },\r\n methods: {\r\n ...billingAccountModule.mapActions({\r\n loadAccountInfo: BillingAccountActions.LoadAccountInfo\r\n }),\r\n ...billingAccountModule.mapMutations({\r\n setYearAndMonth: BillingAccountMutation.SetYearAndMonth\r\n })\r\n },\r\n computed: billingAccountModule.mapGetters({\r\n accountInfo: BillingAccountGetters.AccountInfo,\r\n isLoading: BillingAccountGetters.IsLoading,\r\n year: BillingAccountGetters.Year,\r\n month: BillingAccountGetters.Month,\r\n errors: BillingAccountGetters.Errors\r\n })\r\n})\r\nexport default class BillingAccount extends Vue {\r\n readonly accountInfo!: AccountInfo;\r\n readonly isLoading!: boolean;\r\n readonly year!: number;\r\n readonly month!: number;\r\n readonly errors!: string[];\r\n\r\n readonly headers = [\r\n { text: \"Type\", value: \"billingType\" },\r\n { text: \"Number of not calculated cases\", value: \"count\", width: 250 }\r\n ];\r\n readonly billingDates = billingDates;\r\n\r\n readonly loadAccountInfo!: () => Promise;\r\n readonly setYearAndMonth!: (value: { year: number; month: number }) => void;\r\n readonly getYearMonthString = getYearMonthString;\r\n\r\n isBilling = false;\r\n\r\n get pickedDate(): string {\r\n return this.getYearMonthString(this.year, this.month - 1);\r\n }\r\n\r\n set pickedDate(dateString: string) {\r\n const date = new Date(dateString);\r\n const year = date.getFullYear();\r\n const month = date.getMonth() + 1;\r\n this.setYearAndMonth({ year, month });\r\n this.loadAccountInfo();\r\n }\r\n\r\n created(): void {\r\n this.loadAccountInfo();\r\n }\r\n\r\n async bill(): Promise {\r\n await makeRequest(\r\n () => billingAccountApi.createBillings(this.year, this.month),\r\n (val) => (this.isBilling = val)\r\n );\r\n await this.loadAccountInfo();\r\n }\r\n}\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--15-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./BillingAccount.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--15-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./BillingAccount.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./BillingAccount.html?vue&type=template&id=61228e0e&scoped=true&\"\nimport script from \"./BillingAccount.vue?vue&type=script&lang=ts&\"\nexport * from \"./BillingAccount.vue?vue&type=script&lang=ts&\"\nimport style0 from \"./BillingAccount.scss?vue&type=style&index=0&id=61228e0e&prod&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 \"61228e0e\",\n null\n \n)\n\nexport default component.exports","import BillingAccount from \"./BillingAccount.vue\";\r\nexport default BillingAccount;\r\n"],"sourceRoot":""}