mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
feat: fix journal.
This commit is contained in:
@@ -21,7 +21,7 @@ export default function BranchSuggestField({
|
||||
...suggestProps
|
||||
}) {
|
||||
const initialBranch = React.useMemo(
|
||||
() => branches.some((b) => b.id === initialBranchId),
|
||||
() => branches.find((b) => b.id === initialBranchId),
|
||||
[initialBranchId, branches],
|
||||
);
|
||||
|
||||
@@ -29,6 +29,15 @@ export default function BranchSuggestField({
|
||||
initialBranch || null,
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (typeof selectedBranchId !== 'undefined') {
|
||||
const branch = selectedBranchId
|
||||
? branches.find((a) => a.id === selectedBranchId)
|
||||
: null;
|
||||
setSelectedBranch(branch);
|
||||
}
|
||||
}, [selectedBranchId, branches, setSelectedBranch]);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} branch
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function BranchesListFieldCell({
|
||||
}) {
|
||||
const handleBranchSelected = React.useCallback(
|
||||
(branch) => {
|
||||
updateData(index, 'brnach_id', branch.id);
|
||||
updateData(index, 'branch_id', branch.id);
|
||||
},
|
||||
[updateData, index],
|
||||
);
|
||||
@@ -33,7 +33,7 @@ export default function BranchesListFieldCell({
|
||||
<BranchSuggestField
|
||||
branches={branches}
|
||||
onBranchSelected={handleBranchSelected}
|
||||
selectedBranchId={original?.contact_id}
|
||||
selectedBranchId={original?.branch_id}
|
||||
/>
|
||||
</FormGroup>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user