{"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","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","AppendNotExistingWarnings","newWarnings","WarningMessages","indexOf","push","UpdateTermsSections","model","Applied","ShouldDisplay","Required","IsRequired","DataTestMode","GetModelDataWrapper","sectionModel","blockui","applicationMID","personMID","Promise","resolve","GetModelData","IsExceptionalSection","ctx","includes","Initialize","personGID","isReturning","ApplicationGID","ShowPartialPopup","PersonGID","_currentPersonId","PersonID","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","GetSectionModel","IsLoggedIn","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","jQuery","animate","scrollTop","offset","top","trigger","FirstLoad","validation","group","showAllMessages","Display","custData","LoadChildData","target","property","cmd","eval","GetApplicationSectionModel","sectionName","appSectionModel","GetSectionTitle","sectionTitle","GetSectionNavClass","sectionNavClass","NavigationClass","LoadSummaryData","summaryDataModel","theName","theData","AdmissionsProgramID","AdmissionsPrograms","LoadSection","first","focus","NavigateToSection","matched","res","CanAdvanceAfterTerms","SetSectionsConfigData","configData","isDynamicSection","appSection","SetRequired","body","TermsMessage","ok","ui","lightBox","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","location","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","employment","Employment","employmentData","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","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,gCA+iEpD,OA9iEAV,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,gDACpCjB,GAAGM,OAAOiB,GAAGC,OAAOC,qBAAqBtB,MAEzCC,KAAKsB,mBAAqB,SAAUC,GAChC,IAAIC,EAAMC,YAAc,4CAA8CF,EACtE7B,EAAEgC,UAEFhC,EAAEiC,KAAK,CACHH,IAAKA,EACLI,KAAM,MACNC,SAAU,OACVC,YAAa,kCACbC,QAAS,CACL,gBAAiB,KAErBC,aAAa,EACbC,aAAa,EACbC,UAAW,CACPC,iBAAiB,GAErBC,QAAS,SAAUC,EAAMC,EAAYC,GAC5B3C,GAAGM,OAAOC,QAAQqC,cAAcH,KACjCI,UAAUC,kBAAkBL,EAAKM,QAAQD,mBACzCD,UAAUG,WAAWP,EAAKM,QAAQC,aAEtClD,EAAEmD,WACN,GAER,EAEA7C,KAAK8C,UAAY,SAAUC,GAEvB,IAAK,IAAIC,EAAI,EAAGA,EAAIhD,KAAKiD,WAAWC,OAAQF,IAAK,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,CAAEiB,GAAI,CAAC,IA+jE/BnB,KAAKwd,YAAc,SAAUC,GACzB/d,EAAEgC,UACF9B,GAAGM,OAAOC,QAAQud,IAAI,mDAAmD,SAAUC,GAC/E,IAAInc,EAAMC,YAAc,6CACxBgc,EAAgC,gBAAIE,EAAOhb,QAAQib,uBACnDle,EAAEiC,KAAK,CACHH,IAAKA,EACLI,KAAM,OACNC,SAAU,OACVQ,KAAMoZ,KAAKC,UAAU+B,GACrB3b,YAAa,kCACbC,QAAS,CACL,gBAAiB,KAErBC,aAAa,EACbC,aAAa,EAEbC,UAAW,CACPC,iBAAiB,GAErBC,QAAS,SAAUC,GACf3C,EAAE2C,GAAMwb,SAAS,QAAQC,QAC7B,EACA9H,MAAO,SAAU+H,EAAKC,EAAa/H,GAC/BlW,KAAKqE,YAAY6R,GACjBvW,EAAEmD,WACN,GAER,GACJ,EAEA7C,KAAKkd,kBAAoB,SAAUe,EAA0BR,GACrDQ,IACAxb,UAAU8K,0BAAyB,GACnC7N,EAAE,+BAA+BqW,GAAG,SAAS,WACzCyH,YAAYC,EAChB,IAER,EAEAzd,KAAK+c,uBAAyB,WAC1B,GAAIta,UAAU8K,yBAA0B,CACpC,IAAI/L,EAAMC,YAAc7B,GAAGM,OAAOC,QAAQkO,aAAa,kDACvD3O,EAAEiC,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,UAAU+K,oBAAoBnL,EAClC,EACA2T,MAAO,SAAUC,GACbxT,UAAU2B,YAAY6R,EAC1B,GAER,CACJ,EAEAvW,EAAE6d,QAAO,EAAM3d,GAAGM,OAAOiB,GAAI,CACzBrB,qBAAsBA,sBAG7B,EA5oED,CA4oEG+P","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 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\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'];\r\n return secArr.includes(ctx);\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 // 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 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 }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 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.getHighSchoolIndex()) {\r\n this.Sections()[self.getHighSchoolIndex()].SectionModel().DataLoaded(false);\r\n self.GetModelDataWrapper(this.Sections()[self.getHighSchoolIndex()].SectionModel(), false, this.ApplicationMID(), this.PersonMID())\r\n }\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 var employmentData = employmentSecData.ExtractATO();\r\n \r\n for (var i = 0; i < employmentData.length; i++) {\r\n employmentInformation.push(employmentData[i].EmploymentInformation);\r\n employerNames.push(employmentData[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 }\r\n },\r\n error: function (jqXHR, exception) {\r\n viewModel.HandleError(exception + jqXHR.responseJSON.Message);\r\n viewModel.Saving(false);\r\n }\r\n });\r\n }\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 (data.Status == 'notyet' || data.Status == 'error') {\r\n // Do Nothing, not ready for an incremental save...\r\n viewModel.Saving(false);\r\n }\r\n },\r\n error: function (jqXHR, exception) {\r\n viewModel.HandleError(exception);\r\n viewModel.Saving(false);\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.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.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 // 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 }\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 }\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);"]}