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-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<!-- <b-field
|
<b-field
|
||||||
label="Programa"
|
label="Programa"
|
||||||
v-if="equipo.carrito.tipoCarrito.id_tipo_carrito === 2"
|
v-if="equipo.carrito.tipoCarrito.id_tipo_carrito === 2"
|
||||||
>
|
>
|
||||||
@ -45,7 +45,7 @@
|
|||||||
{{ programa.programa.programa }}
|
{{ programa.programa.programa }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field> -->
|
</b-field>
|
||||||
|
|
||||||
<b-field
|
<b-field
|
||||||
label="Cambiar nombre del equipo"
|
label="Cambiar nombre del equipo"
|
||||||
@ -59,22 +59,6 @@
|
|||||||
/>
|
/>
|
||||||
</b-field>
|
</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
|
<b-button
|
||||||
class="my-5"
|
class="my-5"
|
||||||
type="is-link"
|
type="is-link"
|
||||||
@ -82,7 +66,7 @@
|
|||||||
@click="
|
@click="
|
||||||
imprimirWarning(
|
imprimirWarning(
|
||||||
`¿Estas segur@ que deseas cambiar esta información?`,
|
`¿Estas segur@ que deseas cambiar esta información?`,
|
||||||
updateEquipo
|
updateInformacion
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
:disabled="mostrarBoton()"
|
:disabled="mostrarBoton()"
|
||||||
@ -142,6 +126,36 @@ export default {
|
|||||||
return false
|
return false
|
||||||
return true
|
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() {
|
updateEquipo() {
|
||||||
const data = {
|
const data = {
|
||||||
id_equipo: this.equipo.id_equipo,
|
id_equipo: this.equipo.id_equipo,
|
||||||
@ -152,7 +166,7 @@ export default {
|
|||||||
id_status:
|
id_status:
|
||||||
this.idStatus != this.equipo.status.id_status ? this.idStatus : null,
|
this.idStatus != this.equipo.status.id_status ? this.idStatus : null,
|
||||||
motivo: this.motivo,
|
motivo: this.motivo,
|
||||||
// idPrograma: this.idPrograma ? this.idPrograma : null,
|
idPrograma: this.idPrograma ? this.idPrograma : null,
|
||||||
}
|
}
|
||||||
this.updateIsLoading(true)
|
this.updateIsLoading(true)
|
||||||
axios
|
axios
|
||||||
@ -167,12 +181,51 @@ export default {
|
|||||||
this.imprimirError(err.response.data)
|
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() {
|
obtenerCatalogoStatus() {
|
||||||
axios
|
axios
|
||||||
.get(`${process.env.api}/status`, this.operador.token)
|
.get(`${process.env.api}/status`, this.operador.token)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.status = res.data
|
this.status = res.data
|
||||||
this.obtenerCatalogoProgramas()
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
this.imprimirError(err.response.data)
|
this.imprimirError(err.response.data)
|
||||||
@ -186,7 +239,6 @@ export default {
|
|||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.programas = res.data
|
this.programas = res.data
|
||||||
console.log(this.programas)
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
this.imprimirError(err.response.data)
|
this.imprimirError(err.response.data)
|
||||||
@ -218,28 +270,10 @@ export default {
|
|||||||
this.imprimirError(err.response.data)
|
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: {
|
watch: {
|
||||||
equipo() {
|
equipo() {
|
||||||
|
this.obtenerCatalogoProgramas()
|
||||||
this.obtenerCatalogoTipoEntradas()
|
this.obtenerCatalogoTipoEntradas()
|
||||||
this.obtenerCatalogoCarritos()
|
this.obtenerCatalogoCarritos()
|
||||||
this.idStatus = this.equipo.status.id_status
|
this.idStatus = this.equipo.status.id_status
|
||||||
|
@ -26,7 +26,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<InfoEquipo :equipo="equipo" />
|
<InfoEquipo
|
||||||
|
:equipo="equipo"
|
||||||
|
:imprimirError="imprimirError"
|
||||||
|
:imprimirWarning="imprimirWarning"
|
||||||
|
:imprimirMensaje="imprimirMensaje"
|
||||||
|
:updateIsLoading="updateIsLoading"
|
||||||
|
:buscar="buscar"
|
||||||
|
/>
|
||||||
|
|
||||||
<AdminEquipo
|
<AdminEquipo
|
||||||
:operador="operador"
|
:operador="operador"
|
||||||
|
@ -26,9 +26,12 @@
|
|||||||
<b-tag
|
<b-tag
|
||||||
class="ml-2"
|
class="ml-2"
|
||||||
type="is-dark"
|
type="is-dark"
|
||||||
|
closable
|
||||||
|
closeType="is-danger"
|
||||||
|
@close="programaB(programa.id_equipo_programa)"
|
||||||
v-for="(programa, index) in programasArray"
|
v-for="(programa, index) in programasArray"
|
||||||
:key="index"
|
:key="index"
|
||||||
>{{ programa }}</b-tag
|
>{{ programa.programa.programa }}</b-tag
|
||||||
>
|
>
|
||||||
</b-field>
|
</b-field>
|
||||||
</div>
|
</div>
|
||||||
@ -50,9 +53,12 @@
|
|||||||
<b-tag
|
<b-tag
|
||||||
class="ml-2"
|
class="ml-2"
|
||||||
type="is-dark"
|
type="is-dark"
|
||||||
|
closable
|
||||||
|
closeType="is-danger"
|
||||||
|
@close="tipoEntradaB(tipoEntrada.id_equipo_tipo_entrada)"
|
||||||
v-for="(tipoEntrada, index) in tiposEntradasArray"
|
v-for="(tipoEntrada, index) in tiposEntradasArray"
|
||||||
:key="index"
|
:key="index"
|
||||||
>{{ tipoEntrada }}</b-tag
|
>{{ tipoEntrada.tipoEntrada.tipo_entrada }}</b-tag
|
||||||
>
|
>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
@ -79,9 +85,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
equipo: { type: Object, required: true },
|
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() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -101,19 +113,69 @@ export default {
|
|||||||
],
|
],
|
||||||
tiposEntradasArray: [],
|
tiposEntradasArray: [],
|
||||||
programasArray: [],
|
programasArray: [],
|
||||||
|
|
||||||
|
idEquipoPrograma: 0,
|
||||||
|
idEquipoTipoEntrada: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
programas() {
|
programas() {
|
||||||
for (let i = 0; i < this.equipo.programas.length; i++)
|
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() {
|
tiposEntradas() {
|
||||||
let tiposEntradasArray = new Array(this.equipo.tiposEntradas.length)
|
|
||||||
for (let i = 0; i < this.equipo.tiposEntradas.length; i++)
|
for (let i = 0; i < this.equipo.tiposEntradas.length; i++)
|
||||||
this.tiposEntradasArray[i] = this.equipo.tiposEntradas[
|
this.tiposEntradasArray[i] = this.equipo.tiposEntradas[i]
|
||||||
i
|
},
|
||||||
].tipoEntrada.tipo_entrada
|
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: {
|
watch: {
|
||||||
|
Loading…
Reference in New Issue
Block a user