Skip to content

Commit

Permalink
add initials
Browse files Browse the repository at this point in the history
  • Loading branch information
dtxe committed Feb 20, 2024
1 parent 1493249 commit 336dacd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<h2>Expense Parser</h2>

<h4>Paste in data from My Wallet</h4>
<label>Enter your initials:</label>
<input type="text" id="initials" style="width: 10em;">
<br><br>
<textarea id="inputText" style="width: 100%; height: 8em;" placeholder="Paste your expenses here..."></textarea>
<br>
<button onclick="parseAndDisplay()">Parse Expenses</button>
Expand Down Expand Up @@ -50,6 +53,10 @@ <h4 style="margin-top: 2em;">Interactive table</h4>
};

const parseTextToTable = (input) => {
let initials = document.getElementById('initials').value.toUpperCase();
initials = initials.length == 0 ? '' : initials + '_';


const lines = input.split('\n').filter(line => line.trim() !== '');
const table = [];
let currentDate;
Expand All @@ -67,7 +74,7 @@ <h4 style="margin-top: 2em;">Interactive table</h4>
const amountInCAD = amounts[1].replace(/,/g, '');
const amountInOriginalCurrency = (amounts[3] ? `${amounts[2]} ${amounts[3]}` : '').replace(/,/g, '');
const dateFormatted = formatDate(currentDate);
const filename = `${dateFormatted}_${expenseName.replace(/[^a-zA-Z0-9.\-_]/g, '')}_${amountInCAD}.pdf`;
const filename = `${initials}${dateFormatted}_${expenseName.replace(/[^a-zA-Z0-9.\-_]/g, '')}_${amountInCAD}.pdf`;

table.push([
currentDate.toLocaleDateString('en-CA'),
Expand Down

0 comments on commit 336dacd

Please sign in to comment.