2013-05-06 03:38:29 -04:00
|
|
|
var biomed = {};
|
|
|
|
|
2015-04-20 05:31:12 -04:00
|
|
|
angular.module('biomed', ['biomed.filters', 'biomed.services', 'biomed.directives', 'ngResource', 'ngRoute', 'ui.bootstrap.dialog'])
|
2013-05-06 03:38:29 -04:00
|
|
|
.run(function($rootScope) {
|
|
|
|
$rootScope.TECH_GROUPS = {
|
|
|
|
all: 'All',
|
|
|
|
biomed: 'Biomed',
|
2013-06-17 04:08:57 -04:00
|
|
|
ice: 'ICE',
|
2013-05-06 03:38:29 -04:00
|
|
|
sales: 'Sales',
|
|
|
|
other: 'Others'
|
|
|
|
};
|
2015-04-06 03:28:20 -04:00
|
|
|
$rootScope.dayOfYear = moment().dayOfYear();
|
2013-05-06 03:38:29 -04:00
|
|
|
})
|
|
|
|
.config(function($routeProvider, $locationProvider, $httpProvider) {
|
|
|
|
|
|
|
|
var JSON_START = /^\s*(\[|\{[^\{])/,
|
|
|
|
JSON_END = /[\}\]]\s*$/,
|
|
|
|
PROTECTION_PREFIX = /^\)\]\}',?\n/,
|
|
|
|
DATE_MATCHER = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;
|
|
|
|
|
|
|
|
$httpProvider.defaults.transformResponse = [function(data) {
|
|
|
|
if (angular.isString(data)) {
|
|
|
|
data = data.replace(PROTECTION_PREFIX, '');
|
|
|
|
if (JSON_START.test(data) && JSON_END.test(data)) {
|
|
|
|
data = JSON.parse(data, function(key, val) {
|
2014-07-25 03:00:29 -04:00
|
|
|
if (DATE_MATCHER.test(val)) {
|
|
|
|
return new moment(val).zone(-5).toDate();
|
|
|
|
}
|
2013-05-06 03:38:29 -04:00
|
|
|
return val;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
|
|
|
|
$locationProvider.html5Mode(true);
|
|
|
|
$routeProvider
|
|
|
|
.when('/schedule', {
|
|
|
|
templateUrl: '/partials/schedule/index.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "ScheduleIndexCtrl"
|
2013-05-06 03:38:29 -04:00
|
|
|
})
|
|
|
|
.when('/schedule/pms', {
|
|
|
|
templateUrl: '/partials/schedule/pms.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "SchedulePmsCtrl"
|
2013-05-06 03:38:29 -04:00
|
|
|
})
|
|
|
|
.when('/clients', {
|
|
|
|
templateUrl: '/partials/clients/index.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "ClientIndexCtrl",
|
2013-05-06 03:38:29 -04:00
|
|
|
reloadOnSearch: false
|
|
|
|
})
|
|
|
|
.when('/clients/add', {
|
|
|
|
templateUrl: '/partials/clients/add.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "ClientAddCtrl"
|
2013-05-06 03:38:29 -04:00
|
|
|
})
|
|
|
|
.when('/clients/:id', {
|
|
|
|
templateUrl: '/partials/clients/edit.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "ClientEditCtrl"
|
2013-05-06 03:38:29 -04:00
|
|
|
})
|
2015-04-06 06:36:17 -04:00
|
|
|
.when('/accounting', {
|
|
|
|
templateUrl: '/partials/accounting/index.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "AccountingIndexCtrl",
|
2015-04-06 06:36:17 -04:00
|
|
|
reloadOnSearch: false
|
|
|
|
})
|
2013-05-06 03:38:29 -04:00
|
|
|
.when('/workorders', {
|
|
|
|
templateUrl: '/partials/workorders/index.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "WorkorderIndexCtrl",
|
2013-05-06 03:38:29 -04:00
|
|
|
reloadOnSearch: false
|
|
|
|
})
|
|
|
|
.when('/workorders/add', {
|
|
|
|
templateUrl: '/partials/workorders/add.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "WorkorderAddCtrl"
|
2013-05-06 03:38:29 -04:00
|
|
|
})
|
|
|
|
.when('/workorders/:id', {
|
|
|
|
templateUrl: '/partials/workorders/edit.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "WorkorderEditCtrl"
|
2013-05-06 03:38:29 -04:00
|
|
|
})
|
2014-07-25 03:00:29 -04:00
|
|
|
.when('/techs/:id', {
|
|
|
|
templateUrl: '/partials/techs/schedule.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "TechScheduleCtrl"
|
2014-07-25 03:00:29 -04:00
|
|
|
})
|
2014-12-15 02:36:41 -05:00
|
|
|
.when('/posts', {
|
|
|
|
templateUrl: '/partials/posts/index.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "PostIndexCtrl"
|
2014-12-15 02:36:41 -05:00
|
|
|
})
|
|
|
|
.when('/posts/add', {
|
|
|
|
templateUrl: '/partials/posts/add.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "PostAddCtrl"
|
2014-12-15 02:36:41 -05:00
|
|
|
})
|
|
|
|
.when('/posts/:id', {
|
|
|
|
templateUrl: '/partials/posts/edit.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "PostEditCtrl"
|
2014-12-15 02:36:41 -05:00
|
|
|
})
|
2014-07-25 03:00:29 -04:00
|
|
|
.when('/admin', {
|
|
|
|
templateUrl: '/partials/users/index.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "UsersIndexCtrl",
|
2014-07-25 03:00:29 -04:00
|
|
|
reloadOnSearch: false
|
|
|
|
})
|
2014-09-14 06:43:04 -04:00
|
|
|
.when('/admin/users/:id', {
|
|
|
|
templateUrl: '/partials/users/clock.html',
|
2015-04-20 05:31:12 -04:00
|
|
|
controller: "UserClockCtrl"
|
2014-09-14 06:43:04 -04:00
|
|
|
})
|
2013-05-06 03:38:29 -04:00
|
|
|
.otherwise({
|
|
|
|
redirectTo: '/schedule'
|
|
|
|
});
|
|
|
|
});
|