var Webflow = Webflow || []; Webflow.push(function() { const DATA_URL = `https://ko2rgptkm7.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/LifeInsQuestionnaireClient/GetById`; //------Anonymous method that returns Identomat session token-------------------- const isSess = false; const IDENT_SESS_URL_TEST = 'https://ko2rgptkm7.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/FaceId/GetIdentomatSession'; const IDENT_SESS_URL_PROD = 'https://kqfpyidq8j.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/FaceId/GetIdentomatSession'; const IDENT_SESS_URL = isSess ? IDENT_SESS_URL_PROD : IDENT_SESS_URL_TEST; //--------------------------IdentResult------------------------------------------------------------------------------ const isResult = false; const IDENT_RESULT_URL_TEST = 'https://ko2rgptkm7.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/FaceId/CheckLifeInsIdentomatResult'; const IDENT_RESULT_URL_PROD = 'https://kqfpyidq8j.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/FaceId/CheckLifeInsIdentomatResult'; const IDENT_RESULT_URL = isResult ? IDENT_RESULT_URL_PROD : IDENT_RESULT_URL_TEST; //--------------------------CloseWithRejection------------------------------------------------------------------------------ const isCloseWithRejection = false; const CLOSE_WITH_REJECTION_URL_TEST = 'https://ko2rgptkm7.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/LifeInsQuestionnaireClient/ConfirmToCloseWithRejection'; const CLOSE_WITH_REJECTION_URL_PROD = 'https://kqfpyidq8j.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/LifeInsQuestionnaireClient/ConfirmToCloseWithRejection'; const CLOSE_WITH_REJECTION_URL = isCloseWithRejection ? CLOSE_WITH_REJECTION_URL_PROD : CLOSE_WITH_REJECTION_URL_TEST; //--------------------------RequestChange------------------------------------------------------------------------------ const isRequestChange = false; const REQUEST_CHANGE_URL_TEST = 'https://ko2rgptkm7.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/LifeInsQuestionnaireClient/RequestChange'; const REQUEST_CHANGE_URL_PROD = 'https://kqfpyidq8j.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/LifeInsQuestionnaireClient/RequestChange'; const REQUEST_CHANGE_URL = isRequestChange ? REQUEST_CHANGE_URL_PROD : REQUEST_CHANGE_URL_TEST; //--------------------------Confirm------------------------------------------------------------------------------ const isConfirm = false; const CONFIRM_URL_TEST = 'https://ko2rgptkm7.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/LifeInsQuestionnaireClient/Confirm'; const CONFIRM_URL_PROD = 'https://kqfpyidq8j.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/LifeInsQuestionnaireClient/Confirm'; const CONFIRM_URL = isConfirm ? CONFIRM_URL_PROD : CONFIRM_URL_TEST; //--------------------------FileTempUrl------------------------------------------------------------------------------ const isFileTempUrl = false; const FILE_TEMP_URL_TEST = 'https://ko2rgptkm7.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/LifeInsQuestionnaireClient/GetFileTempUrl'; const FILE_TEMP_URL_PROD = 'https://kqfpyidq8j.execute-api.eu-west-1.amazonaws.com/prod/myprofileportal/api/LifeInsQuestionnaireClient/GetFileTempUrl'; const FILE_TEMP_URL = isFileTempUrl ? FILE_TEMP_URL_PROD : FILE_TEMP_URL_TEST; $(".s-header-first-answer").css("display", "none"); $(".s-header-second-answer").css("display", "none"); $(".s-header-second-option").css("display", "none"); $(".popup_iframe").css("display", "none"); //--------Anonymous method that returns Identomat session token------------------ $('[identomatSession]').on('click', async (e) => { try { //------Anonymous method that returns Identomat session token-------------------- const respIdentomatSession = await fetch(IDENT_SESS_URL, { method: 'GET', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, }); const repsIdentomatSessionData = await respIdentomatSession.json(); console.log('>> ', repsIdentomatSessionData); $(".popup_iframe").css("display", "flex"); $("iframe").attr('src', `https://widget.identomat.com/?session_token=${repsIdentomatSessionData.token}`); console.log('Open iframe'); window.addEventListener('message', (e) => { receiveMessage(e); }); let finishedProcess = false; async function receiveMessage(event){ console.log(event); if ( finishedProcess || event.origin !== 'https://widget.identomat.com' || event.data !== 'DONE') { return; } finishedProcess = true; //--------------------------IdentResult------------------------------------------------------------------------------ const respIdentResult = await fetch(IDENT_RESULT_URL, { method: 'POST', headers: { // 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({sessionToken: repsIdentomatSessionData.token}), }); const respIdentResultData = await respIdentResult.json(); console.log('>> ', respIdentResultData); let userId = respIdentResultData.id[0]; let tokenNumber = respIdentResultData.token.tokenValue; // -------------------------LoadData----------------------------------------------------------------------------------------------- await loadData(userId, tokenNumber); $(".popup_iframe").css("display", "none"); $("iframe").attr('src', ``); } } catch (e) { $(".s-pre-loading").css("display", "none"); $(".s-error-not-found").css("display", "flex"); $("body").css("overflow", "hidden"); // console.error(e); } // -------------------------LoadData----------------------------------------------------------------------------------------------- async function loadData(userId, tokenNumber) { const resp = await fetch(DATA_URL + '?' + 'id=' + userId, { method: 'GET', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + tokenNumber }, }); const fullData = await resp.json(); console.log('DATA: ', fullData); if (fullData.data.statusId == 7) { $(window).scrollTop(0); $('#btn-lang').hide(); $('#btn-lang-eng').hide(); $('.s-header-first-option').hide(); $('.s-header-first-answer').show(); $('.s-header-second-answer').hide(); $('.s-header-second-option').hide(); } else if (fullData.data.statusId == 4) { $(window).scrollTop(0); processData(fullData.data); translateWords (); $('#btn-lang').hide(); $('#btn-lang-eng').hide(); $('.s-header-second-option').hide(); $('.s-header-first-option').hide(); $('.s-header-first-answer').hide(); $('.s-header-second-answer').show(); } else if (fullData.data.statusId !== 4 || fullData.data.statusId !== 7) { $(window).scrollTop(0); $('#btn-lang').hide(); $('#btn-lang-eng').hide(); $('.s-header-first-option').hide(); $('.s-header-first-answer').hide(); $('.s-header-second-answer').hide(); $('.s-header-second-option').show(); } //--------------------------RequestChange------------------------------------------------------------------------------ $('[requestChange]').on('click', async (e) => { // const userComment = $(this).attr('textUserComment'); const userComment = $('.block__textarea').val(); console.log(userComment); const respRequestChange = await fetch(REQUEST_CHANGE_URL, { method: 'POST', headers: { // 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + tokenNumber }, body: JSON.stringify({id: userId, comment: userComment}), }); const respRequestChangeData = await respRequestChange.json(); console.log('>> ', respRequestChangeData); // console.log('clickrequestChange'); if (respRequestChangeData.status == 0) { setTimeout(() => { // console.log('setTimeout'); $(".c-popups-success3b").css("display", "none"); $(".c-popups-success3b").css("opacity", "0"); $("body").css("overflow", "visible"); }, 5000); $(".c-popups-success3b").css("display", "flex"); $(".c-popups-success3b").css("opacity", "1"); $(".c-popups-holder3b2").hide(); $(".c-popups-holder3b").hide(); $("body").css("overflow", "hidden"); // console.error(e); } else { setTimeout(() => { // console.log('setTimeout'); $(".c-popups-err3a").css("display", "none"); $(".c-popups-err3a").css("opacity", "0"); $("body").css("overflow", "visible"); }, 5000); $(".c-popups-err3a").css("display", "flex"); $(".c-popups-err3a").css("opacity", "1"); $(".c-popups-holder3b2").hide(); $(".c-popups-holder3b").hide(); $("body").css("overflow", "hidden"); } }); //--------------------------Confirm------------------------------------------------------------------------------ $('[confirm]').on('click', async (e) => { const respConfirm = await fetch(CONFIRM_URL, { method: 'POST', headers: { // 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + tokenNumber }, body: JSON.stringify({id: userId}), }); const respConfirmData = await respConfirm.json(); console.log('>> ', respConfirmData); // console.log('clickConfirm'); if (respConfirmData.status == 0) { setTimeout(() => { // console.log('setTimeout'); $(".c-popups-success3a").css("display", "none"); $(".c-popups-success3a").css("opacity", "0"); $("body").css("overflow", "visible"); }, 5000); $(".c-popups-success3a").css("display", "flex"); $(".c-popups-success3a").css("opacity", "1"); $("body").css("overflow", "hidden"); } else { console.log('error'); setTimeout(() => { // console.log('setTimeout'); $(".c-popups-err3a").css("display", "none"); $(".c-popups-err3a").css("opacity", "0"); $("body").css("overflow", "visible"); }, 5000); $(".c-popups-err3a").css("display", "flex"); $(".c-popups-err3a").css("opacity", "1"); $(".c-popups-holder3a").hide(); $("body").css("overflow", "hidden"); // console.error(e); } }); //--------------------------CloseWithRejection------------------------------------------------------------------------------ $('[closeWithRejection]').on('click', async (e) => { const respCloseWithRejection = await fetch(CLOSE_WITH_REJECTION_URL, { method: 'POST', headers: { // 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + tokenNumber }, body: JSON.stringify({id: userId}), }); const respCloseWithRejectionData = await respCloseWithRejection.json(); console.log('>> ', respCloseWithRejectionData); // console.log('clickCloseWithRejection'); if (respCloseWithRejectionData.status == 0) { setTimeout(() => { // console.log('setTimeout'); $(".c-popups-success3a").css("display", "none"); $(".c-popups-success3a").css("opacity", "0"); $("body").css("overflow", "visible"); // window.open(`https://on.tbcinsurance.ge`, '_blank' ); $(location).attr( "href", `https://on.tbcinsurance.ge`); }, 5000); $(".c-popups-success3a").css("display", "flex"); $(".c-popups-success3a").css("opacity", "1"); $("body").css("overflow", "hidden"); } else { setTimeout(() => { // console.log('setTimeout'); $(".c-popups-err3a").css("display", "none"); $(".c-popups-err3a").css("opacity", "0"); $("body").css("overflow", "visible"); }, 5000); $(".c-popups-err3a").css("display", "flex"); $(".c-popups-err3a").css("opacity", "1"); $("body").css("overflow", "hidden"); } }); // -------------------------downloadFileURI()------------------------------------------------------------------------ function downloadURI(uri, name) { var link = document.createElement("a"); // If you don't know the name or want to use // the webserver default set name = '' link.setAttribute('download', name); link.href = uri; document.body.appendChild(link); link.click(); link.remove(); } //--------------------------FileTempUrl------------------------------------------------------------------------------ $('[fileName]').on('click', async function(e) { const fileId = $(this).attr('dataFileId'); console.log(fileId); const fileName = $(this).text(); console.log(fileName); const newUrl = FILE_TEMP_URL+ '?' + 'id=' + userId + '&' + 'fileStoreId=' + fileId; console.log(newUrl); const respFileTempUrl = await fetch(newUrl, { method: 'GET', headers: { // 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + tokenNumber }, }); const resprespFileTempUrlData = await respFileTempUrl.json(); console.log('>> ', resprespFileTempUrlData); downloadURI(resprespFileTempUrlData.url, fileName); }); } }); // -------------------------translateWords()-------------------------------------------------------------------------------------------------------------- function translateWords () { if (window.location.href.indexOf("eng") > -1) { $('.item__title').filter(function () { return $(this).text() == 'არა'; }).text('No'); $('.item__title').filter(function () { return $(this).text() == 'კი'; }).text('Yes'); } } // -------------------------processData(data)-------------------------------------------------------------------------------------------------------------- function processData(data) { $('[firstName]').text(data['firstName']); $('[lastName]').text(data['lastName']); $('[personalId]').text(data['personalId']); $('[birthDate]').text(data['birthDate']); $('[gender]').text(data['gender']); $('[maritalStatus]').text(data['maritalStatus']); $('[phoneNumber]').text(data['phoneNumber']); $('[email]').text(data['email']); $('[citizenshipCountry]').text(data['citizenshipCountry']); $('[actualAddress]').text(data['actualAddress']); $('[country]').text(data['country']); $('[city]').text(data['city']); $('[wasInsured]').text(data['wasInsured']); if (data['wasInsured'] !== 'კი') { // console.log('block_medical-paragraph1a-hide'); $('#block-was-insured').hide(); } else { // console.log('block_medical-paragraph1a-show'); $('#block-was-insured').show(); } $('[insuranceType]').text(data['insuranceType']); $('[insuranceLimit]').text(data['insuranceLimit']); $('[terms]').text(data['terms']); const loans = data['loans']; loans.forEach(loan => { const $template = $('.list__loans [template]'); const $clone = $template.clone(); $clone.removeAttr('template'); $clone.find('[loanId]').text(loan.id); $clone.find('[loanAmount]').text(loan.loanAmount); $clone.find('[loanAmount]').text(loan.loanAmount); $clone.find('[loanCurrency]').text(loan.loanCurrency); $clone.find('[loanDisburseDate]').text(loan.loanDisburseDate); $clone.find('[loanPeriod]').text(loan.loanPeriod); $('.list__loans').append($clone); }); $('.list__loans [template]').remove(); const employments = data['employments']; employments.forEach(employment => { const $template = $('.list__employments [template]'); const $clone = $template.clone(); $clone.removeAttr('template'); $clone.find('[employmentId]').text(employment.id); $clone.find('[company]').text(employment.company); $clone.find('[workingAddress]').text(employment.workingAddress); $clone.find('[employmentsCity]').text(employment.city); $clone.find('[employmentsCountry]').text(employment.country); $clone.find('[hireDate]').text(employment.hireDate); $clone.find('[position]').text(employment.position); $clone.find('[annualSalary]').text(employment.annualSalary); $clone.find('[currency]').text(employment.currency); $clone.find('[workingHours]').text(employment.workingHours); $clone.find('[jobDescription]').text(employment.jobDescription); $('.list__employments').append($clone); }); $('.list__employments [template]').remove(); const aviation = data['aviation']; if (aviation['aviationPurpose'] == null) { console.log('block_aviation-hide'); $('.block_aviation').hide(); } else { $('.block_aviation').show(); console.log('block_aviation-show'); } $('[aviationPurpose]').text(aviation['aviationPurpose']); $('[aviationLicence]').text(aviation['aviationLicence']); $('[aircraftType]').text(aviation['aircraftType']); $('[aircraftWeight]').text(aviation['aircraftWeight']); $('[avarageFlownHours]').text(aviation['avarageFlownHours']); $('[plannedFlyingHours]').text(aviation['plannedFlyingHours']); $('[aloneFlownHours]').text(aviation['aloneFlownHours']); $('[aviaParticipation]').text(aviation['aviaParticipation']); $('[flightFrequencyAndDestination]').text(aviation['flightFrequencyAndDestination']); const marine = data['marine']; if (marine['marineActivity'] == 'არა') { console.log('block_marine-hide'); $('.block_marine').hide(); } else { console.log('block_marine-show'); $('.block_marine').show(); } $('[marineActivity]').text(marine['marineActivity']); $('[otherVesselType]').text(marine['otherVesselType']); $('[vesselTypesAll]').text(marine['vesselTypesAll']); $('[manualDutiesPercentage]').text(marine['manualDutiesPercentage']); $('[hadAccidentOrIllness]').text(marine['hadAccidentOrIllness']); const winter = data['winter']; if (winter['sportKind'] == null) { console.log('block_winter-hide'); $('.block_winter').hide(); } else { console.log('block_winter-show'); $('.block_winter').show(); } $('[sportKind]').text(winter['sportKind']); $('[sportActivityFrequency]').text(winter['sportActivityFrequency']); $('[sportActivityPlace]').text(winter['sportActivityPlace']); $('[competitionParticipation]').text(winter['competitionParticipation']); $('[hadWonPrize]').text(winter['hadWonPrize']); $('[sportIncomePercentage]').text(winter['sportIncomePercentage']); $('[hadAccident]').text(winter['hadAccident']); $('[accidentComment]').text(winter['accidentComment']); $('[flightFrequencyAndDestination]').text(winter['flightFrequencyAndDestination']); const files = data.winter['files']; if (data.winter['files'] == null || data.winter['files'] == 0) { console.log('list__files-hide'); $('.list__files').hide(); } else { console.log('.list__files-show'); $('.list__files').show(); files.forEach(file => { const $template = $('.list__files [template]'); const $clone = $template.clone(); $clone.removeAttr('template'); $clone.find('[fileName]').text(file.fileName); $clone.find('[fileName]').attr('dataFileId', file.fileStoreId); $('.list__files').append($clone); }); $('.list__files [template]').remove(); } // files.forEach(file => { // const $template = $('.list__files [template]'); // const $clone = $template.clone(); // $clone.removeAttr('template'); // $clone.find('[fileName]').text(file.fileName); // $clone.find('[fileName]').attr('dataFileId', file.fileStoreId); // $('.list__files').append($clone); // }); // $('.list__files [template]').remove(); // const signedDocuments = data['signedDocuments']; // signedDocuments.forEach(signedDocument => { // const $template = $('.list__signed-documents [template]'); // const $clone = $template.clone(); // $clone.removeAttr('template'); // $clone.find('[fileName]').text(signedDocument.fileName); // $clone.find('[fileName]').attr('dataFileId', signedDocument.fileStoreId); // $('.list__signed-documents').append($clone); // }); // $('.list__signed-documents [template]').remove(); const travels = data['travels']; travels.forEach(travel => { const $template = $('.list__travels [template]'); const $clone = $template.clone(); $clone.removeAttr('template'); $clone.find('[travelsId]').text(travel.id); $clone.find('[travelsDestination]').text(travel.destination); $clone.find('[frequency]').text(travel.frequency); $clone.find('[duration]').text(travel.duration); $clone.find('[travelPurpose]').text(travel.travelPurpose); $('.list__travels').append($clone); }); $('.list__travels [template]').remove(); const residence = data['residence']; if (residence['currentResidencyDetails'] == null) { // console.log('block_residence-hide'); $('.block_residence').hide(); } else { // console.log('block_residence-show'); $('.block_residence').show(); } $('[currentResidencyDetails]').text(residence['currentResidencyDetails']); $('[activityDescription]').text(residence['activityDescription']); $('[visitLargeCities]').text(residence['visitLargeCities']); $('[accommodationDetails]').text(residence['accommodationDetails']); $('[medicalDetails]').text(residence['medicalDetails']); $('[additionalInformation]').text(residence['additionalInformation']); const previousResidences = data.residence.previousResidences; previousResidences.forEach(previousResidence => { const $template = $('.list__previous-residences [template]'); const $clone = $template.clone(); $clone.removeAttr('template'); $clone.find('[previousResidencesId]').text(previousResidence.id); $clone.find('[stayDates]').text(previousResidence.stayDates); $clone.find('[countryAndRegion]').text(previousResidence.countryAndRegion); $clone.find('[visitReason]').text(previousResidence.visitReason); $clone.find('[visitFrequency]').text(previousResidence.visitFrequency); $clone.find('[visitDuration]').text(previousResidence.visitDuration); $('.list__previous-residences').append($clone); }); $('.list__previous-residences [template]').remove(); const futureResidences = data.residence.futureResidences; futureResidences.forEach(futureResidence => { const $template = $('.list__future-residences [template]'); const $clone = $template.clone(); $clone.removeAttr('template'); $clone.find('[futureResidenceId]').text(futureResidence.id); $clone.find('[futureResidencedatesOfStay]').text(futureResidence.stayDates); $clone.find('[futureResidencecountryAndRegion]').text(futureResidence.countryAndRegion); $clone.find('[futureResidencevisititReason]').text(futureResidence.visitReason); $clone.find('[futureResidencevisititFrequency]').text(futureResidence.visitFrequency); $clone.find('[futureResidencevisititDuration]').text(futureResidence.visitDuration); $('.list__future-residences').append($clone); }); $('.list__future-residences [template]').remove(); const medical = data['medical']; if (medical['weight'] == null) { // console.log('block_medical-hide'); $('.block_medical').hide(); } else { // console.log('block_medical-show'); $('.block_medical').show(); } $('[weight]').text(medical['weight']); $('[medicalHeight]').text(medical['height']); if (medical['wasTreated'] == 'არა') { // console.log('block_medical-paragraph1-hide'); $('#block_medical-paragraph1').hide(); } else if (medical['wasTreated'] == 'კი') { $('#none1').hide(); // console.log('block_medical-paragraph1-show'); $('#block_medical-paragraph1').show(); } $('[wasTreated]').text(medical['wasTreated']); $('[diagnostics]').text(medical['diagnostics']); $('[treatment]').text(medical['treatment']); $('[treatmentDate]').text(medical['treatmentDate']); $('[treatmentDetails]').text(medical['treatmentDetails']); if (medical['hasNervousSystemProblems'] == 'არა') { // console.log('block_medical-paragraph1a-hide'); $('#block_medical-paragraph1a').hide(); } else if (medical['wasTreated'] == 'კი') { $('#none1a').hide(); // console.log('block_medical-paragraph1a-show'); $('#block_medical-paragraph1a').show(); } $('[nervousSystemDiagnostics]').text(medical['nervousSystemDiagnostics']); $('[nervousSystemTreatment]').text(medical['nervousSystemTreatment']); $('[nervousSystemTreatmentDate]').text(medical['nervousSystemTreatmentDate']); $('[nervousSystemTreatmentDetails]').text(medical['nervousSystemTreatmentDetails']); $('[hasNervousSystemProblems]').text(medical['hasNervousSystemProblems']); if (medical['hasNervousSystemProblems'] == 'არა') { // console.log('block_medical-paragraph1b-hide'); $('#block_medical-paragraph1b').hide(); } else if (medical['wasTreated'] == 'კი') { $('#none1b').hide(); // console.log('block_medical-paragraph1b-show'); $('#block_medical-paragraph1b').show(); } $('[hasMentalRetardation]').text(medical['hasMentalRetardation']); $('[mentalRetardationDiagnostics]').text(medical['mentalRetardationDiagnostics']); $('[mentalRetardationTreatment]').text(medical['mentalRetardationTreatment']); $('[mentalRetardationTreatmentDate]').text(medical['mentalRetardationTreatmentDate']); $('[mentalRetardationTreatmentDetails]').text(medical['mentalRetardationTreatmentDetails']); if (medical['hasHighPressure'] == 'არა') { // console.log('block_medical-paragraph1c-hide'); $('#block_medical-paragraph1c').hide(); } else if (medical['hasHighPressure'] == 'კი') { // console.log('block_medical-paragraph1c-show'); $('#none1c').hide(); $('#block_medical-paragraph1c').show(); } $('[hasHighPressure]').text(medical['hasHighPressure']); $('[pressureInfo]').text(medical['pressureInfo']); $('[pressureDate]').text(medical['pressureDate']); $('[pressureDiagnostics]').text(medical['pressureDiagnostics']); $('[pressureTreatment]').text(medical['pressureTreatment']); $('[pressureTreatmentDate]').text(medical['pressureTreatmentDate']); $('[pressureTreatmentDetails]').text(medical['pressureTreatmentDetails']); if (medical['hasAllergy'] == 'არა') { // console.log('block_medical-paragraph1d-hide'); $('#block_medical-paragraph1d').hide(); } else if (medical['hasAllergy'] == 'კი') { // console.log('block_medical-paragraph1d-show'); $('#none1d').hide(); $('#block_medical-paragraph1d').show(); } $('[hasAllergy]').text(medical['hasAllergy']); $('[allergyDiagnostics]').text(medical['allergyDiagnostics']); $('[allergyTreatment]').text(medical['allergyTreatment']); $('[allergyTreatmentDate]').text(medical['allergyTreatmentDate']); $('[allergyTreatmentDetails]').text(medical['allergyTreatmentDetails']); if (medical['hasDigestiveDisorder'] == 'არა') { // console.log('block_medical-paragraph1e-hide'); $('#block_medical-paragraph1e').hide(); } else if (medical['hasDigestiveDisorder'] == 'კი') { // console.log('block_medical-paragraph1e-show'); $('#none1e').hide(); $('#block_medical-paragraph1e').show(); } $('[hasDigestiveDisorder]').text(medical['hasDigestiveDisorder']); $('[digestiveDiagnostics]').text(medical['digestiveDiagnostics']); $('[digestiveTreatment]').text(medical['digestiveTreatment']); $('[digestiveTreatmentDate]').text(medical['digestiveTreatmentDate']); $('[digestiveTreatmentDetails]').text(medical['digestiveTreatmentDetails']); if (medical['hasCancer'] == 'არა') { // console.log('block_medical-paragraph1f-hide'); $('#block_medical-paragraph1f').hide(); } else if (medical['hasCancer'] == 'კი') { // console.log('block_medical-paragraph1f-show'); $('#none1f').hide(); $('#block_medical-paragraph1f').show(); } $('[hasCancer]').text(medical['hasCancer']); $('[cancerDiagnostics]').text(medical['cancerDiagnostics']); $('[cancerTreatment]').text(medical['cancerTreatment']); $('[cancerTreatmentDate]').text(medical['cancerTreatmentDate']); $('[cancerTreatmentDetails]').text(medical['cancerTreatmentDetails']); if (medical['hasUrinaryDisorder'] == 'არა') { // console.log('block_medical-paragraph1g-hide'); $('#block_medical-paragraph1g').hide(); } else if (medical['hasUrinaryDisorder'] == 'კი') { // console.log('block_medical-paragraph1g-show'); $('#none1g').hide(); $('#block_medical-paragraph1g').show(); } $('[hasUrinaryDisorder]').text(medical['hasUrinaryDisorder']); $('[urinaryDiagnostics]').text(medical['urinaryDiagnostics']); $('[urinaryTreatment]').text(medical['urinaryTreatment']); $('[urinaryTreatmentDate]').text(medical['urinaryTreatmentDate']); $('[urinaryTreatmentDetails]').text(medical['urinaryTreatmentDetails']); if (medical['hasGenitalDisorder'] == 'არა') { // console.log('block_medical-paragraph1h-hide'); $('#block_medical-paragraph1h').hide(); } else if (medical['hasGenitalDisorder'] == 'კი') { // console.log('block_medical-paragraph1h-show'); $('#none1h').hide(); $('#block_medical-paragraph1h').show(); } $('[hasGenitalDisorder]').text(medical['hasGenitalDisorder']); $('[genitalDiagnostics]').text(medical['genitalDiagnostics']); $('[genitalTreatment]').text(medical['genitalTreatment']); $('[genitalTreatmentDate]').text(medical['genitalTreatmentDate']); $('[genitalTreatmentDetails]').text(medical['genitalTreatmentDetails']); if (medical['hasInfertility'] == 'არა') { // console.log('block_medical-paragraph1i-hide'); $('#block_medical-paragraph1i').hide(); } else if (medical['hasInfertility'] == 'კი') { // console.log('block_medical-paragraph1i-show'); $('#none1i').hide(); $('#block_medical-paragraph1i').show(); } $('[hasInfertility]').text(medical['hasInfertility']); $('[infertilityDiagnostics]').text(medical['infertilityDiagnostics']); $('[infertilityTreatment]').text(medical['infertilityTreatment']); $('[infertilityTreatmentDate]').text(medical['infertilityTreatmentDate']); $('[infertilityTreatmentDetails]').text(medical['infertilityTreatmentDetails']); if (medical['hasBonesDisease'] == 'არა') { // console.log('block_medical-paragraph1j-hide'); $('#block_medical-paragraph1j').hide(); } else if (medical['hasBonesDisease'] == 'კი') { // console.log('block_medical-paragraph1j-show'); $('#none1j').hide(); $('#block_medical-paragraph1j').show(); } $('[hasBonesDisease]').text(medical['hasBonesDisease']); $('[bonesDiagnostics]').text(medical['bonesDiagnostics']); $('[bonesTreatment]').text(medical['bonesTreatment']); $('[bonesTreatmentDate]').text(medical['bonesTreatmentDate']); $('[bonesTreatmentDetails]').text(medical['bonesTreatmentDetails']); if (medical['hasDiabetes'] == 'არა') { // console.log('block_medical-paragraph1k-hide'); $('#block_medical-paragraph1k').hide(); } else if (medical['hasDiabetes'] == 'კი') { // console.log('block_medical-paragraph1k-show'); $('#none1k').hide(); $('#block_medical-paragraph1k').show(); } $('[hasDiabetes]').text(medical['hasDiabetes']); $('[diabetesType]').text(medical['diabetesType']); $('[bloodSugarCheckDate]').text(medical['bloodSugarCheckDate']); $('[diabetesDiagnostics]').text(medical['diabetesDiagnostics']); $('[diabetesTreatment]').text(medical['diabetesTreatment']); $('[diabetesTreatmentDate]').text(medical['diabetesTreatmentDate']); $('[diabetesTreatmentDetails]').text(medical['diabetesTreatmentDetails']); // $('[diabetesType]').text(medical['diabetesType']); // $('[bloodSugarCheckDate]').text(medical['bloodSugarCheckDate']); // $('[diabetesDiagnostics]').text(medical['diabetesDiagnostics']); // $('[diabetesTreatment]').text(medical['diabetesTreatment']); // $('[diabetesTreatmentDate]').text(medical['diabetesTreatmentDate']); // $('[diabetesTreatmentDetails]').text(medical['diabetesTreatmentDetails']); if (medical['hasEarNoseOrThroatDisorder'] == 'არა') { // console.log('block_medical-paragraph1l-hide'); $('#block_medical-paragraph1l').hide(); } else if (medical['hasEarNoseOrThroatDisorder'] == 'კი') { // console.log('block_medical-paragraph1l-show'); $('#none1l').hide(); $('#block_medical-paragraph1l').show(); } $('[hasEarNoseOrThroatDisorder]').text(medical['hasEarNoseOrThroatDisorder']); $('[earNoseOrThroatDiagnostics]').text(medical['earNoseOrThroatDiagnostics']); $('[earNoseOrThroatTreatment]').text(medical['earNoseOrThroatTreatment']); $('[earNoseOrThroatTreatmentDate]').text(medical['earNoseOrThroatTreatmentDate']); $('[earNoseOrThroatTreatmentDetails]').text(medical['earNoseOrThroatTreatmentDetails']); if (medical['isAddicted'] == 'არა') { // console.log('block_medical-paragraph1m-hide'); $('#block_medical-paragraph1m').hide(); } else if (medical['isAddicted'] == 'კი') { // console.log('block_medical-paragraph1m-show'); $('#none1m').hide(); $('#block_medical-paragraph1m').show(); } $('[isAddicted]').text(medical['isAddicted']); $('[addictionDiagnostics]').text(medical['addictionDiagnostics']); $('[addictionTreatment]').text(medical['addictionTreatment']); $('[addictionTreatmentDate]').text(medical['addictionTreatmentDate']); $('[addictionTreatmentDetails]').text(medical['addictionTreatmentDetails']); if (medical['hasAIDS'] == 'არა') { // console.log('block_medical-paragraph1n-hide'); $('#block_medical-paragraph1n').hide(); } else if (medical['hasAIDS'] == 'კი') { // console.log('block_medical-paragraph1n-show'); $('#none1n').hide(); $('#block_medical-paragraph1n').show(); } $('[hasAIDS]').text(medical['hasAIDS']); $('[aidsDiagnostics]').text(medical['aidsDiagnostics']); $('[aidsTreatment]').text(medical['aidsTreatment']); $('[aidsTreatmentDate]').text(medical['aidsTreatmentDate']); $('[aidsTreatmentDetails]').text(medical['aidsTreatmentDetails']); if (medical['hasSurgicalRecommendation'] == 'არა') { // console.log('block_medical-paragraph2-hide'); $('#block_medical-paragraph2').hide(); } else if (medical['hasSurgicalRecommendation'] == 'კი') { // console.log('block_medical-paragraph2-show'); $('#none2').hide(); $('#block_medical-paragraph2').show(); } $('[hasSurgicalRecommendation]').text(medical['hasSurgicalRecommendation']); $('[surgicalDiagnostics]').text(medical['surgicalDiagnostics']); $('[surgicalTreatment]').text(medical['surgicalTreatment']); $('[surgicalTreatmentDate]').text(medical['surgicalTreatmentDate']); $('[surgicalTreatmentDetails]').text(medical['surgicalTreatmentDetails']); if (medical['isCurrentlyPregnant'] == 'არა') { //console.log('block_medical-paragraph3-3a-3b-hide'); $('#none3').show(); $('#block_medical-paragraph3-3a-3b').hide(); $('#block_medical-paragraph3-3a-3b4').hide(); } else if (medical['isCurrentlyPregnant'] == 'კი' && medical['pregnancyComplications'] == 'არა' && medical['infertilityTreatmentResult'] == 'არა') { // console.log('block_medical-paragraph2-show'); $('#none3').hide(); $('#block_medical-paragraph3-3a-3b4').hide(); $('#block_medical-paragraph3-3a-3b').show(); } else if (medical['isCurrentlyPregnant'] == 'კი' && medical['pregnancyComplications'] == 'არა' && medical['infertilityTreatmentResult'] == 'კი') { // console.log('block_medical-paragraph2-show'); $('#none3').hide(); $('#block_medical-paragraph3-3a-3b').hide(); $('#block_medical-paragraph3-3a-3b4').show(); } else if (medical['isCurrentlyPregnant'] == 'კი' && medical['pregnancyComplications'] == 'კი' && medical['infertilityTreatmentResult'] == 'არა') { // console.log('block_medical-paragraph2-show'); $('#none3').hide(); $('#block_medical-paragraph3-3a-3b').show(); $('#block_medical-paragraph3-3a-3b4').hide(); } else if (medical['isCurrentlyPregnant'] == 'კი' && medical['pregnancyComplications'] == 'კი' && medical['infertilityTreatmentResult'] == 'კი') { // console.log('block_medical-paragraph2-show'); $('#none3').hide(); $('#block_medical-paragraph3-3a-3b').hide(); $('#block_medical-paragraph3-3a-3b4').show(); } $('[isCurrentlyPregnant]').text(medical['isCurrentlyPregnant']); $('[pregnancyComplications]').text(medical['pregnancyComplications']); $('[infertilityTreatmentResult]').text(medical['infertilityTreatmentResult']); $('[pregnancyDiagnostics]').text(medical['pregnancyDiagnostics']); $('[pregnancyTreatment]').text(medical['pregnancyTreatment']); $('[pregnancyTreatmentDate]').text(medical['pregnancyTreatmentDate']); $('[pregnancyTreatmentDetails]').text(medical['pregnancyTreatmentDetails']); if (medical['hasGainedOrLostWeight'] == 'არა') { // console.log('block_medical-paragraph4-hide'); $('#block_medical-paragraph4').hide(); } else if (medical['hasGainedOrLostWeight'] == 'კი') { // console.log('block_medical-paragraph4-show'); $('#none4').hide(); $('#block_medical-paragraph4').show(); } $('[hasGainedOrLostWeight]').text(medical['hasGainedOrLostWeight']); $('[weightDiagnostics]').text(medical['weightDiagnostics']); $('[weightTreatment]').text(medical['weightTreatment']); $('[weightTreatmentDate]').text(medical['weightTreatmentDate']); $('[weightTreatmentDetails]').text(medical['weightTreatmentDetails']); $('[wasDeclined]').text(medical['wasDeclined']); if (medical['wasHospitalized'] == 'არა') { // console.log('block_medical-paragraph6-hide'); $('#block_medical-paragraph6').hide(); } else if (medical['wasHospitalized'] == 'კი') { // console.log('block_medical-paragraph6-show'); $('#none6').hide(); $('#block_medical-paragraph6').show(); } $('[wasHospitalized]').text(medical['wasHospitalized']); $('[hospitalizationDiagnostics]').text(medical['hospitalizationDiagnostics']); $('[hospitalizationTreatment]').text(medical['hospitalizationTreatment']); $('[hospitalizationTreatmentDate]').text(medical['hospitalizationTreatmentDate']); $('[hospitalizationTreatmentDetails]').text(medical['hospitalizationTreatmentDetails']); if (medical['wasConsulted'] == 'არა') { // console.log('block_medical-paragraph7-hide'); $('#block_medical-paragraph7').hide(); } else if (medical['wasConsulted'] == 'კი') { // console.log('block_medical-paragraph7-show'); $('#none7').hide(); $('#block_medical-paragraph7').show(); } $('[wasConsulted]').text(medical['wasConsulted']); $('[consultationDiagnostics]').text(medical['consultationDiagnostics']); $('[consultationTreatment]').text(medical['consultationTreatment']); $('[consultationTreatmentDate]').text(medical['consultationTreatmentDate']); $('[consultationTreatmentDetails]').text(medical['consultationTreatmentDetails']); $('[hasHazardousProfession]').text(medical['hasHazardousProfession']); if (medical['hasDisabilityPension'] == 'არა') { // console.log('block_medical-paragraph9-hide'); $('#block_medical-paragraph9').hide(); } else if (medical['hasDisabilityPension'] == 'კი') { // console.log('block_medical-paragraph9-show'); $('#none9').hide(); $('#block_medical-paragraph9').show(); } $('[hasDisabilityPension]').text(medical['hasDisabilityPension']); $('[disabilityDiagnostics]').text(medical['disabilityDiagnostics']); $('[disabilityTreatment]').text(medical['disabilityTreatment']); $('[disabilityTreatmentDate]').text(medical['disabilityTreatmentDate']); $('[disabilityTreatmentDetails]').text(medical['disabilityTreatmentDetails']); if (medical['wasCOVIDPositive'] == 'არა') { // console.log('block_medical-paragraph10-hide'); $('#block_medical-paragraph10').hide(); } else if (medical['wasCOVIDPositive'] == 'კი') { // console.log('block_medical-paragraph10-show'); $('#none10').hide(); $('#block_medical-paragraph10').show(); } $('[wasCOVIDPositive]').text(medical['wasCOVIDPositive']); $('[covidTestDate]').text(medical['covidTestDate']); $('[covidDiagnostics]').text(medical['covidDiagnostics']); $('[covidTreatment]').text(medical['covidTreatment']); $('[covidTreatmentDate]').text(medical['covidTreatmentDate']); $('[covidTreatmentDetails]').text(medical['covidTreatmentDetails']); //-----------------checkbox---------------------------------------------------- // if (medical['selfIsolation'] == 'არა' || medical['selfIsolation'] == null && // medical['wasInContact'] == 'არა' || medical['wasInContact'] == null) { // console.log('checkbox-paragraph11-1-show'); // $('#checkbox-paragraph11-1').hide(); // $('#none_text').hide(); // $('#checkbox-paragraph11-2').hide(); // $('#checkbox-paragraph11-3').hide(); // $('#checkbox-paragraph11-4').hide(); // $('#checkbox-paragraph11-5').hide(); // $('#checkbox-paragraph11-6').hide(); // } else if (medical['selfIsolation'] === 'კი' && // (medical['wasInContact'] === 'არა' || medical['wasInContact'] === null) && // (medical['fullyRecovered'] === 'არა' || medical['fullyRecovered'] === null)) { // console.log('checkbox-paragraph11-2-show'); // $('#none_text').hide(); // $('#checkbox-paragraph11-1').hide(); // $('#checkbox-paragraph11-2').show(); // $('#checkbox-paragraph11-3').hide(); // $('#checkbox-paragraph11-4').hide(); // $('#checkbox-paragraph11-5').hide(); // $('#checkbox-paragraph11-6').hide(); // } else if (medical['selfIsolation'] === 'კი' && // (medical['wasInContact'] === 'არა' || medical['wasInContact'] === null) && // (medical['fullyRecovered'] === 'კი')) { // console.log('checkbox-paragraph11-3-show'); // $('#none_text').show(); // $('#checkbox-paragraph11-1').hide(); // $('#checkbox-paragraph11-2').hide(); // $('#checkbox-paragraph11-3').show(); // $('#checkbox-paragraph11-4').hide(); // $('#checkbox-paragraph11-5').hide(); // $('#checkbox-paragraph11-6').hide(); // } else if (medical['selfIsolation'] === 'არა' || medical['selfIsolation'] === null && // (medical['wasInContact'] === 'კი') && // (medical['fullyRecovered'] === 'არა' || medical['fullyRecovered'] === null)) { // console.log('checkbox-paragraph11-4-show'); // $('#none_text').hide(); // $('#checkbox-paragraph11-1').hide(); // $('#checkbox-paragraph11-2').hide(); // $('#checkbox-paragraph11-3').hide(); // $('#checkbox-paragraph11-4').show(); // $('#checkbox-paragraph11-5').hide(); // $('#checkbox-paragraph11-6').hide(); // } else if (medical['selfIsolation'] === 'არა' || medical['selfIsolation'] === null && // (medical['wasInContact'] === 'კი') && // (medical['fullyRecovered'] === 'კი')) { // console.log('checkbox-paragraph11-5-show'); // $('#none_text').show(); // $('#checkbox-paragraph11-1').hide(); // $('#checkbox-paragraph11-2').hide(); // $('#checkbox-paragraph11-3').hide(); // $('#checkbox-paragraph11-4').hide(); // $('#checkbox-paragraph11-5').show(); // $('#checkbox-paragraph11-6').hide(); // } else if (medical['selfIsolation'] === 'კი' && // (medical['wasInContact'] === 'კი') && // (medical['fullyRecovered'] === 'კი')) { // console.log('checkbox-paragraph11-6-show'); // $('#none_text').show(); // $('#checkbox-paragraph11-1').hide(); // $('#checkbox-paragraph11-2').hide(); // $('#checkbox-paragraph11-3').hide(); // $('#checkbox-paragraph11-4').hide(); // $('#checkbox-paragraph11-5').hide(); // $('#checkbox-paragraph11-6').show(); // } if ((medical['selfIsolation'] == 'არა' || medical['selfIsolation'] == null) && (medical['wasInContact'] == 'არა' || medical['wasInContact'] == null)) { console.log('checkbox-paragraph11-1-show'); console.log(medical['selfIsolation']); console.log(medical['wasInContact']); $('#checkbox-paragraph11-1').hide(); $('#none_text').hide(); $('#checkbox-paragraph11-2').hide(); $('#checkbox-paragraph11-3').hide(); $('#checkbox-paragraph11-4').hide(); $('#checkbox-paragraph11-5').hide(); $('#checkbox-paragraph11-6').hide(); $('#checkbox-paragraph11-7').hide(); } else if (medical['selfIsolation'] === 'კი' && (medical['wasInContact'] === 'არა' || medical['wasInContact'] === null) && (medical['fullyRecovered'] === 'არა' || medical['fullyRecovered'] === null)) { console.log('checkbox-paragraph11-2-show'); console.log(medical['selfIsolation']); console.log(medical['wasInContact']); console.log(medical['fullyRecovered']); $('#none_text').hide(); $('#checkbox-paragraph11-1').hide(); $('#checkbox-paragraph11-2').show(); $('#checkbox-paragraph11-3').hide(); $('#checkbox-paragraph11-4').hide(); $('#checkbox-paragraph11-5').hide(); $('#checkbox-paragraph11-6').hide(); $('#checkbox-paragraph11-7').hide(); } else if (medical['selfIsolation'] === 'კი' && (medical['wasInContact'] === 'არა' || medical['wasInContact'] === null) && medical['fullyRecovered'] === 'კი') { console.log('checkbox-paragraph11-3-show'); console.log(medical['selfIsolation']); console.log(medical['wasInContact']); console.log(medical['fullyRecovered']); $('#none_text').show(); $('#checkbox-paragraph11-1').hide(); $('#checkbox-paragraph11-2').hide(); $('#checkbox-paragraph11-3').show(); $('#checkbox-paragraph11-4').hide(); $('#checkbox-paragraph11-5').hide(); $('#checkbox-paragraph11-6').hide(); $('#checkbox-paragraph11-7').hide(); } else if ((medical['selfIsolation'] === 'არა' || medical['selfIsolation'] === null) && medical['wasInContact'] === 'კი' && (medical['fullyRecovered'] === 'არა' || medical['fullyRecovered'] === null)) { console.log('checkbox-paragraph11-4-show'); console.log(medical['selfIsolation']); console.log(medical['wasInContact']); console.log(medical['fullyRecovered']); $('#none_text').hide(); $('#checkbox-paragraph11-1').hide(); $('#checkbox-paragraph11-2').hide(); $('#checkbox-paragraph11-3').hide(); $('#checkbox-paragraph11-4').show(); $('#checkbox-paragraph11-5').hide(); $('#checkbox-paragraph11-6').hide(); $('#checkbox-paragraph11-7').hide(); } else if ((medical['selfIsolation'] === 'არა' || medical['selfIsolation'] === null) && medical['wasInContact'] === 'კი' && medical['fullyRecovered'] === 'კი') { console.log('checkbox-paragraph11-5-show'); console.log(medical['selfIsolation']); console.log(medical['wasInContact']); console.log(medical['fullyRecovered']); $('#none_text').show(); $('#checkbox-paragraph11-1').hide(); $('#checkbox-paragraph11-2').hide(); $('#checkbox-paragraph11-3').hide(); $('#checkbox-paragraph11-4').hide(); $('#checkbox-paragraph11-5').show(); $('#checkbox-paragraph11-6').hide(); $('#checkbox-paragraph11-7').hide(); } else if (medical['selfIsolation'] === 'კი' && medical['wasInContact'] === 'კი' && medical['fullyRecovered'] === 'კი') { console.log('checkbox-paragraph11-6-show'); console.log(medical['selfIsolation']); console.log(medical['wasInContact']); console.log(medical['fullyRecovered']); $('#none_text').show(); $('#checkbox-paragraph11-1').hide(); $('#checkbox-paragraph11-2').hide(); $('#checkbox-paragraph11-3').hide(); $('#checkbox-paragraph11-4').hide(); $('#checkbox-paragraph11-5').hide(); $('#checkbox-paragraph11-6').show(); $('#checkbox-paragraph11-7').hide(); } else if (medical['selfIsolation'] === 'კი' && medical['wasInContact'] === 'კი' && medical['fullyRecovered'] === 'არა') { console.log('checkbox-paragraph11-7-show'); console.log(medical['selfIsolation']); console.log(medical['wasInContact']); console.log(medical['fullyRecovered']); $('#none_text').hide(); $('#checkbox-paragraph11-1').hide(); $('#checkbox-paragraph11-2').hide(); $('#checkbox-paragraph11-3').hide(); $('#checkbox-paragraph11-4').hide(); $('#checkbox-paragraph11-5').hide(); $('#checkbox-paragraph11-6').hide(); $('#checkbox-paragraph11-7').show(); } else { console.log('checkbox-paragraph-all-hide'); $('#checkbox-paragraph11-1').hide(); $('#none_text').hide(); $('#checkbox-paragraph11-2').hide(); $('#checkbox-paragraph11-3').hide(); $('#checkbox-paragraph11-4').hide(); $('#checkbox-paragraph11-5').hide(); $('#checkbox-paragraph11-6').hide(); $('#checkbox-paragraph11-7').hide(); } $('[selfIsolation]').text(medical['selfIsolation']); $('[wasInContact]').text(medical['wasInContact']); //---------------------------------------------------------------------------- $('[fullyRecovered]').text(medical['fullyRecovered']); const medications = data['medications']; if (data['medications'] == 0) { console.log('block__medications-hide'); $('.block__medications').hide(); } else { console.log('block__medications-show'); $('.block__medications').show(); } medications.forEach(medication => { const $template = $('.list__medications [template]'); const $clone = $template.clone(); $clone.removeAttr('template'); $clone.find('[medicationsId]').text(medication.id); $clone.find('[medicationName]').text(medication.name); $clone.find('[dosage]').text(medication.dosage); $clone.find('[frequency]').text(medication.frequency); $clone.find('[consumptionRule]').text(medication.consumptionRule); $('.list__medications').append($clone); }); $('.list__medications [template]').remove(); const doctor = data['doctor']; if (doctor['fullName'] == null) { $('.block__doctor').hide(); } else { $('.block__doctor').show(); } $('[doctorFullName]').text(doctor['fullName']); $('[doctorEmail]').text(doctor['email']); $('[doctorPhoneNumber]').text(doctor['phoneNumber']); } });