Upgrades to the UI

This commit is contained in:
2021-12-23 00:46:56 -03:00
parent 9e29dd09b7
commit 4abe3448c0
11 changed files with 96 additions and 63 deletions

View File

@ -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
},