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,kCACetG,EAAAA,EAAAA,IAAA,EAArDmG,EAAAA,EAAAA,IAAK,CAAEC,KAAMC,OAAQC,UAAU,EAAOC,QAAS,MAAK,4BACKvG,EAAAA,EAAAA,IAAA,EAAzDmG,EAAAA,EAAAA,IAAK,CAAEC,KAAMC,OAAQC,UAAU,EAAOC,QAAS,UAAS,6BAyFzDvG,EAAAA,EAAAA,IAAA,EADCwG,EAAAA,EAAAA,IAAM,aAAW,qCA3FD5C,GAAqB5D,EAAAA,EAAAA,IAAA,EAJzCyG,EAAAA,EAAAA,IAAU,CACPlG,KAAM,wBACNmG,WAAY,CAAC,KAEI9C,G,UCfmd,I,eCOpe+C,GAAY,OACd,EACAjG,EACAgD,GACA,EACA,KACA,KACA,MAIF,QAAeiD,EAAiB,O","sources":["webpack://website-js/./src/services/RecipeService.ts","webpack://website-js/./src/store/modules/RecipeModule.ts","webpack://website-js/./src/components/recipe/AddRecipeToCartButton.vue","webpack://website-js/./src/components/recipe/AddRecipeToCartButton.vue?f5c9","webpack://website-js/./src/components/recipe/AddRecipeToCartButton.vue?7af1","webpack://website-js/./src/components/recipe/AddRecipeToCartButton.vue?b697"],"sourcesContent":["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-add-to-cart\"},[_c('button',{staticClass:\"uk-button uk-button-primary\",class:_vm.buttonClasses,on:{\"click\":_vm.modalShow}},[_c('span',{staticClass:\"uk-icon\",attrs:{\"uk-icon\":`icon: fal-shopping-bag; ratio: ${_vm.buttonIconSize}`}}),_c('span',[_vm._v(_vm._s(_vm.buttonText))])]),_c('Modal',{attrs:{\"width\":\"900px\",\"height\":\"auto\",\"autoExpand\":true},on:{\"close-modal\":_vm.modalHide},model:{value:(_vm.modalOpen),callback:function ($$v) {_vm.modalOpen=$$v},expression:\"modalOpen\"}},[_c('ModalHeader',{attrs:{\"title\":_vm.buttonText,\"icon\":\"fal-shopping-bag\"},on:{\"close-modal\":_vm.modalHide}}),(_vm.model)?_c('div',{staticClass:\"modal-body\"},[(_vm.model.outofstockitems)?_c('div',{staticClass:\"recipe-add-to-cart-outofstock uk-flex uk-flex-center\"},[_c('div',{staticClass:\"uk-margin-top\"},[_c('strong',{staticClass:\"uk-text-center\"},[_vm._v(_vm._s(_vm.$t('recipe.out-of-stock-notice', ['Please note that the following items are not in stock and will therefore not be added to the basket.'])))]),_c('ul',_vm._l((_vm.model.outofstockitems),function(item){return _c('li',{key:item},[_vm._v(_vm._s(item))])}),0)])]):_vm._e(),_c('div',{staticClass:\"recipe-add-to-cart-products\"},[_c('div',{staticClass:\"uk-grid uk-child-width-1-3@s uk-grid-large\"},[_c('div',[_c('div',{staticClass:\"recipe-add-to-cart-products-title uk-visible@s\"}),_c('div',{staticClass:\"recipe-add-to-cart-portions\"},[_c('span',[_vm._v(_vm._s(_vm.$t('recipe.how-many-portions', ['How many portions do you want to make?'])))]),_c('RecipePortions')],1)]),_c('div',[_c('div',{staticClass:\"recipe-add-to-cart-products-title\"},[_vm._v(_vm._s(_vm.$t('recipe.raw-materials', ['Raw materials'])))]),_c('div',_vm._l((_vm.model.ingredients),function(ingredient){return _c('div',{key:ingredient.id,staticClass:\"recipe-add-to-cart-product recipe-add-to-cart-ingredient\"},[_c('div',{staticClass:\"recipe-add-to-cart-product-name\"},[_vm._v(_vm._s(ingredient.name))]),_c('div',{staticClass:\"recipe-add-to-cart-product-volume\"},[_vm._v(\" \"+_vm._s(ingredient.quantity)+\"x\"+_vm._s(ingredient.volume)+\" \")]),_c('div',{staticClass:\"recipe-add-to-cart-product-price\"},[_vm._v(\" \"+_vm._s(ingredient.price.currency)+\" \"+_vm._s(ingredient.price.priceincvat)+\" \")])])}),0)]),_c('div',[_c('div',{staticClass:\"recipe-add-to-cart-products-title\"},[_vm._v(_vm._s(_vm.$t('recipe.containers', ['Containers'])))]),_c('div',[_vm._l((_vm.model.containers),function(container){return _c('div',{key:container.id,staticClass:\"recipe-add-to-cart-product recipe-add-to-cart-container\"},[_c('div',{staticClass:\"recipe-add-to-cart-product-name\"},[_vm._v(_vm._s(container.name))]),_c('div',{staticClass:\"recipe-add-to-cart-product-volume\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.containerselection),expression:\"containerselection\"}],staticClass:\"uk-radio\",attrs:{\"type\":\"radio\"},domProps:{\"value\":container.id,\"checked\":_vm._q(_vm.containerselection,container.id)},on:{\"change\":[function($event){_vm.containerselection=container.id},_vm.calculate]}}),_vm._v(\" \"+_vm._s(container.quantity)+\"x\"+_vm._s(container.volume)+\" \")]),_c('div',{staticClass:\"recipe-add-to-cart-product-price\"},[_vm._v(\" \"+_vm._s(container.price.currency)+\" \"+_vm._s(container.price.priceincvat)+\" \")])])}),_c('div',{staticClass:\"recipe-add-to-cart-product recipe-add-to-cart-container-no-selection\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.containerselection),expression:\"containerselection\"}],staticClass:\"uk-radio\",attrs:{\"type\":\"radio\",\"value\":\"none\"},domProps:{\"checked\":_vm._q(_vm.containerselection,\"none\")},on:{\"change\":[function($event){_vm.containerselection=\"none\"},_vm.calculate]}}),_vm._v(\" \"+_vm._s(_vm.$t('recipe.no-containers-wanted', ['No containers wanted']))+\" \")])],2)])])]),_c('div',{staticClass:\"recipe-add-to-cart-totals\"},[_c('div',{staticClass:\"uk-grid uk-child-width-1-3@s\",attrs:{\"uk-grid\":\"\"}},[_c('div',[_c('div',{staticClass:\"recipe-add-to-cart-totals-title\"},[_vm._v(_vm._s(_vm.$t('recipe.approx-raw-price-per-portion', ['Approximate raw material price per portion'])))]),_c('div',{staticClass:\"recipe-add-to-cart-totals-amount\"},[_vm._v(\" \"+_vm._s(_vm.model.priceperbatch.currency)+\" \"+_vm._s(_vm.model.priceperbatch.priceincvat)+\" \")]),_c('div',{staticClass:\"recipe-add-to-cart-totals-subtitle\"},[_vm._v(_vm._s(_vm.$t('recipe.excl-excess-raw-materials', ['Excl. excess raw materials'])))])]),_c('div',[_c('div',{staticClass:\"recipe-add-to-cart-totals-title\"},[_vm._v(_vm._s(_vm.$t('recipe.total-recipe-price', ['Total price for recipe'])))]),_c('div',{staticClass:\"recipe-add-to-cart-totals-amount\"},[_vm._v(\" \"+_vm._s(_vm.model.pricetotal.currency)+\" \"+_vm._s(_vm.model.pricetotal.priceincvat)+\" \")]),_c('div',{staticClass:\"recipe-add-to-cart-totals-subtitle\"},[_vm._v(_vm._s(_vm.$t('recipe.incl-excess-raw-materials', ['Incl. excess raw materials'])))])]),_c('div',[_c('div',{staticClass:\"recipe-add-to-cart-totals-title\"},[_vm._v(_vm._s(_vm.$t('recipe.surplus-raw-materials', ['Surplus raw materials'])))]),_c('div',{staticClass:\"recipe-add-to-cart-totals-ingredients\"},_vm._l((_vm.leftovers),function(item){return _c('div',{key:item},[_vm._v(_vm._s(item))])}),0),_c('div',{staticClass:\"recipe-add-to-cart-totals-subtitle\"},[_vm._v(_vm._s(_vm.$t('recipe.indications-are-approximate', ['All indications are approximate'])))])])])])]):_vm._e(),_c('div',{staticClass:\"modal-footer\"},[_c('button',{staticClass:\"uk-button uk-button-primary uk-button-large uk-align-center\",on:{\"click\":_vm.addToCart}},[_c('span',{staticClass:\"uk-icon\",attrs:{\"uk-icon\":\"icon: fal-shopping-bag; ratio: 1\"}}),_c('span',[_vm._v(_vm._s(_vm.$t('recipe.add-recipe-ingredients-to-cart', ['Add the ingredients for the recipe to the cart'])))])])])],1)],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\r\nimport { AddOrUpdateCartEditModel } from '@/models/Cart';\r\nimport { RecipeCalculationResponse, RecipeCalculationResponseContainer, RecipeCalculationResponseIngredient } from '@/models/Recipe';\r\nimport RecipeService from '@/services/RecipeService';\r\nimport CartModule from '@/store/modules/CartModule';\r\nimport { CbxVariablesModule } from '@/store/modules/CbxVariablesModule';\r\nimport RecipeModule from '@/store/modules/RecipeModule';\r\nimport { Component, Prop, Vue, Watch } from 'vue-property-decorator';\r\n\r\nconst recipeService: RecipeService = new RecipeService();\r\n\r\n@Component({\r\n name: 'AddRecipeToCartButton',\r\n components: {}\r\n})\r\nexport default class AddRecipeToCartButton extends Vue {\r\n @Prop({ type: String, required: true }) buttonText: string;\r\n @Prop({ type: String, required: false, default: \"\" }) size: string;\r\n @Prop({ type: String, required: false, default: \"left\" }) align: string;\r\n\r\n modalOpen: boolean = false;\r\n model: RecipeCalculationResponse = null;\r\n containerselection: string = null;\r\n leftovers: string[] = [];\r\n\r\n get buttonIconSize(): string {\r\n return this.size == \"large\" ? \"1\" : \"0.7\"; \r\n }\r\n\r\n get buttonClasses(): string {\r\n const classes = [];\r\n\r\n if (this.size == \"large\") classes.push(\"uk-button-large\");\r\n classes.push(`uk-align-${this.align}`);\r\n\r\n return classes.join(\" \");\r\n }\r\n\r\n get portions(): number {\r\n return RecipeModule.PORTIONS;\r\n }\r\n set portions(input: number)\r\n {\r\n RecipeModule.SET_PORTIONS(input);\r\n }\r\n\r\n async calculate() {\r\n this.model = await recipeService.calculate({\r\n contentid: Number(CbxVariablesModule.VARIABLES.currentContentId),\r\n noofbatches: this.portions,\r\n containerid: this.containerselection,\r\n });\r\n \r\n this.containerselection = this.model.containers?.find(c => c.selected)?.id ?? \"none\";\r\n \r\n this.leftovers = [];\r\n let lastparent: string;\r\n let lastamount: number;\r\n this.model.ingredients.forEach((i: RecipeCalculationResponseIngredient) => {\r\n var amount = i.quantityasnumeric * parseFloat(i.volume);\r\n\r\n if (i.parent == '' || lastparent != i.parent) {\r\n lastparent = i.parent;\r\n lastamount = amount;\r\n } else {\r\n amount += lastamount; \r\n }\r\n\r\n const available = Math.round(amount - (parseFloat(i.volume) * i.usage / 100));\r\n const unit = i.volume.replace(/[0-9]/g, '');\r\n\r\n if (available > 0)\r\n this.leftovers.push(`${available} ${unit} ${i.name}`);\r\n });\r\n }\r\n\r\n async modalShow() {\r\n await this.calculate();\r\n\r\n this.modalOpen = true;\r\n }\r\n\r\n modalHide() {\r\n this.modalOpen = false;\r\n }\r\n\r\n async addToCart()\r\n {\r\n const variantid = `recipe-${CbxVariablesModule.VARIABLES.currentContentId}`;\r\n\r\n const payload: AddOrUpdateCartEditModel[] = [\r\n ...this.model.ingredients.map((i: RecipeCalculationResponseIngredient) => \r\n {\r\n return { productid: i.id, variantid: variantid, quantity: i.quantityasnumeric };\r\n }),\r\n ...this.model.containers?.filter(c => c.selected).map((c: RecipeCalculationResponseContainer) => \r\n {\r\n return { productid: c.id, variantid: variantid, quantity: c.quantityasnumeric };\r\n }) ?? [],\r\n ];\r\n\r\n await CartModule.ADD_LIST_TO_CART(payload);\r\n this.modalHide();\r\n CartModule.SET_IS_OPEN(true);\r\n }\r\n\r\n @Watch(\"portions\")\r\n async onPortionsChange() {\r\n if (this.modalOpen)\r\n await this.calculate();\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!./AddRecipeToCartButton.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!./AddRecipeToCartButton.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./AddRecipeToCartButton.vue?vue&type=template&id=36c83e3a&\"\nimport script from \"./AddRecipeToCartButton.vue?vue&type=script&lang=ts&\"\nexport * from \"./AddRecipeToCartButton.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":["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","class","buttonClasses","on","modalShow","attrs","buttonIconSize","_v","_s","buttonText","modalHide","model","value","modalOpen","callback","$$v","expression","outofstockitems","$t","_l","item","key","_e","ingredients","ingredient","quantity","volume","price","currency","priceincvat","containers","container","directives","rawName","containerselection","domProps","_q","$event","calculate","priceperbatch","pricetotal","leftovers","addToCart","staticRenderFns","recipeService","AddRecipeToCartButton","Vue","size","classes","push","align","join","input","lastparent","lastamount","contentid","Number","CbxVariablesModule","VARIABLES","currentContentId","noofbatches","containerid","find","c","selected","forEach","i","amount","quantityasnumeric","parseFloat","parent","available","Math","round","usage","unit","replace","variantid","map","productid","filter","CartModule","ADD_LIST_TO_CART","SET_IS_OPEN","Prop","type","String","required","default","Watch","Component","components","component"],"sourceRoot":""}