borrar tipo entrada y programa- me manda este error: id_equipo_programa must be an integer number, pero si le estoy pasando un integer
This commit is contained in:
parent
efcea26d65
commit
bc549b281f
@ -32,7 +32,7 @@
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<!-- <b-field
|
||||
<b-field
|
||||
label="Programa"
|
||||
v-if="equipo.carrito.tipoCarrito.id_tipo_carrito === 2"
|
||||
>
|
||||
@ -45,7 +45,7 @@
|
||||
{{ programa.programa.programa }}
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field> -->
|
||||
</b-field>
|
||||
|
||||
<b-field
|
||||
label="Cambiar nombre del equipo"
|
||||
@ -59,22 +59,6 @@
|
||||
/>
|
||||
</b-field>
|
||||
|
||||
<!-- <b-field
|
||||
label="Carrito"
|
||||
v-if="this.operador.tipoUsuario.id_tipo_usuario === 3"
|
||||
>
|
||||
<b-select icon="list-status" v-model="idCarrito" expanded rounded>
|
||||
<option
|
||||
v-for="(carrito, index) in carritos"
|
||||
:key="index"
|
||||
:value="carrito.id_carrito"
|
||||
v-show="equipo.id_equipo"
|
||||
>
|
||||
{{ carrito.carrito }}
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field> -->
|
||||
|
||||
<b-button
|
||||
class="my-5"
|
||||
type="is-link"
|
||||
@ -82,7 +66,7 @@
|
||||
@click="
|
||||
imprimirWarning(
|
||||
`¿Estas segur@ que deseas cambiar esta información?`,
|
||||
updateEquipo
|
||||
updateInformacion
|
||||
)
|
||||
"
|
||||
:disabled="mostrarBoton()"
|
||||
@ -142,6 +126,36 @@ export default {
|
||||
return false
|
||||
return true
|
||||
},
|
||||
updateInformacion() {
|
||||
if (
|
||||
this.idStatus != this.equipo.status.id_status ||
|
||||
this.nuevoNombreEquipo != ''
|
||||
) {
|
||||
this.updateEquipo()
|
||||
this.motivo = ''
|
||||
}
|
||||
for (let i = 0; i < this.programas.length; i++) {
|
||||
if (this.idPrograma) {
|
||||
if (
|
||||
this.idPrograma != this.equipo.programas[i].programa.id_programa
|
||||
) {
|
||||
this.updateProgramas()
|
||||
this.idPrograma = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < this.tipoEntradas.length; i++) {
|
||||
if (this.idTipoEntrada != '') {
|
||||
if (
|
||||
this.idTipoEntrada !=
|
||||
this.equipo.tiposEntradas[i].tipoEntrada.id_tipo_entrada
|
||||
) {
|
||||
this.updateTipoEntradas()
|
||||
this.idTipoEntrada = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
updateEquipo() {
|
||||
const data = {
|
||||
id_equipo: this.equipo.id_equipo,
|
||||
@ -152,7 +166,7 @@ export default {
|
||||
id_status:
|
||||
this.idStatus != this.equipo.status.id_status ? this.idStatus : null,
|
||||
motivo: this.motivo,
|
||||
// idPrograma: this.idPrograma ? this.idPrograma : null,
|
||||
idPrograma: this.idPrograma ? this.idPrograma : null,
|
||||
}
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
@ -167,12 +181,51 @@ export default {
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
updateProgramas() {
|
||||
const data = {
|
||||
id_equipo: this.equipo.id_equipo,
|
||||
id_programa: this.idPrograma,
|
||||
}
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.post(`${process.env.api}/equipo-programa`, data, this.operador.token)
|
||||
.then((res) => {
|
||||
this.buscar()
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirMensaje(res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
updateTipoEntradas() {
|
||||
const data = {
|
||||
id_equipo: this.equipo.id_equipo,
|
||||
id_tipo_entrada: this.idTipoEntrada,
|
||||
}
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.post(
|
||||
`${process.env.api}/equipo-tipo-entrada`,
|
||||
data,
|
||||
this.operador.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.buscar()
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirMensaje(res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
obtenerCatalogoStatus() {
|
||||
axios
|
||||
.get(`${process.env.api}/status`, this.operador.token)
|
||||
.then((res) => {
|
||||
this.status = res.data
|
||||
this.obtenerCatalogoProgramas()
|
||||
})
|
||||
.catch((err) => {
|
||||
this.imprimirError(err.response.data)
|
||||
@ -186,7 +239,6 @@ export default {
|
||||
)
|
||||
.then((res) => {
|
||||
this.programas = res.data
|
||||
console.log(this.programas)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.imprimirError(err.response.data)
|
||||
@ -218,28 +270,10 @@ export default {
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
prompt() {
|
||||
this.$buefy.dialog.prompt({
|
||||
type: 'is-warning',
|
||||
title: '¡Espera un minuto!',
|
||||
message: `¿Estas segur@ que quieres cambiar el status de este equipo?`,
|
||||
inputAttrs: {
|
||||
type: 'text',
|
||||
placeholder: 'Motivo del cambio',
|
||||
min: 1,
|
||||
max: 500,
|
||||
},
|
||||
trapFocus: true,
|
||||
hasIcon: true,
|
||||
iconPack: 'mdi',
|
||||
icon: 'help-circle',
|
||||
cancelText: 'Cancelar',
|
||||
onConfirm: (value) => this.cambiarStatus(value),
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
equipo() {
|
||||
this.obtenerCatalogoProgramas()
|
||||
this.obtenerCatalogoTipoEntradas()
|
||||
this.obtenerCatalogoCarritos()
|
||||
this.idStatus = this.equipo.status.id_status
|
||||
|
@ -26,7 +26,14 @@
|
||||
</div>
|
||||
|
||||
<div class="columns">
|
||||
<InfoEquipo :equipo="equipo" />
|
||||
<InfoEquipo
|
||||
:equipo="equipo"
|
||||
:imprimirError="imprimirError"
|
||||
:imprimirWarning="imprimirWarning"
|
||||
:imprimirMensaje="imprimirMensaje"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:buscar="buscar"
|
||||
/>
|
||||
|
||||
<AdminEquipo
|
||||
:operador="operador"
|
||||
|
@ -26,9 +26,12 @@
|
||||
<b-tag
|
||||
class="ml-2"
|
||||
type="is-dark"
|
||||
closable
|
||||
closeType="is-danger"
|
||||
@close="programaB(programa.id_equipo_programa)"
|
||||
v-for="(programa, index) in programasArray"
|
||||
:key="index"
|
||||
>{{ programa }}</b-tag
|
||||
>{{ programa.programa.programa }}</b-tag
|
||||
>
|
||||
</b-field>
|
||||
</div>
|
||||
@ -50,9 +53,12 @@
|
||||
<b-tag
|
||||
class="ml-2"
|
||||
type="is-dark"
|
||||
closable
|
||||
closeType="is-danger"
|
||||
@close="tipoEntradaB(tipoEntrada.id_equipo_tipo_entrada)"
|
||||
v-for="(tipoEntrada, index) in tiposEntradasArray"
|
||||
:key="index"
|
||||
>{{ tipoEntrada }}</b-tag
|
||||
>{{ tipoEntrada.tipoEntrada.tipo_entrada }}</b-tag
|
||||
>
|
||||
</b-field>
|
||||
|
||||
@ -79,9 +85,15 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
export default {
|
||||
props: {
|
||||
equipo: { type: Object, required: true },
|
||||
imprimirError: { type: Function, required: true },
|
||||
imprimirWarning: { type: Function, required: true },
|
||||
imprimirMensaje: { type: Function, required: true },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
buscar: { type: Function, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -101,19 +113,69 @@ export default {
|
||||
],
|
||||
tiposEntradasArray: [],
|
||||
programasArray: [],
|
||||
|
||||
idEquipoPrograma: 0,
|
||||
idEquipoTipoEntrada: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
programas() {
|
||||
for (let i = 0; i < this.equipo.programas.length; i++)
|
||||
this.programasArray[i] = this.equipo.programas[i].programa.programa
|
||||
this.programasArray[i] = this.equipo.programas[i]
|
||||
},
|
||||
tiposEntradas() {
|
||||
let tiposEntradasArray = new Array(this.equipo.tiposEntradas.length)
|
||||
for (let i = 0; i < this.equipo.tiposEntradas.length; i++)
|
||||
this.tiposEntradasArray[i] = this.equipo.tiposEntradas[
|
||||
i
|
||||
].tipoEntrada.tipo_entrada
|
||||
this.tiposEntradasArray[i] = this.equipo.tiposEntradas[i]
|
||||
},
|
||||
programaB(id_equipo_programa) {
|
||||
this.idEquipoPrograma = id_equipo_programa
|
||||
this.imprimirWarning(
|
||||
'¿Estás segur@ de querer borrar este programa?',
|
||||
this.borrarPrograma
|
||||
)
|
||||
},
|
||||
borrarPrograma() {
|
||||
const data = {
|
||||
id_equipo_programa: this.idEquipoPrograma,
|
||||
}
|
||||
console.log(data)
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.delete(`${process.env.api}/equipo-programa`, data)
|
||||
.then((res) => {
|
||||
this.buscar()
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirMensaje(res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
tipoEntradaB(id_equipo_tipo_entrada) {
|
||||
this.idEquipoTipoEntrada = id_equipo_tipo_entrada
|
||||
this.imprimirWarning(
|
||||
'¿Estás segur@ de querer borrar este tipo de entrada?',
|
||||
this.borrarTipoEntrada
|
||||
)
|
||||
},
|
||||
borrarTipoEntrada() {
|
||||
const data = {
|
||||
id_equipo_tipo_entrada: this.idEquipoTipoEntrada,
|
||||
}
|
||||
console.log(data)
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.delete(`${process.env.api}/equipo-tipo-entrada`, data)
|
||||
.then((res) => {
|
||||
this.buscar()
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirMensaje(res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
Loading…
Reference in New Issue
Block a user