<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('合同详情')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-contract-edit" th:object="${tblContract}">
        <input name="id" th:field="*{id}" type="hidden">
        <input id="leader" name="leader" type="hidden" th:field="*{leader}" />
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">合同名称：</label>
            <div class="col-sm-8">
                <input name="name" th:field="*{name}" class="form-control" type="text" disabled="disabled" />
<!--                [[*{name}]]-->
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">负责人：</label>
            <div class="col-sm-8">
                <select id="leaderId" name="leaderId" class="form-control m-b" disabled="disabled">
                    <option value="">--请选择--</option>
                    <option th:each="leaders:${leaders}" th:value="${leaders.userId}" th:text="${leaders.userName}" th:disabled="${leaders.status == '1'}" th:phone="${leaders.phonenumber}" th:email="${leaders.email}" th:field="*{leaderId}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">甲方：</label>
            <div class="col-sm-8">
                <input name="buyers" th:field="*{buyers}" class="form-control" type="text" disabled="disabled">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">乙方：</label>
            <div class="col-sm-8">
                <input name="sellers" th:field="*{sellers}" class="form-control" type="text" disabled="disabled">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">签约日期：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="signDate" th:value="${#dates.format(tblContract.signDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled="disabled">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">合同期限：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="startDate" th:value="${#dates.format(tblContract.startDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled="disabled" style="float: left;width: 49%;">
                    <div style="float: left;width: 2%;">~</div>
                    <input name="endDate" th:value="${#dates.format(tblContract.endDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled="disabled" style="float: left;width: 49%;">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">金额：</label>
            <div class="col-sm-8">
                <input name="amount" th:field="*{amount}" class="form-control" type="text" disabled="disabled" style="width: 90%;float: left;">元
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">付款方式：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('cnt_pay_mode')}">
                    <input type="radio" th:id="${dict.dictCode}" name="payMode" th:value="${dict.dictValue}" th:checked="${dict.default}" th:field="*{payMode}" disabled="disabled">
                    <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea name="remark" class="form-control" disabled="disabled">[[*{remark}]]</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">状态：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('cnt_status')}">
                    <input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}" th:field="*{status}" disabled="disabled">
                    <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
    var prefix = ctx + "system/contract";
    $("#form-contract-edit").validate({
        focusCleanup: true
    });

    function  selectLeader(e){
        try {
            var opt = $(e.options[e.selectedIndex]);
            var leader = opt.text();
            if(!leader){
                leader = ""
            }
            $('#leader').val(leader);
        }catch (e){

        }
    }

    $("input[name='signDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='startDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='endDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>