{"version":3,"file":"sm.portal.vm.highschool.uk.min.js","names":["jQuery","undefined","sm","window","portal","extend","vm","ukhighschool","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","id","url","_baseApiUri","formatString","ajax","type","dataType","contentType","headers","processData","crossDomain","xhrFields","withCredentials","success","textStatus","jqXHR","HighSchoolAddress","ExtractATO","stdHighSchoolInformationModel","LoadModelPreDataItem","dateFormat","resources","portalResource","getValue","toUpperCase","mdyDateFormat","ymdDateFormat","StartDate","charAt","moment","format","EndDate","GraduationDate"],"sources":["assets/js/localization/uk/helpers/viewmodels/admissions/sm.portal.vm.highschool.uk.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,IAyJjDP,EAAOK,QAAO,EAAMH,EAAGE,OAAOE,GAAGC,aAAc,CAC3CC,kBAvJJ,SAA2BC,GAEvB,OAAIA,EAASC,eAAiB,GAAiC,GAA3BD,EAASC,iBAAwBR,EAAGE,OAAOO,QAA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AkBgD,UAAU7C,OAAS,IAC1E,MAA1CH,EAAkBgD,UAAUC,OAAO,IAAwD,MAA1CjD,EAAkBgD,UAAUC,OAAO,GACpFjD,EAAkBgD,UAAYE,OAAOlD,EAAkBgD,UAAWF,GAAeK,OAAOV,GAExFzC,EAAkBgD,UAAYE,OAAOlD,EAAkBgD,UAAWD,GAAeI,OAAOV,IAG/D,MAA7BzC,EAAkBoD,SAAmBpD,EAAkBoD,SAAWxF,GAAaoC,EAAkBoD,QAAQjD,OAAS,IACtE,MAAxCH,EAAkBoD,QAAQH,OAAO,IAAsD,MAAxCjD,EAAkBoD,QAAQH,OAAO,GAChFjD,EAAkBoD,QAAUF,OAAOlD,EAAkBoD,QAASN,GAAeK,OAAOV,GAEpFzC,EAAkBoD,QAAUF,OAAOlD,EAAkBoD,QAASL,GAAeI,OAAOV,IAGpD,MAApCzC,EAAkBqD,gBAA0BrD,EAAkBqD,gBAAkBzF,GAAaoC,EAAkBqD,eAAelD,OAAS,IACpF,MAA/CH,EAAkBqD,eAAeJ,OAAO,IAA6D,MAA/CjD,EAAkBqD,eAAeJ,OAAO,GAC9FjD,EAAkBqD,eAAiBH,OAAOlD,EAAkBqD,eAAgBP,GAAeK,OAAOV,GAElGzC,EAAkBqD,eAAiBH,OAAOlD,EAAkBqD,eAAgBN,GAAeI,OAAOV,GAG9G,GAkGH,CAlLD,CAkLG9E","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.ukhighschool === \"undefined\") {\r\n jQuery.extend(sm.portal.vm, { ukhighschool: {} });\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\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 {\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 function Subscribe(highSchool, newValue){\r\n highSchool.enableSchoolAddressFields(newValue === 0);\r\n if (newValue > 0) {\r\n highSchool.LoadAddressFields(newValue);\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.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\r\n jQuery.extend(true, sm.portal.vm.ukhighschool, {\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);"]}