Tirvo commited on
Commit
a549b63
·
verified ·
1 Parent(s): 28c452e

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +380 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ji8g
3
- emoji: 🏆
4
- colorFrom: pink
5
- colorTo: green
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: ji8g
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: pink
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,380 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="pt-BR">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Fatura | Sua Empresa</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <script>
10
+ tailwind.config = {
11
+ theme: {
12
+ extend: {
13
+ colors: {
14
+ primary: '#4F46E5',
15
+ secondary: '#10B981',
16
+ dark: '#1F2937',
17
+ light: '#F9FAFB'
18
+ }
19
+ }
20
+ }
21
+ }
22
+ </script>
23
+ <style>
24
+ @media print {
25
+ .no-print {
26
+ display: none !important;
27
+ }
28
+ body {
29
+ padding: 0;
30
+ margin: 0;
31
+ }
32
+ }
33
+ .watermark {
34
+ position: absolute;
35
+ opacity: 0.1;
36
+ font-size: 5rem;
37
+ width: 100%;
38
+ text-align: center;
39
+ z-index: -1;
40
+ transform: rotate(-30deg);
41
+ top: 50%;
42
+ left: 0;
43
+ }
44
+ </style>
45
+ </head>
46
+ <body class="bg-gray-50 font-sans">
47
+ <div class="max-w-4xl mx-auto p-6">
48
+ <!-- Header with action buttons -->
49
+ <div class="flex justify-between items-center mb-8 no-print">
50
+ <h1 class="text-2xl font-bold text-dark">Gerador de Fatura</h1>
51
+ <div class="space-x-2">
52
+ <button onclick="window.print()" class="bg-primary hover:bg-primary/90 text-white px-4 py-2 rounded-lg flex items-center">
53
+ <i class="fas fa-print mr-2"></i> Imprimir
54
+ </button>
55
+ <button onclick="generatePDF()" class="bg-secondary hover:bg-secondary/90 text-white px-4 py-2 rounded-lg flex items-center">
56
+ <i class="fas fa-file-pdf mr-2"></i> Gerar PDF
57
+ </button>
58
+ <button onclick="sendEmail()" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center">
59
+ <i class="fas fa-paper-plane mr-2"></i> Enviar por Email
60
+ </button>
61
+ </div>
62
+ </div>
63
+
64
+ <!-- Invoice Container -->
65
+ <div class="bg-white rounded-xl shadow-lg overflow-hidden border border-gray-200">
66
+ <!-- Invoice Header -->
67
+ <div class="bg-primary p-6 text-white">
68
+ <div class="flex justify-between items-start">
69
+ <div>
70
+ <h1 class="text-3xl font-bold">FATURA</h1>
71
+ <p class="text-primary-200 mt-1">Nº <span id="invoice-number">INV-2023-001</span></p>
72
+ </div>
73
+ <div class="text-right">
74
+ <img src="https://via.placeholder.com/150x50?text=Your+Logo" alt="Logo" class="h-12">
75
+ <p class="mt-2 text-primary-200">Sua Empresa LTDA</p>
76
+ </div>
77
+ </div>
78
+ </div>
79
+
80
+ <!-- Invoice Details -->
81
+ <div class="p-6 grid grid-cols-1 md:grid-cols-2 gap-8">
82
+ <!-- From -->
83
+ <div>
84
+ <h3 class="text-lg font-semibold text-dark mb-3">De:</h3>
85
+ <p class="font-bold">Sua Empresa LTDA</p>
86
+ <p>Rua Exemplo, 123</p>
87
+ <p>Centro, São Paulo - SP</p>
88
+ <p>CEP: 01000-000</p>
89
+ <p class="mt-2">CNPJ: 12.345.678/0001-90</p>
90
+ <p>IE: 123.456.789.111</p>
91
+ <p class="mt-2">Email: contato@suaempresa.com</p>
92
+ <p>Telefone: (11) 9999-9999</p>
93
+ </div>
94
+
95
+ <!-- To and Dates -->
96
+ <div>
97
+ <div class="mb-6">
98
+ <h3 class="text-lg font-semibold text-dark mb-3">Para:</h3>
99
+ <input type="text" id="client-name" placeholder="Nome do Cliente" class="w-full p-2 border border-gray-300 rounded mb-2">
100
+ <input type="text" id="client-document" placeholder="CPF/CNPJ" class="w-full p-2 border border-gray-300 rounded mb-2">
101
+ <textarea id="client-address" placeholder="Endereço completo" class="w-full p-2 border border-gray-300 rounded mb-2" rows="3"></textarea>
102
+ </div>
103
+
104
+ <div class="grid grid-cols-2 gap-4">
105
+ <div>
106
+ <label for="issue-date" class="block text-sm font-medium text-gray-700">Data de Emissão</label>
107
+ <input type="date" id="issue-date" class="w-full p-2 border border-gray-300 rounded">
108
+ </div>
109
+ <div>
110
+ <label for="due-date" class="block text-sm font-medium text-gray-700">Vencimento</label>
111
+ <input type="date" id="due-date" class="w-full p-2 border border-gray-300 rounded">
112
+ </div>
113
+ </div>
114
+ </div>
115
+ </div>
116
+
117
+ <!-- Items Table -->
118
+ <div class="px-6">
119
+ <div class="overflow-x-auto">
120
+ <table class="min-w-full divide-y divide-gray-200">
121
+ <thead class="bg-gray-50">
122
+ <tr>
123
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Item</th>
124
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Descrição</th>
125
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Quantidade</th>
126
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Preço Unit.</th>
127
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Total</th>
128
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider no-print">Ações</th>
129
+ </tr>
130
+ </thead>
131
+ <tbody id="items-table" class="bg-white divide-y divide-gray-200">
132
+ <!-- Items will be added here -->
133
+ </tbody>
134
+ </table>
135
+ </div>
136
+
137
+ <div class="mt-4 no-print">
138
+ <button onclick="addItem()" class="bg-primary hover:bg-primary/90 text-white px-4 py-2 rounded-lg flex items-center">
139
+ <i class="fas fa-plus mr-2"></i> Adicionar Item
140
+ </button>
141
+ </div>
142
+ </div>
143
+
144
+ <!-- Totals -->
145
+ <div class="p-6">
146
+ <div class="flex justify-end">
147
+ <div class="w-full md:w-1/3">
148
+ <div class="grid grid-cols-2 gap-2">
149
+ <div class="text-right font-medium">Subtotal:</div>
150
+ <div class="text-right" id="subtotal">R$ 0,00</div>
151
+
152
+ <div class="text-right font-medium">Desconto:</div>
153
+ <div class="text-right">
154
+ <input type="number" id="discount" value="0" min="0" step="0.01" class="w-full p-1 border border-gray-300 rounded text-right" onchange="calculateTotals()">
155
+ </div>
156
+
157
+ <div class="text-right font-medium">Taxas:</div>
158
+ <div class="text-right">
159
+ <input type="number" id="tax" value="0" min="0" step="0.01" class="w-full p-1 border border-gray-300 rounded text-right" onchange="calculateTotals()">
160
+ </div>
161
+
162
+ <div class="text-right font-bold text-lg border-t border-gray-300 pt-2">Total:</div>
163
+ <div class="text-right font-bold text-lg border-t border-gray-300 pt-2" id="total">R$ 0,00</div>
164
+ </div>
165
+ </div>
166
+ </div>
167
+ </div>
168
+
169
+ <!-- Payment Info -->
170
+ <div class="p-6 bg-gray-50 border-t border-gray-200">
171
+ <h3 class="text-lg font-semibold text-dark mb-3">Informações de Pagamento</h3>
172
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
173
+ <div>
174
+ <label for="payment-method" class="block text-sm font-medium text-gray-700">Método de Pagamento</label>
175
+ <select id="payment-method" class="mt-1 block w-full p-2 border border-gray-300 rounded-md">
176
+ <option value="bank-transfer">Transferência Bancária</option>
177
+ <option value="credit-card">Cartão de Crédito</option>
178
+ <option value="boleto">Boleto Bancário</option>
179
+ <option value="pix">PIX</option>
180
+ <option value="cash">Dinheiro</option>
181
+ </select>
182
+ </div>
183
+ <div>
184
+ <label for="payment-instructions" class="block text-sm font-medium text-gray-700">Instruções</label>
185
+ <textarea id="payment-instructions" class="mt-1 block w-full p-2 border border-gray-300 rounded-md" rows="3">
186
+ Banco: Banco do Brasil
187
+ Agência: 1234
188
+ Conta: 56789-0
189
+ Favorecido: Sua Empresa LTDA
190
+ CNPJ: 12.345.678/0001-90
191
+ </textarea>
192
+ </div>
193
+ </div>
194
+ </div>
195
+
196
+ <!-- Footer -->
197
+ <div class="p-6 bg-gray-100 text-center text-gray-600 text-sm">
198
+ <p>Agradecemos pela preferência! Em caso de dúvidas, entre em contato conosco.</p>
199
+ <p class="mt-1">contato@suaempresa.com | (11) 9999-9999</p>
200
+ <p class="mt-2">Este documento é válido sem assinatura conforme art. 7º da Lei nº 8.078/90</p>
201
+ </div>
202
+
203
+ <!-- Watermark (hidden by default) -->
204
+ <div id="watermark" class="watermark hidden">
205
+ <p>COPIA</p>
206
+ </div>
207
+ </div>
208
+
209
+ <!-- Email Modal -->
210
+ <div id="email-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
211
+ <div class="bg-white rounded-lg p-6 w-full max-w-md">
212
+ <div class="flex justify-between items-center mb-4">
213
+ <h3 class="text-xl font-bold">Enviar Fatura por Email</h3>
214
+ <button onclick="closeEmailModal()" class="text-gray-500 hover:text-gray-700">
215
+ <i class="fas fa-times"></i>
216
+ </button>
217
+ </div>
218
+ <div class="space-y-4">
219
+ <div>
220
+ <label for="email-to" class="block text-sm font-medium text-gray-700">Para:</label>
221
+ <input type="email" id="email-to" class="w-full p-2 border border-gray-300 rounded">
222
+ </div>
223
+ <div>
224
+ <label for="email-subject" class="block text-sm font-medium text-gray-700">Assunto:</label>
225
+ <input type="text" id="email-subject" value="Fatura Nº INV-2023-001" class="w-full p-2 border border-gray-300 rounded">
226
+ </div>
227
+ <div>
228
+ <label for="email-message" class="block text-sm font-medium text-gray-700">Mensagem:</label>
229
+ <textarea id="email-message" rows="4" class="w-full p-2 border border-gray-300 rounded">
230
+ Prezado(a),
231
+
232
+ Segue em anexo a fatura referente aos nossos serviços.
233
+
234
+ Agradecemos pela preferência!
235
+
236
+ Atenciosamente,
237
+ Sua Empresa
238
+ </textarea>
239
+ </div>
240
+ <div class="flex justify-end space-x-2 pt-2">
241
+ <button onclick="closeEmailModal()" class="px-4 py-2 border border-gray-300 rounded">Cancelar</button>
242
+ <button onclick="confirmSendEmail()" class="px-4 py-2 bg-primary text-white rounded">Enviar</button>
243
+ </div>
244
+ </div>
245
+ </div>
246
+ </div>
247
+ </div>
248
+
249
+ <script>
250
+ // Initialize invoice with one empty item
251
+ document.addEventListener('DOMContentLoaded', function() {
252
+ // Set default dates
253
+ const today = new Date();
254
+ document.getElementById('issue-date').valueAsDate = today;
255
+
256
+ const dueDate = new Date();
257
+ dueDate.setDate(today.getDate() + 7);
258
+ document.getElementById('due-date').valueAsDate = dueDate;
259
+
260
+ // Add first item
261
+ addItem();
262
+
263
+ // Generate random invoice number
264
+ document.getElementById('invoice-number').textContent = 'INV-' + today.getFullYear() + '-' + Math.floor(1000 + Math.random() * 9000);
265
+ });
266
+
267
+ // Add new item to the invoice
268
+ function addItem() {
269
+ const table = document.getElementById('items-table');
270
+ const rowCount = table.rows.length;
271
+
272
+ const row = table.insertRow();
273
+ row.className = 'item-row';
274
+
275
+ row.innerHTML = `
276
+ <td class="px-6 py-4 whitespace-nowrap">
277
+ <input type="text" class="item-name w-full p-1 border border-gray-300 rounded" placeholder="Serviço">
278
+ </td>
279
+ <td class="px-6 py-4 whitespace-nowrap">
280
+ <input type="text" class="item-description w-full p-1 border border-gray-300 rounded" placeholder="Descrição detalhada">
281
+ </td>
282
+ <td class="px-6 py-4 whitespace-nowrap">
283
+ <input type="number" class="item-quantity w-full p-1 border border-gray-300 rounded" value="1" min="1" onchange="calculateItemTotal(this)">
284
+ </td>
285
+ <td class="px-6 py-4 whitespace-nowrap">
286
+ <input type="number" class="item-price w-full p-1 border border-gray-300 rounded" value="0" min="0" step="0.01" onchange="calculateItemTotal(this)">
287
+ </td>
288
+ <td class="px-6 py-4 whitespace-nowrap item-total">
289
+ R$ 0,00
290
+ </td>
291
+ <td class="px-6 py-4 whitespace-nowrap no-print">
292
+ <button onclick="removeItem(this)" class="text-red-500 hover:text-red-700">
293
+ <i class="fas fa-trash"></i>
294
+ </button>
295
+ </td>
296
+ `;
297
+
298
+ calculateTotals();
299
+ }
300
+
301
+ // Remove item from invoice
302
+ function removeItem(button) {
303
+ const row = button.closest('tr');
304
+ row.remove();
305
+ calculateTotals();
306
+ }
307
+
308
+ // Calculate total for a single item
309
+ function calculateItemTotal(input) {
310
+ const row = input.closest('tr');
311
+ const quantity = parseFloat(row.querySelector('.item-quantity').value) || 0;
312
+ const price = parseFloat(row.querySelector('.item-price').value) || 0;
313
+ const total = quantity * price;
314
+
315
+ row.querySelector('.item-total').textContent = formatCurrency(total);
316
+ calculateTotals();
317
+ }
318
+
319
+ // Calculate all totals (subtotal, tax, discount, total)
320
+ function calculateTotals() {
321
+ let subtotal = 0;
322
+ const rows = document.querySelectorAll('.item-row');
323
+
324
+ rows.forEach(row => {
325
+ const totalText = row.querySelector('.item-total').textContent;
326
+ const totalValue = parseFloat(totalText.replace('R$', '').replace('.', '').replace(',', '.').trim()) || 0;
327
+ subtotal += totalValue;
328
+ });
329
+
330
+ const discount = parseFloat(document.getElementById('discount').value) || 0;
331
+ const tax = parseFloat(document.getElementById('tax').value) || 0;
332
+
333
+ const total = subtotal - discount + tax;
334
+
335
+ document.getElementById('subtotal').textContent = formatCurrency(subtotal);
336
+ document.getElementById('total').textContent = formatCurrency(total);
337
+ }
338
+
339
+ // Format number as currency
340
+ function formatCurrency(value) {
341
+ return 'R$ ' + value.toFixed(2).replace('.', ',').replace(/(\d)(?=(\d{3})+\,)/g, '$1.');
342
+ }
343
+
344
+ // Generate PDF (mock function)
345
+ function generatePDF() {
346
+ alert('Funcionalidade de PDF seria implementada com uma biblioteca como jsPDF ou similar.');
347
+ // In a real implementation, you would use jsPDF or similar library
348
+ // to generate a PDF version of the invoice
349
+ }
350
+
351
+ // Show email modal
352
+ function sendEmail() {
353
+ document.getElementById('email-modal').classList.remove('hidden');
354
+ }
355
+
356
+ // Close email modal
357
+ function closeEmailModal() {
358
+ document.getElementById('email-modal').classList.add('hidden');
359
+ }
360
+
361
+ // Confirm send email (mock function)
362
+ function confirmSendEmail() {
363
+ const to = document.getElementById('email-to').value;
364
+ if (!to) {
365
+ alert('Por favor, insira um endereço de email válido.');
366
+ return;
367
+ }
368
+
369
+ alert(`Fatura enviada para: ${to}\n\nEm uma implementação real, isso enviaria o email com a fatura anexada.`);
370
+ closeEmailModal();
371
+ }
372
+
373
+ // Toggle watermark for print
374
+ function toggleWatermark() {
375
+ const watermark = document.getElementById('watermark');
376
+ watermark.classList.toggle('hidden');
377
+ }
378
+ </script>
379
+ <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=Tirvo/ji8g" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
380
+ </html>