(function(){"use strict";angular.module("appCWHome",["ngRoute","ngAnimate","ngMessages","ui.bootstrap","appCWUtils","btford.markdown"]).config(["$routeProvider","$locationProvider","$httpProvider",function(n,t,i){n.caseInsensitiveMatch=!0;n.when("/",{templateUrl:"Home/Root/Login",controller:"LoginController"}).when("/Registration",{templateUrl:"Registration/RegisterUserForm",controller:"RegistrationController"}).when("/NewService",{templateUrl:"Home/RequestNewService/Index",controller:"RequestNewServiceController"}).when("/HomeForms/:formId",{templateUrl:function(n){return"CustomForm/LoadCustomForm/"+n.formId},controller:"CustomFormController"}).when("/ExpressPayId",{templateUrl:"Home/ExpressPayment/Identification",controller:"ExpressPaymentIdController"}).when("/ExpressPay/:customerNumber/:locationId",{templateUrl:"Home/ExpressPayment/Pay",controller:"ExpressPaymentController"}).when("/PrivacyPolicy",{templateUrl:"About/PrivacyPolicy"}).when("/TermsAndConditions",{templateUrl:"About/TermsAndConditions"}).when("/RefundPolicy",{templateUrl:"About/RefundPolicy"}).when("/ForgotPassword",{templateUrl:"Home/User/ForgotPassword",controller:"UserController"}).when("/ForgotUsername",{templateUrl:"Home/User/ForgotUsername",controller:"UserController"}).when("/RunOnce",{templateUrl:"Home/RunOnce",controller:"UserController"}).when("/ResetPassword/:customerGuid",{templateUrl:function(n){return"Home/User/ResetPassword/"+n.customerGuid},controller:"PasswordResetController"}).otherwise({redirectTo:"/"});t.html5Mode(!0);i.interceptors.push("httpLoaderInterceptor");i.interceptors.push("httpModelStateInterceptor")}])})(),function(){"use strict";function n(n,t){n.showAjaxLoader=!1;n.isActive=function(n){return t.path().indexOf("/HomeForms")>=0&&n=="/HomeForms"?!0:n===t.path()};n.$on("cw.showAjaxLoader",function(){n.showAjaxLoader=!0});n.$on("cw.hideAjaxLoader",function(){n.showAjaxLoader=!1})}angular.module("appCWHome").controller("HomeNavController",n);n.$inject=["$scope","$location"]}(),function(){"use strict";function n(n){function t(t){n.alerts.length===2&&n.alerts.splice(0,1);n.alerts.push(t)}function i(){n.alerts=[]}function r(){for(var t=0;t<n.alerts.length;t++)(n.alerts[t].type==="danger"||n.alerts[t].type==="warning")&&n.alerts.splice(t,1)}n.alerts=[];n.$on("cw.errorNotification",function(n,i){i.type="danger";t(i)});n.$on("cw.warningNotification",function(n,i){i.type="warning";t(i)});n.$on("cw.infoNotification",function(n,i){i.type="info";t(i)});n.$on("cw.successNotification",function(n,i){i.type="success";t(i)});n.$on("cw.clearAllNotifications",function(){i()});n.$on("cw.clearAllErrorsAndWarnings",function(){r()});n.$on("$routeChangeSuccess",function(n,t){t.loadedTemplateUrl==="Home/Root/Login"?r():i()});n.closeAlert=function(t){n.alerts.splice(t,1)}}angular.module("appCWHome").controller("NotificationController",n);n.$inject=["$scope"]}(),function(){"use strict";function n(n,t,i,r){n.isSubmitting=!1;n.onSubmit=function(){n.isSubmitting=!0;n.error=null;t.post("api/Home/LoginApi/Post",n.loginModel).then(function(){r.location.href="Customer"},function(t){n.isSubmitting=!1;n.error=t.data.message})}}angular.module("appCWHome").controller("LoginController",n);n.$inject=["$scope","$http","$location","$window"]}(),function(){"use strict";function n(n){n.LoadCustomForm=function(n){var t="HomeForms/"+n;window.location=t}}angular.module("appCWHome").controller("CustomFormController",n);n.$inject=["$scope","$route","$location"]}(),function(){"use strict";function n(n,t,i,r,u){n.isSubmitting=!1;n.resetPassword=function(){n.isSubmitting=!0;n.modelState=null;u.clearAll();n.model.customerGuid=r.customerGuid;t.post("api/Home/UserApi/ResetPassword",n.model).then(function(t){n.isSubmitting=!1;u.showSuccess(t.data);i.path("/")},function(t){n.isSubmitting=!1;t.data.modelState?n.modelState=t.data.modelState:u.showError(t.data)})}}angular.module("appCWHome").controller("PasswordResetController",n);n.$inject=["$scope","$http","$location","$routeParams","notificationService"]}(),function(){"use strict";function n(n,t,i,r){function u(u){n.isSubmitting=!0;r.clearAll();t.post(u,n.model).then(function(t){n.isSubmitting=!1;r.showSuccess(t.data);i.path("/")},function(t){n.isSubmitting=!1;r.showError(t.data)})}n.isSubmitting=!1;n.sendPasswordReset=function(){u("api/Home/UserApi/ForgotPassword")};n.sendUsername=function(){u("api/Home/UserApi/ForgotUsername")};n.runOnce=function(){u("api/Home/RunOnceApi")}}angular.module("appCWHome").controller("UserController",n);n.$inject=["$scope","$http","$location","notificationService"]}(),function(){"use strict";function n(n,t,i,r){n.birthDatePicker={isOpened:!1,maxDate:new Date,minDate:new Date(1900,0,1),dateOptions:{showWeeks:!1},format:"M/d/yyyy"};n.openBirthDatePicker=function(t){t.preventDefault();t.stopPropagation();n.birthDatePicker.isOpened=!0};n.onBlur=function(t){(typeof n.userIdForm[t.currentTarget.id].$viewValue!="undefined"||n.userIdForm[t.currentTarget.id].$viewValue!=null)&&n.userIdForm[t.currentTarget.id].$invalid==!0&&(n.userIdForm[t.currentTarget.id].$dirty=!0,n.userIdForm[t.currentTarget.id].$pristine=!1,n.userIdForm[t.currentTarget.id].$setValidity("serverError",!0))};n.onSubmit=function(){n.userIdForm.$invalid||(n.modelState=null,t.post("Home/ExpressPayment/Identification",n.model).then(function(t){t.status==200&&i.path("ExpressPay/"+n.model.customerNumber+"/"+n.model.locationID)},function(t){t.data.modelState?n.modelState=t.data.modelState:(t.data=="Bad Request"&&(t.data=t,t.data.header="Bad Request",t.data.message='Received a http status of 400, "Bad Request".  Please ensure that all form fields values are correctly filled in.  If the problem persist please contact customer support.'),r.showError(t.data))}))}}angular.module("appCWHome").controller("ExpressPaymentIdController",n);n.$inject=["$scope","$http","$location","notificationService"]}(),function(){"use strict";function n(n,t,i,r){function u(){var u="?customerNumber="+t.customerNumber+"&locationId="+t.locationId;i.get("Home/ExpressPayment/GetExpressPayData"+u).then(function(t){n.customer=t.data},function(n){r.showError(n.data)})}u()}angular.module("appCWHome").controller("ExpressPaymentController",n);n.$inject=["$scope","$routeParams","$http","notificationService"]}(),function(){"use strict";function n(n,t,i,r){function f(n){i.postAndRedirectExpressPayToCSIPay(n,u)}function e(n){r.postAndRedirectExpressPayToMoneris(n,u)}function u(){n.payment.enabled=!0}n.payment={enabled:!0,amount:n.customer.paymentAmount<0?0:n.customer.paymentAmount,accountType:"R"};n.cannotMakePayment=function(){return n.ExpressPaymentForm.paymentAmount.$invalid||n.payment.amount<=0||!n.payment.enabled};n.goToHpgPage=function(){n.payment.enabled=!1;var i={customerNumber:n.customer.customerNumber,locationId:n.customer.locationId,amount:n.payment.amount};t.postAndRedirectExpressPayToHpg(i,u)};n.goToCSIPayPage=function(){n.payment.enabled=!1;var t={customerNumber:n.customer.customerNumber,customerName:n.customer.customerName,locationId:n.customer.locationId,amount:n.payment.amount,email:n.customer.email,accountType:n.payment.accountType};i.checkPaymentRestrictionsCSIPayExpressPay(t,f,u)};n.goToMonerisPage=function(){n.payment.enabled=!1;var t={customerNumber:n.customer.customerNumber,locationId:n.customer.locationId,amount:n.payment.amount,email:n.customer.email,accountType:n.payment.accountType};r.checkPaymentRestrictionsExpressPayMoneris(t,e,u)}}angular.module("appCWHome").controller("ExpressPaymentProcessorController",n);n.$inject=["$scope","hpgPaymentService","csipayPaymentService","monerisPaymentService"]}(),function(){"use strict";function n(n,t,i){function r(){n.minDate=new Date;var t=n.minDate.getFullYear()+5;n.maxDate=new Date;n.maxDate.setFullYear(t)}n.model={effectiveDate:new Date,billToAddressIsSame:!0};n.open=function(t){t.preventDefault();t.stopPropagation();n.opened=!0};r();n.dateOptions={showWeeks:!1};n.format="M/d/yyyy";n.onNext=function(){var r=i.open({animation:!0,templateUrl:"agreeToTermsAndConditionsModal.html",controller:"AgreeToTermsAndConditionsModalInstanceCtrl",size:"lg",keyboard:!1,resolve:{model:function(){return n.model}}});r.result.then(function(n){n&&t.path("/")},function(){n.requestForm.$submitted=!1;n.model.agreeToTerms=!1})}}function t(n,t,i,r,u){n.model=u;n.isSubmitting=!1;n.ok=function(){var u,f,e;n.isSubmitting=!0;u="";for(e in n.model)f=n.model[e],f!==undefined&&f!==null&&(u+=encodeURIComponent(e)+"="+encodeURIComponent(f)+"&");u=u.substr(0,u.length-1);i({url:"api/Home/RequestNewServiceApi/Post",method:"POST",data:u,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(function(i){r.showSuccess(i.data);n.isSubmitting=!1;t.close(n.model)},function(i){n.isSubmitting=!1;t.close();r.showError(i.data)})};n.cancel=function(){t.dismiss("cancel")}}angular.module("appCWHome").controller("RequestNewServiceController",n);n.$inject=["$scope","$location","$uibModal"];angular.module("appCWHome").controller("AgreeToTermsAndConditionsModalInstanceCtrl",t);t.$inject=["$scope","$uibModalInstance","$http","notificationService","model"]}(),function(){"use strict";function n(n,t,i,r){n.isSubmitting=!1;n.birthDatePicker={isOpened:!1,maxDate:new Date,minDate:new Date(1900,0,1),dateOptions:{showWeeks:!1},format:"M/d/yyyy"};n.openBirthDatePicker=function(t){t.preventDefault();t.stopPropagation();n.birthDatePicker.isOpened=!0};n.onSubmit=function(){n.userIdForm.$invalid||(n.isSubmitting=!0,n.modelState=null,t.post("api/RegistrationApi",n.model).then(function(t){r.showSuccess(t.data);n.isSubmitting=!1;i.path("/")},function(t){n.isSubmitting=!1;t.data.modelState?n.modelState=t.data.modelState:r.showError(t.data)}))}}angular.module("appCWHome").controller("RegistrationController",n);n.$inject=["$scope","$http","$location","notificationService"]}()