Skip to content

Commit 258da8b

Browse files
committed
add create action item functionality
1 parent e251ec4 commit 258da8b

File tree

6 files changed

+332
-444
lines changed

6 files changed

+332
-444
lines changed

public/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@
304304
"deleteActionItem": "Delete Action Item",
305305
"deleteActionItemMsg": "Do you want to remove this action item?",
306306
"yes": "Yes",
307-
"no": "No"
307+
"no": "No",
308+
"successfulCreation": "Action Item created successfully"
308309
},
309310
"eventListCard": {
310311
"location": "Location",
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import gql from 'graphql-tag';
2+
3+
/**
4+
* GraphQL query to retrieve action item categories by organization.
5+
*
6+
* @param organizationId - The ID of the organization for which action item categories are being retrieved.
7+
* @returns The list of action item categories associated with the organization.
8+
*/
9+
10+
export const ACTION_ITEM_LIST = gql`
11+
query ActionItemsByOrganization($organizationId: ID!) {
12+
actionItemsByOrganization(organizationId: $organizationId) {
13+
_id
14+
assignee {
15+
_id
16+
firstName
17+
lastName
18+
}
19+
assigner {
20+
_id
21+
firstName
22+
lastName
23+
}
24+
actionItemCategory {
25+
_id
26+
name
27+
}
28+
preCompletionNotes
29+
postCompletionNotes
30+
assignmentDate
31+
dueDate
32+
completionDate
33+
isCompleted
34+
event {
35+
_id
36+
title
37+
}
38+
creator {
39+
_id
40+
firstName
41+
lastName
42+
}
43+
}
44+
}
45+
`;

src/GraphQl/Queries/Queries.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,9 @@ export const MEMBERSHIP_REQUEST = gql`
584584
// get the list of action item categories for an organization
585585
export { ACTION_ITEM_CATEGORY_LIST } from './ActionItemCategoryQueries';
586586

587+
// get the list of action items for an organization
588+
export { ACTION_ITEM_LIST } from './ActionItemQueries';
589+
587590
// to take the list of the blocked users
588591
export { PLUGIN_GET } from './PlugInQueries';
589592
export { ADVERTISEMENTS_GET } from './PlugInQueries';
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
import React, { useState } from 'react';
2+
import { Button, Col, Row } from 'react-bootstrap';
3+
import type { InterfaceActionItemList } from 'utils/interfaces';
4+
5+
function actionItemContainer({
6+
data,
7+
}: {
8+
data: InterfaceActionItemList | undefined;
9+
}): JSX.Element {
10+
return (
11+
<>
12+
<div className="mx-1 my-4">
13+
<div className="mx-4 shadow-sm rounded-top-4">
14+
<Row className="mx-0 border border-light-subtle rounded-top-4 py-3">
15+
<Col xs={7} sm={4} md={3} lg={3} className="ps-3 fs-5 fw-bold">
16+
Assignee
17+
</Col>
18+
<Col
19+
className="fs-5 fw-bold d-none d-sm-block"
20+
sm={5}
21+
md={6}
22+
lg={4}
23+
>
24+
Action Item Category
25+
</Col>
26+
<Col className="d-none d-lg-block fs-5 fw-bold" md={4} lg={3}>
27+
Assigner
28+
</Col>
29+
<Col xs={5} sm={3} lg={2} className="fs-5 fw-bold">
30+
Options
31+
</Col>
32+
</Row>
33+
</div>
34+
35+
<div className="mx-4 bg-light-subtle border border-light-subtle border-top-0 rounded-bottom-4 shadow-sm">
36+
{data?.actionItemsByOrganization.map((actionItem, index) => (
37+
<div key={index}>
38+
<Row className={`${index === 0 ? 'pt-3' : ''} mb-3 mx-2`}>
39+
<Col
40+
sm={4}
41+
xs={7}
42+
md={3}
43+
lg={3}
44+
className="align-self-center fw-semibold text-body-secondary"
45+
>
46+
{`${actionItem.assignee.firstName} ${actionItem.assignee.lastName}`}
47+
</Col>
48+
<Col
49+
sm={5}
50+
md={6}
51+
lg={4}
52+
className="d-none d-sm-block align-self-center fw-semibold text-body-secondary"
53+
>
54+
{actionItem.actionItemCategory.name}
55+
</Col>
56+
<Col
57+
className="d-none d-lg-block align-self-center fw-semibold text-body-secondary"
58+
md={4}
59+
lg={3}
60+
>
61+
{`${actionItem.assigner.firstName} ${actionItem.assigner.lastName}`}
62+
</Col>
63+
<Col xs={5} sm={3} lg={2} className="p-0">
64+
<Button
65+
className="btn btn-sm me-2"
66+
variant="outline-secondary"
67+
// onClick={showDetailsModal}
68+
>
69+
Details
70+
</Button>
71+
<Button
72+
size="sm"
73+
data-testid="editEventModalBtn"
74+
// onClick={toggleUpdateModel}
75+
className="me-2 d-none d-xl-inline"
76+
variant="success"
77+
>
78+
{' '}
79+
<i className="fas fa-edit"></i>
80+
</Button>
81+
<Button
82+
size="sm"
83+
data-testid="deleteEventModalBtn"
84+
variant="danger"
85+
// onClick={toggleDeleteModal}
86+
>
87+
{' '}
88+
<i className="fa fa-trash"></i>
89+
</Button>
90+
</Col>
91+
</Row>
92+
93+
{index !== data.actionItemsByOrganization.length - 1 && (
94+
<hr className="mx-3" />
95+
)}
96+
</div>
97+
))}
98+
</div>
99+
</div>
100+
</>
101+
);
102+
}
103+
104+
export default actionItemContainer;

0 commit comments

Comments
 (0)