(function() {
	"use strict";

	window.app.controller("UserController",
	[
		"$uibModal", "userSvc", "downloadSvc",
		function($uibModal, userSvc, downloadSvc) {
			var vm = this;

			vm.users = userSvc.users;

			vm.create = function() {
				$uibModal.open({
					template: "<user-create />",
					backdrop: "static"
				});
			};
			vm.edit = function() {
				$uibModal.open({
					template: "<user-edit />",
					backdrop: "static"
				});
			};
			vm.export = function() {
				userSvc.exportUsers()
					.success(downloadSvc.success);
			};
		}
	]);
})();