<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
<?php $this->endBlock(); ?>

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <form role="form" class="form-horizontal data-from" id="theFrm">
                        <input type="hidden" name="car_id" value="<?=$car_id?>">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">预约日期</label>
                            <div class="col-sm-5">
                                <div class="input-group date">
                                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                    <input type="text" name="pdate" class="form-control" value="" autocomplete="off">
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">预约时间</label>
                            <div class="col-sm-5">
                                <div class="input-group clockpicker" data-autoclose="true">
                                    <input type="text" name="ptime" class="form-control" value="09:30" autocomplete="off">
                                    <span class="input-group-addon"><span class="fa fa-clock-o"></span></span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">备注</label>
                            <div class="col-sm-11">
                                <textarea name="remark" id="remark" class="form-control"></textarea>
                            </div>
                        </div>
                        <div>
                            <div class="row">
                                <div class="col-sm-5 col-sm-offset-5">
                                    <button class="btn btn-primary btn-save" type="button">
                                        <strong>添 加</strong>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/clockpicker/clockpicker.js"></script>
<script type="text/javascript" language="javascript">
    $(function () {
        $('.input-group.date').datepicker({
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            calendarWeeks: true,
            autoclose: true
        });
        $('.clockpicker').clockpicker();
        //提交按钮
        $(".btn-save").click(function(){
            parent.layer.confirm('是否确认提交?', {
                btn: ['确认','取消'], //按钮
                shade: false //不显示遮罩
            }, function(){
                var params = $("#theFrm").serialize();
                $.post('/appointment/save',params,function(obj){
                    if(obj.success) {
                        parent.layer.msg('保存成功');
                        parent.refreshList();
                        layer_close();
                    } else {
                        parent.layer.msg(data.msg);
                    }
                },'json');
            }, function(){
                //
            });
        });
    })
</script>
<?php $this->endBlock('footer_js'); ?>