/**
 * ReportPeriodCtrl Controller
 * Extracted from clients module
 */

ClientsModule.controller('ReportPeriodCtrl', ['$scope', '$uibModalInstance', function ($scope, $uibModalInstance) {

	$scope.helpers = {
		dates: {
			startDate: moment().subtract('months', 1),
			endDate: moment()
		}
	};

	$scope.ranges = {
		'This month': [moment(), moment()]
	};

	$scope.ok = function () {

		$uibModalInstance.close({ startDate: $scope.helpers.dates.startDate.format('YYYY-MM-DD'), endDate: $scope.helpers.dates.endDate.format('YYYY-MM-DD') });

	};

	$scope.cancel = function () {
		$uibModalInstance.close({ startDate: '', endDate: '' });
	};

	$scope.isValidPeriod = function () {

		return true;
		if ($scope.dates.startDate && $scope.dates.endDate && $scope.dates.startDate < $scope.dates.endDate)
			return true;
		return false;

	};

}]);
