Skip to content

Commit

Permalink
Merge pull request #38 from melpsh/003-sep-27-compliance-tracker-cont…
Browse files Browse the repository at this point in the history
…rol-pane

003 sep 27 compliance tracker control pane
  • Loading branch information
MuhammadKhalilzadeh authored Oct 4, 2024
2 parents ac7afd4 + 9e4d553 commit 2f978d7
Show file tree
Hide file tree
Showing 15 changed files with 1,530 additions and 256 deletions.
882 changes: 748 additions & 134 deletions Clients/package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Clients/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@fontsource/roboto": "^5.1.0",
"@mui/icons-material": "^6.1.0",
"@mui/icons-material": "^6.1.2",
"@mui/lab": "^6.0.0-beta.10",
"@mui/material": "^6.1.1",
"@mui/styled-engine-sc": "^6.1.0",
"@mui/x-date-pickers": "^7.18.0",
"@reduxjs/toolkit": "^2.2.7",
"@svgr/rollup": "^8.1.0",
"@tiptap/react": "^2.8.0",
"@tiptap/starter-kit": "^2.8.0",
"dayjs": "^1.11.13",
"libphonenumber-js": "^1.11.9",
"react": "^18.3.1",
Expand Down
14 changes: 1 addition & 13 deletions Clients/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import Assessment from "./presentation/pages/Assessment";
import Vendors from "./presentation/pages/Vendors";
import Setting from "./presentation/pages/Setting";
import Team from "./presentation/pages/Team";
import {
complianceMetrics,
complianceDetails,
} from "./presentation/pages/ComplianceTracker/complianceData";

function App() {
const mode = useSelector((state: any) => state.ui?.mode || "light");
Expand All @@ -25,15 +21,7 @@ function App() {
<Routes>
<Route path="/" element={<Dashboard />}>
<Route path="/" element={<Home />} />
<Route
path="/compliance-tracker"
element={
<ComplianceTracker
complianceMetrics={complianceMetrics}
complianceDetails={complianceDetails}
/>
}
/>
<Route path="/compliance-tracker" element={<ComplianceTracker />} />
<Route path="/assessment" element={<Assessment />} />
<Route path="/vendors" element={<Vendors />} />
<Route path="/setting" element={<Setting />} />
Expand Down
3 changes: 3 additions & 0 deletions Clients/src/presentation/assets/icons/cloudUpload.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 Clients/src/presentation/assets/icons/headingIcone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const DatePicker = ({
color={theme.palette.text.secondary}
fontSize={13}
fontWeight={500}
marginBottom={theme.spacing(3)}
marginBottom={theme.spacing(2)}
>
{label}
{isRequired ? (
Expand Down
134 changes: 134 additions & 0 deletions Clients/src/presentation/components/Inputs/Dropdowns/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { Grid, Stack, Typography, useTheme } from "@mui/material";
import { useState } from "react";
import Select from "../Select";
import DatePicker from "../Datepicker";
import Field from "../Field";

const DropDowns = () => {
const [status, setStatus] = useState<string | number>("");
const [approver, setApprover] = useState<string | number>("");
const [riskReview, setRiskReview] = useState<string | number>("");
const [owner, setOwner] = useState<string | number>("");
const [reviewer, setReviewer] = useState<string | number>("");
const theme = useTheme();

const inputStyles = { width: 200, height: 34 };

return (
<>
<Stack
display="flex"
flexDirection="row"
justifyContent="space-between"
alignItems="center"
>
<Select
id="status"
label="Status:"
value={status}
onChange={(e) => setStatus(e.target.value)}
items={[
{ _id: 10, name: "Waiting" },
{ _id: 20, name: "In progress" },
{ _id: 30, name: "Done" },
]}
sx={inputStyles}
/>

<Select
id="Approver"
label="Approver:"
value={approver}
onChange={(e) => setApprover(e.target.value)}
items={[
{ _id: 10, name: "Option 1" },
{ _id: 20, name: "Option 2" },
{ _id: 30, name: "Option 3" },
]}
sx={inputStyles}
/>

<Select
id="Risk review"
label="Risk review:"
value={riskReview}
onChange={(e) => setRiskReview(e.target.value)}
items={[
{ _id: 10, name: "Acceptable risk" },
{ _id: 20, name: "Residual risk" },
{ _id: 30, name: "Unacceptable risk" },
]}
sx={inputStyles}
/>
</Stack>

{/* Second Row */}
<Stack
display="flex"
flexDirection="row"
justifyContent="space-between"
alignItems="center"
sx={{ mt: 3 }}
>
<Select
id="Owner"
label="Owner:"
value={owner}
onChange={(e) => setOwner(e.target.value)}
items={[
{ _id: 10, name: "Option 1" },
{ _id: 20, name: "Option 2" },
{ _id: 30, name: "Option 3" },
]}
sx={inputStyles}
/>

<Select
id="Reviewer"
label="Reviewer:"
value={reviewer}
onChange={(e) => setReviewer(e.target.value)}
items={[
{ _id: 10, name: "Option 1" },
{ _id: 20, name: "Option 2" },
{ _id: 30, name: "Option 3" },
]}
sx={inputStyles}
/>

<DatePicker
label="Due date:"
sx={inputStyles}
/>
</Stack>

<Typography
fontSize={13}
fontWeight={400}
sx={{ textAlign: "left", mt: 4, ml: 2 }}
>
Implementation details:
</Typography>
<Grid container sx={{ mt: 3 }}>
<Grid
item
xs={12}
sx={{
height: 73,
borderRadius: theme.shape.borderRadius,
"& .MuiInputBase-root": {
height: "73px",
},
"& .MuiOutlinedInput-input": {
paddingTop: "20px",
},
}}
>
<Field type="description" />
</Grid>
</Grid>
</>
);
};

export default DropDowns;
16 changes: 5 additions & 11 deletions Clients/src/presentation/components/Inputs/Field/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ import {
IconButton,
InputAdornment,
Stack,
SxProps,
TextField,
Theme,
Typography,
useTheme,
} from "@mui/material";
Expand All @@ -53,6 +55,7 @@ interface FieldProps {
error?: string;
disabled?: boolean;
width?: number | string;
sx?: SxProps<Theme>;
}

const Field = forwardRef(
Expand All @@ -73,6 +76,7 @@ const Field = forwardRef(
error,
disabled,
width,
sx,
}: FieldProps,
ref: ForwardedRef<HTMLInputElement>
) => {
Expand Down Expand Up @@ -153,17 +157,7 @@ const Field = forwardRef(
},
},
}}
sx={
type === "url"
? {
"& .MuiInputBase-root": { padding: 0 },
"& .MuiStack-root": {
borderTopLeftRadius: theme.shape.borderRadius,
borderBottomLeftRadius: theme.shape.borderRadius,
},
}
: {}
}
sx={sx}
InputProps={{
startAdornment: type === "url" && (
<Stack
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { Box, Typography, Tooltip, IconButton } from "@mui/material";
import React, { useState } from "react";
import CloudUpload from "../../../assets/icons/cloudUpload.svg";
import RichTextEditor from "../../../components/RichTextEditor/index";

interface AuditorFeedbackProps {
activeSection: string;
}

const AuditorFeedback: React.FC<AuditorFeedbackProps> = ({ activeSection }) => {
const [file, setFile] = useState<File | null>(null);

const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
if (e.target.files && e.target.files[0]) {
setFile(e.target.files[0]);
}
};

const UploadFile = () => {
document.getElementById("file-upload")?.click();
};

const handleContentChange = (content: string) => {
console.log("Updated content: ", content);
};

return (
<Box sx={{ width: "100%", padding: 2 }}>
<Typography sx={{ mb: 2 }}>
{activeSection === "Evidence" ? "Evidence:" : "Auditor Feedback:"}
</Typography>

{/* Use the RichTextEditor component */}
<RichTextEditor onContentChange={handleContentChange} />

{/* File Upload */}
<Box
sx={{
display: "flex",
flexDirection: "row-reverse",
border: "1px dotted",
borderColor: "#D0D5DD",
width: 472,
alignItems: "center",
cursor: "pointer",
}}
onClick={UploadFile}
>
<Typography sx={{ color: "black", padding: 5, marginLeft: 1, paddingLeft: 0 }}>
You can also drag and drop, or click to upload a feedback.
</Typography>
<Tooltip title="Attach a file">
<IconButton component="label">
<img
src={CloudUpload}
alt="Upload"
style={{ height: 19, width: 20 }}
/>
<input type="file" hidden id="file-upload" onChange={handleFileUpload} />
</IconButton>
</Tooltip>
</Box>

{file && (
<Typography variant="body2" sx={{ mt: 2 }}>
Attached file: {file.name}
</Typography>
)}
</Box>
);
};

export default AuditorFeedback;
Loading

0 comments on commit 2f978d7

Please sign in to comment.