{"version":3,"file":"period_controller-9-sMT1FO.js","sources":["../../../app/javascript/controllers/automation/period_controller.js"],"sourcesContent":["import ApplicationController from '@/controllers/application_controller'\n\nexport default class extends ApplicationController {\n static targets = [\n 'container',\n 'whenButton',\n 'durationInput',\n 'durationSelect',\n 'trigger',\n 'option',\n 'quantityInput',\n 'periodSubfilterInput',\n ]\n\n enable() {\n this.show(this.containerTarget)\n this.hide(this.whenButtonTarget)\n }\n\n hidePeriodFilters({ currentTarget }) {\n this.hide(this.durationInputTarget, this.durationSelectTarget)\n this.disable(this.durationInputTarget)\n\n this.triggerTarget.innerText = currentTarget.innerText\n\n this.durationSelectTarget.querySelectorAll('select, input').forEach(this.disable)\n this.disable(this.periodSubfilterInputTarget)\n\n this.optionTargets.forEach((option) => {\n if(option === currentTarget) {\n option.classList.add('bg-lavender-light')\n } else {\n option.classList.remove('bg-lavender-light')\n }\n })\n }\n\n showPeriodFilters({ currentTarget }) {\n this.show(this.durationInputTarget, this.durationSelectTarget)\n\n super.enable(this.durationInputTarget)\n this.durationSelectTarget.querySelectorAll('select, input').forEach(super.enable)\n\n this.focus(this.durationInputTarget, { moveCursorToEnd: true })\n\n this.triggerTarget.innerText = currentTarget.innerText\n this.optionTargets.forEach((option) => {\n if(option === currentTarget) {\n option.classList.add('bg-lavender-light')\n } else {\n option.classList.remove('bg-lavender-light')\n }\n })\n }\n\n setQuantityFilter() {\n super.enable(this.quantityInputTarget)\n }\n\n unsetQuantityFilter() {\n this.disable(this.quantityInputTarget)\n }\n\n setPeriodSubfilter({ currentTarget }) {\n const { subfilter } = currentTarget.dataset\n\n this.periodSubfilterInputTarget.value = subfilter\n super.enable(this.periodSubfilterInputTarget)\n }\n}\n"],"names":["period_controller","ApplicationController","currentTarget","option","subfilter","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAsB,CAYjD,QAAS,CACP,KAAK,KAAK,KAAK,eAAe,EAC9B,KAAK,KAAK,KAAK,gBAAgB,CACnC,CAEE,kBAAkB,CAAE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