;
(function(){
	const app_cache = require('app-cache');

	angular.module('app.widgets')
	.directive('leftShare',leftShare);
	//leftShare.$inject = ['$scope'];

	function leftShare(){
		var directive = {
			link : leftShareCtr,
		  	templateUrl: "./app/widgets/leftShare/shareTpl.html",
			restrict: 'EA',
			replace:true,
			scope :{
				vmClick:'='
			}

		};
		return directive;
	}
    function leftShareCtr($scope){
			var vm = $scope;
			vm.cur_id = 'all';

			var department =app_cache.cur_user.branchs.map(v=>{
					return {
								id:''+v.id,
								icon: 'icon-department',
								text:v.branchName
							};
			});
			vm.menus = [{
				id:'all',
				icon: 'icon-allFile',
				text:'所有分享'
			},{
				id:'dept_share',
				icon: 'icon-other',
				text:'公共分享',
				childmenus : department
			},{
				id:'person_share',
				icon: 'icon-person',
				text:'个人分享'
			}];

			vm.checked = (id) => {
			    vm.cur_id = id; 	
			    vm.vmClick(id);	
			};
		}
})();