Skip to content

Commit d186b17

Browse files
committed
add sorting
1 parent 3db3cd0 commit d186b17

File tree

8 files changed

+190
-179
lines changed

8 files changed

+190
-179
lines changed

src/GraphQl/Mutations/ActionItemMutations.ts

Lines changed: 0 additions & 85 deletions
This file was deleted.

src/GraphQl/Mutations/mutations.ts

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,67 @@ export const UPDATE_ACTION_ITEM_CATEGORY_MUTATION = gql`
258258
}
259259
`;
260260

261+
// to create an action item
262+
263+
export const CREATE_ACTION_ITEM_MUTATION = gql`
264+
mutation CreateActionItem(
265+
$actionItemCategoryId: ID!
266+
$assigneeId: ID!
267+
$preCompletionNotes: String
268+
$dueDate: Date
269+
$eventId: ID
270+
) {
271+
createActionItem(
272+
actionItemCategoryId: $actionItemCategoryId
273+
data: {
274+
assigneeId: $assigneeId
275+
preCompletionNotes: $preCompletionNotes
276+
dueDate: $dueDate
277+
eventId: $eventId
278+
}
279+
) {
280+
_id
281+
}
282+
}
283+
`;
284+
285+
// to update an action item
286+
287+
export const UPDATE_ACTION_ITEM_MUTATION = gql`
288+
mutation UpdateActionItem(
289+
$actionItemId: ID!
290+
$assigneeId: ID!
291+
$preCompletionNotes: String
292+
$postCompletionNotes: String
293+
$dueDate: Date
294+
$completionDate: Date
295+
$isCompleted: Boolean
296+
) {
297+
updateActionItem(
298+
id: $actionItemId
299+
data: {
300+
assigneeId: $assigneeId
301+
preCompletionNotes: $preCompletionNotes
302+
postCompletionNotes: $postCompletionNotes
303+
dueDate: $dueDate
304+
completionDate: $completionDate
305+
isCompleted: $isCompleted
306+
}
307+
) {
308+
_id
309+
}
310+
}
311+
`;
312+
313+
// to delete an action item
314+
315+
export const DELETE_ACTION_ITEM_MUTATION = gql`
316+
mutation RemoveActionItem($actionItemId: ID!) {
317+
removeActionItem(id: $actionItemId) {
318+
_id
319+
}
320+
}
321+
`;
261322
// to create the event by any organization
262323

263324
export const CREATE_EVENT_MUTATION = gql`
@@ -600,11 +661,6 @@ export const REGISTER_EVENT = gql`
600661
}
601662
`;
602663

603-
// Create, update and delete Action Items
604-
export { CREATE_ACTION_ITEM_MUTATION } from './ActionItemMutations';
605-
export { UPDATE_ACTION_ITEM_MUTATION } from './ActionItemMutations';
606-
export { DELETE_ACTION_ITEM_MUTATION } from './ActionItemMutations';
607-
608664
// Changes the role of a event in an organization and add and remove the event from the organization
609665
export { ADD_EVENT_ATTENDEE } from './EventAttendeeMutations';
610666
export { REMOVE_EVENT_ATTENDEE } from './EventAttendeeMutations';

src/GraphQl/Queries/ActionItemQueries.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/GraphQl/Queries/Queries.ts

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,51 @@ export const ACTION_ITEM_CATEGORY_LIST = gql`
102102
}
103103
`;
104104

105+
// Query to get the action items list
106+
107+
export const ACTION_ITEM_LIST = gql`
108+
query ActionItemsByOrganization(
109+
$organizationId: ID!
110+
$orderBy: ActionItemsOrderByInput
111+
) {
112+
actionItemsByOrganization(
113+
organizationId: $organizationId
114+
orderBy: $orderBy
115+
) {
116+
_id
117+
assignee {
118+
_id
119+
firstName
120+
lastName
121+
}
122+
assigner {
123+
_id
124+
firstName
125+
lastName
126+
}
127+
actionItemCategory {
128+
_id
129+
name
130+
}
131+
preCompletionNotes
132+
postCompletionNotes
133+
assignmentDate
134+
dueDate
135+
completionDate
136+
isCompleted
137+
event {
138+
_id
139+
title
140+
}
141+
creator {
142+
_id
143+
firstName
144+
lastName
145+
}
146+
}
147+
}
148+
`;
149+
105150
// Query to take the User list
106151
export const USER_LIST = gql`
107152
query Users(
@@ -593,9 +638,6 @@ export const MEMBERSHIP_REQUEST = gql`
593638
}
594639
`;
595640

596-
// get the list of action items for an organization
597-
export { ACTION_ITEM_LIST } from './ActionItemQueries';
598-
599641
// to take the list of the blocked users
600642
export { PLUGIN_GET } from './PlugInQueries';
601643
export { ADVERTISEMENTS_GET } from './PlugInQueries';

src/components/ActionItemsContainer/ActionItemsContainer.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import ActionItemDeleteModal from '../../screens/OrganizationActionItems/ActionI
2020
function actionItemsContainer({
2121
actionItemsData,
2222
membersData,
23-
refetch,
23+
actionItemsRefetch,
2424
}: {
2525
actionItemsData: InterfaceActionItemList | undefined;
2626
membersData: any;
27-
refetch: any;
27+
actionItemsRefetch: any;
2828
}): JSX.Element {
2929
const { t } = useTranslation('translation', {
3030
keyPrefix: 'organizationActionItems',
@@ -104,7 +104,7 @@ function actionItemsContainer({
104104
},
105105
});
106106

107-
refetch();
107+
actionItemsRefetch();
108108
hideUpdateModal();
109109
toast.success(t('successfulUpdation'));
110110
} catch (error: any) {
@@ -122,7 +122,7 @@ function actionItemsContainer({
122122
},
123123
});
124124

125-
refetch();
125+
actionItemsRefetch();
126126
toggleDeleteModal();
127127
toast.success(t('successfulDeletion'));
128128
} catch (error: any) {
@@ -152,7 +152,7 @@ function actionItemsContainer({
152152
<div className="mx-4 shadow-sm rounded-top-4">
153153
<Row className="mx-0 border border-light-subtle rounded-top-4 py-3">
154154
<Col xs={7} sm={4} md={3} lg={3} className="ps-3 fs-5 fw-bold">
155-
Assignee
155+
<div className="ms-2">Assignee</div>
156156
</Col>
157157
<Col
158158
className="fs-5 fw-bold d-none d-sm-block"
@@ -163,7 +163,7 @@ function actionItemsContainer({
163163
Action Item Category
164164
</Col>
165165
<Col className="d-none d-lg-block fs-5 fw-bold" md={4} lg={3}>
166-
Status
166+
<div className="ms-3">Status</div>
167167
</Col>
168168
<Col xs={5} sm={3} lg={2} className="fs-5 fw-bold">
169169
Options
@@ -198,7 +198,15 @@ function actionItemsContainer({
198198
md={4}
199199
lg={3}
200200
>
201-
{actionItem.isCompleted ? 'Completed' : 'In Progress'}
201+
<div
202+
className={`lh-base w-50 badge rounded-pill ${
203+
actionItem.isCompleted
204+
? 'text-bg-success text-white'
205+
: 'text-bg-warning'
206+
}`}
207+
>
208+
{actionItem.isCompleted ? 'Completed' : 'Active'}
209+
</div>
202210
</Col>
203211
<Col xs={5} sm={3} lg={2} className="p-0">
204212
<Button

src/screens/OrganizationActionItems/ActionItemPreviewModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const ActionItemPreviewModal: React.FC<InterfaceActionItemCreateModalProps> = ({
8383
<p className={styles.preview}>
8484
{t('status')}:{' '}
8585
<span className={styles.view}>
86-
{formState.isCompleted ? 'Completed' : 'In Progress'}
86+
{formState.isCompleted ? 'Completed' : 'Active'}
8787
</span>
8888
</p>
8989
</div>

src/screens/OrganizationActionItems/OrganizationActionItems.module.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,21 @@ hr {
121121
}
122122

123123
.message {
124+
margin-top: 25%;
124125
display: flex;
125126
justify-content: center;
126127
align-items: center;
127128
flex-direction: column;
128129
}
129130

131+
.preview {
132+
display: flex;
133+
flex-direction: row;
134+
font-weight: 900;
135+
font-size: 16px;
136+
color: rgb(80, 80, 80);
137+
}
138+
130139
.searchForm {
131140
display: inline;
132141
}
@@ -141,6 +150,13 @@ hr {
141150
width: 65%;
142151
}
143152

153+
.view {
154+
margin-left: 2%;
155+
font-weight: 600;
156+
font-size: 16px;
157+
color: #707070;
158+
}
159+
144160
@media (max-width: 1020px) {
145161
.btnsContainer {
146162
flex-direction: column;

0 commit comments

Comments
 (0)