Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export interface HIPProject {
admins?: string[]
members?: string[]
dataset?: BIDSDataset
hasDta?: boolean
hasEthics?: boolean
}

export interface ImportSubjectDto {
Expand Down
61 changes: 50 additions & 11 deletions src/components/Projects/Create.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMatomo } from '@jonkoops/matomo-tracker-react'
import { Save } from '@mui/icons-material'
import { LoadingButton } from '@mui/lab'
import { Box, Grid, TextField, Typography } from '@mui/material'
import { Box, Checkbox, FormControlLabel, Grid, TextField, Typography } from '@mui/material'
import { Form, Formik } from 'formik'
import * as React from 'react'
import { useNavigate } from 'react-router-dom'
Expand Down Expand Up @@ -41,6 +41,8 @@ const initialValues = {
Funding: '',
ReferencesAndLinks: '',
DatasetDOI: '',
hasDta: false,
hasEthics: false,
}

const CreateProject = () => {
Expand Down Expand Up @@ -76,12 +78,14 @@ const CreateProject = () => {
setIsLoading(true)

const adminId = user.uid
const { title, shortDescription, description, ...datasetDescription } = values
const { title, shortDescription, description, hasDta, hasEthics, ...datasetDescription } = values
const project = {
adminId,
title,
shortDescription,
description,
hasDta,
hasEthics,
datasetDescription: {
...datasetDescription,
Authors: datasetDescription.Authors.split(','),
Expand Down Expand Up @@ -135,34 +139,68 @@ const CreateProject = () => {
? errors.title
: 'Title is required'
}
sx={{ mb: 2 }}
/>
<TextField
disabled={submitting}
size='small'
id='shortDescription'
multiline
id='description'
fullWidth
name='shortDescription'
label='Project Short Description'
name='description'
label='Project Description'
type='text'
minRows={3}
value={values.shortDescription}
value={values.description}
onChange={handleChange}
onBlur={handleBlur}
/>
</Grid>

<Grid item xs={6}>
<TextField
disabled={submitting}
size='small'
multiline
id='description'
id='shortDescription'
fullWidth
name='description'
label='Project Description'
name='shortDescription'
label='Project Short Description'
type='text'
minRows={3}
value={values.description}
value={values.shortDescription}
onChange={handleChange}
onBlur={handleBlur}
sx={{ mb: 2 }}
/>
<Box>
<Typography variant='h6' sx={{ mb: 2 }}>
Permissions
</Typography>
<FormControlLabel
control={
<Checkbox
disabled={submitting}
name='hasDta'
checked={values.hasDta}
onChange={handleChange}
/>
}
label='Has Data Transfer Agreement'
sx={{ display: 'block', mb: 1 }}
/>
<FormControlLabel
control={
<Checkbox
disabled={submitting}
name='hasEthics'
checked={values.hasEthics}
onChange={handleChange}
/>
}
label='Has Ethics Approval'
sx={{ display: 'block' }}
/>
</Box>
</Grid>

<Grid item xs={12}>
Expand Down Expand Up @@ -357,6 +395,7 @@ const CreateProject = () => {
}
/>
</Grid>

</Grid>

<Grid item xs={12} sx={{ mt: 2 }}>
Expand Down
32 changes: 17 additions & 15 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,21 +338,23 @@ const Sidebar = () => {
</ListItemIcon>
<ListItemText primary='Desktops' />
</ListItemButton>
<ListItemButton
sx={{ pl: 4 }}
selected={
`${ROUTE_PREFIX}/projects/${project.name}/transfer` ===
pathname
}
onClick={() =>
handleClickNavigate(`/projects/${project.name}/transfer`)
}
>
<ListItemIcon>
<ContentCopy />
</ListItemIcon>
<ListItemText primary='Transfer' />
</ListItemButton>
{project.hasDta === true && project.hasEthics === true && (
<ListItemButton
sx={{ pl: 4 }}
selected={
`${ROUTE_PREFIX}/projects/${project.name}/transfer` ===
pathname
}
onClick={() =>
handleClickNavigate(`/projects/${project.name}/transfer`)
}
>
<ListItemIcon>
<ContentCopy />
</ListItemIcon>
<ListItemText primary='Transfer' />
</ListItemButton>
)}
<ListItemButton
sx={{ pl: 4 }}
selected={
Expand Down