initial release testing
This commit is contained in:
43
app/customers/page.tsx
Normal file
43
app/customers/page.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import { createCustomer } from "@/lib/actions";
|
||||
import { getCustomers } from "@/lib/repository";
|
||||
|
||||
export default function CustomersPage() {
|
||||
const customers = getCustomers();
|
||||
|
||||
return (
|
||||
<div className="grid">
|
||||
<section className="two-up">
|
||||
<article className="panel">
|
||||
<h2 className="section-title">Add Customer</h2>
|
||||
<p className="section-copy">Customer records anchor sales orders, shipping, and accounts receivable activity.</p>
|
||||
<form action={createCustomer} className="form-grid">
|
||||
<div className="form-row"><label htmlFor="customer-code">Customer Code</label><input className="input" id="customer-code" name="code" required /></div>
|
||||
<div className="form-row"><label htmlFor="customer-name">Name</label><input className="input" id="customer-name" name="name" required /></div>
|
||||
<div className="form-row"><label htmlFor="customer-email">Email</label><input className="input" id="customer-email" name="email" type="email" /></div>
|
||||
<div className="form-row"><label htmlFor="customer-phone">Phone</label><input className="input" id="customer-phone" name="phone" /></div>
|
||||
<div className="form-row"><label htmlFor="billingAddress">Billing Address</label><textarea className="textarea" id="billingAddress" name="billingAddress" /></div>
|
||||
<div className="form-row"><label htmlFor="shippingAddress">Shipping Address</label><textarea className="textarea" id="shippingAddress" name="shippingAddress" /></div>
|
||||
<button className="button" type="submit">Save Customer</button>
|
||||
</form>
|
||||
</article>
|
||||
<article className="panel">
|
||||
<h2 className="section-title">Customer Directory</h2>
|
||||
<div className="table-wrap">
|
||||
<table className="table">
|
||||
<thead><tr><th>Code</th><th>Name</th><th>Email</th><th>Phone</th></tr></thead>
|
||||
<tbody>
|
||||
{customers.length === 0 ? (
|
||||
<tr><td colSpan={4} className="muted">No customers yet.</td></tr>
|
||||
) : (
|
||||
customers.map((customer) => (
|
||||
<tr key={customer.id}><td>{customer.code}</td><td>{customer.name}</td><td>{customer.email || "—"}</td><td>{customer.phone || "—"}</td></tr>
|
||||
))
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user