(function() {
	'use strict';

	window.app.directive('inventoryTypeList', inventoryTypeList);
	function inventoryTypeList() {
		return {
			scope: { "inventoryTypes": "=" },
			templateUrl: '/inventoryType/template/inventoryTypeList.tmpl.cshtml',
			controller: controller,
			controllerAs: 'vm'
		}
	}

	controller.$inject = ['$scope', '$uibModal'];
	function controller($scope, $uibModal) {
		var vm = this;

		vm.inventoryTypes = $scope.inventoryTypes;
		vm.edit = edit;

		function edit(inventoryType) {
			$uibModal.open({
				template: '<edit-inventory-type inventory-type="inventoryType" />',
				scope: angular.extend($scope.$new(true), { inventoryType: inventoryType })
			});
		}
	}
})();