Skip to content

Commit

Permalink
Fix: #74 #70 [API Integration]: Data Disclosure Agreement page
Browse files Browse the repository at this point in the history
  • Loading branch information
MARZOOQUE authored and georgepadayatti committed Apr 5, 2024
1 parent 4f362ff commit 726115c
Show file tree
Hide file tree
Showing 20 changed files with 877 additions and 542 deletions.
116 changes: 103 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"license": "ISC",
"dependencies": {
"@reduxjs/toolkit": "^1.8.5",
"axios": "^1.6.8",
"jwt-decode": "^4.0.0",
"mui-image": "^1.0.7",
"react": "^18.2.0",
Expand Down
1 change: 1 addition & 0 deletions src/component/Table/TableRows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const TableRows: FC<TableRowProps> = ({
key={`Row-Cell-${index}`}
width={tHead?.bodyWidth}
>
{console.log("tHead", tHead)}
{tHead?.field
? formatDatafield(tHead?.field, item)
: tHead?.cell(item, tHead?.reference ? tHead?.reference : i )}
Expand Down
1 change: 1 addition & 0 deletions src/component/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const renderTableHead = (tableField) => {
};

const renderTableBody = (tableData, tableField, isColumnWise?) => {

return (
<TableBody>
{isColumnWise ?
Expand Down
91 changes: 13 additions & 78 deletions src/component/VersionDropDown.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from "react";
import React from "react";
import { MenuItem, Select } from "@mui/material";


const dropDownStyle = {
border: "1px solid lightgray",
outline: "none",
Expand All @@ -16,103 +15,39 @@ const dropDownStyle = {

interface Props {
record: any;
selectedValue: any;
setSelectedValue: any;
key: any;
setSelectedDropdownDataAgreementValue: any;
}

const VersionDropdown = (props: Props) => {
const {
record,
} = props;

const [ selectedValue, setSelectedValue ] = useState('1.0.1');

const dataAgreementFromRevision = [
{
version: "1.0.2",
active: true,
},
{
version: "1.0.3",
active: true,
},
{
version: "1.0.4",
active: true,
}
]

// useEffect(() => {
// let dataAgreementFromRevision: any = record.revisions?.map(
// (revision: any) => {
// return JSON.parse(revision.objectData);
// }
// );

// if (record.active === false && filter === "all") {
// dataAgreementFromRevision = [
// record,
// ...(dataAgreementFromRevision !== undefined
// ? dataAgreementFromRevision
// : []),
// ];
// setDataAgreementFromRevision(dataAgreementFromRevision);
// } else {
// setDataAgreementFromRevision(dataAgreementFromRevision);
// }
// }, [record]);

// const setDefaultSelectedValueNew =
// dataAgreementFromRevision && dataAgreementFromRevision.length > 0
// ? dataAgreementFromRevision[0].version
// : "";

const handleChange = (event: any) => {
setSelectedValue(event.target.value);
}

// const selectedRevision = dataAgreementFromRevision?.find(
// (dataAgreement: any) => dataAgreement.version === event.target.value
// );

// record.selectedRevision = selectedRevision;
// };

// const newSelectedValue =
// selectedValue[record.id] || setDefaultSelectedValueNew;
const { record } = props;

return (
<>
<Select
onChange={(e) => handleChange(e)}
variant="outlined"
value={selectedValue}
value={record.version}
fullWidth
style={{
...dropDownStyle,
width: "120px"
width: "100%",
}}
renderValue={(value) => (
<span
style={{
color:"black"
color: record.publish_flag === "false" ? "#FF0C10" : "black",
}}
>
{value}
</span>
)}
>
{dataAgreementFromRevision?.map((versions: any, index: number) => (
<MenuItem
key={index}
value={versions.version}
style={{ color: versions.active === false ? "red" : "black" }}
>
{versions.version}
</MenuItem>
))}
<MenuItem
value={record.version}
style={{
color: record.publish_flag === "false" ? "#FF0C10" : "black",
}}
>
{record.version}
</MenuItem>
</Select>
</>
);
Expand Down
Loading

0 comments on commit 726115c

Please sign in to comment.