<#assign base=request.contextPath />
<#import "../common/defaultLayout.ftl" as defaultLayout>
<@defaultLayout.layout>
    <link rel="stylesheet" href="../assets/css/amazeui.switch.css"/>
    <div class="admin-content">
        <div class="am-cf am-padding" style="padding:1rem 1.6rem 1.6rem 1rem;margin:0px;">
            <!--  padding:1px 2px 3px 4px;上、右、下,和左   -->
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">人力成本管理</strong> /
                <small>人力成本管理</small>
            </div>
        </div>
        <div class="am-g">
            <div class="am-u-sm-12">
                <form class="am-form" id="listForm" action="${base}/humanCost/list" method="POST">
                    <input type="hidden" id="keywords" name="keywords" value='${keywords!""}'/>
                    <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
                        <tbody>
                        <tr>
                            <th class="am-text-middle">项目时间</th>
                            <td>
                                <div class="am-u-sm-10">
                                    <div class="am-form am-form-inline">
                                        <div class="am-form-group am-form-icon">
                                            <input type="text" id="time" autocomplete="off" readonly value="${time!}">
                                        </div>
                                    </div>
                                </div>
                            </td>

                            <td colspan="2">
                                <div align='right'>
                                    <@shiro.hasPermission name="HUMAN_QUERY">
                                    <button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
                                            id="submit-btn">搜索
                                    </button>
                                    <button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
                                            id="submit-btn-export">导出
                                    </button>
                                    </@shiro.hasPermission>
                                </div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
            <div class="am-u-sm-12 am-u-md-12" style="padding:0 1.6rem 1.6rem 1rem;margin:0;">
                <div class="am-btn-toolbar" style="padding-left:.5rem;">
                    <div class="am-btn-group am-btn-group-xs">
                        <@shiro.hasPermission name="HUMAN_IMPORT">

                        </@shiro.hasPermission>
                    </div>
                </div>
            </div>
        </div>

        <div class="am-g">
            <div class="am-u-sm-12">
                <div class="am-scrollable-horizontal">
                    <table class="am-table am-table-striped am-table-hover table-main">
                        <thead>
                        <tr class="am-text-nowrap">
                            <th class="table-title">项目名称</th>
                            <th class="table-title">人力总计</th>
                            <th class="table-title">${individualTime!}</th>

                        </tr>
                        </thead>
                        <tbody>
                        <#list    pager.list as list>
                            <tr>
                                <td>${list.projectName!}</td>
                                <td>${(list.userCost!0)?string("#,##0.##")}</td>
                                <td>${(list.userCost!0)?string("#,##0.##")}</td>
                            </tr>
                        </#list>
                        </tbody>
                    </table>
                </div>
                <div class="am-cf">
                    <!-- 分页 -->
                    <#if (pager.list)?exists && (pager.list?size>0) >
                        <div class="am-fr">
                            <#include "../common/common_pager.ftl">
                        </div>
                    <#else>
                        <div class="am-kai" align="center">
                            <h3>没有找到任何记录!</h3>
                        </div>
                    </#if>
                </div>

            </div>
        </div>


        <footer class="admin-content-footer">
            <hr>
        </footer>
    </div>
</@defaultLayout.layout>
<script src="${base}/layui/layui.js"></script>
<script src="../assets/js/amazeui.switch.js"></script>
<script type="text/javascript">
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        laydate.render({
            elem: '#time',
            type: 'month',
            btns: ['confirm'],
            trigger: 'click',
            ready: function(date){
                console.log(date);
            }
        });
    });

    $(function () {

        $("#submit-btn").on("click", function () {
            $("#pageNumber").val(1);
            setKeywords();
            $("#listForm").attr("action","${base}/humanCost/list");
            $("#listForm").submit();
        });

        $("#submit-btn-export").on("click", function () {
            setKeywords();
            $("#listForm").attr("action","${base}/humanCost/export");
            $("#listForm").submit();
        });


        function setKeywords() {
            var keywordsObj = {};
            if ($("#time").val())
                keywordsObj.time = $("#time").val();
            var keywords = "";
            if (!$.isEmptyObject(keywordsObj)) {
                keywords = JSON.stringify(keywordsObj);
            }
            console.log("keywords = " + keywords);

            $("#keywords").val(keywords);
        }


    });

</script>
















