{"version":3,"file":"sm.portal.vm.application.min.js","names":["$","undefined","sm","window","ApplicationViewModel","self","this","ukFeatureEnabled","portal","utility","isUKFeatureEnabled","euFeatureEnabled","isEUFeatureEnabled","apasFeatureEnabled","isAPASFeatureEnabled","conservatoireFeatureEnabled","isConservatoireFeatureEnabled","SummaryInfoMessageTemplate","ko","observable","SetDemographicRequired","AcademicTemplateCustom","hidesummarybutton","hidePartialText","SubmissionText","allCustomData","isErrorMsgVisible","vm","custom","setCustomLocalizeKey","GetAdmissionsStage","applicationGID","url","_baseApiUri","blockUI","ajax","type","dataType","contentType","headers","processData","crossDomain","xhrFields","withCredentials","success","data","textStatus","jqXHR","isNullOrEmpty","viewModel","AdmissionsStageID","Payload","Milestones","unblockUI","LoadModel","container","i","Sections","length","section","SectionName","Person","SectionModel","FirstName","GivenName","MiddleName","LastName","Surname","customSectionData","Container","PreferredGivenName","Section","callCustomization","DateOfBirth","GenderID","e","HandleError","title","messages","IsError","ErrorMessages","ErrorHeader","getResourceValue","ThrowErrorWithRelevantMessage","action","userLoggedIn","GetSectionModel","IsLoggedIn","errorMessage","status","body","ok","ui","lightBox","jQuery","click","autoRefresh","location","reload","AppendNotExistingWarnings","newWarnings","WarningMessages","indexOf","push","UpdateTermsSections","model","Applied","ShouldDisplay","Required","IsRequired","DataTestMode","GetModelDataWrapper","sectionModel","blockui","applicationMID","personMID","Promise","resolve","GetModelData","IsExceptionalSection","ctx","includes","ConstructData","fullAttempt","CompositePayload","FullAttempt","allListdata","EnableU4smPortalStaticdataService","getListData","obj","key","value","Object","entries","Account","BasicContact","ListData","contact","BeforeTerms","AfterTerms","Demographic","demographic","Employment","employment","HighSchool","highschool","BasicPerson","person","Academic","academic","QualificationsOnEntry","qualifications","Languages","languages","AccessibilityNeed","accessibilityneed","ApplicationInformation","applicationinformation","sectionName","U4smPortalStaticdataServiceURL","listData","async","TenantGID","isTenantAvailable","GetAllSection","mid","data_all","Initialize","personGID","isReturning","ApplicationGID","ShowPartialPopup","PersonGID","_currentPersonId","PersonID","allData","startingPoint","InitializeSections","sectionModelArray","getHighSchoolIndex","getSummaryIndex","getAcademicIndex","nextSection","DataLoaded","DataLoading","smapi","constant","applicationDebugFlag","console","log","customData","NextSection","ApplicationMID","PersonMID","user_id","all","then","sort","a","b","AppearanceOrder","valueHasMutated","ActiveSectionChanged","ShowSplashScreen","dialog","width","height","modal","buttons","Ok","ToggleLogin","LoginUserName","setTimeout","CheckSectionsForInclusion","accountModel","AccountViewModel","personModel","PersonalInformationViewModel","getTaxIdRegex","contactModel","BasicContactViewModel","academicModel","AcademicInterestsViewModel","demographicModel","DemographicViewModel","employmentModel","EmploymentViewModel","collegeModel","PreviousCollegeViewModel","highSchoolModel","PreviousHighSchoolViewModel","testscoreModel","PlacementTestViewModel","beforeTermsModel","TermsConditionsViewModel","afterTermsModel","subscribe","newValue","HandlePartialApplications","IsUserLoggedIn","appearanceOrder","ApplicationSectionModel","SectionTitle","SectionNavTitle","SectionTemplate","Active","coreSection","Completed","LastSectionName","summarySection","SummaryViewModel","SummarySection","ukapplication","euapplication","apasapplication","conservatoireapplication","concat","MaintainSections","sectionsToAdd","sectionsToRemove","j","addObj","required","UpdateData","TemplatesLoaded","BaseU4SMUrl","ShowPartialData","ApplicationID","computed","observableArray","DisclaimerText","IsDisclaimerTextEmpty","CurrentSection","IsCreateUserProcessRunning","HasApplicationFee","ApplicationFeeRequired","AdmissionsAcademicLevelFees","ShowUserCreatedNotification","Saved","Saving","HasBeenSaved","Submitted","Result_PersonGivenName","IsPaymentProviderEnabled","PaymentProviderName","PaymentDetails","IsBillingDomicileMappingCorrect","BillingDomicileMessage","IsBillingDomicilePaymentProviderEnabled","BillingDomicilePaymentProviders","PartialPaymentAmount","MinimumAmountForPayments","EnablePartialPayment","PaymentProviderID","AppliedSections","results","Array","UnappliedSections","CompletedSections","IncompleteSections","SummarySections","appliedSections","CurrentSectionName","CurrentSectionTitle","CurrentSectionCount","formatString","SectionIndex","SubmitAvailable","SummaryVisible","SummaryAvailable","ApplicationFeeMessageShown","ApplicationFeeAmount","msg","feeCount","firstLoad","activeSection","workspace","block","message","show","previousSection","PreviousSection","ActiveSection","parseInt","ProcessOnServer","PerformApplicationAutoSave","cusdata","Activate","unblock","animate","scrollTop","offset","top","trigger","FirstLoad","validation","group","showAllMessages","Display","custData","LoadChildData","target","property","cmd","eval","GetApplicationSectionModel","appSectionModel","GetSectionTitle","sectionTitle","GetSectionNavClass","sectionNavClass","NavigationClass","LoadSummaryData","summaryDataModel","theName","theData","AdmissionsProgramID","AdmissionsPrograms","LoadSection","first","focus","NavigateToSection","matched","res","CanAdvanceAfterTerms","SetSectionsConfigData","configData","isDynamicSection","appSection","SetRequired","TermsMessage","SetFocus","test","navigator","userAgent","find","each","that","isSelect","isComboBox","next","not","CanCrateUser","sectionsArray","neededSectionArray","IsVMValid","NextButtonEnabled","isAvailable","currentIndex","nextIndex","AllowNext","available","PreviousButtonEnabled","previousIndex","MoveToNextSection","isLoggedIn","accountViewModel","newPassword","val","regularExpressionString","PasswordRegex","regularExpression","RegExp","minNumberofChars","PasswordMinLength","nextSectionObj","alert","MoveToPreviousSection","prevSectionObj","prevIndex","MoveToSummary","NextSectionName","PrevSectionName","ShowLogin","callback","PartialApps","GetPartialData","gid","Status","PartialApplications","attr","on","error","exception","OpenApplication","partial","event","GID","which","joinOperator","href","ExtractATO","accountSecData","personSecData","contactSecData","academicSecData","demographicSecData","employmentSecData","collegeSecData","highSchoolSecData","placementTestSecData","beforeTermSecData","afterTermSecData","requiredModels","personID","ID","previousCollegeData","testScoreData","previousHighSchoolData","highSchoolInformationModel","highSchoolAddressInformation","HighSchoolInformationModel","HighSchoolAddressInformation","stdPerson","contactDetails","PhoneNumber","Number","PhoneNumbers","Addresses","MailingAddress","result","Email","Value","ElectronicAddresses","DoNotContact","demographicData","cusData","employmentInformation","employerNames","ExtraModels","EmploymentInformation","EmployerNames","stdAttempt","termsData","ProcessObjectID","toJS","applicationInformationData","genericMap","ObjectType","ObjectTypeName","StageTypeName","StageBusinessMeaningName","updatedCustomGenericMap","genericData","ACT","SAT","TOEFL","PRAXIS","PRAXISII","GREGeneral","GMAT","genericDataUpdated","submitModel","NewAccountPassword","PersonalInformation","AdmissionsInformation","DemographicInformation","GenericMap","GenericData","TermsData","DataCustom","CallUserCreation","ProcessApplicationInProgress","shouldUpdatePersonalInfo","UpdatePersonInformation","submitData","availableForIncremental","JSON","stringify","access","ApiContainerModel","ValidationTitle","ValidationMessages","TestSections","collegeViewModel","detailedList","responseJSON","Message","UsercreationFail","PersonRecordCreationErrorOkButton","PersonRecordCreationErrorMsg","UserCreatedCallback","CreatePortalUserStatus","basicPersonViewModel","firstName","InitializeOnUserCreated","InitializeAndLoginUser","AjaxPost","PersonFirstName","CheckInclusion","SubmitApplication","BlockContainer","GetPaymentProviderName","PersonGivenName","BaseServiceUrl","BiilingDomicileSettings","PaymentProviders","AttachMakePayment","UnBlockContainer","PaymentProviderSelectionPopup","bodyContent","Name","GenerateHTMLForPaymentMethods","buttonContent","is","removeAttr","selectedPaymentProvider","selectedPaymentProviderId","selectedPaymentProviderName","removeLightbox","worldpaybtnMakePayment","MakePayment","ReviewApplicantChecklist","global","replace","extend","paymentDetails","get","output","RedirectPaymentPageURL","appendTo","submit","xhr","ajaxOptions","isPaymentProviderEnabled"],"sources":["assets/js/viewmodels/admissions/sm.portal.vm.application.js"],"mappings":"CAAA,SAAWA,EAAGC,WACV,IAAIC,GAAKC,OAAOD,GAAKC,OAAOD,IAAM,CAAC,EAYnC,SAASE,uBAGL,IAAIC,KAAOC,KACPC,iBAAmBL,GAAGM,OAAOC,QAAQC,qBACrCC,iBAAmBT,GAAGM,OAAOC,QAAQG,qBACrCC,mBAAqBX,GAAGM,OAAOC,QAAQK,uBACvCC,4BAA8Bb,GAAGM,OAAOC,QAAQO,gCAi5EpD,OAh5EAV,KAAKW,2BAA6BC,GAAGC,WAAW,IAChDb,KAAKc,uBAAyBF,GAAGC,YAAW,GAC5Cb,KAAKe,uBAAyBH,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a,kCACbC,QAAS,CACL,gBAAiB,KAErBC,aAAa,EACbC,aAAa,EACbC,UAAW,CACPC,iBAAiB,GAErBC,QAAS,SAAUC,GACfI,UAAU2O,oBAAoB/O,EAClC,EACAyX,MAAO,SAAUC,GACbtX,UAAU2B,YAAY2V,EAC1B,GAER,CACJ,EAEAva,EAAE2iB,QAAO,EAAMziB,GAAGM,OAAOmB,GAAI,CACzBvB,qBAAsBA,sBAG7B,EAl/ED,CAk/EG0F","ignoreList":[],"sourcesContent":["(function ($, undefined) {\r\n var sm = window.sm = window.sm || {};\r\n\r\n if (typeof sm.portal === \"undefined\") {\r\n $.extend(sm, { portal: {} });\r\n }\r\n if (typeof sm.portal.vm === \"undefined\") {\r\n $.extend(sm.portal, { vm: {} });\r\n }\r\n\r\n /************************************************/\r\n /* Full Application View Model */\r\n /************************************************/\r\n function ApplicationViewModel() {\r\n\r\n // Self-Identification\r\n var self = this;\r\n var ukFeatureEnabled = sm.portal.utility.isUKFeatureEnabled();\r\n var euFeatureEnabled = sm.portal.utility.isEUFeatureEnabled();\r\n var apasFeatureEnabled = sm.portal.utility.isAPASFeatureEnabled();\r\n var conservatoireFeatureEnabled = sm.portal.utility.isConservatoireFeatureEnabled();\r\n this.SummaryInfoMessageTemplate = ko.observable('');\r\n this.SetDemographicRequired = ko.observable(false);\r\n this.AcademicTemplateCustom = ko.observable(false);\r\n this.hidesummarybutton = ko.observable(false);\r\n this.hidePartialText = ko.observable(false);\r\n this.SubmissionText = ko.observable('SubmitApplication0WithReceiptAndInstructions');\r\n this.allCustomData = ko.observable('');\r\n this.isErrorMsgVisible = ko.observable(false);\r\n sm.portal.vm.custom.setCustomLocalizeKey(self);\r\n // Get AdmissionsStage and Milestones\r\n this.GetAdmissionsStage = function (applicationGID) {\r\n var url = _baseApiUri + 'api/StudentPortal/GetAdmissionsStage?gid=' + applicationGID;\r\n $.blockUI();\r\n\r\n $.ajax({\r\n url: url,\r\n type: 'GET',\r\n dataType: 'json',\r\n contentType: 'application/json; charset=utf-8',\r\n headers: {\r\n \"x-api-version\": '1' //,\r\n },\r\n processData: false,\r\n crossDomain: true,\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data, textStatus, jqXHR) {\r\n if (!sm.portal.utility.isNullOrEmpty(data)) {\r\n viewModel.AdmissionsStageID(data.Payload.AdmissionsStageID);\r\n viewModel.Milestones(data.Payload.Milestones);\r\n }\r\n $.unblockUI();\r\n }\r\n });\r\n };\r\n\r\n this.LoadModel = function (container) {\r\n\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n var section = this.Sections()[i];\r\n\r\n switch (section.SectionName()) {\r\n case \"BasicPerson\":\r\n if (container.Person != null) {\r\n try {\r\n\r\n section.SectionModel().FirstName(container.Person.GivenName);\r\n section.SectionModel().MiddleName(container.Person.MiddleName);\r\n section.SectionModel().LastName(container.Person.Surname);\r\n var customSectionData = {\r\n Container: container,\r\n Person : Person,\r\n PreferredGivenName : PreferredGivenName,\r\n Section: section,\r\n }\r\n sm.portal.vm.custom.callCustomization('SetPreferedName', customSectionData);\r\n section.SectionModel().DateOfBirth(container.Person.DateOfBirth);\r\n section.SectionModel().GenderID(container.Person.GenderID);\r\n\r\n } catch (e) { }\r\n }\r\n break;\r\n case \"BasicContact\":\r\n break;\r\n }\r\n\r\n }\r\n\r\n\r\n };\r\n\r\n this.HandleError = function (title, messages) {\r\n this.IsError(true);\r\n if (messages) {\r\n this.ErrorMessages(messages);\r\n }\r\n if (sm.portal.utility.isNullOrEmpty(title)) {\r\n this.ErrorHeader(sm.portal.utility.getResourceValue('ThereWasAnError'));\r\n } else {\r\n this.ErrorHeader(title);\r\n }\r\n };\r\n this.ThrowErrorWithRelevantMessage = function(data, action) {\r\n $.unblockUI();\r\n const userLoggedIn = viewModel && viewModel.GetSectionModel('Account') && viewModel.GetSectionModel('Account').IsLoggedIn();\r\n if (!viewModel.isErrorMsgVisible()) {\r\n viewModel.isErrorMsgVisible(true);\r\n let errorMessage = 'There is an error';\r\n if (userLoggedIn === true && action === 'save') {\r\n if (data && data.status === 0) {\r\n errorMessage = sm.portal.utility.getResourceValue('ErrorMessageOnSaveForInternet');\r\n } else {\r\n errorMessage = sm.portal.utility.getResourceValue('ErrorMessageOnSave');\r\n }\r\n } else if (userLoggedIn === true && action === 'fetch') {\r\n if (data && data.status === 0) {\r\n errorMessage = sm.portal.utility.getResourceValue('ErrorMessageOnFetchForInternet');\r\n } else {\r\n errorMessage = sm.portal.utility.getResourceValue('ErrorMessageOnFetch');\r\n }\r\n } else {\r\n errorMessage = sm.portal.utility.getResourceValue('ErrorMessageNotLoggedIn');\r\n // refresh page automatically\r\n }\r\n var title = sm.portal.utility.getResourceValue('Error');\r\n var body = errorMessage;\r\n var ok = sm.portal.utility.getResourceValue('OK');\r\n sm.portal.ui.lightBox(\r\n title,\r\n body,\r\n 'userCreationFailPopUp',\r\n null,\r\n null,\r\n '',\r\n null,\r\n null,\r\n null,\r\n 'UserCreationFail',\r\n null\r\n );\r\n } \r\n jQuery('#confirmErrorMessage').click(function () {\r\n viewModel.isErrorMsgVisible(false);\r\n viewModel.autoRefresh(userLoggedIn);\r\n });\r\n }\r\n\r\n this.autoRefresh = function(userLoggedIn) {\r\n if (userLoggedIn) {\r\n return;\r\n }\r\n location.reload();\r\n }\r\n\r\n this.AppendNotExistingWarnings = function (newWarnings) {\r\n if (!newWarnings)\r\n return;\r\n\r\n for (var i = 0; i < newWarnings.length; i++) {\r\n if (this.WarningMessages.indexOf(newWarnings[i]) == -1) {\r\n this.WarningMessages.push(newWarnings[i]);\r\n }\r\n }\r\n };\r\n\r\n this.UpdateTermsSections = function () {\r\n\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n var section = this.Sections()[i];\r\n\r\n switch (section.SectionName()) {\r\n case \"BeforeTerms\":\r\n case \"AfterTerms\":\r\n var model = section.SectionModel();\r\n section.Applied(model.ShouldDisplay());\r\n section.Required(model.IsRequired());\r\n break;\r\n }\r\n\r\n }\r\n };\r\n\r\n this.DataTestMode = ko.observable(false);\r\n sm.portal.vm.custom.callCustomization('UpdateTermsSectionsProp', self);\r\n\r\n /**\r\n * Method to get viewmodel data\r\n * This will wait until all viewmodel API data is retrieved\r\n * @param {object} sectionModel \r\n * @param {boolean} blockui \r\n * @param {string} applicationMID \r\n * @param {string} personMID \r\n */\r\n this.GetModelDataWrapper = function (sectionModel, blockui, applicationMID, personMID) {\r\n return new Promise(function (resolve) {\r\n sectionModel.GetModelData(blockui, applicationMID, personMID, function () {\r\n resolve();\r\n });\r\n });\r\n };\r\n\r\n this.IsExceptionalSection = function(ctx){\r\n let secArr = ['Account','BeforeTerms','ApplicationInformation','AfterTerms','HighSchool'];\r\n return secArr.includes(ctx);\r\n }\r\n\r\n this.ConstructData = function(data){\r\n var fullAttempt = data.CompositePayload.FullAttempt.FullAttempt;\r\n var arr = [];\r\n let allListdata = {};\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n allListdata = self.getListData('');\r\n }\r\n var obj = {};\r\n for (const [key, value] of Object.entries(data.CompositePayload)) {\r\n if(key==\"accountSection\"){\r\n obj[\"Account\"] = {};\r\n obj.Account[\"Payload\"] = value;\r\n obj.Account.Payload[\"FullAttempt\"]= fullAttempt;\r\n }\r\n if(key==\"contactSection\"){\r\n obj[\"BasicContact\"] = {};\r\n obj.BasicContact[\"Payload\"] = value;\r\n obj.BasicContact.Payload[\"FullAttempt\"]= fullAttempt;\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n obj.BasicContact.Payload.ListData = allListdata.contact.ListData;\r\n }\r\n \r\n }\r\n \r\n if(key==\"beforetermsSection\"){\r\n obj[\"BeforeTerms\"] = {};\r\n obj.BeforeTerms[\"Payload\"] = value;\r\n obj.BeforeTerms.Payload[\"FullAttempt\"]= fullAttempt;\r\n }\r\n if(key==\"aftertermsSection\"){\r\n obj[\"AfterTerms\"] = {};\r\n obj.AfterTerms[\"Payload\"] = value;\r\n obj.AfterTerms.Payload[\"FullAttempt\"]= fullAttempt;\r\n }\r\n if(key==\"demographicSection\"){\r\n obj[\"Demographic\"] = {};\r\n obj.Demographic[\"Payload\"] = value;\r\n obj.Demographic.Payload[\"FullAttempt\"]= fullAttempt;\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n obj.Demographic.Payload.ListData = allListdata.demographic.ListData;\r\n }\r\n \r\n }\r\n //Employment\r\n if(key==\"employmentSection\"){\r\n obj[\"Employment\"] = {};\r\n obj.Employment[\"Payload\"] = value;\r\n obj.Employment.Payload[\"FullAttempt\"]= fullAttempt;\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n obj.Employment.Payload.ListData = allListdata.employment.ListData;\r\n }\r\n \r\n }\r\n if(key==\"highschoolSection\"){\r\n obj[\"HighSchool\"] = {};\r\n obj.HighSchool[\"Payload\"] = value;\r\n obj.HighSchool.Payload[\"FullAttempt\"]= fullAttempt;\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n obj.HighSchool.Payload.ListData = allListdata.highschool.ListData;\r\n }\r\n \r\n }\r\n if(key==\"personSection\"){\r\n //BasicPerson\r\n obj[\"BasicPerson\"] = {};\r\n obj.BasicPerson[\"Payload\"] = value;\r\n obj.BasicPerson.Payload[\"FullAttempt\"]= fullAttempt;\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n obj.BasicPerson.Payload.ListData = allListdata.person.ListData;\r\n }\r\n \r\n }\r\n // //academicSection\r\n if(key==\"academicSection\"){\r\n obj[\"Academic\"] = {};\r\n obj.Academic[\"Payload\"] = value;\r\n obj.Academic.Payload[\"FullAttempt\"]= fullAttempt;\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n obj.Academic.Payload.ListData = allListdata.academic.ListData;\r\n }\r\n \r\n }\r\n //QualificationsOnEntry\r\n if(key==\"qualificationsSection\"){\r\n obj[\"QualificationsOnEntry\"] = {};\r\n obj.QualificationsOnEntry[\"Payload\"] = value;\r\n obj.QualificationsOnEntry.Payload[\"FullAttempt\"]= fullAttempt;\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n obj.QualificationsOnEntry.Payload.ListData = allListdata.qualifications.ListData;\r\n }\r\n \r\n }\r\n //\r\n if(key==\"languagesSection\"){\r\n obj[\"Languages\"] = {};\r\n obj.Languages[\"Payload\"] = value;\r\n obj.Languages.Payload[\"FullAttempt\"]= fullAttempt;\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n obj.Languages.Payload.ListData = allListdata.languages.ListData;\r\n }\r\n \r\n }\r\n if(key==\"accessibilityneedSection\"){\r\n obj[\"AccessibilityNeed\"] = {};\r\n obj.AccessibilityNeed[\"Payload\"] = value;\r\n obj.AccessibilityNeed.Payload[\"FullAttempt\"]= fullAttempt;\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n obj.AccessibilityNeed.Payload.ListData = allListdata.accessibilityneed.ListData\r\n }\r\n \r\n }\r\n if(key==\"applicationinformationSection\"){\r\n obj[\"ApplicationInformation\"] = {};\r\n obj.ApplicationInformation[\"Payload\"] = value;\r\n obj.ApplicationInformation.Payload[\"FullAttempt\"]= fullAttempt;\r\n if(sm.portal.utility.EnableU4smPortalStaticdataService()){\r\n obj.ApplicationInformation.Payload.ListData = allListdata.applicationinformation.ListData;\r\n }\r\n \r\n }\r\n \r\n }\r\n return obj;\r\n }\r\n \r\n this.getListData = function(sectionName){\r\n var url = sm.portal.utility.U4smPortalStaticdataServiceURL()+\"applynow/allsectionportalstaticdata.json\";\r\n \r\n let listData = {};\r\n \r\n $.ajax({\r\n url: url,\r\n type: 'GET',\r\n dataType: 'json',\r\n async: false,\r\n contentType: 'application/json; charset=utf-8',\r\n headers: {\r\n \"x-api-version\": '1' ,\r\n \"TenantGID\": sm.portal.utility.isTenantAvailable(),\r\n },\r\n processData: false,\r\n crossDomain: true,\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data, textStatus, jqXHR) {\r\n listData = data.CompositePayload;\r\n }\r\n });\r\n return listData;\r\n }\r\n\r\n this.GetAllSection = function(mid){\r\n var data_all = {};\r\n var url = _baseApiUri + 'api/studentportal/GetApplicationAllSection?attemptMID=' + mid;\r\n $.blockUI();\r\n $.ajax({\r\n url: url,\r\n type: 'GET',\r\n dataType: 'json',\r\n async: false,\r\n contentType: 'application/json; charset=utf-8',\r\n headers: {\r\n \"x-api-version\": '1' //,\r\n },\r\n processData: false,\r\n crossDomain: true,\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data, textStatus, jqXHR) {\r\n data_all = self.ConstructData(data);\r\n $.unblockUI();\r\n }\r\n });\r\n return data_all;\r\n }\r\n\r\n // Entry Point Initialization methods\r\n this.Initialize = function (applicationGID, personGID) {\r\n var isReturning = false;\r\n var isUser = false;\r\n // Store the Existing GID if it's there...\r\n if (!sm.portal.utility.isNullOrEmpty(applicationGID)) {\r\n this.GetAdmissionsStage(applicationGID);\r\n this.ApplicationGID(applicationGID);\r\n this.ShowPartialPopup(false); // This is a specific application, don't show the Partial application popup\r\n isReturning = true;\r\n }\r\n\r\n // Store the Person GID if it's there...\r\n if (!sm.portal.utility.isNullOrEmpty(personGID)) {\r\n this.PersonGID(personGID);\r\n isUser = true;\r\n }\r\n\r\n if (!sm.portal.utility.isNullOrEmpty(_currentPersonId) && _currentPersonId > 0) {\r\n this.PersonID(_currentPersonId);\r\n isUser = true;\r\n }\r\n\r\n if(!sm.portal.utility.isNullOrEmpty(sm.portal.vm.custom.callCustomization('loadConsolidatedTemplates'))){\r\n var allData = self.GetAllSection(applicationGID);\r\n self.allCustomData(allData);\r\n }\r\n\r\n // Set the Starting Point for the Sections.\r\n var startingPoint = this.InitializeSections();\r\n\r\n var sectionModelArray = [];\r\n // Start the Data Loading Process\r\n for (var i = 0; i < viewModel.Sections().length; i++) {\r\n if(viewModel.Sections()[i].SectionName() == 'HighSchool') {\r\n self.getHighSchoolIndex(i);\r\n }\r\n if(viewModel.Sections()[i].SectionName() == 'Summary') {\r\n self.getSummaryIndex(i);\r\n }\r\n if(viewModel.Sections()[i].SectionName() == 'Academic') {\r\n self.getAcademicIndex(i);\r\n }\r\n if(!sm.portal.utility.isNullOrEmpty(sm.portal.vm.custom.callCustomization('loadConsolidatedTemplates'))){\r\n if(user_id == 0 && self.IsExceptionalSection(viewModel.Sections()[i].SectionName())) {\r\n var nextSection = viewModel.Sections()[i];\r\n if (!sm.portal.utility.isNullOrEmpty(nextSection.SectionModel()) && !nextSection.SectionModel().DataLoaded() && !nextSection.SectionModel().DataLoading()) {\r\n if (smapi.constant.applicationDebugFlag) { console.log('[SectionModel.Activate] Background Loading ' + nextSection.SectionName()); }\r\n var customData = {\r\n NextSection : nextSection,\r\n ApplicationMID : this.ApplicationMID(),\r\n PersonMID : this.PersonMID(),\r\n }\r\n var isCustomized = sm.portal.vm.custom.callCustomization('GetModelDataForNextSection', customData);\r\n if(!isCustomized){\r\n sectionModelArray.push(self.GetModelDataWrapper(nextSection.SectionModel(), false, this.ApplicationMID(), this.PersonMID())); \r\n }\r\n }\r\n } else {\r\n if(user_id > 0) {\r\n var nextSection = viewModel.Sections()[i];\r\n if (!sm.portal.utility.isNullOrEmpty(nextSection.SectionModel()) && !nextSection.SectionModel().DataLoaded() && !nextSection.SectionModel().DataLoading()) {\r\n if (smapi.constant.applicationDebugFlag) { console.log('[SectionModel.Activate] Background Loading ' + nextSection.SectionName()); }\r\n var customData = {\r\n NextSection : nextSection,\r\n ApplicationMID : this.ApplicationMID(),\r\n PersonMID : this.PersonMID(),\r\n }\r\n \r\n var isCustomized = sm.portal.vm.custom.callCustomization('GetModelDataForNextSection', customData);\r\n if(!isCustomized){\r\n sectionModelArray.push(self.GetModelDataWrapper(nextSection.SectionModel(), false, this.ApplicationMID(), this.PersonMID())); \r\n }\r\n \r\n }\r\n }\r\n }\r\n }else{\r\n var nextSection = viewModel.Sections()[i];\r\n if (!sm.portal.utility.isNullOrEmpty(nextSection.SectionModel()) && !nextSection.SectionModel().DataLoaded() && !nextSection.SectionModel().DataLoading()) {\r\n if (smapi.constant.applicationDebugFlag) { console.log('[SectionModel.Activate] Background Loading ' + nextSection.SectionName()); }\r\n var customData = {\r\n NextSection : nextSection,\r\n ApplicationMID : this.ApplicationMID(),\r\n PersonMID : this.PersonMID(),\r\n }\r\n var isCustomized = sm.portal.vm.custom.callCustomization('GetModelDataForNextSection', customData);\r\n if(!isCustomized){\r\n sectionModelArray.push(self.GetModelDataWrapper(nextSection.SectionModel(), false, this.ApplicationMID(), this.PersonMID())); \r\n }\r\n }\r\n }\r\n }\r\n // Sort the array based on admin configuration\r\n var retainCustomAppearance = sm.portal.vm.custom.callCustomization('RetainCustomAppearance');\r\n if(!retainCustomAppearance){\r\n Promise.all(sectionModelArray).then(function () {\r\n self.Sections().sort(function (a, b) {\r\n return a.AppearanceOrder() - b.AppearanceOrder();\r\n });\r\n self.Sections.valueHasMutated();\r\n });\r\n }\r\n\r\n\r\n // Set the Current to the first\r\n this.ActiveSectionChanged(startingPoint);\r\n\r\n // Show the Splash Screen if needed // TODO: Finish this to look good if we want a splash screen.\r\n if (this.ShowSplashScreen()) {\r\n // Dialog the splash screen div...\r\n $(\"#smApplicationSplash\").dialog({\r\n width: 600,\r\n height: 400,\r\n modal: true,\r\n buttons: {\r\n Ok: function () {\r\n $(this).dialog(\"close\");\r\n }\r\n }\r\n });\r\n }\r\n\r\n // if we have an application gid, then grab the username and switch to the login form\r\n var applicationViewModel = this;\r\n var section = applicationViewModel.GetSectionModel('Account');\r\n\r\n if (!sm.portal.utility.isNullOrEmpty(applicationGID) && !sm.portal.utility.isNullOrEmpty(personGID) && !section.IsLoggedIn()) {\r\n var url = _baseApiUri + 'api/StudentPortal/GetUserFromAttempt?admissionsAttemptGID=' + applicationGID + '&personGID=' + personGID;\r\n $.blockUI();\r\n $.ajax({\r\n url: url,\r\n type: 'GET',\r\n dataType: 'json',\r\n contentType: 'application/json; charset=utf-8',\r\n headers: {\r\n \"x-api-version\": '1' //,\r\n },\r\n processData: false,\r\n crossDomain: true,\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data, textStatus, jqXHR) {\r\n if (!sm.portal.utility.isNullOrEmpty(data)) {\r\n section.ToggleLogin();\r\n section.LoginUserName(data);\r\n }\r\n $.unblockUI();\r\n }\r\n });\r\n }\r\n\r\n if (isReturning) {\r\n setTimeout(function () {\r\n console.log('checking initially');\r\n viewModel.CheckSectionsForInclusion();\r\n }, 1000);\r\n\r\n }\r\n }; \r\n this.InitializeSections = function () {\r\n\r\n if (smapi.constant.applicationDebugFlag) { console.log('[InitializeSections] Firing'); }\r\n \r\n // Models defined in order to take advantage of Test Mode Data\r\n var accountModel = new sm.portal.vm.AccountViewModel();\r\n var personModel = new sm.portal.vm.PersonalInformationViewModel({ getTaxIdRegex: true });\r\n var contactModel = new sm.portal.vm.BasicContactViewModel();\r\n var academicModel = new sm.portal.vm.AcademicInterestsViewModel();\r\n var demographicModel = new sm.portal.vm.DemographicViewModel();\r\n var employmentModel = new sm.portal.vm.EmploymentViewModel();\r\n var collegeModel = new sm.portal.vm.PreviousCollegeViewModel();\r\n var highSchoolModel = new sm.portal.vm.PreviousHighSchoolViewModel();\r\n var testscoreModel = new sm.portal.vm.PlacementTestViewModel();\r\n var beforeTermsModel = new sm.portal.vm.TermsConditionsViewModel(\"BeforeTerms\", \"BeforeTermsContainer\", this);\r\n var afterTermsModel = new sm.portal.vm.TermsConditionsViewModel(\"AfterTerms\", \"AfterTermsContainer\", this);\r\n\r\n // Trigger the Partial lookup if the PersonGID is Set\r\n accountModel.PersonGID.subscribe(function (newValue) {\r\n self.HandlePartialApplications(newValue);\r\n });\r\n\r\n //Force account section to be true\r\n accountModel.IsRequired(true);\r\n\r\n // Account Setup\r\n accountModel.IsUserLoggedIn(); // Trigger the initialization of the Account Model - Special Case.\r\n\r\n // TEST DATA\r\n if (this.DataTestMode()) {\r\n // This is where you can set up test data if you want to run through the app faster.\r\n }\r\n\r\n /** ---Appearance Order---\r\n * The appearance order will be multiplied by 10\r\n * for all core sections. This will give localization\r\n * packages the ability to insert their own sections\r\n * between the exisitng core sections.\r\n */\r\n var appearanceOrder = -1;\r\n\r\n var startingPoint = new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: \"Account\",\r\n SectionTitle: sm.portal.utility.getResourceValue('AccountInformation'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('Account'),\r\n Applied: true,\r\n Required: true,\r\n SectionModel: accountModel,\r\n SectionTemplate: \"AccountTemplate\",\r\n Active: true\r\n });\r\n\r\n // Initial Section\r\n\r\n this.Sections.push(startingPoint);\r\n\r\n var coreSection = [];\r\n // Terms and Conditions Before Section\r\n coreSection.push(new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'BeforeTerms',\r\n SectionTitle: sm.portal.utility.getResourceValue('BeforeTerms'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('BeforeTerms'),\r\n Applied: false,\r\n Required: false,\r\n Completed: false,\r\n SectionModel: beforeTermsModel,\r\n SectionTemplate: \"BeforeTermsTemplate\",\r\n }));\r\n\r\n // Personal\r\n coreSection.push(new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'BasicPerson',\r\n SectionTitle: sm.portal.utility.getResourceValue('PersonalInformation'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('Personal'),\r\n Applied: true,\r\n Required: true,\r\n SectionModel: personModel,\r\n SectionTemplate: \"BasicPersonTemplate\",\r\n Active: true\r\n }));\r\n\r\n // Contact\r\n coreSection.push(new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'BasicContact',\r\n SectionTitle: sm.portal.utility.getResourceValue('ContactDetails'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('Contact'),\r\n Applied: true,\r\n Required: true,\r\n SectionModel: contactModel,\r\n SectionTemplate: \"BasicContactTemplate\"\r\n }));\r\n \r\n // Academic Interests \r\n coreSection.push(new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'Academic',\r\n SectionTitle: sm.portal.utility.getResourceValue('AcademicGoals'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('Academic'),\r\n Applied: true,\r\n Required: true,\r\n SectionModel: academicModel,\r\n SectionTemplate: \"AcademicTemplate\"\r\n }));\r\n\r\n // Demographic Information\r\n coreSection.push(new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'Demographic',\r\n SectionTitle: sm.portal.utility.getResourceValue('DemographicInformation'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('Demographic'),\r\n Applied: true,\r\n Required: self.SetDemographicRequired(),\r\n SectionModel: demographicModel,\r\n SectionTemplate: \"DemographicTemplate\"\r\n }));\r\n\r\n // Employment Information\r\n coreSection.push(new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'Employment',\r\n SectionTitle: sm.portal.utility.getResourceValue('EmploymentDetails'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('Employment'),\r\n Applied: true,\r\n Completed: false,\r\n Required: false,\r\n SectionModel: employmentModel,\r\n SectionTemplate: \"EmploymentTemplate\"\r\n }));\r\n\r\n // Previous High School\r\n coreSection.push(new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'HighSchool',\r\n SectionTitle: sm.portal.utility.getResourceValue('HighSchool'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('HighSchool'),\r\n Required: true,\r\n SectionModel: highSchoolModel,\r\n SectionTemplate: \"HighSchoolTemplate\"\r\n }));\r\n \r\n // Previous College\r\n coreSection.push(new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'College',\r\n SectionTitle: sm.portal.utility.getResourceValue('PreviousCollege'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('College'),\r\n Required: false,\r\n SectionModel: collegeModel,\r\n SectionTemplate: \"CollegeTemplate\"\r\n }));\r\n\r\n // Test Scores\r\n coreSection.push(new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'TestScore',\r\n SectionTitle: sm.portal.utility.getResourceValue('TestScores'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('TestScores'),\r\n Required: false,\r\n SectionModel: testscoreModel,\r\n SectionTemplate: \"TestScoreTemplate\"\r\n }));\r\n\r\n this.LastSectionName('TestScore');\r\n\r\n\r\n // Terms and Conditions After Section\r\n coreSection.push(new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'AfterTerms',\r\n SectionTitle: sm.portal.utility.getResourceValue('AfterTerms'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('AfterTerms'),\r\n Applied: false,\r\n Required: false,\r\n Completed: false,\r\n SectionModel: afterTermsModel,\r\n SectionTemplate: \"AfterTermsTemplate\"\r\n }));\r\n\r\n var summarySection = new sm.portal.vm.ApplicationSectionModel({\r\n AppearanceOrder: ((++appearanceOrder) * 10),\r\n SectionName: 'Summary',\r\n SectionTitle: sm.portal.utility.getResourceValue('Summary'),\r\n SectionNavTitle: sm.portal.utility.getResourceValue('Summary'),\r\n Applied: true,\r\n Required: true,\r\n Completed: false,\r\n SectionModel: new sm.portal.vm.SummaryViewModel(),\r\n SectionTemplate: \"SummaryTemplate\"\r\n });\r\n\r\n coreSection.push(summarySection);\r\n this.SummarySection(summarySection);\r\n var section = sm.portal.vm.custom.callCustomization('RemoveEmplymentSection', coreSection);\r\n if (section != undefined) {\r\n coreSection = section;\r\n }\r\n\r\n if (typeof sm.portal.vm.ukapplication !== 'undefined' && ukFeatureEnabled) {\r\n coreSection = sm.portal.vm.ukapplication.InitializeSections(this, coreSection);\r\n } else if (typeof sm.portal.vm.euapplication !== 'undefined' && euFeatureEnabled) {\r\n coreSection = sm.portal.vm.euapplication.InitializeSections(this, coreSection);\r\n } else if (typeof sm.portal.vm.apasapplication !== 'undefined' && apasFeatureEnabled) {\r\n coreSection = sm.portal.vm.apasapplication.InitializeSections(this, coreSection);\r\n }\r\n\r\n if (typeof sm.portal.vm.conservatoireapplication !== 'undefined' && conservatoireFeatureEnabled) {\r\n coreSection = sm.portal.vm.conservatoireapplication.InitializeSections(this, coreSection);\r\n }\r\n\r\n sm.portal.vm.custom.callCustomization('UpdateSections',coreSection);\r\n\r\n coreSection.sort(function (a, b) { return a.AppearanceOrder() - b.AppearanceOrder(); });\r\n this.Sections(self.Sections().concat(coreSection));\r\n\r\n return startingPoint;\r\n };\r\n this.MaintainSections = function (sectionsToAdd, sectionsToRemove) {\r\n if (sectionsToAdd != null && sectionsToAdd != undefined) {\r\n\r\n // Loop through the sections, updating the Applied value.\r\n for (var j = 0; j < sectionsToAdd.length; j++) {\r\n var addObj = sectionsToAdd[j];\r\n\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n if (this.Sections()[i].SectionName() == addObj.section) {\r\n if (smapi.constant.applicationDebugFlag) { console.log('Applying Section ' + addObj.section); }\r\n\r\n this.Sections()[i].Applied(true);\r\n this.Sections()[i].Required(addObj.required);\r\n\r\n // This would be a great spot to refresh any caches from the services\r\n if (!this.Sections()[i].SectionModel().DataLoaded() && !this.Sections()[i].SectionModel().DataLoading()) {\r\n this.Sections()[i].SectionModel().GetModelData(false, this.ApplicationMID(), this.PersonMID());\r\n }\r\n\r\n if (this.Sections()[i].SectionModel().UpdateData != undefined && this.Sections()[i].SectionModel().UpdateData()) {\r\n this.Sections()[i].SectionModel().GetModelData(false, this.ApplicationMID(), this.PersonMID());\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if (sectionsToRemove != null && sectionsToRemove != undefined) {\r\n for (var j = 0; j < sectionsToRemove.length; j++) {\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n if (this.Sections()[i].SectionName() == sectionsToRemove[j]) {\r\n if (smapi.constant.applicationDebugFlag) { console.log('Un-Applying Section ' + sectionsToRemove[j]); }\r\n this.Sections()[i].Applied(false);\r\n this.Sections()[i].Required(false); // If it's not applied, it's not required - issue on Graduate Level apps for High School...\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n // Helper Properties\r\n this.TemplatesLoaded = ko.observable(false);\r\n this.BaseU4SMUrl = ko.observable();\r\n this.ShowPartialData = ko.observable(false);\r\n this.ShowPartialPopup = ko.observable(true);\r\n\r\n // Application Properties\r\n this.ApplicationID = ko.observable();\r\n this.ApplicationGID = ko.observable();\r\n this.PersonID = ko.observable();\r\n this.PersonGID = ko.observable();\r\n this.ApplicationMID = ko.computed(function () {\r\n if (!sm.portal.utility.isNullOrEmpty(this.ApplicationGID())) {\r\n return this.ApplicationGID();\r\n } else if (!sm.portal.utility.isNullOrEmpty(this.ApplicationID())) {\r\n return this.ApplicationID();\r\n }\r\n return \"\";\r\n }, this);\r\n this.PersonMID = ko.computed(function () {\r\n\r\n if (!sm.portal.utility.isNullOrEmpty(this.PersonGID())) {\r\n return this.PersonGID();\r\n } else if (!sm.portal.utility.isNullOrEmpty(this.PersonID())) {\r\n return this.PersonID();\r\n }\r\n return \"\";\r\n }, this);\r\n\r\n this.AdmissionsStageID = ko.observable();\r\n this.Milestones = ko.observableArray();\r\n this.DisclaimerText = ko.observable();\r\n this.IsDisclaimerTextEmpty = ko.observable(false);\r\n \r\n // Section Properties\r\n this.CurrentSection = ko.observable();\r\n this.SummarySection = ko.observable();\r\n this.LastSectionName = ko.observable();\r\n this.ShowSplashScreen = ko.observable(false); // TODO: If we want to implement a splash screen dialog, change this to TRUE and look inside this.Initialize();\r\n this.IsCreateUserProcessRunning = ko.observable(false);\r\n\r\n // App Fee Notification Properties\r\n this.HasApplicationFee = ko.observable(false);\r\n this.ApplicationFeeRequired = ko.observable(false);\r\n this.AdmissionsAcademicLevelFees = ko.observableArray();\r\n this.ShowUserCreatedNotification = ko.observable(false);\r\n\r\n // Results\r\n this.Saved = ko.observable(false);\r\n this.Saving = ko.observable(false);\r\n this.HasBeenSaved = ko.observable();\r\n this.Submitted = ko.observable(false);\r\n this.Result_PersonGivenName = ko.observable();\r\n this.IsPaymentProviderEnabled = ko.observable(false);\r\n this.PaymentProviderName = ko.observable();\r\n this.PaymentDetails = ko.observable();\r\n this.WarningMessages = ko.observableArray();\r\n sm.portal.vm.custom.callCustomization('UpdateProps', self);\r\n sm.portal.vm.custom.callCustomization('PebblePadFunctionality', self);\r\n\r\n //Domicile related observables\r\n this.IsBillingDomicileMappingCorrect = ko.observable(false);\r\n this.BillingDomicileMessage = ko.observable(\"\");\r\n this.IsBillingDomicilePaymentProviderEnabled = ko.observable(false);\r\n this.BillingDomicilePaymentProviders = ko.observableArray();\r\n this.PartialPaymentAmount = ko.observable();\r\n this.MinimumAmountForPayments = ko.observable();\r\n this.EnablePartialPayment = ko.observable();\r\n this.PaymentProviderID = ko.observable();\r\n\r\n // Calculated Sections Properties - Identifies what sections are required, and what has been handled\r\n this.Sections = ko.observableArray();\r\n this.AppliedSections = ko.computed(function () {\r\n var results = Array();\r\n\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n\r\n if (this.Sections()[i].Applied() == true) {\r\n results.push(this.Sections()[i]);\r\n }\r\n }\r\n\r\n return results;\r\n }, this);\r\n\r\n this.UnappliedSections = ko.computed(function () {\r\n var results = Array();\r\n\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n\r\n if (this.Sections()[i].Applied() != true) {\r\n results.push(this.Sections()[i]);\r\n }\r\n }\r\n\r\n return results;\r\n }, this);\r\n this.CompletedSections = ko.computed(function () {\r\n var results = Array();\r\n\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n if (this.Sections()[i].Applied() == true && this.Sections()[i].Completed() == true) {\r\n results.push(this.Sections()[i]);\r\n }\r\n }\r\n\r\n return results;\r\n }, this);\r\n this.IncompleteSections = ko.computed(function () {\r\n var results = Array();\r\n\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n\r\n if (this.Sections()[i].Applied() == true && this.Sections()[i].Completed() != true) {\r\n results.push(this.Sections()[i]);\r\n }\r\n }\r\n\r\n return results;\r\n }, this);\r\n\r\n // Summary sections having applied sections only\r\n this.SummarySections = ko.computed(function () {\r\n var results = Array();\r\n var appliedSections = this.AppliedSections();\r\n for (var i = 0; i < appliedSections.length; i++) {\r\n var section = appliedSections[i];\r\n if (section.SectionName() !== \"Account\" && section.SectionName() !== \"Summary\") {\r\n results.push(appliedSections[i]);\r\n }\r\n }\r\n return results;\r\n }, this);\r\n\r\n // Current Section Computed Properties\r\n this.CurrentSectionName = ko.computed(function () {\r\n if (sm.portal.utility.isNullOrEmpty(this.CurrentSection())) {\r\n return \"\";\r\n }\r\n return this.CurrentSection().SectionName();\r\n }, this);\r\n this.CurrentSectionTitle = ko.computed(function () {\r\n if (sm.portal.utility.isNullOrEmpty(this.CurrentSection())) {\r\n return \"\";\r\n }\r\n return this.CurrentSection().SectionTitle();\r\n }, this);\r\n this.CurrentSectionCount = ko.computed(function () {\r\n if (sm.portal.utility.isNullOrEmpty(this.CurrentSection())) {\r\n return \"\";\r\n }\r\n return sm.portal.utility.formatString(\"{0} of {1}\", this.CurrentSection().SectionIndex(), this.AppliedSections().length);\r\n }, this);\r\n this.SubmitAvailable = ko.computed(function () {\r\n\r\n if (smapi.constant.applicationDebugFlag) { return true; }\r\n\r\n for (var i = 0; i < this.AppliedSections().length; i++) {\r\n if (this.AppliedSections()[i].SectionName() != \"Summary\"\r\n && (this.AppliedSections()[i].Required() == true && this.AppliedSections()[i].Completed() != true)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n\r\n }, this);\r\n this.SummaryVisible = ko.computed(function () {\r\n return this.CurrentSectionName() == \"Summary\";\r\n }, this);\r\n this.SummaryAvailable = ko.computed(function () {\r\n if (smapi.constant.applicationDebugFlag) { return true; }\r\n \r\n var results = Array();\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n if (this.Sections()[i].SectionName() != 'Summary' &&\r\n (this.Sections()[i].Required() == true && this.Sections()[i].Completed() != true)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }, this);\r\n this.ApplicationFeeMessageShown = ko.computed(function () {\r\n\r\n if (!this.HasApplicationFee()) {\r\n return false;\r\n }\r\n\r\n if (this.HasApplicationFee()) {\r\n if (this.CurrentSectionName() == \"Account\") {\r\n return true;\r\n }\r\n return false;\r\n }\r\n return false;\r\n }, this);\r\n this.ApplicationFeeAmount = ko.computed(function () {\r\n var msg = \"\";\r\n var feeCount = this.AdmissionsAcademicLevelFees().length;\r\n\r\n for (i = 0; i < feeCount; i++) {\r\n msg += this.AdmissionsAcademicLevelFees()[i];\r\n\r\n if (i !== feeCount - 1) {\r\n msg += \", \";\r\n }\r\n }\r\n\r\n return msg;\r\n }, this);\r\n\r\n this.firstLoad = ko.observable(true);\r\n this.getHighSchoolIndex = ko.observable(0);\r\n this.getSummaryIndex = ko.observable(0);\r\n this.getAcademicIndex = ko.observable(0);\r\n\r\n // Event Change Handler\r\n this.ActiveSectionChanged = function (activeSection) {\r\n\r\n var workspace = $(\"#TestContainer\");\r\n if (workspace.length > 0) {\r\n workspace.block({ message: sm.portal.utility.getResourceValue('Loading') });\r\n $(\"div.blockUI.blockMsg.blockElement\").show();\r\n }\r\n\r\n // Set the Previous Section\r\n var previousSection = this.CurrentSection();\r\n var customData = {\r\n PreviousSection: previousSection,\r\n ActiveSection: activeSection,\r\n self : self,\r\n workspace : workspace\r\n }\r\n \r\n var nextSection = sm.portal.vm.custom.callCustomization('UpdateActiveSectionChanged', customData);\r\n\r\n if(!sm.portal.utility.isNullOrEmpty(sm.portal.vm.custom.callCustomization('loadConsolidatedTemplates'))){\r\n if(!sm.portal.utility.isNullOrEmpty(previousSection)) {\r\n if(parseInt(previousSection.SectionIndex()) + 1 == self.getSummaryIndex()) {\r\n this.Sections()[self.getSummaryIndex()].SectionModel().GetModelData(false, this.ApplicationMID(), this.PersonMID());\r\n }\r\n if(parseInt(previousSection.SectionIndex()) + 1 == self.getAcademicIndex()) {\r\n this.Sections()[self.getAcademicIndex()].SectionModel().GetModelData(false, this.ApplicationMID(), this.PersonMID());\r\n }\r\n }\r\n }\r\n \r\n if(!sm.portal.utility.isNullOrEmpty(nextSection)){\r\n return false;\r\n }\r\n // Background process any server actions for the previous section\r\n if (previousSection != null && previousSection.Completed()) {\r\n try {\r\n previousSection.SectionModel().ProcessOnServer();\r\n } catch (e) { }\r\n }\r\n\r\n // Send the Application to the Server for in-process caching/saving\r\n try {\r\n this.PerformApplicationAutoSave();\r\n } catch (e) {\r\n var cusdata = { \r\n viewModel : viewModel,\r\n e : e\r\n }\r\n //Required console to check which section throws an error\r\n console.log(\"error is===>\" + e.message);\r\n sm.portal.vm.custom.callCustomization('UpdateIsUserCreateProp', cusdata);\r\n }\r\n\r\n // Find the Current Section in the list\r\n var currentSection = null;\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n\r\n if (this.Sections()[i].SectionName() != activeSection.SectionName()) {\r\n this.Sections()[i].Active(false);\r\n }\r\n }\r\n\r\n // Set the Current Section\r\n this.CurrentSection(activeSection);\r\n this.CurrentSection().Activate();\r\n\r\n setTimeout(function () {\r\n if (workspace.length > 0) {\r\n workspace.unblock();\r\n }\r\n }, 500);\r\n\r\n\r\n if (this.firstLoad() == false) {\r\n jQuery('html,body').animate({\r\n scrollTop: jQuery('.smContentArea').offset().top\r\n }, 500);\r\n }\r\n else {\r\n this.firstLoad(false);\r\n }\r\n\r\n if (activeSection.SectionName() !== \"TestScore\") {\r\n $(\"#cancelACTItem\").trigger(\"click\");\r\n $(\"#cancelSATItem\").trigger(\"click\");\r\n }\r\n\r\n if (activeSection.SectionName() === \"Academic\" && activeSection.SectionModel().FirstLoad()) {\r\n\r\n ko.validation.group(activeSection.SectionModel()).showAllMessages(false);\r\n activeSection.SectionModel().FirstLoad(false);\r\n }\r\n\r\n if (activeSection.SectionName() === \"BasicContact\") {\r\n activeSection.SectionModel().Display();\r\n }\r\n var custData = {\r\n previousSection : previousSection,\r\n self : self\r\n }\r\n sm.portal.vm.custom.callCustomization('ResetProgrammeCategory', custData);\r\n };\r\n\r\n // Loads data between Sections\r\n this.LoadChildData = function (target, property, data) {\r\n\r\n // Find the matching Target\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n if (this.Sections()[i].SectionName() == target) {\r\n\r\n // Attempt to set the Property via Eval\r\n try {\r\n var cmd = \"this.Sections()[i].SectionModel().\" + property + \"(data);\";\r\n eval(cmd);\r\n\r\n } catch (e) {\r\n if (smapi.constant.applicationDebugFlag) { console.log('Problem setting Child Data for ' + target + ', ' + property + ': ' + e.message); }\r\n }\r\n break;\r\n }\r\n }\r\n };\r\n // Retrieves the specified Section's application section model\r\n this.GetApplicationSectionModel = function (sectionName) {\r\n var appSectionModel = null;\r\n for (var i = 0; i < self.Sections().length; i++) {\r\n if (self.Sections()[i].SectionName() == sectionName) {\r\n appSectionModel = self.Sections()[i];\r\n break;\r\n }\r\n }\r\n return appSectionModel;\r\n };\r\n\r\n // Retrieves the specified Section's model\r\n this.GetSectionModel = function (sectionName) {\r\n\r\n var sectionModel = null;\r\n for (var i = 0; i < self.Sections().length; i++) {\r\n if (self.Sections()[i].SectionName() == sectionName) {\r\n sectionModel = self.Sections()[i].SectionModel();\r\n break;\r\n }\r\n }\r\n return sectionModel;\r\n };\r\n this.GetSectionTitle = function (sectionName) {\r\n\r\n var sectionTitle = null;\r\n for (var i = 0; i < self.Sections().length; i++) {\r\n if (self.Sections()[i].SectionName() == sectionName) {\r\n sectionTitle = self.Sections()[i].SectionTitle();\r\n break;\r\n }\r\n }\r\n return sectionTitle;\r\n };\r\n this.GetSectionNavClass = function (sectionName) {\r\n\r\n var sectionNavClass = null;\r\n for (var i = 0; i < self.Sections().length; i++) {\r\n if (self.Sections()[i].SectionName() == sectionName) {\r\n sectionNavClass = self.Sections()[i].NavigationClass();\r\n break;\r\n }\r\n }\r\n return sectionNavClass;\r\n };\r\n\r\n // Loads the Data from the Sections into the Summary\r\n this.LoadSummaryData = function () {\r\n var summaryDataModel = this.SummarySection().SectionModel();\r\n\r\n for (var i = 0; i < this.AppliedSections().length; i++) {\r\n var theName = this.AppliedSections()[i].SectionName();\r\n var theData = this.AppliedSections()[i].SectionModel();\r\n // Academic section available options data is not fetched at the load of page\r\n // Get academic section data from GetAdmissionsOfferingMatrix API \r\n // if admissions attempt present but options not present\r\n if(theName == 'Academic' && theData.AdmissionsProgramID() && !theData.AdmissionsPrograms().length){\r\n this.AppliedSections()[i].SectionModel().Initialize();\r\n }\r\n\r\n summaryDataModel.LoadSection(this.AppliedSections()[i].SectionName(), this.AppliedSections()[i].SectionModel());\r\n }\r\n summaryDataModel.LoadModel(null);\r\n jQuery('.sectionLink').first().focus();\r\n };\r\n\r\n // Navigates to a specific Section via Summary Page.\r\n this.NavigateToSection = function (sectionName) {\r\n var matched = null;\r\n for (var i = 0; i < this.AppliedSections().length; i++) {\r\n if (this.AppliedSections()[i].SectionName() == sectionName) {\r\n matched = this.AppliedSections()[i];\r\n break;\r\n }\r\n }\r\n var customData = {\r\n matched : matched,\r\n self : self\r\n }\r\n var res = sm.portal.vm.custom.callCustomization('CustomNavigateToSection', customData);\r\n if(sm.portal.utility.isNullOrEmpty(res)){\r\n if (matched != null && this.CanAdvanceAfterTerms(this.CurrentSection())) {\r\n this.ActiveSectionChanged(matched);\r\n }\r\n }\r\n \r\n };\r\n // Update the sections configuration data\r\n this.SetSectionsConfigData = function (sectionName, configData, isDynamicSection) {\r\n if (sectionName && configData) {\r\n var appSection = this.GetApplicationSectionModel(sectionName);\r\n appSection && appSection.SetSectionsConfigData(configData, isDynamicSection);\r\n }\r\n }\r\n\r\n // Triggers the Form Validation setup for dynamic bits\r\n this.SetRequired = function () {\r\n if (!sm.portal.utility.isNullOrEmpty(this.CurrentSection())) {\r\n this.CurrentSection().Required();\r\n }\r\n };\r\n\r\n this.CanAdvanceAfterTerms = function (section) {\r\n // Check for Terms and Conditions should the pop-up be shown\r\n if (section != null && section.Applied()\r\n && (section.SectionName() == \"BeforeTerms\" || section.SectionName() == \"AfterTerms\")) {\r\n\r\n if (!section.Completed()) {\r\n var title = sm.portal.utility.getResourceValue('Warning');\r\n var body = sm.portal.utility.getResourceValue('TermsNotAccepted');\r\n\r\n sm.portal.ui.lightBox(title, body, ' smallDialog');\r\n return false;\r\n }\r\n else {\r\n var title = sm.portal.utility.getResourceValue('TermsConditions');\r\n var body = section.SectionModel().TermsMessage();\r\n var ok = sm.portal.utility.getResourceValue('OK');\r\n\r\n sm.portal.ui.lightBox(title,\r\n body,\r\n ' smallDialog',\r\n null,\r\n null,\r\n '');\r\n return true;\r\n }\r\n }\r\n\r\n return true;\r\n };\r\n\r\n // Not sure if my way of doing this is appropriate, but here they are (please refactor if needed!)\r\n this.SetFocus = function () {\r\n var res = sm.portal.vm.custom.callCustomization('CustomSetFocus', self);\r\n if(!sm.portal.utility.isNullOrEmpty(res)){\r\n return;\r\n }\r\n if (self.CurrentSectionName() == 'Account') {\r\n return;\r\n }\r\n\r\n var iOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);\r\n\r\n if (iOS == false) {\r\n $('.templateContainer').find('.displayHeader').first().each(function () {\r\n var that = $(this);\r\n var isButton = (that.find('button').length > 0);\r\n if (isButton) {\r\n that.find('button').focus();\r\n }\r\n });\r\n // This script is pretty basic, but it works for the current scenario - could be better.\r\n $('.templateContainer form').find('.field').first().each(function () {\r\n var that = $(this);\r\n var isSelect = (that.find('select').length > 0);\r\n var isComboBox = (that.find('.comboSearch').length > 0);\r\n\r\n if (isSelect) {\r\n that.find('select').focus();\r\n }\r\n\r\n else if (isComboBox) {\r\n if (that.next('.field').find('select').length > 0) {\r\n that.next('.field').find('select').focus();\r\n }\r\n else {\r\n that.next('.field').find('input').not(':hidden').focus();\r\n }\r\n }\r\n else {\r\n that.find('input').not(':hidden').focus();\r\n }\r\n });\r\n }\r\n };\r\n\r\n this.CanCrateUser = ko.computed(function () {\r\n if (this.IsCreateUserProcessRunning() || !this.Sections || this.Sections().length === 0) {\r\n return false;\r\n }\r\n \r\n var sectionsArray = this.Sections();\r\n var neededSectionArray = ['Account', 'BasicPerson'];\r\n sm.portal.vm.custom.callCustomization('UpdateSectionArray', neededSectionArray);\r\n \r\n for (var i = 0; i < sectionsArray.length; i++) {\r\n if (neededSectionArray.indexOf(sectionsArray[i].SectionName()) > -1) {\r\n if (!sectionsArray[i].SectionModel().IsVMValid()) {\r\n return false;\r\n }\r\n\r\n if (sectionsArray[i].SectionName() === 'Account' && sectionsArray[i].SectionModel().IsLoggedIn()) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n }, this);\r\n\r\n // Navigation Controls\r\n this.NextButtonEnabled = ko.computed(function () {\r\n // Find the Current Position\r\n var isAvailable = true;\r\n var currentIndex = 999;\r\n var nextIndex = -1;\r\n var atLastSection = false;\r\n\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n if (this.Sections()[i].SectionName() == this.CurrentSectionName()) {\r\n currentIndex = i;\r\n }\r\n else if (i > currentIndex && this.Sections()[i].Applied()) {\r\n nextIndex = i;\r\n }\r\n\r\n // Break if got both\r\n if (currentIndex < 999 && nextIndex > -1) {\r\n break;\r\n }\r\n }\r\n\r\n if (smapi.constant.applicationDebugFlag) {\r\n console.log('[Next-To-Last] Completed: ' + this.CompletedSections().length);\r\n console.log('[Next-To-Last] Incompleted: ' + this.IncompleteSections().length);\r\n console.log('[Next-To-Last] Applied: ' + this.AppliedSections().length);\r\n console.log('[Next-To-Last] Unapplied: ' + this.UnappliedSections().length);\r\n }\r\n\r\n if (nextIndex == this.Sections().length - 1) {\r\n\r\n // We're on the next-to-last section before the summary,\r\n // check for Completion\r\n\r\n isAvailable = true; // this.SummaryAvailable();\r\n\r\n } else if (nextIndex >= this.Sections().length) {\r\n isAvailable = false;\r\n }\r\n var customData = {\r\n self: self,\r\n currentIndex: currentIndex,\r\n isAvailable: isAvailable\r\n }\r\n \r\n if (currentIndex == 0) {\r\n // We're on the very first section - depending on the security requirements, we may\r\n // need to verify passwords match before allowing the applicant to continue.\r\n isAvailable = (self.Sections()[0].AllowNext() || self.Sections()[0].SectionModel().IsLoggedIn());\r\n }\r\n\r\n var available = sm.portal.vm.custom.callCustomization('CustomizeNextButtonEnabled', customData); \r\n\r\n if(!sm.portal.utility.isNullOrEmpty(available)){\r\n if(available!=999){\r\n isAvailable = available;\r\n }\r\n }\r\n\r\n if (smapi.constant.applicationDebugFlag) { console.log('[NextButtonEnabled] returning ' + isAvailable); }\r\n return isAvailable;\r\n\r\n }, this);\r\n this.PreviousButtonEnabled = ko.computed(function () {\r\n\r\n // Find the Current Position\r\n var isAvailable = true;\r\n var currentIndex = 999;\r\n var previousIndex = -1;\r\n\r\n for (var i = this.Sections().length - 1; i > -1; i--) {\r\n if (this.Sections()[i].SectionName() == this.CurrentSectionName()) {\r\n currentIndex = i;\r\n if (smapi.constant.applicationDebugFlag) { console.log('[PreviousButtonEnabled] Got Current Index: ' + currentIndex); }\r\n }\r\n else if (currentIndex < 999 && this.Sections()[i].Applied()) {\r\n previousIndex = i;\r\n if (smapi.constant.applicationDebugFlag) { console.log('[PreviousButtonEnabled] Got Previous Index: ' + previousIndex); }\r\n }\r\n\r\n // Break if got both\r\n if (currentIndex < 999 && previousIndex > -1) {\r\n break;\r\n }\r\n }\r\n\r\n if (previousIndex < 0) {\r\n isAvailable = false;\r\n }\r\n\r\n if (smapi.constant.applicationDebugFlag) { console.log('[PreviousButtonEnabled] returning ' + isAvailable); }\r\n return isAvailable;\r\n\r\n }, this);\r\n\r\n // Navigation Handlers\r\n this.MoveToNextSection = function () {\r\n var isLoggedIn = this.Sections()[0].SectionModel().IsLoggedIn();\r\n\r\n if (smapi.constant.applicationDebugFlag) { console.log('[MoveToNextSection] Click Fired'); }\r\n\r\n var accountViewModel = viewModel.GetSectionModel('Account');\r\n if (accountViewModel != null) {\r\n var newPassword = jQuery(\"#NewAccountPassword\").val();\r\n var regularExpressionString = accountViewModel.PasswordRegex();\r\n var regularExpression = new RegExp(regularExpressionString);\r\n var minNumberofChars = accountViewModel.PasswordMinLength();;\r\n if (newPassword != undefined && !isLoggedIn) {\r\n if (newPassword.length < minNumberofChars) {\r\n $.unblockUI();\r\n return;\r\n }\r\n if (!regularExpression.test(newPassword)) {\r\n $.unblockUI();\r\n return;\r\n }\r\n }\r\n }\r\n\r\n if(sm.portal.utility.isNullOrEmpty(sm.portal.vm.custom.callCustomization(\"CanAdvanceAfterTermsHide\")) && !this.CanAdvanceAfterTerms(this.CurrentSection())){\r\n return;\r\n }\r\n\r\n // Handle the move to the next applied section\r\n var nextSectionObj = null;\r\n var currentIndex = 999;\r\n var nextIndex = -1;\r\n\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n if (this.Sections()[i].SectionName() == this.CurrentSectionName()) {\r\n currentIndex = i;\r\n }\r\n else if (i > currentIndex && this.Sections()[i].Applied()) {\r\n nextSectionObj = this.Sections()[i];\r\n nextIndex = i;\r\n }\r\n\r\n // Break if got both\r\n if (currentIndex < 999 && nextIndex > -1) {\r\n break;\r\n }\r\n }\r\n\r\n if (nextSectionObj != null) {\r\n var customData = {\r\n nextSectionObj : nextSectionObj,\r\n self : self\r\n }\r\n sm.portal.vm.custom.callCustomization('CustomMovetoNextSection', customData);\r\n if (nextSectionObj.SectionName() == 'Summary') {\r\n if (this.SubmitAvailable()) {\r\n nextSectionObj.Active(true);\r\n this.ActiveSectionChanged(nextSectionObj);\r\n } else {\r\n alert(sm.portal.utility.getResourceValue('NotAllStepsComplete'));\r\n // Alert the user there are uncompleted steps\r\n }\r\n } else {\r\n nextSectionObj.Active(true);\r\n this.ActiveSectionChanged(nextSectionObj);\r\n if(nextSectionObj.SectionName() == 'HighSchool' && sm.portal.utility.isAPASFeatureEnabled()){\r\n nextSectionObj.SectionModel().Completed(true);\r\n }\r\n }\r\n }\r\n\r\n if (typeof sm.portal.vm.ukapplication !== 'undefined' && ukFeatureEnabled) {\r\n sm.portal.vm.ukapplication.MoveToNextSection(this, nextSectionObj);\r\n } else if (typeof sm.portal.vm.euapplication !== 'undefined' && euFeatureEnabled) {\r\n sm.portal.vm.euapplication.MoveToNextSection(this, nextSectionObj);\r\n } else if (typeof sm.portal.vm.apasapplication !== 'undefined' && apasFeatureEnabled) {\r\n sm.portal.vm.apasapplication.MoveToNextSection(this, nextSectionObj);\r\n }\r\n\r\n if (typeof sm.portal.vm.conservatoireapplication !== 'undefined' && conservatoireFeatureEnabled) {\r\n sm.portal.vm.conservatoireapplication.MoveToNextSection(this, nextSectionObj);\r\n }\r\n\r\n };\r\n this.MoveToPreviousSection = function () {\r\n if (smapi.constant.applicationDebugFlag) { console.log('[MoveToPreviousSection] Click Fired'); }\r\n\r\n if(sm.portal.utility.isNullOrEmpty(sm.portal.vm.custom.callCustomization(\"CanAdvanceAfterTermsHide\")) && !this.CanAdvanceAfterTerms(this.CurrentSection())){\r\n return;\r\n }\r\n\r\n var prevSectionObj = null;\r\n var currentIndex = 999;\r\n var prevIndex = -1;\r\n\r\n for (var i = this.Sections().length - 1; i > -1; i--) {\r\n if (this.Sections()[i].SectionName() == this.CurrentSectionName()) {\r\n currentIndex = i;\r\n }\r\n else if (currentIndex < 999 && this.Sections()[i].Applied()) {\r\n prevSectionObj = this.Sections()[i];\r\n prevIndex = i;\r\n }\r\n\r\n // Break if got both\r\n if (currentIndex < 999 && prevIndex > -1) {\r\n break;\r\n }\r\n }\r\n\r\n if (prevSectionObj != null) {\r\n prevSectionObj.Active(true);\r\n this.ActiveSectionChanged(prevSectionObj);\r\n if(prevSectionObj.SectionName() == 'HighSchool' && sm.portal.utility.isAPASFeatureEnabled()){\r\n prevSectionObj.SectionModel().Completed(true);\r\n }\r\n }\r\n };\r\n this.MoveToSummary = function () {\r\n \r\n if(sm.portal.utility.isNullOrEmpty(sm.portal.vm.custom.callCustomization(\"CanAdvanceAfterTermsHide\")) && !this.CanAdvanceAfterTerms(this.CurrentSection())){\r\n return;\r\n }\r\n\r\n this.ActiveSectionChanged(this.SummarySection());\r\n };\r\n this.NextSectionName = function () {\r\n // Handle the move to the next applied section\r\n var nextSectionObj = null;\r\n var currentIndex = 999;\r\n var nextIndex = -1;\r\n\r\n for (var i = 0; i < this.Sections().length; i++) {\r\n if (this.Sections()[i].SectionName() == this.CurrentSectionName()) {\r\n currentIndex = i;\r\n }\r\n else if (i > currentIndex && this.Sections()[i].Applied()) {\r\n nextSectionObj = this.Sections()[i];\r\n nextIndex = i;\r\n }\r\n\r\n // Break if got both\r\n if (currentIndex < 999 && nextIndex > -1) {\r\n break;\r\n }\r\n }\r\n\r\n if (nextSectionObj != null) {\r\n return nextSectionObj.SectionName();\r\n }\r\n return \"\";\r\n };\r\n this.PrevSectionName = function () {\r\n var prevSectionObj = null;\r\n var currentIndex = 999;\r\n var prevIndex = -1;\r\n\r\n for (var i = this.Sections().length - 1; i > -1; i--) {\r\n if (this.Sections()[i].SectionName() == this.CurrentSectionName()) {\r\n currentIndex = i;\r\n }\r\n else if (currentIndex < 999 && this.Sections()[i].Applied()) {\r\n prevSectionObj = this.Sections()[i];\r\n prevIndex = i;\r\n }\r\n\r\n // Break if got both\r\n if (currentIndex < 999 && prevIndex > -1) {\r\n break;\r\n }\r\n }\r\n\r\n if (prevSectionObj != null) {\r\n return prevSectionObj.SectionName();\r\n }\r\n return \"\";\r\n };\r\n\r\n // Security Handlers\r\n this.IsUserLoggedIn = function () {\r\n\r\n if (!sm.portal.utility.isNullOrEmpty(_currentPersonId) && _currentPersonId > 0) {\r\n viewModel.IsLoggedIn(true);\r\n viewModel.ShowLogin(false);\r\n\r\n } else {\r\n viewModel.IsLoggedIn(false);\r\n viewModel.ShowLogin(true);\r\n }\r\n\r\n if (callback != undefined && callback != null) {\r\n callback();\r\n }\r\n };\r\n\r\n //Login Handlers\r\n this.PartialApps = ko.observableArray();\r\n this.HandlePartialApplications = function (personGID) {\r\n if (personGID != null && this.ShowPartialPopup()) {\r\n var accountViewModel = viewModel.GetSectionModel('Account');\r\n if (!sm.portal.utility.isNullOrEmpty(personGID) && accountViewModel.IsLoggedIn()) {\r\n this.GetPartialData(personGID);\r\n }\r\n }\r\n };\r\n\r\n // this gets the partial applications for a person and displays this as a popup\r\n this.GetPartialData = function (gid) {\r\n var url = _baseApiUri + 'api/studentportal/getapplicationsinprocessfromperson';\r\n $.ajax({\r\n url: url,\r\n type: 'GET',\r\n dataType: 'json',\r\n contentType: 'application/json; charset=utf-8',\r\n headers: {\r\n \"x-api-version\": '1' //,\r\n },\r\n processData: false,\r\n crossDomain: true,\r\n\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data, textStatus, jqXHR) {\r\n if (data.Status == 'success' && data.Payload != null && data.Payload.PartialApplications != null) {\r\n viewModel.PartialApps(data.Payload.PartialApplications);\r\n // Now run the functions for Partial app popup\r\n var title = $('#partialApplicationContainer').attr('data-dialog-title');\r\n sm.portal.ui.lightBox(title, $('#partialApplicationContainer'), 'smallDialog', null, null, null, function () {\r\n $('.smModal .smModalClose').on('click', function () {\r\n viewModel.ShowPartialData(false);\r\n viewModel.ShowPartialPopup(false);\r\n });\r\n });\r\n\r\n viewModel.ShowPartialData(true);\r\n viewModel.ShowPartialPopup(false);\r\n }\r\n else {\r\n viewModel.ShowPartialData(false);\r\n viewModel.ShowPartialPopup(false); //Default to Shown so that it never shows again\r\n }\r\n $.unblockUI();\r\n },\r\n error: function (jqXHR, exception) {\r\n\r\n console.log('** Error on partial retrevial: Person GID =' + gid);\r\n $.unblockUI();\r\n }\r\n });\r\n };\r\n this.OpenApplication = function (partial, event) {\r\n if (partial != null && partial.GID != null) {\r\n if (event.type === \"click\" || (event.type === \"keypress\" && (event.which == 13 || event.which == 32))) {\r\n var joinOperator = window.location.href.indexOf(\"?\") == -1 ? \"?\" : \"&\";\r\n window.location.href = window.location.href + joinOperator + \"attemptGID=\" + partial.GID;\r\n }\r\n }\r\n };\r\n\r\n // Error Handling\r\n this.ErrorHeader = ko.observable();\r\n this.ErrorMessages = ko.observableArray();\r\n this.IsError = ko.observable();\r\n\r\n // Extraction Method\r\n this.ExtractATO = function () {\r\n \r\n // Get the full Section Data\r\n var accountSecData = this.GetSectionModel('Account');\r\n var personSecData = this.GetSectionModel('BasicPerson');\r\n var contactSecData = this.GetSectionModel('BasicContact');\r\n var academicSecData = this.GetSectionModel('Academic');\r\n var demographicSecData = this.GetSectionModel('Demographic');\r\n var employmentSecData = this.GetSectionModel('Employment');\r\n var collegeSecData = this.GetSectionModel('College');\r\n var highSchoolSecData = this.GetSectionModel('HighSchool');\r\n var placementTestSecData = this.GetSectionModel('TestScore');\r\n\r\n var beforeTermSecData = this.GetSectionModel('BeforeTerms');\r\n var afterTermSecData = this.GetSectionModel('AfterTerms');\r\n var requiredModels = sm.portal.vm.custom.callCustomization('LoadMissingModels',self);\r\n // Consolidate IDs\r\n var personID = null;\r\n var personGID = null;\r\n if (!sm.portal.utility.isNullOrEmpty(accountSecData.PersonID()) && accountSecData.PersonID() > 0) {\r\n personID = accountSecData.PersonID();\r\n personGID = accountSecData.PersonGID();\r\n }\r\n else if (!sm.portal.utility.isNullOrEmpty(personSecData.ID()) && personSecData.ID() > 0) {\r\n personID = personSecData.ID();\r\n personGID = personSecData.GID();\r\n }\r\n else if (!sm.portal.utility.isNullOrEmpty(this.PersonID()) && this.PersonID() > 0) {\r\n personID = this.PersonID();\r\n personGID = this.PersonGID();\r\n }\r\n // Construct the College ATO Object\r\n var previousCollegeData = null;\r\n if (collegeSecData) {\r\n previousCollegeData = collegeSecData.ExtractATO();\r\n }\r\n // Construct the list of Placement Test objects.\r\n var testScoreData = null;\r\n if (placementTestSecData) {\r\n testScoreData = placementTestSecData.ExtractATO();\r\n }\r\n // Construct the HS ATO Object\r\n var previousHighSchoolData = highSchoolSecData.ExtractATO();\r\n var highSchoolInformationModel = Array();\r\n var highSchoolAddressInformation = Array();\r\n for (var i = 0; i < previousHighSchoolData.length; i++) {\r\n highSchoolInformationModel.push(previousHighSchoolData[i].HighSchoolInformationModel);\r\n highSchoolAddressInformation.push(previousHighSchoolData[i].HighSchoolAddressInformation);\r\n }\r\n // Person object\r\n var stdPerson = personSecData.ExtractATO(); \r\n // Contact Information\r\n var contactDetails = contactSecData.ExtractATO();\r\n \r\n if (!sm.portal.utility.isNullOrEmpty(contactDetails.PhoneNumber.Number())) {\r\n stdPerson.Person.PhoneNumbers.push(contactDetails.PhoneNumber);\r\n }\r\n\r\n\r\n stdPerson.Person.Addresses.push(contactDetails.MailingAddress);\r\n\r\n\r\n var customData = {\r\n personSecData : personSecData,\r\n stdPerson : stdPerson,\r\n contactSecData : contactSecData,\r\n contactDetails : contactDetails\r\n }\r\n\r\n var result = sm.portal.vm.custom.callCustomization('SetElectronicAddress', customData); \r\n\r\n if(sm.portal.utility.isNullOrEmpty(result)){\r\n if (!sm.portal.utility.isNullOrEmpty(stdPerson.Email.Value())) {\r\n stdPerson.Person.ElectronicAddresses.push(stdPerson.Email);\r\n }\r\n \r\n stdPerson.Person.DoNotContact(contactDetails.DoNotContact);\r\n \r\n }\r\n\r\n sm.portal.vm.custom.callCustomization('SetPersonDetails', customData);\r\n\r\n // Construct the Demographic ATO object\r\n var demographicData = demographicSecData.ExtractATO();\r\n \r\n var cusData = {\r\n stdPerson: stdPerson,\r\n demographicSecData: demographicSecData,\r\n requiredModels: requiredModels,\r\n employmentSecData: employmentSecData\r\n }\r\n var employmentInformation = Array();\r\n var employerNames = Array();\r\n\r\n var ExtraModels = sm.portal.vm.custom.callCustomization('CustomizeDemographicATOobject', cusData);\r\n\r\n if (sm.portal.utility.isNullOrEmpty(self.SummaryInfoMessageTemplate())) {\r\n var employment = employmentSecData.ExtractATO();\r\n stdPerson.Person.Employment.push(employment);\r\n \r\n // Construct the Employment ATO object\r\n for (var i = 0; i < employment.length; i++) {\r\n employmentInformation.push(employment[i].EmploymentInformation);\r\n employerNames.push(employment[i].EmployerNames);\r\n } \r\n }\r\n\r\n // New AdmissionsModel - basic information\r\n var stdAttempt = academicSecData.ExtractATO();\r\n\r\n stdAttempt.Surname(stdPerson.Person.Surname());\r\n stdAttempt.GivenName(stdPerson.Person.GivenName());\r\n stdAttempt.MiddleName(stdPerson.Person.MiddleName());\r\n \r\n //Before Terms\r\n var termsData = beforeTermSecData.ExtractATO();\r\n //After Terms\r\n termsData = termsData.concat(afterTermSecData.ExtractATO());\r\n\r\n for (var i = 0; i < termsData.length; i++) {\r\n termsData[i].PersonID(this.PersonID());\r\n termsData[i].ProcessObjectID(this.ApplicationID());\r\n }\r\n\r\n termsData = ko.toJS(termsData);\r\n\r\n // ID Consolidation\r\n stdAttempt.PersonID(personID);\r\n stdPerson.Person.ID(personID);\r\n stdPerson.Person.GID(personGID);\r\n stdAttempt.ID(this.ApplicationID());\r\n stdAttempt.GID(this.ApplicationGID());\r\n stdAttempt.AdmissionsStageID(this.AdmissionsStageID());\r\n stdAttempt.Milestones(this.Milestones());\r\n\r\n var applicationInformationData = sm.portal.vm.custom.callCustomization('ApplicationInformationData', requiredModels);\r\n \r\n var data = {\r\n applicationInformationData: applicationInformationData,\r\n stdAttempt: stdAttempt,\r\n contactDetails: contactDetails\r\n\r\n }\r\n \r\n var CusRet = sm.portal.vm.custom.callCustomization('CustomizeStdAttempt', data);\r\n if(CusRet == false){\r\n return false;\r\n }\r\n var genericMap = {};\r\n genericMap[\"HighSchool\"] = {\r\n ObjectType: \"ProcessStage\",\r\n ObjectTypeName: \"TRS.CAMS.Admissions.Entity.Api.HighSchoolInformationATO, TRS.CAMS.Admissions.Entity\",\r\n StageTypeName: \"TRS.CAMS.Admissions.Entity.HighSchoolInformationStep, TRS.CAMS.Admissions.Entity\",\r\n StageBusinessMeaningName: \"Application.HighSchoolInformation\"\r\n };\r\n genericMap[\"PaymentInformation\"] = {\r\n ObjectType: \"ProcessStage\",\r\n ObjectTypeName: \"TRS.CAMS.Admissions.Entity.Api.AdmissionsPaymentInformationATO, TRS.CAMS.Admissions.Entity\",\r\n StageTypeName: \"TRS.CAMS.Admissions.Entity.AdmissionsPaymentInformationStep, TRS.CAMS.Admissions.Entity\",\r\n StageBusinessMeaningName: \"Application.Fee\"\r\n };\r\n genericMap[\"College\"] = {\r\n ObjectType: \"ProcessStage\",\r\n ObjectTypeName: \"TRS.CAMS.Admissions.Entity.Api.CollegeInformationATO, TRS.CAMS.Admissions.Entity\",\r\n StageTypeName: \"TRS.CAMS.Admissions.Entity.CollegeInformationStep, TRS.CAMS.Admissions.Entity\",\r\n StageBusinessMeaningName: \"Application.PreviousCollegeInformation\"\r\n };\r\n genericMap[\"ACT\"] = {\r\n ObjectType: \"ProcessStage\",\r\n ObjectTypeName: \"TRS.CAMS.Admissions.Entity.Api.ACTATO, TRS.CAMS.Admissions.Entity\",\r\n StageTypeName: \"TRS.CAMS.Admissions.Entity.ACTStep, TRS.CAMS.Admissions.Entity\",\r\n StageBusinessMeaningName: \"Application.ACTScore\"\r\n };\r\n genericMap[\"SAT\"] = {\r\n ObjectType: \"ProcessStage\",\r\n ObjectTypeName: \"TRS.CAMS.Admissions.Entity.Api.SATATO, TRS.CAMS.Admissions.Entity\",\r\n StageTypeName: \"TRS.CAMS.Admissions.Entity.SATStep, TRS.CAMS.Admissions.Entity\",\r\n StageBusinessMeaningName: \"Application.SATScore\"\r\n };\r\n\r\n genericMap[\"TOEFL\"] = {\r\n ObjectType: \"ProcessStage\",\r\n ObjectTypeName: \"TRS.CAMS.Admissions.Entity.Api.TOEFLATO, TRS.CAMS.Admissions.Entity\",\r\n StageTypeName: \"TRS.CAMS.Admissions.Entity.TOEFLStep, TRS.CAMS.Admissions.Entity\",\r\n StageBusinessMeaningName: \"Application.TOEFL\"\r\n };\r\n genericMap[\"Praxis\"] = {\r\n ObjectType: \"ProcessStage\",\r\n ObjectTypeName: \"TRS.CAMS.Admissions.Entity.Api.PraxisATO, TRS.CAMS.Admissions.Entity\",\r\n StageTypeName: \"TRS.CAMS.Admissions.Entity.PraxisStep, TRS.CAMS.Admissions.Entity\",\r\n StageBusinessMeaningName: \"Application.PraxisScore\"\r\n };\r\n genericMap[\"PraxisII\"] = {\r\n ObjectType: \"ProcessStage\",\r\n ObjectTypeName: \"TRS.CAMS.Admissions.Entity.Api.PraxisIIATO, TRS.CAMS.Admissions.Entity\",\r\n StageTypeName: \"TRS.CAMS.Admissions.Entity.PraxisIIStep, TRS.CAMS.Admissions.Entity\",\r\n StageBusinessMeaningName: \"Application.PraxisIIScore\"\r\n };\r\n genericMap[\"GRE\"] = {\r\n ObjectType: \"ProcessStage\",\r\n ObjectTypeName: \"TRS.CAMS.Admissions.Entity.Api.GREGeneralATO, TRS.CAMS.Admissions.Entity\",\r\n StageTypeName: \"TRS.CAMS.Admissions.Entity.GREGeneralStep, TRS.CAMS.Admissions.Entity\",\r\n StageBusinessMeaningName: \"Application.GREScore\"\r\n };\r\n genericMap[\"GMAT\"] = {\r\n ObjectType: \"ProcessStage\",\r\n ObjectTypeName: \"TRS.CAMS.Admissions.Entity.Api.GMATATO, TRS.CAMS.Admissions.Entity\",\r\n StageTypeName: \"TRS.CAMS.Admissions.Entity.GMATStep, TRS.CAMS.Admissions.Entity\",\r\n StageBusinessMeaningName: \"Application.GMATScore\"\r\n };\r\n var updatedCustomGenericMap = sm.portal.vm.custom.callCustomization('CustomGenericMap');\r\n if(!sm.portal.utility.isNullOrEmpty(updatedCustomGenericMap )){\r\n genericMap = updatedCustomGenericMap ;\r\n }\r\n var genericData = {};\r\n genericData[\"HighSchool\"] = previousHighSchoolData;\r\n genericData[\"College\"] = previousCollegeData;\r\n if (testScoreData) {\r\n genericData[\"ACT\"] = testScoreData.ACT;\r\n genericData[\"SAT\"] = testScoreData.SAT;\r\n genericData[\"TOEFL\"] = testScoreData.TOEFL;\r\n genericData[\"Praxis\"] = testScoreData.PRAXIS;\r\n genericData[\"PraxisII\"] = testScoreData.PRAXISII;\r\n genericData[\"GRE\"] = testScoreData.GREGeneral;\r\n genericData[\"GMAT\"] = testScoreData.GMAT;\r\n }\r\n var genericDataUpdated = sm.portal.vm.custom.callCustomization('UpdateGenericData', highSchoolInformationModel);\r\n if(!sm.portal.utility.isNullOrEmpty(genericDataUpdated)){\r\n genericData = genericDataUpdated;\r\n }\r\n // Finally, construct the model to submit to the service.\r\n var submitModel = {\r\n GID: this.ApplicationGID(),\r\n ID: this.ApplicationID(),\r\n\r\n // Account Data\r\n NewAccountPassword: accountSecData.NewAccountPassword(),\r\n PersonID: accountSecData.PersonID(),\r\n PersonGID: accountSecData.PersonGID(),\r\n\r\n PersonalInformation: ko.toJS(stdPerson.Person),\r\n AdmissionsInformation: ko.toJS(stdAttempt),\r\n\r\n DemographicInformation: ko.toJS(demographicData),\r\n\r\n GenericMap: genericMap,\r\n GenericData: genericData,\r\n\r\n TermsData: termsData,\r\n HighSchoolAddressInformation: ko.toJS(highSchoolAddressInformation)\r\n };\r\n var DataCustom = {\r\n ExtraModels: ExtraModels,\r\n submitModel: submitModel,\r\n contactSecData: contactSecData\r\n }\r\n sm.portal.vm.custom.callCustomization('SubmitModel',DataCustom)\r\n\r\n if (sm.portal.utility.isNullOrEmpty(self.SummaryInfoMessageTemplate())) {\r\n submitModel.EmploymentInformation = ko.toJS(employmentInformation);\r\n submitModel.EmployerNames = ko.toJS(employerNames); \r\n }\r\n\r\n\r\n if (sm.portal.utility.isNullOrEmpty(submitModel.PersonID)) {\r\n submitModel.PersonID = this.PersonID();\r\n }\r\n if (sm.portal.utility.isNullOrEmpty(submitModel.PersonGID)) {\r\n submitModel.PersonGID = this.PersonGID();\r\n }\r\n if(genericDataUpdated){\r\n return submitModel;\r\n }\r\n if (typeof sm.portal.vm.ukapplication !== 'undefined' && ukFeatureEnabled) {\r\n submitModel = sm.portal.vm.ukapplication.ExtractATO(this, submitModel, stdAttempt, stdPerson.Person);\r\n sm.portal.vm.custom.callCustomization('SetPersonGenderID', submitModel);\r\n } else if (typeof sm.portal.vm.euapplication !== 'undefined' && euFeatureEnabled) {\r\n submitModel = sm.portal.vm.euapplication.ExtractATO(this, submitModel, stdAttempt, stdPerson.Person);\r\n } else if (typeof sm.portal.vm.apasapplication !== 'undefined' && apasFeatureEnabled) {\r\n submitModel = sm.portal.vm.apasapplication.ExtractATO(this, submitModel, stdAttempt, stdPerson.Person);\r\n }\r\n\r\n if (typeof sm.portal.vm.conservatoireapplication !== 'undefined' && conservatoireFeatureEnabled) {\r\n submitModel = sm.portal.vm.conservatoireapplication.ExtractATO(this, submitModel, stdAttempt, stdPerson.Person);\r\n }\r\n\r\n return submitModel;\r\n };\r\n\r\n this.PerformApplicationAutoSave = function () {\r\n if (this.CanCrateUser()) {\r\n\r\n var userCreatedSuccessCallback = function () {\r\n viewModel.ShowUserCreatedNotification(true);\r\n viewModel.IsCreateUserProcessRunning(false);\r\n setTimeout(function () { viewModel.ShowUserCreatedNotification(false); }, 5000);\r\n viewModel.ProcessApplicationInProgress();\r\n };\r\n\r\n this.IsCreateUserProcessRunning(true);\r\n this.CallUserCreation(userCreatedSuccessCallback);\r\n }\r\n else if (this.GetSectionModel('Account').IsLoggedIn() && this.GetSectionModel('Academic').IsVMValid()) {\r\n this.ProcessApplicationInProgress();\r\n }\r\n else if (this.shouldUpdatePersonalInfo()) {\r\n this.UpdatePersonInformation();\r\n }\r\n };\r\n\r\n this.shouldUpdatePersonalInfo = function () {\r\n return this.GetSectionModel('Account').IsLoggedIn() &&\r\n (this.CurrentSection().SectionName() === 'BasicContact' || this.CurrentSection().SectionName() === 'BasicPerson') &&\r\n this.GetSectionModel('Account').IsVMValid();\r\n };\r\n\r\n // Submission Method\r\n this.ProcessApplicationInProgress = function () {\r\n if (!self.Saving()) {\r\n\r\n // TODO: In Progress Saving of application - so they can come back to it.\r\n var submitData = self.ExtractATO();\r\n\r\n var availableForIncremental = true;\r\n if (sm.portal.utility.isNullOrEmpty(submitData.PersonalInformation)) { return; }\r\n if (sm.portal.utility.isNullOrEmpty(submitData.PersonalInformation.GivenName)) { availableForIncremental = false; }\r\n if (sm.portal.utility.isNullOrEmpty(submitData.PersonalInformation.Surname)) { availableForIncremental = false; }\r\n if (submitData.PersonalInformation.ElectronicAddresses.length == 0) { availableForIncremental = false; }\r\n\r\n // TODO: Scott's Suggestion, change the Application Type or Stage or ProcessStage to Inquiry or something not as restrictive to incremental save.\r\n\r\n if (availableForIncremental) { // TODO: Change to use variable to implement.\r\n\r\n self.ShowPartialPopup(false); // DO NOT show the partial popup, if this isn't set\r\n\r\n self.Saving(true);\r\n\r\n var url = _baseApiUri + 'api/studentportal/PersistPartialApplication?id=';\r\n if (!sm.portal.utility.isNullOrEmpty(self.ApplicationID())) {\r\n url += self.ApplicationID();\r\n }\r\n $.ajax({\r\n url: url,\r\n type: 'POST',\r\n dataType: 'json',\r\n data: JSON.stringify(submitData),\r\n contentType: 'application/json; charset=utf-8',\r\n headers: {\r\n \"x-api-version\": '1' //,\r\n },\r\n processData: false,\r\n crossDomain: true,\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data, textStatus, jqXHR) {\r\n var container = new smapi.access.ApiContainerModel(data.Status, data.Payload, data.ValidationTitle, data.ValidationMessages);\r\n if (data.Status == 'saved') {\r\n\r\n viewModel.ApplicationGID(container.Payload.ApplicationGID);\r\n viewModel.ApplicationID(container.Payload.ApplicationID);\r\n viewModel.PersonGID(container.Payload.PersonGID);\r\n viewModel.PersonID(container.Payload.PersonID);\r\n viewModel.AdmissionsStageID(container.Payload.AdmissionsStageID);\r\n viewModel.Milestones(container.Payload.Milestones);\r\n\r\n // Dynamic Section\r\n if (container.Payload.TestSections && viewModel.GetSectionModel('TestScore')) {\r\n var testScoreViewModel = viewModel.GetSectionModel('TestScore');\r\n testScoreViewModel.LoadModel(container);\r\n }\r\n\r\n var hsViewModel = viewModel.GetSectionModel('HighSchool');\r\n hsViewModel.LoadModel(container);\r\n\r\n var collegeViewModel = viewModel.GetSectionModel('College');\r\n if (!sm.portal.utility.isNullOrEmpty(collegeViewModel)) {\r\n collegeViewModel.LoadModel(container);\r\n }\r\n\r\n viewModel.Saved(true);\r\n viewModel.HasBeenSaved(true);\r\n var customData = {\r\n viewModel: viewModel,\r\n container: container \r\n }\r\n sm.portal.vm.custom.callCustomization('UpdatePersistQualification', customData);\r\n\r\n setTimeout(function () {\r\n viewModel.Saved(false);\r\n viewModel.Saving(false);\r\n // with section order change, dependent section may come just before summary section\r\n // so, once user navigates to summary section, dynamic sections should load\r\n viewModel.CheckSectionsForInclusion();\r\n sm.portal.ui.detailedList();\r\n\r\n }, 3000);\r\n\r\n } else if (data.Status == 'notyet' || data.Status == 'error') {\r\n // Do Nothing, not ready for an incremental save...\r\n viewModel.Saving(false);\r\n viewModel.IsCreateUserProcessRunning(false);\r\n if (data.Status == 'notyet' && data.ValidationTitle && !data.ValidationTitle.includes('Academic Level must have a value')) {\r\n viewModel.ThrowErrorWithRelevantMessage(jqXHR, 'save');\r\n }\r\n }\r\n },\r\n error: function (jqXHR, exception) {\r\n if (jqXHR && jqXHR.responseJSON) {\r\n viewModel.HandleError(exception + jqXHR.responseJSON.Message);\r\n } else {\r\n viewModel.HandleError('Error');\r\n }\r\n viewModel.Saving(false);\r\n viewModel.ThrowErrorWithRelevantMessage(jqXHR, 'save');\r\n }\r\n });\r\n }\r\n }\r\n };\r\n\r\n this.UsercreationFail = function () {\r\n var PersonRecordCreationErrorOkButton = '
';\r\n var PersonRecordCreationErrorMsg = '

' + sm.portal.utility.getResourceValue('ErrorMessageNotLoggedIn') + '

';\r\n \r\n sm.portal.ui.lightBox(\r\n sm.portal.utility.getResourceValue('AccountCreationErrorMsg'),\r\n PersonRecordCreationErrorMsg,\r\n 'userCreationFailPopUp',\r\n function () {\r\n jQuery('.userCreationFail_Ok_button').on('click',\r\n function () {\r\n location.reload();\r\n }\r\n );\r\n },\r\n null,\r\n PersonRecordCreationErrorOkButton,\r\n null,\r\n null,\r\n null,\r\n 'UserCreationFail',\r\n null\r\n );\r\n }\r\n\r\n this.CallUserCreation = function (UserCreatedCallback) {\r\n if (!self.Saving()) {\r\n \r\n var submitData = self.ExtractATO();\r\n \r\n self.Saving(true);\r\n \r\n var url = _baseApiUri + 'api/studentportal/CreatePortalUserFromPartialApplication?id=';\r\n if (!sm.portal.utility.isNullOrEmpty(self.ApplicationID())) {\r\n url += self.ApplicationID();\r\n }\r\n\r\n $.ajax({\r\n url: url,\r\n type: 'POST',\r\n dataType: 'json',\r\n data: JSON.stringify(submitData),\r\n contentType: 'application/json; charset=utf-8',\r\n headers: {\r\n \"x-api-version\": '1' //,\r\n },\r\n processData: false,\r\n crossDomain: true,\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data, textStatus, jqXHR) {\r\n var container = new smapi.access.ApiContainerModel(data.Status, data.Payload, data.ValidationTitle, data.ValidationMessages);\r\n if (data.Status == 'saved') {\r\n if (container.Payload.CreatePortalUserStatus == \"success\") {\r\n\r\n var basicPersonViewModel = self.GetSectionModel('BasicPerson');\r\n var firstName = basicPersonViewModel != null ? basicPersonViewModel.FirstName() : \"\";\r\n\r\n basicPersonViewModel.InitializeOnUserCreated(container.Payload);\r\n\r\n var accountViewModel = viewModel.GetSectionModel('Account');\r\n if (accountViewModel != null && !accountViewModel.IsLoggedIn()) {\r\n accountViewModel.InitializeAndLoginUser(container.Payload, UserCreatedCallback, firstName, true, false);\r\n }\r\n }\r\n viewModel.Saving(false);\r\n viewModel.AppendNotExistingWarnings(container.Payload.WarningMessages);\r\n\r\n } else if (container && container.Payload && container.Payload.CreatePortalUserStatus == 'error') {\r\n self.UsercreationFail();\r\n viewModel.Saving(false);\r\n }\r\n else if (data.Status == 'notyet' || data.Status == 'error') {\r\n // Do Nothing, not ready for an incremental save...\r\n viewModel.Saving(false);\r\n viewModel.ThrowErrorWithRelevantMessage(jqXHR, 'save');\r\n }\r\n },\r\n error: function (jqXHR, exception) {\r\n viewModel.HandleError(exception);\r\n viewModel.Saving(false);\r\n viewModel.ThrowErrorWithRelevantMessage(jqXHR, 'save');\r\n }\r\n });\r\n\r\n }\r\n };\r\n\r\n this.UpdatePersonInformation = function () {\r\n if (!self.Saving()) {\r\n\r\n var submitData = self.ExtractATO();\r\n\r\n self.Saving(true);\r\n var url = _baseApiUri + 'api/studentportal/UpdateUserInformation';\r\n\r\n var onSuccess = function (data, textStatus, jqXHR) {\r\n viewModel.Saved(true);\r\n\r\n setTimeout(function () {\r\n viewModel.Saved(false);\r\n viewModel.Saving(false);\r\n }, 3000);\r\n };\r\n\r\n var onError = function (jqXHR, exception) {\r\n viewModel.HandleError(exception);\r\n viewModel.ThrowErrorWithRelevantMessage(jqXHR, 'save');\r\n viewModel.Saving(false);\r\n };\r\n\r\n sm.portal.utility.AjaxPost(\r\n url,\r\n JSON.stringify(submitData),\r\n onSuccess,\r\n onError\r\n );\r\n }\r\n };\r\n\r\n this.UpdatePersonInformation = function () {\r\n if (!self.Saving()) {\r\n\r\n var submitData = self.ExtractATO();\r\n\r\n self.Saving(true);\r\n var url = _baseApiUri + 'api/studentportal/UpdateUserInformation';\r\n\r\n var onSuccess = function (data, textStatus, jqXHR) {\r\n viewModel.Saved(true);\r\n\r\n var accountViewModel = self.GetSectionModel('Account');\r\n var basicPersonViewModel = self.GetSectionModel('BasicPerson');\r\n if (accountViewModel !== null && basicPersonViewModel !== null) {\r\n accountViewModel.PersonFirstName(basicPersonViewModel.FirstName());\r\n }\r\n\r\n setTimeout(function () {\r\n viewModel.Saved(false);\r\n viewModel.Saving(false);\r\n }, 3000);\r\n };\r\n\r\n var onError = function (jqXHR, exception) {\r\n viewModel.HandleError(exception);\r\n viewModel.ThrowErrorWithRelevantMessage(jqXHR, 'save');\r\n viewModel.Saving(false);\r\n };\r\n\r\n sm.portal.utility.AjaxPost(\r\n url,\r\n JSON.stringify(submitData),\r\n onSuccess,\r\n onError\r\n );\r\n }\r\n };\r\n\r\n this.CheckSectionsForInclusion = function () {\r\n // Attempt to check Inclusion for other sections - not sure if this is the best place for it, but it gets called a lot..\r\n for (var i = 0; i < viewModel.Sections().length; i++) {\r\n var nextSection = viewModel.Sections()[i];\r\n if (!sm.portal.utility.isNullOrEmpty(nextSection.SectionModel()) && !nextSection.SectionModel().DataLoading() && self.CurrentSectionName() != nextSection.SectionName()) {\r\n if (smapi.constant.applicationDebugFlag) { console.log('[SectionModel.Activate] Inclusion Checking ' + nextSection.SectionName()); }\r\n try {\r\n nextSection.SectionModel().CheckInclusion(this.ApplicationMID(), this.PersonMID());\r\n } catch (e) {\r\n if (smapi.constant.applicationDebugFlag) { console.log('[SectionModel.CheckInclusion] Method not found ' + nextSection.SectionName()); }\r\n }\r\n }\r\n }\r\n };\r\n\r\n this.SubmitApplication = function () {\r\n $.blockUI();\r\n var submitData = self.ExtractATO();\r\n\r\n // Submit the object to the service\r\n var url = _baseApiUri + 'api/studentportal/SubmitApplication?id=';\r\n if (!sm.portal.utility.isNullOrEmpty(self.ApplicationID())) {\r\n url += self.ApplicationID();\r\n }\r\n\r\n var model = self.GetSectionModel(self.CurrentSectionName());\r\n model.BlockContainer();\r\n\r\n self.IsError(false);\r\n self.ErrorHeader(\"\");\r\n\r\n $('html,body').animate({\r\n scrollTop: $('.smContentArea').offset().top\r\n }, 500);\r\n\r\n $.ajax({\r\n url: url,\r\n type: 'POST',\r\n dataType: 'json',\r\n data: JSON.stringify(submitData),\r\n contentType: 'application/json; charset=utf-8',\r\n headers: {\r\n \"x-api-version\": '1' //,\r\n },\r\n processData: false,\r\n crossDomain: true,\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data, textStatus, jqXHR) {\r\n var container = new smapi.access.ApiContainerModel(data.Status, data.Payload, data.ValidationTitle, data.ValidationMessages);\r\n if (data.Status == 'submitted') {\r\n if (data.Payload.IsPaymentProviderEnabled) {\r\n GetPaymentProviderName();\r\n }\r\n viewModel.Result_PersonGivenName('');\r\n if (container.Payload.PersonGivenName.length > 0) {\r\n viewModel.Result_PersonGivenName(container.Payload.PersonGivenName);\r\n }\r\n viewModel.BaseU4SMUrl(container.Payload.BaseServiceUrl);\r\n viewModel.Submitted(true);\r\n viewModel.PaymentDetails(data.Payload.PaymentDetails)\r\n viewModel.AppendNotExistingWarnings(container.Payload.WarningMessages);\r\n if (container.Payload.BiilingDomicileSettings !== undefined) {\r\n viewModel.IsBillingDomicileMappingCorrect(container.Payload.BiilingDomicileSettings.IsBillingDomicileMappingCorrect);\r\n viewModel.BillingDomicileMessage(container.Payload.BiilingDomicileSettings.BillingDomicileMessage);\r\n viewModel.IsBillingDomicilePaymentProviderEnabled(container.Payload.BiilingDomicileSettings.IsBillingDomicilePaymentProviderEnabled);\r\n viewModel.BillingDomicilePaymentProviders(container.Payload.BiilingDomicileSettings.PaymentProviders);\r\n }\r\n if (!self.IsBillingDomicilePaymentProviderEnabled()) {\r\n AttachMakePayment(data.Payload.IsPaymentProviderEnabled, data.Payload.PaymentDetails);\r\n }\r\n var customData = {\r\n viewModel: viewModel,\r\n container: container\r\n }\r\n sm.portal.vm.custom.callCustomization('CallSetUpPebblePad', customData);\r\n } else if (data.Status == 'validationerror') {\r\n\r\n viewModel.HandleError(container.ValidationTitle, container.ValidationMessages);\r\n viewModel.ThrowErrorWithRelevantMessage(jqXHR, 'save');\r\n // TODO: Identify and highlight the associated fields (if possible)\r\n\r\n } else if (data.Status == 'error') {\r\n\r\n viewModel.HandleError(container.ValidationTitle, container.ValidationMessages);\r\n viewModel.ThrowErrorWithRelevantMessage(jqXHR, 'save');\r\n }\r\n $.unblockUI();\r\n model.UnBlockContainer();\r\n },\r\n error: function (jqXHR, exception) {\r\n viewModel.HandleError(exception);\r\n model.UnBlockContainer();\r\n $.blockUI();\r\n viewModel.ThrowErrorWithRelevantMessage(jqXHR, 'save');\r\n }\r\n });\r\n };\r\n\r\n self.PaymentProviderSelectionPopup = function () {\r\n jQuery.blockUI();\r\n function GenerateHTMLForPaymentMethods() {\r\n var result='';\r\n if (self.BillingDomicilePaymentProviders().length > 0) {\r\n for (var i = 0; i < self.BillingDomicilePaymentProviders().length; i++) {\r\n result = result +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '' +\r\n '
' +\r\n '
' +\r\n '
'\r\n }\r\n }\r\n return result\r\n }\r\n var bodyContent = GenerateHTMLForPaymentMethods();\r\n var buttonContent = '' +\r\n '';\r\n sm.portal.ui.lightBox(sm.portal.utility.getResourceValue('MakePayment'), bodyContent, 'smallDialog', null, null, buttonContent);\r\n jQuery.unblockUI();\r\n\r\n jQuery('input[name=\"radioPayment\"]').on('change', function () {\r\n if (jQuery(this).is(':checked')) {\r\n jQuery('#MakePaymentbtn').removeAttr('disabled');\r\n }\r\n else {\r\n jQuery('#MakePaymentbtn').attr('disabled', '');\r\n }\r\n })\r\n\r\n jQuery('#MakePaymentbtn').click(function () {\r\n var selectedPaymentProvider = jQuery('input[name=\"radioPayment\"]:checked');\r\n var selectedPaymentProviderId = selectedPaymentProvider.attr('id');\r\n var selectedPaymentProviderName = selectedPaymentProvider.attr('value');\r\n self.PaymentProviderName(selectedPaymentProviderName);\r\n viewModel.PaymentProviderID(selectedPaymentProviderId);\r\n sm.portal.ui.removeLightbox();\r\n if (self.PaymentProviderName() === \"FlywireV2\") {\r\n jQuery(\"#flywireVisibleButton\").click();\r\n } else if (selectedPaymentProviderName === \"Flywire\") {\r\n jQuery('#flywireButton').click();\r\n } else {\r\n self.worldpaybtnMakePayment();\r\n }\r\n });\r\n\r\n };\r\n\r\n this.worldpaybtnMakePayment = function () {\r\n MakePayment(viewModel.PaymentDetails());\r\n };\r\n\r\n this.ReviewApplicantChecklist = function () {\r\n $.blockUI();\r\n\r\n $.ajax({\r\n type: 'GET',\r\n url: _baseApiUri + 'api/ApplicationSetting/GetPortalUserApplicantChecklistURL',\r\n contentType: false,\r\n global: true,\r\n crossDomain: true,\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data, textStatus, jqXHR) {\r\n $.unblockUI();\r\n window.location.replace(data);\r\n },\r\n error: function (jqXHR, exception) {\r\n $.unblockUI();\r\n viewModel.HandleError(exception);\r\n }\r\n });\r\n };\r\n\r\n return self;\r\n };\r\n\r\n this.MakePayment = function (paymentDetails) {\r\n $.blockUI();\r\n sm.portal.utility.get('api/Reenrollment/PaymentConfirmationRedirectURL', function (output) {\r\n var url = _baseApiUri + 'api/portalstudentledger/CreatePaymentForm/';\r\n paymentDetails[\"PaymentLocation\"] = output.Payload.RedirectPaymentPageURL;\r\n if (viewModel.IsBillingDomicilePaymentProviderEnabled()) {\r\n paymentDetails[\"PaymentProviderId\"] = viewModel.PaymentProviderID();\r\n }\r\n \r\n $.ajax({\r\n url: url,\r\n type: 'POST',\r\n dataType: 'json',\r\n data: JSON.stringify(paymentDetails),\r\n contentType: 'application/json; charset=utf-8',\r\n headers: {\r\n \"x-api-version\": '1'\r\n },\r\n processData: false,\r\n crossDomain: true,\r\n\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data) {\r\n $(data).appendTo('body').submit();\r\n },\r\n error: function (xhr, ajaxOptions, exception) {\r\n self.HandleError(exception);\r\n $.unblockUI();\r\n }\r\n });\r\n });\r\n };\r\n\r\n this.AttachMakePayment = function (isPaymentProviderEnabled, paymentDetails) {\r\n if (isPaymentProviderEnabled) {\r\n viewModel.IsPaymentProviderEnabled(true);\r\n $('button[data-payment-button]').on('click', function () {\r\n MakePayment(paymentDetails);\r\n });\r\n }\r\n };\r\n\r\n this.GetPaymentProviderName = function () {\r\n if (viewModel.IsPaymentProviderEnabled) {\r\n var url = _baseApiUri + sm.portal.utility.formatString('api/portalstudentledger/GetPaymentProviderName');\r\n $.ajax({\r\n url: url,\r\n type: 'GET',\r\n dataType: 'json',\r\n contentType: 'application/json; charset=utf-8',\r\n headers: {\r\n \"x-api-version\": '1'\r\n },\r\n processData: false,\r\n crossDomain: true,\r\n xhrFields: {\r\n withCredentials: true\r\n },\r\n success: function (data) {\r\n viewModel.PaymentProviderName(data);\r\n },\r\n error: function (exception) {\r\n viewModel.HandleError(exception);\r\n }\r\n });\r\n }\r\n };\r\n\r\n $.extend(true, sm.portal.vm, {\r\n ApplicationViewModel: ApplicationViewModel,\r\n })\r\n\r\n})(jQuery);"]}