mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-29 02:54:09 -05:00
[Feature] Add option to control the "cleared state" in Rules (#482)
This commit is contained in:
@@ -133,7 +133,8 @@ export default function TransactionList({
|
||||
if (
|
||||
newTransaction[field] == null ||
|
||||
newTransaction[field] === '' ||
|
||||
newTransaction[field] === 0
|
||||
newTransaction[field] === 0 ||
|
||||
newTransaction[field] === false
|
||||
) {
|
||||
newTransaction[field] = diff[field];
|
||||
}
|
||||
|
||||
@@ -284,7 +284,8 @@ let actionFields = [
|
||||
'date',
|
||||
'amount',
|
||||
'category',
|
||||
'account'
|
||||
'account',
|
||||
'cleared'
|
||||
].map(field => [field, mapField(field)]);
|
||||
function ActionEditor({ ops, action, editorStyle, onChange, onDelete, onAdd }) {
|
||||
let { field, op, value, type, error, inputKey = 'initial' } = action;
|
||||
|
||||
@@ -7,6 +7,7 @@ import Autocomplete from 'loot-design/src/components/Autocomplete';
|
||||
import CategoryAutocomplete from 'loot-design/src/components/CategorySelect';
|
||||
import { View, Input } from 'loot-design/src/components/common';
|
||||
import DateSelect from 'loot-design/src/components/DateSelect';
|
||||
import { Checkbox } from 'loot-design/src/components/forms';
|
||||
import PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete';
|
||||
import RecurringSchedulePicker from 'loot-design/src/components/RecurringSchedulePicker';
|
||||
|
||||
@@ -149,6 +150,16 @@ export default function GenericInput({
|
||||
}
|
||||
break;
|
||||
|
||||
case 'boolean':
|
||||
content = (
|
||||
<Checkbox
|
||||
checked={value}
|
||||
value={value}
|
||||
onChange={e => onChange(!value)}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (multi) {
|
||||
content = (
|
||||
|
||||
@@ -57,6 +57,8 @@ export function mapField(field, opts) {
|
||||
return 'amount (inflow)';
|
||||
case 'amount-outflow':
|
||||
return 'amount (outflow)';
|
||||
case 'cleared':
|
||||
return 'cleared';
|
||||
default:
|
||||
return field;
|
||||
}
|
||||
@@ -154,6 +156,10 @@ export function parse(item) {
|
||||
let parsed = item.value == null ? '' : item.value;
|
||||
return { ...item, value: parsed };
|
||||
}
|
||||
case 'boolean': {
|
||||
let parsed = item.value;
|
||||
return { ...item, value: parsed };
|
||||
}
|
||||
default:
|
||||
}
|
||||
|
||||
@@ -174,6 +180,10 @@ export function unparse({ error, inputKey, ...item }) {
|
||||
let unparsed = item.value == null ? '' : item.value;
|
||||
return { ...item, value: unparsed };
|
||||
}
|
||||
case 'boolean': {
|
||||
let unparsed = item.value == null ? false : item.value;
|
||||
return { ...item, value: unparsed };
|
||||
}
|
||||
default:
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user