multas
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
const api = {}
|
||||
|
||||
<<<<<<< HEAD
|
||||
api.url = 'http://f60a9553.ngrok.io'
|
||||
// api.url = 'http://venus.acatlan.unam.mx:3010'
|
||||
=======
|
||||
// api.url = 'http://localhost:3000'
|
||||
api.url = 'http://venus.acatlan.unam.mx:3010'
|
||||
>>>>>>> 6de917e80504bc12a5975c20b98a18e052721f1a
|
||||
api.isAuth = function () {
|
||||
if (window.localStorage.pcpumaT && window.localStorage.pcpumaU) {
|
||||
return true
|
||||
|
||||
@@ -38,11 +38,7 @@ export default {
|
||||
maxFecha: function (date) {
|
||||
let dt = new Date(date)
|
||||
console.log(dt)
|
||||
<<<<<<< HEAD
|
||||
return `${dt.getMonth() + 1}-${dt.getDate()} ${dt.getHours() + 2}:${dt.getMinutes() + 15} `
|
||||
=======
|
||||
return `${dt.getMonth() + 1}-${dt.getDate()} ${dt.getHours() + 2}:${dt.getMinutes() + 15}`
|
||||
>>>>>>> 6de917e80504bc12a5975c20b98a18e052721f1a
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<template lang="pug">
|
||||
.modal.is-active
|
||||
.modal-background
|
||||
.modal-card
|
||||
header.modal-card-head
|
||||
p.modal-card-title Actualizar Multa
|
||||
button.delete
|
||||
section.modal-card-body
|
||||
p ajsjahjshas
|
||||
footer.modal-card-foot
|
||||
button.button.is-success Save changes
|
||||
button.button Cancel
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="css" scoped>
|
||||
</style>
|
||||
+202
-1
@@ -1,10 +1,211 @@
|
||||
<template lang="pug">
|
||||
section
|
||||
p Hola como estas mi amor
|
||||
.modal#modal
|
||||
.modal-background
|
||||
.modal-card
|
||||
header.modal-card-head
|
||||
p.modal-card-title Actualizar Multa
|
||||
button.delete(v-on:click="toggleModal()")
|
||||
section.modal-card-body
|
||||
.field
|
||||
label.label Descripción
|
||||
.control
|
||||
input.input(type="text" v-model="multa.nombre" placeholder="Descripción de la multa")
|
||||
.field
|
||||
label.label Semanas
|
||||
.control
|
||||
input.input(type="number" v-model="multa.semanas" placeholder="Numero de semanas multado")
|
||||
footer.modal-card-foot
|
||||
button.button.is-success(v-on:click="update()") Save changes
|
||||
button.button(v-on:click="toggleModal()") Cancel
|
||||
.container
|
||||
br
|
||||
br
|
||||
h1.is-size-1 Multas
|
||||
.columns
|
||||
.column.is-12
|
||||
.field
|
||||
label.label Descripción
|
||||
.control
|
||||
input.input(type="text" v-model="desc" placeholder="Descripción de la multa")
|
||||
.columns
|
||||
.column.is-12
|
||||
.field
|
||||
label.label Semanas
|
||||
.control
|
||||
input.input(type="number" v-model="sem" placeholder="Numero de semanas multado")
|
||||
.columns
|
||||
.column
|
||||
.field
|
||||
.control
|
||||
button.button.is-u-blue(v-on:click="save()") Guardar
|
||||
.colmuns
|
||||
.column.is-10.is-offset-1
|
||||
table.table.is-fullwidth
|
||||
thead
|
||||
th Id
|
||||
th Descripcion
|
||||
th Semanas
|
||||
th Editar
|
||||
th Borrar
|
||||
tbody
|
||||
tr(v-for="dt in data")
|
||||
td {{dt.id}}
|
||||
td {{dt.nombre}}
|
||||
td {{dt.semanas}}
|
||||
td
|
||||
a.button.is-info.is-outlined(v-on:click="updateButton(dt)")
|
||||
span.icon.is-small
|
||||
font-awesome-icon(icon="pen")
|
||||
td
|
||||
a.button.is-danger.is-outlined(v-on:click="del(dt.id)")
|
||||
span.icon.is-small
|
||||
font-awesome-icon(icon="trash")
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Edit from '../components/multa/Edit.vue'
|
||||
import swal from 'sweetalert'
|
||||
import api from '../api'
|
||||
const axios = require('axios')
|
||||
export default {
|
||||
components: { Edit },
|
||||
data () {
|
||||
return {
|
||||
desc: '',
|
||||
sem: '',
|
||||
data: [],
|
||||
multa: {}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
axios.get(api.url + '/multa', {
|
||||
headers: {
|
||||
'token': window.localStorage.pcpumaT
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
console.log(response.data)
|
||||
this.data = response.data.data
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
updateButton: function (data) {
|
||||
this.multa = data
|
||||
this.toggleModal()
|
||||
console.log(this.multa)
|
||||
},
|
||||
toggleModal: function () {
|
||||
let modal = document.getElementById('modal')
|
||||
if (!modal.classList.contains('is-active')) {
|
||||
modal.classList.add('is-active')
|
||||
} else {
|
||||
modal.classList.remove('is-active')
|
||||
}
|
||||
},
|
||||
save: function () {
|
||||
axios({
|
||||
method: 'post',
|
||||
url: api.url + '/multa',
|
||||
data: {
|
||||
nombre: this.desc,
|
||||
semanas: this.sem
|
||||
},
|
||||
headers: {
|
||||
'token': window.localStorage.pcpumaT
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
// console.log(this.data)
|
||||
swal('Exito', 'Peticion exitosa ', 'success')
|
||||
axios.get(api.url + '/multa', {
|
||||
headers: {
|
||||
'token': window.localStorage.pcpumaT
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
// console.log(response.data)
|
||||
this.data = response.data.data
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.response.data)
|
||||
swal('Error', error.response.data.err, 'error')
|
||||
})
|
||||
},
|
||||
del: function (id) {
|
||||
axios({
|
||||
method: 'delete',
|
||||
url: api.url + '/multa',
|
||||
data: {
|
||||
id
|
||||
},
|
||||
headers: {
|
||||
'token': window.localStorage.pcpumaT
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
swal('Exito', 'Se elimino el Registro ', 'success')
|
||||
axios.get(api.url + '/multa', {
|
||||
headers: {
|
||||
'token': window.localStorage.pcpumaT
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
// console.log(response.data)
|
||||
this.data = response.data.data
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.response.data)
|
||||
swal('Error', error.response.data.err, 'error')
|
||||
})
|
||||
},
|
||||
update: function () {
|
||||
axios({
|
||||
method: 'put',
|
||||
url: api.url + '/multa',
|
||||
data: {
|
||||
id: this.multa.id,
|
||||
nombre: this.multa.nombre,
|
||||
semanas: this.multa.semanas
|
||||
},
|
||||
headers: {
|
||||
'token': window.localStorage.pcpumaT
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
swal('Exito', 'Se actualizo el Registro ', 'success')
|
||||
axios.get(api.url + '/multa', {
|
||||
headers: {
|
||||
'token': window.localStorage.pcpumaT
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
// console.log(response.data)
|
||||
this.data = response.data.data
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error)
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.response.data)
|
||||
swal('Error', error.response.data.err, 'error')
|
||||
})
|
||||
this.toggleModal()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faLaptop, faTabletAlt, faUser, faLock, faSearch, faShoppingCart, faCheckCircle, faPen, faEye } from '@fortawesome/free-solid-svg-icons'
|
||||
import { faLaptop, faTrash, faTabletAlt, faUser, faLock, faSearch, faShoppingCart, faCheckCircle, faPen, faEye } from '@fortawesome/free-solid-svg-icons'
|
||||
import { faChrome } from '@fortawesome/free-brands-svg-icons'
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
||||
import router from './routes.js'
|
||||
@@ -10,7 +10,7 @@ library.add(faLaptop)
|
||||
library.add(faUser)
|
||||
library.add(faLock)
|
||||
library.add(faTabletAlt)
|
||||
|
||||
library.add(faTrash)
|
||||
Vue.component('font-awesome-icon', FontAwesomeIcon)
|
||||
|
||||
// import Child from './components/Child.vue'
|
||||
|
||||
+2
-1
@@ -1 +1,2 @@
|
||||
@import '../../node_modules/bulma/bulma.sass'
|
||||
//@import '../../node_modules/bulma/bulma.sass'
|
||||
@import './acatlan/bulma.sass'
|
||||
|
||||
Reference in New Issue
Block a user