fix: lock company/email fields on sent/paid invoices
Company dropdown and Email To input only editable on draft invoices. Sent and paid invoices show read-only text values instead. Applied to both popup (embedded) and standalone page views. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -400,13 +400,19 @@ export function TeamInvoiceDetailPanel({
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div style={F}>Company</div>
|
<div style={F}>Company</div>
|
||||||
<select className="input" style={{ margin: 0 }} value={invoice.company_id || ''} onChange={e => handleCompanyChange(e.target.value)} disabled={saving}>
|
{invoice.status === 'draft'
|
||||||
{companies.map(co => <option key={co.id} value={co.id}>{co.name}</option>)}
|
? <select className="input" style={{ margin: 0 }} value={invoice.company_id || ''} onChange={e => handleCompanyChange(e.target.value)} disabled={saving}>
|
||||||
</select>
|
{companies.map(co => <option key={co.id} value={co.id}>{co.name}</option>)}
|
||||||
|
</select>
|
||||||
|
: <div style={{ fontSize: 13, color: 'var(--text-primary)' }}>{company?.name || '—'}</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div style={F}>Email To</div>
|
<div style={F}>Email To</div>
|
||||||
<input type="email" className="input" style={{ margin: 0 }} value={emailRecipient} onChange={e => setEmailRecipient(e.target.value)} onBlur={handleEmailBlur} placeholder="client@example.com" disabled={saving} />
|
{invoice.status === 'draft'
|
||||||
|
? <input type="email" className="input" style={{ margin: 0 }} value={emailRecipient} onChange={e => setEmailRecipient(e.target.value)} onBlur={handleEmailBlur} placeholder="client@example.com" disabled={saving} />
|
||||||
|
: <div style={{ fontSize: 13, color: 'var(--text-primary)' }}>{invoice.invoice_email || emailRecipient || '—'}</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div style={F}>Total</div>
|
<div style={F}>Total</div>
|
||||||
@@ -516,28 +522,19 @@ export function TeamInvoiceDetailPanel({
|
|||||||
<div className="detail-item"><label>Terms</label><p>Net 30</p></div>
|
<div className="detail-item"><label>Terms</label><p>Net 30</p></div>
|
||||||
<div className="detail-item">
|
<div className="detail-item">
|
||||||
<label>Company</label>
|
<label>Company</label>
|
||||||
<select
|
{invoice.status === 'draft'
|
||||||
className="input"
|
? <select className="input" style={{ margin: 0 }} value={invoice.company_id || ''} onChange={e => handleCompanyChange(e.target.value)} disabled={saving}>
|
||||||
style={{ margin: 0 }}
|
{companies.map(co => <option key={co.id} value={co.id}>{co.name}</option>)}
|
||||||
value={invoice.company_id || ''}
|
</select>
|
||||||
onChange={e => handleCompanyChange(e.target.value)}
|
: <p>{company?.name || '—'}</p>
|
||||||
disabled={saving}
|
}
|
||||||
>
|
|
||||||
{companies.map(co => <option key={co.id} value={co.id}>{co.name}</option>)}
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="detail-item">
|
<div className="detail-item">
|
||||||
<label>Email To</label>
|
<label>Email To</label>
|
||||||
<input
|
{invoice.status === 'draft'
|
||||||
type="email"
|
? <input type="email" className="input" style={{ margin: 0 }} value={emailRecipient} onChange={e => setEmailRecipient(e.target.value)} onBlur={handleEmailBlur} placeholder="client@example.com" disabled={saving} />
|
||||||
className="input"
|
: <p>{invoice.invoice_email || emailRecipient || '—'}</p>
|
||||||
style={{ margin: 0 }}
|
}
|
||||||
value={emailRecipient}
|
|
||||||
onChange={e => setEmailRecipient(e.target.value)}
|
|
||||||
onBlur={handleEmailBlur}
|
|
||||||
placeholder="client@example.com"
|
|
||||||
disabled={saving}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="detail-item"><label>Total</label><p style={{ fontSize: 18, fontWeight: 400, color: 'var(--accent)' }}>${Number(invoice.total).toFixed(2)}</p></div>
|
<div className="detail-item"><label>Total</label><p style={{ fontSize: 18, fontWeight: 400, color: 'var(--accent)' }}>${Number(invoice.total).toFixed(2)}</p></div>
|
||||||
{invoice.paid_at && (
|
{invoice.paid_at && (
|
||||||
|
|||||||
Reference in New Issue
Block a user