690526:1239 ADR-023-229 dynamic prompt #03
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user