Spaces:
Running
Running
Upload 9 files
#3
by
sosunakuflom3
- opened
- accounting.js +244 -0
- admin.css +317 -0
- admin.html +279 -0
- admin.js +224 -0
- bhr.html +1051 -0
- chart.js +197 -0
- index.html +171 -375
- inventory.js +158 -0
- styles.css +129 -0
accounting.js
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// =======================
|
| 2 |
+
// Load members into accounting dropdown
|
| 3 |
+
// =======================
|
| 4 |
+
async function loadMembersForAccounting() {
|
| 5 |
+
try {
|
| 6 |
+
const res = await fetch('/api/members');
|
| 7 |
+
if (!res.ok) throw new Error('Failed to fetch members');
|
| 8 |
+
|
| 9 |
+
const members = await res.json();
|
| 10 |
+
const select = document.getElementById('memberSelect');
|
| 11 |
+
select.innerHTML = '<option value="">Select Member</option>';
|
| 12 |
+
|
| 13 |
+
members.forEach(m => {
|
| 14 |
+
const opt = document.createElement('option');
|
| 15 |
+
opt.value = m.id;
|
| 16 |
+
opt.textContent = `${m.name} (#${m.id})`;
|
| 17 |
+
select.appendChild(opt);
|
| 18 |
+
});
|
| 19 |
+
} catch (error) {
|
| 20 |
+
console.error(error);
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
// =======================
|
| 25 |
+
// Show/hide payerName input based on payer type
|
| 26 |
+
// =======================
|
| 27 |
+
document.getElementById('payerType').addEventListener('change', (e) => {
|
| 28 |
+
const isNonMember = e.target.value === 'non-member';
|
| 29 |
+
document.getElementById('payerName').style.display = isNonMember ? 'inline-block' : 'none';
|
| 30 |
+
});
|
| 31 |
+
|
| 32 |
+
// =======================
|
| 33 |
+
// Load transactions and apply filters
|
| 34 |
+
// =======================
|
| 35 |
+
async function loadTransactions() {
|
| 36 |
+
try {
|
| 37 |
+
const res = await fetch('/api/accounting');
|
| 38 |
+
if (!res.ok) throw new Error('Failed to fetch transactions');
|
| 39 |
+
|
| 40 |
+
let transactions = await res.json();
|
| 41 |
+
|
| 42 |
+
// Apply filters (assumes filters object exists with start/end properties)
|
| 43 |
+
if (filters?.start || filters?.end) {
|
| 44 |
+
transactions = transactions.filter(tx => {
|
| 45 |
+
const txDate = new Date(tx.month + "-01");
|
| 46 |
+
const start = filters.start ? new Date(filters.start + "-01") : null;
|
| 47 |
+
const end = filters.end ? new Date(filters.end + "-01") : null;
|
| 48 |
+
return (!start || txDate >= start) && (!end || txDate <= end);
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
const tbody = document.getElementById('accountingBody');
|
| 53 |
+
tbody.innerHTML = transactions.map((t, i) => `
|
| 54 |
+
<tr class="${t.category === 'expense' ? 'expense' : 'income'}">
|
| 55 |
+
<td>${i + 1}</td>
|
| 56 |
+
<td>${t.payerType === 'member' ? t.memberId : t.payerName}</td>
|
| 57 |
+
<td>${t.payerType}</td>
|
| 58 |
+
<td>${t.month}</td>
|
| 59 |
+
<td>${t.amount}</td>
|
| 60 |
+
<td>${t.category}</td>
|
| 61 |
+
<td>${t.description || ''}</td>
|
| 62 |
+
<td>
|
| 63 |
+
<button class="btn btn-sm btn-primary" onclick="openActionModal(${t.id})">Actions</button>
|
| 64 |
+
</td>
|
| 65 |
+
</tr>
|
| 66 |
+
`).join('');
|
| 67 |
+
|
| 68 |
+
// Update summary and charts with the filtered transactions
|
| 69 |
+
updateAccountingSummary(transactions);
|
| 70 |
+
renderMonthlyChart(transactions);
|
| 71 |
+
renderIncomeExpenseChart(transactions);
|
| 72 |
+
|
| 73 |
+
} catch (error) {
|
| 74 |
+
console.error(error);
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
// =======================
|
| 79 |
+
// Update accounting summary table
|
| 80 |
+
// =======================
|
| 81 |
+
async function updateAccountingSummary(transactionsParam = null) {
|
| 82 |
+
try {
|
| 83 |
+
const transactions = transactionsParam || await (await fetch('/api/accounting')).json();
|
| 84 |
+
|
| 85 |
+
const summary = {
|
| 86 |
+
contribution: 0,
|
| 87 |
+
donation: 0,
|
| 88 |
+
sale: 0,
|
| 89 |
+
expense: 0,
|
| 90 |
+
memberIncome: 0,
|
| 91 |
+
nonMemberIncome: 0
|
| 92 |
+
};
|
| 93 |
+
|
| 94 |
+
transactions.forEach(tx => {
|
| 95 |
+
if (tx.category === 'contribution') summary.contribution += tx.amount;
|
| 96 |
+
else if (tx.category === 'donation') summary.donation += tx.amount;
|
| 97 |
+
else if (tx.category === 'sale') summary.sale += tx.amount;
|
| 98 |
+
else if (tx.category === 'expense') summary.expense += tx.amount;
|
| 99 |
+
|
| 100 |
+
if (tx.payerType === 'member' && tx.category !== 'expense') summary.memberIncome += tx.amount;
|
| 101 |
+
if (tx.payerType === 'non-member' && tx.category !== 'expense') summary.nonMemberIncome += tx.amount;
|
| 102 |
+
});
|
| 103 |
+
|
| 104 |
+
const tbody = document.getElementById('summaryBody');
|
| 105 |
+
tbody.innerHTML = `
|
| 106 |
+
<tr class="income-summary"><td>Contribution (Income)</td><td>${summary.contribution}</td></tr>
|
| 107 |
+
<tr class="income-summary"><td>Donation (Income)</td><td>${summary.donation}</td></tr>
|
| 108 |
+
<tr class="income-summary"><td>Sales (Income)</td><td>${summary.sale}</td></tr>
|
| 109 |
+
<tr class="income-summary"><td>Total Income from Members</td><td>${summary.memberIncome}</td></tr>
|
| 110 |
+
<tr class="income-summary"><td>Total Income from Non-Members</td><td>${summary.nonMemberIncome}</td></tr>
|
| 111 |
+
<tr class="expense-summary"><td>Total Expenses</td><td>${summary.expense}</td></tr>
|
| 112 |
+
<tr class="income-summary"><td>Net Total</td><td>${(summary.contribution + summary.donation + summary.sale) - summary.expense}</td></tr>
|
| 113 |
+
`;
|
| 114 |
+
} catch (error) {
|
| 115 |
+
console.error(error);
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
// =======================
|
| 120 |
+
// Handle transaction form submission
|
| 121 |
+
// =======================
|
| 122 |
+
document.getElementById('transactionForm').addEventListener('submit', async (e) => {
|
| 123 |
+
e.preventDefault();
|
| 124 |
+
|
| 125 |
+
const category = document.getElementById('transactionCategory').value;
|
| 126 |
+
|
| 127 |
+
const transaction = {
|
| 128 |
+
payerType: document.getElementById('payerType').value,
|
| 129 |
+
memberId: document.getElementById('memberSelect').value || null,
|
| 130 |
+
payerName: document.getElementById('payerName').value || null,
|
| 131 |
+
month: document.getElementById('transactionMonth').value,
|
| 132 |
+
amount: parseFloat(document.getElementById('transactionAmount').value),
|
| 133 |
+
category,
|
| 134 |
+
type: category === 'expense' ? 'expense' : 'income', // additional field for convenience
|
| 135 |
+
description: document.getElementById('transactionDesc').value.trim()
|
| 136 |
+
};
|
| 137 |
+
|
| 138 |
+
try {
|
| 139 |
+
const res = await fetch('/api/accounting', {
|
| 140 |
+
method: 'POST',
|
| 141 |
+
headers: { 'Content-Type': 'application/json' },
|
| 142 |
+
body: JSON.stringify(transaction)
|
| 143 |
+
});
|
| 144 |
+
|
| 145 |
+
if (!res.ok) throw new Error('Failed to add transaction');
|
| 146 |
+
|
| 147 |
+
document.getElementById('transactionForm').reset();
|
| 148 |
+
loadTransactions();
|
| 149 |
+
updateAccountingSummary();
|
| 150 |
+
renderMonthlyChart();
|
| 151 |
+
|
| 152 |
+
} catch (error) {
|
| 153 |
+
console.error(error);
|
| 154 |
+
alert('Failed to save transaction');
|
| 155 |
+
}
|
| 156 |
+
});
|
| 157 |
+
|
| 158 |
+
// =======================
|
| 159 |
+
// Export accounting data as JSON
|
| 160 |
+
// =======================
|
| 161 |
+
document.getElementById('exportAccounting').addEventListener('click', () => {
|
| 162 |
+
window.location.href = '/api/accounting/export';
|
| 163 |
+
});
|
| 164 |
+
|
| 165 |
+
// =======================
|
| 166 |
+
// Initial data load
|
| 167 |
+
// =======================
|
| 168 |
+
loadMembersForAccounting();
|
| 169 |
+
loadTransactions();
|
| 170 |
+
updateAccountingSummary();
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
let selectedTransaction = null;
|
| 175 |
+
|
| 176 |
+
// Open modal and load transaction data
|
| 177 |
+
window.openActionModal = async function (id) {
|
| 178 |
+
const res = await fetch('/api/accounting');
|
| 179 |
+
const transactions = await res.json();
|
| 180 |
+
selectedTransaction = transactions.find(t => t.id === id);
|
| 181 |
+
if (!selectedTransaction) return alert('Transaction not found');
|
| 182 |
+
|
| 183 |
+
// Fill the form
|
| 184 |
+
document.getElementById('editTransactionId').value = selectedTransaction.id;
|
| 185 |
+
document.getElementById('editTransactionMonth').value = selectedTransaction.month;
|
| 186 |
+
document.getElementById('editTransactionAmount').value = selectedTransaction.amount;
|
| 187 |
+
document.getElementById('editTransactionCategory').value = selectedTransaction.category;
|
| 188 |
+
document.getElementById('editTransactionDesc').value = selectedTransaction.description || '';
|
| 189 |
+
|
| 190 |
+
// Show modal
|
| 191 |
+
document.getElementById('transactionModal').classList.remove('hidden');
|
| 192 |
+
};
|
| 193 |
+
|
| 194 |
+
window.closeModal = function () {
|
| 195 |
+
document.getElementById('transactionModal').classList.add('hidden');
|
| 196 |
+
selectedTransaction = null;
|
| 197 |
+
};
|
| 198 |
+
|
| 199 |
+
// Save edited transaction
|
| 200 |
+
document.getElementById('editTransactionForm').addEventListener('submit', async function (e) {
|
| 201 |
+
e.preventDefault();
|
| 202 |
+
const id = document.getElementById('editTransactionId').value;
|
| 203 |
+
|
| 204 |
+
const updatedTx = {
|
| 205 |
+
...selectedTransaction,
|
| 206 |
+
month: document.getElementById('editTransactionMonth').value,
|
| 207 |
+
amount: parseFloat(document.getElementById('editTransactionAmount').value),
|
| 208 |
+
category: document.getElementById('editTransactionCategory').value,
|
| 209 |
+
description: document.getElementById('editTransactionDesc').value
|
| 210 |
+
};
|
| 211 |
+
|
| 212 |
+
const res = await fetch(`/api/accounting/${id}`, {
|
| 213 |
+
method: 'PUT',
|
| 214 |
+
headers: { 'Content-Type': 'application/json' },
|
| 215 |
+
body: JSON.stringify(updatedTx)
|
| 216 |
+
});
|
| 217 |
+
|
| 218 |
+
if (!res.ok) {
|
| 219 |
+
alert('Failed to update transaction');
|
| 220 |
+
return;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
closeModal();
|
| 224 |
+
loadTransactions();
|
| 225 |
+
});
|
| 226 |
+
|
| 227 |
+
// Delete transaction
|
| 228 |
+
window.deleteTransaction = async function () {
|
| 229 |
+
const id = document.getElementById('editTransactionId').value;
|
| 230 |
+
|
| 231 |
+
if (!confirm('Are you sure you want to delete this transaction?')) return;
|
| 232 |
+
|
| 233 |
+
const res = await fetch(`/api/accounting/${id}`, {
|
| 234 |
+
method: 'DELETE'
|
| 235 |
+
});
|
| 236 |
+
|
| 237 |
+
if (!res.ok) {
|
| 238 |
+
alert('Failed to delete transaction');
|
| 239 |
+
return;
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
closeModal();
|
| 243 |
+
loadTransactions();
|
| 244 |
+
};
|
admin.css
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* === RESET & BASE === */
|
| 2 |
+
* {
|
| 3 |
+
margin: 0;
|
| 4 |
+
padding: 0;
|
| 5 |
+
box-sizing: border-box;
|
| 6 |
+
font-family: Arial, sans-serif;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
body {
|
| 10 |
+
background: #f4f6f8;
|
| 11 |
+
color: #333;
|
| 12 |
+
line-height: 1.5;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
/* === HEADER === */
|
| 16 |
+
header {
|
| 17 |
+
background: #2c3e50;
|
| 18 |
+
color: white;
|
| 19 |
+
padding: 1rem;
|
| 20 |
+
text-align: center;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
header h1 {
|
| 24 |
+
font-size: 1.8rem;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
/* === MAIN CONTAINER === */
|
| 28 |
+
main {
|
| 29 |
+
max-width: 1000px;
|
| 30 |
+
margin: 2rem auto;
|
| 31 |
+
padding: 0 1rem;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/* === NAVIGATION TABS === */
|
| 35 |
+
.admin-tabs, .tab-nav {
|
| 36 |
+
display: flex;
|
| 37 |
+
justify-content: center;
|
| 38 |
+
gap: 12px;
|
| 39 |
+
margin: 1rem 0;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.admin-tabs button,
|
| 43 |
+
.tab-nav button {
|
| 44 |
+
background: #bdc3c7;
|
| 45 |
+
color: #2c3e50;
|
| 46 |
+
border: none;
|
| 47 |
+
padding: 10px 16px;
|
| 48 |
+
border-radius: 6px;
|
| 49 |
+
font-weight: bold;
|
| 50 |
+
cursor: pointer;
|
| 51 |
+
transition: background 0.2s ease;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.admin-tabs button:hover,
|
| 55 |
+
.tab-nav button:hover {
|
| 56 |
+
background: #95a5a6;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.admin-tabs button.active,
|
| 60 |
+
.tab-nav button.active {
|
| 61 |
+
background: #2c3e50;
|
| 62 |
+
color: #fff;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/* === SECTIONS === */
|
| 66 |
+
.admin-tab {
|
| 67 |
+
display: none;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
.admin-tab.active {
|
| 71 |
+
display: block;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/* === CARDS & PANELS === */
|
| 75 |
+
.card {
|
| 76 |
+
background: #fff;
|
| 77 |
+
padding: 1rem 1.5rem;
|
| 78 |
+
margin-bottom: 2rem;
|
| 79 |
+
border-radius: 8px;
|
| 80 |
+
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
.card h2, .card h3 {
|
| 84 |
+
margin-bottom: 1rem;
|
| 85 |
+
color: #2c3e50;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/* === FORM STYLING === */
|
| 89 |
+
form {
|
| 90 |
+
margin: 1rem 0;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
form input, form select {
|
| 94 |
+
display: block;
|
| 95 |
+
width: 100%;
|
| 96 |
+
padding: 0.6rem;
|
| 97 |
+
margin-bottom: 0.8rem;
|
| 98 |
+
border: 1px solid #ccc;
|
| 99 |
+
border-radius: 6px;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
form button {
|
| 103 |
+
background: #3498db;
|
| 104 |
+
color: white;
|
| 105 |
+
border: none;
|
| 106 |
+
padding: 0.6rem 1.2rem;
|
| 107 |
+
border-radius: 6px;
|
| 108 |
+
cursor: pointer;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
form button:hover {
|
| 112 |
+
background: #2980b9;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/* === TABLES === */
|
| 116 |
+
table {
|
| 117 |
+
width: 100%;
|
| 118 |
+
border-collapse: collapse;
|
| 119 |
+
margin-top: 1rem;
|
| 120 |
+
font-size: 14px;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
th, td {
|
| 124 |
+
padding: 0.6rem;
|
| 125 |
+
border: 1px solid #ddd;
|
| 126 |
+
text-align: left;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
th {
|
| 130 |
+
background: #ecf0f1;
|
| 131 |
+
font-weight: bold;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
tbody tr:nth-child(even) {
|
| 135 |
+
background: #f9f9f9;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
tbody tr:hover {
|
| 139 |
+
background: #f0f8ff;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
/* === ACCOUNTING HIGHLIGHTING === */
|
| 143 |
+
#accountingBody tr.income {
|
| 144 |
+
background-color: #d4f8d4; /* light green */
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
#accountingBody tr.expense {
|
| 148 |
+
background-color: #f8d4d4; /* light red */
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
#accountingBody tr.non-member {
|
| 152 |
+
border-left: 4px solid red;
|
| 153 |
+
font-style: italic;
|
| 154 |
+
opacity: 0.9;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
#summaryBody tr.income-summary {
|
| 158 |
+
background: #d4f8d4;
|
| 159 |
+
font-weight: bold;
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
#summaryBody tr.expense-summary {
|
| 163 |
+
background: #f8d4d4;
|
| 164 |
+
font-weight: bold;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
/* === BUTTONS === */
|
| 168 |
+
button {
|
| 169 |
+
margin-top: 1rem;
|
| 170 |
+
padding: 0.5rem 1rem;
|
| 171 |
+
border-radius: 6px;
|
| 172 |
+
border: none;
|
| 173 |
+
font-weight: bold;
|
| 174 |
+
cursor: pointer;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
#exportMembers {
|
| 178 |
+
background: #27ae60;
|
| 179 |
+
color: white;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
#exportMembers:hover {
|
| 183 |
+
background: #1e8449;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
#exportAccounting {
|
| 187 |
+
background: #e67e22;
|
| 188 |
+
color: white;
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
#exportAccounting:hover {
|
| 192 |
+
background: #ca6f1e;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
#exportInventory {
|
| 196 |
+
background: #9b59b6;
|
| 197 |
+
color: white;
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
#exportInventory:hover {
|
| 201 |
+
background: #8e44ad;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
button[id^="toggle"] {
|
| 205 |
+
background: #7f8c8d;
|
| 206 |
+
color: white;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
button[id^="toggle"]:hover {
|
| 210 |
+
background: #636e72;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
/* === CHARTS === */
|
| 214 |
+
.chart-container {
|
| 215 |
+
width: 400px;
|
| 216 |
+
max-width: 100%;
|
| 217 |
+
margin: 20px auto;
|
| 218 |
+
padding: 15px;
|
| 219 |
+
background: #fff;
|
| 220 |
+
border-radius: 12px;
|
| 221 |
+
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
|
| 222 |
+
text-align: center;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
.chart-container h3 {
|
| 226 |
+
margin-bottom: 10px;
|
| 227 |
+
font-size: 1.2em;
|
| 228 |
+
color: #333;
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
.chart-legend {
|
| 232 |
+
margin-top: 10px;
|
| 233 |
+
display: flex;
|
| 234 |
+
justify-content: center;
|
| 235 |
+
gap: 15px;
|
| 236 |
+
font-size: 0.9em;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
.chart-legend span {
|
| 240 |
+
display: flex;
|
| 241 |
+
align-items: center;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
.chart-legend i {
|
| 245 |
+
display: inline-block;
|
| 246 |
+
width: 14px;
|
| 247 |
+
height: 14px;
|
| 248 |
+
margin-right: 5px;
|
| 249 |
+
border-radius: 3px;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
.legend-income i {
|
| 253 |
+
background-color: rgba(75,192,192,0.7);
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
.legend-expense i {
|
| 257 |
+
background-color: rgba(255,99,132,0.7);
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
#monthlyChart {
|
| 261 |
+
width: 100%;
|
| 262 |
+
max-width: 800px;
|
| 263 |
+
margin: auto;
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
/* === RESPONSIVE (optional) === */
|
| 267 |
+
@media (max-width: 768px) {
|
| 268 |
+
.admin-tabs, .tab-nav {
|
| 269 |
+
flex-direction: column;
|
| 270 |
+
align-items: center;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
table, thead, tbody, th, td, tr {
|
| 274 |
+
display: block;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
table thead {
|
| 278 |
+
display: none;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
table tr {
|
| 282 |
+
margin-bottom: 1rem;
|
| 283 |
+
background: #fff;
|
| 284 |
+
border: 1px solid #ccc;
|
| 285 |
+
padding: 1rem;
|
| 286 |
+
border-radius: 6px;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
table td {
|
| 290 |
+
padding: 0.5rem 0;
|
| 291 |
+
border: none;
|
| 292 |
+
position: relative;
|
| 293 |
+
padding-left: 50%;
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
table td::before {
|
| 297 |
+
position: absolute;
|
| 298 |
+
top: 0.5rem;
|
| 299 |
+
left: 1rem;
|
| 300 |
+
font-weight: bold;
|
| 301 |
+
content: attr(data-label);
|
| 302 |
+
}
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
.modal.hidden { display: none; }
|
| 308 |
+
.modal {
|
| 309 |
+
position: fixed; top: 0; left: 0;
|
| 310 |
+
width: 100%; height: 100%;
|
| 311 |
+
background: rgba(0,0,0,0.5);
|
| 312 |
+
}
|
| 313 |
+
.modal-content {
|
| 314 |
+
background: #fff; padding: 20px;
|
| 315 |
+
margin: 10% auto; width: 300px;
|
| 316 |
+
}
|
| 317 |
+
|
admin.html
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Admin Dashboard</title>
|
| 7 |
+
<link rel="stylesheet" href="admin.css">
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 9 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
| 10 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
| 11 |
+
</head>
|
| 12 |
+
<body>
|
| 13 |
+
<header>
|
| 14 |
+
<h1>Admin Dashboard</h1>
|
| 15 |
+
<nav class="admin-tabs">
|
| 16 |
+
<button data-tab="members" class="active">Members</button>
|
| 17 |
+
<button data-tab="accounting">Accounting</button>
|
| 18 |
+
<button data-tab="inventory">Inventory</button>
|
| 19 |
+
</nav>
|
| 20 |
+
</header>
|
| 21 |
+
|
| 22 |
+
<main>
|
| 23 |
+
<!-- === Members Section === -->
|
| 24 |
+
<section id="members" class="admin-tab active">
|
| 25 |
+
<h2>Members</h2>
|
| 26 |
+
<button id="toggleMemberForm">Add Member</button>
|
| 27 |
+
|
| 28 |
+
<div id="memberFormContainer" class="form-container hidden">
|
| 29 |
+
<form id="memberForm">
|
| 30 |
+
<input type="text" id="memberId" placeholder="Member ID" readonly />
|
| 31 |
+
<p>Next ID will be: <span id="nextIdPreview"></span></p>
|
| 32 |
+
<input type="text" id="name" placeholder="Full Name" required />
|
| 33 |
+
<input type="text" id="address" placeholder="Address (e.g. 12 Apostle Rd)" />
|
| 34 |
+
<input type="email" id="email" placeholder="Email" required />
|
| 35 |
+
<input type="text" id="phone" placeholder="Phone" />
|
| 36 |
+
<button type="submit">Add Member</button>
|
| 37 |
+
</form>
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
<h3>Members List</h3>
|
| 41 |
+
<table>
|
| 42 |
+
<thead>
|
| 43 |
+
<tr>
|
| 44 |
+
<th>ID</th><th>Name</th><th>Address</th><th>Email</th><th>Phone</th>
|
| 45 |
+
</tr>
|
| 46 |
+
</thead>
|
| 47 |
+
<tbody id="membersBody"></tbody>
|
| 48 |
+
</table>
|
| 49 |
+
<button id="exportMembers">Export JSON</button>
|
| 50 |
+
</section>
|
| 51 |
+
|
| 52 |
+
<!-- === Accounting Section === -->
|
| 53 |
+
<section id="accounting" class="admin-tab">
|
| 54 |
+
<h2>Accounting Dashboard</h2>
|
| 55 |
+
<button id="toggleTransactionForm">Add Transaction</button>
|
| 56 |
+
|
| 57 |
+
<div id="transactionFormContainer" class="form-container hidden">
|
| 58 |
+
<form id="transactionForm">
|
| 59 |
+
<select id="payerType">
|
| 60 |
+
<option value="member">Member</option>
|
| 61 |
+
<option value="non-member">Non-Member</option>
|
| 62 |
+
</select>
|
| 63 |
+
|
| 64 |
+
<select id="memberSelect">
|
| 65 |
+
<option value="">Select Member</option>
|
| 66 |
+
</select>
|
| 67 |
+
|
| 68 |
+
<input type="text" id="payerName" placeholder="Non-member Name" class="hidden" />
|
| 69 |
+
<input type="month" id="transactionMonth" required />
|
| 70 |
+
<input type="number" id="transactionAmount" placeholder="Amount" required />
|
| 71 |
+
|
| 72 |
+
<select id="transactionCategory">
|
| 73 |
+
<option value="contribution">Contribution (Income)</option>
|
| 74 |
+
<option value="donation">Donation (Income)</option>
|
| 75 |
+
<option value="sale">Sale (Income)</option>
|
| 76 |
+
<option value="expense">Expense</option>
|
| 77 |
+
</select>
|
| 78 |
+
|
| 79 |
+
<input type="text" id="transactionDesc" placeholder="Description" />
|
| 80 |
+
<button type="submit">Add Transaction</button>
|
| 81 |
+
</form>
|
| 82 |
+
</div>
|
| 83 |
+
|
| 84 |
+
<!-- Filter Controls -->
|
| 85 |
+
<div id="filters">
|
| 86 |
+
<label for="filterStart">Start:</label>
|
| 87 |
+
<input type="month" id="filterStart" />
|
| 88 |
+
|
| 89 |
+
<label for="filterEnd">End:</label>
|
| 90 |
+
<input type="month" id="filterEnd" />
|
| 91 |
+
|
| 92 |
+
<button id="applyFilters">Apply</button>
|
| 93 |
+
<button id="clearFilters">Clear</button>
|
| 94 |
+
<button id="exportPdf">Export PDF</button>
|
| 95 |
+
</div>
|
| 96 |
+
|
| 97 |
+
<!-- Tabs -->
|
| 98 |
+
<nav id="accountingTabs" class="tab-nav">
|
| 99 |
+
<button data-tab="summary" class="active">Summary</button>
|
| 100 |
+
<button data-tab="pie">Income vs Expense</button>
|
| 101 |
+
<button data-tab="monthly">Monthly Breakdown</button>
|
| 102 |
+
<button data-tab="all">Show All</button>
|
| 103 |
+
</nav>
|
| 104 |
+
|
| 105 |
+
<!-- Summary View -->
|
| 106 |
+
<div id="view-summary" class="accounting-tab-view active">
|
| 107 |
+
<div class="card" id="accountingSummary">
|
| 108 |
+
<h3>Accounting Summary</h3>
|
| 109 |
+
<table>
|
| 110 |
+
<thead>
|
| 111 |
+
<tr><th>Category / Type</th><th>Total Amount</th></tr>
|
| 112 |
+
</thead>
|
| 113 |
+
<tbody id="summaryBody"></tbody>
|
| 114 |
+
</table>
|
| 115 |
+
</div>
|
| 116 |
+
</div>
|
| 117 |
+
|
| 118 |
+
<!-- Pie Chart View -->
|
| 119 |
+
<div id="view-pie" class="accounting-tab-view hidden">
|
| 120 |
+
<div class="chart-container">
|
| 121 |
+
<h3>Income vs Expenses</h3>
|
| 122 |
+
<canvas id="incomeExpenseChart"></canvas>
|
| 123 |
+
<div class="chart-legend">
|
| 124 |
+
<span><i class="legend-income"></i> Income</span>
|
| 125 |
+
<span><i class="legend-expense"></i> Expenses</span>
|
| 126 |
+
</div>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
|
| 130 |
+
<!-- Monthly Chart View -->
|
| 131 |
+
<div id="view-monthly" class="accounting-tab-view hidden">
|
| 132 |
+
<div class="card">
|
| 133 |
+
<h3>Monthly Income vs Expenses</h3>
|
| 134 |
+
<canvas id="monthlyChart" height="150"></canvas>
|
| 135 |
+
</div>
|
| 136 |
+
</div>
|
| 137 |
+
|
| 138 |
+
<!-- All Transactions -->
|
| 139 |
+
<h3>All Transactions</h3>
|
| 140 |
+
<table>
|
| 141 |
+
<thead>
|
| 142 |
+
<tr>
|
| 143 |
+
<th>#</th>
|
| 144 |
+
<th>Payer</th>
|
| 145 |
+
<th>Type</th>
|
| 146 |
+
<th>Month</th>
|
| 147 |
+
<th>Amount</th>
|
| 148 |
+
<th>Category</th>
|
| 149 |
+
<th>Description</th>
|
| 150 |
+
<th>Actions</th>
|
| 151 |
+
</tr>
|
| 152 |
+
</thead>
|
| 153 |
+
<tbody id="accountingBody"></tbody>
|
| 154 |
+
</table>
|
| 155 |
+
|
| 156 |
+
<button id="exportAccounting">Export JSON</button>
|
| 157 |
+
</section>
|
| 158 |
+
|
| 159 |
+
<!-- === Inventory Section === -->
|
| 160 |
+
<section id="inventory" class="admin-tab">
|
| 161 |
+
<h2>Inventory Management</h2>
|
| 162 |
+
<button id="toggleItemForm">Add Item</button>
|
| 163 |
+
|
| 164 |
+
<div id="itemFormContainer" class="form-container hidden">
|
| 165 |
+
<form id="itemForm">
|
| 166 |
+
<input type="text" id="itemName" placeholder="Item Name" required />
|
| 167 |
+
<input type="text" id="itemType" placeholder="Type/Category" />
|
| 168 |
+
<input type="text" id="itemColor" placeholder="Color/Style" />
|
| 169 |
+
<input type="number" id="itemQty" placeholder="Quantity" required />
|
| 170 |
+
<input type="number" id="itemPrice" placeholder="Price" step="0.01" />
|
| 171 |
+
<input type="text" id="itemNote" placeholder="Note" />
|
| 172 |
+
<button type="submit">Add Item</button>
|
| 173 |
+
</form>
|
| 174 |
+
</div>
|
| 175 |
+
|
| 176 |
+
<h3>Current Inventory</h3>
|
| 177 |
+
<table>
|
| 178 |
+
<thead>
|
| 179 |
+
<tr>
|
| 180 |
+
<th>ID</th><th>Name</th><th>Type</th><th>Color</th>
|
| 181 |
+
<th>Qty</th><th>Price</th><th>Note</th><th>Actions</th>
|
| 182 |
+
</tr>
|
| 183 |
+
</thead>
|
| 184 |
+
<tbody id="inventoryBody"></tbody>
|
| 185 |
+
</table>
|
| 186 |
+
<button id="exportInventory">Export JSON</button>
|
| 187 |
+
</section>
|
| 188 |
+
</main>
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
<!-- Transaction Modal -->
|
| 192 |
+
<div id="transactionModal" class="modal hidden">
|
| 193 |
+
<div class="modal-content">
|
| 194 |
+
<h3>Edit or Delete Transaction</h3>
|
| 195 |
+
<form id="editTransactionForm">
|
| 196 |
+
<input type="hidden" id="editTransactionId">
|
| 197 |
+
<label>Month: <input type="month" id="editTransactionMonth"></label><br>
|
| 198 |
+
<label>Amount: <input type="number" id="editTransactionAmount"></label><br>
|
| 199 |
+
<label>Category:
|
| 200 |
+
<select id="editTransactionCategory">
|
| 201 |
+
<option value="contribution">Contribution</option>
|
| 202 |
+
<option value="donation">Donation</option>
|
| 203 |
+
<option value="sale">Sale</option>
|
| 204 |
+
<option value="expense">Expense</option>
|
| 205 |
+
</select>
|
| 206 |
+
</label><br>
|
| 207 |
+
<label>Description: <input type="text" id="editTransactionDesc"></label><br>
|
| 208 |
+
<div class="modal-actions">
|
| 209 |
+
<button type="submit">Save</button>
|
| 210 |
+
<button type="button" onclick="deleteTransaction()">Delete</button>
|
| 211 |
+
<button type="button" onclick="closeModal()">Cancel</button>
|
| 212 |
+
</div>
|
| 213 |
+
</form>
|
| 214 |
+
</div>
|
| 215 |
+
</div>
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
<!-- Member Modal -->
|
| 219 |
+
<div id="memberModal" class="modal hidden">
|
| 220 |
+
<div class="modal-content">
|
| 221 |
+
<span id="closeModalBtn" class="close">×</span>
|
| 222 |
+
<h3>Edit Member</h3>
|
| 223 |
+
<form id="editMemberForm">
|
| 224 |
+
<input type="hidden" id="editMemberId">
|
| 225 |
+
|
| 226 |
+
<label>Name:</label>
|
| 227 |
+
<input type="text" id="editMemberName">
|
| 228 |
+
|
| 229 |
+
<label>Email:</label>
|
| 230 |
+
<input type="email" id="editMemberEmail">
|
| 231 |
+
|
| 232 |
+
<label>Phone:</label>
|
| 233 |
+
<input type="text" id="editMemberPhone">
|
| 234 |
+
|
| 235 |
+
<label>Address:</label>
|
| 236 |
+
<input type="text" id="editMemberAddress">
|
| 237 |
+
|
| 238 |
+
<div class="modal-actions">
|
| 239 |
+
<button type="submit">Save</button>
|
| 240 |
+
<button type="button" id="deleteMemberBtn">Delete</button>
|
| 241 |
+
<button type="button" id="cancelModalBtn">Cancel</button>
|
| 242 |
+
</div>
|
| 243 |
+
</form>
|
| 244 |
+
</div>
|
| 245 |
+
</div>
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
<!-- Inventory Modal -->
|
| 249 |
+
<div id="inventoryModal" style="display:none; position:fixed; top:10%; left:50%; transform:translateX(-50%); background:white; padding:20px; border:1px solid #ccc; z-index:1000;">
|
| 250 |
+
<h3>Inventory Action</h3>
|
| 251 |
+
<form id="actionForm">
|
| 252 |
+
<input type="hidden" name="id" />
|
| 253 |
+
<label>Name: <input name="name" disabled required /></label><br/>
|
| 254 |
+
<label>Type: <input name="type" disabled /></label><br/>
|
| 255 |
+
<label>Color: <input name="color" disabled /></label><br/>
|
| 256 |
+
<label>Quantity: <input name="quantity" type="number" disabled required /></label><br/>
|
| 257 |
+
<label>Price: <input name="price" type="number" step="0.01" disabled required /></label><br/>
|
| 258 |
+
<label>Note: <input name="note" disabled /></label><br/><br/>
|
| 259 |
+
|
| 260 |
+
<!-- Modal Buttons -->
|
| 261 |
+
<div id="modalButtons">
|
| 262 |
+
<button type="button" id="editBtn">Edit</button>
|
| 263 |
+
<button type="button" id="sellBtn">Sell</button>
|
| 264 |
+
<button type="button" id="useBtn">Use</button>
|
| 265 |
+
<button type="button" id="deleteBtn">Delete</button>
|
| 266 |
+
<button type="submit" id="saveBtn" style="display:none;">Save</button>
|
| 267 |
+
<button type="button" id="cancelBtn">Cancel</button>
|
| 268 |
+
</div>
|
| 269 |
+
</form>
|
| 270 |
+
</div>
|
| 271 |
+
|
| 272 |
+
<!-- Scripts -->
|
| 273 |
+
<script src="admin.js"></script>
|
| 274 |
+
<script src="chart.js"></script>
|
| 275 |
+
<script src="accounting.js"></script>
|
| 276 |
+
<script src="inventory.js"></script>
|
| 277 |
+
</body>
|
| 278 |
+
|
| 279 |
+
</html>
|
admin.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// =======================
|
| 2 |
+
// Load members from API and populate table
|
| 3 |
+
// =======================
|
| 4 |
+
async function loadMembers() {
|
| 5 |
+
try {
|
| 6 |
+
const res = await fetch('/api/members');
|
| 7 |
+
if (!res.ok) throw new Error('Failed to fetch members');
|
| 8 |
+
|
| 9 |
+
const members = await res.json();
|
| 10 |
+
const tbody = document.getElementById('membersBody');
|
| 11 |
+
tbody.innerHTML = members
|
| 12 |
+
.map(
|
| 13 |
+
(m) => `
|
| 14 |
+
<tr>
|
| 15 |
+
<td>${m.id || ''}</td>
|
| 16 |
+
<td>${m.name}</td>
|
| 17 |
+
<td>${m.address || ''}</td>
|
| 18 |
+
<td>${m.email}</td>
|
| 19 |
+
<td>${m.phone || ''}</td>
|
| 20 |
+
<td><button onclick="openMemberModal(${m.id})">Action</button></td>
|
| 21 |
+
</tr>`
|
| 22 |
+
)
|
| 23 |
+
.join('');
|
| 24 |
+
} catch (err) {
|
| 25 |
+
console.error(err);
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
// =======================
|
| 30 |
+
// Fetch and show the next available member ID
|
| 31 |
+
// =======================
|
| 32 |
+
async function previewNextId() {
|
| 33 |
+
try {
|
| 34 |
+
const res = await fetch('/api/members/next-id');
|
| 35 |
+
if (!res.ok) throw new Error('Failed to fetch next ID');
|
| 36 |
+
|
| 37 |
+
const data = await res.json();
|
| 38 |
+
const previewEl = document.getElementById('nextIdPreview');
|
| 39 |
+
if (previewEl) previewEl.textContent = data.nextId;
|
| 40 |
+
} catch (err) {
|
| 41 |
+
console.error(err);
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
// =======================
|
| 46 |
+
// Handle Add Member form submission
|
| 47 |
+
// =======================
|
| 48 |
+
document.getElementById('memberForm').addEventListener('submit', async (e) => {
|
| 49 |
+
e.preventDefault();
|
| 50 |
+
|
| 51 |
+
const newMember = {
|
| 52 |
+
name: document.getElementById('name').value.trim(),
|
| 53 |
+
address: document.getElementById('address').value.trim(),
|
| 54 |
+
email: document.getElementById('email').value.trim(),
|
| 55 |
+
phone: document.getElementById('phone').value.trim()
|
| 56 |
+
};
|
| 57 |
+
|
| 58 |
+
try {
|
| 59 |
+
const res = await fetch('/api/members', {
|
| 60 |
+
method: 'POST',
|
| 61 |
+
headers: { 'Content-Type': 'application/json' },
|
| 62 |
+
body: JSON.stringify(newMember)
|
| 63 |
+
});
|
| 64 |
+
|
| 65 |
+
if (!res.ok) throw new Error('Failed to add member');
|
| 66 |
+
|
| 67 |
+
document.getElementById('memberForm').reset();
|
| 68 |
+
await loadMembers();
|
| 69 |
+
await previewNextId();
|
| 70 |
+
} catch (err) {
|
| 71 |
+
console.error(err);
|
| 72 |
+
alert('Error saving member');
|
| 73 |
+
}
|
| 74 |
+
});
|
| 75 |
+
|
| 76 |
+
// =======================
|
| 77 |
+
// Export members as JSON by redirecting to API endpoint
|
| 78 |
+
// =======================
|
| 79 |
+
document.getElementById('exportMembers').addEventListener('click', () => {
|
| 80 |
+
window.location.href = '/api/members/export';
|
| 81 |
+
});
|
| 82 |
+
|
| 83 |
+
// =======================
|
| 84 |
+
// Initialize on page load
|
| 85 |
+
// =======================
|
| 86 |
+
window.addEventListener('DOMContentLoaded', () => {
|
| 87 |
+
loadMembers();
|
| 88 |
+
previewNextId();
|
| 89 |
+
});
|
| 90 |
+
|
| 91 |
+
// =======================
|
| 92 |
+
// Tabs (optional)
|
| 93 |
+
// =======================
|
| 94 |
+
// Admin main tab switching
|
| 95 |
+
document.querySelectorAll('.admin-tabs button').forEach(btn => {
|
| 96 |
+
btn.addEventListener('click', () => {
|
| 97 |
+
// Remove active class from all buttons and hide all tabs
|
| 98 |
+
document.querySelectorAll('.admin-tabs button').forEach(b => b.classList.remove('active'));
|
| 99 |
+
document.querySelectorAll('.admin-tab').forEach(tab => (tab.style.display = 'none'));
|
| 100 |
+
|
| 101 |
+
// Activate clicked button and show corresponding tab
|
| 102 |
+
btn.classList.add('active');
|
| 103 |
+
const tabId = btn.dataset.tab;
|
| 104 |
+
document.getElementById(tabId).style.display = 'block';
|
| 105 |
+
});
|
| 106 |
+
});
|
| 107 |
+
|
| 108 |
+
// Toggle visibility helper for forms with button label change
|
| 109 |
+
function setupToggle(buttonId, containerId, defaultLabel = "Add", closeLabel = "Close") {
|
| 110 |
+
const button = document.getElementById(buttonId);
|
| 111 |
+
const container = document.getElementById(containerId);
|
| 112 |
+
|
| 113 |
+
button.addEventListener('click', () => {
|
| 114 |
+
const isVisible = container.style.display === 'block';
|
| 115 |
+
container.style.display = isVisible ? 'none' : 'block';
|
| 116 |
+
button.textContent = isVisible ? defaultLabel : `${closeLabel} ${defaultLabel}`;
|
| 117 |
+
});
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
// Setup toggles for member, transaction, and item forms
|
| 121 |
+
setupToggle("toggleMemberForm", "memberFormContainer", "Add Member");
|
| 122 |
+
setupToggle("toggleTransactionForm", "transactionFormContainer", "Add Transaction");
|
| 123 |
+
setupToggle("toggleItemForm", "itemFormContainer", "Add Item");
|
| 124 |
+
|
| 125 |
+
// Accounting sub-tabs view toggle
|
| 126 |
+
document.querySelectorAll('#accountingTabs button').forEach(button => {
|
| 127 |
+
button.addEventListener('click', () => {
|
| 128 |
+
// Remove active class from all accounting tab buttons
|
| 129 |
+
document.querySelectorAll('#accountingTabs button').forEach(b => b.classList.remove('active'));
|
| 130 |
+
|
| 131 |
+
// Add active class to clicked button
|
| 132 |
+
button.classList.add('active');
|
| 133 |
+
|
| 134 |
+
const selected = button.dataset.tab;
|
| 135 |
+
|
| 136 |
+
// Hide all accounting views initially
|
| 137 |
+
document.querySelectorAll('.accounting-tab-view').forEach(view => {
|
| 138 |
+
view.style.display = 'none';
|
| 139 |
+
});
|
| 140 |
+
|
| 141 |
+
// Show all or a specific accounting view
|
| 142 |
+
if (selected === 'all') {
|
| 143 |
+
document.querySelectorAll('.accounting-tab-view').forEach(view => {
|
| 144 |
+
view.style.display = 'block';
|
| 145 |
+
});
|
| 146 |
+
} else {
|
| 147 |
+
const view = document.getElementById(`view-${selected}`);
|
| 148 |
+
if (view) view.style.display = 'block';
|
| 149 |
+
}
|
| 150 |
+
});
|
| 151 |
+
});
|
| 152 |
+
|
| 153 |
+
///////////////////////////////////////
|
| 154 |
+
///////////////////////////////////////////////
|
| 155 |
+
// ================= INVENTORY =================
|
| 156 |
+
|
| 157 |
+
let selectedMember = null;
|
| 158 |
+
|
| 159 |
+
window.openMemberModal = async function (id) {
|
| 160 |
+
const res = await fetch('/api/members');
|
| 161 |
+
const members = await res.json();
|
| 162 |
+
selectedMember = members.find(m => m.id === id);
|
| 163 |
+
|
| 164 |
+
if (!selectedMember) return alert('Member not found');
|
| 165 |
+
|
| 166 |
+
// Populate modal form
|
| 167 |
+
document.getElementById('editMemberId').value = selectedMember.id;
|
| 168 |
+
document.getElementById('editMemberName').value = selectedMember.name;
|
| 169 |
+
document.getElementById('editMemberEmail').value = selectedMember.email;
|
| 170 |
+
document.getElementById('editMemberPhone').value = selectedMember.phone || '';
|
| 171 |
+
document.getElementById('editMemberAddress').value = selectedMember.address || '';
|
| 172 |
+
|
| 173 |
+
// Show modal
|
| 174 |
+
document.getElementById('memberModal').classList.remove('hidden');
|
| 175 |
+
};
|
| 176 |
+
|
| 177 |
+
document.getElementById('closeModalBtn').addEventListener('click', () => {
|
| 178 |
+
document.getElementById('memberModal').classList.add('hidden');
|
| 179 |
+
});
|
| 180 |
+
|
| 181 |
+
document.getElementById('cancelModalBtn').addEventListener('click', () => {
|
| 182 |
+
document.getElementById('memberModal').classList.add('hidden');
|
| 183 |
+
});
|
| 184 |
+
|
| 185 |
+
// Save edited member
|
| 186 |
+
document.getElementById('editMemberForm').addEventListener('submit', async e => {
|
| 187 |
+
e.preventDefault();
|
| 188 |
+
|
| 189 |
+
const updated = {
|
| 190 |
+
name: document.getElementById('editMemberName').value,
|
| 191 |
+
email: document.getElementById('editMemberEmail').value,
|
| 192 |
+
phone: document.getElementById('editMemberPhone').value,
|
| 193 |
+
address: document.getElementById('editMemberAddress').value
|
| 194 |
+
};
|
| 195 |
+
|
| 196 |
+
const id = document.getElementById('editMemberId').value;
|
| 197 |
+
|
| 198 |
+
const res = await fetch(`/api/members/${id}`, {
|
| 199 |
+
method: 'PUT',
|
| 200 |
+
headers: { 'Content-Type': 'application/json' },
|
| 201 |
+
body: JSON.stringify(updated)
|
| 202 |
+
});
|
| 203 |
+
|
| 204 |
+
if (!res.ok) return alert('Failed to update member');
|
| 205 |
+
|
| 206 |
+
document.getElementById('memberModal').classList.add('hidden');
|
| 207 |
+
loadMembers();
|
| 208 |
+
});
|
| 209 |
+
|
| 210 |
+
// Delete member
|
| 211 |
+
document.getElementById('deleteMemberBtn').addEventListener('click', async () => {
|
| 212 |
+
if (!confirm('Are you sure you want to delete this member?')) return;
|
| 213 |
+
|
| 214 |
+
const id = document.getElementById('editMemberId').value;
|
| 215 |
+
|
| 216 |
+
const res = await fetch(`/api/members/${id}`, {
|
| 217 |
+
method: 'DELETE'
|
| 218 |
+
});
|
| 219 |
+
|
| 220 |
+
if (!res.ok) return alert('Failed to delete member');
|
| 221 |
+
|
| 222 |
+
document.getElementById('memberModal').classList.add('hidden');
|
| 223 |
+
loadMembers();
|
| 224 |
+
});
|
bhr.html
ADDED
|
@@ -0,0 +1,1051 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<title>Eritrean New Year & Feasts</title>
|
| 6 |
+
<style>
|
| 7 |
+
body {
|
| 8 |
+
margin: 0; padding: 0;
|
| 9 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 10 |
+
color: #222;
|
| 11 |
+
/* background: url('https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=1470&q=80') no-repeat center center fixed;
|
| 12 |
+
background-size: cover;
|
| 13 |
+
min-height: 100vh; */
|
| 14 |
+
display: flex;
|
| 15 |
+
justify-content: center;
|
| 16 |
+
padding: 30px 10px;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
#headcon {
|
| 20 |
+
display: flex;
|
| 21 |
+
flex-direction: column;
|
| 22 |
+
align-items: center;
|
| 23 |
+
background: linear-gradient(135deg, #f7f0f0, #fff7f7);
|
| 24 |
+
border: 3px solid #ba1c1c;
|
| 25 |
+
border-radius: 12px;
|
| 26 |
+
padding: 1rem 2rem;
|
| 27 |
+
margin-bottom: 2rem;
|
| 28 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
| 29 |
+
text-align: center;
|
| 30 |
+
position: relative;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
#headcon h1 {
|
| 34 |
+
font-size: 2.2rem;
|
| 35 |
+
font-weight: bold;
|
| 36 |
+
color: #ba1c1c;
|
| 37 |
+
margin: 1rem 0;
|
| 38 |
+
text-shadow: 1px 1px 0 #f8dddd;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
.header-img {
|
| 42 |
+
width: 80px;
|
| 43 |
+
height: 80px;
|
| 44 |
+
object-fit: cover;
|
| 45 |
+
border-radius: 50%;
|
| 46 |
+
border: 3px solid #ba1c1c;
|
| 47 |
+
background: white;
|
| 48 |
+
box-shadow: 0 0 10px rgba(186, 28, 28, 0.3);
|
| 49 |
+
margin: 0.5rem;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
@media screen and (min-width: 600px) {
|
| 53 |
+
#headcon {
|
| 54 |
+
flex-direction: row;
|
| 55 |
+
justify-content: center;
|
| 56 |
+
gap: 1.5rem;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
#headcon h1 {
|
| 60 |
+
margin: 0;
|
| 61 |
+
font-size: 2.5rem;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.header-img {
|
| 65 |
+
width: 90px;
|
| 66 |
+
height: 90px;
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
h1, h2 {
|
| 71 |
+
text-align: center;
|
| 72 |
+
color: #ba1c1c;
|
| 73 |
+
text-shadow: 1px 1px 3px rgba(0,0,0,0.15);
|
| 74 |
+
margin-bottom: 0.5rem;
|
| 75 |
+
}
|
| 76 |
+
h1 { font-size: 2.8rem; font-weight: 700; }
|
| 77 |
+
h2 { font-size: 2rem; font-weight: 600; margin-top: 2rem; }
|
| 78 |
+
|
| 79 |
+
.controls {
|
| 80 |
+
display: flex;
|
| 81 |
+
flex-wrap: wrap;
|
| 82 |
+
align-items: center;
|
| 83 |
+
justify-content: center;
|
| 84 |
+
gap: 1rem;
|
| 85 |
+
margin-bottom: 2rem;
|
| 86 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
.controls label {
|
| 90 |
+
font-weight: 600;
|
| 91 |
+
font-size: 1.2rem;
|
| 92 |
+
color: #ba1c1c;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
.controls input[type="number"] {
|
| 96 |
+
width: 100px;
|
| 97 |
+
padding: 8px 12px;
|
| 98 |
+
font-size: 1.1rem;
|
| 99 |
+
border: 2px solid #ba1c1c;
|
| 100 |
+
border-radius: 10px;
|
| 101 |
+
outline-offset: 2px;
|
| 102 |
+
transition: border-color 0.3s ease, box-shadow 0.3s ease;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
.controls input[type="number"]:focus {
|
| 106 |
+
border-color: #e03e3e;
|
| 107 |
+
box-shadow: 0 0 8px #e03e3e;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.controls button {
|
| 111 |
+
padding: 10px 20px;
|
| 112 |
+
font-size: 1.1rem;
|
| 113 |
+
font-weight: 700;
|
| 114 |
+
color: white;
|
| 115 |
+
background: linear-gradient(135deg, #ba1c1c, #e03e3e);
|
| 116 |
+
border: none;
|
| 117 |
+
border-radius: 12px;
|
| 118 |
+
cursor: pointer;
|
| 119 |
+
box-shadow: 0 4px 8px rgba(186, 28, 28, 0.4);
|
| 120 |
+
transition: background 0.3s ease, transform 0.2s ease;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
.controls button:hover {
|
| 124 |
+
background: linear-gradient(135deg, #e03e3e, #ba1c1c);
|
| 125 |
+
transform: scale(1.05);
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.controls button:active {
|
| 129 |
+
transform: scale(0.95);
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
table {
|
| 134 |
+
width: 100%;
|
| 135 |
+
border-collapse: collapse;
|
| 136 |
+
margin-bottom: 2rem;
|
| 137 |
+
font-size: 1.1rem;
|
| 138 |
+
}
|
| 139 |
+
th, td {
|
| 140 |
+
border: 1px solid #ba1c1c;
|
| 141 |
+
padding: 10px 15px;
|
| 142 |
+
text-align: left;
|
| 143 |
+
}
|
| 144 |
+
th {
|
| 145 |
+
background-color: #ba1c1c;
|
| 146 |
+
color: white;
|
| 147 |
+
font-weight: 600;
|
| 148 |
+
text-transform: uppercase;
|
| 149 |
+
letter-spacing: 0.05em;
|
| 150 |
+
}
|
| 151 |
+
tbody tr:nth-child(even) {
|
| 152 |
+
background-color: #f9f0f0;
|
| 153 |
+
}
|
| 154 |
+
caption {
|
| 155 |
+
caption-side: top;
|
| 156 |
+
text-align: center;
|
| 157 |
+
font-size: 1.6rem;
|
| 158 |
+
font-weight: 600;
|
| 159 |
+
margin-bottom: 1rem;
|
| 160 |
+
color: #8b0000;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
/* Calendar styling */
|
| 164 |
+
.month-grid {
|
| 165 |
+
display: grid;
|
| 166 |
+
grid-template-columns: repeat(7, 1fr);
|
| 167 |
+
gap: 4px;
|
| 168 |
+
margin-bottom: 3rem;
|
| 169 |
+
}
|
| 170 |
+
.month-name {
|
| 171 |
+
grid-column: span 7;
|
| 172 |
+
font-weight: 700;
|
| 173 |
+
font-size: 1.5rem;
|
| 174 |
+
text-align: center;
|
| 175 |
+
margin-bottom: 8px;
|
| 176 |
+
color: #ba1c1c;
|
| 177 |
+
}
|
| 178 |
+
.day-header, .date-cell {
|
| 179 |
+
text-align: center;
|
| 180 |
+
font-weight: 600;
|
| 181 |
+
padding: 6px 4px;
|
| 182 |
+
font-size: 0.9rem;
|
| 183 |
+
}
|
| 184 |
+
.day-header {
|
| 185 |
+
background-color: #ba1c1c;
|
| 186 |
+
color: white;
|
| 187 |
+
}
|
| 188 |
+
.date-cell {
|
| 189 |
+
background: #fff;
|
| 190 |
+
border: 1px solid #ba1c1c;
|
| 191 |
+
border-radius: 5px;
|
| 192 |
+
min-height: 60px;
|
| 193 |
+
display: flex;
|
| 194 |
+
flex-direction: column;
|
| 195 |
+
justify-content: center;
|
| 196 |
+
font-weight: 500;
|
| 197 |
+
position: relative;
|
| 198 |
+
}
|
| 199 |
+
.eth-date {
|
| 200 |
+
font-size: 1.2rem;
|
| 201 |
+
font-weight: 700;
|
| 202 |
+
color: #ba1c1c;
|
| 203 |
+
}
|
| 204 |
+
.greg-date {
|
| 205 |
+
font-size: 0.75rem;
|
| 206 |
+
color: #555;
|
| 207 |
+
margin-top: 4px;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
footer {
|
| 211 |
+
text-align: center;
|
| 212 |
+
font-size: 0.9rem;
|
| 213 |
+
color: #444;
|
| 214 |
+
margin-top: 10px;
|
| 215 |
+
font-style: italic;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
@media (max-width: 720px) {
|
| 219 |
+
.container {
|
| 220 |
+
padding: 20px;
|
| 221 |
+
max-width: 100%;
|
| 222 |
+
}
|
| 223 |
+
h1 { font-size: 2rem; }
|
| 224 |
+
h2 { font-size: 1.5rem; }
|
| 225 |
+
table {
|
| 226 |
+
font-size: 0.9rem;
|
| 227 |
+
}
|
| 228 |
+
.date-cell {
|
| 229 |
+
min-height: 50px;
|
| 230 |
+
font-size: 0.85rem;
|
| 231 |
+
}
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
@media print {
|
| 235 |
+
body {
|
| 236 |
+
-webkit-print-color-adjust: exact !important;
|
| 237 |
+
print-color-adjust: exact !important;
|
| 238 |
+
background: white !important;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
.container {
|
| 242 |
+
background: white !important;
|
| 243 |
+
color: black !important;
|
| 244 |
+
box-shadow: none !important;
|
| 245 |
+
border: none !important;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
th {
|
| 249 |
+
background-color: #ba1c1c !important;
|
| 250 |
+
color: white !important;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
.day-header {
|
| 254 |
+
background-color: #ba1c1c !important;
|
| 255 |
+
color: white !important;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
.date-cell {
|
| 259 |
+
border: 1px solid #ba1c1c !important;
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
select, button, footer {
|
| 263 |
+
display: none !important;
|
| 264 |
+
}
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
.hidden {
|
| 268 |
+
display: none;
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
#customHolidaySection {
|
| 272 |
+
background-color: #fff7e6;
|
| 273 |
+
padding: 1.5rem;
|
| 274 |
+
margin-top: 2rem;
|
| 275 |
+
border: 2px dashed #ba1c1c;
|
| 276 |
+
border-radius: 10px;
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
#customHolidayForm {
|
| 280 |
+
display: flex;
|
| 281 |
+
flex-direction: column;
|
| 282 |
+
gap: 1rem;
|
| 283 |
+
margin-bottom: 1rem;
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
.custom-btn {
|
| 287 |
+
background-color: #ba1c1c;
|
| 288 |
+
color: white;
|
| 289 |
+
padding: 10px 15px;
|
| 290 |
+
font-size: 1.1rem;
|
| 291 |
+
border: none;
|
| 292 |
+
border-radius: 6px;
|
| 293 |
+
cursor: pointer;
|
| 294 |
+
margin-top: 1rem;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
</style>
|
| 299 |
+
</head>
|
| 300 |
+
<body>
|
| 301 |
+
|
| 302 |
+
<div class="container">
|
| 303 |
+
<button><a href="https://www.blacklioncarrents.com/">back home</a></button>
|
| 304 |
+
<header>
|
| 305 |
+
</header>
|
| 306 |
+
|
| 307 |
+
<div id="headcon">
|
| 308 |
+
<img src="https://i.pinimg.com/736x/55/c3/10/55c310adca255f4aaa3c0fe42f2352a3.jpg" alt="Celebration icon" class="header-img">
|
| 309 |
+
<h1>Happy Eritrean New Year (Kudus Yohannes)</h1>
|
| 310 |
+
<p id="zemeneText">Welcome!</p>
|
| 311 |
+
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT0DSSxnr990Od7vwChi8zT3NhnsB5rhpyTXQ&s" alt="Celebration icon" class="header-img">
|
| 312 |
+
</div>
|
| 313 |
+
|
| 314 |
+
<section class="controls">
|
| 315 |
+
<label for="year">E.C. Year:</label>
|
| 316 |
+
<input type="number" id="year" value="2018" />
|
| 317 |
+
<button id="calc">Calculate Feasts</button>
|
| 318 |
+
<button id="printBtn">🖨️ Print</button>
|
| 319 |
+
<!-- Custom Holiday Toggle Button -->
|
| 320 |
+
<button id="toggleCustomHolidayBtn" class="custom-btn">➕ Add Custom Holiday</button>
|
| 321 |
+
</section>
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
<!-- Hidden Section -->
|
| 325 |
+
<div id="customHolidaySection" class="hidden">
|
| 326 |
+
<h2>Add Your Custom Holiday</h2>
|
| 327 |
+
<form id="customHolidayForm">
|
| 328 |
+
<label for="customName">Holiday Name:</label>
|
| 329 |
+
<input type="text" id="customName" required>
|
| 330 |
+
|
| 331 |
+
<label for="customMonth">Month (0–12):</label>
|
| 332 |
+
<input type="number" id="customMonth" min="0" max="12" required>
|
| 333 |
+
|
| 334 |
+
<label for="customDay">Day:</label>
|
| 335 |
+
<input type="number" id="customDay" min="1" max="30" required>
|
| 336 |
+
|
| 337 |
+
<button type="submit">Add</button>
|
| 338 |
+
<button type="button" onclick="window.print()">🖨️ Print Only This</button>
|
| 339 |
+
</form>
|
| 340 |
+
|
| 341 |
+
<div id="customHolidayList"></div>
|
| 342 |
+
</div>
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
<section class="tables">
|
| 346 |
+
<h2>Bahre Hasab Core Values</h2>
|
| 347 |
+
<table>
|
| 348 |
+
<tbody id="coreBody"></tbody>
|
| 349 |
+
</table>
|
| 350 |
+
|
| 351 |
+
<h2>መጥቅዕ + ለውሳከ ዕለት Metke Weekday Assignment</h2>
|
| 352 |
+
<table>
|
| 353 |
+
<thead><tr><th>Weekday</th><th>Assigned</th><th>Mebaja</th></tr></thead>
|
| 354 |
+
<tbody id="weekdayBody"></tbody>
|
| 355 |
+
</table>
|
| 356 |
+
|
| 357 |
+
<h2>በዓላትን ኣጽዋማትን ዝውዕልሉ መዓልቲ Feasts (Bahre Hasab Sequence)</h2>
|
| 358 |
+
<table>
|
| 359 |
+
<thead>
|
| 360 |
+
<tr><th>#</th><th>Feast</th><th>Offset</th><th>E.C. Date</th><th>G.C. Date</th></tr>
|
| 361 |
+
</thead>
|
| 362 |
+
<tbody id="feastBody"></tbody>
|
| 363 |
+
</table>
|
| 364 |
+
|
| 365 |
+
<section class="fixed-holidays">
|
| 366 |
+
|
| 367 |
+
<h2> ዓመታዊ በዓላት Fixed Holidays</h2>
|
| 368 |
+
<table>
|
| 369 |
+
<thead>
|
| 370 |
+
<tr>
|
| 371 |
+
<th>#</th>
|
| 372 |
+
<th>Holiday</th>
|
| 373 |
+
<th>EC Date</th>
|
| 374 |
+
<th>Gregorian Date</th>
|
| 375 |
+
<th>Day of Week</th>
|
| 376 |
+
</tr>
|
| 377 |
+
</thead>
|
| 378 |
+
<tbody id="fixedHolidayBody"></tbody>
|
| 379 |
+
</table>
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
<h2>ዓበይቲ ናይ ጎይታ በዓላት Great Holidays</h2>
|
| 383 |
+
<table>
|
| 384 |
+
<thead>
|
| 385 |
+
<tr>
|
| 386 |
+
<th>#</th>
|
| 387 |
+
<th>Holiday</th>
|
| 388 |
+
<th>EC Date</th>
|
| 389 |
+
<th>Gregorian Date</th>
|
| 390 |
+
<th>Day of Week</th>
|
| 391 |
+
</tr>
|
| 392 |
+
</thead>
|
| 393 |
+
<tbody id="greatHolidayBody"></tbody>
|
| 394 |
+
</table>
|
| 395 |
+
|
| 396 |
+
<h2>ንኣሽቱ ናይ ጎይታ በዓላት mall Holidays</h2>
|
| 397 |
+
<table>
|
| 398 |
+
<thead>
|
| 399 |
+
<tr>
|
| 400 |
+
<th>#</th>
|
| 401 |
+
<th>Holiday</th>
|
| 402 |
+
<th>EC Date</th>
|
| 403 |
+
<th>Gregorian Date</th>
|
| 404 |
+
<th>Day of Week</th>
|
| 405 |
+
</tr>
|
| 406 |
+
</thead>
|
| 407 |
+
<tbody id="smallHolidayBody"></tbody>
|
| 408 |
+
</table>
|
| 409 |
+
|
| 410 |
+
<h2> ናይ ቅድስት ድንግል ማርያም በዓላት St. Mary Holidays</h2>
|
| 411 |
+
<table>
|
| 412 |
+
<thead>
|
| 413 |
+
<tr>
|
| 414 |
+
<th>#</th>
|
| 415 |
+
<th>Holiday</th>
|
| 416 |
+
<th>EC Date</th>
|
| 417 |
+
<th>Gregorian Date</th>
|
| 418 |
+
<th>Day of Week</th>
|
| 419 |
+
</tr>
|
| 420 |
+
</thead>
|
| 421 |
+
<tbody id="stMaryHolidayBody"></tbody>
|
| 422 |
+
</table>
|
| 423 |
+
|
| 424 |
+
<h2> ናይ ቅድስት ድንግል ማርያም በዓላት St. Mary Holidays</h2>
|
| 425 |
+
<table>
|
| 426 |
+
<thead>
|
| 427 |
+
<tr>
|
| 428 |
+
<th>#</th>
|
| 429 |
+
<th>Holiday</th>
|
| 430 |
+
<th>EC Date</th>
|
| 431 |
+
<th>Gregorian Date</th>
|
| 432 |
+
<th>Day of Week</th>
|
| 433 |
+
</tr>
|
| 434 |
+
</thead>
|
| 435 |
+
<tbody id="StSaints1HolidayBody"></tbody>
|
| 436 |
+
</table>
|
| 437 |
+
|
| 438 |
+
<h2> ናይ ቅድስት ድንግል ማርያም በዓላት St. Mary Holidays</h2>
|
| 439 |
+
<table>
|
| 440 |
+
<thead>
|
| 441 |
+
<tr>
|
| 442 |
+
<th>#</th>
|
| 443 |
+
<th>Holiday</th>
|
| 444 |
+
<th>EC Date</th>
|
| 445 |
+
<th>Gregorian Date</th>
|
| 446 |
+
<th>Day of Week</th>
|
| 447 |
+
</tr>
|
| 448 |
+
</thead>
|
| 449 |
+
<tbody id="stSaints2HolidayBody"></tbody>
|
| 450 |
+
</table> <h2> ናይ ቅድስት ድንግል ማርያም በዓላት St. Mary Holidays</h2>
|
| 451 |
+
<table>
|
| 452 |
+
<thead>
|
| 453 |
+
<tr>
|
| 454 |
+
<th>#</th>
|
| 455 |
+
<th>Holiday</th>
|
| 456 |
+
<th>EC Date</th>
|
| 457 |
+
<th>Gregorian Date</th>
|
| 458 |
+
<th>Day of Week</th>
|
| 459 |
+
</tr>
|
| 460 |
+
</thead>
|
| 461 |
+
<tbody id="BirthFeastsHolidayBody"></tbody>
|
| 462 |
+
</table>
|
| 463 |
+
|
| 464 |
+
</section>
|
| 465 |
+
|
| 466 |
+
</section>
|
| 467 |
+
|
| 468 |
+
|
| 469 |
+
<footer>
|
| 470 |
+
<p> <img src="hadshamet.jpg" alt="hadshamet" width="30" /> Made with ❤️ for Eritrean Heritage</p>
|
| 471 |
+
</footer>
|
| 472 |
+
</div>
|
| 473 |
+
|
| 474 |
+
<script>
|
| 475 |
+
(function () {
|
| 476 |
+
// ===================== CONSTANTS =====================
|
| 477 |
+
const MONTHS = [
|
| 478 |
+
"Meskerem", "Tikimt", "Hidar", "Tahsas",
|
| 479 |
+
"Tir", "Yekatit", "Megabit", "Miyazya",
|
| 480 |
+
"Genbot", "Sene", "Hamle", "Nehasse", "Pagumien"
|
| 481 |
+
];
|
| 482 |
+
|
| 483 |
+
const ASSIGNED_BY_JS_DAY = { 6: 8, 0: 7, 1: 6, 2: 5, 3: 4, 4: 3, 5: 2 };
|
| 484 |
+
const JS_DAY_NAME = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
| 485 |
+
|
| 486 |
+
const FEAST_GAPS = [
|
| 487 |
+
{ name: " ነነዌ Nenewie", gap: 0, category: "" },
|
| 488 |
+
{ name: "ዓብይ ጾም Abiy Tsom", gap: 14, category: "" },
|
| 489 |
+
{ name: "ደብረ ዘይት Debre Zeyt", gap: 27, category: "small" },
|
| 490 |
+
{ name: "ሆሣዕና Hosaena (Palm Sunday)", gap: 21, category: "great" },
|
| 491 |
+
{ name: "ዓርቢ ስቅለት Good Friday", gap: 5, category: "great" },
|
| 492 |
+
{ name: "ትንሳኤ Fasika", gap: 2, category: "great" },
|
| 493 |
+
{ name: "ርክበ ካህናትPriests’ Meeting", gap: 24, category: "" },
|
| 494 |
+
{ name: "ዕርገት Erget", gap: 15, category: "great" },
|
| 495 |
+
{ name: "በዓለ መንፈስ ቅዱስ Pentecost", gap: 10, category: "great" },
|
| 496 |
+
{ name: "ጾመ ሰነ Tsome Sene", gap: 1, category: "" },
|
| 497 |
+
{ name: "ጾመ ድህነት Mhlela Dihnet", gap: 2, category: "" }
|
| 498 |
+
];
|
| 499 |
+
|
| 500 |
+
// Fixed holidays example - you can extend this list
|
| 501 |
+
const HOLIDAY_GROUPS = {
|
| 502 |
+
fixed: [
|
| 503 |
+
{ name: "ቅ, ዮውሃንስ St. John (Eritrean New Year)", month: 0, day: 1 },
|
| 504 |
+
{ name: "መስቀል Meskel", month: 0, day: 17 },
|
| 505 |
+
{ name: " ቅ Mኢካኤል St. Archangel Michael", month: 2, day: 12 }
|
| 506 |
+
|
| 507 |
+
],
|
| 508 |
+
great: [
|
| 509 |
+
{ name: " ልደት Lideta (Nativity)", month: 3, day: 29 },
|
| 510 |
+
{ name: "ጥምቀት Timket (Epiphany)", month: 4, day: 11 },
|
| 511 |
+
{ name: "ትስብእት Tsbiet (Incarnation)", month:6,day:29},
|
| 512 |
+
{ name: "ሆሳዕና Hosaena (Palm Sunday)", movable: "ሆሣዕና Hosaena (Palm Sunday)" },
|
| 513 |
+
{ name: "ዓርቢ ስቅለት Sklet (Good Friday)", movable: "ዓርቢ ስቅለት Good Friday" },
|
| 514 |
+
{ name: " ትንሳኤ Fasika", movable: "ትንሳኤ Fasika" },
|
| 515 |
+
{ name: "ዕርገት Erget (Ascension)", movable: "ዕርገት Erget" },
|
| 516 |
+
{ name: "በዓለ መንፈስ ቅዱስ Pentecost", movable: "በዓለ መንፈስ ቅዱስ Pentecost" },
|
| 517 |
+
{ name: "ደብረ ታቦር", month: 11, day: 13 } // fixed fallback
|
| 518 |
+
],
|
| 519 |
+
small: [
|
| 520 |
+
{ name: " ግዝረት Gzret", month: 4, day: 6 },
|
| 521 |
+
{ name: "ቃና ዘገሊላ Kana zegelila", month: 4, day: 12 },
|
| 522 |
+
{ name: "ባዓለ ስምኦን ኣረጋዊ Beale Simon", month: 5, day: 8 },
|
| 523 |
+
{ name: "ደብረ ዘይት Debre Zeyt", movable: "ደብረ ዘይት Debre Zeyt"},
|
| 524 |
+
{ name: "መስቀል Meskel", month: 0, day: 17 },
|
| 525 |
+
{ name: "መስቀል Meskel", month: 6, day: 10 }
|
| 526 |
+
],
|
| 527 |
+
stMary: [
|
| 528 |
+
{ name: "ባዓታ Beata", month: 3, day: 3 },
|
| 529 |
+
{ name: "ዐስተርእዮ Astereyo", month: 4, day: 21 },
|
| 530 |
+
{ name: "ለደታ Ldeta", month: 8, day: 1 },
|
| 531 |
+
{ name: "ቅዳሴ ቤታ Kdasie Bieta", month: 9, day: 20 }
|
| 532 |
+
],
|
| 533 |
+
stSaints1: [
|
| 534 |
+
{ name: "ኪዳነ ምሕረት Kidane Mihret", month: 5, day: 16 },
|
| 535 |
+
{ name: "ኪዳነ እግዚአብሔር Kidane Egziabher", month: 2, day: 2 },
|
| 536 |
+
{ name: "እንተአ መርዓዊ Ente’a Merawi", month: 4, day: 4 },
|
| 537 |
+
{ name: "ኪዳነ ጸጋ ማርያም Kidane Tsega Mariam", month: 5, day: 5 },
|
| 538 |
+
{ name: "ኪዳነ እምነት Kidane Emenet", month: 14, day: 14 },
|
| 539 |
+
{ name: "ቅዱስ ኪዳነ ጊዮርጊስ Kidane Giorgis", month: 20, day: 20 },
|
| 540 |
+
{ name: "ኪዳነ ብርሃን Kidane Birhan", month: 25, day: 25 },
|
| 541 |
+
{ name: "ቅዱስ ዮሐንስ Kidane Yohannes", month: 7, day: 23 },
|
| 542 |
+
{ name: "ጊዮርጊስ ኪዳነ ምሕረት Giorgis Kidane Mihret", month: 9, day: 9 },
|
| 543 |
+
{ name: "ቅዱስ ሚካኤል Kidane Mikael", month: 15, day: 15 },
|
| 544 |
+
{ name: "ነገሥት ኪዳነ ምሕረት Negest Kidane Mihret", month: 25, day: 25 },
|
| 545 |
+
{ name: "ኪዳነ ከፍርሂ Kidane Kefrihi", month: 29, day: 6 },
|
| 546 |
+
{ name: "ኪዳነ አቡነ ሕዝቅያስ Kidane Abune Hizqiyas", month: 12, day: 12 },
|
| 547 |
+
{ name: "ቅዱስ እስጢፋኖስ Kidane Estifanos", month: 22, day: 22 },
|
| 548 |
+
{ name: "ኪዳነ ጴጥሮስ Kidane Petros", month: 24, day: 24 },
|
| 549 |
+
{ name: "ኪዳነ በአብ Kidane Be’ab", month: 25, day: 25 },
|
| 550 |
+
{ name: "ቅዱስ ማርቆስ Kidane Markos", month: 3, day: 3 },
|
| 551 |
+
{ name: "ኪዳነ ስምኦን Kidane Simon", month: 6, day: 6 },
|
| 552 |
+
{ name: "ቅዱስ ያሬድ Kidane Yared", month: 15, day: 19 },
|
| 553 |
+
{ name: "ኪዳነ አቡነ አንበሳ Kidane Abune Anbesa", month: 1, day: 1 },
|
| 554 |
+
{ name: "ቅዱስ ጊዮርጊስ Kidane Giorgis", month: 13, day: 13 },
|
| 555 |
+
{ name: "ኪዳነ ማርያም Kidane Mariam", month: 7, day: 7 }
|
| 556 |
+
],
|
| 557 |
+
BirthFeasts: [
|
| 558 |
+
{ name: "ድርሳ ቅዱስ Dirsa Kidus", month: 15, day: 15 },
|
| 559 |
+
{ name: "ድርሳ ማርያም Dirsa Mariam", month: 25, day: 25 },
|
| 560 |
+
{ name: "ጊዮርጊስ Giorgis", month: 9, day: 9 },
|
| 561 |
+
{ name: "ድርሳ ሲኖዶስ Dirsa Sinodos", month: 24, day: 24 },
|
| 562 |
+
{ name: "ድርሳ ቅዱስ Dirsa Kidus", month: 26, day: 26 },
|
| 563 |
+
{ name: "ድርሳ ፍላጤ Dirsa Filate", month: 1, day: 1 },
|
| 564 |
+
{ name: "ድርሳ ማርያም Dirsa Mariam", month: 5, day: 5 }
|
| 565 |
+
],
|
| 566 |
+
|
| 567 |
+
stSaints2: [
|
| 568 |
+
{ name: "በርትልሜዎስ Bertelmeos", month: 1, day: 1 },
|
| 569 |
+
{ name: "ማቴዎስ Mateos", month: 12, day: 12 },
|
| 570 |
+
{ name: "አቡነ ሕዝቅኤል Abune Hizqiel", month: 17, day: 17 },
|
| 571 |
+
{ name: "ለቲቆ Letiko", month: 22, day: 22 },
|
| 572 |
+
{ name: "ደሚስክስ Demiskis", month: 18, day: 18 },
|
| 573 |
+
{ name: "ቅርማኖስ Kermanos", month: 29, day: 29 },
|
| 574 |
+
{ name: "ዮሐንስ ወልድ ዘቀዳማዊ Yohannes Weld Zeqedamawi", month: 4, day: 4 },
|
| 575 |
+
{ name: "ዮሐንስ ወልድ ኪዳነ ምሕረት Yohannes Weld Kidane Mihret", month: 10, day: 10 },
|
| 576 |
+
{ name: "ማቴዎስ Mateos", month: 8, day: 8 },
|
| 577 |
+
{ name: "ዮሐንስ ወልድ ኪዳነ ብርሃን Yohannes Weld Kidane Birhan", month: 17, day: 17 },
|
| 578 |
+
{ name: "ማርቆስ Markos", month: 26, day: 26 },
|
| 579 |
+
{ name: "ሐና Hanna", month: 2, day: 2 },
|
| 580 |
+
{ name: "ፍላጤ ወልድ አናስዮስ Filate Weld Anasios", month: 5, day: 5 },
|
| 581 |
+
{ name: "ጴጥሮስ Petros", month: 10, day: 10 },
|
| 582 |
+
{ name: "አቡነ አርጎስ እንደር Abune Argos Ender", month: 18, day: 18 },
|
| 583 |
+
{ name: "አንድርያስ Andreas", month: 30, day: 30 },
|
| 584 |
+
{ name: "ኪዳነ ምሕረት Kidane Mihret", month: 4, day: 4 }
|
| 585 |
+
]
|
| 586 |
+
|
| 587 |
+
|
| 588 |
+
};
|
| 589 |
+
|
| 590 |
+
// ===================== DOM Elements =====================
|
| 591 |
+
const els = {
|
| 592 |
+
year: document.getElementById("year"),
|
| 593 |
+
coreBody: document.getElementById("coreBody"),
|
| 594 |
+
weekdayBody: document.getElementById("weekdayBody"),
|
| 595 |
+
feastBody: document.getElementById("feastBody"),
|
| 596 |
+
calcBtn: document.getElementById("calc"),
|
| 597 |
+
fixedHolidayBody: document.getElementById("fixedHolidayBody"),
|
| 598 |
+
printBtn: document.getElementById("printBtn")
|
| 599 |
+
};
|
| 600 |
+
|
| 601 |
+
// ===================== UTILITIES =====================
|
| 602 |
+
const mod = (n, m) => ((n % m) + m) % m;
|
| 603 |
+
|
| 604 |
+
function isGregorianLeap(y) {
|
| 605 |
+
return (y % 4 === 0) && (y % 100 !== 0 || y % 400 === 0);
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
function meskerem1DateUTC(ecYear) {
|
| 609 |
+
const gYear = ecYear + 7;
|
| 610 |
+
const day = isGregorianLeap(gYear + 1) ? 12 : 11;
|
| 611 |
+
return new Date(Date.UTC(gYear, 8, day));
|
| 612 |
+
}
|
| 613 |
+
|
| 614 |
+
function ecMonthLen(mIdx, ecYear) {
|
| 615 |
+
if (mIdx === 12) {
|
| 616 |
+
if (ecYear % 128 === 0) return 7;
|
| 617 |
+
if (ecYear % 4 === 3) return 6;
|
| 618 |
+
return 5;
|
| 619 |
+
}
|
| 620 |
+
return 30;
|
| 621 |
+
}
|
| 622 |
+
|
| 623 |
+
function ecToGregorianISO(ecYear, monthIdx, day) {
|
| 624 |
+
const base = meskerem1DateUTC(ecYear);
|
| 625 |
+
let offset = 0;
|
| 626 |
+
for (let m = 0; m < monthIdx; m++) offset += ecMonthLen(m, ecYear);
|
| 627 |
+
offset += day - 1;
|
| 628 |
+
const d = new Date(base.getTime());
|
| 629 |
+
d.setUTCDate(d.getUTCDate() + offset);
|
| 630 |
+
return d.toISOString().slice(0, 10);
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
function addDaysEC(ecYear, monthIdx, day, add) {
|
| 634 |
+
let y = ecYear, m = monthIdx, d = day;
|
| 635 |
+
let left = add;
|
| 636 |
+
while (left > 0) {
|
| 637 |
+
const len = ecMonthLen(m, y);
|
| 638 |
+
const remaining = len - d;
|
| 639 |
+
if (left <= remaining) {
|
| 640 |
+
d += left;
|
| 641 |
+
left = 0;
|
| 642 |
+
} else {
|
| 643 |
+
left -= (remaining + 1);
|
| 644 |
+
d = 1;
|
| 645 |
+
m++;
|
| 646 |
+
if (m > 12) {
|
| 647 |
+
m = 0; y++;
|
| 648 |
+
}
|
| 649 |
+
}
|
| 650 |
+
}
|
| 651 |
+
return { ecYear: y, monthIdx: m, day: d };
|
| 652 |
+
}
|
| 653 |
+
|
| 654 |
+
// ===================== BAHRE HASAB CORE CALCULATION =====================
|
| 655 |
+
function coreCalc(ecYear) {
|
| 656 |
+
const amete = 5500 + ecYear;
|
| 657 |
+
const remainder1 = mod(amete, 532);
|
| 658 |
+
const menber = mod(remainder1, 19);
|
| 659 |
+
const abektie = mod((menber - 1) * 11, 30);
|
| 660 |
+
const metke = 30 - abektie;
|
| 661 |
+
return { amete, remainder1, menber, abektie, metke };
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
function computeNenewie(ecYear, metke) {
|
| 665 |
+
const metkeMonthIdx = (metke >= 15) ? 0 : 1;
|
| 666 |
+
const metkeISO = ecToGregorianISO(ecYear, metkeMonthIdx, metke);
|
| 667 |
+
const jsDay = new Date(metkeISO + "T00:00:00Z").getUTCDay();
|
| 668 |
+
const weekdayAssigned = ASSIGNED_BY_JS_DAY[jsDay];
|
| 669 |
+
const weekdayName = JS_DAY_NAME[jsDay];
|
| 670 |
+
const mebaja = metke + weekdayAssigned;
|
| 671 |
+
let nenMonthIdx = (metke >= 15) ? 4 : 5;
|
| 672 |
+
let nenDay = mebaja;
|
| 673 |
+
if (nenDay > 30) {
|
| 674 |
+
nenDay -= 30;
|
| 675 |
+
nenMonthIdx++;
|
| 676 |
+
}
|
| 677 |
+
const nenGregISO = ecToGregorianISO(ecYear, nenMonthIdx, nenDay);
|
| 678 |
+
return {
|
| 679 |
+
metkeMonthIdx,
|
| 680 |
+
metkeISO,
|
| 681 |
+
weekdayName,
|
| 682 |
+
weekdayAssigned,
|
| 683 |
+
mebaja,
|
| 684 |
+
nenEC: { ecYear, monthIdx: nenMonthIdx, day: nenDay },
|
| 685 |
+
nenGregISO
|
| 686 |
+
};
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
+
function cumulativeOffsetsFromGaps(gaps) {
|
| 690 |
+
const out = [];
|
| 691 |
+
let total = 0;
|
| 692 |
+
for (const [name, gap] of gaps) {
|
| 693 |
+
total += gap;
|
| 694 |
+
out.push([name, total]);
|
| 695 |
+
}
|
| 696 |
+
return out;
|
| 697 |
+
}
|
| 698 |
+
|
| 699 |
+
// ===================== RENDER FUNCTIONS =====================
|
| 700 |
+
|
| 701 |
+
function render() {
|
| 702 |
+
const ecYear = Number(els.year.value || 0);
|
| 703 |
+
if (!ecYear) {
|
| 704 |
+
alert("Please enter a valid Eritrean year.");
|
| 705 |
+
return;
|
| 706 |
+
}
|
| 707 |
+
|
| 708 |
+
const core = coreCalc(ecYear);
|
| 709 |
+
const nen = computeNenewie(ecYear, core.metke);
|
| 710 |
+
|
| 711 |
+
// Core Table
|
| 712 |
+
els.coreBody.innerHTML = `
|
| 713 |
+
<tr><th>ዓመተ ዓለም Amete Alem</th><td>${core.amete}</td></tr>
|
| 714 |
+
<tr><th>ዓብይ ቀመር Remainder1 (mod 532)</th><td>${core.remainder1}</td></tr>
|
| 715 |
+
<tr><th>መንበር Menber (mod 19)</th><td>${core.menber}</td></tr>
|
| 716 |
+
<tr><th>ኣበቅቴ Abektie</th><td>${core.abektie}</td></tr>
|
| 717 |
+
<tr><th>መጥቅዕMetke (day)</th><td>${core.metke}</td></tr>
|
| 718 |
+
<tr><th>መጥቅዕ ዝወድቀሉ ወርሒ Metke “virtual month”</th><td>${MONTHS[nen.metkeMonthIdx]}</td></tr>
|
| 719 |
+
<tr><th>Metke date (E.C.)</th><td>${MONTHS[nen.metkeMonthIdx]} ${core.metke}</td></tr>
|
| 720 |
+
<tr><th መጥቅዕ + ለውሳከ ዕለት >Metke weekday</th><td>${nen.weekdayName}</td></tr>
|
| 721 |
+
<tr><th>መባጃ ሓመር Mebaja</th><td>${nen.mebaja}</td></tr>
|
| 722 |
+
<tr><th>ነነዌ ብግዕዝ Nenewie (E.C.)</th><td>${MONTHS[nen.nenEC.monthIdx]} ${nen.nenEC.day}</td></tr>
|
| 723 |
+
<tr><th> ነነዌ ብጊርጎርያን Nenewie (Gregorian)</th><td>${nen.nenGregISO}</td></tr>
|
| 724 |
+
<tr><th>Pagumien length</th><td>${ecMonthLen(12, ecYear)} days</td></tr>
|
| 725 |
+
|
| 726 |
+
`;
|
| 727 |
+
|
| 728 |
+
// Metke Weekday Table
|
| 729 |
+
const jsDay = new Date(nen.metkeISO + "T00:00:00Z").getUTCDay(); // 0=Sun..6=Sat
|
| 730 |
+
const assigned = ASSIGNED_BY_JS_DAY[jsDay];
|
| 731 |
+
const mebaja = core.metke + assigned;
|
| 732 |
+
const weekdayName = JS_DAY_NAME[jsDay];
|
| 733 |
+
els.weekdayBody.innerHTML = `
|
| 734 |
+
<tr style="color:red; font-weight:bold;">
|
| 735 |
+
<td>${weekdayName} ✔ actual</td>
|
| 736 |
+
<td>${assigned}</td>
|
| 737 |
+
<td>${mebaja}</td>
|
| 738 |
+
</tr>
|
| 739 |
+
`;
|
| 740 |
+
|
| 741 |
+
// Feasts Table
|
| 742 |
+
const feastByCategory = {
|
| 743 |
+
great: [],
|
| 744 |
+
small: [],
|
| 745 |
+
stMary: []
|
| 746 |
+
};
|
| 747 |
+
|
| 748 |
+
let totalOffset = 0;
|
| 749 |
+
els.feastBody.innerHTML = "";
|
| 750 |
+
|
| 751 |
+
FEAST_GAPS.forEach((feastObj, i) => {
|
| 752 |
+
totalOffset += feastObj.gap;
|
| 753 |
+
const feastEC = addDaysEC(ecYear, nen.nenEC.monthIdx, nen.nenEC.day, totalOffset);
|
| 754 |
+
const feastECStr = `${MONTHS[feastEC.monthIdx]} ${feastEC.day}`;
|
| 755 |
+
const feastGreg = ecToGregorianISO(feastEC.ecYear, feastEC.monthIdx, feastEC.day);
|
| 756 |
+
const gDateObj = new Date(feastGreg + "T00:00:00Z");
|
| 757 |
+
const weekday = JS_DAY_NAME[gDateObj.getUTCDay()];
|
| 758 |
+
|
| 759 |
+
// Row for main feast table
|
| 760 |
+
els.feastBody.innerHTML += `
|
| 761 |
+
<tr>
|
| 762 |
+
<td>${i + 1}</td>
|
| 763 |
+
<td>${feastObj.name}</td>
|
| 764 |
+
<td>${totalOffset}</td>
|
| 765 |
+
<td>${feastECStr}</td>
|
| 766 |
+
<td>${feastGreg}</td>
|
| 767 |
+
</tr>
|
| 768 |
+
`;
|
| 769 |
+
|
| 770 |
+
// Add to its category table
|
| 771 |
+
if (feastByCategory[feastObj.category]) {
|
| 772 |
+
feastByCategory[feastObj.category].push({
|
| 773 |
+
name: feastObj.name,
|
| 774 |
+
ecStr: feastECStr,
|
| 775 |
+
gcStr: feastGreg,
|
| 776 |
+
weekday
|
| 777 |
+
});
|
| 778 |
+
}
|
| 779 |
+
});
|
| 780 |
+
|
| 781 |
+
|
| 782 |
+
// Helper to render each holiday category
|
| 783 |
+
function renderDynamicHolidayTable(holidays, tbodyEl) {
|
| 784 |
+
tbodyEl.innerHTML = "";
|
| 785 |
+
holidays.forEach((h, i) => {
|
| 786 |
+
tbodyEl.innerHTML += `
|
| 787 |
+
<tr>
|
| 788 |
+
<td>${i + 1}</td>
|
| 789 |
+
<td>${h.name}</td>
|
| 790 |
+
<td>${h.ecStr}</td>
|
| 791 |
+
<td>${h.gcStr}</td>
|
| 792 |
+
<td>${h.weekday}</td>
|
| 793 |
+
</tr>
|
| 794 |
+
`;
|
| 795 |
+
});
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
const evangelists = ["John ዮውሃንስ", "Matthew፡ ማስቴዎስ", "Mark ማርቆስ", "Luke ሉቃስ"];
|
| 799 |
+
const zemeneIndex = ecYear % 4;
|
| 800 |
+
const zemeneName = evangelists[zemeneIndex];
|
| 801 |
+
|
| 802 |
+
document.getElementById("zemeneText").innerHTML =
|
| 803 |
+
`Welcome to the Year of <strong> ${zemeneName}</strong>!. እንቃዕ ናብ ዘበነ <strong> ${zemeneName}</strong>ብሰላም አብጸሓና።`;
|
| 804 |
+
|
| 805 |
+
|
| 806 |
+
// Render by category
|
| 807 |
+
renderDynamicHolidayTable(feastByCategory.great, document.getElementById('greatHolidayBody'));
|
| 808 |
+
renderDynamicHolidayTable(feastByCategory.small, document.getElementById('smallHolidayBody'));
|
| 809 |
+
renderDynamicHolidayTable(feastByCategory.stMary, document.getElementById('stMaryHolidayBody')); // if any
|
| 810 |
+
|
| 811 |
+
const movableFeastsByName = {};
|
| 812 |
+
feastByCategory.great.concat(feastByCategory.small || [], feastByCategory.stMary || []).forEach(feast => {
|
| 813 |
+
movableFeastsByName[feast.name] = {
|
| 814 |
+
ecStr: feast.ecStr,
|
| 815 |
+
gcStr: feast.gcStr,
|
| 816 |
+
weekdayName: feast.weekday
|
| 817 |
+
};
|
| 818 |
+
});
|
| 819 |
+
|
| 820 |
+
// Now populate tables using the structured list:
|
| 821 |
+
populateHolidayTables(ecYear, movableFeastsByName);
|
| 822 |
+
|
| 823 |
+
}
|
| 824 |
+
|
| 825 |
+
// Attach event handlers
|
| 826 |
+
els.calcBtn.addEventListener("click", render);
|
| 827 |
+
els.printBtn.addEventListener("click", () => window.print());
|
| 828 |
+
|
| 829 |
+
|
| 830 |
+
// Initial render on page load
|
| 831 |
+
render();
|
| 832 |
+
|
| 833 |
+
|
| 834 |
+
function populateHolidayTables(ecYear, movableFeastsByName) {
|
| 835 |
+
const categoryToElementId = {
|
| 836 |
+
fixed: "fixedHolidayBody",
|
| 837 |
+
great: "greatHolidayBody",
|
| 838 |
+
small: "smallHolidayBody",
|
| 839 |
+
stMary: "stMaryHolidayBody",
|
| 840 |
+
stSaints1: "StSaints1HolidayBody",
|
| 841 |
+
stSaints2:"stSaints2HolidayBody",
|
| 842 |
+
BirthFeasts: "BirthFeastsHolidayBody"
|
| 843 |
+
};
|
| 844 |
+
|
| 845 |
+
for (const [category, holidays] of Object.entries(HOLIDAY_GROUPS)) {
|
| 846 |
+
const tbody = document.getElementById(categoryToElementId[category]);
|
| 847 |
+
tbody.innerHTML = "";
|
| 848 |
+
|
| 849 |
+
holidays.forEach(({ name, month, day, movable }, i) => {
|
| 850 |
+
let ecDateStr = "";
|
| 851 |
+
let gcDateStr = "";
|
| 852 |
+
let weekday = "";
|
| 853 |
+
|
| 854 |
+
if (movable && movableFeastsByName[movable]) {
|
| 855 |
+
// Movable feast date
|
| 856 |
+
const { ecStr, gcStr, weekdayName } = movableFeastsByName[movable];
|
| 857 |
+
ecDateStr = ecStr;
|
| 858 |
+
gcDateStr = gcStr;
|
| 859 |
+
weekday = weekdayName;
|
| 860 |
+
} else if (typeof month === "number" && typeof day === "number") {
|
| 861 |
+
// Fixed date
|
| 862 |
+
const gDate = ecToGregorianISO(ecYear, month, day);
|
| 863 |
+
const gDateObj = new Date(gDate + "T00:00:00Z");
|
| 864 |
+
weekday = JS_DAY_NAME[gDateObj.getUTCDay()];
|
| 865 |
+
ecDateStr = `${MONTHS[month]} ${day}`;
|
| 866 |
+
gcDateStr = gDate;
|
| 867 |
+
}
|
| 868 |
+
|
| 869 |
+
tbody.innerHTML += `
|
| 870 |
+
<tr>
|
| 871 |
+
<td>${i + 1}</td>
|
| 872 |
+
<td>${name}</td>
|
| 873 |
+
<td>${ecDateStr}</td>
|
| 874 |
+
<td>${gcDateStr}</td>
|
| 875 |
+
<td>${weekday}</td>
|
| 876 |
+
</tr>
|
| 877 |
+
`;
|
| 878 |
+
});
|
| 879 |
+
}
|
| 880 |
+
|
| 881 |
+
}
|
| 882 |
+
|
| 883 |
+
|
| 884 |
+
const customHolidayForm = document.getElementById("customHolidayForm");
|
| 885 |
+
const customName = document.getElementById("customName");
|
| 886 |
+
const customMonth = document.getElementById("customMonth");
|
| 887 |
+
const customDay = document.getElementById("customDay");
|
| 888 |
+
const customHolidayList = document.getElementById("customHolidayList");
|
| 889 |
+
const includeAllCheckbox = document.getElementById("includeAll");
|
| 890 |
+
const printCustomBtn = document.getElementById("printCustomBtn");
|
| 891 |
+
|
| 892 |
+
const customHolidays = [];
|
| 893 |
+
|
| 894 |
+
// Populate Month Dropdown
|
| 895 |
+
MONTHS.forEach((month, idx) => {
|
| 896 |
+
const opt = document.createElement("option");
|
| 897 |
+
opt.value = idx;
|
| 898 |
+
opt.textContent = month;
|
| 899 |
+
customMonth.appendChild(opt);
|
| 900 |
+
});
|
| 901 |
+
|
| 902 |
+
|
| 903 |
+
document.getElementById("toggleCustomHolidayBtn").addEventListener("click", () => {
|
| 904 |
+
const section = document.getElementById("customHolidaySection");
|
| 905 |
+
section.classList.toggle("hidden");
|
| 906 |
+
});
|
| 907 |
+
|
| 908 |
+
document.getElementById("customHolidayForm").addEventListener("submit", function (e) {
|
| 909 |
+
e.preventDefault();
|
| 910 |
+
|
| 911 |
+
const name = document.getElementById("customName").value;
|
| 912 |
+
const monthIdx = Number(document.getElementById("customMonth").value);
|
| 913 |
+
const day = Number(document.getElementById("customDay").value);
|
| 914 |
+
|
| 915 |
+
const ecStr = `${MONTHS[monthIdx]} ${day}`;
|
| 916 |
+
const gcStr = ecToGregorianISO(Number(document.getElementById("year").value), monthIdx, day);
|
| 917 |
+
const weekday = JS_DAY_NAME[new Date(gcStr + "T00:00:00Z").getUTCDay()];
|
| 918 |
+
|
| 919 |
+
// Add to visible list
|
| 920 |
+
document.getElementById("customHolidayList").innerHTML += `
|
| 921 |
+
<p><strong>${name}</strong>: ${ecStr} (${gcStr}) — ${weekday}</p>
|
| 922 |
+
`;
|
| 923 |
+
|
| 924 |
+
// Optionally, reset form
|
| 925 |
+
this.reset();
|
| 926 |
+
});
|
| 927 |
+
|
| 928 |
+
})();
|
| 929 |
+
|
| 930 |
+
|
| 931 |
+
</script>
|
| 932 |
+
<script type="application/ld+json">
|
| 933 |
+
{
|
| 934 |
+
"@context": "https://schema.org",
|
| 935 |
+
"@graph": [
|
| 936 |
+
{
|
| 937 |
+
"@type": "WebPage",
|
| 938 |
+
"name": "Eritrean Holidays 2025",
|
| 939 |
+
"url": "https://yourdomain.com/eritrea-holidays",
|
| 940 |
+
"inLanguage": "en",
|
| 941 |
+
"description": "List of major Eritrean holidays for 2025"
|
| 942 |
+
},
|
| 943 |
+
{
|
| 944 |
+
"@type": "Event",
|
| 945 |
+
"name": "Orthodox Christmas",
|
| 946 |
+
"startDate": "2025-01-07",
|
| 947 |
+
"endDate": "2025-01-07",
|
| 948 |
+
"eventStatus": "https://schema.org/EventScheduled",
|
| 949 |
+
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
|
| 950 |
+
"location": {
|
| 951 |
+
"@type": "Place",
|
| 952 |
+
"name": "Eritrea",
|
| 953 |
+
"address": {
|
| 954 |
+
"@type": "PostalAddress",
|
| 955 |
+
"addressCountry": "ER"
|
| 956 |
+
}
|
| 957 |
+
},
|
| 958 |
+
"description": "Orthodox Christmas celebrated in Eritrea on 2025-01-07"
|
| 959 |
+
},
|
| 960 |
+
{
|
| 961 |
+
"@type": "Event",
|
| 962 |
+
"name": "Timket (Epiphany)",
|
| 963 |
+
"startDate": "2025-01-19",
|
| 964 |
+
"endDate": "2025-01-19",
|
| 965 |
+
"eventStatus": "https://schema.org/EventScheduled",
|
| 966 |
+
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
|
| 967 |
+
"location": {
|
| 968 |
+
"@type": "Place",
|
| 969 |
+
"name": "Eritrea",
|
| 970 |
+
"address": {
|
| 971 |
+
"@type": "PostalAddress",
|
| 972 |
+
"addressCountry": "ER"
|
| 973 |
+
}
|
| 974 |
+
},
|
| 975 |
+
"description": "Timket (Epiphany) celebrated in Eritrea on 2025-01-19"
|
| 976 |
+
},
|
| 977 |
+
{
|
| 978 |
+
"@type": "Event",
|
| 979 |
+
"name": "Independence Day",
|
| 980 |
+
"startDate": "2025-05-24",
|
| 981 |
+
"endDate": "2025-05-24",
|
| 982 |
+
"eventStatus": "https://schema.org/EventScheduled",
|
| 983 |
+
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
|
| 984 |
+
"location": {
|
| 985 |
+
"@type": "Place",
|
| 986 |
+
"name": "Eritrea",
|
| 987 |
+
"address": {
|
| 988 |
+
"@type": "PostalAddress",
|
| 989 |
+
"addressCountry": "ER"
|
| 990 |
+
}
|
| 991 |
+
},
|
| 992 |
+
"description": "Independence Day celebrated in Eritrea on 2025-05-24"
|
| 993 |
+
},
|
| 994 |
+
{
|
| 995 |
+
"@type": "Event",
|
| 996 |
+
"name": "Martyrs' Day",
|
| 997 |
+
"startDate": "2025-06-20",
|
| 998 |
+
"endDate": "2025-06-20",
|
| 999 |
+
"eventStatus": "https://schema.org/EventScheduled",
|
| 1000 |
+
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
|
| 1001 |
+
"location": {
|
| 1002 |
+
"@type": "Place",
|
| 1003 |
+
"name": "Eritrea",
|
| 1004 |
+
"address": {
|
| 1005 |
+
"@type": "PostalAddress",
|
| 1006 |
+
"addressCountry": "ER"
|
| 1007 |
+
}
|
| 1008 |
+
},
|
| 1009 |
+
"description": "Martyrs' Day celebrated in Eritrea on 2025-06-20"
|
| 1010 |
+
},
|
| 1011 |
+
{
|
| 1012 |
+
"@type": "Event",
|
| 1013 |
+
"name": "Kudus Yohannes (Eritrean New Year)",
|
| 1014 |
+
"startDate": "2025-09-11",
|
| 1015 |
+
"endDate": "2025-09-11",
|
| 1016 |
+
"eventStatus": "https://schema.org/EventScheduled",
|
| 1017 |
+
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
|
| 1018 |
+
"location": {
|
| 1019 |
+
"@type": "Place",
|
| 1020 |
+
"name": "Eritrea",
|
| 1021 |
+
"address": {
|
| 1022 |
+
"@type": "PostalAddress",
|
| 1023 |
+
"addressCountry": "ER"
|
| 1024 |
+
}
|
| 1025 |
+
},
|
| 1026 |
+
"description": "Eritrean New Year (Kudus Yohannes) celebrated on 2025-09-11"
|
| 1027 |
+
},
|
| 1028 |
+
{
|
| 1029 |
+
"@type": "Event",
|
| 1030 |
+
"name": "Meskel",
|
| 1031 |
+
"startDate": "2025-09-27",
|
| 1032 |
+
"endDate": "2025-09-27",
|
| 1033 |
+
"eventStatus": "https://schema.org/EventScheduled",
|
| 1034 |
+
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
|
| 1035 |
+
"location": {
|
| 1036 |
+
"@type": "Place",
|
| 1037 |
+
"name": "Eritrea",
|
| 1038 |
+
"address": {
|
| 1039 |
+
"@type": "PostalAddress",
|
| 1040 |
+
"addressCountry": "ER"
|
| 1041 |
+
}
|
| 1042 |
+
},
|
| 1043 |
+
"description": "Meskel celebration in Eritrea on 2025-09-27"
|
| 1044 |
+
}
|
| 1045 |
+
]
|
| 1046 |
+
}
|
| 1047 |
+
</script>
|
| 1048 |
+
|
| 1049 |
+
</body>
|
| 1050 |
+
</html>
|
| 1051 |
+
|
chart.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
//////////////////////////////////////////////////////////
|
| 3 |
+
let monthlyChart;
|
| 4 |
+
|
| 5 |
+
async function renderMonthlyChart(transactionsParam = null) {
|
| 6 |
+
const transactions = transactionsParam || await (await fetch('/api/accounting')).json();
|
| 7 |
+
|
| 8 |
+
const contribution = Array(12).fill(0);
|
| 9 |
+
const donation = Array(12).fill(0);
|
| 10 |
+
const sale = Array(12).fill(0);
|
| 11 |
+
const expenses = Array(12).fill(0);
|
| 12 |
+
|
| 13 |
+
transactions.forEach(tx => {
|
| 14 |
+
if (!tx.month) return;
|
| 15 |
+
const parts = tx.month.split('-');
|
| 16 |
+
if (parts.length !== 2) return;
|
| 17 |
+
const monthIndex = parseInt(parts[1], 10) - 1;
|
| 18 |
+
if (monthIndex < 0 || monthIndex > 11) return;
|
| 19 |
+
|
| 20 |
+
if (tx.category === 'contribution') contribution[monthIndex] += tx.amount;
|
| 21 |
+
else if (tx.category === 'donation') donation[monthIndex] += tx.amount;
|
| 22 |
+
else if (tx.category === 'sale') sale[monthIndex] += tx.amount;
|
| 23 |
+
else if (tx.category === 'expense') expenses[monthIndex] += tx.amount;
|
| 24 |
+
});
|
| 25 |
+
|
| 26 |
+
const ctx = document.getElementById('monthlyChart').getContext('2d');
|
| 27 |
+
if (monthlyChart) monthlyChart.destroy();
|
| 28 |
+
|
| 29 |
+
monthlyChart = new Chart(ctx, {
|
| 30 |
+
type: 'bar',
|
| 31 |
+
data: {
|
| 32 |
+
labels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
|
| 33 |
+
datasets: [
|
| 34 |
+
{ label: 'Contribution', data: contribution, backgroundColor: 'rgba(75,192,192,0.7)' },
|
| 35 |
+
{ label: 'Donation', data: donation, backgroundColor: 'rgba(54,162,235,0.7)' },
|
| 36 |
+
{ label: 'Sale', data: sale, backgroundColor: 'rgba(255,206,86,0.7)' },
|
| 37 |
+
{ label: 'Expense', data: expenses, backgroundColor: 'rgba(255,99,132,0.7)' }
|
| 38 |
+
]
|
| 39 |
+
},
|
| 40 |
+
options: { responsive: true, plugins: { legend: { position: 'top' }, title: { display: true, text: 'Monthly Income & Expenses by Category' } }, scales: { y: { beginAtZero: true } } }
|
| 41 |
+
});
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
async function loadTransactions() {
|
| 45 |
+
const res = await fetch('/api/accounting', { cache: 'no-store' });
|
| 46 |
+
let transactions = await res.json();
|
| 47 |
+
|
| 48 |
+
if (filters.start || filters.end) {
|
| 49 |
+
const startDate = filters.start ? new Date(filters.start + "-01") : null;
|
| 50 |
+
const endDate = filters.end ? new Date(filters.end + "-01") : null;
|
| 51 |
+
|
| 52 |
+
transactions = transactions.filter(tx => {
|
| 53 |
+
if (!tx.month) return false;
|
| 54 |
+
const txDate = new Date(tx.month + "-01");
|
| 55 |
+
return (!startDate || txDate >= startDate) && (!endDate || txDate <= endDate);
|
| 56 |
+
});
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
const tbody = document.getElementById('accountingBody');
|
| 60 |
+
tbody.innerHTML = transactions.map((t, i) => `
|
| 61 |
+
<tr class="${t.category === 'expense' ? 'expense' : 'income'}">
|
| 62 |
+
<td>${i + 1}</td>
|
| 63 |
+
<td>${t.payerType === 'member' ? t.memberId : t.payerName}</td>
|
| 64 |
+
<td>${t.payerType}</td>
|
| 65 |
+
<td>${t.month}</td>
|
| 66 |
+
<td>${t.amount.toFixed(2)}</td>
|
| 67 |
+
<td>${t.category}</td>
|
| 68 |
+
<td>${t.description || ''}</td>
|
| 69 |
+
</tr>
|
| 70 |
+
`).join('');
|
| 71 |
+
|
| 72 |
+
updateAccountingSummary(transactions);
|
| 73 |
+
renderMonthlyChart(transactions);
|
| 74 |
+
renderIncomeExpenseChart(transactions);
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
// Call this on page load and after adding a transaction
|
| 80 |
+
renderMonthlyChart();
|
| 81 |
+
//////////////////////////////////////////
|
| 82 |
+
let filters = { start: null, end: null };
|
| 83 |
+
|
| 84 |
+
async function loadTransactions() {
|
| 85 |
+
const res = await fetch('/api/accounting');
|
| 86 |
+
let transactions = await res.json();
|
| 87 |
+
|
| 88 |
+
// Apply filter if set
|
| 89 |
+
if (filters.start || filters.end) {
|
| 90 |
+
transactions = transactions.filter(tx => {
|
| 91 |
+
if (!tx.month) return false;
|
| 92 |
+
const txDate = new Date(tx.month + "-01");
|
| 93 |
+
const startDate = filters.start ? new Date(filters.start + "-01") : null;
|
| 94 |
+
const endDate = filters.end ? new Date(filters.end + "-01") : null;
|
| 95 |
+
|
| 96 |
+
return (!startDate || txDate >= startDate) &&
|
| 97 |
+
(!endDate || txDate <= endDate);
|
| 98 |
+
});
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
const tbody = document.getElementById('accountingBody');
|
| 102 |
+
tbody.innerHTML = transactions
|
| 103 |
+
.map((t, i) => `
|
| 104 |
+
<tr class="${t.category === 'expense' ? 'expense' : 'income'}">
|
| 105 |
+
<td>${i + 1}</td>
|
| 106 |
+
<td>${t.payerType === 'member' ? t.memberId : t.payerName}</td>
|
| 107 |
+
<td>${t.payerType}</td>
|
| 108 |
+
<td>${t.month}</td>
|
| 109 |
+
<td>${t.amount}</td>
|
| 110 |
+
<td>${t.category}</td>
|
| 111 |
+
<td>${t.description || ''}</td>
|
| 112 |
+
</tr>
|
| 113 |
+
`).join('');
|
| 114 |
+
|
| 115 |
+
// Refresh charts/summary with filtered data
|
| 116 |
+
updateAccountingSummary(transactions);
|
| 117 |
+
renderMonthlyChart(transactions);
|
| 118 |
+
renderIncomeExpenseChart(transactions);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
let incomeExpenseChart;
|
| 122 |
+
|
| 123 |
+
async function renderIncomeExpenseChart(transactionsParam = null) {
|
| 124 |
+
const transactions = transactionsParam || await (await fetch('/api/accounting')).json();
|
| 125 |
+
|
| 126 |
+
let totalIncome = 0, totalExpenses = 0;
|
| 127 |
+
|
| 128 |
+
transactions.forEach(tx => {
|
| 129 |
+
if (tx.category === 'expense') totalExpenses += tx.amount;
|
| 130 |
+
else totalIncome += tx.amount;
|
| 131 |
+
});
|
| 132 |
+
|
| 133 |
+
const ctx = document.getElementById('incomeExpenseChart').getContext('2d');
|
| 134 |
+
if (incomeExpenseChart) incomeExpenseChart.destroy();
|
| 135 |
+
|
| 136 |
+
incomeExpenseChart = new Chart(ctx, {
|
| 137 |
+
type: 'pie',
|
| 138 |
+
data: {
|
| 139 |
+
labels: ['Income', 'Expenses'],
|
| 140 |
+
datasets: [{
|
| 141 |
+
data: [totalIncome, totalExpenses],
|
| 142 |
+
backgroundColor: ['rgba(75,192,192,0.7)', 'rgba(255,99,132,0.7)']
|
| 143 |
+
}]
|
| 144 |
+
},
|
| 145 |
+
options: { responsive: true, plugins: { legend: { position: 'top' }, title: { display: true, text: 'Income vs Expenses' } } }
|
| 146 |
+
});
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
document.getElementById('applyFilters').addEventListener('click', () => {
|
| 151 |
+
filters.start = document.getElementById('filterStart').value || null;
|
| 152 |
+
filters.end = document.getElementById('filterEnd').value || null;
|
| 153 |
+
loadTransactions();
|
| 154 |
+
});
|
| 155 |
+
|
| 156 |
+
document.getElementById('clearFilters').addEventListener('click', () => {
|
| 157 |
+
filters.start = null;
|
| 158 |
+
filters.end = null;
|
| 159 |
+
document.getElementById('filterStart').value = '';
|
| 160 |
+
document.getElementById('filterEnd').value = '';
|
| 161 |
+
loadTransactions();
|
| 162 |
+
});
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
document.getElementById("exportPdf").addEventListener("click", async () => {
|
| 166 |
+
const { jsPDF } = window.jspdf;
|
| 167 |
+
const pdf = new jsPDF("p", "pt", "a4");
|
| 168 |
+
|
| 169 |
+
// Title
|
| 170 |
+
pdf.setFontSize(18);
|
| 171 |
+
pdf.text("Church Accounting Report", 40, 40);
|
| 172 |
+
|
| 173 |
+
// Capture summary table
|
| 174 |
+
const summaryElement = document.getElementById("summaryTable");
|
| 175 |
+
const summaryCanvas = await html2canvas(summaryElement);
|
| 176 |
+
const summaryImg = summaryCanvas.toDataURL("image/png");
|
| 177 |
+
pdf.addImage(summaryImg, "PNG", 40, 60, 500, 0);
|
| 178 |
+
|
| 179 |
+
pdf.addPage();
|
| 180 |
+
|
| 181 |
+
// Capture monthly chart
|
| 182 |
+
const chartCanvas = document.getElementById("monthlyChart");
|
| 183 |
+
const chartImg = chartCanvas.toDataURL("image/png");
|
| 184 |
+
pdf.text("Monthly Breakdown", 40, 40);
|
| 185 |
+
pdf.addImage(chartImg, "PNG", 40, 60, 500, 300);
|
| 186 |
+
|
| 187 |
+
pdf.addPage();
|
| 188 |
+
|
| 189 |
+
// Capture income vs expense pie
|
| 190 |
+
const pieCanvas = document.getElementById("incomeExpenseChart");
|
| 191 |
+
const pieImg = pieCanvas.toDataURL("image/png");
|
| 192 |
+
pdf.text("Income vs Expense", 40, 40);
|
| 193 |
+
pdf.addImage(pieImg, "PNG", 40, 60, 400, 300);
|
| 194 |
+
|
| 195 |
+
// Save file
|
| 196 |
+
pdf.save("accounting-report.pdf");
|
| 197 |
+
});
|
index.html
CHANGED
|
@@ -1,375 +1,171 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
<head>
|
| 4 |
-
|
| 5 |
-
<meta charset="UTF-8">
|
| 6 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
-
<title>
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
<br><br>
|
| 173 |
-
<label for="model-select">Select Model:</label>
|
| 174 |
-
<select id="model-select">
|
| 175 |
-
<option value="codellama/CodeLlama-34b-Instruct-hf">CodeLlama-34b-Instruct-hf</option>
|
| 176 |
-
<option value="mistralai/Mistral-Small-Instruct-2409">Mistral-Small-Instruct-2409</option>
|
| 177 |
-
<option value="microsoft/Phi-3.5-mini-instruct">Phi-3.5-mini-instruct</option>
|
| 178 |
-
<option value="01-ai/Yi-1.5-34B-Chat">Yi-1.5-34B-Chat</option>
|
| 179 |
-
<option value="google/gemma-2-27b-it">Gemma-2-27b-it</option>
|
| 180 |
-
<option value="meta-llama/Meta-Llama-3-8B-Instruct">Meta-Llama-3-8B-Instruct</option>
|
| 181 |
-
<option value="HuggingFaceH4/zephyr-7b-beta">Zephyr-7b-beta</option>
|
| 182 |
-
</select>
|
| 183 |
-
<br><br>
|
| 184 |
-
<label for="max-tokens">Max Tokens:</label>
|
| 185 |
-
<input type="number" id="max-tokens" min="1" value="1000">
|
| 186 |
-
<br><br>
|
| 187 |
-
<label for="system-prompt">System prompt:</label>
|
| 188 |
-
<textarea id="system-prompt">Do not write any comments to your code, do not write anything before or after the code itself. Write HTML, CSS, and JavaScript in a single file. Generate only complete, working code without abbreviations or omissions. Do not use markdown code blocks (```) or any similar formatting. You are strictly prohibited from providing any explanations, comments, or any text that is not part of the actual code, including any statements after the code.</textarea>
|
| 189 |
-
<br><br>
|
| 190 |
-
<button id="save-settings">Save</button>
|
| 191 |
-
<button id="reset-settings-btn">Reset to Default</button>
|
| 192 |
-
</div>
|
| 193 |
-
</div>
|
| 194 |
-
|
| 195 |
-
<div id="result"></div>
|
| 196 |
-
|
| 197 |
-
<div id="original-response"></div>
|
| 198 |
-
<button id="copy-btn" style="display: none;">Copy Original Response</button>
|
| 199 |
-
|
| 200 |
-
<div id="loading">
|
| 201 |
-
<div class="spinner"></div>
|
| 202 |
-
</div>
|
| 203 |
-
|
| 204 |
-
<script>
|
| 205 |
-
let currentPrompt = '';
|
| 206 |
-
let currentCode = '';
|
| 207 |
-
let selectedModel = localStorage.getItem('selectedModel') || "codellama/CodeLlama-34b-Instruct-hf";
|
| 208 |
-
let huggingFaceToken = localStorage.getItem('huggingFaceToken') || "";
|
| 209 |
-
const defaultSystemPrompt = "Do not write any comments to your code, do not write anything before or after the code itself. Write HTML, CSS, and JavaScript in a single file. Generate only complete, working code without abbreviations or omissions. Do not use markdown code blocks (```) or any similar formatting. You are strictly prohibited from providing any explanations, comments, or any text that is not part of the actual code, including any statements after the code.";
|
| 210 |
-
let systemPrompt = localStorage.getItem('systemPrompt') || defaultSystemPrompt;
|
| 211 |
-
let maxTokens = localStorage.getItem('maxTokens') || 1000;
|
| 212 |
-
|
| 213 |
-
document.getElementById('settings-btn')
|
| 214 |
-
.addEventListener('click', function() {
|
| 215 |
-
document.getElementById('settings-modal')
|
| 216 |
-
.style.display = 'block';
|
| 217 |
-
document.getElementById('huggingface-token')
|
| 218 |
-
.value = huggingFaceToken;
|
| 219 |
-
document.getElementById('model-select')
|
| 220 |
-
.value = selectedModel;
|
| 221 |
-
document.getElementById('system-prompt')
|
| 222 |
-
.value = systemPrompt;
|
| 223 |
-
document.getElementById('max-tokens')
|
| 224 |
-
.value = maxTokens;
|
| 225 |
-
});
|
| 226 |
-
|
| 227 |
-
document.getElementsByClassName('close')[0].addEventListener('click', function() {
|
| 228 |
-
document.getElementById('settings-modal')
|
| 229 |
-
.style.display = 'none';
|
| 230 |
-
});
|
| 231 |
-
|
| 232 |
-
document.getElementById('save-settings')
|
| 233 |
-
.addEventListener('click', function() {
|
| 234 |
-
huggingFaceToken = document.getElementById('huggingface-token')
|
| 235 |
-
.value;
|
| 236 |
-
selectedModel = document.getElementById('model-select')
|
| 237 |
-
.value;
|
| 238 |
-
systemPrompt = document.getElementById('system-prompt')
|
| 239 |
-
.value;
|
| 240 |
-
maxTokens = document.getElementById('max-tokens')
|
| 241 |
-
.value;
|
| 242 |
-
localStorage.setItem('huggingFaceToken', huggingFaceToken);
|
| 243 |
-
localStorage.setItem('selectedModel', selectedModel);
|
| 244 |
-
localStorage.setItem('systemPrompt', systemPrompt);
|
| 245 |
-
localStorage.setItem('maxTokens', maxTokens);
|
| 246 |
-
document.getElementById('settings-modal')
|
| 247 |
-
.style.display = 'none';
|
| 248 |
-
console.log("Settings saved. Token:", huggingFaceToken, "Model:", selectedModel, "System Prompt:", systemPrompt, "Max Tokens:", maxTokens);
|
| 249 |
-
});
|
| 250 |
-
|
| 251 |
-
document.getElementById('reset-settings-btn')
|
| 252 |
-
.addEventListener('click', function() {
|
| 253 |
-
selectedModel = "codellama/CodeLlama-34b-Instruct-hf";
|
| 254 |
-
systemPrompt = defaultSystemPrompt;
|
| 255 |
-
maxTokens = 1000;
|
| 256 |
-
document.getElementById('model-select')
|
| 257 |
-
.value = selectedModel;
|
| 258 |
-
document.getElementById('system-prompt')
|
| 259 |
-
.value = systemPrompt;
|
| 260 |
-
document.getElementById('max-tokens')
|
| 261 |
-
.value = maxTokens;
|
| 262 |
-
localStorage.setItem('selectedModel', selectedModel);
|
| 263 |
-
localStorage.setItem('systemPrompt', systemPrompt);
|
| 264 |
-
localStorage.setItem('maxTokens', maxTokens);
|
| 265 |
-
console.log("Settings reset to default. Model:", selectedModel, "System Prompt:", systemPrompt, "Max Tokens:", maxTokens);
|
| 266 |
-
});
|
| 267 |
-
|
| 268 |
-
document.getElementById('generate-btn')
|
| 269 |
-
.addEventListener('click', generateWebsite);
|
| 270 |
-
|
| 271 |
-
document.getElementById('prompt-input')
|
| 272 |
-
.addEventListener('keypress', function(event) {
|
| 273 |
-
if (event.key === 'Enter') {
|
| 274 |
-
generateWebsite();
|
| 275 |
-
}
|
| 276 |
-
});
|
| 277 |
-
|
| 278 |
-
document.getElementById('copy-btn')
|
| 279 |
-
.addEventListener('click', function() {
|
| 280 |
-
const originalResponse = document.getElementById('original-response')
|
| 281 |
-
.textContent;
|
| 282 |
-
navigator.clipboard.writeText(originalResponse)
|
| 283 |
-
.then(function() {
|
| 284 |
-
alert('Original response copied to clipboard!');
|
| 285 |
-
}, function(err) {
|
| 286 |
-
console.error('Could not copy text: ', err);
|
| 287 |
-
});
|
| 288 |
-
});
|
| 289 |
-
|
| 290 |
-
function generateWebsite() {
|
| 291 |
-
currentPrompt = document.getElementById('prompt-input')
|
| 292 |
-
.value;
|
| 293 |
-
if (currentPrompt) {
|
| 294 |
-
generateWebsiteFromAPI(currentPrompt);
|
| 295 |
-
}
|
| 296 |
-
}
|
| 297 |
-
|
| 298 |
-
async function generateWebsiteFromAPI(prompt) {
|
| 299 |
-
if (!huggingFaceToken) {
|
| 300 |
-
alert("Please set your Hugging Face token in the settings.");
|
| 301 |
-
return;
|
| 302 |
-
}
|
| 303 |
-
|
| 304 |
-
const apiUrl = 'https://api-inference.huggingface.co/models/' + selectedModel + '/v1/chat/completions';
|
| 305 |
-
|
| 306 |
-
let messages = [{
|
| 307 |
-
"role": "system",
|
| 308 |
-
"content": systemPrompt
|
| 309 |
-
},
|
| 310 |
-
{
|
| 311 |
-
"role": "user",
|
| 312 |
-
"content": "Generate a website based on this description: " + prompt
|
| 313 |
-
}
|
| 314 |
-
];
|
| 315 |
-
|
| 316 |
-
document.getElementById('loading')
|
| 317 |
-
.style.display = 'block';
|
| 318 |
-
|
| 319 |
-
try {
|
| 320 |
-
const response = await fetch(apiUrl, {
|
| 321 |
-
method: 'POST',
|
| 322 |
-
headers: {
|
| 323 |
-
'Authorization': 'Bearer ' + huggingFaceToken,
|
| 324 |
-
'Content-Type': 'application/json'
|
| 325 |
-
},
|
| 326 |
-
body: JSON.stringify({
|
| 327 |
-
model: selectedModel,
|
| 328 |
-
messages: messages,
|
| 329 |
-
max_tokens: parseInt(maxTokens),
|
| 330 |
-
stream: false
|
| 331 |
-
})
|
| 332 |
-
});
|
| 333 |
-
|
| 334 |
-
document.getElementById('loading')
|
| 335 |
-
.style.display = 'none';
|
| 336 |
-
|
| 337 |
-
if (!response.ok) {
|
| 338 |
-
throw new Error(`HTTP error! status: ${response.status}`);
|
| 339 |
-
}
|
| 340 |
-
|
| 341 |
-
const data = await response.json();
|
| 342 |
-
currentCode = data.choices[0].message.content;
|
| 343 |
-
|
| 344 |
-
const resultDiv = document.getElementById('result');
|
| 345 |
-
resultDiv.innerHTML = '';
|
| 346 |
-
|
| 347 |
-
const sandbox = document.createElement('iframe');
|
| 348 |
-
sandbox.style.width = '100%';
|
| 349 |
-
sandbox.style.height = '500px';
|
| 350 |
-
sandbox.style.border = 'none';
|
| 351 |
-
resultDiv.appendChild(sandbox);
|
| 352 |
-
|
| 353 |
-
const sandboxContent = sandbox.contentDocument || sandbox.contentWindow.document;
|
| 354 |
-
sandboxContent.open();
|
| 355 |
-
sandboxContent.write(currentCode);
|
| 356 |
-
sandboxContent.close();
|
| 357 |
-
|
| 358 |
-
document.getElementById('original-response')
|
| 359 |
-
.textContent = currentCode;
|
| 360 |
-
document.getElementById('copy-btn')
|
| 361 |
-
.style.display = 'block';
|
| 362 |
-
|
| 363 |
-
} catch (error) {
|
| 364 |
-
document.getElementById('loading')
|
| 365 |
-
.style.display = 'none';
|
| 366 |
-
console.error('There was a problem with the fetch operation:', error);
|
| 367 |
-
document.getElementById('result')
|
| 368 |
-
.innerHTML = `<p>An error occurred while generating the website: ${error.message}</p>`;
|
| 369 |
-
}
|
| 370 |
-
}
|
| 371 |
-
</script>
|
| 372 |
-
|
| 373 |
-
</body>
|
| 374 |
-
|
| 375 |
-
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Saint Michael Eritrean Orthodox Tewahdo Church WA</title>
|
| 8 |
+
<link rel="stylesheet" href="styles.css">
|
| 9 |
+
|
| 10 |
+
</head>
|
| 11 |
+
<body>
|
| 12 |
+
<header>
|
| 13 |
+
<h1>Saint Michael Eritrean Orthodox Tewahdo Church WA</h1>
|
| 14 |
+
<p>Marangaroo, Western Australia</p>
|
| 15 |
+
</header>
|
| 16 |
+
|
| 17 |
+
<nav>
|
| 18 |
+
<a href="#" onclick="showPage"(bahre-hasab)></a>
|
| 19 |
+
<a href="#" onclick="showPage('home')">Home</a>
|
| 20 |
+
<a href="#" onclick="showPage('about')">About</a>
|
| 21 |
+
<a href="#" onclick="showPage('services')">Services</a>
|
| 22 |
+
<a href="#" onclick="showPage('contact')">Contact</a>
|
| 23 |
+
<a href="bhr.html" onclick="showPage('bahre-hasab')">Calendar</a>
|
| 24 |
+
<a href="#" onclick="showPage('books')">Books</a>
|
| 25 |
+
<a href="admin/admin.html" >admin</a>
|
| 26 |
+
</nav>
|
| 27 |
+
|
| 28 |
+
<main>
|
| 29 |
+
<section id="home" class="active">
|
| 30 |
+
<h2>Welcome</h2>
|
| 31 |
+
<p>Welcome to Saint Michael Eritrean Orthodox Tewahdo Church in Western Australia. We are a spiritual home for Eritrean Orthodox believers in Perth and beyond.</p>
|
| 32 |
+
</section>
|
| 33 |
+
|
| 34 |
+
<section id="about">
|
| 35 |
+
<h2>About Us</h2>
|
| 36 |
+
<p>Established in 2015, our church serves the Eritrean Orthodox Tewahdo community in WA. We are dedicated to faith, worship, and community support.</p>
|
| 37 |
+
</section>
|
| 38 |
+
|
| 39 |
+
<section id="services">
|
| 40 |
+
<h2>Services</h2>
|
| 41 |
+
<ul>
|
| 42 |
+
<li>Sunday Worship Services</li>
|
| 43 |
+
<li>Baptisms</li>
|
| 44 |
+
<li>Sunday School for children</li>
|
| 45 |
+
<li>Youth & Family Programs</li>
|
| 46 |
+
</ul>
|
| 47 |
+
</section>
|
| 48 |
+
|
| 49 |
+
<section id="contact">
|
| 50 |
+
<h2>Contact Us</h2>
|
| 51 |
+
<p><strong>Address:</strong> 18 Pleasant Mews, Marangaroo, WA 6064</p>
|
| 52 |
+
<p><strong>Email:</strong> stmichael.eri.orthodox@gmail.com</p>
|
| 53 |
+
<p><strong>Phone:</strong> 0478 138 494</p>
|
| 54 |
+
<div style="margin-top:1rem;">
|
| 55 |
+
<iframe src="https://www.google.com/maps?q=18+Pleasant+Mews,+Marangaroo,+WA+6064&output=embed" width="100%" height="250" style="border:0;"></iframe>
|
| 56 |
+
</div>
|
| 57 |
+
</section>
|
| 58 |
+
|
| 59 |
+
<section id="bahre-hasab">
|
| 60 |
+
<div class="wrap">
|
| 61 |
+
<h1>Eritrean Feast Calculator</h1>
|
| 62 |
+
<p class="sub">Enter Eritrean year and calculate all movable feast dates automatically. Optional: supply Nenewie Gregorian base date if you want Gregorian mapping.</p>
|
| 63 |
+
|
| 64 |
+
<div class="card">
|
| 65 |
+
<label for="year">Eritrean Year</label>
|
| 66 |
+
<input id="year" type="number" value="2017" />
|
| 67 |
+
<button id="calc" style="margin-top:14px">Calculate</button>
|
| 68 |
+
<button id="printBtn">Print / Export PDF</button>
|
| 69 |
+
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
<div class="card">
|
| 73 |
+
<h3>Core Results</h3>
|
| 74 |
+
<table><tbody id="coreBody"></tbody></table>
|
| 75 |
+
<div class="note">Mebaja Hamer is computed for <b>all weekdays</b> automatically.</div>
|
| 76 |
+
</div>
|
| 77 |
+
|
| 78 |
+
<div class="card">
|
| 79 |
+
<h3>Mebaja Hamer by Weekday</h3>
|
| 80 |
+
<table>
|
| 81 |
+
<thead><tr><th>Weekday</th><th>Assigned Value</th><th>Mebaja</th></tr></thead>
|
| 82 |
+
<tbody id="weekdayBody"></tbody>
|
| 83 |
+
</table>
|
| 84 |
+
</div>
|
| 85 |
+
|
| 86 |
+
<div class="card">
|
| 87 |
+
<h3>Feast Dates (Eritrean Calendar)</h3>
|
| 88 |
+
<table>
|
| 89 |
+
<thead><tr><th>#</th><th>Feast</th><th>Offset (days)</th><th>Eritrean Date</th><th>Gregorian (optional)</th></tr></thead>
|
| 90 |
+
<tbody id="feastBody"></tbody>
|
| 91 |
+
</table>
|
| 92 |
+
<div class="note">Months assumed 30 days; Pagumien length is auto-detected (5, 6, or 7 days based on year rule).</div>
|
| 93 |
+
</div>
|
| 94 |
+
|
| 95 |
+
<div class="card">
|
| 96 |
+
<h3>Step-by-Step Calculation</h3>
|
| 97 |
+
<ol id="steps"></ol>
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
<h3>Add Fixed Holiday</h3>
|
| 101 |
+
<input type="text" id="holidayName" placeholder="Holiday Name">
|
| 102 |
+
<select id="holidayMonth"></select>
|
| 103 |
+
<input type="number" id="holidayDay" placeholder="Day" min="1" max="30">
|
| 104 |
+
<button id="addHoliday">Add Holiday</button>
|
| 105 |
+
|
| 106 |
+
<h3>Fixed Holidays</h3>
|
| 107 |
+
<table>
|
| 108 |
+
<thead>
|
| 109 |
+
<tr><th>#</th><th>Holiday Name</th><th>Eritrean Date</th><th>Gregorian Date</th></tr>
|
| 110 |
+
</thead>
|
| 111 |
+
<tbody id="fixedHolidayBody"></tbody>
|
| 112 |
+
</table>
|
| 113 |
+
|
| 114 |
+
</section>
|
| 115 |
+
|
| 116 |
+
<section id="books">
|
| 117 |
+
<h2>Church Books</h2>
|
| 118 |
+
|
| 119 |
+
<!-- Container for book categories -->
|
| 120 |
+
<div id="book-categories"></div>
|
| 121 |
+
|
| 122 |
+
<!-- Container for selected book list (e.g. list of liturgies) -->
|
| 123 |
+
<div id="book-list" style="margin-top: 1rem;"></div>
|
| 124 |
+
|
| 125 |
+
<!-- Container for the detailed content of one book -->
|
| 126 |
+
<div id="book-content" style="margin-top: 1rem;"></div>
|
| 127 |
+
</section>
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
<div class="verse">
|
| 131 |
+
<div class="role"></div>
|
| 132 |
+
<div class="lang en"></div>
|
| 133 |
+
<div class="lang geez"></div>
|
| 134 |
+
<div class="lang ti"></div>
|
| 135 |
+
</div>
|
| 136 |
+
|
| 137 |
+
</main>
|
| 138 |
+
|
| 139 |
+
<footer>
|
| 140 |
+
<p>© 2025 Saint Michael Eritrean Orthodox Tewahdo Church WA</p>
|
| 141 |
+
</footer>
|
| 142 |
+
<script src="data/books.js"></script>
|
| 143 |
+
<script src="data/liturgy/liturgy.js"></script>
|
| 144 |
+
<script>
|
| 145 |
+
loadBooksIndex(); // bootstrap
|
| 146 |
+
</script>
|
| 147 |
+
|
| 148 |
+
<script src="script.js"></script>
|
| 149 |
+
<script>
|
| 150 |
+
function showPage(pageId) {
|
| 151 |
+
document.querySelectorAll('section').forEach(section =>
|
| 152 |
+
section.classList.remove('active')
|
| 153 |
+
);
|
| 154 |
+
document.getElementById(pageId).classList.add('active');
|
| 155 |
+
|
| 156 |
+
document.querySelectorAll('nav a').forEach(a =>
|
| 157 |
+
a.classList.remove('active-link')
|
| 158 |
+
);
|
| 159 |
+
document.querySelector(`nav a[onclick*="${pageId}"]`).classList.add('active-link');
|
| 160 |
+
|
| 161 |
+
localStorage.setItem('lastPage', pageId);
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
window.addEventListener('load', () => {
|
| 165 |
+
const last = localStorage.getItem('lastPage') || 'home';
|
| 166 |
+
showPage(last);
|
| 167 |
+
});
|
| 168 |
+
|
| 169 |
+
</script>
|
| 170 |
+
</body>
|
| 171 |
+
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 2 |
+
const tbody = document.getElementById('inventoryBody');
|
| 3 |
+
const modal = document.getElementById('inventoryModal');
|
| 4 |
+
const form = document.getElementById('actionForm');
|
| 5 |
+
|
| 6 |
+
// Buttons
|
| 7 |
+
const editBtn = document.getElementById('editBtn');
|
| 8 |
+
const saveBtn = document.getElementById('saveBtn');
|
| 9 |
+
const cancelBtn = document.getElementById('cancelBtn');
|
| 10 |
+
const deleteBtn = document.getElementById('deleteBtn');
|
| 11 |
+
const sellBtn = document.getElementById('sellBtn');
|
| 12 |
+
const useBtn = document.getElementById('useBtn');
|
| 13 |
+
|
| 14 |
+
let currentId = null;
|
| 15 |
+
|
| 16 |
+
async function loadInventory() {
|
| 17 |
+
const res = await fetch('/api/inventory');
|
| 18 |
+
const items = await res.json();
|
| 19 |
+
tbody.innerHTML = items.map(item => `
|
| 20 |
+
<tr data-id="${item.id}">
|
| 21 |
+
<td>${item.id}</td>
|
| 22 |
+
<td>${item.name}</td>
|
| 23 |
+
<td>${item.type}</td>
|
| 24 |
+
<td>${item.color}</td>
|
| 25 |
+
<td>${item.quantity}</td>
|
| 26 |
+
<td>${item.price}</td>
|
| 27 |
+
<td>${item.note || ''}</td>
|
| 28 |
+
<td><button class="action-btn">Action</button></td>
|
| 29 |
+
</tr>
|
| 30 |
+
`).join('');
|
| 31 |
+
|
| 32 |
+
document.querySelectorAll('.action-btn').forEach(btn => {
|
| 33 |
+
btn.onclick = openModal;
|
| 34 |
+
});
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
function openModal(e) {
|
| 38 |
+
const row = e.target.closest('tr');
|
| 39 |
+
currentId = row.dataset.id;
|
| 40 |
+
|
| 41 |
+
// Fill form values
|
| 42 |
+
form.id.value = currentId;
|
| 43 |
+
form.name.value = row.children[1].textContent;
|
| 44 |
+
form.type.value = row.children[2].textContent;
|
| 45 |
+
form.color.value = row.children[3].textContent;
|
| 46 |
+
form.quantity.value = row.children[4].textContent;
|
| 47 |
+
form.price.value = row.children[5].textContent;
|
| 48 |
+
form.note.value = row.children[6].textContent;
|
| 49 |
+
|
| 50 |
+
setFormDisabled(true);
|
| 51 |
+
saveBtn.style.display = 'none';
|
| 52 |
+
modal.style.display = 'block';
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
function setFormDisabled(disabled) {
|
| 56 |
+
form.name.disabled = disabled;
|
| 57 |
+
form.type.disabled = disabled;
|
| 58 |
+
form.color.disabled = disabled;
|
| 59 |
+
form.quantity.disabled = disabled;
|
| 60 |
+
form.price.disabled = disabled;
|
| 61 |
+
form.note.disabled = disabled;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
// Cancel closes modal
|
| 65 |
+
cancelBtn.onclick = () => {
|
| 66 |
+
modal.style.display = 'none';
|
| 67 |
+
setFormDisabled(true);
|
| 68 |
+
saveBtn.style.display = 'none';
|
| 69 |
+
};
|
| 70 |
+
|
| 71 |
+
// Edit button - enables fields
|
| 72 |
+
editBtn.onclick = () => {
|
| 73 |
+
setFormDisabled(false);
|
| 74 |
+
saveBtn.style.display = 'inline-block';
|
| 75 |
+
};
|
| 76 |
+
|
| 77 |
+
// Save edited item
|
| 78 |
+
form.onsubmit = async (e) => {
|
| 79 |
+
e.preventDefault();
|
| 80 |
+
|
| 81 |
+
const updated = {
|
| 82 |
+
name: form.name.value,
|
| 83 |
+
type: form.type.value,
|
| 84 |
+
color: form.color.value,
|
| 85 |
+
quantity: parseInt(form.quantity.value),
|
| 86 |
+
price: parseFloat(form.price.value),
|
| 87 |
+
note: form.note.value
|
| 88 |
+
};
|
| 89 |
+
|
| 90 |
+
const res = await fetch(`/api/inventory/${currentId}`, {
|
| 91 |
+
method: 'PUT',
|
| 92 |
+
headers: { 'Content-Type': 'application/json' },
|
| 93 |
+
body: JSON.stringify(updated)
|
| 94 |
+
});
|
| 95 |
+
|
| 96 |
+
if (res.ok) {
|
| 97 |
+
modal.style.display = 'none';
|
| 98 |
+
await loadInventory();
|
| 99 |
+
} else {
|
| 100 |
+
alert('Failed to update.');
|
| 101 |
+
}
|
| 102 |
+
};
|
| 103 |
+
|
| 104 |
+
// Delete
|
| 105 |
+
deleteBtn.onclick = async () => {
|
| 106 |
+
if (!confirm('Delete this item?')) return;
|
| 107 |
+
const res = await fetch(`/api/inventory/${currentId}`, { method: 'DELETE' });
|
| 108 |
+
if (res.ok) {
|
| 109 |
+
modal.style.display = 'none';
|
| 110 |
+
await loadInventory();
|
| 111 |
+
} else {
|
| 112 |
+
alert('Delete failed.');
|
| 113 |
+
}
|
| 114 |
+
};
|
| 115 |
+
|
| 116 |
+
// Sell
|
| 117 |
+
sellBtn.onclick = async () => {
|
| 118 |
+
const qty = prompt("Quantity to sell:", 1);
|
| 119 |
+
const quantity = parseInt(qty, 10);
|
| 120 |
+
if (!qty || isNaN(quantity) || quantity <= 0) return alert('Invalid quantity');
|
| 121 |
+
|
| 122 |
+
const res = await fetch(`/api/inventory/${currentId}/sell`, {
|
| 123 |
+
method: 'POST',
|
| 124 |
+
headers: { 'Content-Type': 'application/json' },
|
| 125 |
+
body: JSON.stringify({ quantity, payerType: "non-member" })
|
| 126 |
+
});
|
| 127 |
+
|
| 128 |
+
if (res.ok) {
|
| 129 |
+
modal.style.display = 'none';
|
| 130 |
+
await loadInventory();
|
| 131 |
+
} else {
|
| 132 |
+
alert('Sell failed.');
|
| 133 |
+
}
|
| 134 |
+
};
|
| 135 |
+
|
| 136 |
+
// Use
|
| 137 |
+
useBtn.onclick = async () => {
|
| 138 |
+
const qty = prompt("Quantity to use:", 1);
|
| 139 |
+
const quantity = parseInt(qty, 10);
|
| 140 |
+
if (!qty || isNaN(quantity) || quantity <= 0) return alert('Invalid quantity');
|
| 141 |
+
|
| 142 |
+
const res = await fetch(`/api/inventory/${currentId}/use`, {
|
| 143 |
+
method: 'POST',
|
| 144 |
+
headers: { 'Content-Type': 'application/json' },
|
| 145 |
+
body: JSON.stringify({ quantity })
|
| 146 |
+
});
|
| 147 |
+
|
| 148 |
+
if (res.ok) {
|
| 149 |
+
modal.style.display = 'none';
|
| 150 |
+
await loadInventory();
|
| 151 |
+
} else {
|
| 152 |
+
alert('Use failed.');
|
| 153 |
+
}
|
| 154 |
+
};
|
| 155 |
+
|
| 156 |
+
// Initial load
|
| 157 |
+
loadInventory();
|
| 158 |
+
});
|
styles.css
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
body {
|
| 2 |
+
margin: 0;
|
| 3 |
+
font-family: Arial, sans-serif;
|
| 4 |
+
background: #fdfdfd;
|
| 5 |
+
color: #333;
|
| 6 |
+
}
|
| 7 |
+
header {
|
| 8 |
+
background: #800000;
|
| 9 |
+
color: white;
|
| 10 |
+
padding: 1rem;
|
| 11 |
+
text-align: center;
|
| 12 |
+
}
|
| 13 |
+
nav {
|
| 14 |
+
display: flex;
|
| 15 |
+
justify-content: center;
|
| 16 |
+
background: #333;
|
| 17 |
+
}
|
| 18 |
+
nav a {
|
| 19 |
+
color: white;
|
| 20 |
+
padding: 1rem;
|
| 21 |
+
text-decoration: none;
|
| 22 |
+
}
|
| 23 |
+
nav a:hover {
|
| 24 |
+
background: #555;
|
| 25 |
+
}
|
| 26 |
+
section {
|
| 27 |
+
padding: 2rem;
|
| 28 |
+
display: none;
|
| 29 |
+
}
|
| 30 |
+
section.active {
|
| 31 |
+
display: block;
|
| 32 |
+
}
|
| 33 |
+
footer {
|
| 34 |
+
text-align: center;
|
| 35 |
+
padding: 1rem;
|
| 36 |
+
background: #800000;
|
| 37 |
+
color: white;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
*{box-sizing:border-box}
|
| 44 |
+
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial; background:var(--bg); color:var(--text)}
|
| 45 |
+
.wrap{max-width:1100px;margin:32px auto;padding:0 16px}
|
| 46 |
+
h1{font-size:clamp(24px,2.5vw,34px);margin:0 0 8px}
|
| 47 |
+
p.sub{opacity:.8;margin:.25rem 0 1.25rem}
|
| 48 |
+
.card{background:var(--card);border-radius:16px;padding:16px;margin-bottom:20px;box-shadow:0 8px 20px rgba(0,0,0,.25)}
|
| 49 |
+
label{display:block;font-size:14px;margin-bottom:6px}
|
| 50 |
+
input,button{width:100%;padding:10px;border-radius:12px;border:1px solid #374151;background:#eceef0;color:var(--text)}
|
| 51 |
+
button{cursor:pointer;background:linear-gradient(135deg,var(--accent),var(--accent2));color:#0b1220;font-weight:700;border:none;box-shadow:0 8px 18px rgba(99,102,241,.25)}
|
| 52 |
+
button:hover{filter:brightness(1.05)}
|
| 53 |
+
table{width:100%;border-collapse:collapse;margin-top:10px}
|
| 54 |
+
th,td{padding:8px;border:1px solid #2a3343;text-align:left}
|
| 55 |
+
.note{font-size:12px;opacity:.7}
|
| 56 |
+
ol{padding-left:18px}
|
| 57 |
+
li{margin-bottom:6px}
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
.books-table {
|
| 61 |
+
width: 100%;
|
| 62 |
+
border-collapse: collapse;
|
| 63 |
+
margin: 1rem auto;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.books-table th, .books-table td {
|
| 67 |
+
border: 1px solid #ccc;
|
| 68 |
+
padding: 0.75rem;
|
| 69 |
+
text-align: center;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
.books-table th {
|
| 73 |
+
background: #800000;
|
| 74 |
+
color: white;
|
| 75 |
+
}
|
| 76 |
+
#booksList {
|
| 77 |
+
text-align: center;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.book-category,
|
| 81 |
+
.book-child,
|
| 82 |
+
.chapter-btn {
|
| 83 |
+
display: inline-block;
|
| 84 |
+
margin: 0.25rem;
|
| 85 |
+
padding: 0.5rem 1rem;
|
| 86 |
+
background: #800000;
|
| 87 |
+
color: white;
|
| 88 |
+
border: none;
|
| 89 |
+
border-radius: 6px;
|
| 90 |
+
cursor: pointer;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.book-category:hover,
|
| 94 |
+
.book-child:hover,
|
| 95 |
+
.chapter-btn:hover {
|
| 96 |
+
background: #a00000;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
/* Liturgy Verse Layout */
|
| 102 |
+
.verse {
|
| 103 |
+
display: grid;
|
| 104 |
+
grid-template-columns: repeat(3, 1fr); /* just 3 equal columns */
|
| 105 |
+
gap: 8px;
|
| 106 |
+
padding: 4px 0;
|
| 107 |
+
border-bottom: 1px solid #ddd; /* optional subtle divider */
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.verse:last-child {
|
| 111 |
+
border-bottom: none;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.lang {
|
| 115 |
+
font-size: 1rem;
|
| 116 |
+
line-height: 1.4;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.lang.en,
|
| 120 |
+
.lang.geez,
|
| 121 |
+
.lang.ti {
|
| 122 |
+
white-space: pre-wrap; /* keep line breaks if any */
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/* Role label inside text */
|
| 126 |
+
.role-label {
|
| 127 |
+
font-weight: bold;
|
| 128 |
+
margin-right: 4px;
|
| 129 |
+
}
|