1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- 'use strict';
-
- /* App Module */
-
- var app = angular.module('app', [
- 'ui.bootstrap',
- 'ui.router',
- 'LocalStorageModule',
- 'ngMaterial',
- 'ngMaterialDatePicker',
- 'appSdk'
- ]);
-
- app.config(['$stateProvider', '$urlRouterProvider',
- function($stateProvider, $urlRouterProvider) {
-
- $stateProvider.state('home', {
- url:'/groups?group',
- title: "Courses",
- reloadOnSearch: false,
- templateUrl:'views/home.html',
- controller:'HomeController'
- });
-
- $stateProvider.state('rooms', {
- url:'/rooms?group',
- title: "Rooms",
- reloadOnSearch: false,
- templateUrl:'views/home.html',
- controller:'HomeController'
- });
-
- $stateProvider.state('freeroom', {
- url:'/freeroom',
- title: "Free Rooms",
- templateUrl:'views/freeroom.html',
- controller:'FreeRoomController'
- });
-
- $urlRouterProvider.otherwise('/groups');
-
- if (!('find' in Array.prototype)) {
- Array.prototype.find= function(func) {
- for (var i = 0; i < this.length; ++i) {
- if (func(this[i])) {
- return this[i];
- }
- }
- return null;
- };
- }
-
- }])
- .directive('dateNow', ['$filter', function($filter) {
- return {
- link: function( $scope, $element, $attrs) {
- $element.text($filter('date')(new Date(), $attrs.dateNow));
- }
- };
- }])
- .run(['$rootScope', '$state', 'DataShareBusiness', 'GroupsBusiness', 'StaffsBusiness', 'RoomsBusiness', '$mdDateLocale', '$filter',
- function ($rootScope, $state, DataShareBusiness, GroupsBusiness, StaffsBusiness, RoomsBusiness, $mdDateLocale, $filter) {
- $rootScope.$on('$stateChangeSuccess', function (event, current, previous) {
- $rootScope.title = current.title + " - Chronos";
- });
-
- var promiseLoadEntities = {
- id: "promiseLoadEntities",
- loaderGroups: ["toolbar"],
- groups: ["sidebar"]
- };
- GroupsBusiness.getAll(promiseLoadEntities).then(function(groups)
- {
- StaffsBusiness.getAll(promiseLoadEntities).then(function(staffs)
- {
- RoomsBusiness.getAll(promiseLoadEntities).then(function(rooms)
- {
- DataShareBusiness.Groups = groups;
- DataShareBusiness.Staffs = staffs;
- DataShareBusiness.Rooms = rooms;
- });
- });
- });
-
- $mdDateLocale.firstDayOfWeek = 1;
- $mdDateLocale.formatDate = function(date) {
- return $filter("date")(date, DataShareBusiness.DateFormat);
- };
- }]);
|