<!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-payPlan-edit" th:object="${financePayPlan}">
            <input name="planId" th:field="*{planId}" type="hidden">
            <input name="customerId" type="hidden" id="customerId"  th:field="*{customerId}"/>
            <input name="orderId" th:field="*{orderId}" type="hidden" id="orderId" />
            <div class="form-group">    
                <label class="col-sm-3 control-label">回款主题：</label>
                <div class="col-sm-8">
                    <input name="planName" th:field="*{planName}" class="form-control" type="text">
                </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">
	                    <input name="customerName"  onclick="selectCustomer()" th:field="*{customer.customerName}" class="form-control" type="text" placeholder="请选择所属客户 " id="customerName" required readonly>
	                    <span class="input-group-addon"><i class="fa fa-search"></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">
                   		<input name="orderName"  id="orderName"  onclick="selectOrder()"  th:field="*{order.orderName}" class="form-control" type="text" placeholder="请选择成交订单 " required readonly>
                   		<span class="input-group-addon"><i class="fa fa-search"></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="planMoney" th:field="*{planMoney}" class="form-control" type="number" required>
                </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">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="planDate" th:value="${#dates.format(financePayPlan.planDate, 'yyyy-MM-dd HH:mm')}" class="form-control" placeholder="yyyy-MM-dd HH:mm" type="text" required>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">计划回款方式：</label>
                <div class="col-sm-8">
                    <select name="planType" class="form-control m-b" th:with="type=${@dict.getType('pay_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{planType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">期次：</label>
                <div class="col-sm-8">
                    <select name="planTimes" class="form-control m-b" th:with="type=${@dict.getType('pay_times')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{planTimes}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">已回款：</label>
                <div class="col-sm-8">
                    <input name="payedMoney" th:field="*{payedMoney}" class="form-control" type="number">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "crm/payPlan";
        $("#form-payPlan-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-payPlan-edit').serialize());
            }
        }

        $("input[name='planDate']").datetimepicker({
        });
    </script>
    <script src="../static/crm/customer.js" th:src="@{/crm/common.js}"></script>
</body>
</html>