How to make a confirmation dialog with vue js?

1

I have a module to add contracts in vue:

createContrato: function(){
            //aca deberia mostrar el dialogo de confirmacion antes de agregar el contrato
            this.newContrato.CONT_datFin=document.getElementById('CONT_datFin').value;
            var url='insertarcontrato';
            var contrato=this.newContrato;
            axios.post(url,contrato).then(response=>{
                //limpiar datos
                var urlproductos='insertarproductos';
                var meta_id=response.data;

                for (var i = this.newContrato.productos.length - 1; i >= 0; i--) {
                    var NCantidad=this.newContrato.productos[i].Cantidad;
                    var text=this.newContrato.productos[i].Denominacion;
                    var ProductoInsert={Contrato:meta_id,Cantidad:NCantidad,Denominacion:text};
                    axios.post(urlproductos,ProductoInsert).then(response=>{
                        //
                    }).catch(error=>{
                        this.errors=error.response.data
                    });

                };
                this.errors=[];
                this.fillMeta={META_intId: '', META_varSubMeta: '', META_varDenominacion: '', META_intYear: ''};
                this.newContrato={META_intId:'',CONT_intTiempoContrato:'',CONT_varProfesion:'',CONT_varGradoAcademico:'',CONT_douMontoTotal:'',CONT_intArmadas:'',META_intId:'',PERS_varDNI:'',CONT_datInicio:'',CONT_datFin:'',productos:[]};
                this.dacademic='';
                document.getElementById('tablaProductos').style.visibility="hidden";
                var elmtTable = document.getElementById("tablaProductos").getElementsByTagName('tbody')[0];
                var tableRows = elmtTable.getElementsByTagName('tr');
                var rowCount = tableRows.length;
                for (var x=rowCount-1; x>=0; x--) {
                   elmtTable.removeChild(tableRows[x]);
                }

                $('#makeContrato').modal('hide');
                toastr.success('Contrato agregado con exíto');
            }).catch(error=>{
                this.errors=error.response.data
            });


        }

What I would like is: before adding the contract, verify if a person already has a contract and show a confirmation dialog with the data of the existing contract, if you agree to add the new contract.

    
asked by hans 13.04.2018 в 14:53
source

0 answers