Skip to content

Commit

Permalink
View Users various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chandra-tacc committed Nov 8, 2024
1 parent f80fb5c commit 68d7a80
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 43 deletions.
2 changes: 1 addition & 1 deletion apcd-cms/src/apps/utils/apcd_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_users():
LEFT JOIN submitter_users ON users.user_id = submitter_users.user_id
AND users.user_number = submitter_users.user_number
LEFT JOIN submitters on submitter_users.submitter_id = submitters.submitter_id
ORDER BY submitters.entity_name ASC;
ORDER BY submitters.entity_name, users.user_id ASC;
"""
cur = conn.cursor()
cur.execute(query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
@media (max-width: 767px) {
/* To label the cells */
/* RFE: Add `data-label` to each cell so we can use `attr(data-label)` */
.users-table td:nth-of-type(1):before { content: "User Name"; }
.users-table td:nth-of-type(2):before { content: "Role"; }
.users-table td:nth-of-type(3):before { content: "Organization"; }
.users-table td:nth-of-type(4):before { content: "Email"; }
.users-table td:nth-of-type(5):before { content: "Created"; }
.users-table td:nth-of-type(6):before { content: "Updated"; }
.users-table td:nth-of-type(7):before { content: "Notes"; }
.users-table td:nth-of-type(1):before { content: "User Id"; }
.users-table td:nth-of-type(2):before { content: "Name"; }
.users-table td:nth-of-type(3):before { content: "Entity Organization'"; }
.users-table td:nth-of-type(4):before { content: "Role"; }
.users-table td:nth-of-type(5):before { content: "Status"; }
.users-table td:nth-of-type(6):before { content: "User Number"; }
.users-table td:nth-of-type(7):before { content: "Actions"; }
}
101 changes: 67 additions & 34 deletions apcd-cms/src/client/src/components/Admin/ViewUsers/ViewRecordModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Modal, ModalHeader, ModalBody, Label } from 'reactstrap';
import { Modal, Row, Col, ModalBody } from 'reactstrap';
import { UserRow } from 'hooks/admin';
import styles from './ViewUsers.module.scss';
import { formatDate } from 'utils/dateUtil';
Expand All @@ -20,9 +20,9 @@ const UserDetailsModal: React.FC<UserDetailsModalProps> = ({
return (
<Modal isOpen={isOpen} toggle={toggle} className={styles.customModal}>
<div className={`modal-header ${styles.modalHeader}`}>
<Label className={styles.customModalTitle}>
<h4 className="modal-title">
Details for User: {user.user_name} ({user.user_id})
</Label>
</h4>
<button
type="button"
className={`close ${styles.customCloseButton}`}
Expand All @@ -31,37 +31,70 @@ const UserDetailsModal: React.FC<UserDetailsModalProps> = ({
<span aria-hidden="true">&#xe912;</span>
</button>
</div>
<ModalBody>
<p>
<strong>User ID:</strong> {user.user_id}
</p>
<p>
<strong>Name:</strong> {user.user_name}
</p>
<p>
<strong>User Number:</strong> {user.user_number}
</p>
<p>
<strong>Email:</strong> {user.user_email}
</p>
<p>
<strong>Entity Organization:</strong> {user.entity_name}
</p>
<p>
<strong>Role:</strong> {user.role_name}
</p>
<p>
<strong>Status:</strong> {user.status}
</p>
<p>
<strong>Created Date:</strong> {formatDate(user.created_at)}
</p>
<p>
<strong>Updated Date:</strong> {formatDate(user.updated_at)}
</p>
<p>
<strong>Notes:</strong> {user.notes ? user.notes : 'None'}
</p>

<ModalBody className="modal-content">
<div className={styles.userListing}>
<Row className={styles.userRow}>
<Col sm="3" className={styles.userkey}>
User ID:
</Col>
<Col sm="9">{user.user_id}</Col>
</Row>
<Row className={styles.userRow}>
<Col sm="3" className={styles.userkey}>
Name:
</Col>
<Col sm="9">{user.user_name}</Col>
</Row>
<Row className={styles.userRow}>
<Col sm="3" className={styles.userkey}>
User Number:
</Col>
<Col sm="9">{user.user_number}</Col>
</Row>
<Row className={styles.userRow}>
<Col sm="3" className={styles.userkey}>
Email:
</Col>
<Col sm="9">{user.user_email}</Col>
</Row>
<Row className={styles.userRow}>
<Col sm="3" className={styles.userkey}>
Entity Organization:
</Col>
<Col sm="9">{user.entity_name}</Col>
</Row>
<Row className={styles.userRow}>
<Col sm="3" className={styles.userkey}>
Role:
</Col>
<Col sm="9">{user.role_name}</Col>
</Row>
<Row className={styles.userRow}>
<Col sm="3" className={styles.userkey}>
Status:
</Col>
<Col sm="9">{user.status}</Col>
</Row>
<Row className={styles.userRow}>
<Col sm="3" className={styles.userkey}>
Created Date:
</Col>
<Col sm="9">{formatDate(user.created_at)}</Col>
</Row>
<Row className={styles.userRow}>
<Col sm="3" className={styles.userkey}>
Updated Date:
</Col>
<Col sm="9">{formatDate(user.updated_at)}</Col>
</Row>
<Row className={styles.userRow}>
<Col sm="3" className={styles.userkey}>
Notes:
</Col>
<Col sm="9">{user.notes ? user.notes : 'None'}</Col>
</Row>
</div>
</ModalBody>
</Modal>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,17 @@ $modal-width: 55%;
height: 100%; /* Adjust as needed */
padding-top: 20px;
}

.userkey {
padding-bottom: 0.05em;
padding-right: 0.25em;
}

.userListing {
padding-left: 0.25em;
padding-right: 0.25em;
}

.userRow {
padding-bottom: 0.1em;
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const ViewUsers: React.FC = () => {
</div>
</div>
<div>
<table id="viewUserTable" className="view-user-table">
<table id="viewUserTable" className="users-table">
<thead>
<tr>
{header.map((columnName: string, index: number) => (
Expand Down

0 comments on commit 68d7a80

Please sign in to comment.