Skip to content

Commit

Permalink
update jotform fields; link fix (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
huang0h authored Dec 17, 2024
1 parent 6fa877d commit f8879cc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,33 @@ async function postNewPendingPractitioner(req: Request, postPendingPractitioner:
}

// List of field names for JotForm submission request objects
// const FIELD_NAMES = {
// PHONE: 'q4_contact_number',
// WEBSITE: 'q26_website',
// MODALITY: 'q24_modality',
// BUSINESS_LOCATION: 'q6_business_location',
// BUSINESS_NAME: 'q32_business_name',
// MIN_AGE_SERVED: 'q30_min_age_served',
// EMAIL: 'q5_email',
// FULL_NAME: 'q3_full_name',
// LANGUAGES: 'q29_languages'
// }

const FIELD_NAMES = {
PHONE: 'q4_contact_number',
WEBSITE: 'q26_website',
MODALITY: 'q24_modality',
BUSINESS_LOCATION: 'q6_business_location',
BUSINESS_NAME: 'q32_business_name',
MIN_AGE_SERVED: 'q30_min_age_served',
PHONE: 'q6_contact_number',
WEBSITE: 'q9_website',
MODALITY: 'q12_modality',
BUSINESS_LOCATION: 'q11_business_location',
BUSINESS_NAME: 'q8_business_name',
MIN_AGE_SERVED: 'q18_min_age_served',
EMAIL: 'q5_email',
FULL_NAME: 'q3_full_name',
LANGUAGES: 'q29_languages'
FULL_NAME: 'q4_full_name',
LANGUAGES: 'q52_languages'
}

function getPractitionerInfo(webhookRequest): Omit<PractitionerInfo, 'uuid'> {
const practitionerInfo: PractitionerInfo = {};
console.info('Webhook request:', webhookRequest);

practitionerInfo.phoneNumber = webhookRequest[FIELD_NAMES.PHONE]['full'];
practitionerInfo.website = webhookRequest[FIELD_NAMES.WEBSITE] || '';
Expand All @@ -34,7 +47,7 @@ function getPractitionerInfo(webhookRequest): Omit<PractitionerInfo, 'uuid'> {
practitionerInfo.minAgeServed = parseInt(webhookRequest[FIELD_NAMES.MIN_AGE_SERVED] || 0);
practitionerInfo.email = webhookRequest[FIELD_NAMES.EMAIL];
practitionerInfo.fullName = `${webhookRequest[FIELD_NAMES.FULL_NAME].first} ${webhookRequest[FIELD_NAMES.FULL_NAME].last}`;
practitionerInfo.languagesList = webhookRequest[FIELD_NAMES.LANGUAGES].split('\r\n')
practitionerInfo.languagesList = ['English'].concat(webhookRequest[FIELD_NAMES.LANGUAGES].split('\r\n'));

const modalities = webhookRequest[FIELD_NAMES.MODALITY].split('\r\n')
practitionerInfo.modality = modalities.join(', ');
Expand Down
8 changes: 7 additions & 1 deletion apps/monarch/monarch-frontend/src/app/SearchTherapists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,13 @@ export const SearchTherapists: React.FC<{
Website
</Box>
<Text>
<Link href={therapist.website} color="blue.600">
{/*
If the given website value doesn't have a protocol (http:// or https://), prefix with //
which tells the browser to open the link as a root address (i.e. not prefixed by the page URL).
This way, if the given URL looks like 'www.site.com`, we open that actual URL instead of as a relative path.
Do this here so we don't display a weird link like '//www.site.com' to the user.
*/}
<Link href={therapist.website.indexOf('//') === -1 ? `//${therapist.website}` : therapist.website} color="blue.600" target="_blank" rel="noopener">
{therapist.website}
</Link>
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import { QueryContext } from '../../SearchTherapists';

const LanguageFilter: React.FC = () => {
const queryContext = useContext(QueryContext);
const availableLanguages = ['English', 'Spanish', 'Polish', 'Portuguese','Korean', 'French', 'ASL', 'Chinese'];

const availableLanguages = ['English', 'Spanish', 'Polish', 'Portuguese', 'Korean', 'French', 'ASL', 'Chinese', 'Haitian Creole', 'Russian', 'Vietnamese'];
return (
<Box mb='6'>
<Heading size='sm' mb='2'>
Expand Down

0 comments on commit f8879cc

Please sign in to comment.