<div class="modal " id="edit-supplier" 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="edit-name" class="col-sm-3 col-form-label text-right">名称</label>
                        <div class="col-sm-9 form-inline">
                            <input type="text"id="edit-name" class="form-control col-sm-10"  v-model="editSupplier.name"  placeholder="供应商名称"
                                   :class="supplierErrors.name?'is-invalid':''"
                                   @focus="supplierErrors.name!==null ? supplierErrors.name=null:''"
                            >
                            <div class="invalid-feedback" v-if="supplierErrors.name">
                                @{{ supplierErrors.name[0] }}
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="edit-contact-man" class="col-sm-3 col-form-label text-right">联系人</label>
                        <div class="col-sm-9 form-inline">
                            <input type="text" name="material-code" id="edit-contact-man" class="form-control col-sm-10" v-model="editSupplier.contact_man" placeholder="联系人"
                                   :class="supplierErrors.contact_man?'is-invalid':''"
                                   @focus="supplierErrors.contact_man!==null ? supplierErrors.contact_man=null:''"
                            >
                            <div class="invalid-feedback" v-if="supplierErrors.contact_man">
                                @{{ supplierErrors.contact_man[0] }}
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="edit-phone" class="col-sm-3 col-form-label text-right">联系电话</label>
                        <div class="col-sm-9 form-inline">
                            <input type="text" name="phone" id="edit-phone" class="form-control col-9" v-model="editSupplier.phone" placeholder="联系电话"
                                   :class="supplierErrors.phone?'is-invalid':''"
                                   @focus="supplierErrors.phone!==null ? supplierErrors.phone=null:''"
                            >
                            <div class="invalid-feedback" v-if="supplierErrors.phone">
                                @{{ supplierErrors.phone[0] }}
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="edit-invoice-title" class="col-sm-3 col-form-label text-right">发票抬头</label>
                        <div class="col-sm-9 form-inline">
                            <input type="text" id="edit-invoice-title"  class="form-control col-10" v-model="editSupplier.invoice_title" placeholder="发票抬头"
                                   :class="supplierErrors.invoice_title?'is-invalid':''"
                                   @focus="supplierErrors.invoice_title!==null ? supplierErrors.invoice_title=null:''"
                            >
                            <div class="invalid-feedback" v-if="supplierErrors.invoice_title">
                                @{{ supplierErrors.invoice_title[0]  }}
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="edit-bank" class="col-sm-3 col-form-label text-right">账户银行</label>
                        <div class="col-sm-9 form-inline">
                            <input type="text" id="edit-bank" class="form-control col-10" name="size" v-model="editSupplier.bank" placeholder="账户银行"
                                   :class="supplierErrors.bank?'is-invalid':''"
                                   @focus="supplierErrors.bank!==null ? supplierErrors.bank=null:''"
                            >
                            <div class="invalid-feedback" v-if="supplierErrors.bank">
                                @{{ supplierErrors.bank[0]}}
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="edit-bank-account " class="col-sm-3 col-form-label text-right">收款账户</label>
                        <div class="col-sm-9 form-inline">
                            <input type="text" id="edit-bank-account " class="form-control col-10" name="size" v-model="editSupplier.bank_account " placeholder="账户银行"
                                   :class="supplierErrors.bank_account?'is-invalid':''"
                                   @focus="supplierErrors.bank_account!==null ? supplierErrors.bank_account=null:''"
                            >
                            <div class="invalid-feedback" v-if="supplierErrors.bank_account">
                                @{{ supplierErrors.bank_account[0] }}
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="edit-opening-bank " class="col-sm-3 col-form-label text-right">开户行</label>
                        <div class="col-sm-9 form-inline">
                            <textarea name="specification" id="edit-opening-bank " cols="30" rows="5"  class="form-control form-text col-10" v-model="editSupplier.opening_bank "
                                      :class="supplierErrors.opening_bank?'is-invalid':''"
                                      @focus="supplierErrors.opening_bank!==null ? supplierErrors.opening_bank=null:''"></textarea>
                            <div class="invalid-feedback" v-if="supplierErrors.opening_bank">
                                @{{ supplierErrors.opening_bank[0] }}
                            </div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="add-bank-account " class="col-sm-3 col-form-label text-right ">耗材类型</label>
                        <select id="material_id" class="selectpicker" multiple data-live-search="true" title="耗材类型(多选)" v-model="editSupplier.material_id">
                            <option v-for="material in materials" :value="material.id">@{{ material.name }}</option>
                        </select>
                        <label hidden><input name="material_id" type="text" :value="editSupplier.material_id"></label>
                    </div>
                    <div class="form-group row">
                        <label  class="col-sm-3 col-form-label text-right"></label>
                        <span class="text-danger" v-if="supplierErrors.material_id">
                                @{{ supplierErrors.material_id[0] }}
                        </span>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary"  data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" @click="update(editSupplier,selectIndex)">保存</button>
            </div>
        </div>
    </div>
</div>
