improvement: multi organization possibility implemented for users (owners and staffs)
This commit is contained in:
@@ -18,6 +18,7 @@ const registerSchema = z.object({
|
||||
.regex(/[0-9]/, 'Password must contain at least one number'),
|
||||
confirmPassword: z.string(),
|
||||
organizationName: z.string().min(2, 'Organization name must be at least 2 characters'),
|
||||
organizationEmail: z.string().email('Please enter a valid organization email'),
|
||||
organizationType: z.enum(['CLINIC', 'LAB'], {
|
||||
message: 'Please select organization type',
|
||||
}),
|
||||
@@ -47,7 +48,7 @@ export default function RegisterPage() {
|
||||
const handleNext = async () => {
|
||||
const fieldsToValidate = step === 1
|
||||
? ['name', 'email', 'password', 'confirmPassword']
|
||||
: ['organizationName', 'organizationType'];
|
||||
: ['organizationName', 'organizationEmail', 'organizationType'];
|
||||
|
||||
const isValid = await trigger(fieldsToValidate as any);
|
||||
if (isValid) {
|
||||
@@ -62,6 +63,7 @@ export default function RegisterPage() {
|
||||
data.password,
|
||||
data.name,
|
||||
data.organizationName,
|
||||
data.organizationEmail,
|
||||
data.organizationType
|
||||
);
|
||||
// No need to redirect - auth context will handle it
|
||||
@@ -182,6 +184,14 @@ export default function RegisterPage() {
|
||||
error={errors.organizationName?.message}
|
||||
icon={<Building2 className="h-5 w-5 icon-flat" />}
|
||||
/>
|
||||
<Input
|
||||
label="Organization email"
|
||||
{...register('organizationEmail')}
|
||||
type="email"
|
||||
placeholder="contact@sunshineclinic.com"
|
||||
error={errors.organizationEmail?.message}
|
||||
icon={<Mail className="h-5 w-5 icon-flat" />}
|
||||
/>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-text-secondary mb-2">
|
||||
Organization type
|
||||
|
||||
Reference in New Issue
Block a user