690526:1239 ADR-023-229 dynamic prompt #03
CI / CD Pipeline / build (push) Successful in 5m12s
CI / CD Pipeline / deploy (push) Successful in 6m42s

This commit is contained in:
2026-05-26 12:39:29 +07:00
parent 01de542d15
commit 960cd78b8a
8 changed files with 38 additions and 17 deletions
@@ -80,7 +80,7 @@ export default function OrganizationsPage() {
header: 'Role',
cell: ({ row }) => {
const roleId = row.getValue('roleId') as number;
const role = ORGANIZATION_ROLES.find((r) => r.value === roleId?.toString());
const role = Array.isArray(ORGANIZATION_ROLES) ? ORGANIZATION_ROLES.find((r) => r.value === roleId?.toString()) : undefined;
return role ? role.label : '-';
},
},
@@ -99,9 +99,9 @@ export default function UsersPage() {
return 'All Organizations';
}
const org = organizationList.find(
const org = Array.isArray(organizationList) ? organizationList.find(
(o) => (o.id ?? o.publicId) === orgId?.toString() || o.publicId === orgId?.toString()
);
) : undefined;
return org ? org.organizationCode : 'All Organizations';
},
},
@@ -281,7 +281,7 @@ function ManageMappings({ projectId }: { projectId: string }) {
{subCategories
.filter(
(s: ContractSubCategory) =>
!mappings.find((m: Record<string, unknown>) => {
!Array.isArray(mappings) || !mappings.find((m: Record<string, unknown>) => {
const sub = m.subCategory as { id?: number } | undefined;
return sub?.id === s.id;
})
@@ -31,10 +31,11 @@ export default function EditTemplatePage() {
const contractId = getContractPublicId(firstContract);
const { data: disciplines = [] } = useDisciplines(contractId);
const selectedProjectName =
(projects as Array<{ id?: number; publicId?: string; projectCode: string; projectName: string }>).find((p) =>
String(p.publicId ?? p.id) === String(projectId))
?.projectName || 'LCBP3';
const selectedProjectName = Array.isArray(projects)
? (projects as Array<{ id?: number; publicId?: string; projectCode: string; projectName: string }>).find((p) =>
String(p.publicId ?? p.id) === String(projectId))
?.projectName || 'LCBP3'
: 'LCBP3';
useEffect(() => {
const fetchTemplate = async () => {
@@ -21,9 +21,10 @@ export default function NewTemplatePage() {
const contractId = getContractPublicId(firstContract);
const { data: disciplines = [] } = useDisciplines(contractId);
const selectedProjectName =
(projects as Array<{ id?: number; publicId?: string; projectName: string }>).find((p) =>
String(p.publicId ?? p.id) === String(projectId))?.projectName || 'LCBP3';
const selectedProjectName = Array.isArray(projects)
? (projects as Array<{ id?: number; publicId?: string; projectName: string }>).find((p) =>
String(p.publicId ?? p.id) === String(projectId))?.projectName || 'LCBP3'
: 'LCBP3';
const handleSave = async (data: Partial<NumberingTemplate>) => {
try {
@@ -49,7 +49,7 @@ export default function NumberingPage() {
const [isTesting, setIsTesting] = useState(false);
const [testTemplate, setTestTemplate] = useState<NumberingTemplate | null>(null);
const selectedProject = (projects as ProjectItem[]).find((p) => String(p.publicId) === selectedProjectId);
const selectedProject = Array.isArray(projects) ? (projects as ProjectItem[]).find((p) => String(p.publicId) === selectedProjectId) : undefined;
const selectedProjectName = selectedProject?.projectName || 'Unknown Project';
// Master Data