From a9d34dfcc89bf9f828d48040cf27a0ec063feb30 Mon Sep 17 00:00:00 2001
From: Khanh Nguyen <66460089+kstockk@users.noreply.github.com>
Date: Fri, 4 Aug 2023 17:05:27 +1000
Subject: [PATCH] Add options on Import transactions screen to mark
 transactions as cleared/uncleared (#1451)

---
 .../src/components/modals/ImportTransactions.js      | 12 ++++++++++++
 packages/desktop-client/src/icons/v2/Eye.js          |  2 +-
 upcoming-release-notes/1451.md                       |  6 ++++++
 3 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 upcoming-release-notes/1451.md

diff --git a/packages/desktop-client/src/components/modals/ImportTransactions.js b/packages/desktop-client/src/components/modals/ImportTransactions.js
index 88af52fe2..6ff4ea5b7 100644
--- a/packages/desktop-client/src/components/modals/ImportTransactions.js
+++ b/packages/desktop-client/src/components/modals/ImportTransactions.js
@@ -584,6 +584,8 @@ export default function ImportTransactions({ modalProps, options }) {
 
   let [parseDateFormat, setParseDateFormat] = useState(null);
 
+  let [clearOnImport, setClearOnImport] = useState(true);
+
   async function parse(filename, options) {
     setLoadingState('parsing');
 
@@ -741,6 +743,7 @@ export default function ImportTransactions({ modalProps, options }) {
         ...finalTransaction,
         date,
         amount: amountToInteger(amount),
+        cleared: clearOnImport,
       });
     }
 
@@ -943,6 +946,15 @@ export default function ImportTransactions({ modalProps, options }) {
                 >
                   File has header row
                 </CheckboxOption>
+                <CheckboxOption
+                  id="clear_on_import"
+                  checked={clearOnImport}
+                  onChange={() => {
+                    setClearOnImport(!clearOnImport);
+                  }}
+                >
+                  Clear transactions on import
+                </CheckboxOption>
               </View>
             )}
 
diff --git a/packages/desktop-client/src/icons/v2/Eye.js b/packages/desktop-client/src/icons/v2/Eye.js
index df51a7148..aeff6467e 100644
--- a/packages/desktop-client/src/icons/v2/Eye.js
+++ b/packages/desktop-client/src/icons/v2/Eye.js
@@ -47,4 +47,4 @@ const SvgEye = props => (
     />
   </svg>
 );
-export default SvgEye;
\ No newline at end of file
+export default SvgEye;
diff --git a/upcoming-release-notes/1451.md b/upcoming-release-notes/1451.md
new file mode 100644
index 000000000..9a3baea53
--- /dev/null
+++ b/upcoming-release-notes/1451.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [kstockk]
+---
+
+Add option on import transactions screen to mark the transactions as cleared/uncleared
-- 
GitLab