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

Feature/arnav710/add delete admin flow #152

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9a25520
updated login of admin portal
Arnav710 Feb 6, 2023
dbee9fe
Move icons to /public, linting
alexzhang1618 Feb 6, 2023
d905b9e
replaced png with svg at login
Arnav710 Feb 6, 2023
597821c
changed styling using flexbox for login page
Arnav710 Feb 11, 2023
4783b5d
created the driver registeration dashboard
Arnav710 Feb 13, 2023
0b680cb
updated styles
Feb 21, 2023
2b599ee
update
Feb 24, 2023
d7fd495
Fixed dropdown using react select + Added Dropbox to Each row in tabl…
Feb 24, 2023
e0dff25
added sidebar to dashboard
Feb 28, 2023
d5ad2e3
react state update
Mar 3, 2023
d3e3252
- Added functionality to transfer records from one category to another
Mar 3, 2023
9b6a507
fixed select all/deselect all bug
Mar 3, 2023
547406b
uncheck records after transfer
Mar 3, 2023
701dcf6
updates
Mar 3, 2023
5e01e69
made changes to login part so that they align with the login page
Mar 4, 2023
8cdda35
ran linting
Mar 4, 2023
52cfdb5
merge changes
Mar 4, 2023
5aba8bf
fixing changes requested on pr
Mar 16, 2023
de02aa5
copying Login.module.css from main
Mar 16, 2023
2c16a3e
Delete firebase-config.json
alexzhang1618 Apr 6, 2023
3f8da33
merging main
Apr 14, 2023
4841253
working on PR comments
Apr 14, 2023
fcb6d4d
ran linting
Apr 14, 2023
550edc6
running npm install
Apr 15, 2023
f0810d1
Update package.json to correct Node version
alexzhang1618 Apr 15, 2023
70d97c9
allowing select all on only one tab and resetting after tab switches
Apr 15, 2023
0a35222
Merge branch 'page/Arnav710/driver-registeration-dashboard' of https:…
Apr 15, 2023
868da42
ran linting
Apr 15, 2023
4e46415
creating link for add-admin page on button click
May 12, 2023
71a2dc1
creating tsx and css files to delete admin
May 12, 2023
6c5d693
using router to go to delete admin page on row click
May 12, 2023
e2175c8
implementing basic functionality of delete user page
May 12, 2023
d5bd5c7
adding most buttons and vals and styling
May 12, 2023
9dd87b7
styling changes to the text on the delete-admin page
May 12, 2023
b14906f
worked on add admin page
PiXlRAM May 12, 2023
db57c0a
worked on add admin page
PiXlRAM May 12, 2023
ac7a99f
Merge branch 'admin-flow' of https://github.com/TritonSE/LAK-Goods-Tr…
PiXlRAM May 12, 2023
efb2a3f
styling changes to button
May 12, 2023
345f151
creating a popup component and applying it to delete-admin
May 18, 2023
1912f88
added single button popup component
PiXlRAM May 19, 2023
804b8d6
functionality in comonent for 2 buttons + styling + general styling f…
May 19, 2023
1f4ac0b
making button pointer cursor
May 19, 2023
cca85f0
okay button width
May 19, 2023
5b193e1
fixed proportion issue with popup box
PiXlRAM May 19, 2023
798a536
merging main in
Arnav710 May 26, 2023
f19a580
making key of table phone number
Arnav710 May 26, 2023
e11f45a
ran linting
Arnav710 Jun 2, 2023
0e1ff4b
Merge branch 'main' into feature/arnav710/add-delete-admin-flow
Arnav710 Jun 2, 2023
f17eb92
copying over package.json from main
Arnav710 Jun 2, 2023
0c3e76a
linting changes
Arnav710 Jun 3, 2023
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
529 changes: 509 additions & 20 deletions AdminPortal/package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion AdminPortal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
"@types/node": "18.11.18",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"bootstrap": "^5.2.3",
"eslint": "8.32.0",
"eslint-config-next": "13.1.4",
"next": "13.1.4",
"next": "^13.1.4",
"react": "18.2.0",
"react-bootstrap": "^2.7.1",
"react-dom": "18.2.0",
"react-router-dom": "^6.11.1",
"react-select": "^5.7.0",
Arnav710 marked this conversation as resolved.
Show resolved Hide resolved
"typescript": "4.9.4"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions AdminPortal/public/profile-logo-bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions AdminPortal/public/profile-logo-person.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions AdminPortal/src/components/popup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React, { useState } from 'react';
import styles from '@/styles/popup.module.css';

type PopupProps = {
name: string;
description: string;
buttonText: string;
twoButtonStyle: boolean;
onClose: () => void;
};

export function Popup({ name, description, buttonText, twoButtonStyle, onClose }: PopupProps) {
return (
<div className={styles.container}>
<div className={styles.popup}>
<div className={styles.container}>
<div className={styles.close_button}>
<button onClick={onClose} className={styles.close_button}>
X
</button>
</div>
<div className={styles.inner_div}>
<h2 className={styles.header}>{name}</h2>
</div>
<div className={styles.inner_div}>{description}</div>
{twoButtonStyle ? (
<div className={styles.twoButtonContainer}>
<button onClick={onClose} className={styles.secondary_button}>
Back
</button>
<button onClick={onClose} className={styles.primary_button}>
Delete
</button>
</div>
) : (
<div>
<button onClick={onClose} className={styles.okay_button}>
{buttonText}
</button>
</div>
)}
</div>
</div>
</div>
);
};


4 changes: 2 additions & 2 deletions AdminPortal/src/components/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export function Sidebar({ currentPage }: SidebarProps) {
<div className={styles.menu}>
<button type="button" className={styles.sidebarButton}>
<a
href="./settings"
href="./dashboard"
className={
currentPage === '/settings'
currentPage === '/dashboard'
? styles.active
: styles.buttonText
}
Expand Down
52 changes: 52 additions & 0 deletions AdminPortal/src/pages/add-admin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react';
import styles from '@/styles/add-admin.module.css';
import { Sidebar } from '../components/sidebar';
import Link from 'next/link';
import { Popup } from '@/components/popup';
import { useState } from 'react';

function AddAdminPage() {
const [showPopup, setShowPopup] = useState(false);

const handleAddClick = () =>{
setShowPopup(true);
}

const handlePopupClose = () => {
setShowPopup(false);
};
return (
<>
<main className={styles.main}>
<Sidebar currentPage={'/add-admin'} />
<div>
<Link href="/admin">
<button className={styles.button}>{'Back'}</button>
</Link>
</div>
<div className={styles.header}>{'Add Admin'}</div>
<div>
<div className={styles.title}>{'Name'}</div>
<input className={styles.input} type="text"/>
</div>
<div>
<div className={styles.title}>{'Mobile number'}</div>
<input className={styles.input} type="text"/>
</div>

<button className={styles.button2} onClick={handleAddClick}>{'Add'}</button>

{showPopup && <Popup
name="Admin Added"
description="Admin will appear in the system once they successfully login."
buttonText="Okay"
twoButtonStyle={false}
onClose={handlePopupClose}
/>
}
</main>
</>
);
}

export default AddAdminPage;
27 changes: 21 additions & 6 deletions AdminPortal/src/pages/admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import styles from '@/styles/Admin.module.css';
import { Sidebar } from '../components/sidebar';
import Image from 'next/image';
import React from 'react';
import Link from 'next/link';
import { useRouter } from 'next/router';


interface AdminUser {
id: number;
Expand All @@ -15,6 +18,7 @@ interface AdminUser {
}

export default function Admin() {
const router = useRouter();
let data = [
{
id: 1,
Expand All @@ -41,13 +45,23 @@ export default function Admin() {
role: 'Secondary Admin',
},
];

function handleRowClick(item: AdminUser) {
router.push({
pathname: '/delete-admin',
query: { id: item.id, name: item.name, phone: item.phone, role: item.role }
});
}

return (
<>
<main className={styles.main}>
<Sidebar currentPage={'/admin'} />
<div className={styles.header}>{'Manage Admin'}</div>
<div className={styles.rightalign}>
<button className={styles.button}>{'Add Admin'}</button>
<Link href="/add-admin">
<button className={styles.button}>{'Add Admin'}</button>
</Link>
<Image src={'/sort.svg'} alt="Sort" width={39} height={30} priority />
</div>
<div>
Expand All @@ -60,12 +74,13 @@ export default function Admin() {
</tr>
</thead>
<tbody className={styles.tablebody}>

{data.map((item) => (
<tr key={JSON.stringify(item)}>
<td>{item.name}</td>
<td>{item.phone}</td>
<td>{item.role}</td>
</tr>
<tr key={JSON.stringify(item)} onClick={() => handleRowClick(item)}>
Arnav710 marked this conversation as resolved.
Show resolved Hide resolved
<td>{item.name}</td>
<td>{item.phone}</td>
<td>{item.role}</td>
</tr>
))}
</tbody>
</table>
Expand Down
Loading