Add 3 files
Browse files- README.md +6 -4
- index.html +662 -19
- prompts.txt +4 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: invoice-generator
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: red
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,662 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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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>Business Invoice Generator</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
| 9 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
| 10 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 11 |
+
<style>
|
| 12 |
+
@keyframes fadeIn {
|
| 13 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 14 |
+
to { opacity: 1; transform: translateY(0); }
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
.invoice-item:last-child {
|
| 18 |
+
border-bottom: none;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
.modal {
|
| 22 |
+
animation: fadeIn 0.3s ease-out;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
#invoice-preview {
|
| 26 |
+
background-color: white;
|
| 27 |
+
color: black;
|
| 28 |
+
box-shadow: 0 0 20px rgba(0,0,0,0.1);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
#logo-preview {
|
| 32 |
+
max-width: 150px;
|
| 33 |
+
max-height: 80px;
|
| 34 |
+
object-fit: contain;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.logo-upload-container {
|
| 38 |
+
border: 2px dashed #d1d5db;
|
| 39 |
+
border-radius: 0.5rem;
|
| 40 |
+
padding: 1rem;
|
| 41 |
+
text-align: center;
|
| 42 |
+
cursor: pointer;
|
| 43 |
+
transition: all 0.3s;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.logo-upload-container:hover {
|
| 47 |
+
border-color: #3b82f6;
|
| 48 |
+
background-color: #f8fafc;
|
| 49 |
+
}
|
| 50 |
+
</style>
|
| 51 |
+
</head>
|
| 52 |
+
<body class="bg-gray-100 min-h-screen">
|
| 53 |
+
<div class="container mx-auto px-4 py-8">
|
| 54 |
+
<div class="flex justify-between items-center mb-8">
|
| 55 |
+
<div class="flex items-center">
|
| 56 |
+
<h1 class="text-3xl font-bold text-gray-800">
|
| 57 |
+
<i class="fas fa-file-invoice-dollar mr-2 text-blue-600"></i>
|
| 58 |
+
Invoice Generator
|
| 59 |
+
</h1>
|
| 60 |
+
<button id="theme-toggle" type="button" class="ml-4 p-2 rounded-full bg-gray-200 text-gray-700">
|
| 61 |
+
<i id="theme-icon" class="fas fa-moon"></i>
|
| 62 |
+
</button>
|
| 63 |
+
</div>
|
| 64 |
+
<button id="preview-btn" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition flex items-center">
|
| 65 |
+
<i class="fas fa-eye mr-2"></i> Preview Invoice
|
| 66 |
+
</button>
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
| 70 |
+
<!-- Invoice Form -->
|
| 71 |
+
<div class="lg:col-span-2 bg-white rounded-xl shadow-md p-6">
|
| 72 |
+
<h2 class="text-xl font-semibold mb-4 text-gray-800">Invoice Details</h2>
|
| 73 |
+
|
| 74 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
|
| 75 |
+
<div>
|
| 76 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Invoice Number</label>
|
| 77 |
+
<input type="text" id="invoice-number" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" value="INV-0001">
|
| 78 |
+
</div>
|
| 79 |
+
<div>
|
| 80 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Date</label>
|
| 81 |
+
<input type="date" id="invoice-date" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 82 |
+
</div>
|
| 83 |
+
<div>
|
| 84 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Due Date</label>
|
| 85 |
+
<input type="date" id="due-date" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 86 |
+
</div>
|
| 87 |
+
<div>
|
| 88 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Currency</label>
|
| 89 |
+
<select id="currency" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 90 |
+
<option value="TSh">Tanzania (TSh)</option>
|
| 91 |
+
<option value="KSh">Kenya (KSh)</option>
|
| 92 |
+
<option value="USh">Uganda (USh)</option>
|
| 93 |
+
<option value="RF">Rwanda (RF)</option>
|
| 94 |
+
<option value="FBu">Burundi (FBu)</option>
|
| 95 |
+
<option value="$">USD ($)</option>
|
| 96 |
+
<option value="€">EUR (€)</option>
|
| 97 |
+
<option value="£">GBP (£)</option>
|
| 98 |
+
</select>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
|
| 102 |
+
<!-- Logo Upload -->
|
| 103 |
+
<div class="mb-6">
|
| 104 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Company Logo</label>
|
| 105 |
+
<div id="logo-upload" class="logo-upload-container">
|
| 106 |
+
<div id="logo-upload-placeholder" class="flex flex-col items-center justify-center">
|
| 107 |
+
<i class="fas fa-image text-3xl text-gray-400 mb-2"></i>
|
| 108 |
+
<p class="text-sm text-gray-500">Click to upload logo</p>
|
| 109 |
+
<p class="text-xs text-gray-400">(Recommended: 300x100px)</p>
|
| 110 |
+
</div>
|
| 111 |
+
<img id="logo-preview" class="hidden mx-auto mb-2" alt="Logo Preview">
|
| 112 |
+
<input type="file" id="logo-input" accept="image/*" class="hidden">
|
| 113 |
+
</div>
|
| 114 |
+
<button id="remove-logo-btn" class="mt-2 text-sm text-red-600 hover:text-red-800 hidden">
|
| 115 |
+
<i class="fas fa-trash mr-1"></i> Remove Logo
|
| 116 |
+
</button>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
|
| 120 |
+
<!-- From Section -->
|
| 121 |
+
<div>
|
| 122 |
+
<h3 class="text-lg font-medium mb-2 text-gray-800 flex items-center">
|
| 123 |
+
<i class="fas fa-building mr-2 text-blue-600"></i> From
|
| 124 |
+
</h3>
|
| 125 |
+
<div class="space-y-3">
|
| 126 |
+
<div>
|
| 127 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Business Name</label>
|
| 128 |
+
<input type="text" id="from-name" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" value="Your Company Name">
|
| 129 |
+
</div>
|
| 130 |
+
<div>
|
| 131 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Email</label>
|
| 132 |
+
<input type="email" id="from-email" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" value="contact@yourcompany.com">
|
| 133 |
+
</div>
|
| 134 |
+
<div>
|
| 135 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Phone</label>
|
| 136 |
+
<input type="text" id="from-phone" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" value="+255 123 456 789">
|
| 137 |
+
</div>
|
| 138 |
+
<div>
|
| 139 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Address</label>
|
| 140 |
+
<textarea id="from-address" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">123 Business St, Dar es Salaam
|
| 141 |
+
Tanzania</textarea>
|
| 142 |
+
</div>
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
|
| 146 |
+
<!-- To Section -->
|
| 147 |
+
<div>
|
| 148 |
+
<h3 class="text-lg font-medium mb-2 text-gray-800 flex items-center">
|
| 149 |
+
<i class="fas fa-user-tie mr-2 text-blue-600"></i> To
|
| 150 |
+
</h3>
|
| 151 |
+
<div class="space-y-3">
|
| 152 |
+
<div>
|
| 153 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Client Name</label>
|
| 154 |
+
<input type="text" id="to-name" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" value="Client Name">
|
| 155 |
+
</div>
|
| 156 |
+
<div>
|
| 157 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Email</label>
|
| 158 |
+
<input type="email" id="to-email" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" value="client@example.com">
|
| 159 |
+
</div>
|
| 160 |
+
<div>
|
| 161 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Phone</label>
|
| 162 |
+
<input type="text" id="to-phone" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" value="+255 987 654 321">
|
| 163 |
+
</div>
|
| 164 |
+
<div>
|
| 165 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Address</label>
|
| 166 |
+
<textarea id="to-address" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">456 Client Ave, Dar es Salaam
|
| 167 |
+
Tanzania</textarea>
|
| 168 |
+
</div>
|
| 169 |
+
</div>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
|
| 173 |
+
<!-- Items Section -->
|
| 174 |
+
<div class="mb-6">
|
| 175 |
+
<div class="flex justify-between items-center mb-4">
|
| 176 |
+
<h3 class="text-lg font-medium text-gray-800 flex items-center">
|
| 177 |
+
<i class="fas fa-list-ul mr-2 text-blue-600"></i> Items
|
| 178 |
+
</h3>
|
| 179 |
+
<button id="add-item-btn" class="bg-green-600 hover:bg-green-700 text-white font-medium py-1 px-3 rounded-md text-sm transition flex items-center">
|
| 180 |
+
<i class="fas fa-plus mr-1"></i> Add Item
|
| 181 |
+
</button>
|
| 182 |
+
</div>
|
| 183 |
+
|
| 184 |
+
<div id="invoice-items" class="space-y-4">
|
| 185 |
+
<!-- Item template will be added here -->
|
| 186 |
+
</div>
|
| 187 |
+
|
| 188 |
+
<div class="mt-6 grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 189 |
+
<div>
|
| 190 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Notes</label>
|
| 191 |
+
<textarea id="notes" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">Thank you for your business!</textarea>
|
| 192 |
+
</div>
|
| 193 |
+
<div>
|
| 194 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Terms</label>
|
| 195 |
+
<textarea id="terms" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">Payment due within 15 days. Late payments subject to 5% fee.</textarea>
|
| 196 |
+
</div>
|
| 197 |
+
</div>
|
| 198 |
+
</div>
|
| 199 |
+
</div>
|
| 200 |
+
|
| 201 |
+
<!-- Preview Section -->
|
| 202 |
+
<div class="lg:col-span-1">
|
| 203 |
+
<div class="bg-white rounded-xl shadow-md p-6 sticky top-6">
|
| 204 |
+
<h2 class="text-xl font-semibold mb-4 text-gray-800">Invoice Summary</h2>
|
| 205 |
+
|
| 206 |
+
<div class="space-y-4">
|
| 207 |
+
<div class="flex justify-between">
|
| 208 |
+
<span class="text-gray-600">Subtotal:</span>
|
| 209 |
+
<span id="subtotal" class="font-medium">0.00</span>
|
| 210 |
+
</div>
|
| 211 |
+
<div class="flex justify-between">
|
| 212 |
+
<span class="text-gray-600">Tax (%):</span>
|
| 213 |
+
<div class="flex items-center">
|
| 214 |
+
<input type="number" id="tax-rate" min="0" max="100" value="18" class="w-16 px-2 py-1 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 215 |
+
<span class="ml-2">%</span>
|
| 216 |
+
</div>
|
| 217 |
+
</div>
|
| 218 |
+
<div class="flex justify-between">
|
| 219 |
+
<span class="text-gray-600">Tax Amount:</span>
|
| 220 |
+
<span id="tax-amount" class="font-medium">0.00</span>
|
| 221 |
+
</div>
|
| 222 |
+
<div class="border-t border-gray-200 pt-2">
|
| 223 |
+
<div class="flex justify-between font-bold text-lg">
|
| 224 |
+
<span>Total:</span>
|
| 225 |
+
<span id="total" class="text-blue-600">0.00</span>
|
| 226 |
+
</div>
|
| 227 |
+
</div>
|
| 228 |
+
</div>
|
| 229 |
+
|
| 230 |
+
<div class="mt-6 space-y-3">
|
| 231 |
+
<button id="download-pdf-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-md transition flex items-center justify-center">
|
| 232 |
+
<i class="fas fa-file-pdf mr-2"></i> Download PDF
|
| 233 |
+
</button>
|
| 234 |
+
<button id="download-png-btn" class="w-full bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium py-2 px-4 rounded-md transition flex items-center justify-center">
|
| 235 |
+
<i class="fas fa-image mr-2"></i> Download PNG
|
| 236 |
+
</button>
|
| 237 |
+
<button id="copy-link-btn" class="w-full bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium py-2 px-4 rounded-md transition flex items-center justify-center">
|
| 238 |
+
<i class="fas fa-link mr-2"></i> Copy Share Link
|
| 239 |
+
</button>
|
| 240 |
+
</div>
|
| 241 |
+
</div>
|
| 242 |
+
</div>
|
| 243 |
+
</div>
|
| 244 |
+
</div>
|
| 245 |
+
|
| 246 |
+
<!-- Preview Modal -->
|
| 247 |
+
<div id="preview-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
|
| 248 |
+
<div class="bg-white rounded-xl shadow-xl max-w-4xl w-full max-h-[90vh] overflow-auto">
|
| 249 |
+
<div class="flex justify-between items-center border-b border-gray-200 p-4">
|
| 250 |
+
<h3 class="text-xl font-semibold text-gray-800">Invoice Preview</h3>
|
| 251 |
+
<button id="close-preview-btn" class="text-gray-500 hover:text-gray-700">
|
| 252 |
+
<i class="fas fa-times"></i>
|
| 253 |
+
</button>
|
| 254 |
+
</div>
|
| 255 |
+
<div class="p-6">
|
| 256 |
+
<div id="invoice-preview" class="p-8 mx-auto">
|
| 257 |
+
<!-- Invoice preview will be rendered here -->
|
| 258 |
+
</div>
|
| 259 |
+
</div>
|
| 260 |
+
<div class="border-t border-gray-200 p-4 flex justify-end">
|
| 261 |
+
<button id="download-from-preview-btn" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-md transition flex items-center">
|
| 262 |
+
<i class="fas fa-download mr-2"></i> Download
|
| 263 |
+
</button>
|
| 264 |
+
</div>
|
| 265 |
+
</div>
|
| 266 |
+
</div>
|
| 267 |
+
|
| 268 |
+
<script>
|
| 269 |
+
// Set today's date as default
|
| 270 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 271 |
+
const today = new Date().toISOString().split('T')[0];
|
| 272 |
+
document.getElementById('invoice-date').value = today;
|
| 273 |
+
|
| 274 |
+
// Set due date to 15 days from today
|
| 275 |
+
const dueDate = new Date();
|
| 276 |
+
dueDate.setDate(dueDate.getDate() + 15);
|
| 277 |
+
document.getElementById('due-date').value = dueDate.toISOString().split('T')[0];
|
| 278 |
+
|
| 279 |
+
// Initialize invoice items
|
| 280 |
+
addInvoiceItem();
|
| 281 |
+
|
| 282 |
+
// Theme toggle functionality
|
| 283 |
+
const themeToggle = document.getElementById('theme-toggle');
|
| 284 |
+
const themeIcon = document.getElementById('theme-icon');
|
| 285 |
+
|
| 286 |
+
themeToggle.addEventListener('click', function() {
|
| 287 |
+
document.documentElement.classList.toggle('dark');
|
| 288 |
+
|
| 289 |
+
if (document.documentElement.classList.contains('dark')) {
|
| 290 |
+
themeIcon.classList.remove('fa-moon');
|
| 291 |
+
themeIcon.classList.add('fa-sun');
|
| 292 |
+
localStorage.setItem('theme', 'dark');
|
| 293 |
+
} else {
|
| 294 |
+
themeIcon.classList.remove('fa-sun');
|
| 295 |
+
themeIcon.classList.add('fa-moon');
|
| 296 |
+
localStorage.setItem('theme', 'light');
|
| 297 |
+
}
|
| 298 |
+
});
|
| 299 |
+
|
| 300 |
+
// Check for saved theme preference
|
| 301 |
+
if (localStorage.getItem('theme') === 'dark') {
|
| 302 |
+
document.documentElement.classList.add('dark');
|
| 303 |
+
themeIcon.classList.remove('fa-moon');
|
| 304 |
+
themeIcon.classList.add('fa-sun');
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
// Logo upload functionality
|
| 308 |
+
const logoUpload = document.getElementById('logo-upload');
|
| 309 |
+
const logoInput = document.getElementById('logo-input');
|
| 310 |
+
const logoPreview = document.getElementById('logo-preview');
|
| 311 |
+
const logoPlaceholder = document.getElementById('logo-upload-placeholder');
|
| 312 |
+
const removeLogoBtn = document.getElementById('remove-logo-btn');
|
| 313 |
+
|
| 314 |
+
logoUpload.addEventListener('click', function() {
|
| 315 |
+
logoInput.click();
|
| 316 |
+
});
|
| 317 |
+
|
| 318 |
+
logoInput.addEventListener('change', function(e) {
|
| 319 |
+
if (e.target.files.length) {
|
| 320 |
+
const reader = new FileReader();
|
| 321 |
+
reader.onload = function(event) {
|
| 322 |
+
logoPreview.src = event.target.result;
|
| 323 |
+
logoPreview.classList.remove('hidden');
|
| 324 |
+
logoPlaceholder.classList.add('hidden');
|
| 325 |
+
removeLogoBtn.classList.remove('hidden');
|
| 326 |
+
};
|
| 327 |
+
reader.readAsDataURL(e.target.files[0]);
|
| 328 |
+
}
|
| 329 |
+
});
|
| 330 |
+
|
| 331 |
+
removeLogoBtn.addEventListener('click', function(e) {
|
| 332 |
+
e.stopPropagation();
|
| 333 |
+
logoPreview.src = '';
|
| 334 |
+
logoPreview.classList.add('hidden');
|
| 335 |
+
logoPlaceholder.classList.remove('hidden');
|
| 336 |
+
removeLogoBtn.classList.add('hidden');
|
| 337 |
+
logoInput.value = '';
|
| 338 |
+
});
|
| 339 |
+
|
| 340 |
+
// Preview button functionality
|
| 341 |
+
const previewBtn = document.getElementById('preview-btn');
|
| 342 |
+
const previewModal = document.getElementById('preview-modal');
|
| 343 |
+
const closePreviewBtn = document.getElementById('close-preview-btn');
|
| 344 |
+
|
| 345 |
+
previewBtn.addEventListener('click', function() {
|
| 346 |
+
renderInvoicePreview();
|
| 347 |
+
previewModal.classList.remove('hidden');
|
| 348 |
+
});
|
| 349 |
+
|
| 350 |
+
closePreviewBtn.addEventListener('click', function() {
|
| 351 |
+
previewModal.classList.add('hidden');
|
| 352 |
+
});
|
| 353 |
+
|
| 354 |
+
// Close modal when clicking outside
|
| 355 |
+
previewModal.addEventListener('click', function(e) {
|
| 356 |
+
if (e.target === previewModal) {
|
| 357 |
+
previewModal.classList.add('hidden');
|
| 358 |
+
}
|
| 359 |
+
});
|
| 360 |
+
|
| 361 |
+
// Download buttons functionality
|
| 362 |
+
const downloadPdfBtn = document.getElementById('download-pdf-btn');
|
| 363 |
+
const downloadPngBtn = document.getElementById('download-png-btn');
|
| 364 |
+
const downloadFromPreviewBtn = document.getElementById('download-from-preview-btn');
|
| 365 |
+
|
| 366 |
+
downloadPdfBtn.addEventListener('click', generatePdf);
|
| 367 |
+
downloadPngBtn.addEventListener('click', generatePng);
|
| 368 |
+
downloadFromPreviewBtn.addEventListener('click', generatePdf);
|
| 369 |
+
|
| 370 |
+
// Copy link button functionality
|
| 371 |
+
document.getElementById('copy-link-btn').addEventListener('click', function() {
|
| 372 |
+
// In a real app, this would generate a shareable link
|
| 373 |
+
alert('Share link copied to clipboard!');
|
| 374 |
+
});
|
| 375 |
+
});
|
| 376 |
+
|
| 377 |
+
// Invoice item template
|
| 378 |
+
function getInvoiceItemTemplate(index = 0) {
|
| 379 |
+
return `
|
| 380 |
+
<div class="invoice-item bg-gray-50 p-4 rounded-lg border border-gray-200" data-index="${index}">
|
| 381 |
+
<div class="grid grid-cols-12 gap-3">
|
| 382 |
+
<div class="col-span-12 md:col-span-5">
|
| 383 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
| 384 |
+
<input type="text" class="item-description w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Item description">
|
| 385 |
+
</div>
|
| 386 |
+
<div class="col-span-6 md:col-span-2">
|
| 387 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Quantity</label>
|
| 388 |
+
<input type="number" min="1" value="1" class="item-quantity w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 389 |
+
</div>
|
| 390 |
+
<div class="col-span-6 md:col-span-2">
|
| 391 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Price</label>
|
| 392 |
+
<input type="number" min="0" step="0.01" value="0.00" class="item-price w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 393 |
+
</div>
|
| 394 |
+
<div class="col-span-9 md:col-span-2">
|
| 395 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Amount</label>
|
| 396 |
+
<input type="text" class="item-amount w-full px-3 py-2 border border-gray-300 rounded-md bg-gray-100 font-medium" readonly>
|
| 397 |
+
</div>
|
| 398 |
+
<div class="col-span-3 md:col-span-1 flex items-end">
|
| 399 |
+
<button class="remove-item-btn w-full py-2 text-red-600 hover:text-red-800">
|
| 400 |
+
<i class="fas fa-trash"></i>
|
| 401 |
+
</button>
|
| 402 |
+
</div>
|
| 403 |
+
</div>
|
| 404 |
+
</div>
|
| 405 |
+
`;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
// Add new invoice item
|
| 409 |
+
function addInvoiceItem() {
|
| 410 |
+
const itemsContainer = document.getElementById('invoice-items');
|
| 411 |
+
const index = itemsContainer.children.length;
|
| 412 |
+
const itemTemplate = getInvoiceItemTemplate(index);
|
| 413 |
+
|
| 414 |
+
itemsContainer.insertAdjacentHTML('beforeend', itemTemplate);
|
| 415 |
+
|
| 416 |
+
// Add event listeners to the new item
|
| 417 |
+
const newItem = itemsContainer.lastElementChild;
|
| 418 |
+
const quantityInput = newItem.querySelector('.item-quantity');
|
| 419 |
+
const priceInput = newItem.querySelector('.item-price');
|
| 420 |
+
const amountInput = newItem.querySelector('.item-amount');
|
| 421 |
+
const removeBtn = newItem.querySelector('.remove-item-btn');
|
| 422 |
+
|
| 423 |
+
quantityInput.addEventListener('input', calculateItemAmount);
|
| 424 |
+
priceInput.addEventListener('input', calculateItemAmount);
|
| 425 |
+
|
| 426 |
+
removeBtn.addEventListener('click', function() {
|
| 427 |
+
newItem.remove();
|
| 428 |
+
calculateInvoiceTotal();
|
| 429 |
+
});
|
| 430 |
+
|
| 431 |
+
// Calculate initial amount
|
| 432 |
+
calculateItemAmount.call(quantityInput);
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
// Calculate item amount
|
| 436 |
+
function calculateItemAmount() {
|
| 437 |
+
const item = this.closest('.invoice-item');
|
| 438 |
+
const quantity = parseFloat(item.querySelector('.item-quantity').value) || 0;
|
| 439 |
+
const price = parseFloat(item.querySelector('.item-price').value) || 0;
|
| 440 |
+
const amount = quantity * price;
|
| 441 |
+
|
| 442 |
+
item.querySelector('.item-amount').value = amount.toFixed(2);
|
| 443 |
+
calculateInvoiceTotal();
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
// Calculate invoice total
|
| 447 |
+
function calculateInvoiceTotal() {
|
| 448 |
+
const items = document.querySelectorAll('.invoice-item');
|
| 449 |
+
let subtotal = 0;
|
| 450 |
+
|
| 451 |
+
items.forEach(item => {
|
| 452 |
+
const amount = parseFloat(item.querySelector('.item-amount').value) || 0;
|
| 453 |
+
subtotal += amount;
|
| 454 |
+
});
|
| 455 |
+
|
| 456 |
+
const taxRate = parseFloat(document.getElementById('tax-rate').value) || 0;
|
| 457 |
+
const taxAmount = subtotal * (taxRate / 100);
|
| 458 |
+
const total = subtotal + taxAmount;
|
| 459 |
+
|
| 460 |
+
document.getElementById('subtotal').textContent = subtotal.toFixed(2);
|
| 461 |
+
document.getElementById('tax-amount').textContent = taxAmount.toFixed(2);
|
| 462 |
+
document.getElementById('total').textContent = total.toFixed(2);
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
// Add item button
|
| 466 |
+
document.getElementById('add-item-btn').addEventListener('click', addInvoiceItem);
|
| 467 |
+
|
| 468 |
+
// Tax rate change
|
| 469 |
+
document.getElementById('tax-rate').addEventListener('input', calculateInvoiceTotal);
|
| 470 |
+
|
| 471 |
+
// Render invoice preview
|
| 472 |
+
function renderInvoicePreview() {
|
| 473 |
+
const previewContainer = document.getElementById('invoice-preview');
|
| 474 |
+
const currency = document.getElementById('currency').value;
|
| 475 |
+
const invoiceNumber = document.getElementById('invoice-number').value;
|
| 476 |
+
const invoiceDate = document.getElementById('invoice-date').value;
|
| 477 |
+
const dueDate = document.getElementById('due-date').value;
|
| 478 |
+
const fromName = document.getElementById('from-name').value;
|
| 479 |
+
const fromEmail = document.getElementById('from-email').value;
|
| 480 |
+
const fromPhone = document.getElementById('from-phone').value;
|
| 481 |
+
const fromAddress = document.getElementById('from-address').value;
|
| 482 |
+
const toName = document.getElementById('to-name').value;
|
| 483 |
+
const toEmail = document.getElementById('to-email').value;
|
| 484 |
+
const toPhone = document.getElementById('to-phone').value;
|
| 485 |
+
const toAddress = document.getElementById('to-address').value;
|
| 486 |
+
const notes = document.getElementById('notes').value;
|
| 487 |
+
const terms = document.getElementById('terms').value;
|
| 488 |
+
const subtotal = document.getElementById('subtotal').textContent;
|
| 489 |
+
const taxAmount = document.getElementById('tax-amount').textContent;
|
| 490 |
+
const total = document.getElementById('total').textContent;
|
| 491 |
+
const taxRate = document.getElementById('tax-rate').value;
|
| 492 |
+
|
| 493 |
+
// Format dates
|
| 494 |
+
const formattedInvoiceDate = formatDate(invoiceDate);
|
| 495 |
+
const formattedDueDate = formatDate(dueDate);
|
| 496 |
+
|
| 497 |
+
// Get items
|
| 498 |
+
let itemsHtml = '';
|
| 499 |
+
document.querySelectorAll('.invoice-item').forEach(item => {
|
| 500 |
+
const description = item.querySelector('.item-description').value;
|
| 501 |
+
const quantity = item.querySelector('.item-quantity').value;
|
| 502 |
+
const price = parseFloat(item.querySelector('.item-price').value).toFixed(2);
|
| 503 |
+
const amount = item.querySelector('.item-amount').value;
|
| 504 |
+
|
| 505 |
+
itemsHtml += `
|
| 506 |
+
<tr class="border-b border-gray-200">
|
| 507 |
+
<td class="py-3 px-2">${description || 'No description'}</td>
|
| 508 |
+
<td class="py-3 px-2 text-right">${quantity}</td>
|
| 509 |
+
<td class="py-3 px-2 text-right">${currency} ${price}</td>
|
| 510 |
+
<td class="py-3 px-2 text-right">${currency} ${amount}</td>
|
| 511 |
+
</tr>
|
| 512 |
+
`;
|
| 513 |
+
});
|
| 514 |
+
|
| 515 |
+
// Check if logo exists
|
| 516 |
+
const logoPreview = document.getElementById('logo-preview');
|
| 517 |
+
let logoHtml = '';
|
| 518 |
+
if (!logoPreview.classList.contains('hidden')) {
|
| 519 |
+
logoHtml = `<img src="${logoPreview.src}" alt="Company Logo" class="h-16">`;
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
// Generate preview HTML
|
| 523 |
+
previewContainer.innerHTML = `
|
| 524 |
+
<div class="max-w-4xl mx-auto">
|
| 525 |
+
<div class="flex justify-between items-start mb-8">
|
| 526 |
+
<div>
|
| 527 |
+
${logoHtml}
|
| 528 |
+
<h1 class="text-3xl font-bold text-gray-800 mt-4">INVOICE</h1>
|
| 529 |
+
</div>
|
| 530 |
+
<div class="text-right">
|
| 531 |
+
<p class="text-lg font-semibold">${fromName}</p>
|
| 532 |
+
<p class="text-sm text-gray-600">${fromAddress.replace(/\n/g, '<br>')}</p>
|
| 533 |
+
<p class="text-sm text-gray-600 mt-2">${fromEmail}</p>
|
| 534 |
+
<p class="text-sm text-gray-600">${fromPhone}</p>
|
| 535 |
+
</div>
|
| 536 |
+
</div>
|
| 537 |
+
|
| 538 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
|
| 539 |
+
<div>
|
| 540 |
+
<h2 class="text-sm font-semibold text-gray-500 uppercase mb-2">Bill To</h2>
|
| 541 |
+
<p class="font-medium">${toName}</p>
|
| 542 |
+
<p class="text-sm text-gray-600">${toAddress.replace(/\n/g, '<br>')}</p>
|
| 543 |
+
<p class="text-sm text-gray-600 mt-2">${toEmail}</p>
|
| 544 |
+
<p class="text-sm text-gray-600">${toPhone}</p>
|
| 545 |
+
</div>
|
| 546 |
+
<div>
|
| 547 |
+
<div class="grid grid-cols-2 gap-4">
|
| 548 |
+
<div>
|
| 549 |
+
<h2 class="text-sm font-semibold text-gray-500 uppercase mb-2">Invoice #</h2>
|
| 550 |
+
<p>${invoiceNumber}</p>
|
| 551 |
+
</div>
|
| 552 |
+
<div>
|
| 553 |
+
<h2 class="text-sm font-semibold text-gray-500 uppercase mb-2">Date</h2>
|
| 554 |
+
<p>${formattedInvoiceDate}</p>
|
| 555 |
+
</div>
|
| 556 |
+
<div>
|
| 557 |
+
<h2 class="text-sm font-semibold text-gray-500 uppercase mb-2">Due Date</h2>
|
| 558 |
+
<p>${formattedDueDate}</p>
|
| 559 |
+
</div>
|
| 560 |
+
<div>
|
| 561 |
+
<h2 class="text-sm font-semibold text-gray-500 uppercase mb-2">Currency</h2>
|
| 562 |
+
<p>${currency}</p>
|
| 563 |
+
</div>
|
| 564 |
+
</div>
|
| 565 |
+
</div>
|
| 566 |
+
</div>
|
| 567 |
+
|
| 568 |
+
<div class="mb-8">
|
| 569 |
+
<table class="w-full">
|
| 570 |
+
<thead>
|
| 571 |
+
<tr class="border-b border-gray-200 text-left">
|
| 572 |
+
<th class="py-2 px-2 font-semibold">Description</th>
|
| 573 |
+
<th class="py-2 px-2 font-semibold text-right">Qty</th>
|
| 574 |
+
<th class="py-2 px-2 font-semibold text-right">Price</th>
|
| 575 |
+
<th class="py-2 px-2 font-semibold text-right">Amount</th>
|
| 576 |
+
</tr>
|
| 577 |
+
</thead>
|
| 578 |
+
<tbody>
|
| 579 |
+
${itemsHtml}
|
| 580 |
+
</tbody>
|
| 581 |
+
</table>
|
| 582 |
+
</div>
|
| 583 |
+
|
| 584 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
|
| 585 |
+
<div>
|
| 586 |
+
<h2 class="text-sm font-semibold text-gray-500 uppercase mb-2">Notes</h2>
|
| 587 |
+
<p class="text-gray-600">${notes}</p>
|
| 588 |
+
|
| 589 |
+
<h2 class="text-sm font-semibold text-gray-500 uppercase mb-2 mt-4">Terms</h2>
|
| 590 |
+
<p class="text-gray-600">${terms}</p>
|
| 591 |
+
</div>
|
| 592 |
+
<div>
|
| 593 |
+
<div class="ml-auto max-w-xs">
|
| 594 |
+
<div class="flex justify-between py-2">
|
| 595 |
+
<span class="text-gray-600">Subtotal:</span>
|
| 596 |
+
<span class="font-medium">${currency} ${subtotal}</span>
|
| 597 |
+
</div>
|
| 598 |
+
<div class="flex justify-between py-2">
|
| 599 |
+
<span class="text-gray-600">Tax (${taxRate}%):</span>
|
| 600 |
+
<span class="font-medium">${currency} ${taxAmount}</span>
|
| 601 |
+
</div>
|
| 602 |
+
<div class="flex justify-between py-2 border-t border-gray-200 font-bold text-lg">
|
| 603 |
+
<span>Total:</span>
|
| 604 |
+
<span>${currency} ${total}</span>
|
| 605 |
+
</div>
|
| 606 |
+
</div>
|
| 607 |
+
</div>
|
| 608 |
+
</div>
|
| 609 |
+
</div>
|
| 610 |
+
`;
|
| 611 |
+
}
|
| 612 |
+
|
| 613 |
+
// Format date
|
| 614 |
+
function formatDate(dateString) {
|
| 615 |
+
if (!dateString) return '';
|
| 616 |
+
|
| 617 |
+
const options = { year: 'numeric', month: 'short', day: 'numeric' };
|
| 618 |
+
const date = new Date(dateString);
|
| 619 |
+
return date.toLocaleDateString('en-US', options);
|
| 620 |
+
}
|
| 621 |
+
|
| 622 |
+
// Generate PDF
|
| 623 |
+
function generatePdf() {
|
| 624 |
+
const { jsPDF } = window.jspdf;
|
| 625 |
+
const doc = new jsPDF('p', 'pt', 'a4');
|
| 626 |
+
const preview = document.getElementById('invoice-preview');
|
| 627 |
+
|
| 628 |
+
html2canvas(preview, {
|
| 629 |
+
scale: 2,
|
| 630 |
+
logging: false,
|
| 631 |
+
useCORS: true
|
| 632 |
+
}).then(canvas => {
|
| 633 |
+
const imgData = canvas.toDataURL('image/png');
|
| 634 |
+
const imgWidth = doc.internal.pageSize.getWidth() - 40;
|
| 635 |
+
const imgHeight = (canvas.height * imgWidth) / canvas.width;
|
| 636 |
+
|
| 637 |
+
doc.addImage(imgData, 'PNG', 20, 20, imgWidth, imgHeight);
|
| 638 |
+
|
| 639 |
+
// Get invoice number for filename
|
| 640 |
+
const invoiceNumber = document.getElementById('invoice-number').value || 'invoice';
|
| 641 |
+
doc.save(`${invoiceNumber}.pdf`);
|
| 642 |
+
});
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
// Generate PNG
|
| 646 |
+
function generatePng() {
|
| 647 |
+
const preview = document.getElementById('invoice-preview');
|
| 648 |
+
|
| 649 |
+
html2canvas(preview, {
|
| 650 |
+
scale: 2,
|
| 651 |
+
logging: false,
|
| 652 |
+
useCORS: true
|
| 653 |
+
}).then(canvas => {
|
| 654 |
+
const link = document.createElement('a');
|
| 655 |
+
link.download = `${document.getElementById('invoice-number').value || 'invoice'}.png`;
|
| 656 |
+
link.href = canvas.toDataURL('image/png');
|
| 657 |
+
link.click();
|
| 658 |
+
});
|
| 659 |
+
}
|
| 660 |
+
</script>
|
| 661 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=THEMONEYHOLLIC/invoice-generator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 662 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
add east africans shillings, main should be TZS, but also add logo upoad make sure nothing is broken
|
| 2 |
+
add dark and light mode toogle make sure nothing is broken
|
| 3 |
+
litg mode doesnt work, make sure nothing is broken
|
| 4 |
+
please revert the all edits
|