Skip to content
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

[DUOS-2797] Create Request LC page #2414

Merged
merged 3 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions src/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import NIHICWebform from './pages/NIHicWebform';
import PrivacyPolicy from './pages/PrivacyPolicy';
import ResearcherConsole from './pages/researcher_console/ResearcherConsole';
import UserProfile from './pages/user_profile/UserProfile';
import RequestRole from './pages/user_profile/RequestRole';
import RequestForm from './pages/user_profile/RequestForm';
import SigningOfficialResearchers from './pages/signing_official_console/SigningOfficialResearchers';
import SigningOfficialDarRequests from './pages/signing_official_console/SigningOfficialDarRequests';
import SigningOfficialDataSubmitters from './pages/signing_official_console/SigningOfficialDataSubmitters';
Expand Down Expand Up @@ -66,7 +66,8 @@ const Routes = (props) => (
<Route path="/nih_dms_policy" component={NIHDMSPolicyInfo} />
<Route path="/anvil_dms_policy" component={AnVILDMSPolicyInfo} />
<AuthenticatedRoute path="/profile" component={UserProfile} props={props} rolesAllowed={[USER_ROLES.all]} />
<AuthenticatedRoute path="/request_role" component={RequestRole} props={props} rolesAllowed={[USER_ROLES.all]} />
<AuthenticatedRoute path="/request_role" component={RequestForm} props={Object.assign({isRequestRolePage: true}, props)} rolesAllowed={[USER_ROLES.all]} />
<AuthenticatedRoute path="/request_lc" component={RequestForm} props={Object.assign({isRequestLCPage: true}, props)} rolesAllowed={[USER_ROLES.all]} />
hams7504 marked this conversation as resolved.
Show resolved Hide resolved
<AuthenticatedRoute path="/admin_review_collection/:collectionId" component={DarCollectionReview} props={Object.assign({adminPage: true}, props)} rolesAllowed={[USER_ROLES.admin]} />
<AuthenticatedRoute path="/admin_manage_users" component={AdminManageUsers} props={props} rolesAllowed={[USER_ROLES.admin]} />
<AuthenticatedRoute path="/admin_edit_user/:userId" component={AdminEditUser} props={props} rolesAllowed={[USER_ROLES.admin]} />
Expand Down
6 changes: 3 additions & 3 deletions src/pages/user_profile/LibraryCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default function LibraryCard(props) {

return <div style={{ display: 'flex' }}>
<div style={{
height: '40px',
width: '60px',
height: '50px',
width: '160px',
background: '#00A097',
borderRadius: '4px',
boxShadow: '0px 4px 4px 0px rgba(0, 0, 0, 0.25) inset',
Expand All @@ -20,7 +20,7 @@ export default function LibraryCard(props) {
fontFamily: 'Montserrat',
fontSize: '16px',
fontWeight: '500',
lineHeight: '20px',
lineHeight: '30px',
letterSpacing: '0em',
textAlign: 'center',
color: 'rgba(255, 255, 255, 1)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Notifications } from '../../libs/utils';
import { isNil } from 'lodash';
import { FormField, FormFieldTypes } from '../../components/forms/forms';

export default function RequestRole(props) {
export default function SupportRequestsPage(props) {

const profile = props.location.state?.data || undefined;

Expand All @@ -16,7 +16,7 @@ export default function RequestRole(props) {
marginBottom: '1rem'
};

const possibleSupportRequests = [
const possibleRoleRequests = [
{
key: 'checkRegisterDataset',
label: 'Register a dataset'
Expand All @@ -31,14 +31,31 @@ export default function RequestRole(props) {
}
];

const [hasSupportRequests, setHasSupportRequests] = useState(false);
const [supportRequests, setSupportRequests] = useState({
const possibleLCRequests = [
hams7504 marked this conversation as resolved.
Show resolved Hide resolved
{
key: 'requestNewLC',
label: 'Request a new library card',
isDefaultOption: true,
}
];

const possibleSupportRequests = props.isRequestRolePage ? possibleRoleRequests : (props.isRequestLCPage ? possibleLCRequests : []);

const [hasSupportRequests, setHasSupportRequests] = useState(props.isRequestLCPage);

const roleSupportRequests = {
checkRegisterDataset: false,
checkRequestDataAccess: false,
checkSOPermissions: false,
checkJoinDac: false,
extraRequest: undefined
});
};

const lcSupportRequests = {
requestNewLC: true,
};

const [supportRequests, setSupportRequests] = useState(props.isRequestRolePage ? roleSupportRequests : (props.isRequestLCPage ? lcSupportRequests : {}));

const goToPrevPage = async (event) => {
event.preventDefault();
Expand Down Expand Up @@ -119,7 +136,7 @@ export default function RequestRole(props) {
fontWeight: '600',
marginTop: 10
}}>
Request a New Role in DUOS
{props.isRequestRolePage ? 'Request a New Role' : (props.isRequestLCPage ? 'Request Library Card' : '')}
</p>
<div
style={{
Expand All @@ -135,6 +152,8 @@ export default function RequestRole(props) {
{possibleSupportRequests.map((supportRequest) => {
return <FormField
toggleText={supportRequest.label}
defaultValue={supportRequest?.isDefaultOption}
disabled={supportRequest?.isDefaultOption}
type={FormFieldTypes.CHECKBOX}
key={supportRequest.key}
id={supportRequest.key}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/user_profile/ResearcherStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function ResearcherStatus(props) {

const goToRequestRole = () => {
pageProps.history.push({
pathname: '/request_role',
pathname: '/request_lc',
state: { data: profile }
});
};
Expand Down
Loading