-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/AB#19916' into dev
- Loading branch information
Showing
9 changed files
with
285 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/components/Modals/ObjectModals/ObjectAreaModal/ObjectAreaModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { Text } from '@pzh-ui/components' | ||
|
||
import { | ||
useModulesModuleIdObjectWerkingsgebiedLatestLineageIdGet, | ||
useWerkingsgebiedenLatestLineageIdGet, | ||
} from '@/api/fetchers' | ||
import { LeafletTinyViewer } from '@/components/Leaflet' | ||
import Modal from '@/components/Modal' | ||
import useAuth from '@/hooks/useAuth' | ||
import useModalStore from '@/store/modalStore' | ||
|
||
import { ModalStateMap } from '../../types' | ||
|
||
const ObjectAreaModal = () => { | ||
const { user } = useAuth() | ||
|
||
const modalState = useModalStore( | ||
state => state.modalStates['objectArea'] | ||
) as ModalStateMap['objectArea'] | ||
|
||
const { | ||
data: moduleData, | ||
isSuccess, | ||
isError, | ||
} = useModulesModuleIdObjectWerkingsgebiedLatestLineageIdGet( | ||
parseInt(modalState?.moduleId), | ||
parseInt(modalState?.id), | ||
{ | ||
query: { | ||
enabled: !!modalState?.moduleId && !!modalState?.id && !!user, | ||
}, | ||
} | ||
) | ||
|
||
const { data: validData } = useWerkingsgebiedenLatestLineageIdGet( | ||
parseInt(modalState?.id), | ||
{ | ||
query: { | ||
enabled: | ||
(!modalState?.moduleId && !!modalState?.id) || | ||
(!!modalState?.moduleId && | ||
!!modalState?.id && | ||
!moduleData && | ||
isSuccess) || | ||
isError, | ||
}, | ||
} | ||
) | ||
|
||
const data = modalState?.moduleId && isSuccess ? moduleData : validData | ||
|
||
return ( | ||
<Modal id="objectArea" size="xl" title="Gebiedsaanwijzing"> | ||
<div className="flex gap-4"> | ||
<div className="flex w-1/2 flex-col gap-4"> | ||
<div> | ||
<Text>Gebiedengroep</Text> | ||
<Text bold>{modalState?.label}</Text> | ||
</div> | ||
<div> | ||
<Text>Type gebiedsaanwijzing</Text> | ||
<Text bold>{modalState?.gebiedsaanwijzingtype}</Text> | ||
</div> | ||
<div> | ||
<Text>Gebiedsaanwijzinggroep</Text> | ||
<Text bold>{modalState?.gebiedengroep}</Text> | ||
</div> | ||
</div> | ||
<div className="h-[360px] w-full overflow-hidden rounded-lg"> | ||
{data?.Area_UUID && ( | ||
<LeafletTinyViewer uuid={data.Area_UUID} /> | ||
)} | ||
</div> | ||
</div> | ||
</Modal> | ||
) | ||
} | ||
|
||
export default ObjectAreaModal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ObjectAreaModal' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.