Skip to content

Commit

Permalink
20989 - exclude USA conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
ketaki-deodhar committed May 7, 2024
1 parent 4ad1897 commit 9ee2278
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/components/jurisdiction/Jurisdiction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default class Jurisdiction extends Vue {
separator: (jur.value === JurisdictionLocation.FD)
}))
// add USA jurisdictions (conditionally)
if (this.showUsJurisdictions) {
array.push({ isHeader: true, group: 1, text: 'United States' })
UsaJurisdiction
Expand All @@ -56,7 +57,7 @@ export default class Jurisdiction extends Vue {
// add in International jurisdictions (not including CA)
array.push({ isHeader: true, group: 2, text: 'International' })
IntlJurisdictions
.filter(jur => jur.value !== JurisdictionLocation.CA)
.filter(jur => !this.excludeJurisdictions(jur.value).includes(jur.value))
.forEach(jur => array.push({
group: 2,
text: jur.text,
Expand All @@ -67,6 +68,23 @@ export default class Jurisdiction extends Vue {
return array
}
/**
* Always exclude CA
* Exclude USA when states are listed in the jurisdiction list based on showUsJurisdictions flag
*/
excludeJurisdictions (jurisdiction): Array<any> {
const excludedValues = []
if (jurisdiction === JurisdictionLocation.CA) {
excludedValues.push(JurisdictionLocation.CA)
}
if (this.showUsJurisdictions) {
excludedValues.push(JurisdictionLocation.US)
}
return excludedValues
}
@Emit('change')
// eslint-disable-next-line @typescript-eslint/no-unused-vars
emitChangeEvent (jurisdiction: any): void {}
Expand Down

0 comments on commit 9ee2278

Please sign in to comment.