function MainCtrl($http, $scope, ServiceFactory) { var vm = this; vm.loginStatus = "Login" vm.UserProfile = {}; vm.Action = { subscription: "loginResults", endpoint: ServiceFactory.endpoints.Message } vm.getFormList = function () { vm.message.Profileid = vm.message.RowKey; vm.loading = true; ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { vm.loading = false; vm.Results = response; }); } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.submit = function () { ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { if (response.StatusCode == "Success") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.message = {}; vm.messageResult = response.Message; vm.read(); } if (response.StatusCode == "Failed") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.messageResult = response.Message; } }); } vm.login = function () { ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { if (response[0].EmailStatus == "true") { ServiceFactory.UserProfile(vm.Action.subscription, response[0]); ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); window.location.href = "https://colleageapp2019.azurewebsites.net/" } if (!response[0].EmailStatus) { window.location = '#/home/failed' } }); } function handleResultSet(event, id) { vm.UserProfile = ServiceFactory.StoreUserProfile; } function handleResultSet(event, id) { vm.UserProfile = ServiceFactory.StoreUserProfile; } vm.readUserProfile = function () { vm.message = ServiceFactory.ReadLocally(vm.Action.subscription); } vm.readUserProfile(); function handleResultSet(event, id) { vm.UserProfile = ServiceFactory.StoreUserProfile; } }; function translateCtrl($translate, $scope) { $scope.changeLanguage = function (langKey) { $translate.use(langKey); $scope.language = langKey; }; } function documentlistCtrl($scope, $log, $modal, ServiceFactory) { var vm = this; vm.Action = { subscription: "documentResult", endpoint: ServiceFactory.endpoints.DocumentList, endpointStore: ServiceFactory.endpoints.Store } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.read = (function () { var getparameter = window.location.hash.split('/')[3] ServiceFactory.Api_Key = getparameter; ServiceFactory.Read(vm.Action.endpoint + '/' + getparameter).then(function (response) { vm.results = response; ServiceFactory.StoreData = vm.results; return response; }); }); vm.openDocument = (function (data) { window.open( data.ReadUrl, '_blank' ); }); vm.applist = [ { "ContentType": "application/json" }, { "ContentType": "application/xml" }, { "ContentType": "text/html" }, { "ContentType": "text/plain" }, ]; vm.delete = function (deleteRecord) { ServiceFactory.Delete(vm.Action.endpoint, deleteRecord).then(function (response) { vm.read(); return response; }); } vm.copyToClipboard = function (url) { var copyElement = document.createElement("textarea"); copyElement.style.position = 'fixed'; copyElement.style.opacity = '0'; copyElement.textContent = url; var body = document.getElementsByTagName('body')[0]; body.appendChild(copyElement); copyElement.select(); document.execCommand('copy'); body.removeChild(copyElement); } vm.submit = function (data) { ServiceFactory.Update(vm.Action.endpoint, data).then(function (response) { vm.read(); return response; }); } vm.AddNewDocument = function () { var f = document.getElementById('file').files[0]; r = new FileReader(); r.onloadend = function (e) { // $scope.data = e.target.result; var dataResults = e.target.result; ServiceFactory.UpdateWithApiKey(vm.Action.endpointStore, dataResults).then(function (response) { vm.read(); return response; }); } r.readAsBinaryString(f); }; vm.read(); vm.ViewDetails = function (details) { console.log(details); vm.visible = false; vm.Details = details; vm.visible = true; } function handleResultSet(event, id) { vm.results = ServiceFactory.StoreData; } } function partnersCtrlV2($scope, $log, $modal, ServiceFactory) { var vm = this; vm.Action = { subscription: "partnerResults", Partners: ServiceFactory.endpoints.Partners, Partner: ServiceFactory.endpoints.Partner, readlob: ServiceFactory.endpoints.LineofBusness } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.delete = (function (deletepartner) { ServiceFactory.Delete(vm.Action.Partner, deletepartner).then(function (response) { vm.read(); }); }); vm.read = (function () { ServiceFactory.Read(vm.Action.Partners).then(function (response) { vm.results = response; return response; }); }); vm.openForm = function (currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: "views/partner_details.html", windowClass: "animated fadeIn", size: "lg", controller: 'popupFormCtrl', controllerAs: 'vm', resolve: { items: function () { return ObjInfo = { EndpointUrl: vm.Action.Partner, Read: vm.Action.Partners, Status: vm.Status, PublisherUrl: vm.Action.subscription, ViewModel: currentState } } } }); }; vm.readLob = (function () { ServiceFactory.Read(vm.Action.readlob).then(function (response) { ServiceFactory.StoreData = response; return response; }); }); vm.read(); vm.readLob(); vm.ViewDetails = function (details) { console.log(details); vm.visible = false; vm.Details = details; vm.visible = true; } function handleResultSet(event, id) { vm.results = ServiceFactory.holdContent; } } function Registration($scope, $modal, ServiceFactory) { var vm = this; vm.Action = { subscription: "registrationresults", endpoint: ServiceFactory.endpoints.add } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.read = (function () { ServiceFactory.Read(vm.Action.endpoint).then(function (response) { vm.results = response; ServiceFactory.StoreData = vm.results; return response; }); }); vm.delete = function (deleteRecord) { ServiceFactory.Delete(vm.Action.endpoint, deleteRecord).then(function (response) { vm.read(); return response; }); }; vm.registerUser = function (registrationinfo) { ServiceFactory.Delete(vm.Action.endpoint, registrationinfo).then(function (response) { vm.read(); return response; }); } vm.openForm = function (currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: "views/lob_details.html", windowClass: "animated fadeIn", size: "lg", controller: 'popupFormCtrl', controllerAs: 'vm', resolve: { items: function () { return ObjInfo = { EndpointUrl: vm.Action.endpoint, Read: vm.Action.endpoint, Status: vm.Status, PublisherUrl: vm.Action.subscription, ViewModel: currentState, } } } }); }; vm.read(); vm.packagechoice = [ { "Package": "Personal" }, { "Package": "Proffessional" }, { "Package": "Ultimate" } ]; vm.ViewDetails = function (details) { console.log(details); vm.visible = false; vm.Details = details; vm.visible = true; } function handleResultSet(event, id) { vm.results = ServiceFactory.holdContent; } } function coursesCtrl($scope, $modal, ServiceFactory) { var vm = this; vm.visible = false; vm.Action = { subscription: "course.Results", endpoint: ServiceFactory.endpoints.courses } vm.read = (function () { ServiceFactory.Read(vm.Action.endpoint).then(function (response) { vm.results = response; } ); }); vm.read(); } function contactCtrl($scope, $modal, ServiceFactory) { var vm = this; vm.visible = false; vm.Action = { subscription: "registerResults", endpoint: ServiceFactory.endpoints.register } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.packagechoice = [ { "Package": "" }, { "Package": "Personal" }, { "Package": "Proffessional" }, { "Package": "Ultimate" } ]; vm.submit = function (register) { ServiceFactory.CreateWithJson(vm.Action.endpoint, register).then(function (response) { if (response.StatusCode == "Succcess") { vm.resultmessage = "Thank you for registering. Email verification is still pending"; vm.visible = true; vm.contact = {}; } }); } function handleResultSet(event, id) { vm.results = ServiceFactory.holdContent; } } function validationCtrl($scope, $modal, $stateParams, ServiceFactory) { var vm = this; vm.search = {}; vm.payload = {}; vm.visible = false; vm.Action = { subscription: "validationResults", endpoint: ServiceFactory.endpoints.Message } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.read = (function () { vm.headers = { 'Content-type': 'application/json', 'filename': '07BDF9CD6D5B4F91B20C7233AAAB39AF' }; vm.payload.Rowkey = $stateParams.id; ServiceFactory.SecureConnection(vm.Action.endpoint, vm.payload, vm.headers).then(function (response) { vm.results = response; if (vm.results.StatusCode == "Failed") { vm.message = "Verification Failed. Please go to the 'Contact Us Tab' and provide a detailed message."; } else { vm.message = "Have Sucessfully Registered. Login to continue"; } ServiceFactory.StoreData = vm.results; vm.visible = true; return response; }); }); vm.read(); function handleResultSet(event, id) { vm.results = ServiceFactory.StoreData; } } function verifiyEmailCtrl($scope, $modal, $stateParams, ServiceFactory) { var vm = this; vm.search = {}; vm.payload = {}; vm.visible = false; vm.Action = { subscription: "validationResults", endpoint: ServiceFactory.endpoints.Message } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.read = (function () { vm.headers = { 'Content-type': 'application/json', 'filename': 'EF78C82E4E2B4F89B762B6321F62451E' }; vm.payload.RowKey = $stateParams.id; vm.payload.EmailStatus = "true"; ServiceFactory.SecureConnection(vm.Action.endpoint, vm.payload, vm.headers).then(function (response) { vm.results = response; if (vm.results.StatusCode == "Failed") { vm.failed = "yes"; } if (vm.results.StatusCode == "Success") { vm.success = "yes"; } ServiceFactory.StoreData = vm.results; vm.visible = true; return response; }); }); vm.read(); function handleResultSet(event, id) { vm.results = ServiceFactory.StoreData; } } function profileCtrl($scope, $modal, ServiceFactory) { var vm = this; vm.visible = false; vm.Action = { subscription: "loginResults", endpoint: ServiceFactory.endpoints.profle, profileInfo: ServiceFactory.profile } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.read = (function () { ServiceFactory.StoreUserProfile = ServiceFactory.ReadLocally(vm.Action.subscription); if (ServiceFactory.StoreUserProfile != null) { ServiceFactory.UserProfileSubcription(vm.Action.subscription); vm.loginStatus = "logout" vm.isLogin = true; } }); vm.read(); function handleResultSet(event, id) { vm.UserProfile = ServiceFactory.StoreUserProfile; } } function registerCtrl($scope, $modal, ServiceFactory) { var vm = this; vm.visible = false; vm.Action = { subscription: "registerResults", endpoint: ServiceFactory.endpoints.register } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.packagechoice = [ { "Package": "" }, { "Package": "Personal" }, { "Package": "Proffessional" }, { "Package": "Ultimate" } ]; vm.submit = function (register) { ServiceFactory.CreateWithJson(vm.Action.endpoint, register).then(function (response) { if (response.StatusCode == "Succcess") { vm.resultmessage = "Thank you for registering. Email verification is still pending"; vm.visible = true; vm.contact = {}; } }); } function handleResultSet(event, id) { vm.results = ServiceFactory.holdContent; } } function popupFormCtrl($scope, items, $modalInstance, $log, ServiceFactory) { var vm = this; vm.show = false; vm.results = ServiceFactory.StoreData; vm.holdContent = ServiceFactory.holdContent; vm.payload = items.ViewModel == undefined ? {} : items.ViewModel; vm.item = items; vm.AdditonalInfo = []; vm.EditProcess = function (currentState) { vm.show = true; vm.tab = 2; vm.editContent = currentState }; vm.read = (function () { ServiceFactory.Read(vm.item.Read).then(function (response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription(vm.item.PublisherUrl); return response; }); }); vm.cancel = function () { $modalInstance.close(); }; } function administrationCtrl($scope, $log, $modal, $stateParams, ServiceFactory) { var vm = this; vm.payload = {}; vm.search = {}; vm.Action = { subscription: "messageResults", endpoint: ServiceFactory.endpoints.Message } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.submit = function () { ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { if (response.StatusCode == "Success") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.message = {}; vm.read(); } }); } function handleResultSet(event, id) { vm.results = ServiceFactory.StoreData; } } function collegeSearchCtrl($scope, $log, $modal, $stateParams, ServiceFactory) { var vm = this; vm.payload = {}; vm.search = {}; vm.AddressResults = []; vm.Action = { subscription: "messageResults", endpoint: ServiceFactory.endpoints.Message } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.testfilter = function (value) { vm.AddressResults.push(value); console.log(vm.AddressResults); return value; } vm.submit = function () { vm.message.Title = "A"; vm.loading = true; vm.results = {}; ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { vm.loading = false; ServiceFactory.StoreData = response; vm.recordCount = response.length; ServiceFactory.Subscription(vm.Action.subscription); }); } function handleResultSet(event, id) { vm.results = ServiceFactory.StoreData; } } function contactCtrl($scope, $log, $modal, $stateParams, ServiceFactory) { var vm = this; vm.payload = {}; vm.search = {}; vm.Action = { subscription: "messageResults", endpoint: ServiceFactory.endpoints.Message } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.submit = function () { ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { if (response.StatusCode == "Success") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.message = {}; vm.read(); } }); } function handleResultSet(event, id) { vm.results = ServiceFactory.StoreData; } } function logoutCtrl($scope, $log, ServiceFactory, $window, $location) { var vm = this; vm.logmeout = (function () { $window.localStorage.clear(); window.location.href = "https://colleageapp2019.azurewebsites.net/" }); vm.logmeout(); } function CollegeRegistrationCtrl($scope, $log, $modal, $stateParams, ServiceFactory) { var vm = this; vm.payload = {}; vm.search = {}; vm.Action = { subscription: "messageResults", endpoint: ServiceFactory.endpoints.Message } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.submit = function () { vm.loading = true; ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { vm.loading = false; if (response.StatusCode == "Success") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.message = {}; vm.messageResult = response; } if (response.StatusCode == "Failed") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.messageResult = response.Message; } }); } function handleResultSet(event, id) { vm.results = ServiceFactory.StoreData; } } function FormAppCtrl($scope, $log, $modal, $stateParams, ServiceFactory) { var vm = this; vm.payload = {}; vm.search = {}; vm.Action = { subscription: "messageResults", endpoint: ServiceFactory.endpoints.Message } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.readUserProfile = function () { vm.profileinfo = ServiceFactory.ReadLocally(vm.Action.subscription); if (vm.profileinfo) { vm.message.Profileid = vm.profileinfo.RowKey; vm.message.ReadUrl = vm.formdata.ReadUrl; vm.message.FormName = vm.formdata.FormName; } } vm.submit = function () { vm.loading = true; vm.readUserProfile(); ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { vm.loading = false; if (response.StatusCode == "Success") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.message = {}; vm.messageResult = response.RowKey; } if (response.StatusCode == "Failed") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.messageResult = response.Message; } }); } function handleResultSet(event, id) { vm.results = ServiceFactory.StoreData; } } function viewAllFormsCtrl($scope, $log, $modal, $stateParams, ServiceFactory) { var vm = this; vm.payload = {}; vm.search = {}; vm.message = {}; vm.Action = { subscription: "loginResults", endpoint: ServiceFactory.endpoints.Message } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.readUserProfile = function () { vm.profileinfo = ServiceFactory.ReadLocally(vm.Action.profile); if (vm.profileinfo) { vm.message.Profileid = vm.profileinfo.RowKey; } } function handleResultSet(event, id) { vm.results = ServiceFactory.StoreData; } } function viewDetailFormsCtrl($scope, $log, $modal, $stateParams, ServiceFactory) { var vm = this; vm.payload = {}; vm.search = {}; vm.message = {}; vm.Action = { subscription: "viewFormResults", profile: "loginResults", endpoint: ServiceFactory.endpoints.Message } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.PostUserProfile = function () { vm.profileinfo = ServiceFactory.ReadLocally(vm.Action.subscription); if (vm.profileinfo) { vm.message.PartnerKey = $stateParams.id; vm.message.ReadUrl = vm.formdata.ReadUrl; vm.message.FormName = vm.formdata.FormName; } } vm.submit = function () { vm.loading = true; vm.PostUserProfile(); ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { vm.loading = false; if (response.StatusCode == "Success") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.message = {}; vm.messageResult = response.RowKey; } if (response.StatusCode == "Failed") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.messageResult = response.Message; } }); } vm.readUserProfile = function () { vm.profileinfo = ServiceFactory.ReadLocally(vm.Action.profile); if (vm.profileinfo) { vm.headers = { 'Content-type': 'application/json', 'filename': '622D52C4B1C84EDFA12AFB9B1D122975' }; vm.message.RowKey = $stateParams.id; vm.message.Profileid = vm.profileinfo.RowKey; } } vm.read = function () { vm.readUserProfile(); ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { ServiceFactory.StoreData = response[0]; ServiceFactory.Subscription(vm.Action.subscription); }); } vm.read(); function handleResultSet(event, id) { vm.message = ServiceFactory.StoreData; } } function shareformCtrl($scope, $log, $modal, $stateParams, ServiceFactory) { var vm = this; vm.payload = {}; vm.search = {}; vm.message = {}; vm.Action = { subscription: "viewFormResults", profile: "loginResults", endpoint: ServiceFactory.endpoints.Message } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.readUserProfile = function () { vm.headers = { 'Content-type': 'application/json', 'filename': 'BC04E93B45094BDC86C6F69CD2D6B9E7' }; vm.message.RowKey = $stateParams.id; } vm.read = function () { vm.readUserProfile(); ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { ServiceFactory.StoreData = response[0]; ServiceFactory.Subscription(vm.Action.subscription); }); } vm.read(); function handleResultSet(event, id) { vm.message = ServiceFactory.StoreData; } } angular .module('pbs') .controller('MainCtrl', MainCtrl) .controller('popupFormCtrl', popupFormCtrl) .controller('partnersCtrlV2', partnersCtrlV2) .controller('Registration', Registration) .controller('documentlistCtrl', documentlistCtrl) .controller('contactCtrl', contactCtrl) .controller('registerCtrl', registerCtrl) .controller('validationCtrl', validationCtrl) .controller('profileCtrl', profileCtrl) .controller('administrationCtrl', administrationCtrl) .controller('collegeSearchCtrl', collegeSearchCtrl) .controller('contactCtrl', contactCtrl) .controller('CollegeRegistrationCtrl', CollegeRegistrationCtrl) .controller('FormAppCtrl', FormAppCtrl) .controller('shareformCtrl', shareformCtrl) .controller('verifiyEmailCtrl', verifiyEmailCtrl) .controller('logoutCtrl', logoutCtrl) .controller('viewDetailFormsCtrl', viewDetailFormsCtrl)