Skip to content

Commit 4fbebb3

Browse files
committed
Update edit-customer-modal.tsx
1 parent 1a83e62 commit 4fbebb3

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

apps/web/ui/modals/edit-customer-modal.tsx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type EditCustomerModalProps = {
1515
setShowModal: (showModal: boolean) => void;
1616
customer: Pick<
1717
CustomerEnriched,
18-
"id" | "email" | "stripeCustomerId" | "externalId"
18+
"id" | "name" | "email" | "stripeCustomerId" | "externalId"
1919
>;
2020
};
2121

@@ -35,6 +35,7 @@ function EditCustomerModal({
3535
formState: { isDirty },
3636
} = useForm<FormData>({
3737
defaultValues: {
38+
name: customer?.name || null,
3839
email: customer?.email || null,
3940
stripeCustomerId: customer?.stripeCustomerId || null,
4041
externalId: customer?.externalId || "",
@@ -44,6 +45,7 @@ function EditCustomerModal({
4445
useEffect(() => {
4546
if (showModal) {
4647
reset({
48+
name: customer?.name || null,
4749
email: customer?.email || null,
4850
stripeCustomerId: customer?.stripeCustomerId || null,
4951
externalId: customer?.externalId || "",
@@ -77,6 +79,22 @@ function EditCustomerModal({
7779
}}
7880
>
7981
<div className="flex flex-col gap-4 px-4 py-6 text-left sm:px-6">
82+
<div>
83+
<label className="text-content-emphasis text-sm font-normal">
84+
Name
85+
</label>
86+
<input
87+
type="text"
88+
autoComplete="off"
89+
className="border-border-subtle mt-2 block w-full rounded-lg text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
90+
placeholder="John Doe"
91+
autoFocus={!isMobile}
92+
{...register("name", {
93+
setValueAs: (value) => (value === "" ? null : value),
94+
})}
95+
/>
96+
</div>
97+
8098
<div>
8199
<label className="text-content-emphasis text-sm font-normal">
82100
Email
@@ -95,29 +113,30 @@ function EditCustomerModal({
95113

96114
<div>
97115
<label className="text-content-emphasis text-sm font-normal">
98-
Stripe Customer ID
116+
External ID
99117
</label>
100118
<input
101119
type="text"
102120
autoComplete="off"
103121
className="border-border-subtle mt-2 block w-full rounded-lg text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
104-
placeholder="cus_N1YwZ8JxQ2AbC9"
105-
{...register("stripeCustomerId", {
122+
placeholder="user_1K92AP652K2R7ANJAAHKENJNF"
123+
{...register("externalId", {
106124
setValueAs: (value) => (value === "" ? null : value),
107125
})}
108126
/>
109127
</div>
110128

129+
111130
<div>
112131
<label className="text-content-emphasis text-sm font-normal">
113-
External ID
132+
Stripe Customer ID
114133
</label>
115134
<input
116135
type="text"
117136
autoComplete="off"
118137
className="border-border-subtle mt-2 block w-full rounded-lg text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
119-
placeholder="user_1K92AP652K2R7ANJAAHKENJNF"
120-
{...register("externalId", {
138+
placeholder="cus_N1YwZ8JxQ2AbC9"
139+
{...register("stripeCustomerId", {
121140
setValueAs: (value) => (value === "" ? null : value),
122141
})}
123142
/>

0 commit comments

Comments
 (0)