<!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-task-edit" th:object="${playletTask}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">任务id：</label>
            <div class="col-sm-8">
                <input name="taskId" th:field="*{taskId}" class="form-control" type="text" required>
            </div>
        </div>
        <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" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">短剧：</label>
            <div class="col-sm-8">
                <select id="itemId" name="itemId" class="form-control m-b" required>
                    <option th:each="playletItem:${playletItems}" th:value="${playletItem.id}" th:text="${playletItem.videoName}" th:field="*{itemId}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">参与人数：</label>
            <div class="col-sm-8">
                <textarea name="peopleNumber" th:field="*{peopleNumber}" class="form-control" required></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">提成比例：</label>
            <div class="col-sm-8">
                <textarea name="commissionRate" th:field="*{commissionRate}" class="form-control" required></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">任务链接：</label>
            <div class="col-sm-8">
                <textarea name="taskUrl" th:field="*{taskUrl}" class="form-control" required></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">任务网盘链接：</label>
            <div class="col-sm-8">
                <textarea name="taskDiskUrl" th:field="*{taskDiskUrl}" class="form-control" required></textarea>
            </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="startTime" th:value="${#dates.format(playletTask.startTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                    <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="endTime" th:value="${#dates.format(playletTask.endTime, 'yyyy-MM-dd hh:mm')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                    <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="taskContent" th:field="*{taskContent}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <input name="remark" th:field="*{remark}" readonly="true" class="form-control" type="text">
            </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/playlet/task";
    $("#form-task-edit").validate({
        focusCleanup: true
    });

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

    $("input[name='startTime']").datetimepicker({
        format: 'yyyy-mm-dd hh:ii',
        todayBtn:  true,
        dateFormat: 'yyyy-mm-dd',//日期显示格式
        timeFormat: 'HH:mm:ss',//时间显示格式
        autoclose: true,
    });

    $("input[name='endTime']").datetimepicker({
        format: 'yyyy-mm-dd hh:ii',
        todayBtn:  true,
        dateFormat: 'yyyy-mm-dd',//日期显示格式
        timeFormat: 'HH:mm:ss',//时间显示格式
        autoclose: true,
    });
</script>
</body>
</html>