<!DOCTYPE html>
<html class="" lang="en">
<head  >

    {% include 'twig/common/header/include.twig' %}
    <script src="/plugin/activity/js/activity.js?v=<?=_version?>" type="text/javascript" charset="utf-8"></script>
    <script src="/dev/lib/handlebars-v4.0.10.js" type="text/javascript" charset="utf-8"></script>
    <script src="/dev/lib/bootstrap-select/js/bootstrap-select.js" type="text/javascript" charset="utf-8"></script>
    <link href="/dev/lib/bootstrap-select/css/bootstrap-select.css" rel="stylesheet">
    <script src="/dev/lib/bootstrap-paginator/src/bootstrap-paginator.js?v=<?=_version?>"  type="text/javascript"></script>
    <script src="/dev/lib/bootstrap-paginator/src/bootstrap-paginator.js" type="text/javascript"></script>
    <link href="/dev/lib/laydate/theme/default/laydate.css" rel="stylesheet">
    <script src="/dev/lib/laydate/laydate.js"></script>

    <link href="/plugin/activity/css/index.css" rel="stylesheet">
</head>

<body class="" data-group="" data-page="projects:issues:index" data-project="default">
{% include 'twig/common/body/script.twig' %}

<section class="has-sidebar page-layout max-sidebar">
    {% include 'twig/common/body/page-left.twig' %}
    <div class="page-layout page-content-body system-page">
        {% include 'twig/common/body/header-content.twig' %}

        <script>
            var findFileURL = "";
        </script>
        <div class="page-with-sidebar system-page">
            {% include 'twig/project/common-page-nav-project.twig' %}

            <div class="content-wrapper page-with-layout-nav page-with-sub-nav">
                <div class="alert-wrapper">
                    <div class="flash-container flash-container-page">
                    </div>
                </div>
                <div class="container-fluid">
                    <div class="content" id="content-body">
                        <div class="row has-side-margin-left30">
                            <div class="col-lg-12">
                                <div class="top-area">
                                    <ul class="nav-links">
                                        <li id="state-all"  class="state_li active" data-value="">
                                            <a  title="<?=project_name?>的活动日志" href="#" ><span> <?=project_name?>的活动日志 </span>
                                            </a>
                                        </li>

                                    </ul>

                                    <div class="nav-controls">
                                        <form id="filter_form" action="" onsubmit="return false" accept-charset="UTF-8" method="get">
                                            <input name="page" id="filter_page" type="hidden" value="1">
                                            <input name="project_id" id="project_id" type="hidden" value="<?=project_id?>">
                                            <input name="sort_by" id="filter_sort_by" type="hidden" value="desc">
                                            <input name="sort_field" id="filter_sort_field" type="hidden" value="id">
                                            <!--<input type="search" name="content" id="filter_content" placeholder="内 容" class="form-control search-text-input input-short" spellcheck="false" value="" />-->
                                            <select name="user_id" id="user_id" title="经办人" class="selectpicker show-tick"  data-width="auto"  data-live-search="true">
                                                <option value="">请选择</option>
                                                {% for row in users %}
                                                    {% set  display_name = row['display_name'] %}
                                                    <option value="<?=row.uid?>"  data-content="<img width='26px' height='26px' class=' float-none' style='border-radius: 50%;' src='/attachment/avatar/<?=row.uid?>.png' > <?=display_name?>"  ><?=display_name?></option>
                                                {% endfor %}
                                            </select>
                                            <input type="text" class="laydate_input_date form-control"  name="start_datetime" id="start_datetime" value="" placeholder="起始时间" autocomplete="off" lay-key="1">
                                            <input type="text" class="laydate_input_date form-control" name="end_datetime" id="end_datetime" value="" placeholder="截止时间" autocomplete="off" lay-key="2">
                                            <select  id="id_type" name="type" class="selectpicker show-tick"  title="类 型"   data-width="auto" >
                                                <option value="">请选择</option>
                                                {% for key,type in type_arr %}
                                                    <option value="<?=key?>"><?=type?></option>
                                                {% endfor %}
                                            </select>
                                        <div class="btn-group">
                                            <a class="btn btn-gray" id="btn-filter" href="#">
                                                <i class="fa fa-filter"></i> 筛 选
                                            </a>
                                            <a class="btn"  href="#"  id="btn-reset"    >
                                                <i class="fa fa-undo"></i> 重 置
                                            </a>
                                        </div>
                                        </form>
                                    </div>
                                </div>
                                <div class="content-list">
                                    <ul  id="activity_wrap" class="event-list">
                                    </ul>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>


{% verbatim %}


<script id="activity_tpl" type="text/html">
    {{#activity}}
    <li class="event-list-item">
        <div class="g-avatar g-avatar-lg event-list-item-avatar">
            {{user_html user_id}}
        </div>

        <div class="event-list-item-content">
            <h4 class="event-list-item-title">
                <a href="/user/profile/{{user_id}}">{{user.display_name}}</a>
                <span class="event">
                    {{action}}
                    {{#if_eq type ''}}
                        <a href="#" title="{{title}}">{{{title}}}</a>
                    {{/if_eq}}
                    {{#if_eq type 'agile'}}
                        <a href="/default/ERP/sprints/{{obj_id}}" title="{{title}}">{{{title}}}</a>
                    {{/if_eq}}
                    {{#if_eq type 'issue'}}
                        <a href="/issue/detail/index/{{obj_id}}" title="{{title}}">{{{title}}}</a>
                    {{/if_eq}}
                    {{#if_eq type 'issue_comment'}}
                        <a href="/issue/detail/index/{{obj_id}}" title="{{title}}">{{{title}}}</a>
                    {{/if_eq}}
                    {{#if_eq type 'user'}}
                        <a href="/user/profile/{{user_id}}" title="{{title}}">{{{title}}}</a>
                    {{/if_eq}}
                    {{#if_eq type 'project'}}
                        <a href="/project/main/home/?project_id={{project_id}}" title="{{title}}">{{{title}}}</a>
                    {{/if_eq}}
                    <div>
                        {{{content}}}
                    </div>
                </span>
            </h4>
            <time class="event-time js-time" title=""
                  datetime="{{time}}"
                  data-toggle="tooltip"
                  data-placement="top"
                  data-container="body"
                  data-original-title="{{time_full}}"
                  data-tid="449">{{time_text}}
            </time>
        </div>
    </li>
    {{/activity}}
    <div class="text-center" style="margin-top: .8em;">
        <span class="text-center">
                总数:<span id="issue_count">{{total}}</span> 每页显示:<span id="page_size">{{page_size}}</span>
        </span>
    </div>
    <div class="gl-pagination" id="ampagination-bootstrap" style="  border-top: 0px solid #e5e5e5; ">

    </div>
</script>

{% endverbatim %}



<script src="/dev/js/handlebars.helper.js?v=<?=_version?>" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">


    var project_root_url = '<?=project_root_url?>';
    var _project_id = '<?=project_id?>';
    var _issueConfig = {
        users:<?=users|json_encode()|raw?>
    };

    var $projectActivityAjax = null;

    $(function() {
        let options = {
            list_render_id:"activity_wrap",
            list_tpl_id:"activity_tpl",
            filter_url: "/activity/fetchByProject"
        };
        $projectActivityAjax = new Activity(options);
        $projectActivityAjax.fetchActivitys();

        $("#btn-filter").click(function(){
            $projectActivityAjax.fetchActivitys()
        });

        $("#btn-reset").click(function(){
            $projectActivityAjax.resetFormData()
        });


        laydate.render({
            elem: '#start_datetime'
            , type: 'datetime'
            , trigger: 'click'
        });
        laydate.render({
            elem: '#end_datetime'
            , type: 'datetime'
            , trigger: 'click'
        });

    });

</script>
</body>
</html>