Skip to content

Commit

Permalink
Merge pull request #155 from simplitrac/ocr_modal
Browse files Browse the repository at this point in the history
new ocr modal
  • Loading branch information
dave-b-b authored Sep 12, 2024
2 parents da18137 + e7ff708 commit bfe7ccf
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions client/src/components/OCRModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const OCRModal = () => {
};

const displayConfirmation = (transaction) => {
console.log("Transaction data in OCRModal:", transaction);

if (transaction.error) {
return (
<li className="source-type-modal__list-item">
Expand All @@ -61,24 +63,19 @@ const OCRModal = () => {
);
}

return Object.entries(transaction)
.filter(entry => entry[1] !== null && entry[1] !== undefined)
.map((entry, index) => {

if(entry[0] === "transactionId") return;

return (
<li key={index} className="source-type-modal__list-item">
<label>
{entry[0]}
</label>
<div>
{entry[1]}
</div>
</li>
)

});
const fields = [
{ key: 'createdAt', label: 'Date' },
{ key: 'vendor', label: 'Vendor' },
{ key: 'amount', label: 'Amount' },
{ key: 'category_name', label: 'Category' }
];

return fields.map((field, index) => (
<li key={index} className="source-type-modal__list-item">
<label>{field.label}</label>
<div>{transaction[field.key] !== undefined && transaction[field.key] !== null ? transaction[field.key] : 'Not available'}</div>
</li>
));
}

// Copied this from: https://stackblitz.com/edit/modal-dialog-with-checkbox?file=src%2FApp.js
Expand Down

0 comments on commit bfe7ccf

Please sign in to comment.