260326:1634 Fixing Refactor ADR-019 Naming convention uuid #05
This commit is contained in:
@@ -59,7 +59,7 @@ export default function OrganizationsPage() {
|
|||||||
|
|
||||||
const confirmDelete = () => {
|
const confirmDelete = () => {
|
||||||
if (orgToDelete) {
|
if (orgToDelete) {
|
||||||
deleteOrg.mutate(orgToDelete.uuid, {
|
deleteOrg.mutate(orgToDelete.publicId, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
setDeleteDialogOpen(false);
|
setDeleteDialogOpen(false);
|
||||||
setOrgToDelete(null);
|
setOrgToDelete(null);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export default function UsersPage() {
|
|||||||
|
|
||||||
const confirmDelete = () => {
|
const confirmDelete = () => {
|
||||||
if (userToDelete) {
|
if (userToDelete) {
|
||||||
deleteMutation.mutate(userToDelete.uuid, {
|
deleteMutation.mutate(userToDelete.publicId, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
setDeleteDialogOpen(false);
|
setDeleteDialogOpen(false);
|
||||||
setUserToDelete(null);
|
setUserToDelete(null);
|
||||||
@@ -100,7 +100,7 @@ export default function UsersPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const org = organizationList.find(
|
const org = organizationList.find(
|
||||||
(o) => (o.id ?? o.uuid) === orgId?.toString() || o.uuid === orgId?.toString()
|
(o) => (o.id ?? o.publicId) === orgId?.toString() || o.publicId === orgId?.toString()
|
||||||
);
|
);
|
||||||
return org ? org.organizationCode : 'All Organizations';
|
return org ? org.organizationCode : 'All Organizations';
|
||||||
},
|
},
|
||||||
@@ -197,7 +197,7 @@ export default function UsersPage() {
|
|||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="all">All Organizations</SelectItem>
|
<SelectItem value="all">All Organizations</SelectItem>
|
||||||
{organizationList.map((org) => (
|
{organizationList.map((org) => (
|
||||||
<SelectItem key={org.uuid} value={org.uuid}>
|
<SelectItem key={org.publicId} value={org.publicId}>
|
||||||
{org.organizationCode} - {org.organizationName}
|
{org.organizationCode} - {org.organizationName}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export default function NumberingPage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (projects.length > 0 && !selectedProjectId) {
|
if (projects.length > 0 && !selectedProjectId) {
|
||||||
const first = projects[0] as ProjectItem;
|
const first = projects[0] as ProjectItem;
|
||||||
setSelectedProjectId(String(first.uuid ?? first.id));
|
setSelectedProjectId(String(first.publicId ?? first.id));
|
||||||
}
|
}
|
||||||
}, [projects, selectedProjectId]);
|
}, [projects, selectedProjectId]);
|
||||||
|
|
||||||
@@ -48,14 +48,14 @@ export default function NumberingPage() {
|
|||||||
const [isTesting, setIsTesting] = useState(false);
|
const [isTesting, setIsTesting] = useState(false);
|
||||||
const [testTemplate, setTestTemplate] = useState<NumberingTemplate | null>(null);
|
const [testTemplate, setTestTemplate] = useState<NumberingTemplate | null>(null);
|
||||||
|
|
||||||
const selectedProject = (projects as ProjectItem[]).find((p) => String(p.uuid ?? p.id) === selectedProjectId);
|
const selectedProject = (projects as ProjectItem[]).find((p) => String(p.publicId ?? p.id) === selectedProjectId);
|
||||||
const selectedProjectName = selectedProject?.projectName || 'Unknown Project';
|
const selectedProjectName = selectedProject?.projectName || 'Unknown Project';
|
||||||
|
|
||||||
// Master Data
|
// Master Data
|
||||||
const { data: correspondenceTypes = [] } = useCorrespondenceTypes();
|
const { data: correspondenceTypes = [] } = useCorrespondenceTypes();
|
||||||
const { data: contracts = [] } = useContracts(selectedProjectId);
|
const { data: contracts = [] } = useContracts(selectedProjectId);
|
||||||
const firstContract = contracts[0] as { id?: number; uuid?: string } | undefined;
|
const firstContract = contracts[0] as { id?: number; uuid?: string } | undefined;
|
||||||
const contractId = firstContract?.uuid ?? firstContract?.id;
|
const contractId = firstContract?.publicId ?? firstContract?.id;
|
||||||
const { data: disciplines = [] } = useDisciplines(contractId);
|
const { data: disciplines = [] } = useDisciplines(contractId);
|
||||||
|
|
||||||
const { data: templateResponse, isLoading: _isLoadingTemplates } = useTemplates();
|
const { data: templateResponse, isLoading: _isLoadingTemplates } = useTemplates();
|
||||||
@@ -116,7 +116,7 @@ export default function NumberingPage() {
|
|||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{(projects as ProjectItem[]).map((project) => (
|
{(projects as ProjectItem[]).map((project) => (
|
||||||
<SelectItem key={String(project.uuid ?? project.id)} value={String(project.uuid ?? project.id)}>
|
<SelectItem key={String(project.publicId ?? project.id)} value={String(project.publicId ?? project.id)}>
|
||||||
{project.projectCode} - {project.projectName}
|
{project.projectCode} - {project.projectName}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
@@ -147,8 +147,8 @@ export default function NumberingPage() {
|
|||||||
.filter(
|
.filter(
|
||||||
(t) =>
|
(t) =>
|
||||||
!t.projectId ||
|
!t.projectId ||
|
||||||
String(t.project?.id ?? t.project?.uuid) === selectedProjectId ||
|
String(t.project?.id ?? t.project?.publicId) === selectedProjectId ||
|
||||||
t.project?.uuid === selectedProjectId
|
t.project?.publicId === selectedProjectId
|
||||||
)
|
)
|
||||||
.map((template) => (
|
.map((template) => (
|
||||||
<Card key={template.id} className="p-6 hover:shadow-md transition-shadow">
|
<Card key={template.id} className="p-6 hover:shadow-md transition-shadow">
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export default function CreateCirculationPage() {
|
|||||||
mutationFn: (data: CreateCirculationDto) => circulationService.create(data),
|
mutationFn: (data: CreateCirculationDto) => circulationService.create(data),
|
||||||
onSuccess: (result) => {
|
onSuccess: (result) => {
|
||||||
toast.success('Circulation created successfully');
|
toast.success('Circulation created successfully');
|
||||||
router.push(`/circulation/${result.uuid}`);
|
router.push(`/circulation/${result.publicId}`);
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: () => {
|
||||||
toast.error('Failed to create circulation');
|
toast.error('Failed to create circulation');
|
||||||
@@ -85,7 +85,7 @@ export default function CreateCirculationPage() {
|
|||||||
const selectedAssignees = form.watch('assigneeIds');
|
const selectedAssignees = form.watch('assigneeIds');
|
||||||
const selectedDocId = form.watch('correspondenceId');
|
const selectedDocId = form.watch('correspondenceId');
|
||||||
|
|
||||||
const selectedDoc = correspondences?.data?.find((c: { uuid: string }) => c.uuid === selectedDocId);
|
const selectedDoc = correspondences?.data?.find((c: { publicId: string }) => c.publicId === selectedDocId);
|
||||||
|
|
||||||
const toggleAssignee = (userUuid: string) => {
|
const toggleAssignee = (userUuid: string) => {
|
||||||
const current = form.getValues('assigneeIds');
|
const current = form.getValues('assigneeIds');
|
||||||
@@ -147,19 +147,19 @@ export default function CreateCirculationPage() {
|
|||||||
<CommandList>
|
<CommandList>
|
||||||
<CommandEmpty>No document found.</CommandEmpty>
|
<CommandEmpty>No document found.</CommandEmpty>
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
{correspondences?.data?.map((doc: { uuid: string; correspondenceNumber: string }) => (
|
{correspondences?.data?.map((doc: { publicId: string; correspondenceNumber: string }) => (
|
||||||
<CommandItem
|
<CommandItem
|
||||||
key={doc.uuid}
|
key={doc.publicId}
|
||||||
value={doc.correspondenceNumber}
|
value={doc.correspondenceNumber}
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
form.setValue('correspondenceId', doc.uuid);
|
form.setValue('correspondenceId', doc.publicId);
|
||||||
setDocOpen(false);
|
setDocOpen(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Check
|
<Check
|
||||||
className={cn(
|
className={cn(
|
||||||
'mr-2 h-4 w-4',
|
'mr-2 h-4 w-4',
|
||||||
doc.uuid === field.value ? 'opacity-100' : 'opacity-0'
|
doc.publicId === field.value ? 'opacity-100' : 'opacity-0'
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{doc.correspondenceNumber}
|
{doc.correspondenceNumber}
|
||||||
@@ -204,7 +204,7 @@ export default function CreateCirculationPage() {
|
|||||||
{selectedAssignees.length > 0 ? (
|
{selectedAssignees.length > 0 ? (
|
||||||
<div className="flex flex-wrap gap-1">
|
<div className="flex flex-wrap gap-1">
|
||||||
{selectedAssignees.map((userUuid) => {
|
{selectedAssignees.map((userUuid) => {
|
||||||
const user = users.find((u) => u.uuid === userUuid);
|
const user = users.find((u) => u.publicId === userUuid);
|
||||||
return user ? (
|
return user ? (
|
||||||
<Badge key={userUuid} variant="secondary" className="mr-1">
|
<Badge key={userUuid} variant="secondary" className="mr-1">
|
||||||
{user.firstName || user.username}
|
{user.firstName || user.username}
|
||||||
@@ -234,14 +234,14 @@ export default function CreateCirculationPage() {
|
|||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
{users.map((user) => (
|
{users.map((user) => (
|
||||||
<CommandItem
|
<CommandItem
|
||||||
key={user.uuid}
|
key={user.publicId}
|
||||||
value={user.username}
|
value={user.username}
|
||||||
onSelect={() => toggleAssignee(user.uuid)}
|
onSelect={() => toggleAssignee(user.publicId)}
|
||||||
>
|
>
|
||||||
<Check
|
<Check
|
||||||
className={cn(
|
className={cn(
|
||||||
'mr-2 h-4 w-4',
|
'mr-2 h-4 w-4',
|
||||||
selectedAssignees.includes(user.uuid) ? 'opacity-100' : 'opacity-0'
|
selectedAssignees.includes(user.publicId) ? 'opacity-100' : 'opacity-0'
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{user.firstName && user.lastName
|
{user.firstName && user.lastName
|
||||||
|
|||||||
Reference in New Issue
Block a user