<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加礼物</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/bootstrap/bootstrap.min.css" >

</head>
<body>
<div id="msg-tip">

</div>
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>添加礼物</header>
                    <hr/>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <input type="hidden" value="<?php echo $url;?>" id="uploadUrl"/>
                                    <input type="hidden" value="<?php echo $baseUrl;?>" id="baseUrl"/>
                                    <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="uploadForm" action="#">
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label"></label>
                                            <div class="col-sm-3" >
                                                <img src="" width="90px;" height="90px;" id="imgDisplay" class="hide"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">礼物图片</label>
                                            <div class="col-sm-3">
                                                    <input type="file" name="giftfile" id="giftfile" />
                                            </div>
                                        </div>
<!--                                        <button type="submit" class="btn btn-default">Submit</button>-->
                                    </form>

                                    <form class="form-horizontal" role="form" method="post" action="gift/actionAdd" enctype="multipart/form-data" id="addForm">
                                        <input type="hidden" value="" id="uploadedFile" name="uploadedFile"/>
                                        <div class="modal-body">
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">中文名称*: </label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" placeholder="中文名称" name="cname" value="">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">泰文*: </label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" placeholder="泰文" name="ename" value="">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">是否VIP礼物: </label>
                                                <div class="col-sm-3">
                                                    <label class="radio-inline">
                                                        <input type="radio" name="vipgift" value="0" checked="checked"> 否
                                                    </label>
                                                    <label class="radio-inline">
                                                        <input type="radio" name="vipgift" value="1"> 是
                                                    </label>
                                                </div>
                                            </div>
                                            <div class="form-group commongifttype">
                                                <label class="col-sm-3 control-label">礼物类型*:</label>
                                                <div class="col-sm-3">
                                                    <?php foreach ($giftType as $v => $n) {?>
                                                        <label class="radio-inline">
                                                            <input type="radio" name="type" cname="gifttype" <?php if($v == 1) echo 'checked'; ?> value="<?php echo $v;?>"  > <?php echo $n;?>
                                                        </label>
                                                    <?php } ?>
                                                </div>
                                            </div>
                                            <div class="form-group hide vipgifttype">
                                                <label class="col-sm-3 control-label">VIP礼物类型*:</label>
                                                <div class="col-sm-3">
                                                    <?php foreach ($vipgiftType as $v => $n) {?>
                                                        <label class="radio-inline">
                                                            <input type="radio" name="type" cname="gifttype" <?php if($v == 1) echo 'checked'; ?> value="<?php echo $v;?>"  > <?php echo $n;?>
                                                        </label>
                                                    <?php } ?>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">价格*:</label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" placeholder="价格" name="price" value="">
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">属性*:</label>
                                                <div class="col-sm-3">
                                                    <?php foreach ($giftProperty as $v => $n) {?>
                                                        <label class="radio-inline">
                                                            <input type="radio" name="prop" <?php if($v == 1) echo 'checked'; ?>  value="<?php echo $v;?>"> <?php echo $n;?>
                                                        </label>
                                                    <?php } ?>
                                                </div>
                                            </div>

<!--                                            <div class="form-group">-->
<!--                                                <label class="col-sm-3 control-label">礼物图片*:</label>-->
<!--                                                <div class="col-sm-9">-->
<!--                                                    <input type="file" name="giftfile" id="giftfile" />-->
<!--                                                </div>-->
<!--                                            </div>-->

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">有效天数*:</label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" placeholder="有效天数" name="expire" value="">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">排序*:</label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" placeholder="排序" name="gsort" value="">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">参数:</label>
                                                <div class="col-sm-3">
                                                    <input type="text" class="form-control" placeholder="可不填(不要使用?开头)" name="urldesc" value="">
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">是否显示*:</label>
                                                <div class="col-sm-3">
                                                    <label class="radio-inline">
                                                        <input type="radio" name="isShow" checked  value="1"> 是
                                                    </label>
                                                    <label class="radio-inline">

                                                        <input type="radio" name="isShow"  value="2"> 否
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-offset-3 col-sm-3">
                                                <button type="button" class="btn btn-info goback">返回</button>
                                                <button type="button" class="btn btn-primary" id="submitBtn">提交</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>

</body>
<script src="<?php echo base_url();?>public/plugins/validate/jquery.validate-1.15.0.min.js"></script>
<script src="<?php echo base_url();?>public/plugins/validate/jaquery.validate.messages_zh.js"></script>
<script src="<?php echo base_url();?>public/js/common.js"></script>
<script src="<?php echo base_url();?>public/js/gift/add.js"></script>
</html>
<script type="text/javascript">
    $('.goback').click(function(){
       history.go(-1);
    });

    $("input[name='vipgift']").click(function () {
        var v = $(this).val();
        if ( v == 1){//VIP
            $('.vipgifttype').removeClass('hide');
            $('.commongifttype').addClass('hide');
        }else{
            $('.vipgifttype').addClass('hide');
            $('.commongifttype').removeClass('hide');
        }
    });

</script>