'use strict';

var angular = require('angular'),
    _ = require('jsUtil');
require('../modules');
require('../../linker/services/LinkerService');

var module = angular.module('mul.services');

module.factory('mulJobsService', function(LinkerService) {
    return {
        getMulJobs: getMulJobs
    };

    function getMulJobs() {
        var user  = LinkerService.currentUser;
        var jobs = [];
        
        _.each(user.deptIds, function(deptId) {
            var job = {};
            job.deptId = deptId;
            jobs.push(job);
        });
        
        var deptNames = user.deptName.split(',');
        _.each(deptNames, function(deptName, index) {
            jobs[index].deptName = deptName;
        });
        return jobs;
    }
});