<!DOCTYPE html>
<html style="height: 100%">
<head lang="zh">
    <meta charset="UTF-8">
    <link rel="stylesheet" href="../../lib/app/css/app.min.css" type="text/css"/>
    <link rel="stylesheet" href="../../lib/bootstrap-select/bootstrap-select.css">
    <link rel="stylesheet" href="../../lib/bootstrap-select/bootstrap-multiselect.css">
    <link rel="stylesheet" href="../../lib/jquery/datetimepicker/jquery.datetimepicker.css">
    <link rel="stylesheet" href="../../lib/jquery/jquery-ui/jquery-ui.min.css">
    <link rel="stylesheet" href="../../lib/jquery/select/jquery-editable-select.min.css"><!--可编辑单选引用-->
    <link rel="stylesheet" href="../../lib/webo/css/ui.css">
    <link rel="stylesheet" href="../../static/css/addgrids.css">
    <link rel="stylesheet" href="../../lib/bootable/bootstrap-table.css">
    <link rel="stylesheet" href="../../lib/font-awesome/css/font-awesome.min.css" type="text/css"/>
    <link rel="stylesheet" href="../../static/css/top_page.css">
</head>
<body>
<form id="item_form">
<div class="container-fluid" style="padding-left: 0;padding-right: 0">
    <header id="header" class="app-header navbar" role="menu">
        {{template "com/purchasetop.tpl" .}}
    </header>
    <div id="container">
        <div class="grid grid-1">
            <div style="padding: 10px 15px;font-size: 25px">
                <a href="/purchase/ui/list" style="color: #00a09d">询价单</a>/<a style="color:grey">修改</a>
            </div>
        </div>
        <div class="grid grid-2">
            <div class="row" style="background-color: white;height: 34px;margin-right: 15px;">
                <p class="toolbar" style="margin:2px 0 2px 30px">
                    <a id="add_item" class="btn btn-default" style="background-color:#00a09d;border-color:#00a09d;padding: 4px 8px">保存</a>
                    <a id="update_item" class="btn btn-default" style="background-color:#00a09d;border-color:#00a09d;padding: 4px 8px">编辑</a>
                    <a class="btn" href="/purchase/ui/list" style="border-color:white;padding: 4px 8px;color: #00a09d">取消</a>
                    <a class="btn" style="position: absolute;right: 45%;"><span style="color: #00a09d">请购单</span>&nbsp;<strong>&nbsp;>&nbsp;&nbsp;采购订单</strong></a>
                </p>
            </div>
            <div style="background-color: white;margin: 15px 15px 0;">
                <div class="row" style="margin:0 auto">
                    <div class="col-md-6 col-sm-6 col-xs-6">
                        <div class="top top-1" style="font-size: x-large">新</div>
                    </div>
                </div>
                <div class="row">
                    <div class="conrow col-md-6">
                        <div class="grids grids-1"></div>
                        <div class="grids grids-2">供应商</div>
                        <div class="grids grids-3">
                            <input type="text" class="input-block-level form-control form-border" name="name" id="name" autocomplete="off" value=""
                                   data-validate="{required: false, number:false,  messages:{required:'请输入供应商'}}" placeholder="选择填写供应商名称"
                                   style="padding-top:0;padding-bottom:0;height: 30px;padding-left: 0"/>
                        </div>
                        <div class="grids grids-4"></div>
                        <div class="grids grids-5"></div>
                        <div class="grids grids-1"></div>
                        <div class="grids grids-2">供应商参考</div>
                        <div class="grids grids-3">
                            <input type="text" class="input-block-level form-control form-border" name="name" id="name" autocomplete="off" value=""
                                   data-validate="{required: false, number:false,  messages:{required:'请输入供应商参考'}}" placeholder="名称、税号、邮箱或参考"
                                   style="padding-top:0;padding-bottom:0;height: 30px;padding-left: 0"/>
                        </div>
                        <div class="grids grids-4"></div>
                        <div class="grids grids-5"></div>
                    </div>

                    <div class="conrow col-md-6">
                        <div class="grids grids-1"></div>
                        <div class="grids grids-2">单据日期</div>
                        <div class="grids grids-3">
                            <input type="text" class="input-block-level form-control form-border" name="name" id="name" autocomplete="off" value="{{.tiemText}}"
                                   data-validate="{required: false, number:false,  messages:{required:'请输入单据日期'}}" readonly
                                   style="padding-top:0;padding-bottom:0;height: 30px;padding-left: 0"/>
                        </div>
                        <div class="grids grids-4"></div>
                        <div class="grids grids-5"></div>
                        <div class="grids grids-1"></div>
                        <div class="grids grids-2">需求日期</div>
                        <div class="grids grids-3">
                            <input type="text" class="input-block-level form-control form-border" name="needtime" id="needtime"
                                   autocomplete="off" value=""
                                   data-validate="{required: true,  messages:{required:'请输入正确的开始日期!'}}"
                                   ui-jq="datetimepicker"
                                   ui-options="{timepicker:false,format:'Y-m-d H:i:s',lang:'zh', scrollMonth:false}"
                                   style="padding-top:0;padding-bottom:0;height: 30px;padding-left: 0"/>
                        </div>
                        <div class="grids grids-4"></div>
                        <div class="grids grids-5"></div>
                    </div>
                </div>
                <div style="clear:both"></div>
                <ul id="myTab" class="nav nav-tabs" style="padding-left:15px;width: auto;margin: 10px 0">
                    <li class="active"><a href="#comprar" data-toggle="tab" style="padding: 5px">产品展示</a></li>
                </ul>
                <div>
                    <table id="item_table" data-undefined-text='-'></table>
                </div>
                <div class="col-md-3">
                    <div style="margin-top: 10px;">
                        <div type="button" id="addcol" title="添加一行" style="color: #169BD5;float: left;" accesskey="1">
                            <a style="color: #008787">添加明细行</a>
                        </div>
                        <div type="button" id="addremark" title="添加一行" style="color: #169BD5;" accesskey="1">
                            <a style="color: #008787;padding-left: 10px">添加备注</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="grid grid-3">
            <div class="row" style="margin:10px auto auto auto">
                <div class="col-md-12 col-sm-6 col-xs-6">
                    <div class="top top-1" style="margin: 5px 0">记录备注</div>
                    <div class="top top-2">
                        <textarea class="form-control" rows="5" class="input-block-level form-control"
                                  name="recordnotes" id="recordnotes" autocomplete="off" placeholder="写些什么..."
                                  style="border: 1px solid #ccc;overflow-y: hidden; height: auto; resize: none;margin-bottom: 20px;"></textarea>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="separator" style="margin-top: 10px;">
                    <span class="date">今天</span>
                </div>
                <div class="row" style="margin: 1px;background-color: rgba(222, 226, 230, 0.5);border-bottom: 1px solid #ced4da;">
                    <div class="col-md-10" style="padding-left: 0">
                        <div style="padding: 10px 10px 10px 20px;">
                            <p>
                                <strong>lt</strong>-<small title="2019年04月01日 13时31分34秒">3 分钟前</small>
                            </p>
                            <div><p>此入库已经创造来自：P00001</p></div>
                        </div>
                    </div>
                </div>
                <div class="row" style="margin: 1px;background-color: rgba(222, 226, 230, 0.5);border-bottom: 1px solid #ced4da;">
                    <div class="col-md-10" style="padding-left: 0">
                        <div style="padding: 10px 10px 10px 20px;">
                            <p>
                                <strong>lt</strong>-<small title="2019年04月01日 13时31分34秒">10 分钟前</small>
                            </p>
                            <div><p>状态：正在等待——>就绪</p></div>
                        </div>
                    </div>
                </div>
                <div class="row" style="margin: 1px;background-color: rgba(222, 226, 230, 0.5);border-bottom: 1px solid #ced4da;">
                    <div class="col-md-10" style="padding-left: 0">
                        <div style="padding: 10px 10px 10px 20px;">
                            <p>
                                <strong>gj</strong>-<small title="2019年04月01日 13时31分34秒">15 分钟前</small>
                            </p>
                            <div><p>状态：草稿——>正在等待</p></div>
                        </div>
                    </div>
                </div>
                <div class="row" style="margin: 1px;background-color: rgba(222, 226, 230, 0.5);border-bottom: 1px solid #ced4da;">
                    <div class="col-md-10" style="padding-left: 0">
                        <div style="padding: 10px 10px 10px 20px;">
                            <p>
                                <strong>zyy</strong>-<small title="2019年04月01日 13时31分34秒">30 分钟前</small>
                            </p>
                            <div><p>入库创造</p></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</form>
<div id="RemorkModel" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">备注</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal padder-md" id="outStoreForm" enctype="multipart/form-data">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">备注</label>
                        <div class="col-sm-7">
                            <textarea class="form-control" class="input-block-level form-control"
                                      name="remark" id="remark" autocomplete="off" ></textarea>
                        </div>
                    </div>
            </form>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            <button id="buttonRemark" type="button" class="btn btn-primary">确定</button>
        </div>
    </div>
</div>
</div>
<script src="../../lib/app/js/app.src.js"></script>
<script src="../../lib/jquery/jquery/validate/jquery.metadata.js"></script>
<script src="../../lib/jquery/jquery/jquery.form.js"></script>
<script src="../../lib/jquery/jquery-ui/jquery-ui.min.js"></script>
<script src="../../lib/jquery/select/jquery-editable-select.min.js"></script><!--可编辑单选引用-->
<script src="../../lib/bootstrap-select/bootstrap-select.js"></script>
<script src="../../lib/bootstrap-select/bootstrap-multiselect.js"></script>
<script src="../../lib/jquery/datetimepicker/jquery.datetimepicker.js"></script>
<script src="../../lib/webo/js/validate.js"></script>
<script src="../../lib/webo/js/validateExtend.js"></script>
<script src="../../lib/webo/js/ui.js"></script>
<script src="../../lib/bootable/bootstrap-table.js"></script>
<script src="../../lib/bootable/extensions/editable/bootstrap-table-editable.js"></script>
<script src="../../lib/xeditable/bootstrap3-editable/js/bootstrap-editable.js"></script>
<script>
    var $ItemTable = $("#item_table");
    $("#update_item").hide()
    $(function () {
        $ItemTable.bootstrapTable({
            url: "/item/list/prestore?sn="+{{.sn}},
            method: "get",
            ordering: false,
            silentSort: true,
            sidePagination: "server",
            pagination: false,
            fixedColumns: true,
            fixedNumber: 1,
            striped: false,
            pageSize: 10,
            pageList: [10, 25, 50, 100],
            showFooter: false,
            columns: [
                {
                    field: 'id',
                    title: '序号',
                    visible:false,
                    width: 10
                },
                {
                    field: 'product',
                    title: '产品展示',
                    width: 100,
                    align:'center',
                    sortable: false,
                    editable: {
                        type: 'text',
                    },
                },{
                    field: 'explain',
                    title: '说明',
                    width: 100,
                    align:'center',
                    sortable: false,
                    editable: {
                        type: 'text',
                    },
                },{
                    field: 'unit',
                    title: '单位',
                    width: 100,
                    align:'center',
                    sortable: false,
                    editable: {
                        type: 'text',
                    },
                },{
                    field: 'complete',
                    title: '在手数量',
                    width: 100,
                    align:'center',
                    sortable: false,
                    editable: {
                        type: 'text',
                    },
                },{
                    field: 'num',
                    title: '需求数量',
                    width: 100,
                    align:'center',
                    sortable: false,
                    editable: {
                        type: 'text',
                    },
                },{
                    field: 'operation',
                    title: '',
                    width: 10,
                    align:'left',
                    sortable: false,
                    formatter: function (value, row, index) {
                        var d = '<a class = "remove glyphicon glyphicon-trash" href="javascript:void(0)"></a>';
                        return d
                    },
                    events: 'operateEvents'
                }
            ]
        });

        var NO = 0;
        $("#addcol").on("click", function () {
            NO += 1;
            $ItemTable.bootstrapTable("append", {
                id: NO,
                product:"",
                explain:"",
                unit:"",
                complete:"",
                num:"",
            });
        })
    });

    $("#addremark").off("click").on("click", function () {
      $("#RemorkModel").modal({backdrop:"static"});
        $("#buttonRemark").off("click").on("click", function () {
            var remark = $("#remark").val();
            $.ajax({
                url:"",
                type:"post",
                data:{
                    "sn":row.sn,
                    "remark":remark
                },
                success:function () {
                    $("#RemorkModel").modal("hide")
                }
            })
        })
    })
    window.operateEvents = {
        'click .remove': function (e, value, row, index) {
            $ItemTable.bootstrapTable('remove', {
                field: 'id',
                values: [row.id]
            });
            $ItemTable.bootstrapTable('load', $ItemTable.bootstrapTable("getData"));
        }
    };
    $("#add_item").off("click").on("click", function () {
        $("#add_item").hide();
        $("#update_item").show();
    })
</script>
</body>
</html>