<div class="modal " id="add-procurement" tabindex="-1" >
    <div class="modal-dialog modal-lg modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title text-center">新增采购单</h5>
                <button type="button" class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <form class="form">
                    <div class="form-group row">
                        <label for="owner_id" class="col-2 col-form-label text-right text-primary">项目名称{{old('owner_id')}} *</label>
                        <div class="col-8 form-inline">
                            <select id="owner_id" name="owner_id" class="form-control col-4" :class="errors.owner_id ? 'is-invalid' : ''" v-model="owner_id" @change="selectOwner" required>
                                <option v-for="owner in owners" :value="owner.name">@{{owner.value}}</option>
                            </select>
                            <input id="owner_name" type="text" class="form-control-sm ml-2" placeholder="输入关键字定位项目" @input="owner_seek($event)" autocomplete="off">
                            <span class="invalid-feedback" role="alert" v-if="errors.owner_id">
                                <strong>@{{ errors.owner_id[0] }}</strong>
                            </span>
                        </div>
                    </div>
{{--                    <div class="form-group row">--}}
{{--                        <label for="customer_name" class="col-2 col-form-label text-right">客户名称</label>--}}
{{--                        <div class="col-8">--}}
{{--                           <input  id="customer_name" type="text" class="form-control " name="customer_name" autocomplete="off" value="{{ old('customer_name') }}" v-model="customer_name" readonly>--}}
{{--                        </div>--}}
{{--                    </div>--}}
                    <div class="form-group row">
                        <label for="owner_material_id" class="col-2 col-form-label text-right text-primary">项目耗材编号{{old('owner_material_id')}} *</label>
                        <div class="col-8">
                            <select id="owner_material_id" name="owner_material_id" class="form-control" :class="errors.owner_material_id ? 'is-invalid' : ''" v-model="owner_material_id" @change="ownerMaterial" required>
                                <option v-for="ownerMaterial in ownerMaterials" :value="ownerMaterial.id">@{{ownerMaterial.material_code}}</option>
                            </select>
                            <span class="invalid-feedback" role="alert" v-if="errors.owner_material_id">
                                <strong>@{{ errors.owner_material_id[0] }}</strong>
                            </span>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="name" class="col-2 col-form-label text-right">耗材名称</label>
                        <div class="col-8">
                           <input id="name" type="text" class="form-control " name="material_name" autocomplete="off" value="{{ old('material_name') }}" v-model="material_name" readonly>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="size" class="col-2 col-form-label text-right">尺寸大小</label>
                        <div class="col-8">
                            <input id="size" type="text" class="form-control " name="size" autocomplete="off" value="{{ old('size') }}" v-model="size" readonly>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="special" class="col-2 col-form-label text-right">特殊要求</label>
                        <div class="col-8">
                            <input id="special" type="text" class="form-control " name="special" autocomplete="off" value="{{ old('special') }}" v-model="special" readonly>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="specification" class="col-2 col-form-label text-right">材质规格</label>
                        <div class="col-8">
                            <textarea id="specification" type="text" class="form-control" name="specification" autocomplete="off" value="{{ old('specification') }}" readonly>@{{ specification }}</textarea>
                        </div>
                    </div>
                    <div class="form-group row" v-if="is_procurement==='procurement'">
                        <label for="quantity" class="col-2 col-form-label text-right">采购数量</label>
                        <div class="col-8">
                            <input id="quantity" type="text" class="form-control" v-model="quantity" :class="errors.quantity ? 'is-invalid' : ''"  name="quantity" autocomplete="off" value="{{ old('quantity') }}" required>
                            <span class="invalid-feedback" role="alert" v-if="errors.quantity">
                                <strong>@{{ errors.quantity[0] }}</strong>
                            </span>
                        </div>
                    </div>
                    <div class="form-group row" v-if="is_procurement==='procurement'">
                        <label for="amount" class="col-2 col-form-label text-right">销售数量</label>
                        <div class="col-8">
                            <input id="amount" type="text" class="form-control" name="amount" :class="errors.amount ? 'is-invalid' : ''" autocomplete="off" value="{{ old('amount') }}" @input="countTotalPrice" v-model="amount" required>
                            <span class="invalid-feedback" role="alert" v-if="errors.amount">
                                <strong>@{{ errors.amount[0] }}</strong>
                            </span>
                        </div>
                    </div>
                    <div class="form-group row" v-if="is_procurement==='procurement'">
                        <label for="unit_price" class="col-2 col-form-label text-right">销售单价</label>
                        <div class="col-8">
                            <input id="unit_price" type="text" class="form-control" name="unit_price" :class="errors.unit_price ? 'is-invalid' : ''" autocomplete="off" value="{{ old('unit_price') }}" @input="countTotalPrice" v-model="unit_price" required>
                            <span class="invalid-feedback" role="alert" v-if="errors.unit_price">
                                <strong>@{{ errors.unit_price[0] }}</strong>
                            </span>
                        </div>
                    </div>
                    <div class="form-group row" v-if="is_procurement==='procurement'">
                        <label for="total_price" class="col-2 col-form-label text-right">销售总价</label>
                        <div class="col-8">
                            <input id="total_price" type="text" class="form-control" name="total_price" autocomplete="off" value="{{ old('total_price') }}" v-model="total_price" readonly>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary"  data-dismiss="modal" >关闭</button>
                <button v-if="is_procurement==='procurement'" type="button" class="btn btn-primary" @click="createProcurement">提交</button>
                <button v-if="is_procurement==='enquiry'" type="button" class="btn btn-primary" @click="createEnquiry">提交</button>
                <button v-if="is_procurement==='proof'" type="button" class="btn btn-primary" @click="createProof">提交</button>
            </div>
        </div>
    </div>
</div>
