veggie-ledger-tracker / transactions.html
UltraFastBrother's picture
I'm like dont get salary, I do work like bringing vegetables, grocery and other for home asked either by Mother, Father, Brother and they gave certain money and I returen certain, I want this type and want like time, date, expense occured, tracking, reports, and change also, and maintain balance and all
1503282 verified
Raw History Blame Contribute Delete
4.43 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Veggie Ledger | Transactions</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#4CAF50',
secondary: '#8BC34A',
}
}
}
}
</script>
</head>
<body class="bg-gray-50">
<custom-navbar></custom-navbar>
<main class="container mx-auto px-4 py-8">
<div class="flex justify-between items-center mb-6">
<h1 class="text-2xl font-bold text-gray-800">All Transactions</h1>
<a href="/add-transaction.html" class="bg-primary hover:bg-primary-dark text-white py-2 px-4 rounded-md flex items-center gap-2 transition duration-200">
<i data-feather="plus"></i> Add Transaction
</a>
</div>
<div class="bg-white rounded-lg shadow-md overflow-hidden">
<div class="grid grid-cols-12 bg-gray-100 p-4 font-medium text-gray-700">
<div class="col-span-2">Date & Time</div>
<div class="col-span-3">Description</div>
<div class="col-span-2">Person</div>
<div class="col-span-2">Type</div>
<div class="col-span-2">Amount</div>
<div class="col-span-1">Actions</div>
</div>
<div id="transactions-list" class="divide-y divide-gray-200">
<!-- Transactions will be loaded here -->
</div>
</div>
</main>
<custom-footer></custom-footer>
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
<script src="script.js"></script>
<script>
feather.replace();
document.addEventListener('DOMContentLoaded', function() {
loadAllTransactions();
});
function loadAllTransactions() {
const container = document.getElementById('transactions-list');
container.innerHTML = '';
transactions.forEach(transaction => {
const transactionEl = document.createElement('div');
transactionEl.className = 'grid grid-cols-12 p-4 items-center hover:bg-gray-50';
transactionEl.innerHTML = `
<div class="col-span-2">
<p class="font-medium">${formatDate(transaction.date)}</p>
<p class="text-sm text-gray-500">${transaction.time}</p>
</div>
<div class="col-span-3">${transaction.description}</div>
<div class="col-span-2">${transaction.person}</div>
<div class="col-span-2">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${
transaction.type === 'income' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
}">
${transaction.type === 'income' ? 'Received' : 'Expense'}
</span>
</div>
<div class="col-span-2 font-medium ${
transaction.type === 'income' ? 'text-primary' : 'text-red-500'
}">
${transaction.type === 'income' ? '+' : '-'}₹${transaction.amount.toFixed(2)}
</div>
<div class="col-span-1 flex gap-2">
<button class="text-gray-500 hover:text-primary transition-colors">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button class="text-gray-500 hover:text-red-500 transition-colors">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
`;
container.appendChild(transactionEl);
});
feather.replace();
}
</script>
</body>
</html>