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

[FIN-8] Create RFP Table Skeleton #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@

import "bootstrap/dist/css/bootstrap.min.css";
import RFP from "pages/RFP";
import RFPAllRfp from "pages/RFPAllRfp";
import RFPFinSec from "pages/RFPFinSec";
import RFPHistoryPage from 'pages/RFPHistory';
import RFPPending from "pages/RFPPending";
import RFPRejected from "pages/RFPRejected";
import RejectedRFP from "pages/RejectedRFP";
import ResourceManagement from "pages/ResourceManagement";
import ResourcePage from "pages/Resources";

function App() {

return (
<div className="App">
<RFPHistoryPage />
<ResourcePage />
<RFP />
<RFPPending />
<RFPFinSec />
<ResourceManagement />
<RejectedRFP />
<RFPRejected />
<RFPAllRfp />
</div>
);
}
Expand Down
17 changes: 8 additions & 9 deletions src/dummy/dummyRFPs.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
[
{
"rfp_number": 0,
"rfp_number": "RFPCMIT133",
"date_submitted": "2022-01-23T09:04:45.904Z",
"status": "APPROVED"
"status": "PENDING",
"submitter": "Daniel Tan",
"executive": "Ricky"
},
{
"rfp_number": 1,
"rfp_number": "RFPCMIT132",
"date_submitted": "2022-03-23T09:04:45.904Z",
"status": "APPROVED"
},
{
"rfp_number": 2,
"date_submitted": "2022-05-23T09:04:45.904Z",
"status": "REJECTED"
"status": "PENDING",
"submitter": "Daniel Tan",
"executive": "Ricky"
}
]
10 changes: 10 additions & 0 deletions src/dummy/dummyResources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"name": "RFPs Guideline",
"link": "https://google.docs/adsfmfsjfokeo"
},
{
"name": "RFP Form",
"link": "https://google.sheet/123knfkn244vdv"
}
]
29 changes: 29 additions & 0 deletions src/pages/RFP/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useEffect, useState } from "react";
import dummyRFPs from "../../dummy/dummyRFPs.json";
import RFPTable from "pages/table/rfp/RFPTable";

const RFP = () => {
// set up states here
const [rfps, setRFPs] = useState<RFP[]>([]);

// set up effects here
useEffect(() => {
const data = dummyRFPs.map((rfp) => ({
...rfp,
date_submitted: new Date(rfp.date_submitted),
status: rfp.status as RFPStatus,
}));
setRFPs(data);
}, []);

// return component
return (
<div className="page" >
{ /* can delete the title of the page */ }
<h1>RFP</h1>
<RFPTable rfp_list={rfps}/>
</div>
);
};

export default RFP;
29 changes: 29 additions & 0 deletions src/pages/RFPAllRfp/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useEffect, useState } from "react";
import dummyRFPs from "../../dummy/dummyRFPs.json";
import RFPAllRfpTable from "pages/table/rfp/RFPAllRfpTable";

const RFPAllRfp = () => {
// set up states here
const [rfps, setRFPs] = useState<RFP[]>([]);

// set up effects here
useEffect(() => {
const data = dummyRFPs.map((rfp) => ({
...rfp,
date_submitted: new Date(rfp.date_submitted),
status: rfp.status as RFPStatus,
}));
setRFPs(data);
}, []);

// return component
return (
<div className="page" >
{ /* can delete the title of the page */ }
<h1>RFP (All Rfps)</h1>
<RFPAllRfpTable rfp_list={rfps}/>
</div>
);
};

export default RFPAllRfp;
29 changes: 29 additions & 0 deletions src/pages/RFPFinSec/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useEffect, useState } from "react";
import dummyRFPs from "../../dummy/dummyRFPs.json";
import RFPFinSecTable from "pages/table/rfp/RFPFinSecTable";

const RFPFinSec = () => {
// set up states here
const [rfps, setRFPs] = useState<RFP[]>([]);

// set up effects here
useEffect(() => {
const data = dummyRFPs.map((rfp) => ({
...rfp,
date_submitted: new Date(rfp.date_submitted),
status: rfp.status as RFPStatus,
}));
setRFPs(data);
}, []);

// return component
return (
<div className="page" >
{ /* can delete the title of the page */ }
<h1>RFP Incoming (Finance Secretary)</h1>
<RFPFinSecTable rfp_list={rfps}/>
</div>
);
};

export default RFPFinSec;
7 changes: 3 additions & 4 deletions src/pages/RFPHistory/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useEffect, useState } from "react";
import dummyRFPs from "../../dummy/dummyRFPs.json";
import RFPTable from './components/RFPTable';
import './style.scss';
import RFPHistoryTable from "pages/table/rfp/RFPHistoryTable";

const RFPHistoryPage = () => {
// set up states here
Expand All @@ -19,10 +18,10 @@ const RFPHistoryPage = () => {

// return component
return (
<div className="rfp-history-page" >
<div className="page" >
{ /* can delete the title of the page */ }
<h1>RFP History Page</h1>
<RFPTable rfp_list={rfps}/>
<RFPHistoryTable rfp_list={rfps}/>
</div>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/pages/RFPHistory/style.css.map

This file was deleted.

29 changes: 29 additions & 0 deletions src/pages/RFPPending/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useEffect, useState } from "react";
import dummyRFPs from "../../dummy/dummyRFPs.json";
import RFPPendingTable from "pages/table/rfp/RFPPendingTable";

const RFPPending = () => {
// set up states here
const [rfps, setRFPs] = useState<RFP[]>([]);

// set up effects here
useEffect(() => {
const data = dummyRFPs.map((rfp) => ({
...rfp,
date_submitted: new Date(rfp.date_submitted),
status: rfp.status as RFPStatus,
}));
setRFPs(data);
}, []);

// return component
return (
<div className="page" >
{ /* can delete the title of the page */ }
<h1>RFP (Pending)</h1>
<RFPPendingTable rfp_list={rfps}/>
</div>
);
};

export default RFPPending;
29 changes: 29 additions & 0 deletions src/pages/RFPRejected/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useEffect, useState } from "react";
import dummyRFPs from "../../dummy/dummyRFPs.json";
import RFPRejectedTable from "pages/table/rfp/RFPRejectedTable";

const RFPRejected = () => {
// set up states here
const [rfps, setRFPs] = useState<RFP[]>([]);

// set up effects here
useEffect(() => {
const data = dummyRFPs.map((rfp) => ({
...rfp,
date_submitted: new Date(rfp.date_submitted),
status: rfp.status as RFPStatus,
}));
setRFPs(data);
}, []);

// return component
return (
<div className="page" >
{ /* can delete the title of the page */ }
<h1>RFP (Rejected)</h1>
<RFPRejectedTable rfp_list={rfps}/>
</div>
);
};

export default RFPRejected;
29 changes: 29 additions & 0 deletions src/pages/RejectedRFP/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useEffect, useState } from "react";
import dummyRFPs from "../../dummy/dummyRFPs.json";
import RejectedRFPTable from "pages/table/rfp/RejectedRFPTable";

const RejectedRFP = () => {
// set up states here
const [rfps, setRFPs] = useState<RFP[]>([]);

// set up effects here
useEffect(() => {
const data = dummyRFPs.map((rfp) => ({
...rfp,
date_submitted: new Date(rfp.date_submitted),
status: rfp.status as RFPStatus,
}));
setRFPs(data);
}, []);

// return component
return (
<div className="page" >
{ /* can delete the title of the page */ }
<h1>Rejected RFP</h1>
<RejectedRFPTable rfp_list={rfps}/>
</div>
);
};

export default RejectedRFP;
24 changes: 24 additions & 0 deletions src/pages/ResourceManagement/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { useEffect, useState } from "react";
import dummyResources from "../../dummy/dummyResources.json";
import ResourceManagementTable from "pages/table/resource/ResourceManagementTable";

const ResourceManagement = () => {
// set up states here
const [resources, setResources] = useState<Resource[]>([]);

// set up effects here
useEffect(() => {
setResources(dummyResources);
}, []);

// return component
return (
<div className="page">
{ /* can delete the title of the page */ }
<h1>Resource Management Page</h1>
<ResourceManagementTable resource_list={resources}/>
</div>
);
};

export default ResourceManagement;
24 changes: 24 additions & 0 deletions src/pages/Resources/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { useEffect, useState } from "react";
import dummyResources from "../../dummy/dummyResources.json";
import ResourceTable from "pages/table/resource/ResourceTable";

const ResourcePage = () => {
// set up states here
const [resources, setResources] = useState<Resource[]>([]);

// set up effects here
useEffect(() => {
setResources(dummyResources);
}, []);

// return component
return (
<div className="page">
{ /* can delete the title of the page */ }
<h1>Resource Page</h1>
<ResourceTable resource_list={resources}/>
</div>
);
};

export default ResourcePage;
60 changes: 60 additions & 0 deletions src/pages/table/resource/ResourceManagementTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//https://www.figma.com/file/oLAkh2SB1j30ih53E6HFyq/Financial-Secretary-Claiming-Website?node-id=113-11&t=ccxtLLnHPMViuz6A-0

import { Table, Button, Group } from "@mantine/core";
import '../style.scss';

type ResourceProps = {
resource_list: Resource[];
};

const TableHeaders = {
name: "Name",
link: "Link",
action: "Action"
};

const ButtonNames = {
edit: "Edit",
delete: "Delete"
}

// TODO
const onEditResource = (resource: Resource) => {};

// TODO
const onDeleteResource = (resource: Resource) => {};

const ResourceManagementTable = ({ resource_list }: ResourceProps) => {
const resourceRows = resource_list.map((resource) => (
<tr key={crypto.randomUUID()}>
<td>{resource.name}</td>
<td><a href={resource.link}>{resource.link}</a></td>
<td>
<Group className="btn-group">
<Button variant="light" color="green" onClick={() => onEditResource(resource)} >{ButtonNames.edit}</Button>
<Button variant="light" color="red" onClick={() => onDeleteResource(resource)} >{ButtonNames.delete}</Button>
</Group>
</td>
</tr>
));

return (
<Table
verticalSpacing="md"
horizontalSpacing="md"
highlightOnHover
className="table"
>
<thead>
<tr className="table-header">
<th>{TableHeaders.name}</th>
<th>{TableHeaders.link}</th>
<th>{TableHeaders.action}</th>
</tr>
</thead>
<tbody className="table-body">{resourceRows}</tbody>
</Table>
);
};

export default ResourceManagementTable;
Loading