Created
October 3, 2018 13:16
-
-
Save arvi/a35c48c39ad63c4e9fcb172b4aea6bff to your computer and use it in GitHub Desktop.
employee-update.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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