var poconsole = angular.module('poconsole', ['ngJustGage', 'n3-line-chart', "ngQuickDate", "ngSails"]);


poconsole.config(function(ngQuickDateDefaultsProvider) {
  // Configure with icons from font-awesome
  return ngQuickDateDefaultsProvider.set({
    closeButtonHtml: "<i class='fa fa-times'></i>",
    buttonIconHtml: "<i class='fa fa-clock-o'></i>",
    nextLinkHtml: "<i class='fa fa-chevron-right'></i>",
    prevLinkHtml: "<i class='fa fa-chevron-left'></i>",
    // Take advantage of Sugar.js date parsing
    parseDateFunction: function(str) {
      d = Date.create(str);
      return d.isValid() ? d : null;
    }
  });
});


poconsole.controller('mainCtrl', function($scope, Page) {
    $scope.Page = Page;
});


//*---- FILTERS -----*//
poconsole.filter('dString', function myDateFormat($filter){
	return function(text){
		var  tempdate= new Date(text);
		return $filter('date')(tempdate, "yyyyMMdd'_'HHmmss");
	};
});


poconsole.filter('sqlite_to_local', function sqliteformat($filter){
	return function(text){
		var utcdate= new Date(text + " UTC");
		return $filter('date')(utcdate, "yyyy-MM-dd hh:mm:ss a");
	};
});
