#{param name=currentProjectId /}
#{param name=project /}
#{param name=projectStatuses /}
#{param name=tasks /}
#{param name=taskNum /}
#{param name=incomNum/}
#{param name=groupTasks /}
#{param name=keyword /}
#{param name=showCompleted/}
#{param name=groupBy /}
#{param name=orderBy /}
#{param name=filter /}
#{param name=bundle /}
#{param name=orders /}
#{param name=groups /}
#{param name=userTimezone/}
#{param name=viewType/}
#{param name=currentLabelId/}
#{param name=currentLabelName/}
#{param name=advanceSearch/}
#{param name=paging/}

<!-- Consider this -->
#{param name=taskService/}
#{param name=currentUser/}

<%
	import org.exoplatform.commons.utils.HTMLEntityEncoder;
    import org.exoplatform.task.management.model.ViewType;
    import org.exoplatform.task.util.ProjectUtil;

    def isBoardView = (ViewType.BOARD == viewType)
	def encoder = HTMLEntityEncoder.getInstance();
%>

<div class="projectListView" data-projectid="${currentProjectId}" data-labelid="${currentLabelId}">
    <div class="title">
        <div class="uiHeaderBar clearfix">
            <div class="settingActionButtons pull-right">
                <span class="advancedSearch-action pull-left">
                   <a href="javascript:void(0)" class="action-search actionIcon "  title="&{label.search}" rel="tooltip"> <i class="uiIconSearch uiIconLightGray"></i></a>
                   <a href="javascript:void(0)" class="action-close  " style="display:none"> <i class="uiIconClose uiIconLightGray" ></i></a>
                </span>
                <a class="actionIcon toggleFilter" href="#"  title="&{label.filter}" rel="tooltip"><i class="uiIcon uiIconFilter <%=advanceSearch ? "uiIconBlue" : ""%>"></i></a>
                <span class="pull-left">
                    <span class="projectPermalinkContainer"  title="&{label.permalink}" rel="tooltip">
                        <a href="${ProjectUtil.permalink(currentProjectId, filter, currentLabelId)}" data-toggle="popover" data-placement="left"
                           class="permalink actionIcon projectPermalink" style="position: relative;">
                            <i class="uiIconPermalink"></i>
                        </a>
                    </span>
                </span>
                <div class="projectPermalinkPopoverContent" style="display:none">
                    <div>
                        <i class="uiIconPermalink"></i>
                        &{popover.title.linkToShare}
                    </div>
                    <div class="input-field input-xlarge">
                        <form method="GET" action="#">
                            <input readonly type="text" name="" value="">
                        </form>
                    </div>
                </div>
            </div>
            <div class="pull-right search-container">
                <form class="UIForm taskSearchForm" action="#" onsubmit="javascript:void(0)">
                    <div class="uiSearchForm uiSearchInput searchWithIcon">
                         <a title="" class="advancedSearch" rel="tooltip" data-placement="bottom" href="javascript:void(0)" data-original-title="&{label.search}"><i class="uiIconSearch uiIconLightGray"></i></a>
                         <input type="text"  name="keyword" value="${keyword}" placeholder="&{label.search}" >
                         <input type="hidden" name="groupBy" value="${groupBy}"/>
                         <input type="hidden" name="orderBy" value="${orderBy}"/>
                         <input type="hidden" name="filter" value="${filter}"/>
                         <input type="hidden" name="viewType" value="${viewType.name()}"/>
                         <input type="hidden" name="page" value="${paging.currentPage}"/>
                         <input type="hidden" name="showCompleted" value="${showCompleted}"/>
                         <input type="hidden" name=incomNum value="${incomNum}"/>
                     </div>
                </form>
            </div>
            <%
              def name = bundle.getString("label.projects");
              if (currentProjectId > 0) {
                name = project.name;
              } else if (currentProjectId == -1) {
                name = bundle.getString("label.incoming");
              } else if (currentProjectId == -2) {
                if (filter.isEmpty()) {
	               name = bundle.getString("label.allTasks");               
                } else {
                  name = bundle.getString("label." + filter);
                }
              } else if (currentLabelId == 0) {
                name = bundle.getString("label.labels");
              } else if (currentLabelId > 0) {
                name = currentLabelName;
              }
            %>
            <div class="label-title pull-left projectName">${encoder.encode(name)}</div>
            <div class="alignBtnGroup center">
                    <%if (currentProjectId > 0) { %>
                <ul class="btn-group normal-group">
                    <li class="btn ${!isBoardView ? 'active' : ''}">
                        <a href="javascript:void(0);" data-viewtype="${ViewType.LIST.name()}">&{label.listView}</a>
                    </li>
                    <li class="btn ${currentProjectId <= 0 ? "disabled" : ""} ${isBoardView ? 'active' : ''}">
                        <a href="javascript:void(0);" data-viewtype="${ViewType.BOARD.name()}">&{label.boardView}</a>
                    </li>
                </ul>
                    <%} %>
            </div>
        </div>
    </div>
    <div class="uiContentBox">
        <% if (isBoardView) {%>
            #{include path=taskBoardView.gtmpl/}
        <%} else {%>
            #{include path=taskListView.gtmpl/}
        <%}%>
    </div>
</div>
<script type="text/javascript">
    require(['taskCenterView'], function(taskCenterView) {
        taskCenterView.init();
    });
</script>


