<!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-fee-edit" th:object="${financeFee}">
            <input name="feeId" th:field="*{feeId}" type="hidden">
            <input name="customerId" type="hidden" id="customerId"  th:field="*{customerId}"/>
            <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('fee_type')}">
                        <input type="radio" th:id="${'feeType_' + dict.dictCode}" name="feeType" th:value="${dict.dictValue}" th:field="*{feeType}" required>
                        <label th:for="${'feeType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">收支金额：</label>
                <div class="col-sm-8">
                    <input name="feeMoney" th:field="*{feeMoney}" class="form-control" type="number" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收支时间：</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="feeDate" th:value="${#dates.format(financeFee.feeDate, '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 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">成交订单：</label>
                <div class="col-sm-8">
                    <input name="orderId" th:field="*{orderId}" 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">
                    <input name="feeName" th:field="*{feeName}" class="form-control" type="text" placeholder="咨询费、招待费等 "  required>
                </div>
            </div>
            <div class="form-group">
                 <label class="col-xs-3 control-label">备注：</label>
                 <div class="col-xs-8">
                     <textarea name="remark" maxlength="500" class="form-control" rows="3">[[*{remark}]]</textarea>
                 </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/fee";
        $("#form-fee-edit").validate({
            focusCleanup: true
        });

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

        $("input[name='feeDate']").datetimepicker({
        });
        
        /*  费用收支-新增-选择客户 */
        function selectCustomer() {
        	 var url = ctx + "crm/customer/selectCustomer";
        	 $.modal.open("选择客户", url);
		}
    </script>
</body>
</html>