{"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","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","AttachMakePayment","UnBlockContainer","ReviewApplicantChecklist","global","replace","extend","MakePayment","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,gCAo0EpD,OAn0EAV,KAAKW,2BAA6BC,GAAGC,WAAW,IAChDb,KAAKc,uBAAyBF,GAAGC,YAAW,GAC5Cb,KAAKe,uBAAyBH,GAAGC,YAAW,GAC5Cb,KAAKgB,kBAAoBJ,GAAGC,YAAW,GACvCb,KAAKiB,gBAAkBL,GAAGC,YAAW,GACrCb,KAAKkB,eAAiBN,GAAGC,WAAW,gDACpCb,KAAKmB,cAAgBP,GAAGC,WAAW,IACnCb,KAAKoB,kBAAoBR,GAAGC,YAAW,GACvCjB,GAAGM,OAAOmB,GAAGC,OAAOC,qBAAqBxB,MAEzCC,KAAKwB,mBAAqB,S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EAA0BR,GACrDQ,IACA7e,UAAU0O,0BAAyB,GACnC3R,EAAE,+BAA+B6Z,GAAG,SAAS,WACzCwH,YAAYC,EAChB,IAER,EAEAhhB,KAAKsgB,uBAAyB,WAC1B,GAAI3d,UAAU0O,yBAA0B,CACpC,IAAI3P,EAAMC,YAAc/B,GAAGM,OAAOC,QAAQgS,aAAa,kDACvDzS,EAAEmC,KAAK,CACHH,IAAKA,EACLI,KAAM,MACNC,SAAU,OACVC,YAAa,kCACbC,QAAS,CACL,gBAAiB,KAErBC,aAAa,EACbC,aAAa,EACbC,UAAW,CACPC,iBAAiB,GAErBC,QAAS,SAAUC,GACfI,UAAU2O,oBAAoB/O,EAClC,EACAiX,MAAO,SAAUC,GACb9W,UAAU2B,YAAYmV,EAC1B,GAER,CACJ,EAEA/Z,EAAEohB,QAAO,EAAMlhB,GAAGM,OAAOmB,GAAI,CACzBvB,qBAAsBA,sBAG7B,EAj6ED,CAi6EG0F","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 // 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 AttachMakePayment(data.Payload.IsPaymentProviderEnabled, data.Payload.PaymentDetails);\r\n viewModel.AppendNotExistingWarnings(container.Payload.WarningMessages);\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 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 $.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);"]}