Upgrades to the UI
This commit is contained in:
@ -210,29 +210,38 @@ class TipoCategoria {
|
||||
}
|
||||
}
|
||||
const cuentas = {
|
||||
id: 'cuentas',
|
||||
id: '#cuentas',
|
||||
balance: 0,
|
||||
tipos: [],
|
||||
tipos_categorias: [],
|
||||
build: function() {
|
||||
return {
|
||||
parent: (segment) => {
|
||||
const tr = $('<tr></tr>').append(
|
||||
$('<th></th>').attr('colspan', 3).html('Cuenta')
|
||||
)
|
||||
$.each(this.tipos, (i, el) => {
|
||||
tr.append(
|
||||
$('<th></th>').attr('class', 'right aligned').css('color', '#' + el.color).html(el.descripcion)
|
||||
)
|
||||
})
|
||||
const table = $('<table></table>').attr('class', 'ui striped table').append(
|
||||
$('<thead></thead>').append(tr)
|
||||
)
|
||||
const parent = $('<tbody></tbody>')
|
||||
table.append(parent)
|
||||
segment.append(table)
|
||||
return parent
|
||||
}
|
||||
}
|
||||
},
|
||||
get: function() {
|
||||
return {
|
||||
parent: () => {
|
||||
let parent = $('#' + this.id)
|
||||
const segment = $(this.id)
|
||||
let parent = segment.find('tbody')
|
||||
if (parent.length === 0) {
|
||||
const tr = $('<tr></tr>').append(
|
||||
$('<th></th>').attr('colspan', 3).html('Cuenta')
|
||||
)
|
||||
$.each(this.tipos, (i, el) => {
|
||||
tr.append(
|
||||
$('<th></th>').attr('class', 'right aligned').css('color', '#' + el.color).html(el.descripcion)
|
||||
)
|
||||
})
|
||||
const table = $('<table></table>').attr('class', 'ui striped table').append(
|
||||
$('<thead></thead>').append(tr)
|
||||
)
|
||||
parent = $('<tbody></tbody>').attr('id', this.id)
|
||||
table.append(parent)
|
||||
$('h1.header').after(table)
|
||||
parent = this.build().parent(segment)
|
||||
}
|
||||
return parent
|
||||
},
|
||||
|
@ -90,32 +90,37 @@ const tipos_categorias = {
|
||||
this.draw()
|
||||
})
|
||||
},
|
||||
getParent: function() {
|
||||
let parent = $(this.id).find('tbody')
|
||||
if (parent.length === 0) {
|
||||
const table = $('<table></table>').attr('class', 'ui table').append(
|
||||
$('<thead></thead>').append(
|
||||
$('<tr></tr>').append(
|
||||
$('<th></th>').attr('class', 'twelve wide').html('Tipo Categoría')
|
||||
).append(
|
||||
$('<th></th>').attr('class', 'two wide').html('Activo')
|
||||
).append(
|
||||
$('<th></th>').attr('class', 'two wide right aligned').append(
|
||||
$('<button></button>').attr('class', 'ui tiny green circular icon button').append(
|
||||
$('<i></i>').attr('class', 'plus icon')
|
||||
)
|
||||
buildParent: function(segment) {
|
||||
const table = $('<table></table>').attr('class', 'ui table').append(
|
||||
$('<thead></thead>').append(
|
||||
$('<tr></tr>').append(
|
||||
$('<th></th>').attr('class', 'twelve wide').html('Tipo Categoría')
|
||||
).append(
|
||||
$('<th></th>').attr('class', 'two wide').html('Activo')
|
||||
).append(
|
||||
$('<th></th>').attr('class', 'two wide right aligned').append(
|
||||
$('<button></button>').attr('class', 'ui tiny green circular icon button').append(
|
||||
$('<i></i>').attr('class', 'plus icon')
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
table.find('.ui.button').click((e) => {
|
||||
e.preventDefault()
|
||||
this.add()
|
||||
return false
|
||||
})
|
||||
parent = $('<tbody></tbody>')
|
||||
table.append(parent)
|
||||
$(this.id).append(table)
|
||||
)
|
||||
table.find('.ui.button').click((e) => {
|
||||
e.preventDefault()
|
||||
this.add()
|
||||
return false
|
||||
})
|
||||
parent = $('<tbody></tbody>')
|
||||
table.append(parent)
|
||||
segment.append(table)
|
||||
return parent
|
||||
},
|
||||
getParent: function() {
|
||||
const segment = $(this.id)
|
||||
let parent = segment.find('tbody')
|
||||
if (parent.length === 0) {
|
||||
parent = this.buildParent(segment)
|
||||
}
|
||||
return parent
|
||||
},
|
||||
|
@ -55,6 +55,7 @@ class TipoCuenta {
|
||||
const tipos_cuentas = {
|
||||
id: '#tipos_cuentas',
|
||||
tipos: [],
|
||||
modal: null,
|
||||
getTipos: function() {
|
||||
this.tipos = []
|
||||
return sendGet(_urls.api + '/tipos/cuentas').then((data) => {
|
||||
|
@ -57,31 +57,40 @@ const archivos = {
|
||||
add: null,
|
||||
edit: null
|
||||
},
|
||||
get: function() {
|
||||
build: function() {
|
||||
return {
|
||||
parent: () => {
|
||||
let parent = $(this.id).find('tbody')
|
||||
if (parent.length === 0) {
|
||||
const table = $('<table></table>').attr('class', 'ui striped table').append(
|
||||
$('<thead></thead>').append(
|
||||
$('<tr></tr>').append(
|
||||
$('<th></th>').html('Archivo')
|
||||
).append(
|
||||
$('<th></th>').attr('class', 'right aligned').append(
|
||||
$('<button></button>').attr('class', 'ui tiny green circular icon button').append(
|
||||
$('<i></i>').attr('class', 'plus icon')
|
||||
).click((e) => {
|
||||
e.preventDefault()
|
||||
this.add()
|
||||
return false
|
||||
})
|
||||
)
|
||||
parent: (segment) => {
|
||||
const table = $('<table></table>').attr('class', 'ui striped table').append(
|
||||
$('<thead></thead>').append(
|
||||
$('<tr></tr>').append(
|
||||
$('<th></th>').html('Archivo')
|
||||
).append(
|
||||
$('<th></th>').attr('class', 'right aligned').append(
|
||||
$('<button></button>').attr('class', 'ui tiny green circular icon button').append(
|
||||
$('<i></i>').attr('class', 'plus icon')
|
||||
).click((e) => {
|
||||
e.preventDefault()
|
||||
this.add()
|
||||
return false
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
parent = $('<tbody></tbody>')
|
||||
table.append(parent)
|
||||
$(this.id).append(table)
|
||||
)
|
||||
const parent = $('<tbody></tbody>')
|
||||
table.append(parent)
|
||||
segment.append(table)
|
||||
return parent
|
||||
}
|
||||
}
|
||||
},
|
||||
get: function() {
|
||||
return {
|
||||
parent: () => {
|
||||
const segment = $(this.id)
|
||||
let parent = segment.find('tbody')
|
||||
if (parent.length === 0) {
|
||||
parent = this.build().parent(segment)
|
||||
}
|
||||
return parent
|
||||
},
|
||||
|
Reference in New Issue
Block a user