-
-
Notifications
You must be signed in to change notification settings - Fork 34
feat(persons): add CSV import functionality #4326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nobodyzero1
wants to merge
34
commits into
sws2apps:main
Choose a base branch
from
nobodyzero1:feature/csv-persons-import
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
953e03e
Implementing CSV-Import for persons
nobodyzero1 914dea5
Fix reliability issues reported by SonarQube
nobodyzero1 4ac06f2
Fix reliability issues reported by SonarQube
nobodyzero1 e626432
Fix reliability issues reported by SonarQube
nobodyzero1 1141e9b
Adding changelog
nobodyzero1 c9fc5ce
Merge branch 'main' into feature/csv-persons-import
nobodyzero1 144cfb4
Trigger review
nobodyzero1 abf076b
Trigger review
nobodyzero1 2f6099e
Minor corrections from code rabbit
nobodyzero1 a7f6df3
just deleting some comments
nobodyzero1 d5671cf
correcting general.json
nobodyzero1 60a2b9e
Merge remote-tracking branch 'origin/main' into feature/csv-persons-i…
nobodyzero1 d496b97
Merge remote-tracking branch 'origin/main' into feature/csv-persons-i…
nobodyzero1 bc52747
Continue CSV persons import feature implementation
nobodyzero1 8628e0e
feat(persons): unify export/import; add group no. and emergency contacts
nobodyzero1 f35449f
Reducing complexity
nobodyzero1 07ba6c7
Implement feedback and suggestions for improvement
nobodyzero1 e6903e9
fixing issues from coderabbitai
nobodyzero1 af13ea6
fixing further coderabbitai issues
nobodyzero1 5f619e8
Merge branch 'main' into feature/csv-persons-import
nobodyzero1 0b48dfa
fixing issues from coderabbitai
nobodyzero1 bc91edc
fixing issues from coderabbit
nobodyzero1 b323425
fixing issues from coderabbit
nobodyzero1 102f567
resolving issue with activating baptized status
nobodyzero1 aa391ad
fixing coderabbit issues
nobodyzero1 967762b
allowing null-value for first_report in type-definition bbecause the …
nobodyzero1 882f8b1
implementing suggestions from coderabbit
nobodyzero1 e1b95b5
correcting closeOpenHistory according to coderabbit
nobodyzero1 8efcbaf
Refactor assignment examples logic
nobodyzero1 73df0c2
resolving examples-issue according to coderabbit
nobodyzero1 37ebeec
Merge branch 'main' into feature/csv-persons-import
nobodyzero1 5589bea
Merge branch 'main' into feature/csv-persons-import
nobodyzero1 c328d7f
feat(ui): Refine link styling and compactify template filling tips
nobodyzero1 512e71d
updating package for merging
nobodyzero1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,52 @@ | ||
| import { SvgIcon, SxProps, Theme } from '@mui/material'; | ||
|
|
||
| type IconProps = { | ||
| color?: string; | ||
| width?: number; | ||
| height?: number; | ||
| sx?: SxProps<Theme>; | ||
| className?: string; | ||
| }; | ||
|
|
||
| const IconUpload = ({ | ||
| color = '#222222', | ||
| width = 24, | ||
| height = 24, | ||
| sx = {}, | ||
| className, | ||
| }: IconProps) => { | ||
| return ( | ||
| <SvgIcon | ||
| className={`organized-icon-upload ${className}`} | ||
| sx={{ width: `${width}px`, height: `${height}px`, ...sx }} | ||
| > | ||
| <svg | ||
| width="24" | ||
| height="24" | ||
| viewBox="0 0 24 24" | ||
| fill="none" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <mask | ||
| id="mask0_2513_2830" | ||
| style={{ maskType: 'alpha' }} | ||
| maskUnits="userSpaceOnUse" | ||
| x="0" | ||
| y="0" | ||
| width="24" | ||
| height="25" | ||
| > | ||
| <rect y="0.000488281" width="24" height="24" fill="#D9D9D9" /> | ||
| </mask> | ||
| <g mask="url(#mask0_2513_2830)"> | ||
| <path | ||
| d="M9 16V10L6.5 12.5L5.4 11.4L12 4.8L18.6 11.4L17.5 12.5L15 10V16H9ZM6 20C5.45 20 4.979 19.804 4.587 19.412C4.195 19.02 3.99934 18.5493 4 18V15H6V18H18V15H20V18C20 18.55 19.804 19.021 19.412 19.413C19.02 19.805 18.5493 20.0007 18 20H6Z" | ||
| fill={color} | ||
| /> | ||
| </g> | ||
| </svg> | ||
| </SvgIcon> | ||
| ); | ||
| }; | ||
|
|
||
| export default IconUpload; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,82 @@ | ||
| import { useRef, useState } from 'react'; | ||
| import { Box, DialogActions, Stack } from '@mui/material'; | ||
| import Dialog from '@components/dialog'; | ||
| import Button from '@components/button'; | ||
| import usePersonsImport from './useImportPersons'; | ||
| import { useAppTranslation } from '@hooks/index'; | ||
| import { IconUpload } from '@components/icons'; | ||
| import Typography from '@components/typography'; | ||
|
|
||
| const PersonsImport = () => { | ||
| const { t } = useAppTranslation(); | ||
| const fileInputRef = useRef<HTMLInputElement>(null); | ||
| const [isDialogOpen, setIsDialogOpen] = useState(false); | ||
|
|
||
| const { handleCsvImport, handleDownloadTemplate } = usePersonsImport(); | ||
|
|
||
| const handleImportClick = () => { | ||
| setIsDialogOpen(true); | ||
| }; | ||
|
|
||
| const handleFileSelect = () => { | ||
| setIsDialogOpen(false); | ||
| fileInputRef.current?.click(); | ||
| }; | ||
|
|
||
| const handleDialogClose = () => { | ||
| setIsDialogOpen(false); | ||
| }; | ||
|
|
||
| return ( | ||
| <Box> | ||
| <Button | ||
| variant="main" | ||
| startIcon={<IconUpload />} | ||
| onClick={handleImportClick} | ||
| > | ||
| {t('tr_import')} | ||
| </Button> | ||
|
|
||
| <Dialog open={isDialogOpen} onClose={handleDialogClose}> | ||
| <Stack spacing="16px"> | ||
| <Typography className="h2">{t('tr_fileImport')}</Typography> | ||
|
|
||
| <Typography | ||
| variant="body1" | ||
| gutterBottom | ||
| sx={{ whiteSpace: 'pre-line' }} | ||
| color="var(--grey-400)" | ||
| > | ||
| {t('tr_csvImportDescription')} | ||
| </Typography> | ||
|
|
||
| <DialogActions> | ||
| <Button variant="secondary" onClick={handleDialogClose}> | ||
| {t('tr_cancel')} | ||
| </Button> | ||
| <Button | ||
| variant="main" | ||
| onClick={handleDownloadTemplate} | ||
| // startIcon={<Download />} | ||
| > | ||
| {t('tr_templateDownload')} | ||
| </Button> | ||
| <Button variant="main" onClick={handleFileSelect}> | ||
| {t('tr_fileChoose')} | ||
| </Button> | ||
| </DialogActions> | ||
| </Stack> | ||
| </Dialog> | ||
|
|
||
| <input | ||
| type="file" | ||
| hidden | ||
| ref={fileInputRef} | ||
| accept=".csv" | ||
| onChange={handleCsvImport} | ||
| /> | ||
| </Box> | ||
| ); | ||
| }; | ||
|
|
||
| export default PersonsImport; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.