1 changed files with 19 additions and 19 deletions
@ -1,27 +1,27 @@ |
|||||||
import { Controller } from '@hotwired/stimulus' |
import { Controller } from '@hotwired/stimulus' |
||||||
|
|
||||||
export default class extends Controller { |
export default class extends Controller { |
||||||
updateProfitStatusOptions (event) { |
updateProfitStatusOptions (event) { |
||||||
const profitStatusSelect = document.getElementById('organisation-profit-status-field') |
const profitStatusSelect = document.getElementById('organisation-profit-status-field') |
||||||
if (!profitStatusSelect) return |
if (!profitStatusSelect) return |
||||||
|
|
||||||
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"]') |
||||||
const providerType = event.target.value |
const providerType = event.target.value |
||||||
|
|
||||||
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 |
||||||
} |
|
||||||
} |
} |
||||||
|
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue