<%- include('partials/header', { title: 'Dashboard' }) %> <% if (error) { %>
<%= decodeURIComponent(error) %>
<% } %> <% if (success) { %>
<%= decodeURIComponent(success) %>
<% } %>
<% if (locals.activeView === 'account') { %>

My Account

<% if (user.profile_photo_path) { %> Profile Photo <% } else { %> <%= user.first_name.charAt(0).toUpperCase() %><%= user.last_name.charAt(0).toUpperCase() %> <% } %>
Card Reference ID
<%= user.card_last_digits %>
<% if (spending.limit > 0) { %> <% const CCpct = Math.min(100, (spending.total / spending.limit) * 100); const CCapprovedPct = Math.min(100, (spending.approved / spending.limit) * 100); const CCpendingPct = Math.min(100, (spending.pending / spending.limit) * 100); %>

Company Card Limit

<%= CCpct.toFixed(0) %> % used
Approved
$<%= spending.approved.toFixed(2) %>
Pending
$<%= spending.pending.toFixed(2) %>
Remaining
$<%= spending.remaining.toFixed(2) %>
Limit: $<%= spending.limit.toFixed(2) %>  ·  Card Used: $<%= spending.total.toFixed(2) %>
<% } %> <% if (spending.reimb && spending.reimb.limit > 0) { %> <% const RePct = Math.min(100, (spending.reimb.total / spending.reimb.limit) * 100); const ReApprovedPct = Math.min(100, (spending.reimb.approved / spending.reimb.limit) * 100); const RePendingPct = Math.min(100, (spending.reimb.pending / spending.reimb.limit) * 100); %>

Reimbursements

<%= RePct.toFixed(0) %> % used
Approved
$<%= spending.reimb.approved.toFixed(2) %>
Pending
$<%= spending.reimb.pending.toFixed(2) %>
Remaining
$<%= spending.reimb.remaining.toFixed(2) %>
Cap: $<%= spending.reimb.limit.toFixed(2) %>  ·  Claims Total: $<%= spending.reimb.total.toFixed(2) %>
<% } %>
<% } else if (locals.activeView === 'add-reimb' || locals.activeView === 'add-cc') { %>

<% if (locals.activeView === 'add-reimb') { %> Add Reimbursement Claim <% } else { %> Add Company Credit Card Expense <% } %>

<% if (jobNumbers && jobNumbers.length > 0) { %> <% } else { %> <% } %>
New job numbers will be sent to admin for confirmation.
<% if (supervisors && supervisors.length > 0) { %> <% } else { %> placeholder="Jane Smith"> <% } %>
<% if (locals.activeView === 'add-reimb') { %>
<% } %>
Net Amount (pre-tax): $0.00
Tax Added: $0.00
Total: $0.00
On mobile, tap to open camera directly. Max 10MB.
<% } else { %>

Expense History

<%= expenses.length %> record(s)
<% if (expenses && expenses.length > 0) { %> <% const reimburseExp = expenses.filter(e => e.payment_type !== 'Company Card' && e.status !== 'voided'); const cardExp = expenses.filter(e => e.payment_type === 'Company Card' && e.status !== 'voided'); const voidedExp = expenses.filter(e => e.status === 'voided'); %> <% function expenseRow(exp) { %> <%= (exp.date || '').toString().split('T')[0] %> <%= exp.store_name %>
ID: <%= exp.transaction_id %> <% if (!exp.receipt_photo_path) { %> ⚠ Receipt Missing <% } %>
<% if (exp.description) { %>
<%= exp.description %>
<% } %> <% if (exp.rejection_reason) { %>
Rejected: <%= exp.rejection_reason %>
<% } %> <%= exp.job_number || '—' %> <%= exp.supervisor || '—' %> $<%= parseFloat(exp.net_amount).toFixed(2) %> <% if (exp.tax_amount > 0) { %>
+$<%= parseFloat(exp.tax_amount).toFixed(2) %> tax
<% } %> <% try { const fees = JSON.parse(exp.fees_json || '[]'); if (fees.length > 0) { const ft = fees.reduce((s,f) => s + (parseFloat(f.amount)||0), 0); %>
+$<%= ft.toFixed(2) %> fees
<% } } catch(e){} %> $<%= parseFloat(exp.total_amount).toFixed(2) %> <% if (exp.status === 'approved') { %> Approved <% if (exp.approved_at) { %>
<%= (exp.approved_at||'').toString().split('T')[0] %>
<% } %> <% } else if (exp.status === 'rejected') { %> Rejected <% } else { %> Pending <% } %>
<% if (exp.receipt_photo_path) { %> <% } %> <% if (exp.status === 'pending' || exp.status === 'rejected') { %> <% } %> <% if (exp.status === 'pending') { %> <% } %>
<% } %> <% if (reimburseExp.length > 0) { %>
Employee Reimbursement Claims <%= reimburseExp.length %> claim(s)
<% reimburseExp.forEach(exp => { expenseRow(exp); }) %>
Date Store / Vendor Job # Supervisor Amount Total Status Actions
<% } %> <% if (cardExp.length > 0) { %>
Company Credit Card Expenses <%= cardExp.length %> expense(s)
<% cardExp.forEach(exp => { expenseRow(exp); }) %>
Date Store / Vendor Job # Supervisor Amount Total Status Actions
<% } %> <% if (voidedExp.length > 0) { %>
<%= voidedExp.length %> Voided Expense(s) – click to show
<% } %> <% if (reimburseExp.length === 0 && cardExp.length === 0 && voidedExp.length === 0) { %>

No expenses submitted yet.
Add your first expense using the form.

<% } %> <% } else { %>

No expenses submitted yet.
Add your first expense using the form.

<% } %>
<% } %>
<%- include('partials/footer') %>