<!--{include file="<!--{$oapath}-->public/ins_popup.tpl"}-->
<block name="content">
    <div class="popup-fixed">
        <div class="popup-header clearfix">
            <div class="pull-left">
                <h1>申请时长</h1>
            </div>
            <div class="pull-right">
                <a onclick="save();" class="btn btn-sm btn-primary">确定</a>
                <a onclick="myclose();" class="btn btn-sm btn-default">关闭</a>
            </div>
        </div>
        <div class="popup-body" style="height: 420px;overflow-y: auto;">
            <form id="form_data" name="form_data" method="post" class="form-horizontal clearfix">
                <input type="hidden" id="opmode" name="opmode" value="<!--{$opmode}-->">
                <!--{if $opmode=='edit'}-->
                <input type="hidden" id="id" name="id" value="<!--{$vo.id}-->">
                <!--{/if}-->
                <input type="hidden" name="ajax" id="ajax" value="1">
                <div class="form-group col-xs-12">
                    <label class="col-xs-3 control-label" for="type">类型：</label>
                    <div class="col-xs-9">
                        <select class="form-control" name="type" id="is_del">
                            <option value="1" <!--{if $vo.type=='1'}-->selected<!--{/if}--> >请假</option>
                            <option value="2" <!--{if $vo.type=='2'}-->selected<!--{/if}--> >加班</option>
                        </select>
                    </div>
                </div>
                <div class="form-group col-xs-12">
                    <label class="col-xs-3 control-label" for="time">开始时间：</label>
                    <div class="col-xs-9">
                        <input type="text" id="time" name="time" readonly="readonly"
                               class="form-control input-date-time" check="require" msg="请输入日期"
                               value="<!--{$vo.time}-->">
                    </div>
                </div>
                <div class="form-group col-xs-12">
                    <label class="col-xs-3 control-label" for="time">结束时间：</label>
                    <div class="col-xs-9">
                        <input type="text" id="end_time" name="end_time" readonly="readonly"
                               class="form-control input-date-time" check="require" msg="请输入日期"
                               value="<!--{$vo.end_time}-->">
                    </div>
                </div>
                <div class="form-group col-xs-12">
                    <label class="col-xs-3 control-label" for="hour">时长：</label>
                    <div class="col-xs-9">
                        <input class="form-control" type="number" id="title" name="hour" value="<!--{$vo.hour}-->"
                               check="require" msg="请输入时长">
                    </div>
                </div>
                <div class="form-group col-xs-12">
                    <label class="col-xs-3 control-label" for="content">原因：</label>
                    <div class="col-xs-9">
                        <textarea class="form-control" name="content" rows="5"
                                  class="col-xs-12"><!--{$vo.content}--></textarea>
                    </div>
                </div>
            </form>
        </div>
</block>
</div>
<!-- Mainly scripts -->
<script src="<!--{$oapath}-->Ins/js/jquery-2.1.1.js"></script>
<script src="<!--{$oapath}-->Ins/js/bootstrap.min.js"></script>
<script src="<!--{$oapath}-->Ins/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="<!--{$oapath}-->Ins/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="<!--{$oapath}-->Ins/js/inspinia.js"></script>
<script src="<!--{$oapath}-->Ins/js/common.js"></script>
<script src="<!--{$oapath}-->Ins/js/plugins/pace/pace.min.js"></script>
<script src="<!--{$oapath}-->Ins/js/plugins/toastr/toastr.min.js"></script>
<script src="<!--{$oapath}-->Ins/js/plugins/gritter/jquery.gritter.min.js"></script>
<script src="<!--{$oapath}-->Ins/js/plugins/bootbox/bootbox.min.js"></script>
<script src="<!--{$oapath}-->Ins/js/plugins/date-time/moment-with-locales.js"></script>
<script src="<!--{$oapath}-->Ins/js/plugins/date-time/bootstrap-datetimepicker.js"></script>
<script>
    $(document).ready(function () {
        $(".popup-container").width($("#dialog", parent.document).width());
        if (is_mobile()) {
            $(".popup-container").height(window.screen.height - 40);
            $(".popup-container").css('overflow', 'auto');
        }
    });
</script>
<block name="js">
    <script type="text/javascript">
        function save() {
            if (check_form("form_data")) {
                var vars = $("#form_data").serialize();
                sendAjax("oa.php?c=Sign&a=save_leave", vars, function (data) {
                    if (data.status) {
                        ui_alert(data.info, function () {
                            parent.location.reload(true);
                            myclose();
                        });
                    } else {
                        ui_error(data.info);
                    }
                });
            }
        }
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.input-date').datetimepicker({
                format: 'YYYY-MM-DD',
                locale: 'zh-cn',
                ignoreReadonly: true,
                widgetPositioning: {
                    horizontal: 'auto',
                    vertical: 'bottom'
                },
            });
            $(".input-daterange input").datetimepicker({
                format: "YYYY-MM-DD",
                locale: 'zh-cn',
                showTodayButton: true,
                showClose: true,
                ignoreReadonly: true,
                widgetPositioning: {
                    horizontal: 'auto',
                    vertical: 'bottom'
                },
            });
            $("#start_date").on("dp.change", function (e) {
                if ($("#end_date").length > 0) {
                    $('#end_date').data("DateTimePicker").minDate(e.date);
                }
            });
            $("#end_date").on("dp.change", function (e) {
                if ($("#start_date").length > 0) {
                    $('#start_date').data("DateTimePicker").maxDate(e.date);
                }
            });
            $(".input-date-time").datetimepicker({
                format: 'YYYY-MM-DD',
                locale: 'zh-cn',
                sideBySide: true,
                showTodayButton: true,
                showClose: true,
                ignoreReadonly: true,
                widgetPositioning: {
                    horizontal: 'auto',
                    vertical: 'bottom'
                },
            });
        });
    </script>
</block>
</body>
</html>