-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update customer service nickname & email
- Loading branch information
Showing
7 changed files
with
107 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
next/web/src/App/Admin/Settings/Members/components/CustomerServiceForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { forwardRef } from 'react'; | ||
import { Form, FormInstance, Input } from 'antd'; | ||
|
||
import { CSRole } from '@/api/customer-service'; | ||
import { RoleCheckboxGroup } from '@/App/Admin/components/RoleCheckboxGroup'; | ||
|
||
export interface CustomerServiceFormData { | ||
nickname?: string; | ||
email?: string; | ||
roles?: CSRole[]; | ||
} | ||
|
||
export interface CustomerServiceFormProps { | ||
initData?: Partial<CustomerServiceFormData>; | ||
onSubmit?: (data: CustomerServiceFormData) => void; | ||
} | ||
|
||
export const CustomerServiceForm = forwardRef<FormInstance, CustomerServiceFormProps>( | ||
({ initData, onSubmit }, ref) => { | ||
const handleSubmit = (data: CustomerServiceFormData) => { | ||
onSubmit?.({ | ||
nickname: data.nickname || undefined, | ||
email: data.email || undefined, | ||
roles: data.roles || [], | ||
}); | ||
}; | ||
|
||
return ( | ||
<Form ref={ref} layout="vertical" initialValues={initData} onFinish={handleSubmit}> | ||
<Form.Item name="nickname" label="昵称"> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item name="email" label="邮箱"> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item | ||
name="roles" | ||
label="角色" | ||
rules={[{ type: 'array', min: 1 }]} | ||
style={{ marginBottom: 0 }} | ||
> | ||
<RoleCheckboxGroup /> | ||
</Form.Item> | ||
</Form> | ||
); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters