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EAAWa,OAAO,CAACpB,EAAIW,GAAGX,EAAIY,GAAGL,EAAWM,iBAAiB,CAACb,EAAIW,GAAGX,EAAIY,GAAGL,EAAWM,gBAAiBN,EAAWY,KAAMlB,EAAG,OAAO,CAACG,YAAY,iCAAiCc,MAAM,CAAC,UAAU,4BAA4BlB,EAAIiB,MAAM,IAAI,KAAI,EACx8B,EACII,EAAkB,G,kECOtB,IAAqBC,EAArB,cAA+CC,EAAAA,GAAG9D,eAAAC,GAAA,SAAAA,IAAAC,EAAAA,EAAAA,GAAA,2BAG1CiB,eACA,OAAOH,EAAAA,EAAaE,QACxB,CAEI2B,2BACA,OAAOkB,EAAAA,EAAAA,GAAKzD,KAAK0D,aAAaC,KAAKnB,IAC/B,GAAIA,EAAWoB,OAASrE,EAAAA,EAAesE,QAAiC,GAAvBrB,EAAWO,SAC5D,CACI,MAAMe,EAAWtB,EAAWQ,gBAAgBe,MAAM,KAC9CD,EAASE,OAAS,IAClBxB,EAAWS,KAAOa,EAAS,IAE/BtB,EAAWQ,iBAAmBR,EAAWO,SAAW/C,KAAKa,UAAUoD,eAAe,Q,CAGtF,OAAOzB,CAAU,GAEzB,CAEAE,SAASF,GACL,OAAOA,EAAWoB,MAAQrE,EAAAA,EAAesE,MAC7C,CAEQK,UAAUC,GACd,OAAQC,MAAMC,WAAWF,GAC7B,IA3BuC7C,EAAAA,EAAAA,IAAA,EAAtCgD,EAAAA,EAAAA,IAAK,CAAEV,KAAMW,MAAOC,UAAU,KAAO,kCADrBjB,GAAiBjC,EAAAA,EAAAA,IAAA,EAHrCmD,EAAAA,EAAAA,IAAU,CACP5C,KAAM,uBAEW0B,G,UCT+c,I,eCOhemB,GAAY,OACd,EACA1C,EACAsB,GACA,EACA,KACA,KACA,MAIF,QAAeoB,EAAiB,O","sources":["webpack://website-js/./src/models/Recipe.ts","webpack://website-js/./src/services/RecipeService.ts","webpack://website-js/./src/store/modules/RecipeModule.ts","webpack://website-js/./src/components/recipe/RecipeIngredients.vue","webpack://website-js/./src/components/recipe/RecipeIngredients.vue?021d","webpack://website-js/./src/components/recipe/RecipeIngredients.vue?678e","webpack://website-js/./src/components/recipe/RecipeIngredients.vue?6ab2"],"sourcesContent":["import { DisplayPriceInfo } from \"./Product\";\r\n\r\nexport interface RecipeIngredient {\r\n type: RecipeItemType;\r\n displayquantity: string;\r\n quantity: number;\r\n displaylabel: string;\r\n unit?: string;\r\n link: string;\r\n info: string;\r\n variants: RecipeIngredientVariant[];\r\n}\r\n\r\nexport enum RecipeItemType {\r\n Header,\r\n Display,\r\n Product\r\n}\r\n\r\nexport interface RecipeIngredientVariant {\r\n productid: string;\r\n consumptionprbatch: string;\r\n consumptionprbatchasdecimal: number;\r\n}\r\n\r\nexport interface RecipeContainer {\r\n type: RecipeItemType;\r\n quantityprbatch: string;\r\n displaylabel: string;\r\n link: string;\r\n productid: string;\r\n quantityprbatchasdecimal: number;\r\n}\r\n\r\nexport interface RecipeStep {\r\n type: RecipeStepType;\r\n number?: number | null;\r\n text: string;\r\n}\r\n\r\nexport enum RecipeStepType {\r\n Header,\r\n Subheader,\r\n Step\r\n}\r\n\r\nexport interface RecipeCalculationRequest {\r\n contentid: number;\r\n noofbatches: number;\r\n containerid: string;\r\n}\r\n\r\nexport interface RecipeCalculationResponse {\r\n ingredients: RecipeCalculationResponseIngredient[];\r\n containers: RecipeCalculationResponseContainer[];\r\n outofstockitems: string[];\r\n priceperbatch: DisplayPriceInfo;\r\n pricetotal: DisplayPriceInfo;\r\n}\r\n\r\nexport interface RecipeCalculationResponseItem {\r\n id: string;\r\n name: string;\r\n volume: string;\r\n price: DisplayPriceInfo;\r\n quantity: string;\r\n quantityasnumeric: number;\r\n}\r\n\r\nexport interface RecipeCalculationResponseIngredient extends RecipeCalculationResponseItem {\r\n parent: string;\r\n usage: number;\r\n}\r\n\r\nexport interface RecipeCalculationResponseContainer extends RecipeCalculationResponseItem {\r\n selected: boolean;\r\n}\r\n\r\nexport interface AddedRecipe {\r\n id: string;\r\n name: string;\r\n url: string;\r\n}\r\n\r\nexport interface RecipePreview {\r\n id: number;\r\n name: string;\r\n summary: string;\r\n image: string;\r\n url: string;\r\n}","import { AddedRecipe, RecipeCalculationRequest, RecipeCalculationResponse } from '@/models/Recipe';\r\nimport axios, { AxiosResponse } from 'axios';\r\n\r\nexport default class RecipeService {\r\n\r\n private profileId: string = (window as any).CbxApiContextKey;\r\n private endpoint: string;\r\n\r\n constructor(args: any = {}) {\r\n if (args.profileId)\r\n this.profileId = args.profileId;\r\n this.endpoint = `/contextapi/${this.profileId}/v1/recipe`;\r\n }\r\n \r\n public async calculate(data: RecipeCalculationRequest): Promise {\r\n try {\r\n const res: AxiosResponse = await axios.post(`${this.endpoint}/calculate`, data);\r\n return res.data;\r\n } catch (e) {\r\n console.log(e);\r\n }\r\n }\r\n \r\n public async getAdded(): Promise {\r\n try {\r\n const res: AxiosResponse = await axios.post(`${this.endpoint}/added`);\r\n return res.data;\r\n } catch (e) {\r\n console.log(e);\r\n }\r\n } \r\n \r\n public async removeAdded(id: string): Promise {\r\n try {\r\n const res: AxiosResponse = await axios.post(`${this.endpoint}/remove/${id}`);\r\n return res.data;\r\n } catch (e) {\r\n console.log(e);\r\n }\r\n } \r\n}\r\n","import { Module, VuexModule, Mutation, getModule, Action } from 'vuex-module-decorators';\r\nimport store from '@/store';\r\nimport { AddedRecipe } from '@/models/Recipe';\r\nimport RecipeService from '@/services/RecipeService';\r\n\r\n@Module({\r\n store,\r\n dynamic: true,\r\n name: 'recipe',\r\n namespaced: true,\r\n})\r\nclass RecipeModule extends VuexModule {\r\n\r\n private service: RecipeService = new RecipeService();\r\n\r\n private portions: number = 1;\r\n private added: AddedRecipe[] = [];\r\n\r\n get PORTIONS(): number {\r\n return this.portions;\r\n }\r\n\r\n get ADDED(): AddedRecipe[] {\r\n return this.added;\r\n }\r\n\r\n @Mutation\r\n public SET_PORTIONS(args: number) {\r\n this.portions = args;\r\n }\r\n\r\n @Action({ commit: 'SET_ADDED' })\r\n public async GET_ADDED() {\r\n return await this.service.getAdded();\r\n }\r\n @Action({ commit: 'SET_ADDED' })\r\n public async REMOVE_ADDED(id: string) {\r\n return await this.service.removeAdded(id);\r\n }\r\n @Mutation\r\n public SET_ADDED(payload: AddedRecipe[]) {\r\n this.added = payload;\r\n }\r\n\r\n}\r\n\r\nexport default getModule(RecipeModule);\r\n","var render = function render(){var _vm=this,_c=_vm._self._c,_setup=_vm._self._setupProxy;return _c('div',{staticClass:\"recipe-ingredients\"},[_vm._l((_vm.portionedIngredients),function(ingredient,idx){return [(_vm.isHeader(ingredient))?[_c('div',{key:`header_${idx}`,staticClass:\"recipe-ingredients-header\"},[_vm._v(_vm._s(ingredient.displaylabel))])]:[_c('div',{key:`qty_${idx}`},[(ingredient.quantity > 0)?[_vm._v(_vm._s(ingredient.displayquantity)+\" \"+_vm._s(ingredient.unit))]:(ingredient.displayquantity)?[_vm._v(_vm._s(ingredient.displayquantity)+\" \"+_vm._s(ingredient.unit))]:_vm._e()],2),_c('div',{key:`text_${idx}`,staticClass:\"recipe-text\",attrs:{\"uk-tooltip\":ingredient.info}},[(ingredient.link)?_c('a',{attrs:{\"href\":ingredient.link}},[_vm._v(_vm._s(ingredient.displaylabel))]):[_vm._v(_vm._s(ingredient.displaylabel))],(ingredient.info)?_c('span',{staticClass:\"uk-margin-xsmall-right uk-icon\",attrs:{\"uk-icon\":\"icon: info; ratio: 0.7\"}}):_vm._e()],2)]]})],2)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\r\nimport { RecipeIngredient, RecipeItemType } from '@/models/Recipe';\r\nimport RecipeModule from '@/store/modules/RecipeModule';\r\nimport { copy } from '@/utils/objectUtils';\r\nimport { Component, Prop, Vue } from 'vue-property-decorator';\r\n\r\n@Component({\r\n name: 'RecipeIngredients',\r\n})\r\nexport default class RecipeIngredients extends Vue {\r\n @Prop({ type: Array, required: true }) ingredients: RecipeIngredient[];\r\n\r\n get portions(): number {\r\n return RecipeModule.PORTIONS;\r\n }\r\n\r\n get portionedIngredients(): RecipeIngredient[] {\r\n return copy(this.ingredients).map((ingredient: RecipeIngredient) => {\r\n if (ingredient.type !== RecipeItemType.Header && ingredient.quantity != 0)\r\n {\r\n const qtyParts = ingredient.displayquantity.split(' ');\r\n if (qtyParts.length > 1)\r\n ingredient.unit = qtyParts[1];\r\n\r\n ingredient.displayquantity = (ingredient.quantity * this.portions).toLocaleString(\"da-DK\");\r\n }\r\n\r\n return ingredient;\r\n });\r\n }\r\n\r\n isHeader(ingredient: RecipeIngredient) {\r\n return ingredient.type == RecipeItemType.Header;\r\n }\r\n \r\n private isNumeric(str: string): boolean {\r\n return !isNaN(parseFloat(str));\r\n }\r\n}\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??clonedRuleSet-41.use[0]!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??clonedRuleSet-41.use[3]!../../../node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!../../../node_modules/@vue/cli-service/lib/config/vue-loader-v15-resolve-compat/vue-loader.js??vue-loader-options!./RecipeIngredients.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??clonedRuleSet-41.use[0]!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??clonedRuleSet-41.use[3]!../../../node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!../../../node_modules/@vue/cli-service/lib/config/vue-loader-v15-resolve-compat/vue-loader.js??vue-loader-options!./RecipeIngredients.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./RecipeIngredients.vue?vue&type=template&id=28b919bc&\"\nimport script from \"./RecipeIngredients.vue?vue&type=script&lang=ts&\"\nexport * from \"./RecipeIngredients.vue?vue&type=script&lang=ts&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/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"],"names":["RecipeItemType","RecipeStepType","RecipeService","constructor","args","_defineProperty","window","CbxApiContextKey","profileId","this","endpoint","async","data","res","axios","e","console","log","id","RecipeModule","VuexModule","PORTIONS","portions","ADDED","added","SET_PORTIONS","service","getAdded","removeAdded","SET_ADDED","payload","__decorate","Mutation","Action","commit","Module","store","dynamic","name","namespaced","getModule","render","_vm","_c","_self","_setupProxy","staticClass","_l","portionedIngredients","ingredient","idx","isHeader","key","_v","_s","displaylabel","quantity","displayquantity","unit","_e","attrs","info","link","staticRenderFns","RecipeIngredients","Vue","copy","ingredients","map","type","Header","qtyParts","split","length","toLocaleString","isNumeric","str","isNaN","parseFloat","Prop","Array","required","Component","component"],"sourceRoot":""}