'use strict';
app.controller('timestampRequesterCreateController', ['$scope', '$http', '$modalInstance', '$translate', 'blockUI', 'lib', 'model', function ($scope, $http, $modalInstance, $translate, blockUI, lib, model) {

	$scope.name = model.name;
	$scope.url = model.url;

	var init = function () {
	};

	$scope.submit = function () {
		blockUI.start();
		$http.post('/Api/TimestampPlans/' + model.planId + '/Requesters', {
			name: $scope.name,
			url: $scope.url
		}).then(function (response) {
			$modalInstance.close();
			blockUI.stop();
		}, lib.handleRestError);
	};

	$scope.cancel = function () {
		$modalInstance.dismiss();
	};

	init();
}]);
