feat: CSV exports, PDF improvements, play internal/external with hour split, roles cleanup, admin companies with 'Cliente avulso', ticket list spacing/alignment fixes, status translations and mappings
This commit is contained in:
parent
addd4ce6e8
commit
3bafcc5a0a
45 changed files with 1401 additions and 256 deletions
|
|
@ -71,7 +71,7 @@ export const seedDemo = mutation({
|
|||
|
||||
function defaultAvatar(name: string, email: string, role: string) {
|
||||
const normalizedRole = role.toUpperCase();
|
||||
if (normalizedRole === "CUSTOMER" || normalizedRole === "MANAGER") {
|
||||
if (normalizedRole === "MANAGER") {
|
||||
return `https://i.pravatar.cc/150?u=${encodeURIComponent(email)}`;
|
||||
}
|
||||
const first = name.split(" ")[0] ?? email;
|
||||
|
|
@ -130,7 +130,7 @@ export const seedDemo = mutation({
|
|||
avatarUrl?: string;
|
||||
}): Promise<Id<"users">> {
|
||||
const normalizedEmail = params.email.trim().toLowerCase();
|
||||
const normalizedRole = (params.role ?? "CUSTOMER").toUpperCase();
|
||||
const normalizedRole = (params.role ?? "MANAGER").toUpperCase();
|
||||
const desiredAvatar = params.avatarUrl ?? defaultAvatar(params.name, normalizedEmail, normalizedRole);
|
||||
const existing = await ctx.db
|
||||
.query("users")
|
||||
|
|
@ -139,7 +139,7 @@ export const seedDemo = mutation({
|
|||
if (existing) {
|
||||
const updates: Record<string, unknown> = {};
|
||||
if (existing.name !== params.name) updates.name = params.name;
|
||||
if ((existing.role ?? "CUSTOMER") !== normalizedRole) updates.role = normalizedRole;
|
||||
if ((existing.role ?? "MANAGER") !== normalizedRole) updates.role = normalizedRole;
|
||||
if ((existing.avatarUrl ?? undefined) !== desiredAvatar) updates.avatarUrl = desiredAvatar;
|
||||
if ((existing.companyId ?? undefined) !== (params.companyId ?? undefined)) updates.companyId = params.companyId ?? undefined;
|
||||
if (Object.keys(updates).length > 0) {
|
||||
|
|
@ -217,13 +217,13 @@ export const seedDemo = mutation({
|
|||
const joaoAtlasId = await ensureUser({
|
||||
name: "João Pedro Ramos",
|
||||
email: "joao.ramos@atlasengenharia.com.br",
|
||||
role: "CUSTOMER",
|
||||
role: "MANAGER",
|
||||
companyId: atlasCompanyId,
|
||||
});
|
||||
await ensureUser({
|
||||
name: "Aline Rezende",
|
||||
email: "aline.rezende@atlasengenharia.com.br",
|
||||
role: "CUSTOMER",
|
||||
role: "MANAGER",
|
||||
companyId: atlasCompanyId,
|
||||
});
|
||||
|
||||
|
|
@ -237,19 +237,19 @@ export const seedDemo = mutation({
|
|||
const ricardoOmniId = await ensureUser({
|
||||
name: "Ricardo Matos",
|
||||
email: "ricardo.matos@omnisaude.com.br",
|
||||
role: "CUSTOMER",
|
||||
role: "MANAGER",
|
||||
companyId: omniCompanyId,
|
||||
});
|
||||
await ensureUser({
|
||||
name: "Luciana Prado",
|
||||
email: "luciana.prado@omnisaude.com.br",
|
||||
role: "CUSTOMER",
|
||||
role: "MANAGER",
|
||||
companyId: omniCompanyId,
|
||||
});
|
||||
const clienteDemoId = await ensureUser({
|
||||
name: "Cliente Demo",
|
||||
email: "cliente.demo@sistema.dev",
|
||||
role: "CUSTOMER",
|
||||
role: "MANAGER",
|
||||
companyId: omniCompanyId,
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue