casi terminado front

This commit is contained in:
arturogll
2019-01-24 20:46:08 +00:00
parent 57b115aa0f
commit e41e39d727
7 changed files with 171 additions and 46 deletions
+43 -5
View File
@@ -4,23 +4,31 @@
table.table.is-fullwidth.is-hoverable.is-narrow
thead
tr
th Equipo
th Carrito
th Equipo
th Tipo
th No Inventario
th Usuario
th Hora inicio
th Hora maximo
th Usuario
th Regresar
tbody
tr(v-for="p in prestamo")
td {{p.detalles[0].equipo.carrito.nombre}}
td {{p.detalles[0].equipo.equipo_carrito}}
td {{p.detalles[0].equipo.idCarrito}}
td {{p.equipo}}
td {{p.detalles[0].equipo.no_inventario}}
td {{p.idUsuario}}
td {{fecha(p.fh_in)}}
td {{maxFecha(p.fh_in)}}
td {{p.idUsuario}}
td
a.button.is-u-blue.is-outlined(v-on:click="regresar(p.detalles[0].equipo.carrito.nombre,p.id)")
span.icon.is-small
font-awesome-icon(icon="undo")
</template>
<script>
import swal from 'sweetalert'
import api from '../../api'
const axios = require('axios')
export default {
@@ -33,12 +41,42 @@ export default {
fecha: function (date) {
let dt = new Date(date)
console.log(dt)
return `${dt.getMonth() + 1}-${dt.getDate()} ${dt.getHours()}:${dt.getMinutes()} `
return `${dt.getMonth() + 1}-${dt.getDate()} ${dt.getHours()}:${dt.getMinutes()}`
},
maxFecha: function (date) {
let dt = new Date(date)
console.log(dt)
return `${dt.getMonth() + 1}-${dt.getDate()} ${dt.getHours() + 2}:${dt.getMinutes() + 15}`
},
regresar: function (usr, pre) {
axios({
method: 'put',
url: api.url + '/devolucion',
data: {
idUsuario: usr,
id: pre
},
headers: {
'token': window.localStorage.pcpumaT
}
})
.then(res => {
swal('Exito', 'Peticion exitosa ', 'success')
axios.get(api.url + '/prestamo', {
headers: {
'token': window.localStorage.pcpumaT
}
})
.then(response => {
this.prestamo = response.data.data
})
.catch(error => {
swal('Error', error.response.data.err, 'error')
})
})
.catch(err => {
swal('Error', err.response.data.err, 'error')
})
}
},
mounted () {
-2
View File
@@ -43,7 +43,6 @@ export default {
url: api.url + '/prestamo',
data: {
equipo: this.tipo,
idLugar: 1,
idUsuario: this.usuario,
idKiosko: window.localStorage.pcpumaK
},
@@ -53,7 +52,6 @@ export default {
})
.then(response => {
this.prestamoData = response.data
console.log(this.prestamoData)
swal('Exito', 'Peticion exitosa ', 'success')
})
.catch(error => {