{"version":3,"file":"sm.portal.vm.highSchool.eu.min.js","names":["jQuery","undefined","sm","window","portal","extend","vm","euhighschool","AnythingPopulated","dataItem","HighSchoolID","utility","isNullOrEmpty","HighSchoolName","SchoolCity","SchoolCountryID","SchoolCountry","SaveWorkingChangesSetupWI","highSchool","workingItem","WorkingItem","GetCountryNameById","name","enableSchoolAddressFields","ko","observable","SaveWorkingChangesWIEdit","OriginalItem","EditItem","highschool","data","HighSchoolDataItem","JSON","parse","toJSON","valueHasMutated","LoadModel","currentHighSchool","payload","HighSchoolAddressInformation","length","highSchoolAddressInfo","i","SchoolID","LoadListData","highSchoolVM","container","Payload","ListData","Countries","smapi","access","loadListItemModels","Subscribe","newValue","LoadAddressFields","subscribe","highSchoolDataItem","LoadHighSchool","schoolId","url","_baseApiUri","formatString","ajax","dataType","contentType","headers","processData","crossDomain","xhrFields","withCredentials","LoadOrganization","OrganizationID","organizationId","type","LoadMailingAddress","Addresses","addressId","ID","SetAddressFields","City","CountryID","id","success","textStatus","jqXHR","HighSchoolAddress","ExtractATO","stdHighSchoolInformationModel","LoadModelPreDataItem","dateFormat","resources","portalResource","getValue","toUpperCase","mdyDateFormat","ymdDateFormat","StartDate","charAt","moment","format","EndDate","GraduationDate"],"sources":["assets/js/localization/eu/helpers/viewmodels/admissions/sm.portal.vm.highSchool.eu.js"],"mappings":"CAAA,SAAWA,EAAQC,GACf,IAAIC,EAAKC,OAAOD,GAAKC,OAAOD,IAAM,CAAC,OAIV,IAAdA,EAAGE,QACVJ,EAAOK,OAAOH,EAAI,CAAEE,OAAQ,CAAC,SAEL,IAAjBF,EAAGE,OAAOE,IACjBN,EAAOK,OAAOH,EAAGE,OAAQ,CAAEE,GAAI,CAAC,SAEK,IAA9BJ,EAAGE,OAAOE,GAAGC,cACpBP,EAAOK,OAAOH,EAAGE,OAAOE,GAAI,CAAEC,aAAc,CAAC,IA2PjDP,EAAOK,QAAO,EAAMH,EAAGE,OAAOE,GAAGC,aAAc,CAC3CC,kBAzPJ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BP,GAAeK,OAAOV,GAElGrD,EAAkBiE,eAAiBH,OAAO9D,EAAkBiE,eAAgBN,GAAeI,OAAOV,GAG9G,GAoMH,CApRD,CAoRG1F","ignoreList":[],"sourcesContent":["(function (jQuery, undefined) {\r\n var sm = window.sm = window.sm || {};\r\n var windowProxy;\r\n var actionQueue = [];\r\n\r\n if (typeof sm.portal === \"undefined\") {\r\n jQuery.extend(sm, { portal: {} });\r\n }\r\n if (typeof sm.portal.vm === \"undefined\") {\r\n jQuery.extend(sm.portal, { vm: {} });\r\n }\r\n if (typeof sm.portal.vm.euhighschool === \"undefined\") {\r\n jQuery.extend(sm.portal.vm, { euhighschool: {} });\r\n }\r\n\r\n function AnythingPopulated(dataItem){\r\n // highschool selected from list or manually defined?\r\n if (dataItem.HighSchoolID() > 0 || (dataItem.HighSchoolID() == 0 && !sm.portal.utility.isNullOrEmpty(dataItem.HighSchoolName()))) return true;\r\n if (!sm.portal.utility.isNullOrEmpty(dataItem.SchoolCity())) return true;\r\n if (!sm.portal.utility.isNullOrEmpty(dataItem.SchoolCountryID())) return true;\r\n if (!sm.portal.utility.isNullOrEmpty(dataItem.SchoolCountry())) return true;\r\n \r\n return false;\r\n }\r\n\r\n function SaveWorkingChangesSetupWI(highSchool, workingItem){\r\n\r\n workingItem.SchoolCity = highSchool.WorkingItem().SchoolCity;\r\n workingItem.SchoolCountryID = highSchool.WorkingItem().SchoolCountryID;\r\n \r\n if(workingItem.SchoolCountryID){\r\n workingItem.SchoolCountry(highSchool.GetCountryNameById(workingItem.SchoolCountryID).name);\r\n } else {\r\n workingItem.SchoolCountry = highSchool.WorkingItem().SchoolCountry;\r\n }\r\n\r\n workingItem.enableSchoolAddressFields = ko.observable(false);\r\n }\r\n\r\n function SaveWorkingChangesWIEdit(highSchool, workingItem){\r\n highSchool.OriginalItem().SchoolCity(workingItem.SchoolCity);\r\n highSchool.OriginalItem().SchoolCountryID(workingItem.SchoolCountryID);\r\n highSchool.OriginalItem().SchoolCountry(workingItem.SchoolCountry);\r\n }\r\n\r\n function EditItem(highschool, data){\r\n highschool.WorkingItem(\r\n new sm.portal.vm.HighSchoolDataItem(\r\n JSON.parse(ko.toJSON(data))\r\n )\r\n );\r\n highschool.WorkingItem.valueHasMutated();\r\n }\r\n\r\n function LoadModelPreDataItem(currentHighSchool) {\r\n var dateFormat = sm.resources.portalResource.getValue('DateFormatExample').toUpperCase();\r\n var mdyDateFormat = \"MM/DD/YYYY\";\r\n var ymdDateFormat = \"YYYY-MM-DDTHH:mm:ss\";\r\n\r\n if (currentHighSchool.StartDate != null && currentHighSchool.StartDate != undefined && currentHighSchool.StartDate.length > 0) {\r\n if (currentHighSchool.StartDate.charAt(1) === '/' || currentHighSchool.StartDate.charAt(2) === '/') {\r\n currentHighSchool.StartDate = moment(currentHighSchool.StartDate, mdyDateFormat).format(dateFormat);\r\n } else {\r\n currentHighSchool.StartDate = moment(currentHighSchool.StartDate, ymdDateFormat).format(dateFormat);\r\n }\r\n }\r\n if (currentHighSchool.EndDate != null && currentHighSchool.EndDate != undefined && currentHighSchool.EndDate.length > 0) {\r\n if (currentHighSchool.EndDate.charAt(1) === '/' || currentHighSchool.EndDate.charAt(2) === '/') {\r\n currentHighSchool.EndDate = moment(currentHighSchool.EndDate, mdyDateFormat).format(dateFormat);\r\n } else {\r\n currentHighSchool.EndDate = moment(currentHighSchool.EndDate, ymdDateFormat).format(dateFormat);\r\n }\r\n }\r\n if (currentHighSchool.GraduationDate != null && currentHighSchool.GraduationDate != undefined && currentHighSchool.GraduationDate.length > 0) {\r\n if (currentHighSchool.GraduationDate.charAt(1) === '/' || currentHighSchool.GraduationDate.charAt(2) === '/') {\r\n currentHighSchool.GraduationDate = moment(currentHighSchool.GraduationDate, mdyDateFormat).format(dateFormat);\r\n } else {\r\n currentHighSchool.GraduationDate = moment(currentHighSchool.GraduationDate, ymdDateFormat).format(dateFormat);\r\n }\r\n }\r\n }\r\n\r\n function LoadModel(currentHighSchool, dataItem, payload) {\r\n //If the HighSchoolAddressInformation object exists, loop through it, find the info that matches the currentHighSchool\r\n //And assign the address data\r\n if (payload.HighSchoolAddressInformation != null && payload.HighSchoolAddressInformation.length > 0) {\r\n\r\n var highSchoolAddressInfo = null;\r\n for (var i = 0; i < payload.HighSchoolAddressInformation.length; i++) {\r\n if (payload.HighSchoolAddressInformation[i].SchoolID === currentHighSchool.HighSchoolID) {\r\n highSchoolAddressInfo = payload.HighSchoolAddressInformation[i];\r\n\r\n dataItem.SchoolCity = ko.observable(highSchoolAddressInfo.SchoolCity);\r\n dataItem.SchoolCountryID = ko.observable(highSchoolAddressInfo.SchoolCountryID);\r\n dataItem.SchoolCountry = ko.observable(highSchoolAddressInfo.SchoolCountry);\r\n\r\n break;\r\n }\r\n }\r\n\r\n }\r\n else {\r\n dataItem.SchoolCity = ko.observable(currentHighSchool.SchoolCity);\r\n dataItem.SchoolCountryID = ko.observable(currentHighSchool.SchoolCountryID);\r\n dataItem.SchoolCountry = ko.observable(currentHighSchool.SchoolCountry);\r\n }\r\n }\r\n\r\n function LoadListData(highSchoolVM, container){\r\n if(container.Payload.ListData){\r\n highSchoolVM.Countries = smapi.access.loadListItemModels(container.Payload.ListData.Countries, highSchoolVM.Countries);\r\n }\r\n }\r\n\r\n function Subscribe(highSchool, newValue){\r\n highSchool.enableSchoolAddressFields(newValue === 0);\r\n if (newValue > 0) {\r\n //Pass in the HighSchoolID\r\n highSchool.LoadAddressFields(highSchool.HighSchoolID());\r\n }\r\n\r\n highSchool.HighSchoolName.subscribe(function () {\r\n // ensure highschool id is zero'd on manual change\r\n highSchool.HighSchoolID(0);\r\n }, highSchool);\r\n }\r\n\r\n function HighSchoolDataItem(highSchoolDataItem){\r\n highSchoolDataItem.HighSchoolName.subscribe(function () {\r\n // ensure highschool id is zero'd on manual change\r\n highSchoolDataItem.HighSchoolID(0);\r\n }, highSchoolDataItem);\r\n\r\n highSchoolDataItem.LoadHighSchool = function (schoolId) {\r\n var url = _baseApiUri + sm.portal.utility.formatString('api/highschool/get?id={0}', schoolId);\r\n\r\n return jQuery.ajax({\r\n url: url,\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 });\r\n };\r\n\r\n highSchoolDataItem.LoadOrganization = function (data) {\r\n if (data == undefined || data == null) {\r\n return null;\r\n }\r\n if (data.Payload == undefined || data.Payload == null) {\r\n return null;\r\n }\r\n if (data.Payload.OrganizationID == undefined || data.Payload.OrganizationID == null) {\r\n return null;\r\n }\r\n\r\n var organizationId = data.Payload.OrganizationID;\r\n var url = _baseApiUri + sm.portal.utility.formatString('api/organization/get?id={0}', organizationId);\r\n\r\n return jQuery.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 });\r\n };\r\n\r\n highSchoolDataItem.LoadMailingAddress = function (data) {\r\n if (data == undefined || data == null) {\r\n return null;\r\n }\r\n if (data.Payload == undefined || data.Payload == null) {\r\n return null;\r\n }\r\n if (data.Payload.Addresses == undefined || data.Payload.Addresses == null) {\r\n return null;\r\n }\r\n if (data.Payload.Addresses.length === 0) {\r\n return null;\r\n }\r\n\r\n var addressId = data.Payload.Addresses[0].ID;\r\n var url = _baseApiUri + sm.portal.utility.formatString('api/mailingaddress/get?id={0}', addressId);\r\n\r\n return jQuery.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 });\r\n };\r\n\r\n highSchoolDataItem.SetAddressFields = function(data) {\r\n if (data == undefined || data == null) {\r\n return;\r\n }\r\n if (data.Payload == undefined || data.Payload == null) {\r\n return;\r\n } \r\n if (data.Payload.City != undefined) {\r\n highSchoolDataItem.SchoolCity(data.Payload.City);\r\n }\r\n if (data.Payload.CountryID != undefined) {\r\n highSchoolDataItem.SchoolCountryID(data.Payload.CountryID);\r\n }\r\n };\r\n\r\n highSchoolDataItem.LoadAddressFields = function (id) {\r\n\r\n var url = _baseApiUri + sm.portal.utility.formatString('api/studentportal/gethighschoolmailingaddress?highschoolID={0}', id);\r\n jQuery.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 highSchoolDataItem.SchoolCity(data.Payload.HighSchoolAddress.SchoolCity);\r\n highSchoolDataItem.SchoolCountryID(data.Payload.HighSchoolAddress.SchoolCountryID);\r\n }\r\n });\r\n };\r\n }\r\n\r\n function ExtractATO(highSchoolVM, stdHighSchoolInformationModel){\r\n\r\n stdHighSchoolInformationModel.SchoolCity = highSchoolVM.SchoolCity;\r\n stdHighSchoolInformationModel.SchoolCountryID = highSchoolVM.SchoolCountryID;\r\n }\r\n\r\n jQuery.extend(true, sm.portal.vm.euhighschool, {\r\n AnythingPopulated: AnythingPopulated,\r\n SaveWorkingChangesSetupWI: SaveWorkingChangesSetupWI,\r\n SaveWorkingChangesWIEdit: SaveWorkingChangesWIEdit,\r\n EditItem: EditItem,\r\n LoadModel: LoadModel,\r\n LoadListData: LoadListData,\r\n Subscribe: Subscribe,\r\n HighSchoolDataItem: HighSchoolDataItem,\r\n ExtractATO: ExtractATO,\r\n LoadModelPreDataItem: LoadModelPreDataItem\r\n });\r\n\r\n})(jQuery);"]}