Skip to content

Commit

Permalink
App history new ui design (#45)
Browse files Browse the repository at this point in the history
* application history and request

* View Submission modified

* reviewed timeline updated

* padding

* UI updation

* fixed style

* replaced bundle keyword by BUNDLED_FORM variable

---------

Co-authored-by: AbijithS-aot <abijith.s@aot-technologies.com>
Co-authored-by: Ajay krishna <ajay.k@aot-technologies.com>
  • Loading branch information
3 people authored May 17, 2023
1 parent 506f52f commit 34f0eb5
Show file tree
Hide file tree
Showing 11 changed files with 416 additions and 45 deletions.
1 change: 1 addition & 0 deletions forms-flow-web/src/actions/actionConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const ACTION_CONSTANTS = {
METRICS_SUBMISSIONS_COUNT: "METRICS_SUBMISSIONS_COUNT",
// Application history
LIST_APPLICATION_HISTORY: "LIST_APPLICATION_HISTORY",
LIST_REQUESTS:"LIST_REQUESTS",
APPLICATION_HISTORY_DETAIL: "APPLICATION_HISTORY_DETAIL",
PROCESS_LIST: "PROCESS_LIST",
DMN_PROCESS_LIST: "DMN_PROCESS_LIST",
Expand Down
7 changes: 7 additions & 0 deletions forms-flow-web/src/actions/taskApplicationHistoryActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ export const setApplicationHistoryList = (data) => (dispatch) => {
});
};

export const setRequestList = (data) => (dispatch) => {
dispatch({
type: ACTION_CONSTANTS.LIST_REQUESTS,
payload: data,
});
};

export const setUpdateHistoryLoader = (data) => (dispatch) => {
dispatch({
type: ACTION_CONSTANTS.IS_HISTORY_LOADING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
setApplicationHistoryList,
serviceActionError,
setUpdateHistoryLoader,
setRequestList,
} from "../../actions/taskApplicationHistoryActions";
import { StorageService, RequestService } from "@formsflow/service";

Expand All @@ -16,7 +17,6 @@ export const fetchApplicationAuditHistoryList = (applicationId, ...rest) => {
"<application_id>",
applicationId
);

RequestService.httpGETRequest(
apiUrlAppHistory,
{},
Expand All @@ -29,7 +29,13 @@ export const fetchApplicationAuditHistoryList = (applicationId, ...rest) => {
let data = applications.map((app) => {
return { ...app };
});
const requests = res.data.requests;
let requestData = requests.map((app) => {
return { ...app };
});

dispatch(setApplicationHistoryList(data));
dispatch(setRequestList(requestData));
dispatch(setUpdateHistoryLoader(false));
done(null, res.data);
} else {
Expand Down
104 changes: 104 additions & 0 deletions forms-flow-web/src/components/Application/Application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,107 @@
min-height: 450px;
overflow: auto;
}

.timeline {
list-style: none;
padding: 0;
margin: 50px 0;
position: relative;
}

.timeline:before {
content: '';
height: 80%;
width: 4px;
background: #c5c5c5;
position: absolute;
top: 0;
left: 50%;
margin-left: -2px;
}

.timeline li {
margin-bottom: 50px;
position: relative;
}

.timeline li:before {
content: '';
height: 20px;
width: 20px;
border-radius: 50%;
background: #fff;
border: 4px solid #c5c5c5;
position: absolute;
top: 0;
left: 50%;
margin-left: -12px;
z-index: 1;
}

.timeline li .timeline-circle {
display: flex;
align-items: center;
justify-content: center;
height: 24px;
width: 24px;
border-radius: 50%;
background: #c5c5c5;
position: absolute;
top: 0;
left: 50%;
margin-left: -12px;
z-index: 2;
}

.timeline li .timeline-circle svg {
color: #fff;
font-size: 16px;
}

.timeline li:last-child {
margin-bottom: 0;
}

.history-panel{
display: flex;
gap:15px;
margin-inline: 2rem;
margin-top: 5rem;
}

.circles-container {
display: flex;
align-items: center;
justify-content: center;
height: 100px; /* set the height of the parent container */
position: relative; /* add position relative to the parent container */
}

.circle-icon {
width: 25px;
height: 25px;
border-radius: 50%;
background-color: #ccc;
display: flex;
align-items: center;
justify-content: center;
}

.fa-times {
color: red;
}

.fa-check{
color: #12782C;
}

.line {
flex: 1;
height: 45px;
width: 1px;
margin-left: 12px;
border-right: 3px solid #CCCCCC;
}


102 changes: 102 additions & 0 deletions forms-flow-web/src/components/Application/ApplicationTimeline.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import React from "react";
import { Typography } from "@material-ui/core";
import moment from "moment";
import { MULTITENANCY_ENABLED } from "../../constants/constants";
import { useSelector } from "react-redux";

function ApplicationTimeline({ applicationHistory }) {
const tenantKey = useSelector((state) => state.tenants?.tenantId);
const formName = useSelector((state) => state.form.form.title);
const redirectUrl = MULTITENANCY_ENABLED ? `/tenant/${tenantKey}/` : "/";
function formatDate(dateString) {
let dateObj = new Date(dateString);
return moment(dateObj).format("DD/MM/YYYY");
}

function formatTime(dateString) {
let dateObj = new Date(dateString);
return moment(dateObj).format("h:mm:ssa");
}

const ptag = {
margin: "0",
};
const postiveStatus = ["New", "Submitted", "Completed","Reviewed"];
const negativeStatus = ["Rejected", "Returned"];

return (
<>
<div className="circle-icon-container ml-2">
{applicationHistory.map((e, index) => (
<>
<div className="circle-icon">
{postiveStatus.includes(
e.applicationStatus || e.requestStatus
) ? (
<i className="fa fa-check"></i>
) : negativeStatus.includes(
e.applicationStatus || e.requestStatus
) ? (
<i className="fa fa-times"></i>
) : (
""
)}
</div>
{index !== applicationHistory.length - 1 && (
<div className="line"></div>
)}
</>
))}
</div>
<div className="d-flex flex-column" style={{ marginTop: "2px" }}>
{applicationHistory.map((e, index) => {
return (
<div
key={index}
className="ml-5 d-flex align-items-center"
style={{
display: "flex",
gap: "65px",
marginTop: index !== 0 ? "25px" : "0",
}}
>
<div style={{ width: "120px" }}>
<Typography className="" style={ptag}>
{" "}
<span style={{ fontWeight: "bold" }}>
{formatDate(e.created)}
</span>
<br></br>
{formatTime(e.created)}
</Typography>
</div>
<div style={{ flex: 1 , paddingBottom: "20px"}}>
<Typography style={ptag}>
<span style={{ fontWeight: "bold", marginRight: "1.5em" }}>
{e.applicationStatus || e.requestStatus}
</span>{" "}
{formName}{" "}
<span style={{ fontWeight: "bold", marginRight: "1.5em" }}>
{e.submittedBy}
</span>
</Typography>
</div>
<div style={{ width: "150px", textAlign: "right" , paddingBottom: "20px" }}>
<a
href={`${redirectUrl}bundle/${e.formId}/submission/${e.submissionId}`}
target="_blank"
rel="noopener noreferrer"
style={{ textDecoration: "underline" , fontSize: "12px" }}
>
View Submission <i className="fa fa-pencil-square-o mr-1"></i>
</a>
</div>
</div>
);
})}
</div>
</>
);
}

export default ApplicationTimeline;
62 changes: 62 additions & 0 deletions forms-flow-web/src/components/Application/BundleHistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React, { useEffect, useState } from "react";
import { Tab, Tabs } from "@material-ui/core";
import ApplicationTimeline from "./ApplicationTimeline";
import RequestStatus from "./RequestStatus";
import { fetchApplicationAuditHistoryList } from "../../apiManager/services/applicationAuditServices";
import { useDispatch, useSelector } from "react-redux";

const BundleHistory = ({ applicationId }) => {
const dispatch = useDispatch();
const applicationHistory = useSelector((state) => state.bpmTasks.appHistory);
const requests = useSelector((state) => state.bpmTasks?.request);
useEffect(() => {
dispatch(fetchApplicationAuditHistoryList(applicationId));
}, []);

const [activeTab, setActiveTab] = useState(0);

const handleChange = (event, newValue) => {
setActiveTab(newValue);
};

return (
<div className="history-panel">
<div
style={{ height: "13rem", gap: "20px" }}
className="border-right d-flex flex-column"
>
<div className="d-flex flex-column">
<Tabs
orientation="vertical"
variant="scrollable"
value={activeTab}
borderColor="primary"
onChange={handleChange}
indicatorColor="primary"
>
<Tab
label="Application Status"
value={0}
style={{ textTransform: "capitalize" }}
/>
<Tab
label="Request Status"
value={1}
disabled={!requests.length}
style={{ textTransform: "capitalize" }}
/>
</Tabs>
</div>
</div>
{activeTab == 0 ? (
<ApplicationTimeline applicationHistory={applicationHistory} />
) : requests.length ? (
<RequestStatus requests={requests} />
) : (
""
)}
</div>
);
};

export default BundleHistory;
Loading

0 comments on commit 34f0eb5

Please sign in to comment.