pdf task-h

This commit is contained in:
phaichayon
2026-06-19 15:09:58 +07:00
parent a85d24235c
commit fd01ebf7c7
35 changed files with 3905 additions and 133 deletions

View File

@@ -1,12 +1,12 @@
import { auth } from '@/auth';
import { redirect } from 'next/navigation';
import { auth } from "@/auth";
import { redirect } from "next/navigation";
export default async function Page() {
const session = await auth();
if (!session?.user?.id) {
return redirect('/auth/sign-in');
return redirect("/auth/sign-in");
} else {
redirect('/dashboard');
redirect("/dashboard/crm");
}
}

View File

@@ -34,52 +34,52 @@ import { NavGroup } from "@/types";
* Use the `access` property for new items.
*/
export const navGroups: NavGroup[] = [
// {
// label: "Overview",
// items: [
// {
// title: "Dashboard Overview",
// url: "/dashboard",
// icon: "dashboard",
// isActive: false,
// shortcut: ["d", "d"],
// items: [],
// },
// {
// title: "Workspaces",
// url: "/dashboard/workspaces",
// icon: "workspace",
// isActive: false,
// items: [],
// access: { systemRole: "super_admin" },
// },
// {
// title: "Teams",
// url: "/dashboard/workspaces/team",
// icon: "teams",
// isActive: false,
// items: [],
// access: { requireOrg: true, role: "admin" },
// },
// {
// title: "Users",
// url: "/dashboard/users",
// icon: "teams",
// shortcut: ["u", "u"],
// isActive: false,
// items: [],
// access: { requireOrg: true, permission: "users:manage" },
// },
// {
// title: "Kanban",
// url: "/dashboard/kanban",
// icon: "kanban",
// shortcut: ["k", "k"],
// isActive: false,
// items: [],
// },
// ],
// },
{
label: "Overview",
items: [
{
title: "Dashboard Overview",
url: "/dashboard",
icon: "dashboard",
isActive: false,
shortcut: ["d", "d"],
items: [],
},
{
title: "Workspaces",
url: "/dashboard/workspaces",
icon: "workspace",
isActive: false,
items: [],
access: { systemRole: "super_admin" },
},
{
title: "Teams",
url: "/dashboard/workspaces/team",
icon: "teams",
isActive: false,
items: [],
access: { requireOrg: true, role: "admin" },
},
{
title: "Users",
url: "/dashboard/users",
icon: "teams",
shortcut: ["u", "u"],
isActive: false,
items: [],
access: { requireOrg: true, permission: "users:manage" },
},
{
title: "Kanban",
url: "/dashboard/kanban",
icon: "kanban",
shortcut: ["k", "k"],
isActive: false,
items: [],
},
],
},
{
label: "CRM",
items: [

View File

@@ -87,6 +87,12 @@ function extractSinglePlaceholder(value: string) {
return uniqueMatches.length === 1 ? uniqueMatches[0] : null;
}
function getFieldName(field: unknown) {
return field && typeof field === 'object' && typeof (field as { name?: unknown }).name === 'string'
? ((field as { name: string }).name ?? '')
: '';
}
function normalizeTopicKey(value: string | null | undefined) {
return (
value
@@ -165,13 +171,26 @@ function normalizePdfmeTemplateInput(schemaJson: unknown, templateInput: Record<
}
const tableField = field as { type?: unknown; content?: unknown };
const fieldName = getFieldName(field);
const placeholderKey =
typeof tableField.content === 'string'
? extractSinglePlaceholder(tableField.content)
: null;
if (fieldName && placeholderKey && fieldName !== placeholderKey) {
if (normalized[fieldName] !== undefined && normalized[placeholderKey] === undefined) {
normalized[placeholderKey] = normalized[fieldName];
}
if (normalized[placeholderKey] !== undefined && normalized[fieldName] === undefined) {
normalized[fieldName] = normalized[placeholderKey];
}
}
if (tableField.type !== 'table' || typeof tableField.content !== 'string') {
continue;
}
const placeholderKey = extractSinglePlaceholder(tableField.content);
if (!placeholderKey) {
continue;
}