Skip to content

Commit

Permalink
TS-936 Municipality
Browse files Browse the repository at this point in the history
- Added municipality service
  • Loading branch information
birkirkristmunds committed Dec 27, 2024
1 parent 7cb4964 commit f17ae44
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 1,372 deletions.
2 changes: 2 additions & 0 deletions apps/skilavottord/web/screens/AccessControl/AccessControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ const AccessControl: FC<React.PropsWithChildren<unknown>> = () => {
: partner.companyName,
value: partner.companyId,
}))
.sort((a, b) => a.label.localeCompare(b.label))

const municipalities = filterInternalPartners(partners)
.filter((partner) => {
Expand All @@ -250,6 +251,7 @@ const AccessControl: FC<React.PropsWithChildren<unknown>> = () => {
label: partner.companyName,
value: partner.companyId,
}))
.sort((a, b) => a.label.localeCompare(b.label))

const roles = Object.keys(AccessControlRole)
.filter((role) =>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { AccessControlImage } from './AccessControlImage/AccessControlImage'
export { AccessControlCreate } from './AccessControlCreate/AccessControlCreate'
export { AccessControlUpdate } from './AccessControlUpdate/AccessControlUpdate'

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { AccessControlImage } from './AccessControlImage/AccessControlImage'
export { AccessControlCreate } from './AccessControlCreate/AccessControlCreate'
export { AccessControlUpdate } from './AccessControlUpdate/AccessControlUpdate'
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Control, Controller, FieldError } from 'react-hook-form'
import { FieldValues } from 'react-hook-form/dist/types'
import { DeepMap } from 'react-hook-form/dist/types/utils'

import { useQuery } from '@apollo/client'
import { gql, useQuery } from '@apollo/client'
import {
Box,
Button,
Expand All @@ -23,7 +23,6 @@ import {
import UserContext from '@island.is/skilavottord-web/context/UserContext'
import { Query } from '@island.is/skilavottord-web/graphql/schema'
import { useI18n } from '@island.is/skilavottord-web/i18n'
import { SkilavottordRecyclingPartnersQuery } from '../../RecyclingCompanies'

interface RecyclingCompanyForm {
onSubmit: (
Expand All @@ -36,6 +35,15 @@ interface RecyclingCompanyForm {
isMunicipalityPage?: boolean | undefined
}

export const SkilavottordAllMunicipalitiesQuery = gql`
query skilavottordAllMunicipalitiesQuery {
skilavottordAllMunicipalities {
companyId
companyName
}
}
`

const RecyclingCompanyForm: FC<
React.PropsWithChildren<RecyclingCompanyForm>
> = ({
Expand All @@ -53,17 +61,16 @@ const RecyclingCompanyForm: FC<
} = useI18n()

const { data } =
useQuery<Query>(SkilavottordRecyclingPartnersQuery, {
skip: isMunicipalityPage,
variables: { isMunicipalityPage: true },
useQuery<Query>(SkilavottordAllMunicipalitiesQuery, {
fetchPolicy: 'cache-and-network',
}) || []

const municipalities = data?.skilavottordRecyclingPartners.map(
(municipality) => ({
const municipalities = data?.skilavottordAllMunicipalities
.map((municipality) => ({
label: municipality.companyName,
value: municipality.companyId,
}),
)
}))
.sort((a, b) => a.label.localeCompare(b.label))

return (
<form onSubmit={onSubmit}>
Expand Down
Loading

0 comments on commit f17ae44

Please sign in to comment.