{"version":3,"file":"roi_calculator_controller-BcH3-w7G.js","names":[],"sources":["../../../app/javascript/entrypoints/site_controllers/roi_calculator_controller.js"],"sourcesContent":["import { Controller } from \"@hotwired/stimulus\"\n\n// Re-entry cost calculator: yearly cost of double data entry and how many weeks the\n// express automation takes to pay for itself (70 % of the time recovered, 46 weeks a year).\nexport default class extends Controller {\n static targets = [\"people\", \"hours\", \"rate\", \"peopleOut\", \"hoursOut\", \"rateOut\", \"yearly\", \"payback\"]\n static values = { price: Number, hourUnit: String, weekUnit: String }\n\n connect() {\n this.update()\n }\n\n update() {\n const people = Number(this.peopleTarget.value)\n const hours = Number(this.hoursTarget.value)\n const rate = Number(this.rateTarget.value)\n const weekly = people * hours * rate\n\n this.peopleOutTarget.textContent = people\n this.hoursOutTarget.textContent = `${hours} ${this.hourUnitValue}`\n this.rateOutTarget.textContent = this.euros(rate)\n this.yearlyTarget.textContent = this.euros(weekly * 46)\n this.paybackTarget.textContent = `${Math.max(1, Math.ceil(this.priceValue / (weekly * 0.7)))} ${this.weekUnitValue}`\n }\n\n euros(amount) {\n return new Intl.NumberFormat(document.documentElement.lang, { style: \"currency\", currency: \"EUR\", maximumFractionDigits: 0 }).format(amount)\n }\n}\n"],"mappings":"4GAIA,EAAA,cAA6B,CAAW,CACtC,OAAO,QAAU,CAAC,SAAU,QAAS,OAAQ,YAAa,WAAY,UAAW,SAAU,UAAU,CACrG,OAAO,OAAS,CAAE,MAAO,OAAQ,SAAU,OAAQ,SAAU,OAAQ,CAErE,SAAU,CACR,KAAK,QAAQ,CAGf,QAAS,CACP,IAAM,EAAS,OAAO,KAAK,aAAa,MAAM,CACxC,EAAQ,OAAO,KAAK,YAAY,MAAM,CACtC,EAAO,OAAO,KAAK,WAAW,MAAM,CACpC,EAAS,EAAS,EAAQ,EAEhC,KAAK,gBAAgB,YAAc,EACnC,KAAK,eAAe,YAAc,GAAG,EAAM,GAAG,KAAK,gBACnD,KAAK,cAAc,YAAc,KAAK,MAAM,EAAK,CACjD,KAAK,aAAa,YAAc,KAAK,MAAM,EAAS,GAAG,CACvD,KAAK,cAAc,YAAc,GAAG,KAAK,IAAI,EAAG,KAAK,KAAK,KAAK,YAAc,EAAS,IAAK,CAAC,CAAC,GAAG,KAAK,gBAGvG,MAAM,EAAQ,CACZ,OAAO,IAAI,KAAK,aAAa,SAAS,gBAAgB,KAAM,CAAE,MAAO,WAAY,SAAU,MAAO,sBAAuB,EAAG,CAAC,CAAC,OAAO,EAAO"}