diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index d5675975b..a50bafe5d 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -75,16 +75,16 @@ {{::prop.nameI18n}}: - , + ,
{{::prop.nameI18n}}: - + - ← + ←
diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index ef1b370b5..362eb8089 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -64,29 +64,47 @@ export default class Controller extends Section { set logs(value) { this._logs = value; if (!value) return; + const empty = {}; const validations = window.validations; + const castJsonValue = this.castJsonValue; + for (const log of value) { - const oldValues = log.oldInstance || empty; - const newValues = log.newInstance || empty; + const notDelete = log.action != 'delete'; + const olds = (notDelete ? log.oldInstance : null) || empty; + const vals = (notDelete ? log.newInstance : log.oldInstance) || empty; const locale = validations[log.changedModel]?.locale || empty; log.changedModelI18n = firstUpper(locale.name) || log.changedModel; - let props = Object.keys(oldValues).concat(Object.keys(newValues)); + let props = Object.keys(olds).concat(Object.keys(vals)); props = [...new Set(props)]; log.props = []; for (const prop of props) { + if (prop.endsWith('$')) continue; log.props.push({ name: prop, nameI18n: firstUpper(locale.columns?.[prop]) || prop, - old: this.castJsonValue(oldValues[prop]), - new: this.castJsonValue(newValues[prop]) + old: getVal(olds, prop), + val: getVal(vals, prop) }); } log.props.sort( (a, b) => a.nameI18n.localeCompare(b.nameI18n)); } + + function getVal(vals, prop) { + let val, id; + const showProp = `${prop}$`; + + if (vals[showProp] != null) { + val = vals[showProp]; + id = vals[prop]; + } else + val = vals[prop]; + + return {val: castJsonValue(val), id}; + } } get models() { @@ -113,10 +131,6 @@ export default class Controller extends Section { : value; } - mainVal(prop, action) { - return action == 'delete' ? prop.old : prop.new; - } - relativeDate(dateVal) { if (dateVal == null) return ''; const date = new Date(dateVal); @@ -238,3 +252,12 @@ ngModule.vnComponent('vnLog', { url: '@' } }); + +ngModule.component('vnLogValue', { + template: + '' + + ' #{{::$ctrl.val.id}}', + bindings: { + val: ' .id-value { + font-size: .9rem; + color: $color-font-secondary; +} diff --git a/modules/account/back/locale/role-inherit/en.yml b/modules/account/back/locale/role-inherit/en.yml index 760881325..8422ecdce 100644 --- a/modules/account/back/locale/role-inherit/en.yml +++ b/modules/account/back/locale/role-inherit/en.yml @@ -1,4 +1,5 @@ name: subrole columns: + id: id role: rol inheritsFrom: inherits diff --git a/modules/account/back/locale/role-inherit/es.yml b/modules/account/back/locale/role-inherit/es.yml index c352c6ff2..10381628c 100644 --- a/modules/account/back/locale/role-inherit/es.yml +++ b/modules/account/back/locale/role-inherit/es.yml @@ -1,4 +1,5 @@ name: subrol columns: + id: id role: rol inheritsFrom: hereda diff --git a/modules/client/back/locale/sms/en.yml b/modules/client/back/locale/sms/en.yml new file mode 100644 index 000000000..cb52f80ec --- /dev/null +++ b/modules/client/back/locale/sms/en.yml @@ -0,0 +1,10 @@ +name: SMS +columns: + id: id + senderFk: sender + sender: sender number + destination: destination + message: message + statusCode: status code + status: status + created: created diff --git a/modules/client/back/locale/sms/es.yml b/modules/client/back/locale/sms/es.yml new file mode 100644 index 000000000..f314921c1 --- /dev/null +++ b/modules/client/back/locale/sms/es.yml @@ -0,0 +1,10 @@ +name: SMS +columns: + id: id + senderFk: remitente + sender: número remitente + destination: destinatario + message: mensaje + statusCode: código estado + status: estado + created: creado