Skip to content

Commit 09ef5a6

Browse files
committed
fix tickets-crud that was introduced in issues 242
-Admins and Coordinators will be able to create tickets -Traineess will be able to see tickets assigned to them -Also Admins and Admins can also perform CRUD operations on Tickets
1 parent 911950b commit 09ef5a6

File tree

100 files changed

+1967
-1023
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1967
-1023
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"no-shadow": 0,
4242
"no-unused-expressions": 0,
4343
"react/require-default-props": 0,
44-
"import/prefer-default-export": 0
44+
"import/prefer-default-export": 0,
45+
"react/no-unstable-nested-components": 0
4546
}
4647
}

index.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@
4141
rel="stylesheet"
4242
/> -->
4343

44-
<link href="https://fonts.googleapis.com/css2?family=PT+Serif:wght@400;700&display=swap" rel="stylesheet">
45-
44+
<link
45+
href="https://fonts.googleapis.com/css2?family=PT+Serif:wght@400;700&display=swap"
46+
rel="stylesheet"
47+
/>
4648
</head>
4749
<body class="dark:bg-dark-frame-bg">
4850
<div id="tree"></div>
@@ -90,8 +92,10 @@
9092
href="https://fonts.googleapis.com/css2?family=Inria+Serif:ital@1&family=Lexend+Deca:wght@600&family=Open+Sans:wght@300;400;600;700;800&display=swap"
9193
rel="stylesheet"
9294
/> -->
93-
<link href="https://fonts.googleapis.com/css2?family=PT+Serif:wght@400;700&display=swap" rel="stylesheet">
94-
95+
<link
96+
href="https://fonts.googleapis.com/css2?family=PT+Serif:wght@400;700&display=swap"
97+
rel="stylesheet"
98+
/>
9599
</head>
96100
<body>
97101
<div id="tree"></div>

public/locales/fr/translation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,6 @@
463463
"Provide Quantity range between 1-2": "Fournir une gamme de quantité comprise entre 1-2",
464464
"Provide Professional_Skills range between 1-2": "Fournir une gamme de compétences professionnelles comprise entre 1-2",
465465
"Sprint Ratings": "Sprint Notations",
466-
"Please wait to be added to a program or cohort":"Veuillez attendre d'être ajouté à un programme ou à une cohorte",
467-
"Enter all the required information":"Entrez toutes les informations requises"
466+
"Please wait to be added to a program or cohort": "Veuillez attendre d'être ajouté à un programme ou à une cohorte",
467+
"Enter all the required information": "Entrez toutes les informations requises"
468468
}

src/App.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ function App() {
1212
return (
1313
<div className="min-h-screen">
1414
<TicketsProvider>
15-
<TraineesProvider>
16-
<Router>
17-
<ScrollToTop>
18-
<Routes>
19-
<Route path="/" element={<LandingPage />} />
20-
<Route path="/*" element={<MainRoutes />} />
21-
</Routes>
22-
</ScrollToTop>
23-
</Router>
24-
</TraineesProvider>
15+
<TraineesProvider>
16+
<Router>
17+
<ScrollToTop>
18+
<Routes>
19+
<Route path="/" element={<LandingPage />} />
20+
<Route path="/*" element={<MainRoutes />} />
21+
</Routes>
22+
</ScrollToTop>
23+
</Router>
24+
</TraineesProvider>
2525
</TicketsProvider>
2626
</div>
2727
);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from 'react';
2+
import ActionDropdown from '../components/ActionDropdown';
3+
4+
interface ActionDropdownCellProps {
5+
row: {
6+
original: any;
7+
};
8+
onView: (ticket: any) => void;
9+
onEdit?: (id: string) => void;
10+
onDelete?: (id: string) => void;
11+
canEditDelete: boolean;
12+
}
13+
14+
function ActionDropdownCell({
15+
row,
16+
onView,
17+
onEdit,
18+
onDelete,
19+
canEditDelete,
20+
}: ActionDropdownCellProps) {
21+
return (
22+
<ActionDropdown
23+
onView={() => onView(row.original)}
24+
onEdit={canEditDelete ? () => onEdit?.(row.original.id) : undefined}
25+
onDelete={canEditDelete ? () => onDelete?.(row.original.id) : undefined}
26+
canEditDelete={canEditDelete}
27+
/>
28+
);
29+
}
30+
31+
export default ActionDropdownCell;

src/Mutations/User.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ export const DROP_TTL_USER = gql`
131131
dropTTLUser(email: $email, reason: $reason)
132132
}
133133
`;
134-
export default GET_PROFILE;
134+
export default GET_PROFILE;

src/Mutations/help.mutation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { gql } from '@apollo/client';
22

33
const CREATE_TICKET = gql`
4-
mutation CreateTicket($subject: String!, $message: String!) {
5-
createTicket(subject: $subject, message: $message) {
4+
mutation CreateTicket($subject: String!, $message: String!, $assignee: ID!) {
5+
createTicket(subject: $subject, message: $message, assignee: $assignee) {
66
responseMsg
77
}
88
}

src/components/ActionDropdown.tsx

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import React, { useState } from 'react';
2+
import { FaEllipsisV, FaEye, FaEdit, FaTrashAlt } from 'react-icons/fa';
3+
4+
interface ActionDropdownProps {
5+
onView: () => void;
6+
onEdit?: () => void; // Optional to allow conditional rendering
7+
onDelete?: () => void; // Optional to allow conditional rendering
8+
canEditDelete: boolean; // Prop to control visibility of Edit and Delete
9+
}
10+
11+
function ActionDropdown({
12+
onView,
13+
onEdit,
14+
onDelete,
15+
canEditDelete,
16+
}: ActionDropdownProps) {
17+
const [isOpen, setIsOpen] = useState(false);
18+
19+
const toggleDropdown = () => setIsOpen(!isOpen);
20+
21+
return (
22+
<div className="relative">
23+
<button
24+
type="button"
25+
aria-label="Open actions menu"
26+
className="text-gray-500 hover:text-gray-700"
27+
onClick={toggleDropdown}
28+
>
29+
<FaEllipsisV className="text-2xl" />
30+
</button>
31+
{isOpen && (
32+
<div className="absolute right-0 z-10 w-48 mt-2 bg-white border border-gray-200 rounded-md shadow-lg">
33+
<button
34+
type="button"
35+
aria-label="View item"
36+
onClick={() => {
37+
onView();
38+
setIsOpen(false);
39+
}}
40+
className="flex items-center w-full px-4 py-2 text-sm text-blue-600 hover:bg-blue-100"
41+
>
42+
<FaEye className="mr-2" />
43+
View
44+
</button>
45+
{canEditDelete && (
46+
<>
47+
<button
48+
type="button"
49+
aria-label="Edit item"
50+
onClick={() => {
51+
onEdit?.();
52+
setIsOpen(false);
53+
}}
54+
className="flex items-center w-full px-4 py-2 text-sm text-yellow-600 hover:bg-yellow-100"
55+
>
56+
<FaEdit className="mr-2" />
57+
Edit
58+
</button>
59+
<button
60+
type="button"
61+
aria-label="Delete item"
62+
onClick={() => {
63+
onDelete?.();
64+
setIsOpen(false);
65+
}}
66+
className="flex items-center w-full px-4 py-2 text-sm text-red-600 hover:bg-red-100"
67+
>
68+
<FaTrashAlt className="mr-2" />
69+
Delete
70+
</button>
71+
</>
72+
)}
73+
</div>
74+
)}
75+
</div>
76+
);
77+
}
78+
79+
export default ActionDropdown;

src/components/AttendanceStatistics.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ function BarChart() {
4646

4747
return (
4848
<div className="bg-white dark:bg-dark-bg shadow-lg px-5 py-8 rounded-md w-full font-serif">
49-
<div className="">
50-
hello
51-
52-
</div>
49+
<div className="">hello</div>
5350
</div>
5451
);
5552
}

src/components/Calendar.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ const Calendar = () => {
108108
<>
109109
{/* =========================== Start:: RegisterTraineeModel =========================== */}
110110
<div
111-
className={`font-serif h-screen w-screen bg-black bg-opacity-30 backdrop-blur-sm fixed top-0 left-0 z-20 flex items-center justify-center px-4 ${addEventModel === true ? 'block' : 'hidden'
112-
}`}
111+
className={`font-serif h-screen w-screen bg-black bg-opacity-30 backdrop-blur-sm fixed top-0 left-0 z-20 flex items-center justify-center px-4 ${
112+
addEventModel === true ? 'block' : 'hidden'
113+
}`}
113114
>
114115
<div className="bg-indigo-100 dark:bg-dark-bg w-full sm:w-3/4 md:w-1/2 xl:w-4/12 rounded-lg p-4 pb-8">
115116
<div className="card-title w-full flex flex-wrap justify-center items-center ">
@@ -155,9 +156,9 @@ const Calendar = () => {
155156
value={newEvent.hostName}
156157
onChange /* istanbul ignore next */={(e) =>
157158
/* istanbul ignore next */ setNewEvent({
158-
...newEvent,
159-
hostName: e.target.value,
160-
})
159+
...newEvent,
160+
hostName: e.target.value,
161+
})
161162
}
162163
/>
163164
</div>
@@ -172,9 +173,9 @@ const Calendar = () => {
172173
selected={newEvent.start}
173174
onChange /* istanbul ignore next */={(start: any) =>
174175
/* istanbul ignore next */ setNewEvent({
175-
...newEvent,
176-
start,
177-
})
176+
...newEvent,
177+
start,
178+
})
178179
}
179180
/>
180181
</div>

0 commit comments

Comments
 (0)