/// <summary>
        /// Initializes the filter data.
        /// </summary>
        /// <param name="leavesPresenter">The leaves presenter.</param>
        private static void InitializeFilterData(TeamLeavesPresenter leavesPresenter)
        {
            if (string.IsNullOrEmpty(leavesPresenter.FilterType))
            {
                leavesPresenter.FilterType = string.IsNullOrEmpty(leavesPresenter.FilterType) ? Pending : leavesPresenter.FilterType;
            }

            var filtersArray = leavesPresenter.FilterType.Split(',');
            IList<FilterData> filterData = new List<FilterData>();
            filterData.Add(new FilterData { FilterType = Approved, FilterId = 1, IsSelected = filtersArray.Contains(All) || filtersArray.Contains(Approved) });
            filterData.Add(new FilterData { FilterType = FilterCanceled, FilterId = 4, IsSelected = filtersArray.Contains(All) || filtersArray.Contains(FilterCanceled) });
            filterData.Add(new FilterData { FilterType = Pending, FilterId = 0, IsSelected = filtersArray.Contains(All) || filtersArray.Contains(Pending) });
            filterData.Add(new FilterData { FilterType = FilterRejected, FilterId = 2, IsSelected = filtersArray.Contains(All) || filtersArray.Contains(FilterRejected) });
            filterData.Add(new FilterData { FilterType = FilterRevoked, FilterId = 3, IsSelected = filtersArray.Contains(All) || filtersArray.Contains(FilterRevoked) });
            leavesPresenter.AssignFilterDataList(filterData);
        }
        /// <summary>
        /// Indexes the specified filter type.
        /// </summary>
        /// <param name="developerId">The developer identifier.</param>
        /// <param name="filterType">Type of the filter.</param>
        /// <returns>
        /// Team Leaves view
        /// </returns>
        public ActionResult Index(string developerId, string filterType)
        {
            TeamLeavesPresenter presenter = new TeamLeavesPresenter();
            if (presenter != null)
            {
                presenter.TeamMember = string.IsNullOrWhiteSpace(developerId) ? SessionData.Instance.UserInfo.Developer : this.developerService.RetrieveByDeveloperId(Convert.ToInt32(developerId, CultureInfo.CurrentCulture), SessionData.Instance.UserInfo.Developer.DeveloperID);
                var teamList = this.developerService.RetrieveList(SessionData.Instance.UserInfo.Developer.DeveloperID, null, SessionData.Instance.UserInfo.Developer.DeveloperID);
                if (teamList.Count <= 0 && !SessionUserManager.IsUserHR())
                {
                    return this.Redirect(Url.MyLeavesAction());
                }

                if (presenter.TeamMember.DeveloperID != SessionData.Instance.UserInfo.Developer.DeveloperID && !SessionUserManager.IsUserHR() && teamList.Count == 0)
                {
                    return this.Redirect(Url.TeamLeavesAction());
                }
                else
                {
                    if (SessionUserManager.IsUserHR() || this.developerService.RetrieveList(SessionData.Instance.UserInfo.Developer.DeveloperID, null, SessionData.Instance.UserInfo.Developer.DeveloperID).Count() > 0)
                    {
                        this.AddBreadcrumbItem(Resources.Assignments, Url.AssignmentsAction());
                    }

                    presenter.TeamViewType = TeamViewType.Leaves;
                    this.AddBreadcrumbItem(string.Format(CultureInfo.CurrentCulture, CommonUrlFormat, Resources.TeamMemberDashboard, presenter.TeamViewType), Url.TeamDashboardAction());
                    presenter.TeamMember.DeveloperImage = presenter.TeamMember.LoginID.RetrieveDeveloperImageName();
                    presenter.AssignDevelopers(SessionData.Instance.AllDevelopers);
                    presenter.SelectedDate = DateTimeHelper.RetrieveCurrentDateTime();
                    var selectedProject = presenter.SelectedProjectIds;
                    var selectedDeveloper = presenter.SelectedDeveloperIds;
                    var projectsList = this.lookupService.RetrieveProjects(null, null, false, null, SessionData.Instance.UserInfo.Developer.DeveloperID);
                    presenter.AssignMasterProjects(projectsList.Sort());

                    this.SetDeveloperList(presenter);
                    AssignSelectedProjectIds(presenter);
                    AssignSelectedDeveloperIds(presenter);
                    presenter.CurrentMonth = DateTime.Now.ToString(MonthNumberFormat, CultureInfo.InvariantCulture);

                    var holidays = this.lookupService.RetrieveHolidays(DateTime.Now.Year, SessionData.Instance.UserInfo.Developer.DeveloperID).Select(holiday => holiday.Date.ToString(MonthDateFormat, CultureInfo.CurrentCulture)).ToList();
                    for (int count = 0; count < holidays.Count; count++)
                    {
                        if (count == 0)
                        {
                            presenter.Holidays = holidays[count];
                        }
                        else
                        {
                            presenter.Holidays = string.Format(CultureInfo.CurrentCulture, "{0},{1}", presenter.Holidays, holidays[count]);
                        }
                    }

                    var leaveTypes = this.lookupService.RetrieveLeaveTypes(SessionData.Instance.UserInfo.Developer.DeveloperID).ToList();
                    presenter.AssignLeaveTypes(leaveTypes);

                    var leaveDayTypes = this.lookupService.RetrieveLeaveDayTypes(SessionData.Instance.UserInfo.Developer.DeveloperID).ToList();
                    presenter.AssignLeaveDayTypes(leaveDayTypes);
                    presenter.FilterType = !string.IsNullOrEmpty(filterType) ? filterType : Pending;
                    InitializeFilter(presenter, selectedProject, selectedDeveloper);
                    var fromDate = DateTime.Now.RetrieveCurrentYearStartDate();
                    var toDate = DateTime.Now.RetrieveCurrentYearEndDate();
                    presenter.FromDate = fromDate.ToString();
                    presenter.ToDate = toDate.ToString();
                    this.AssignLoanResourceDetails(presenter);
                    if (teamList.Count > 0)
                    {
                        teamList.Add(SessionData.Instance.UserInfo.Developer);
                    }

                    var result = teamList.Where(a => a.DeveloperID == presenter.TeamMember.DeveloperID).ToList();
                    if (result.Count > 0)
                    {
                        presenter.IsUnderHierarchy = true;
                    }

                    IList<FilterData> filterData = new List<FilterData>();
                    filterData.Add(new FilterData { FilterType = All, IsSelected = false });
                    filterData.Add(new FilterData { FilterType = Approved, IsSelected = false });
                    filterData.Add(new FilterData { FilterType = Pending, IsSelected = true });
                    presenter.AssignFilterDataList(filterData);
                    InitializeFilterData(presenter);
                    this.LoadLeaveCounts(presenter);
                }
            }

            return this.View(presenter);
        }