{"version":3,"file":"campaign_controller-fbtLSNXu.js","sources":["../../../app/javascript/controllers/admin/campaign_controller.js"],"sourcesContent":["import Application_controller from '@/controllers/application_controller'\n\nexport default class extends Application_controller {\n static targets = [\n 'approveButton',\n 'rejectButton',\n 'rejectionReason',\n 'rejectionReasonTemplate',\n 'rejectionReasonsList',\n 'rejectionReasonItem',\n 'rejectionReasonPopover',\n 'orLabel',\n ]\n\n addRejectionReason({ currentTarget }) {\n const { kind } = currentTarget.dataset\n\n const reason = this.rejectionReasonTemplateTarget.cloneNode(true)\n\n reason.setAttribute('data-admin--campaign-target', 'rejectionReason')\n reason.setAttribute('data-kind', kind)\n\n reason.querySelector('[data-title]').innerText = t.admin.campaign.rejection_reasons.rejection_reason[kind].title\n reason.querySelector('[data-description]').innerText = t.admin.campaign.rejection_reasons.rejection_reason[kind].description\n\n reason.classList.remove('hidden')\n reason.querySelectorAll('input, textarea').forEach(this.enable)\n\n this.rejectionReasonsListTarget.appendChild(reason)\n\n this.hide(currentTarget)\n\n if(this.rejectionReasonItemTargets.every(item => item.classList.contains('hidden'))) {\n this.hide(this.rejectionReasonPopoverTarget)\n this.hide(this.orLabelTarget)\n } else {\n this.show(this.rejectionReasonPopoverTarget)\n this.show(this.orLabelTarget)\n }\n }\n\n rejectionReasonTargetConnected() {\n this.hide(this.approveButtonTarget)\n this.show(this.rejectButtonTarget)\n\n this.rejectionReasonPopoverTarget.querySelector('[data-ui--popover-target=\"trigger\"]').textContent = t.admin.campaigns.campaign.add_another_reason\n }\n\n rejectionReasonTargetDisconnected(target) {\n if(this.rejectionReasonTargets.length === 0) {\n this.show(this.approveButtonTarget)\n this.hide(this.rejectButtonTarget)\n\n this.rejectionReasonPopoverTarget.querySelector('[data-ui--popover-target=\"trigger\"]').textContent = t.admin.campaigns.campaign.choose_rejection_reason\n }\n\n this.rejectionReasonItemTargets.find(item => item.dataset.kind === target.dataset.kind).classList.remove('hidden')\n\n this.show(this.rejectionReasonPopoverTarget)\n this.show(this.orLabel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