Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
employee-update.js
switch (idType) {
case 'national':
case 'iqama':
case 'visa':
if (isPrimaryId) {
form.append('id_type', idType);
form.append('id_number', idNumber);
form.append('id_issuing_country', idIssuingCountry);
form.append('id_expiration', idExpiration);
if (primaryIdType === 'national') {
fromChange = `ID Type: ${primaryIdType}<br />ID Number: ${
employeeBeforeUpdateProfile.national.idNumber
}<br />Issuing Country: ${
employeeBeforeUpdateProfile.national.issuingCountry
}<br />Expiry Date: ${employeeBeforeUpdateProfile.national.expiryDate}`;
} else if (primaryIdType === 'iqama') {
fromChange = `ID Type: ${primaryIdType}<br />ID Number: ${
employeeBeforeUpdateProfile.iqama.idNumber
}<br />Issuing Country: ${
employeeBeforeUpdateProfile.iqama.issuingCountry
}<br />Expiry Date: ${employeeBeforeUpdateProfile.iqama.expiryDate}`;
} else if (primaryIdType === 'visa') {
fromChange = `ID Type: ${primaryIdType}<br />ID Number: ${
employeeBeforeUpdateProfile.visa.idNumber
}<br />Issuing Country: ${
employeeBeforeUpdateProfile.visa.issuingCountry
}<br />Expiry Date: ${employeeBeforeUpdateProfile.visa.expiryDate}`;
}
toChange = `ID Type: ${idType}<br />ID Number: ${idNumber}<br />Issuing Country: ${idIssuingCountry}<br />Expiry Date: ${idExpiration}`;
updateTypeLabel = 'identification details';
}
break;
case 'passport':
if (isPrimaryId) {
form.append('id_type', idType);
form.append('id_number', idNumber);
form.append('id_issuing_country', idIssuingCountry);
form.append('id_expiration', idExpiration);
form.append('passport_number', idNumber);
form.append('passport_issuing_country', idIssuingCountry);
form.append('passport_expiration', idExpiration);
} else {
form.append('passport_number', idNumber);
form.append('passport_issuing_country', idIssuingCountry);
form.append('passport_expiration', idExpiration);
}
fromChange = `ID Number: ${
employeeBeforeUpdateProfile.passport.idNumber
}<br />Issuing Country: ${
employeeBeforeUpdateProfile.passport.issuingCountry
}<br />Expiry Date: ${employeeBeforeUpdateProfile.passport.expiryDate}`;
toChange = `ID Number: ${idNumber}<br />Issuing Country: ${idIssuingCountry}<br />Expiry Date: ${idExpiration}`;
updateTypeLabel = 'passport details';
break;
default:
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment