|
|
@ -1,26 +1,26 @@ |
|
|
|
import { Controller } from '@hotwired/stimulus' |
|
|
|
import { Controller } from '@hotwired/stimulus' |
|
|
|
|
|
|
|
|
|
|
|
const profitStatusSelect = document.getElementById('organisation-profit-status-field'); |
|
|
|
const profitStatusSelect = document.getElementById('organisation-profit-status-field') |
|
|
|
const localAuthorityOption = profitStatusSelect.querySelector('option[value="local_authority"]'); |
|
|
|
const localAuthorityOption = profitStatusSelect.querySelector('option[value="local_authority"]') |
|
|
|
const nonProfitOption = profitStatusSelect.querySelector('option[value="non_profit"]'); |
|
|
|
const nonProfitOption = profitStatusSelect.querySelector('option[value="non_profit"]') |
|
|
|
const profitOption = profitStatusSelect.querySelector('option[value="profit"]'); |
|
|
|
const profitOption = profitStatusSelect.querySelector('option[value="profit"]') |
|
|
|
export default class extends Controller { |
|
|
|
export default class extends Controller { |
|
|
|
updateProfitStatusOptions(event) { |
|
|
|
updateProfitStatusOptions (event) { |
|
|
|
const providerType = event.target.value; |
|
|
|
const providerType = event.target.value |
|
|
|
|
|
|
|
|
|
|
|
if (profitStatusSelect) { |
|
|
|
if (profitStatusSelect) { |
|
|
|
profitStatusSelect.disabled = false; |
|
|
|
profitStatusSelect.disabled = false |
|
|
|
localAuthorityOption.hidden = false; |
|
|
|
localAuthorityOption.hidden = false |
|
|
|
nonProfitOption.hidden = false; |
|
|
|
nonProfitOption.hidden = false |
|
|
|
profitOption.hidden = false; |
|
|
|
profitOption.hidden = false |
|
|
|
|
|
|
|
|
|
|
|
if (providerType === "LA") { |
|
|
|
if (providerType === 'LA') { |
|
|
|
profitStatusSelect.value = "local_authority"; |
|
|
|
profitStatusSelect.value = 'local_authority' |
|
|
|
nonProfitOption.hidden = true; |
|
|
|
nonProfitOption.hidden = true |
|
|
|
profitOption.hidden = true; |
|
|
|
profitOption.hidden = true |
|
|
|
} else if (providerType === "PRP") { |
|
|
|
} else if (providerType === 'PRP') { |
|
|
|
profitStatusSelect.value = ""; |
|
|
|
profitStatusSelect.value = '' |
|
|
|
localAuthorityOption.hidden = true; |
|
|
|
localAuthorityOption.hidden = true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|