Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20989 - Add USA states to jurisdiction list #253

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/jurisdiction/Jurisdiction.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ const Template = (args, { argTypes }) => ({
})

export const Default = Template.bind({})
Default['args'] = {}
Default['args'] = {
showUsJurisdictions: false
}
20 changes: 16 additions & 4 deletions src/components/jurisdiction/Jurisdiction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { Component, Emit, Prop, Vue } from 'vue-property-decorator'
import NestedSelect from './NestedSelect.vue'
import { JurisdictionLocation } from '@bcrs-shared-components/enums'
import { CanJurisdictions, IntlJurisdictions } from './list-data'
import { CanJurisdictions, IntlJurisdictions, UsaJurisdiction } from './list-data'

@Component({
components: { NestedSelect }
Expand All @@ -22,6 +22,7 @@ export default class Jurisdiction extends Vue {
// props
@Prop({ default: 'Select the home jurisdiction' }) readonly label!: string
@Prop() readonly errorMessages!: string
@Prop({ default: false }) readonly showUsJurisdictions!: boolean

// variables
jurisdiction = null
Expand All @@ -41,15 +42,26 @@ export default class Jurisdiction extends Vue {
separator: (jur.value === JurisdictionLocation.FD)
}))

if (this.showUsJurisdictions) {
array.push({ isHeader: true, group: 1, text: 'United States' })
UsaJurisdiction
.forEach(jur => array.push({
group: 1,
text: jur.text,
value: jur.value,
separator: false
}))
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yui confirmed to about Puerto Rico and VI: "Please use the same as live Name Request. I.e. Puerto Rico and VI are considered International."

// add in International jurisdictions (not including CA)
array.push({ isHeader: true, group: 1, text: 'International' })
array.push({ isHeader: true, group: 2, text: 'International' })
IntlJurisdictions
.filter(jur => jur.value !== JurisdictionLocation.CA)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you find out why you don't need to filter out USA when showUsJurisdictions is True?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No not yet. Just wondering if somehow it is removed in filter or forEach function considering duplicates in the Array. (one added when adding USA jurisdiction and other in International jurisdiction list)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those filter and forEach calls are separate, and working on separate lists. I dunno. Might look at it this afternoon for fun.

.forEach(jur => array.push({
group: 1,
group: 2,
text: jur.text,
value: jur.value,
separator: false
separator: (jur.value === JurisdictionLocation.IN)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to show a separator between for International

}))

return array
Expand Down
2 changes: 1 addition & 1 deletion src/components/jurisdiction/NestedSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default class NestedSelect extends Vue {
// specify maxHeight only if it's set, otherwise the v-menu doesn't show all items
// ("maxHeight: auto" doesn't work either)
if (this.maxHeight) return { bottom: true, offsetY: true, maxHeight: this.maxHeight }
return { bottom: true, offsetY: true }
return { bottom: true, offsetY: true, auto: true }
}

// methods
Expand Down
1 change: 1 addition & 0 deletions src/components/jurisdiction/list-data/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './canada-jurisdictions'
export * from './intl-jurisdictions'
export * from './usa-jurisdictions'
254 changes: 254 additions & 0 deletions src/components/jurisdiction/list-data/usa-jurisdictions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
import { JurisdictionI } from '../interfaces'

export const UsaJurisdiction: JurisdictionI[] = [
{
value: 'AL',
SHORT_DESC: 'AL',
text: 'Alabama'
},
{
value: 'AK',
SHORT_DESC: 'AK',
text: 'Alaska'
},
{
value: 'AZ',
SHORT_DESC: 'AZ',
text: 'Arizona'
},
{
value: 'AR',
SHORT_DESC: 'AR',
text: 'Arkansas'
},
{
value: 'CA',
SHORT_DESC: 'CA',
text: 'California'
},
{
value: 'CO',
SHORT_DESC: 'CO',
text: 'Colorado'
},
{
value: 'CT',
SHORT_DESC: 'CT',
text: 'Connecticut'
},
{
value: 'DE',
SHORT_DESC: 'DE',
text: 'Delaware'
},
{
value: 'FL',
SHORT_DESC: 'FL',
text: 'Florida'
},
{
value: 'GA',
SHORT_DESC: 'GA',
text: 'Georgia'
},
{
value: 'HI',
SHORT_DESC: 'HI',
text: 'Hawaii'
},
{
value: 'ID',
SHORT_DESC: 'ID',
text: 'Idaho'
},
{
value: 'IL',
SHORT_DESC: 'IL',
text: 'Illinois'
},
{
value: 'IN',
SHORT_DESC: 'IN',
text: 'Indiana'
},
{
value: 'IA',
SHORT_DESC: 'IA',
text: 'Iowa'
},
{
value: 'KS',
SHORT_DESC: 'KS',
text: 'Kansas'
},
{
value: 'KY',
SHORT_DESC: 'KY',
text: 'Kentucky'
},
{
value: 'LA',
SHORT_DESC: 'LA',
text: 'Louisiana'
},
{
value: 'ME',
SHORT_DESC: 'ME',
text: 'Maine'
},
{
value: 'MD',
SHORT_DESC: 'MD',
text: 'Maryland'
},
{
value: 'MA',
SHORT_DESC: 'MA',
text: 'Massachusetts'
},
{
value: 'MI',
SHORT_DESC: 'MI',
text: 'Michigan'
},
{
value: 'MN',
SHORT_DESC: 'MN',
text: 'Minnesota'
},
{
value: 'MS',
SHORT_DESC: 'MS',
text: 'Mississippi'
},
{
value: 'MO',
SHORT_DESC: 'MO',
text: 'Missouri'
},
{
value: 'MT',
SHORT_DESC: 'MT',
text: 'Montana'
},
{
value: 'NE',
SHORT_DESC: 'NE',
text: 'Nebraska'
},
{
value: 'NV',
SHORT_DESC: 'NV',
text: 'Nevada'
},
{
value: 'NH',
SHORT_DESC: 'NH',
text: 'New Hampshire'
},
{
value: 'NJ',
SHORT_DESC: 'NJ',
text: 'New Jersey'
},
{
value: 'NM',
SHORT_DESC: 'NM',
text: 'New Mexico'
},
{
value: 'NY',
SHORT_DESC: 'NY',
text: 'New York'
},
{
value: 'NC',
SHORT_DESC: 'NC',
text: 'North Carolina'
},
{
value: 'ND',
SHORT_DESC: 'ND',
text: 'North Dakota'
},
{
value: 'OH',
SHORT_DESC: 'OH',
text: 'Ohio'
},
{
value: 'OK',
SHORT_DESC: 'OK',
text: 'Oklahoma'
},
{
value: 'OR',
SHORT_DESC: 'OR',
text: 'Oregon'
},
{
value: 'PA',
SHORT_DESC: 'PA',
text: 'Pennsylvania'
},
{
value: 'RI',
SHORT_DESC: 'RI',
text: 'Rhode Island'
},
{
value: 'SC',
SHORT_DESC: 'SC',
text: 'South Carolina'
},
{
value: 'SD',
SHORT_DESC: 'SD',
text: 'South Dakota'
},
{
value: 'TN',
SHORT_DESC: 'TN',
text: 'Tennessee'
},
{
value: 'TX',
SHORT_DESC: 'TX',
text: 'Texas'
},
{
value: 'UT',
SHORT_DESC: 'UT',
text: 'Utah'
},
{
value: 'VT',
SHORT_DESC: 'VT',
text: 'Vermont'
},
{
value: 'VA',
SHORT_DESC: 'VA',
text: 'Virginia'
},
{
value: 'WA',
SHORT_DESC: 'WA',
text: 'Washington'
},
{
value: 'WV',
SHORT_DESC: 'WV',
text: 'West Virginia'
},
{
value: 'WI',
SHORT_DESC: 'WI',
text: 'Wisconsin'
},
{
value: 'WY',
SHORT_DESC: 'WY',
text: 'Wyoming'
}
]
Loading