fix: expense date timezone, receipt popup blocker
This commit is contained in:
@@ -269,16 +269,16 @@ export default function Invoices() {
|
||||
|
||||
const handleViewReceipt = async (expense) => {
|
||||
if (!expense.receipt_path) return;
|
||||
const { data, error } = await supabase.storage.from(RECEIPT_BUCKET).createSignedUrl(expense.receipt_path, 3600, {
|
||||
download: expense.receipt_name || undefined,
|
||||
});
|
||||
const win = window.open('', '_blank', 'noopener,noreferrer');
|
||||
const { data, error } = await supabase.storage.from(RECEIPT_BUCKET).createSignedUrl(expense.receipt_path, 3600);
|
||||
if (error || !data?.signedUrl) {
|
||||
win?.close();
|
||||
const message = error?.message || 'Failed to open receipt.';
|
||||
setExpensesError(message);
|
||||
alert(message);
|
||||
return;
|
||||
}
|
||||
window.open(data.signedUrl, '_blank', 'noopener,noreferrer');
|
||||
win.location.href = data.signedUrl;
|
||||
};
|
||||
|
||||
const updateSubcontractorPO = async (po, updates, errorLabel = 'Failed to update PO') => {
|
||||
@@ -1210,7 +1210,7 @@ export default function Invoices() {
|
||||
return exp[key] || '';
|
||||
}).map(exp => (
|
||||
<tr key={exp.id} style={{ cursor: 'pointer' }} onClick={() => startEditExpense(exp)}>
|
||||
<td>{new Date(exp.date).toLocaleDateString()}</td>
|
||||
<td>{new Date(exp.date + 'T12:00:00').toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })}</td>
|
||||
<td style={{ fontWeight: 400 }}>{exp.description}</td>
|
||||
<td>{exp.category}</td>
|
||||
<td style={{ color: 'var(--text-muted)' }}>
|
||||
|
||||
Reference in New Issue
Block a user