1 changed files with 20 additions and 20 deletions
@ -1,27 +1,27 @@ |
|||||||
import { Controller } from '@hotwired/stimulus' |
import { Controller } from '@hotwired/stimulus' |
||||||
|
|
||||||
const profitStatusSelect = document.getElementById('organisation-profit-status-field') |
|
||||||
const localAuthorityOption = profitStatusSelect.querySelector('option[value="local_authority"]') |
|
||||||
const nonProfitOption = profitStatusSelect.querySelector('option[value="non_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 profitStatusSelect = document.getElementById('organisation-profit-status-field') |
||||||
|
if (!profitStatusSelect) return |
||||||
|
|
||||||
if (profitStatusSelect) { |
const localAuthorityOption = profitStatusSelect.querySelector('option[value="local_authority"]') |
||||||
profitStatusSelect.disabled = false |
const nonProfitOption = profitStatusSelect.querySelector('option[value="non_profit"]') |
||||||
localAuthorityOption.hidden = false |
const profitOption = profitStatusSelect.querySelector('option[value="profit"]') |
||||||
nonProfitOption.hidden = false |
const providerType = event.target.value |
||||||
profitOption.hidden = false |
|
||||||
|
|
||||||
if (providerType === 'LA') { |
profitStatusSelect.disabled = false |
||||||
profitStatusSelect.value = 'local_authority' |
localAuthorityOption.hidden = false |
||||||
nonProfitOption.hidden = true |
nonProfitOption.hidden = false |
||||||
profitOption.hidden = true |
profitOption.hidden = false |
||||||
} else if (providerType === 'PRP') { |
|
||||||
profitStatusSelect.value = '' |
if (providerType === 'LA') { |
||||||
localAuthorityOption.hidden = true |
profitStatusSelect.value = 'local_authority' |
||||||
} |
nonProfitOption.hidden = true |
||||||
|
profitOption.hidden = true |
||||||
|
} else if (providerType === 'PRP') { |
||||||
|
profitStatusSelect.value = '' |
||||||
|
localAuthorityOption.hidden = true |
||||||
|
} |
||||||
} |
} |
||||||
} |
|
||||||
} |
} |
||||||
|
Loading…
Reference in new issue