fix the contract view and edit

This commit is contained in:
root
2026-05-15 11:34:29 -04:00
committed by Administrator
parent f317fa12dd
commit 593ff202a3
13 changed files with 2331 additions and 381 deletions
+33 -8
View File
@@ -12,9 +12,15 @@ const signupSchema = z.object({
email: z.string().email(),
password: z.string().min(8).max(128),
companyName: z.string().min(2).max(120),
companyPhone: z.string().optional(),
country: z.string().optional(),
city: z.string().optional(),
legalForm: z.string().min(1).max(80),
registrationNumber: z.string().min(1).max(120),
streetAddress: z.string().min(1).max(200),
city: z.string().min(1).max(120),
country: z.string().min(1).max(120),
zipCode: z.string().min(1).max(40),
companyPhone: z.string().min(1).max(80),
fax: z.string().max(80).optional(),
yearsActive: z.string().min(1).max(80),
plan: z.enum(['STARTER', 'GROWTH', 'PRO']),
billingPeriod: z.enum(['MONTHLY', 'ANNUAL']),
currency: z.enum(['MAD', 'USD', 'EUR']),
@@ -129,7 +135,17 @@ router.post('/signup', async (req, res, next) => {
name: body.companyName,
slug,
email: body.email,
phone: body.companyPhone || null,
phone: body.companyPhone,
address: {
streetAddress: body.streetAddress,
city: body.city,
country: body.country,
zipCode: body.zipCode,
legalForm: body.legalForm,
managerName: `${body.firstName} ${body.lastName}`.trim(),
fax: body.fax || null,
yearsActive: body.yearsActive,
},
status: 'TRIALING',
},
})
@@ -140,13 +156,22 @@ router.post('/signup', async (req, res, next) => {
displayName: body.companyName,
subdomain: slug,
publicEmail: body.email,
publicPhone: body.companyPhone || null,
publicCountry: body.country || null,
publicCity: body.city || null,
publicPhone: body.companyPhone,
publicAddress: body.streetAddress,
publicCity: body.city,
publicCountry: body.country,
defaultCurrency: body.currency,
},
})
await tx.contractSettings.create({
data: {
companyId: company.id,
legalName: body.companyName,
registrationNumber: body.registrationNumber,
},
})
await tx.subscription.create({
data: {
companyId: company.id,
@@ -168,7 +193,7 @@ router.post('/signup', async (req, res, next) => {
firstName: body.firstName,
lastName: body.lastName,
email: body.email,
phone: body.companyPhone || null,
phone: body.companyPhone,
passwordHash,
role: 'OWNER',
isActive: true,