diff --git a/new-lamassu-admin/src/pages/Maintenance/CashboxHistory.js b/new-lamassu-admin/src/pages/Maintenance/CashboxHistory.js index 7e2cd8f4..1846bebe 100644 --- a/new-lamassu-admin/src/pages/Maintenance/CashboxHistory.js +++ b/new-lamassu-admin/src/pages/Maintenance/CashboxHistory.js @@ -110,15 +110,11 @@ const CashboxHistory = ({ machines, currency }) => { } const save = row => { - const _performedBy = R.prop( - 'performedBy', - R.find(f => f.id === row.id, fields) - ) - - const performedBy = _performedBy === '' ? null : _performedBy + const field = R.find(f => f.id === row.id, fields) + const performedBy = field.performedBy === '' ? null : field.performedBy schema - .isValid(performedBy) + .isValid(field) .then(() => { setError(false) editBatch({ @@ -133,6 +129,8 @@ const CashboxHistory = ({ machines, currency }) => { setFields(R.filter(f => f.id !== id, fields)) } + const notEditing = id => !R.any(R.propEq('id', id), fields) + const elements = [ { name: 'operation', @@ -197,7 +195,7 @@ const CashboxHistory = ({ machines, currency }) => { width: 180, textAlign: 'left', view: it => { - if (!R.any(R.propEq('id', it.id), fields)) + if (notEditing(it.id)) return R.isNil(it.performedBy) ? 'Unknown entity' : it.performedBy return ( { width: 150, textAlign: 'right', view: it => { - if (!R.any(R.propEq('id', it.id), fields)) + if (notEditing(it.id)) return ( {