Add attachment support for fuel and recurring expenses with camera capture
Co-authored-by: aiulian25 <17886483+aiulian25@users.noreply.github.com>
This commit is contained in:
parent
339cd94b26
commit
8a5b916a39
8 changed files with 487 additions and 9 deletions
|
|
@ -254,7 +254,7 @@ function displayFuelRecords(records) {
|
|||
<td>${formatCurrency(r.cost, settings.currency)}</td>
|
||||
<td>${r.distance || 'N/A'}</td>
|
||||
<td>${r.fuel_economy ? r.fuel_economy.toFixed(2) : 'N/A'} ${r.unit}</td>
|
||||
<td>${r.notes && r.notes.startsWith('attachment:') ? `<a href="/api/attachments/download?path=${encodeURIComponent(r.notes.replace('attachment:', ''))}" class="btn" style="padding: 5px 10px; font-size: 12px;">Download</a>` : 'None'}</td>
|
||||
<td>${r.document_path ? `<a href="/api/attachments/download?path=${encodeURIComponent(r.document_path)}" class="btn" style="padding: 5px 10px; font-size: 12px;">Download</a>` : 'None'}</td>
|
||||
<td>
|
||||
<button onclick="editFuelRecord(${vehicleId}, ${r.id})" class="btn" style="padding: 5px 10px; font-size: 12px; margin-right: 5px;">Edit</button>
|
||||
<button onclick="deleteFuelRecord(${vehicleId}, ${r.id})" class="btn" style="padding: 5px 10px; font-size: 12px; background: #dc3545;">Delete</button>
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="fuel-attachment" data-translate="optional">Receipt (Optional)</label>
|
||||
<input type="file" id="fuel-attachment" name="attachment" accept=".pdf,.png,.jpg,.jpeg,.txt">
|
||||
<input type="file" id="fuel-attachment" name="attachment" accept="image/*,.pdf,.txt" capture="environment">
|
||||
<small data-translate="supported_files">Supported: PDF, Images, Text</small>
|
||||
</div>
|
||||
<div style="display: flex; gap: 10px; margin-top: 20px;">
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="service-attachment" data-translate="optional">Atasament (Optional)</label>
|
||||
<input type="file" id="service-attachment" name="attachment" accept=".pdf,.png,.jpg,.jpeg,.txt,.doc,.docx,.xls,.xlsx">
|
||||
<input type="file" id="service-attachment" name="attachment" accept="image/*,.pdf,.txt,.doc,.docx,.xls,.xlsx" capture="environment">
|
||||
<small data-translate="supported_files">Suportat: PDF, Imagini, Text, Word, Excel</small>
|
||||
</div>
|
||||
<div style="display: flex; gap: 10px; margin-top: 20px;">
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tax-attachment" data-translate="optional">Document (Optional)</label>
|
||||
<input type="file" id="tax-attachment" name="attachment" accept=".pdf,.png,.jpg,.jpeg,.txt,.doc,.docx">
|
||||
<input type="file" id="tax-attachment" name="attachment" accept="image/*,.pdf,.txt,.doc,.docx" capture="environment">
|
||||
<small data-translate="supported_files">Supported: PDF, Images, Text, Word</small>
|
||||
</div>
|
||||
<div style="display: flex; gap: 10px; margin-top: 20px;">
|
||||
|
|
@ -193,6 +193,7 @@
|
|||
<p><strong>Frequency:</strong> ${e.frequency}</p>
|
||||
<p><strong>Next Due:</strong> ${formatDate(e.next_due_date)}</p>
|
||||
<p style="color: var(--text-secondary); font-size: 14px;">${e.notes || ''}</p>
|
||||
${e.document_path ? `<p><strong>Attachment:</strong> <a href="/api/attachments/download?path=${encodeURIComponent(e.document_path)}" class="btn" style="padding: 5px 10px; font-size: 12px; display: inline-block; margin-top: 5px;">Download</a></p>` : ''}
|
||||
<button class="btn btn-danger" onclick="cancelRecurringExpense(${e.id})" style="margin-top: 10px;">
|
||||
Cancel Recurring
|
||||
</button>
|
||||
|
|
@ -291,7 +292,8 @@
|
|||
amount: parseFloat(document.getElementById('tax-amount').value),
|
||||
frequency: document.getElementById('tax-frequency').value,
|
||||
start_date: document.getElementById('tax-date').value,
|
||||
notes: document.getElementById('tax-notes').value || null
|
||||
notes: document.getElementById('tax-notes').value || null,
|
||||
document_path: attachmentPath
|
||||
};
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue