feat: redesign superadmin agencies list, implement flat design, add date filters, and fix UI bugs
This commit is contained in:
66
backend/internal/domain/agency_template.go
Normal file
66
backend/internal/domain/agency_template.go
Normal file
@@ -0,0 +1,66 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// AgencySignupTemplate represents a signup template for agencies (SuperAdmin → Agency)
|
||||
type AgencySignupTemplate struct {
|
||||
ID uuid.UUID `json:"id" db:"id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Slug string `json:"slug" db:"slug"`
|
||||
Description string `json:"description" db:"description"`
|
||||
FormFields []byte `json:"form_fields" db:"form_fields"` // JSONB
|
||||
AvailableModules []byte `json:"available_modules" db:"available_modules"` // JSONB
|
||||
CustomPrimaryColor sql.NullString `json:"custom_primary_color" db:"custom_primary_color"`
|
||||
CustomLogoURL sql.NullString `json:"custom_logo_url" db:"custom_logo_url"`
|
||||
RedirectURL sql.NullString `json:"redirect_url" db:"redirect_url"`
|
||||
SuccessMessage sql.NullString `json:"success_message" db:"success_message"`
|
||||
IsActive bool `json:"is_active" db:"is_active"`
|
||||
UsageCount int `json:"usage_count" db:"usage_count"`
|
||||
MaxUses sql.NullInt64 `json:"max_uses" db:"max_uses"`
|
||||
ExpiresAt sql.NullTime `json:"expires_at" db:"expires_at"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||||
}
|
||||
|
||||
// CreateAgencyTemplateRequest for creating a new agency template
|
||||
type CreateAgencyTemplateRequest struct {
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
FormFields []string `json:"form_fields"`
|
||||
AvailableModules []string `json:"available_modules"`
|
||||
CustomPrimaryColor string `json:"custom_primary_color"`
|
||||
CustomLogoURL string `json:"custom_logo_url"`
|
||||
RedirectURL string `json:"redirect_url"`
|
||||
SuccessMessage string `json:"success_message"`
|
||||
MaxUses int `json:"max_uses"`
|
||||
}
|
||||
|
||||
// AgencyRegistrationViaTemplate for public registration via template
|
||||
type AgencyRegistrationViaTemplate struct {
|
||||
TemplateSlug string `json:"template_slug"`
|
||||
|
||||
// Agency info
|
||||
AgencyName string `json:"agencyName"`
|
||||
Subdomain string `json:"subdomain"`
|
||||
CNPJ string `json:"cnpj"`
|
||||
RazaoSocial string `json:"razaoSocial"`
|
||||
Website string `json:"website"`
|
||||
Phone string `json:"phone"`
|
||||
|
||||
// Admin
|
||||
AdminEmail string `json:"adminEmail"`
|
||||
AdminPassword string `json:"adminPassword"`
|
||||
AdminName string `json:"adminName"`
|
||||
|
||||
// Optional fields
|
||||
Description string `json:"description"`
|
||||
Industry string `json:"industry"`
|
||||
TeamSize string `json:"teamSize"`
|
||||
Address map[string]string `json:"address"`
|
||||
}
|
||||
35
backend/internal/domain/signup_template.go
Normal file
35
backend/internal/domain/signup_template.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// FormField representa um campo do formulário de cadastro
|
||||
type FormField struct {
|
||||
Name string `json:"name"`
|
||||
Label string `json:"label"`
|
||||
Type string `json:"type"` // email, password, text, tel, etc
|
||||
Required bool `json:"required"`
|
||||
Order int `json:"order"`
|
||||
}
|
||||
|
||||
// SignupTemplate representa um template de cadastro personalizado
|
||||
type SignupTemplate struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Slug string `json:"slug"`
|
||||
FormFields []FormField `json:"form_fields"`
|
||||
EnabledModules []string `json:"enabled_modules"` // ["CRM", "ERP", "PROJECTS"]
|
||||
RedirectURL string `json:"redirect_url,omitempty"`
|
||||
SuccessMessage string `json:"success_message,omitempty"`
|
||||
CustomLogoURL string `json:"custom_logo_url,omitempty"`
|
||||
CustomPrimaryColor string `json:"custom_primary_color,omitempty"`
|
||||
IsActive bool `json:"is_active"`
|
||||
UsageCount int `json:"usage_count"`
|
||||
CreatedBy uuid.UUID `json:"created_by"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
@@ -18,14 +18,22 @@ type Tenant struct {
|
||||
Phone string `json:"phone,omitempty" db:"phone"`
|
||||
Website string `json:"website,omitempty" db:"website"`
|
||||
Address string `json:"address,omitempty" db:"address"`
|
||||
Neighborhood string `json:"neighborhood,omitempty" db:"neighborhood"`
|
||||
Number string `json:"number,omitempty" db:"number"`
|
||||
Complement string `json:"complement,omitempty" db:"complement"`
|
||||
City string `json:"city,omitempty" db:"city"`
|
||||
State string `json:"state,omitempty" db:"state"`
|
||||
Zip string `json:"zip,omitempty" db:"zip"`
|
||||
Description string `json:"description,omitempty" db:"description"`
|
||||
Industry string `json:"industry,omitempty" db:"industry"`
|
||||
IsActive bool `json:"is_active" db:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||||
Description string `json:"description,omitempty" db:"description"`
|
||||
Industry string `json:"industry,omitempty" db:"industry"`
|
||||
TeamSize string `json:"team_size,omitempty" db:"team_size"`
|
||||
PrimaryColor string `json:"primary_color,omitempty" db:"primary_color"`
|
||||
SecondaryColor string `json:"secondary_color,omitempty" db:"secondary_color"`
|
||||
LogoURL string `json:"logo_url,omitempty" db:"logo_url"`
|
||||
LogoHorizontalURL string `json:"logo_horizontal_url,omitempty" db:"logo_horizontal_url"`
|
||||
IsActive bool `json:"is_active" db:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||||
}
|
||||
|
||||
// CreateTenantRequest represents the request to create a new tenant
|
||||
|
||||
@@ -36,6 +36,8 @@ type RegisterAgencyRequest struct {
|
||||
Description string `json:"description"`
|
||||
Website string `json:"website"`
|
||||
Industry string `json:"industry"`
|
||||
Phone string `json:"phone"`
|
||||
TeamSize string `json:"teamSize"`
|
||||
|
||||
// Endereço
|
||||
CEP string `json:"cep"`
|
||||
@@ -46,12 +48,59 @@ type RegisterAgencyRequest struct {
|
||||
Number string `json:"number"`
|
||||
Complement string `json:"complement"`
|
||||
|
||||
// Personalização
|
||||
PrimaryColor string `json:"primaryColor"`
|
||||
SecondaryColor string `json:"secondaryColor"`
|
||||
LogoURL string `json:"logoUrl"`
|
||||
LogoHorizontalURL string `json:"logoHorizontalUrl"`
|
||||
|
||||
// Admin da Agência
|
||||
AdminEmail string `json:"adminEmail"`
|
||||
AdminPassword string `json:"adminPassword"`
|
||||
AdminName string `json:"adminName"`
|
||||
}
|
||||
|
||||
// PublicRegisterAgencyRequest represents the public signup payload
|
||||
type PublicRegisterAgencyRequest struct {
|
||||
// User
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
FullName string `json:"fullName"`
|
||||
Newsletter bool `json:"newsletter"`
|
||||
|
||||
// Company
|
||||
CompanyName string `json:"companyName"`
|
||||
CNPJ string `json:"cnpj"`
|
||||
RazaoSocial string `json:"razaoSocial"`
|
||||
Description string `json:"description"`
|
||||
Website string `json:"website"`
|
||||
Industry string `json:"industry"`
|
||||
TeamSize string `json:"teamSize"`
|
||||
|
||||
// Address
|
||||
CEP string `json:"cep"`
|
||||
State string `json:"state"`
|
||||
City string `json:"city"`
|
||||
Neighborhood string `json:"neighborhood"`
|
||||
Street string `json:"street"`
|
||||
Number string `json:"number"`
|
||||
Complement string `json:"complement"`
|
||||
|
||||
// Contacts (simplified for now, taking the first one as phone if available)
|
||||
Contacts []struct {
|
||||
ID int `json:"id"`
|
||||
Whatsapp string `json:"whatsapp"`
|
||||
} `json:"contacts"`
|
||||
|
||||
// Domain
|
||||
Subdomain string `json:"subdomain"`
|
||||
|
||||
// Branding
|
||||
PrimaryColor string `json:"primaryColor"`
|
||||
SecondaryColor string `json:"secondaryColor"`
|
||||
LogoURL string `json:"logoUrl"`
|
||||
}
|
||||
|
||||
// RegisterClientRequest represents client registration (ADMIN_AGENCIA only)
|
||||
type RegisterClientRequest struct {
|
||||
Email string `json:"email"`
|
||||
|
||||
Reference in New Issue
Block a user