(function($,s,u,$scope) { $(function () { $scope.covers = [] var quoteData = u.ses_get_json("quote_data"); var policyData = u.ses_get_json("policy_data"); $("#btnBuyNow").click(function() { window.location = s.app + "Home/completed"; }); if (u.getChannel() == "CUST") { $("#additions").hide(); } //QIC UPDATES //load discounts for all products if the user is not a customer //if (!u.isCustomer()) { // $(".discount").show(0); // //motor discounts // u.lovDropDown("#MOTOR-DISCOUNTS", "getProductDiscountLov", "MOTOR"); // //travel discounts // u.lovDropDown("#TRAVEL-DISCOUNTS", "getProductDiscountLov", "TRA"); // //home owners discounts // u.lovDropDown("#HOME-DISCOUNTS", "getProductDiscountLov", "HOP"); // //personal accident discounts // u.lovDropDown("#PA-DISCOUNTS", "getProductDiscountLov", "PA"); //} else { // $(".discount").remove(); //} //s.countryList("#oCountry", function () { if (policyData == null) {$("#oCountry").selectize();}}); //check if there is quotation data in the session of the currently logged on user //$(".w-tab-link").click(function() { // $("input[name='END_DATE']").val(""); // $scope.startDate = null; // $scope.endDate = null; //}); $("input[name='START_DATE']").change(function () { if (policyData == null) { if (u.dateBefore($(this).val(), u.get_date())) { //start date comes before todays date invalid date $(this).val(""); u.growl_info("The start date cannot be back dated"); } $scope.startDate = this; if (u.datesEqual($($scope.endDate).val(), $(this).val())) { //end date comes before todays date invalid date $($scope.endDate).val(""); u.growl_info("The end date selected cannot be the same as the start date"); } else if (u.dateBefore($($scope.endDate).val(), $(this).val())) { $($scope.endDate).val(""); u.growl_info("The end date cannot be back dated"); } } }); $("input[name='END_DATE']").change(function () { if (policyData == null) { $scope.endDate = this; if (u.datesEqual($($scope.endDate).val(), $($scope.startDate).val())) { //end date comes before todays date invalid date $(this).val(""); u.growl_info("The end date selected cannot be the same as the start date"); } else if (u.dateBefore($($scope.endDate).val(), $($scope.startDate).val())) { $(this).val(""); u.growl_info("The end date cannot be back dated"); } } }); //var user = u.ses_get_json("user_info"); $(".terms").click(function() { $("#termsModal").modal(); }); u.min_lnth_validation(".phone", 10); /** * datepicker utility to display a datepicker for a input field */ u.set_datepicker(".back-date"); u.set_datepicker(".dob"); u.set_datepicker(".sDob") u.set_datepicker_noback(".no-back-date"); u.email_validation(".email"); u.dob_validation(18,"#DateOfBirth"); u.dob_validation(18,"#SpouseDateOfBirth"); /*--------------------------- * year drop down population *--------------------------*/ var year = parseInt(u.getYear(u.get_datetime())); for (var i = year; i >= 1945; i--) { $("#YEAR_MANUFACTURE").append(``); } if (policyData == null) { $("#YEAR_MANUFACTURE").selectize(); } u.lovDropDown2("#VEHICLE_MAKE_CODE", "getMakeModelLov"); var underwritingData; if (quoteData) { //check if the user is an agent or broker if (u.isAgent() && quoteData.agencyCode) { //check if the agency code on the existing policy is the same as the agency code of the logged in user if (quoteData.agencyCode !== u.getAgencyCode()) return u.growl_warning("Your agency code does not match with the agency code specified on the renewal policy."); } //map quote data to the underwriting format underwritingData = { FULL_NAME: quoteData["QH_FULL_NAME"], PHONE_NO: quoteData["QH_CONTACT_NO"], CURRENCY: quoteData["QH_CUR_CODE"], EMAIL: quoteData["QH_EMAIL"], STATUS: quoteData["QH_STATUS"], ID: quoteData["QH_SYS_ID"] }; //we need to determine the type of product if (quoteData["INS_MOTOR_QUOTE"].length > 0) { u.tick("Loading Motor Quote data..."); $("#MotorInsurance").addClass("w--current"); $("#TravelInsurance").removeClass("w--current"); $("#Homeowners").removeClass("w--current"); $("#PersonalAccident").removeClass("w--current"); underwritingData["CURRENCY"] = quoteData["QH_CUR_CODE"]; underwritingData["END_DATE"] = quoteData["QH_TO_DATE"]; underwritingData["START_DATE"] = quoteData["QH_FROM_DATE"]; underwritingData["VEHICAL_VAL"] = quoteData["QH_SI_FC"]; underwritingData["SEATING_CAPACITY"] = quoteData["INS_MOTOR_QUOTE"][0]["MQ_NO_SEATS"]; underwritingData["YEAR_MANUFACTURE"] = quoteData["INS_MOTOR_QUOTE"][0]["MQ_MANUF_YEAR"]; underwritingData["ADDITIONAL_TTPD_YN"] = quoteData["INS_MOTOR_QUOTE"][0]["MQ_ADD_TPPD_YN"]; underwritingData["RISK_TYPE"] = quoteData["QH_RSK_CODE"]; underwritingData["REGISTRATION_NUMBER"] = quoteData["INS_MOTOR_QUOTE"][0]["MQ_REG_NO"]; underwritingData["CUBIC_CAPCITY"] = quoteData["INS_MOTOR_QUOTE"][0]["MQ_CC"]; underwritingData["BUY_BACK_EXCESS"] = quoteData["INS_MOTOR_QUOTE"][0]["MQ_BUY_BACK"]; u.lovDropDown("#PRODUCT", "getProductLov", null, function () {//fetch motor products $("#PRODUCT").val(quoteData["QH_PRD_CODE"]).trigger("change"); u.lovDropDown2(".currency", "getCurencyLov", null, function () {//fetch currency u.lovDropDown2("#RISK_TYPE", "getRiskLov", $("#PRODUCT").val(), function () {// fetch motor product risks u.fill_form(underwritingData, "#motor-quotation-form"); $("#ADDITIONAL_TTP_YN").val(quoteData["INS_MOTOR_QUOTE"][0]["MQ_ADD_TPPD_YN"]).trigger("change"); u.noTick(); $("input [name='START_DATE'], input[name='END_DATE']").each(function () { $(this).val(""); }); $("input [name='START_DATE'], input[name='END_DATE']").each(function () { $(this).val(""); }); }); }); }); u.lovDropDown2("#VEHICLE_MAKE_CODE", "getMakeModelLov", function () { $("#VEHICLE_MAKE_CODE").val(policyData["INS_MOTOR_RISK"][0]["MR_MAKE"]).trigger("change"); }); } else if (quoteData["INS_HOME_QUOTE"].length > 0) { u.tick("Loading Home Owners Quote..."); $("#MotorInsurance").removeClass("w--current"); $("#TravelInsurance").removeClass("w--current"); $("#Homeowners").addClass("w--current"); $("#PersonalAccident").addClass("w--current"); debugger underwritingData["COVERS"] = quoteData["INS_HOME_QUOTE"][0]["INS_HOME_QUOTE_COVER"]; underwritingData["END_DATE"] = quoteData["QH_TO_DATE"]; underwritingData["START_DATE"] = quoteData["QH_FROM_DATE"]; underwritingData["PHONE_NUMBER"] = quoteData["QH_CONTACT_NO"]; underwritingData["CURRENCY_CODE"] = quoteData["QH_CUR_CODE"]; underwritingData["TOTAL_SI"] = quoteData["QH_SI_FC"]; u.lovcheckbox("#COVER_CODE", "getHomeOwnerCovers", "FP01", function (result) { debugger var cover = quoteData["INS_HOME_QUOTE"][0]["INS_HOME_QUOTE_COVER"]; console.log(cover) var coverValue = (quoteData["INS_HOME_QUOTE"][0]["INS_HOME_QUOTE_COVER"]); for (var i = 0; i <= 4; i++) { debugger if ($(`input[data-cover="${result[i]["CODE"]}"]`).val() || null == cover[i]["HC_COVER_CODE"] || null) { $(`input[data-cover="${result[i]["CODE"]}"]`).prop("checked", true) $(`input[data-value="${result[i]["CODE"]}"]`).val(cover[i]["HC_SI"]) $("#buildingLocat").removeAttr("hidden"); $("#buildingDesc").removeAttr("hidden"); $("#contentDesc").removeAttr("hidden"); $("#buildingLocation").prop("disabled", false); $("#buildingDescription").prop("disabled", false); $("#contentDescription").prop("disabled", false); } } u.lovDropDown2(".currency", "getCurencyLov", null, function () { u.fill_form(underwritingData, "#homeOwnersUnderwritingForm"); u.noTick(); $("input [name='START_DATE'], input[name='END_DATE']").each(function () { $(this).val(""); }); }); }); } else if (quoteData["INS_TRAVEL_QUOTE"].length > 0) { console.log(quoteData); s.getCountries(function (response) { //s.countryList("#COUNTRY", function (result) { if (response.length > 0) { $("#COUNTRY").find(".removable").remove(); for (let i in response) { $("#COUNTRY").append(``); } $("#COUNTRY").selectize(); } u.tick("Loading Travel Quote..."); $("#MotorInsurance").removeClass("w--current"); $("#TravelInsurance").addClass("w--current"); $("#Homeowners").removeClass("w--current"); $("#PersonalAccident").removeClass("w--current"); underwritingData["OCCUPATION"] = quoteData["INS_TRAVEL_QUOTE"][0]["TQ_OCCUPATION"]; underwritingData["COUNTRY"] = quoteData["INS_TRAVEL_QUOTE"][0]["TQ_DESTINATION"]; underwritingData["START_DATE"] = quoteData["QH_FROM_DATE"]; underwritingData["END_DATE"] = quoteData["QH_TO_DATE"]; underwritingData["PHONE"] = quoteData["QH_CONTACT_NO"]; underwritingData["NO_TRAVELLERS"] = quoteData["INS_TRAVEL_QUOTE"][0]["TQ_NO_TRAVELING"]; underwritingData["TRAVEL_TYPE"] = quoteData["INS_TRAVEL_QUOTE"][0]["TQ_TRAVEL_TYPE"]; underwritingData["DESTINATION_TYPE"] = quoteData["INS_TRAVEL_QUOTE"][0]["TQ_DESTINATION_TYPE"]; u.lovDropDown2(".currency", "getCurencyLov", null, function () { u.fill_form(underwritingData, "#travelUnderwritingForm"); u.noTick(); $("input [name='START_DATE'], input[name='END_DATE']").each(function () { $(this).val(""); }); }); if (policyData == null) { $("#COUNTRY").selectize(); } }); } else if (quoteData["INS_PA_QUOTE"].length > 0) { u.tick("Loading Personal Accident Quote..."); $("#MotorInsurance").removeClass("w--current"); $("#TravelInsurance").removeClass("w--current"); $("#Homeowners").removeClass("w--current"); $("#PersonalAccident").addClass("w--current"); u.form_reset("#paUnderwritingForm"); underwritingData["END_DATE"] = quoteData["QH_TO_DATE"]; underwritingData["START_DATE"] = quoteData["QH_FROM_DATE"]; underwritingData["PHONE"] = quoteData["QH_CONTACT_NO"]; underwritingData["SUM_INSURED"] = quoteData["QH_SI_FC"]; underwritingData["WORK_NATURE"] = quoteData["INS_PA_QUOTE"][0]["PQ_WORK_NATURE"]; //underwritingData["CONTENT_SI"] = quoteData["INS_PA_QUOTE"][0]["HQ_CONTENT_VAL"]; //underwritingData["PL_SI"] = quoteData["INS_PA_QUOTE"][0]["HQ_PUB_LIAB_VAL"]; //underwritingData["RENT_SI"] = quoteData["INS_PA_QUOTE"][0]["HQ_RENT_VAL"]; //underwritingData["PA_SI"] = quoteData["INS_PA_QUOTE"][0]["HQ_PERS_ACDNT_VAL"]; u.lovDropDown2(".currency", "getCurencyLov", null, function () { u.fill_form(underwritingData, "#paUnderwritingForm"); u.noTick(); $("input [name='START_DATE'], input[name='END_DATE']").each(function () { $(this).val(""); }); }); } } else if (policyData) { //console.log(policyData) //map quote data to the underwriting format underwritingData = { FULL_NAME: policyData["PH_CUST_NAME"], PHONE_NO: policyData["PH_CUST_PHONE"], PHONE: policyData["PH_CUST_PHONE"], CURRENCY: policyData["PH_CUR_CODE"], TXN_STATE: policyData["PH_TXT_STATE"], EMAIL: policyData["PH_CUST_EMAIL"], POL_STATUS: policyData["PH_STATUS"], ADDRESS: policyData["PH_ADDRESS"], OCCUPATION: policyData["PH_OCCUPATION"], POL_ID: policyData["PH_SYS_ID"], DOB: policyData["PH_CUST_DOB"], AGENT_CODE : policyData["PH_INT_CODE"], NATIONAL_ID: policyData["PH_CUST_NATIONAL_ID"] }; //we need to determine the type of product if (policyData["INS_MOTOR_RISK"].length > 0) { console.log(policyData); //we need to check if the policy is active if (policyData["PH_TXT_STATE"] === "E") { //disable all fields u.form_disable("#motor-quotation-form"); } else if (policyData["PH_TXT_STATE"] === "L") { //disable some form controls $("#PRODUCT").prop("disabled", "disabled"); $("#RISK_TYPE").prop("disabled", "disabled"); $("#REGISTRATION_NUMBER").prop("disabled", "disabled"); $("#SEATING_CAPACITY").prop("disabled", "disabled"); $("#CUBIC_CAPCITY").prop("disabled", "disabled"); $("#YEAR_MANUFACTURE").prop("disabled", "disabled"); $("#CHASIS_NO").prop("disabled", "disabled"); $("#BODY_TYPE").prop("disabled", "disabled"); $("#VEHICLE_MAKE_CODE").prop("disabled", "disabled"); $("#VEHICLE_MODEL").prop("disabled", "disabled"); } u.tick("Loading Motor Policy data..."); $("#MotorInsurance").addClass("w--current"); $("#TravelInsurance").removeClass("w--current"); $("#Homeowners").removeClass("w--current"); $("#PersonalAccident").removeClass("w--current"); underwritingData["CURRENCY"] = policyData["PH_CUR_CODE"]; underwritingData["OCCUPATION"] = policyData["PH_OCCUPATION"]; underwritingData["ADDRESS"] = policyData["PH_ADDRESS"]; underwritingData["START_DATE"] = u.dateBefore(policyData["PH_FROM_DATE"], u.get_date()) ? u.dbDate(u.get_date()) : policyData["PH_FROM_DATE"]; underwritingData["END_DATE"] = u.dateBefore(policyData["PH_FROM_DATE"], u.get_date()) ? u.dbDate(u.dateReverse(u.dateFastForward(u.dbDate(underwritingData["START_DATE"]), 1, "year"), 1, "day")) : policyData["PH_TO_DATE"]; underwritingData["VEHICAL_VAL"] = policyData["PH_SI"]; underwritingData["SEATING_CAPACITY"] = policyData["INS_MOTOR_RISK"][0]["MR_NO_SEATS"]; underwritingData["YEAR_MANUFACTURE"] = policyData["INS_MOTOR_RISK"][0]["MR_MANUF_YEAR"]; underwritingData["ADDITIONAL_TTP_YN"] = policyData["INS_MOTOR_RISK"][0]["MR_ADD_TPPD_YN"]; underwritingData["RISK_TYPE"] = policyData["PH_RSK_CODE"]; underwritingData["REGISTRATION_NUMBER"] = policyData["INS_MOTOR_RISK"][0]["MR_REG_NO"]; underwritingData["CUBIC_CAPCITY"] = policyData["INS_MOTOR_RISK"][0]["MR_CC"]; underwritingData["BUY_BACK_EXCESS"] = policyData["INS_MOTOR_RISK"][0]["MR_BUY_BACK"]; underwritingData["VEHICLE_MODEL"] = policyData["INS_MOTOR_RISK"][0]["MR_MODEL"]; // underwritingData["VEHICLE_MAKE_CODE"] = policyData["INS_MOTOR_RISK"][0]["MR_MAKE"]; underwritingData["VEHICLE_MAKE_CODE"] = policyData["INS_MOTOR_RISK"][0]["MR_MAKE_CODE"]; underwritingData["BODY_TYPE"] = policyData["INS_MOTOR_RISK"][0]["MR_BODY_TYPE"]; underwritingData["CHASIS_NO"] = policyData["INS_MOTOR_RISK"][0]["MR_CHASSIS_NO"]; underwritingData["ADDITIONAL_TTPD_YN"] = policyData["INS_MOTOR_RISK"][0]["MR_ADD_TPPD_YN"]; underwritingData["ADDITIONAL_TTPD"] = policyData["INS_MOTOR_RISK"][0]["MR_ADD_TPPD"]; underwritingData["BUY_BACK_EXCESS"] = policyData["INS_MOTOR_RISK"][0]["MR_BUY_BCK"]; underwritingData["COLOR"] = policyData["INS_MOTOR_RISK"][0]["MR_COLOR"]; underwritingData["REGISTRATION_YEAR"] = policyData["INS_MOTOR_RISK"][0]["MR_REG_YEAR"]; u.lovDropDown("#PRODUCT", "getMotorProductLov", null, function () {//fetch motor products $("#PRODUCT").val(policyData["PH_PRD_CODE"]).trigger("change"); u.lovDropDown2(".currency", "getCurencyLov", null, function () {//fetch currency u.lovDropDown2("#RISK_TYPE", "getRiskLov", $("#PRODUCT").val(), function () {// fetch motor product risks $("#ADDITIONAL_TTP_YN").val(policyData["INS_MOTOR_RISK"][0]["MR_ADD_TPPD_YN"]).trigger("change"); u.lovDropDown2("#VEHICLE_MAKE_CODE", "getMakeModelLov", null, function () { //if (policyData == null) { // $("#VEHICLE_MAKE_CODE").selectize(); //} u.fill_form(underwritingData, "#motor-quotation-form"); $("#VEHICLE_MAKE_CODE").val(policyData["INS_MOTOR_RISK"][0]["MR_MAKE_CODE"]).trigger("change"); u.noTick(); /*$("input [name='START_DATE'], input[name='END_DATE']").each(function () { $(this).val(""); });*/ }); }); }); }); } else if (policyData["INS_HOME_RISK"].length > 0) { console.log(policyData) //we need to check if the policy is active if (policyData["PH_TXT_STATE"] === "E") { //disable all fields u.form_disable("#homeOwnersUnderwritingForm"); } else if (policyData["PH_TXT_STATE"] === "L") { //disable some form controls $("#COVER_CODE").prop("disabled", "disabled"); //$("#START_DATE").prop("disabel", "disabled"); //$("#END_DATE").prop("disabel", "disabled"); //$("#END_DATE").prop("disabel", "disabled"); } u.tick("Loading Home Owners Policy data..."); $("#MotorInsurance").removeClass("w--current"); $("#TravelInsurance").removeClass("w--current"); $("#Homeowners").addClass("w--current"); $("#PersonalAccident").removeClass("w--current"); //s.countryList("#COUNTRY", function(result) { //underwritingData["COVERS"] = policyData["PH_RSK_CODE"]; underwritingData["END_DATE"] = policyData["PH_TO_DATE"]; underwritingData["START_DATE"] = policyData["PH_FROM_DATE"]; underwritingData["PHONE_NUMBER"] = policyData["PH_CUST_PHONE"]; underwritingData["CURRENCY_CODE"] = policyData["PH_CUR_CODE"]; underwritingData["TOTAL_SI"] = policyData["PH_SI"]; underwritingData["ADDRESS"] = policyData["PH_ADDRESS"]; underwritingData["OCCUPATION"] = policyData["PH_OCCUPATION"]; underwritingData["EXTINGUISHER_YN"] = policyData["INS_HOME_RISK"][0]["HR_EXTINGUISHER_YN"]; underwritingData["BUILDING_DESCRIPTION"] = policyData["INS_HOME_RISK"][0]["HR_BUILDING_DESCRIPTION"]; underwritingData["BUILDING_LOCATION"] = policyData["INS_HOME_RISK"][0]["HR_BUILDING_LOCATION"]; underwritingData["CONTENT_DESCRIPTION"] = policyData["INS_HOME_RISK"][0]["HR_CONTENT_DESCRIPTION"]; // underwritingData["COVERS"] = policyData["INS_HOME_RISK"][0]["INS_HOME_COVERS"]; u.lovcheckbox("#COVER_CODE", "getHomeOwnerCovers", "FP01", function (result) { debugger var cover = policyData["INS_HOME_RISK"][0]["INS_HOME_COVERS"]; console.log(cover) //var coverValue = (policyData["INS_HOME_RISK"][0]["INS_HOME_COVERS"]); for (var i = 0; i < cover.length; i++) { debugger if ($(`input[data-cover="${result[i]["CODE"]}"]`).val() || null == cover[i]["HC_COVER_CODE"] || null) { $(`input[data-cover="${result[i]["CODE"]}"]`).prop("checked", true) $(`input[data-value="${result[i]["CODE"]}"]`).val(cover[i]["HC_SI"]) $("#buildingLocat").removeAttr("hidden"); $("#buildingDesc").removeAttr("hidden"); $("#contentDesc").removeAttr("hidden"); $("#buildingLocation").prop("disabled", false); $("#buildingDescription").prop("disabled", false); $("#contentDescription").prop("disabled", false); } } u.lovDropDown2(".currency", "getCurencyLov", null, function () { u.fill_form(underwritingData, "#homeOwnersUnderwritingForm"); u.noTick(); }); }) } else if (policyData["INS_PA_RISK"].length > 0) { u.tick("Loading Personal Accident Policy data..."); //we need to check if the policy is active if (policyData["PH_TXT_STATE"] === "E") { //disable all fields u.form_disable("#travelUnderwritingForm"); } else if (policyData["PH_TXT_STATE"] === "L") { //disable some form controls u.form_disable("#travelUnderwritingForm"); u.growl_info("Travel Policies cannot be renewed"); } $("#MotorInsuraunderwritingDatance").removeClass("w--current"); $("#TravelInsurance").removeClass("w--current"); $("#Homeowners").removeClass("w--current"); $("#PersonalAccident").addClass("w--current"); underwritingData["HEIGHT"] = policyData["INS_PA_RISK"][0]["PR_HEIGHT"]; underwritingData["WEIGHT"] = policyData["INS_PA_RISK"][0]["PR_WEIGHT"]; underwritingData["MARITAL_STATUS"] = policyData["INS_PA_RISK"][0]["PR_MARITAL_STATUS"]; underwritingData["WORK_NATURE"] = policyData["INS_PA_RISK"][0]["PR_WORK_NATURE"]; underwritingData["ACCIDENT_YN"] = policyData["INS_PA_RISK"][0]["PR_ACCIDENT_YN"]; underwritingData["ACCIDENT_DATE"] = policyData["INS_PA_RISK"][0]["PR_ACCIDENT_DATE"]; underwritingData["OTHER_ACTIVITY_YN"] = policyData["INS_PA_RISK"][0]["PR_OTHER_ACTIVITY_YN"]; underwritingData["BENEFICIARY_DETL"] = policyData["INS_PA_RISK"][0]["PR_BENEFICIARY_DETL"]; underwritingData["SUM_INSURED"] = policyData["PH_SI"]; underwritingData["ADDRESS"] = policyData["PH_ADDRESS"]; underwritingData["OCCUPATION"] = policyData["PH_OCCUPATION"]; u.lovDropDown2(".currency", "getCurencyLov", null, function () { u.fill_form(underwritingData, "#paUnderwritingForm"); u.noTick(); /*$("input [name='START_DATE'], input[name='END_DATE']").each(function () { $(this).val(""); });*/ }); } else if (policyData["INS_TRAVEL_RISK"].length > 0) { u.tick("Loading Travel Policy data..."); s.getCountries(function (response) { //s.countryList("#COUNTRY", function(result) { //we need to check if the policy is active if (policyData["PH_TXT_STATE"] === "E") { //disable all fields u.form_disable("#travelUnderwritingForm"); } else if (policyData["PH_TXT_STATE"] === "L") { //disable some form controls } if (response.length > 0) { $("#COUNTRY").find(".removable").remove(); for (let i in response) { $("#COUNTRY").append(``); } } $("#MotorInsuraunderwritingDatance").removeClass("w--current"); $("#TravelInsurance").addClass("w--current"); $("#Homeowners").removeClass("w--current"); $("#PersonalAccident").removeClass("w--current"); underwritingData["OCCUPATION"] = policyData["INS_TRAVEL_RISK"][0]["TR_OCCUPATION"]; // underwritingData["COUNTRY"] = policyData["INS_TRAVEL_RISK"][0]["TR_DESTINATION"]; underwritingData["START_DATE"] = policyData["PH_FROM_DATE"]; underwritingData["END_DATE"] = policyData["PH_TO_DATE"]; underwritingData["ADDRESS"] = policyData["PH_ADDRESS"]; underwritingData["PHONE"] = policyData["PH_CUST_PHONE"]; underwritingData["NO_TRAVELLERS"] = policyData["INS_TRAVEL_RISK"][0]["TR_TRAVELLERS"]; // underwritingData["DES_ADDRESS"] = policyData["INS_TRAVEL_RISK"][0]["TR_DES_ADDRESS"]; underwritingData["PASSPORT_NO"] = policyData["INS_TRAVEL_RISK"][0]["TR_PASSPORT_NO"]; underwritingData["ISSUING_COUNTRY"] = policyData["INS_TRAVEL_RISK"][0]["TR_ISSUING_COUNTRY"]; underwritingData["CITIZENSHIP"] = policyData["INS_TRAVEL_RISK"][0]["TR_CITIZENSHIP"]; underwritingData["BENEFICIARY"] = policyData["INS_TRAVEL_RISK"][0]["TR_BENEFICIARY"]; underwritingData["BENEFICIARY_RELATION"] = policyData["INS_TRAVEL_RISK"][0]["TR_BENEFICIARY_RELATION"]; underwritingData["BENEFICIARY_CONTACT"] = policyData["INS_TRAVEL_RISK"][0]["TR_BENEFICIARY_CONTACT"]; // underwritingData["ADD_PERSONS_INSURED"] = policyData["INS_TRAVEL_RISK"][0]["TR_ADD_PERSONS_INSURED"]; underwritingData["SPOUSE_NAME"] = policyData["INS_TRAVEL_RISK"][0]["TR_SPOUSE_NAME"]; underwritingData["SPOUSE_DOB"] = policyData["INS_TRAVEL_RISK"][0]["TR_SPOUSE_DOB"]; underwritingData["SPOUSE_CONTACT"] = policyData["INS_TRAVEL_RISK"][0]["TR_SPOUSE_CONTACT"]; underwritingData["SPOUSE_PASSPORT_NUMBER"] = policyData["INS_TRAVEL_RISK"][0]["TR_SPOUSE_PASSPORT_NUMBER"]; u.lovDropDown2(".currency", "getCurencyLov", null, function () { u.fill_form(underwritingData, "#travelUnderwritingForm"); $("table .trvl-remove").remove(); var countries = policyData["INS_TRAVEL_RISK"][0]["INS_TRAVEL_POL_DEST"]; var destinations = []; countries.ForEach(x => { destinations.push({ DEST_CATEGORY: x.ITD_CATEGORY, DEST_NAME: x.ITD_NAME, DEST_ADDRESS: x.ITD_ADDRESS, DEST_PHONE: x.ITD_PHONE, DEST_CODE: x.ITD_CODE }); }); u.setGlobal("destinations", destinations); destinations.ForEach(x => { $("#countryList").prepend( `