{"version":3,"file":"basic_info_form_controller-BJm7sAMI.js","sources":["../../app/assets/javascript/controllers/loan_applications/basic_info_form_controller.js"],"sourcesContent":["import { Controller } from \"@hotwired/stimulus\";\n\nexport default class extends Controller {\n static targets = [\"marriageCheck\", \"spouseInfo\", \"spouseAddress\", \"spouseField\", \"spouseAddressField\",\n \"spouseDifferentAddressCheck\"];\n\n checkState({ target: { value: state } }) {\n if (state === 'WI') {\n this.marriageCheckTarget.classList.remove('hidden');\n } else {\n this.marriageCheckTarget.classList.add('hidden');\n this.spouseInfoTarget.classList.add('hidden');\n this.spouseAddressTarget.classList.add('hidden');\n this.spouseFieldTargets.forEach(this.clearField);\n }\n }\n\n toggleMarried({ target: marriedCheckbox }) {\n this.spouseInfoTarget.classList.toggle('hidden', !marriedCheckbox.checked);\n\n const forwardElement = marriedCheckbox.checked ? this.spouseDifferentAddressCheckTarget : marriedCheckbox;\n this.toggleSpouseAddress({ target: forwardElement });\n }\n\n toggleSpouseAddress({ target: spouseDifferentAddressCheckbox }) {\n this.spouseAddressTarget.classList.toggle('hidden', !spouseDifferentAddressCheckbox.checked);\n\n if (!spouseDifferentAddressCheckbox.checked) {\n this.spouseAddressFieldTargets.forEach(this.clearField);\n }\n }\n\n clearField(element) {\n if (element.type === 'checkbox') {\n element.checked = false;\n } else {\n element.value = '';\n }\n }\n}\n"],"names":["basic_info_form_controller","Controller","state","marriedCheckbox","forwardElement","spouseDifferentAddressCheckbox","element","__publicField"],"mappings":"kSAEe,MAAKA,UAASC,CAAW,CAItC,WAAW,CAAE,OAAQ,CAAE,MAAOC,CAAO,CAAA,EAAI,CACnCA,IAAU,KACZ,KAAK,oBAAoB,UAAU,OAAO,QAAQ,GAElD,KAAK,oBAAoB,UAAU,IAAI,QAAQ,EAC/C,KAAK,iBAAiB,UAAU,IAAI,QAAQ,EAC5C,KAAK,oBAAoB,UAAU,IAAI,QAAQ,EAC/C,KAAK,mBAAmB,QAAQ,KAAK,UAAU,EAErD,CAEE,cAAc,CAAE,OAAQC,GAAmB,CACzC,KAAK,iBAAiB,UAAU,OAAO,SAAU,CAACA,EAAgB,OAAO,EAEzE,MAAMC,EAAiBD,EAAgB,QAAU,KAAK,kCAAoCA,EAC1F,KAAK,oBAAoB,CAAE,OAAQC,CAAc,CAAE,CACvD,CAEE,oBAAoB,CAAE,OAAQC,GAAkC,CAC9D,KAAK,oBAAoB,UAAU,OAAO,SAAU,CAACA,EAA+B,OAAO,EAEtFA,EAA+B,SAClC,KAAK,0BAA0B,QAAQ,KAAK,UAAU,CAE5D,CAEE,WAAWC,EAAS,CACdA,EAAQ,OAAS,WACnBA,EAAQ,QAAU,GAElBA,EAAQ,MAAQ,EAEtB,CACA,CApCEC,EADkBP,EACX,UAAU,CAAC,gBAAiB,aAAc,gBAAiB,cAAe,qBAC/D,6BAA6B"}