FIX: Clear form and table
This commit is contained in:
@ -90,6 +90,7 @@ const archivos = {
|
|||||||
if (data.files === null || data.files.length === 0) {
|
if (data.files === null || data.files.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.archivos = []
|
||||||
$.each(data.files, (i, el) => {
|
$.each(data.files, (i, el) => {
|
||||||
const arch = new Archivo(el)
|
const arch = new Archivo(el)
|
||||||
arch.setModal(this.modals.edit)
|
arch.setModal(this.modals.edit)
|
||||||
@ -106,20 +107,21 @@ const archivos = {
|
|||||||
},
|
},
|
||||||
draw: function() {
|
draw: function() {
|
||||||
const tbody = this.get().parent()
|
const tbody = this.get().parent()
|
||||||
tbody.html('')
|
tbody.empty()
|
||||||
$.each(this.archivos, (i, el) => {
|
$.each(this.archivos, (i, el) => {
|
||||||
tbody.append(el.draw())
|
tbody.append(el.draw())
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
add: function() {
|
add: function() {
|
||||||
this.modals.add.find('form').trigger('reset')
|
this.modals.add.find('form').trigger('reset')
|
||||||
|
this.modals.add.find("[name='cuenta']").dropdown('clear')
|
||||||
this.modals.add.modal('show')
|
this.modals.add.modal('show')
|
||||||
},
|
},
|
||||||
doAdd: function() {
|
doAdd: function() {
|
||||||
const data = new FormData(this.modals.add.find('form'))
|
const data = new FormData(this.modals.add.find('form')[0])
|
||||||
return sendPost(_urls.api + '/categorias/add', data, true).then((resp) => {
|
return sendPost(_urls.api + '/uploads/add', data, true).then((resp) => {
|
||||||
this.modals.add.modal('hide')
|
this.modals.add.modal('hide')
|
||||||
this.getCategorias()
|
this.get().archivos()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
doEdit: function() {
|
doEdit: function() {
|
||||||
@ -149,7 +151,7 @@ const archivos = {
|
|||||||
date: function(date, settings) {
|
date: function(date, settings) {
|
||||||
if (!date) return ''
|
if (!date) return ''
|
||||||
const year = date.getFullYear()
|
const year = date.getFullYear()
|
||||||
const month = date.getMonth() + 1
|
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||||
return [year, month].join('-')
|
return [year, month].join('-')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user