-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
edit users and campaign UX improvements (#1030)
* extended campaign description to 40K symbols to allow html expansion * mproved campaign creation by opening create beneficiary/company in new tabs * added: users grid and edit form for user changes Co-authored-by: quantum-grit <[email protected]>
- Loading branch information
1 parent
c90fa7a
commit 58696af
Showing
27 changed files
with
401 additions
and
31 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useTranslation } from 'next-i18next' | ||
|
||
import AdminContainer from 'components/admin/navigation/AdminContainer' | ||
import AdminLayout from 'components/admin/navigation/AdminLayout' | ||
import { ModalStoreImpl } from 'stores/dashboard/ModalStore' | ||
|
||
import Grid from './grid/Grid' | ||
import GridAppbar from './grid/GridAppbar' | ||
|
||
export const ModalStore = new ModalStoreImpl() | ||
|
||
export default function PersonGrid() { | ||
const { t } = useTranslation('person') | ||
|
||
return ( | ||
<AdminLayout> | ||
<AdminContainer title={t('admin.headings.info')}> | ||
<GridAppbar /> | ||
<Grid /> | ||
</AdminContainer> | ||
</AdminLayout> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useMutation } from 'react-query' | ||
import { observer } from 'mobx-react' | ||
import { AxiosError, AxiosResponse } from 'axios' | ||
import { useRouter } from 'next/router' | ||
import { useTranslation } from 'next-i18next' | ||
|
||
import { PersonResponse } from 'gql/person' | ||
import { ApiErrors } from 'service/apiErrors' | ||
import { useDeletePerson } from 'service/person' | ||
import { AlertStore } from 'stores/AlertStore' | ||
import { routes } from 'common/routes' | ||
import DeleteDialog from 'components/admin/DeleteDialog' | ||
|
||
import { ModalStore } from '../PersonGrid' | ||
|
||
export default observer(function DeleteModal() { | ||
const router = useRouter() | ||
const { hideDelete, selectedRecord } = ModalStore | ||
const { t } = useTranslation('person') | ||
|
||
const mutationFn = useDeletePerson(selectedRecord.id) | ||
|
||
const deleteMutation = useMutation<AxiosResponse<PersonResponse>, AxiosError<ApiErrors>, string>({ | ||
mutationFn, | ||
onError: () => AlertStore.show(t('alerts.error'), 'error'), | ||
onSuccess: () => { | ||
hideDelete() | ||
AlertStore.show(t('alerts.delete'), 'success') | ||
router.push(routes.admin.person.index) | ||
}, | ||
}) | ||
|
||
function deleteHandler() { | ||
deleteMutation.mutate(selectedRecord.id) | ||
} | ||
|
||
return <DeleteDialog modalStore={ModalStore} deleteHandler={deleteHandler} /> | ||
}) |
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,26 @@ | ||
import React from 'react' | ||
import { UseQueryResult } from 'react-query' | ||
import { observer } from 'mobx-react' | ||
import { useTranslation } from 'next-i18next' | ||
|
||
import DetailsDialog from 'components/admin/DetailsDialog' | ||
|
||
import { ModalStore } from '../PersonGrid' | ||
import { usePerson } from 'common/hooks/person' | ||
import { PersonResponse } from 'gql/person' | ||
|
||
export default observer(function DetailsModal() { | ||
const { selectedRecord } = ModalStore | ||
const { data }: UseQueryResult<PersonResponse> = usePerson(selectedRecord.id) | ||
const { t } = useTranslation('person') | ||
|
||
const dataConverted = [ | ||
{ name: 'ID', value: `${data?.id}` }, | ||
{ name: t('admin.fields.name'), value: `${data?.firstName} + ' ' + ${data?.lastName}` }, | ||
{ name: t('admin.fields.email'), value: `${data?.email}` }, | ||
{ name: t('admin.fields.createdAt'), value: `${data?.createdAt}` }, | ||
//{ name: t('updatedAt'), value: `${data?.updatedAt}` }, | ||
] | ||
|
||
return <DetailsDialog modalStore={ModalStore} data={dataConverted} /> | ||
}) |
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,21 @@ | ||
import { useTranslation } from 'next-i18next' | ||
|
||
import { Container } from '@mui/material' | ||
|
||
import AdminLayout from 'components/admin/navigation/AdminLayout' | ||
import AdminContainer from 'components/admin/navigation/AdminContainer' | ||
import PersonForm from './PersonForm' | ||
|
||
export default function CreatePage() { | ||
const { t } = useTranslation() | ||
|
||
return ( | ||
<AdminLayout> | ||
<AdminContainer title={t('person:admin.headings.edit')}> | ||
<Container maxWidth="md" sx={{ py: 5 }}> | ||
<PersonForm /> | ||
</Container> | ||
</AdminContainer> | ||
</AdminLayout> | ||
) | ||
} |
Oops, something went wrong.