-
Create a new location (JavaScript) file
the-new-location.js
-
Add it to the locations directory
ircc-rescheduler/src/locations/the-new-location.js
-
The location file contain should have the following data / properties
module.exports = {
id: 'the-new-location',
email: 'the-new-location@example.com',
phone: '1-888-111-1111',
receivingEmail:
'the-new-location@example.com',
recurring: {
jan: ['mon', 'tues'],
feb: ['mon', 'tues'],
mar: ['mon', 'tues'],
apr: ['mon', 'tues'],
may: ['mon', 'tues'],
jun: ['mon', 'tues'],
jul: ['mon', 'tues'],
aug: ['mon', 'tues'],
sep: ['mon', 'tues'],
oct: ['mon', 'tues'],
nov: ['mon', 'tues'],
dec: ['mon', 'tues'],
},
}
Note: The the name of the location file should match the id property
module.exports = {
id: 'the-new-location',
The id/name of file the-new-location
will be used as the sub-domain
https://the-new-location.rescheduler-dev.cds-snc.ca
- Whitelist the domain
The locations index page
(/src/locations/index.js) contains a whitelist array of locations
Add the new location to the whitelist
/* ircc-rescheduler/src/locations/index.js */
- export const whitelist = ['vancouver', 'calgary', 'montreal']
+ export const whitelist = ['vancouver', 'calgary', 'montreal', 'the-new-location']
- Review and Deploy your updates.
-
Locate the location file you need to make an update to i.e.
ircc-rescheduler/src/locations/calgary.js
-
Make your edits and save accordingly
Updating the available days for a location
Locate the recurring property in the location file
recurring: {
...
}
Locate the month where you need to make the change
recurring: {
jan: ['tues', 'thurs'],
...
}
Update the available days for the month
- jan: ['tues', 'thurs']
+ jan: ['mon', 'fri']
- Review and Deploy your updates
If you need to block days i.e. holidays you can add a blocked
property to the location file to block access to specific dates.
recurring: {
jan: ['tues', 'wed'],
feb: ['tues', 'wed'],
...
},
blocked: '2018-10-02, 2018-10-03, 2018-11-21', // use CSV format
- Required String
id
: used for the subdomain. Needs to match the location filename - Required String
email
: publicly displayed in the app i.e. on the Cancel Page/cancel
- Required String
phone
: publicly displayed in the app i.e. on the Cancel Page/cancel
- Required String
receivingEmail
: email that will be used to sendstaff
email (publicly displayed) - Required Object
recurring
: Used to determine available days for a location. This property takes a month property and days in the month that will be available.
recurring: {
jan: ['tues', 'wed'],
feb: ['tues', 'wed'],
...
},
Note: recurring
can be empty object if using checkLocationDays
- Optional
blocked
: CSV string containing dates that should be blocked i.e. holidays - Optional
checkLocationDays
function that can be used to handle custom day logic in place of the defaultrecurring
setup
Each location can contain a custom checkLocationDays function. This function can be used in place of the recurring property (days of the week setup).
module.exports = {
email: 'the-new-location@example.com',
phone: '1-888-242-2100',
recurring: {
...
},
checkLocationDays: (location, month, date) => {
// dates pulled in from a resource as an array of dates
// const dates = ['2018-10-17', '2018-11-06', '2018-11-07']
const dateFormatted = format(date, 'YYYY-MM-DD')
// if the date is contained in the date array return true
if (dates[dateFormatted]) {
return { valid: true }
}
// date wasn't found return false
return { valid: false }
},
}