UNPKG

consumerportal

Version:

mydna Custimised for you

123 lines (107 loc) 5.82 kB
/// <reference path="includes.ts" /> module mydna { import IUserService = services.IUserService; import IPatientService = services.IPatientService; angular .module('app', [ 'ngRoute', 'ngMessages', 'ngTouch', 'mydnaValidator', 'appMemorySrvc', 'errorHandlerSrvc', 'logSrvc', 'smoothScroll', 'scrollerSrvc', 'cfp.hotkeys', 'apiSrvc', 'locationSrvc', 'passwordMatcher', 'passwordStrengthSrvc', 'authenSrvc', 'ui.bootstrap', 'rorymadden.date-dropdowns', 'ui.mask', 'UtilitySrvc', 'templates' ]) .config(Config) .run(Run); Config.$inject = ['$routeProvider', '$locationProvider']; function Config($routeProvider: any, $locationProvider: any) { $locationProvider.hashPrefix(''); let buildPath = (controller: string, template: string = null, user: boolean = true, loggedOut: boolean = false): any => { let obj: any = { controller: controller + 'Ctrl', controllerAs: 'vm', templateUrl: `views/${template || controller}.html`, }; if (user) { obj.resolve = { user: ['userService', function (userService: IUserService) { return userService.user(); }], patientCases: ['patientService', function (patientService: IPatientService) { return patientService.cases(); }], }; } else if (loggedOut) { obj.resolve = { user: ['userService', function (userService: IUserService) { return userService.isLoggedOut(); }] }; } return obj; }; $routeProvider .when('/login', buildPath('login', null, false, true)) .when('/login/:imp', buildPath('login', null, false, true)) .when('/dashboard', buildPath('dashboard')) .when('/acctmgmt/contactdetails', buildPath('acctMgmtContactDetails', 'acctmgmt/contactdetails')) //.when('/acctmgmt/emailpreferences', buildPath('acctmgmt/emailpreferences', 'emailPreferences')) .when('/acctmgmt/findpatient', buildPath('acctMgmtFindPatient', 'acctmgmt/findpatient', false)) .when('/acctmgmt/forgotpassword', buildPath('acctMgmtForgotPassword', 'acctmgmt/forgotpassword', false)) .when('/acctmgmt/logindetails', buildPath('acctMgmtLoginDetails', 'acctmgmt/logindetails')) .when('/acctmgmt/register', buildPath('acctMgmtRegister', 'acctmgmt/register', false)) .when('/acctmgmt/personaldetails', buildPath('acctMgmtPersonalDetails', 'acctmgmt/personaldetails')) .when('/acctmgmt/resetpassword/:user/:token*', buildPath('acctMgmtResetPassword', 'acctmgmt/resetpassword', false, true)) .when('/acctmgmt/setpassword', buildPath('acctMgmtSetPassword', 'acctmgmt/setpassword', false)) .when('/acctmgmt/signindetails', buildPath('acctMgmtSignInDetails', 'acctmgmt/signindetails', false)) .when('/alcohol', buildPath('alcoholDashboard', 'alcohol/dashboard')) .when('/alcohol/results', buildPath('alcoholResults', 'alcohol/results')) .when('/alcohol/implications', buildPath('alcoholConsiderations', 'alcohol/implications')) .when('/alcohol/science', buildPath('alcoholScience', 'alcohol/science')) .when('/alcohol/report', buildPath('alcoholReport', 'alcohol/report')) .when('/alcohol/report/:ADH1B/:ALDH2', buildPath('alcoholReport', 'alcohol/report')) .when('/meds', buildPath('medsMedications', 'meds/medications')) .when('/meds/profile', buildPath('medsProfile', 'meds/profile')) .when('/meds/browser', buildPath('medsBrowser', 'meds/browser')) .when('/meds/my', buildPath('medsMy', 'meds/my')) .when('/meds/search', buildPath('medsSearch', 'meds/search')) .when('/meds/results', buildPath('medsResults', 'meds/results')) .when('/diet/basic', buildPath('dietBasic', 'diet/basic')) .when('/diet/:type', buildPath('dietDashboard', 'diet/dashboard')) .when('/diet/:type/guidelines', buildPath('dietGuidelines', 'diet/guidelines')) .when('/diet/:type/meals', buildPath('dietMeals', 'diet/meals')) .when('/diet/:type/servings', buildPath('dietServings', 'diet/servings')) .when('/sports', buildPath('sportsDashboard', 'sports/dashboard')) .when('/sports/training', buildPath('sportsTraining', 'sports/training')) .when('/sports/results', buildPath('sportsResults', 'sports/results')) .when('/sports/science', buildPath('sportsScience', 'sports/science')) .when('/myreports', buildPath('resultsReports', 'reports/owned')) .when('/help/main', buildPath('helpMain', 'help/main')) .when('/help/contactus', buildPath('helpContactUs', 'help/contactus')) .when('/reports/marketplace', buildPath('marketplace', 'reports/marketplace')) .when('/reports/checkout', buildPath('checkout', 'reports/checkout')) .otherwise({redirectTo: '/login'}); } Run.$inject = ['mydnaValues', 'authenSrvc']; function Run( mydnaValues: ImyDNAValues, authenSrvc: authenSrvc.IAuthenService, ) { mydnaValues.baseUrl = webApiBaseUrl; mydnaValues.feedUrl = feedApiUrl; } }