@paro.io/expert-shared-components 1.14.32 → 1.14.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2 -2
  3. package/lib/components/ClientReferencesSection/DeleteButton.js +11 -11
  4. package/lib/components/ClientReferencesSection/ParoError.js +10 -10
  5. package/lib/components/ClientReferencesSection/TagsSection.js +2 -2
  6. package/lib/components/ClientReferencesSection/styles/BrandedTypography.js +2 -2
  7. package/lib/components/ClientReferencesSection/styles/Buttons.js +15 -15
  8. package/lib/components/ClientReferencesSection/styles/Name.js +5 -5
  9. package/lib/components/ClientReferencesSection/styles/NullContentConditionalColor.js +4 -4
  10. package/lib/components/ClientReferencesSection/styles/SectionBody.js +11 -11
  11. package/lib/components/ClientReferencesSection/styles/SectionTitle.js +6 -6
  12. package/lib/components/ClientReferencesSection/styles/Tags.js +2 -2
  13. package/lib/components/DiscussionThread/DiscussionThread.d.ts +25 -25
  14. package/lib/components/DiscussionThread/DiscussionThread.js +137 -137
  15. package/lib/components/DiscussionThread/chat.d.ts +22 -22
  16. package/lib/components/DiscussionThread/chat.js +106 -106
  17. package/lib/components/DiscussionThread/index.d.ts +1 -1
  18. package/lib/components/DiscussionThread/index.js +5 -5
  19. package/lib/components/DocumentCenter/DocumentTable.d.ts +15 -15
  20. package/lib/components/DocumentCenter/DocumentTable.js +350 -350
  21. package/lib/components/DocumentCenter/UploadFilesButton.d.ts +6 -6
  22. package/lib/components/DocumentCenter/UploadFilesButton.js +29 -29
  23. package/lib/components/EarningsTracker/ActiveProjectCard.d.ts +52 -52
  24. package/lib/components/EarningsTracker/ActiveProjectCard.js +161 -161
  25. package/lib/components/EarningsTracker/CenterCardUI.d.ts +13 -13
  26. package/lib/components/EarningsTracker/CenterCardUI.js +134 -134
  27. package/lib/components/EarningsTracker/EarningsTracker.d.ts +52 -52
  28. package/lib/components/EarningsTracker/EarningsTracker.js +508 -508
  29. package/lib/components/EarningsTracker/EditDateModal.d.ts +22 -22
  30. package/lib/components/EarningsTracker/EditDateModal.js +149 -149
  31. package/lib/components/EarningsTracker/EmailModal.d.ts +14 -14
  32. package/lib/components/EarningsTracker/EmailModal.js +79 -79
  33. package/lib/components/EarningsTracker/EndProjectModal.d.ts +56 -56
  34. package/lib/components/EarningsTracker/EndProjectModal.js +221 -221
  35. package/lib/components/EarningsTracker/LeftCardUI.d.ts +18 -18
  36. package/lib/components/EarningsTracker/LeftCardUI.js +189 -189
  37. package/lib/components/EarningsTracker/LogTimeModalAuthenticated.d.ts +52 -52
  38. package/lib/components/EarningsTracker/LogTimeModalAuthenticated.js +358 -358
  39. package/lib/components/EarningsTracker/ProgressBar.d.ts +4 -4
  40. package/lib/components/EarningsTracker/ProgressBar.js +66 -66
  41. package/lib/components/EarningsTracker/ReviewRequestModal.d.ts +17 -17
  42. package/lib/components/EarningsTracker/ReviewRequestModal.js +135 -135
  43. package/lib/components/EarningsTracker/RightCardUI.d.ts +46 -46
  44. package/lib/components/EarningsTracker/RightCardUI.js +231 -231
  45. package/lib/components/EarningsTracker/index.d.ts +1 -1
  46. package/lib/components/EarningsTracker/index.js +5 -5
  47. package/lib/components/Escalations/CustomTag.d.ts +3 -3
  48. package/lib/components/Escalations/CustomTag.js +25 -25
  49. package/lib/components/Escalations/ViewReponseModal.d.ts +8 -8
  50. package/lib/components/Escalations/ViewReponseModal.js +27 -27
  51. package/lib/components/ExpertProfileHeader/ActionButtonSection.js +6 -6
  52. package/lib/components/ExpertProfileHeader/ProfileSection.js +7 -7
  53. package/lib/components/HeaderNavBar/index.d.ts +2 -1
  54. package/lib/components/HeaderNavBar/index.js +3 -3
  55. package/lib/components/Invoices/TestDecisionSection.d.ts +1 -1
  56. package/lib/components/Invoices/TestDecisionSection.js +126 -126
  57. package/lib/components/OrganizationChart/OrganizationChart.d.ts +15 -15
  58. package/lib/components/OrganizationChart/OrganizationChart.js +312 -312
  59. package/lib/components/OrganizationChart/PersonCard.js +5 -5
  60. package/lib/components/OrganizationChart/utils.js +79 -79
  61. package/lib/components/ProjectCard/ProgressBar.js +4 -4
  62. package/lib/components/ProjectCard/ReviewRequestModal.js +5 -5
  63. package/lib/components/ProjectIntelligence/MissingInformation/index.js +1 -1
  64. package/lib/components/Reviews/Pagination.js +6 -6
  65. package/lib/components/ReviewsTab/RatingHeader.js +6 -6
  66. package/lib/components/ReviewsTab/expert-shared-components.code-workspace +20 -20
  67. package/lib/components/ReviewsTab/reviewRequestModal.js +5 -5
  68. package/lib/components/shared/Image.js +13 -13
  69. package/lib/components/shared/ProfileTextField.d.ts +18 -18
  70. package/lib/components/shared/ProfileTextField.js +16 -16
  71. package/lib/components/shared/StyledActionButtons.d.ts +7 -7
  72. package/lib/components/shared/StyledActionButtons.js +15 -15
  73. package/lib/components/shared/ToastNotification.d.ts +10 -10
  74. package/lib/components/shared/ToastNotification.js +63 -63
  75. package/package.json +67 -67
@@ -1,358 +1,358 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.LogTimeModalAuthenticated = exports.SelectDate = exports.constants = exports.TASK_DESCRIPTION_VALIDATION = exports.roundMinutes = void 0;
39
- const react_1 = __importStar(require("react"));
40
- const base_ui_1 = require("@paro.io/base-ui");
41
- require("date-fns");
42
- const classnames_1 = __importDefault(require("classnames"));
43
- const dayjs_1 = __importDefault(require("dayjs"));
44
- const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
45
- const ActiveProjectCard_1 = require("./ActiveProjectCard");
46
- const moment_1 = __importDefault(require("moment"));
47
- const pickers_1 = require("@material-ui/pickers");
48
- const dayjs_2 = __importDefault(require("@date-io/dayjs"));
49
- const core_1 = require("@material-ui/core");
50
- const roundMinutes = (minutes, hours) => {
51
- if (minutes === 0)
52
- return { hours: hours, minutes: 0 };
53
- if (minutes <= 15)
54
- return { hours: hours, minutes: 15 };
55
- if (minutes <= 30)
56
- return { hours: hours, minutes: 30 };
57
- if (minutes <= 45)
58
- return { hours: hours, minutes: 45 };
59
- return { hours: hours + 1, minutes: 0 };
60
- };
61
- exports.roundMinutes = roundMinutes;
62
- exports.TASK_DESCRIPTION_VALIDATION = {
63
- MAX_LENGTH: 120,
64
- MIN_LENGTH: 3,
65
- LENGTH_VALIDATION_MESSAGE: `Task Description should be greater than 3 characters.`,
66
- };
67
- const TASK_MIN_VALIDATION = {
68
- MAX_LENGTH: 59,
69
- MIN_LENGTH: 0,
70
- LENGTH_ERROR_MSG: 'Minutes should be poisitive number and less than 60.',
71
- NON_EMPTY_ERROR_MSG: "Minutes can't be empty",
72
- GREATER_THAN_ZERO: "Hours or minutes should be greater than zero"
73
- };
74
- const TASK_HOURS_VALIDATION = {
75
- MAX_LENGTH: 999,
76
- MIN_LENGTH: 0,
77
- LENGTH_ERROR_MSG: 'Hours should be less than 1000.',
78
- NON_EMPTY_ERROR_MSG: "Hours can't be empty",
79
- GREATER_THAN_ZERO: "Hours or minutes should be greater than zero"
80
- };
81
- const addHoursAndMinutes = (hours, minutes) => {
82
- const MINUTES_IN_AN_HOUR = 60;
83
- const minutesToHours = minutes / MINUTES_IN_AN_HOUR;
84
- return Number((hours + minutesToHours).toFixed(2));
85
- };
86
- const getMaxDateForAddTimeLog = () => {
87
- const date = new Date();
88
- date.setMonth(date.getMonth() + 1);
89
- return date;
90
- };
91
- const getMinDateForAddTimeLog = () => {
92
- const date = new Date();
93
- date.setFullYear(date.getFullYear() - 1);
94
- return date;
95
- };
96
- exports.constants = {
97
- MINUTES_ERROR_MESSAGE: "Minutes can't be empty",
98
- HOURS_ERROR_MESSAGE: "Hours can't be empty",
99
- DATE_FORMAT: 'MM/DD/YYYY',
100
- MAX_DATE: getMaxDateForAddTimeLog(),
101
- MIN_DATE: getMinDateForAddTimeLog(),
102
- DATE_VALIDATION_MESSAGE: 'Please enter valid date',
103
- TASK_DESCRIPTION_ERROR_MESSAGE: "Task Description can't be empty",
104
- };
105
- const SelectDate = ({ timeLogDate, setTimeLogDate, isInvalid, setIsDateInvalid, validateDate, showErrorText = true, disabled, maxDate, minDate }) => {
106
- const theme = (0, core_1.useTheme)();
107
- const mobileScreen = (0, core_1.useMediaQuery)(theme.breakpoints.down('sm'));
108
- const handleDateChange = (date) => {
109
- const currentDate = date.$d;
110
- setTimeLogDate(currentDate);
111
- validateDate(currentDate);
112
- };
113
- const onBlur = (event) => {
114
- let currentDate = new Date(event.target.value);
115
- currentDate = currentDate.toString() !== "Invalid Date" ? currentDate : "";
116
- setTimeLogDate(currentDate);
117
- validateDate(currentDate);
118
- };
119
- const getDatePicker = (showErrorText) => {
120
- return (react_1.default.createElement(pickers_1.MuiPickersUtilsProvider, { utils: dayjs_2.default },
121
- react_1.default.createElement(pickers_1.KeyboardDatePicker, { className: (0, classnames_1.default)({
122
- "base-ui-date-picker": true,
123
- "base-ui-date-picker-error": isInvalid,
124
- }), "data-testid": "date-picker-inline", disableToolbar: true, variant: mobileScreen ? "dialog" : "inline", format: exports.constants.DATE_FORMAT, margin: "normal", placeholder: "Select Date", value: timeLogDate, onChange: () => {
125
- setIsDateInvalid("");
126
- }, onBlur: onBlur, onAccept: handleDateChange, maxDate: maxDate !== null && maxDate !== void 0 ? maxDate : exports.constants.MAX_DATE, minDate: minDate !== null && minDate !== void 0 ? minDate : exports.constants.MIN_DATE, helperText: showErrorText && isInvalid && exports.constants.DATE_VALIDATION_MESSAGE, error: isInvalid !== "" && isInvalid, style: { margin: 0 }, KeyboardButtonProps: Object.assign({ "aria-label": "change date" }, { ["data-testid"]: "timelog-datepicker" }), fullWidth: true, disabled: disabled, autoOk: true })));
127
- };
128
- return (react_1.default.createElement("div", { className: "mt-1" },
129
- react_1.default.createElement("div", { className: "block w-full sm:w-1/3" }, getDatePicker(showErrorText))));
130
- };
131
- exports.SelectDate = SelectDate;
132
- const LogTimeModalAuthenticated = ({ project, freelancerId, showTimeModal, setShowTimeModal, isDateInvalid, setIsDateInvalid, validateDate, setSingleProjectData, projectData, isAuthenticated, selectedTab, submitProjectHoursMutation, GetAllProjectIrprDetailsForFreelancerDocument, getAuth0Roles, submitProjectHoursLambda, user, }) => {
133
- var _a, _b, _c, _d;
134
- const [timeLogDate, setTimeLogDate] = (0, react_1.useState)(new Date());
135
- const [hours, setHours] = (0, react_1.useState)('');
136
- const [minutes, setMinutes] = (0, react_1.useState)('');
137
- const [isHoursInvalid, setIsHoursInvalid] = (0, react_1.useState)(false);
138
- const [isMinutesInvalid, setIsMinutesInvalid] = (0, react_1.useState)(false);
139
- const [isMinutesInvalidText, setIsMinutesInvalidText] = (0, react_1.useState)(exports.constants.MINUTES_ERROR_MESSAGE);
140
- const [isHoursInvalidText, setIsHoursInvalidText] = (0, react_1.useState)(exports.constants.HOURS_ERROR_MESSAGE);
141
- const [isHoursExceeded, setIsHoursExceeded] = (0, react_1.useState)(false);
142
- const [taskDescription, setTaskDescription] = (0, react_1.useState)('');
143
- const [isTaskdescriptionInvalid, setIsTaskdescriptionInvalid] = (0, react_1.useState)(false);
144
- const [isTaskdescriptionInvalidText, setIsTaskdescriptionInvalidText] = (0, react_1.useState)(exports.constants.TASK_DESCRIPTION_ERROR_MESSAGE);
145
- const [loading, setLoading] = (0, react_1.useState)(false);
146
- const [error, setError] = (0, react_1.useState)(false);
147
- const currProjectHours = parseFloat(projectData === null || projectData === void 0 ? void 0 : projectData.hoursInvoiced);
148
- const { hoursPerWeek, minFloorHours } = (0, ActiveProjectCard_1.getAllProjectRecommendationData)({ projectData });
149
- const firstDateOfMonth = (0, moment_1.default)().startOf('month').format('MM/DD/YY');
150
- const lastDateOfMonth = (0, moment_1.default)().endOf('month').format('MM/DD/YY');
151
- const isRecurringHourlyProject = ((_a = project === null || project === void 0 ? void 0 : project.projectScope) === null || _a === void 0 ? void 0 : _a.projectFrequencyId) === 1 || ((_b = project === null || project === void 0 ? void 0 : project.projectScope) === null || _b === void 0 ? void 0 : _b.projectFrequencyId) === 2;
152
- const auth0Roles = user && getAuth0Roles(user);
153
- const disableHoursRounding = auth0Roles && auth0Roles.includes('expert_disable_rounding');
154
- const validateHours = (value) => {
155
- const empty = value == '';
156
- const maxvalue = parseInt(value) > TASK_HOURS_VALIDATION.MAX_LENGTH;
157
- const minvalue = parseInt(value) < TASK_HOURS_VALIDATION.MIN_LENGTH;
158
- if (empty || maxvalue || minvalue) {
159
- setIsHoursInvalid(true);
160
- }
161
- else {
162
- setIsHoursInvalid(false);
163
- setIsHoursInvalidText(TASK_HOURS_VALIDATION.NON_EMPTY_ERROR_MSG);
164
- }
165
- if (value === "0" && minutes === "0") {
166
- setIsHoursInvalid(true);
167
- setIsHoursInvalidText(TASK_HOURS_VALIDATION.GREATER_THAN_ZERO);
168
- }
169
- if (maxvalue || minvalue) {
170
- setIsHoursInvalidText(TASK_HOURS_VALIDATION.LENGTH_ERROR_MSG);
171
- }
172
- else {
173
- return true;
174
- }
175
- return false;
176
- };
177
- (0, react_1.useEffect)(() => {
178
- const hoursAndMinutes = addHoursAndMinutes(Number(hours), Number(minutes) || 0).toFixed(2);
179
- if (Number(hoursAndMinutes) > 24) {
180
- setIsHoursExceeded(true);
181
- }
182
- }, [hours, minutes]);
183
- const validateMinutes = (value) => {
184
- const empty = value == '';
185
- const maxvalue = parseInt(value) > TASK_MIN_VALIDATION.MAX_LENGTH;
186
- const minvalue = parseInt(value) < TASK_MIN_VALIDATION.MIN_LENGTH;
187
- if (empty || maxvalue || minvalue) {
188
- setIsMinutesInvalid(true);
189
- }
190
- else {
191
- setIsMinutesInvalid(false);
192
- setIsMinutesInvalidText(TASK_MIN_VALIDATION.NON_EMPTY_ERROR_MSG);
193
- }
194
- if (value === "0" && hours === "0") {
195
- setIsMinutesInvalid(true);
196
- setIsMinutesInvalidText(TASK_MIN_VALIDATION.GREATER_THAN_ZERO);
197
- }
198
- if (maxvalue || minvalue) {
199
- setIsMinutesInvalidText(TASK_MIN_VALIDATION.LENGTH_ERROR_MSG);
200
- }
201
- else {
202
- return true;
203
- }
204
- return false;
205
- };
206
- const validateTaskDescription = (value) => {
207
- const arealength = value.trim().length < exports.TASK_DESCRIPTION_VALIDATION.MIN_LENGTH;
208
- if (arealength) {
209
- setIsTaskdescriptionInvalid(true);
210
- }
211
- else {
212
- setIsTaskdescriptionInvalid(false);
213
- }
214
- if (arealength) {
215
- setIsTaskdescriptionInvalidText(exports.TASK_DESCRIPTION_VALIDATION.LENGTH_VALIDATION_MESSAGE);
216
- }
217
- else {
218
- return true;
219
- }
220
- return false;
221
- };
222
- const handleChange = (name, value) => {
223
- setError(false);
224
- if (name === 'hours') {
225
- const numberOnly = value.replace(/\D/g, '');
226
- setHours(numberOnly);
227
- validateHours(numberOnly);
228
- setMinutes(minutes || "0");
229
- validateMinutes(minutes || "0");
230
- setIsHoursExceeded(false);
231
- }
232
- else if (name === 'minutes') {
233
- const numberOnly = value.replace(/\D/g, '');
234
- setMinutes(numberOnly);
235
- validateMinutes(numberOnly);
236
- setHours(hours || "0");
237
- validateHours(hours || "0");
238
- setIsHoursExceeded(false);
239
- }
240
- else if (name === 'textarea') {
241
- setTaskDescription(value);
242
- validateTaskDescription(value);
243
- }
244
- };
245
- const handleBlur = () => {
246
- setHours(hours || '0');
247
- validateHours(hours || '0');
248
- setMinutes(minutes || '0');
249
- validateMinutes(minutes || '0');
250
- };
251
- const handleSubmit = () => __awaiter(void 0, void 0, void 0, function* () {
252
- setLoading(true);
253
- const isDateValid = validateDate(timeLogDate);
254
- const isHoursInValid = validateHours(hours);
255
- const minutesInvalid = validateMinutes(minutes);
256
- const taskDescriptionInvalid = validateTaskDescription(taskDescription);
257
- if (isHoursInValid && minutesInvalid && taskDescriptionInvalid) {
258
- const roundedTime = (0, exports.roundMinutes)(Number(minutes), Number(hours));
259
- const totalHours = disableHoursRounding ? parseFloat(addHoursAndMinutes(Number(hours), Number(minutes) || 0).toFixed(2)) : parseFloat((roundedTime.hours + roundedTime.minutes / 60).toFixed(2));
260
- let progressBarHours = 0;
261
- if (isRecurringHourlyProject) {
262
- progressBarHours = (0, moment_1.default)(timeLogDate).isBetween(firstDateOfMonth, lastDateOfMonth, null, '[]') ? totalHours : 0;
263
- }
264
- else {
265
- progressBarHours = totalHours;
266
- }
267
- try {
268
- const projectHours = {
269
- date: (0, dayjs_1.default)(timeLogDate).format('MM/DD/YY'),
270
- description: taskDescription,
271
- hours: totalHours,
272
- sourceId: 55,
273
- freelancerId: freelancerId,
274
- projectId: parseInt(project === null || project === void 0 ? void 0 : project.id)
275
- };
276
- if (isAuthenticated) {
277
- yield submitProjectHoursMutation({
278
- variables: {
279
- input: projectHours,
280
- },
281
- refetchQueries: [
282
- { query: GetAllProjectIrprDetailsForFreelancerDocument, variables: { freelancerId, projectType: 3, activeTabId: selectedTab } }
283
- ]
284
- });
285
- }
286
- else {
287
- yield submitProjectHoursLambda(projectHours);
288
- }
289
- const totalNewHours = currProjectHours + progressBarHours;
290
- const hoursLeftToLog = Number(hoursPerWeek);
291
- setSingleProjectData((prev) => (Object.assign(Object.assign({}, prev), { hoursInvoiced: totalNewHours, weeklyMinHoursLogged: hoursLeftToLog > 0 ? progressBarHours >= hoursLeftToLog : true, minimumFloorHoursCompleted: totalNewHours >= minFloorHours })));
292
- (0, react_hot_toast_1.default)(react_1.default.createElement(base_ui_1.Alert, { color: "success", icon: "success", label: `Logged hours successful` }), {
293
- position: 'bottom-right',
294
- style: { borderRadius: '8px' },
295
- });
296
- setLoading(false);
297
- setShowTimeModal(false);
298
- setTimeLogDate(null);
299
- setHours('');
300
- setMinutes('');
301
- setTaskDescription('');
302
- }
303
- catch (error) {
304
- //@ts-ignore
305
- setLoading(false);
306
- console.log("error updating Project Hours", error);
307
- (0, react_hot_toast_1.default)(react_1.default.createElement(base_ui_1.Alert, { color: "danger", icon: "danger", label: `Failed to update logged hours` }), {
308
- position: 'bottom-right',
309
- style: { borderRadius: '8px' },
310
- });
311
- }
312
- }
313
- else {
314
- setLoading(false);
315
- }
316
- });
317
- const onCloseModal = () => {
318
- setLoading(false);
319
- setShowTimeModal(false);
320
- setTimeLogDate(null);
321
- setHours('');
322
- setMinutes('');
323
- setTaskDescription('');
324
- };
325
- return (react_1.default.createElement(base_ui_1.Modal, { open: showTimeModal, onClose: () => onCloseModal(), size: "sm", className: "z-[100]" },
326
- react_1.default.createElement("div", { className: "flex flex-col gap-y-2" },
327
- react_1.default.createElement("h1", { className: "text-lg font-bold" },
328
- "Add time for ", (_c = project === null || project === void 0 ? void 0 : project.client) === null || _c === void 0 ? void 0 :
329
- _c.name),
330
- react_1.default.createElement("h1", { className: "text-md font-bold" },
331
- "Project: ", project === null || project === void 0 ? void 0 :
332
- project.name),
333
- react_1.default.createElement("div", { className: 'text-xs italic mb-6' }, " Note: Entries are rounded up to the nearest 15-minute increment"),
334
- react_1.default.createElement("p", { className: "font-bold" }, "Select Date"),
335
- react_1.default.createElement(exports.SelectDate, { timeLogDate: timeLogDate, setTimeLogDate: setTimeLogDate, isInvalid: false, setIsDateInvalid: setIsDateInvalid, validateDate: validateDate, maxDate: project === null || project === void 0 ? void 0 : project.endDate }),
336
- react_1.default.createElement("p", { className: "font-bold mt-2" }, "Enter Time"),
337
- react_1.default.createElement("div", { className: "flex flex-col sm:flex-row gap-x-6" },
338
- react_1.default.createElement(base_ui_1.Input, { label: "Hours", className: "sm:text-sm h-12", placeholder: "HH", name: "hours", onChange: (event) => handleChange('hours', event.target.value), onBlur: (_event) => handleBlur(), value: hours, isInvalid: isHoursInvalid, isInvalidText: isHoursInvalidText, maxLength: 3 }),
339
- react_1.default.createElement(base_ui_1.Input, { label: "Minutes", className: "sm:text-sm h-12", placeholder: "MM", name: "minutes", onChange: (event) => handleChange('minutes', event.target.value), onBlur: (_event) => handleBlur(), value: minutes, isInvalid: isMinutesInvalid, isInvalidText: isMinutesInvalidText, maxLength: 2 })),
340
- isHoursExceeded && react_1.default.createElement("div", { className: "text-red-800 text-xs mt-2" },
341
- "Submitting over 24 hours for a single date is not allowed, please contact ",
342
- react_1.default.createElement("a", { className: "text-blue-600", href: "mailto:projectsupport@paro.io" }, "projectsupport@paro.io"),
343
- " if you are experiencing any issues"),
344
- react_1.default.createElement("div", { className: "w-full" },
345
- react_1.default.createElement("textarea", { value: taskDescription, onChange: (event) => handleChange('textarea', event.target.value), cols: 1, style: { resize: 'none' }, className: (0, classnames_1.default)({
346
- 'p-2.5 mt-1 w-full bg-gray-100 focus:bg-white text-sm block sm:text-sm rounded focus:outline-none focus:ring-1 focus:ring-primary': true,
347
- 'focus:outline-none focus:ring-danger focus:border-danger border border-danger': isTaskdescriptionInvalid,
348
- 'focus:border-primary border border-gray-300': !isTaskdescriptionInvalid,
349
- }), placeholder: "Task Description" }),
350
- isTaskdescriptionInvalid && (react_1.default.createElement("div", { className: "block text-sm text-danger-dark mt-1" }, isTaskdescriptionInvalidText))),
351
- react_1.default.createElement("div", { className: "flex flex-row gap-x-2 mt-12 mb-4" },
352
- react_1.default.createElement(base_ui_1.Button, { type: "button", onClick: () => onCloseModal(), label: "CANCEL", className: "mt-4" }),
353
- react_1.default.createElement(base_ui_1.Button, { type: "button", onClick: () => { handleSubmit(); }, label: "SUBMIT", className: "mt-4 w-1/2 sm:w-1/4", color: "primary", isLoading: loading, disabled: isHoursInvalid || isMinutesInvalid || isHoursExceeded || isTaskdescriptionInvalid || !taskDescription.length || !timeLogDate || error })),
354
- error && react_1.default.createElement("div", { className: "w-full" },
355
- "You cannot log over the max hours of ", (_d = projectData === null || projectData === void 0 ? void 0 : projectData.maxHours) !== null && _d !== void 0 ? _d : 0,
356
- " for this project. Please reach out to your Customer Success Manager if you have communication from the Client that you can submit over this amount."))));
357
- };
358
- exports.LogTimeModalAuthenticated = LogTimeModalAuthenticated;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.LogTimeModalAuthenticated = exports.SelectDate = exports.constants = exports.TASK_DESCRIPTION_VALIDATION = exports.roundMinutes = void 0;
39
+ const react_1 = __importStar(require("react"));
40
+ const base_ui_1 = require("@paro.io/base-ui");
41
+ require("date-fns");
42
+ const classnames_1 = __importDefault(require("classnames"));
43
+ const dayjs_1 = __importDefault(require("dayjs"));
44
+ const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
45
+ const ActiveProjectCard_1 = require("./ActiveProjectCard");
46
+ const moment_1 = __importDefault(require("moment"));
47
+ const pickers_1 = require("@material-ui/pickers");
48
+ const dayjs_2 = __importDefault(require("@date-io/dayjs"));
49
+ const core_1 = require("@material-ui/core");
50
+ const roundMinutes = (minutes, hours) => {
51
+ if (minutes === 0)
52
+ return { hours: hours, minutes: 0 };
53
+ if (minutes <= 15)
54
+ return { hours: hours, minutes: 15 };
55
+ if (minutes <= 30)
56
+ return { hours: hours, minutes: 30 };
57
+ if (minutes <= 45)
58
+ return { hours: hours, minutes: 45 };
59
+ return { hours: hours + 1, minutes: 0 };
60
+ };
61
+ exports.roundMinutes = roundMinutes;
62
+ exports.TASK_DESCRIPTION_VALIDATION = {
63
+ MAX_LENGTH: 120,
64
+ MIN_LENGTH: 3,
65
+ LENGTH_VALIDATION_MESSAGE: `Task Description should be greater than 3 characters.`,
66
+ };
67
+ const TASK_MIN_VALIDATION = {
68
+ MAX_LENGTH: 59,
69
+ MIN_LENGTH: 0,
70
+ LENGTH_ERROR_MSG: 'Minutes should be poisitive number and less than 60.',
71
+ NON_EMPTY_ERROR_MSG: "Minutes can't be empty",
72
+ GREATER_THAN_ZERO: "Hours or minutes should be greater than zero"
73
+ };
74
+ const TASK_HOURS_VALIDATION = {
75
+ MAX_LENGTH: 999,
76
+ MIN_LENGTH: 0,
77
+ LENGTH_ERROR_MSG: 'Hours should be less than 1000.',
78
+ NON_EMPTY_ERROR_MSG: "Hours can't be empty",
79
+ GREATER_THAN_ZERO: "Hours or minutes should be greater than zero"
80
+ };
81
+ const addHoursAndMinutes = (hours, minutes) => {
82
+ const MINUTES_IN_AN_HOUR = 60;
83
+ const minutesToHours = minutes / MINUTES_IN_AN_HOUR;
84
+ return Number((hours + minutesToHours).toFixed(2));
85
+ };
86
+ const getMaxDateForAddTimeLog = () => {
87
+ const date = new Date();
88
+ date.setMonth(date.getMonth() + 1);
89
+ return date;
90
+ };
91
+ const getMinDateForAddTimeLog = () => {
92
+ const date = new Date();
93
+ date.setFullYear(date.getFullYear() - 1);
94
+ return date;
95
+ };
96
+ exports.constants = {
97
+ MINUTES_ERROR_MESSAGE: "Minutes can't be empty",
98
+ HOURS_ERROR_MESSAGE: "Hours can't be empty",
99
+ DATE_FORMAT: 'MM/DD/YYYY',
100
+ MAX_DATE: getMaxDateForAddTimeLog(),
101
+ MIN_DATE: getMinDateForAddTimeLog(),
102
+ DATE_VALIDATION_MESSAGE: 'Please enter valid date',
103
+ TASK_DESCRIPTION_ERROR_MESSAGE: "Task Description can't be empty",
104
+ };
105
+ const SelectDate = ({ timeLogDate, setTimeLogDate, isInvalid, setIsDateInvalid, validateDate, showErrorText = true, disabled, maxDate, minDate }) => {
106
+ const theme = (0, core_1.useTheme)();
107
+ const mobileScreen = (0, core_1.useMediaQuery)(theme.breakpoints.down('sm'));
108
+ const handleDateChange = (date) => {
109
+ const currentDate = date.$d;
110
+ setTimeLogDate(currentDate);
111
+ validateDate(currentDate);
112
+ };
113
+ const onBlur = (event) => {
114
+ let currentDate = new Date(event.target.value);
115
+ currentDate = currentDate.toString() !== "Invalid Date" ? currentDate : "";
116
+ setTimeLogDate(currentDate);
117
+ validateDate(currentDate);
118
+ };
119
+ const getDatePicker = (showErrorText) => {
120
+ return (react_1.default.createElement(pickers_1.MuiPickersUtilsProvider, { utils: dayjs_2.default },
121
+ react_1.default.createElement(pickers_1.KeyboardDatePicker, { className: (0, classnames_1.default)({
122
+ "base-ui-date-picker": true,
123
+ "base-ui-date-picker-error": isInvalid,
124
+ }), "data-testid": "date-picker-inline", disableToolbar: true, variant: mobileScreen ? "dialog" : "inline", format: exports.constants.DATE_FORMAT, margin: "normal", placeholder: "Select Date", value: timeLogDate, onChange: () => {
125
+ setIsDateInvalid("");
126
+ }, onBlur: onBlur, onAccept: handleDateChange, maxDate: maxDate !== null && maxDate !== void 0 ? maxDate : exports.constants.MAX_DATE, minDate: minDate !== null && minDate !== void 0 ? minDate : exports.constants.MIN_DATE, helperText: showErrorText && isInvalid && exports.constants.DATE_VALIDATION_MESSAGE, error: isInvalid !== "" && isInvalid, style: { margin: 0 }, KeyboardButtonProps: Object.assign({ "aria-label": "change date" }, { ["data-testid"]: "timelog-datepicker" }), fullWidth: true, disabled: disabled, autoOk: true })));
127
+ };
128
+ return (react_1.default.createElement("div", { className: "mt-1" },
129
+ react_1.default.createElement("div", { className: "block w-full sm:w-1/3" }, getDatePicker(showErrorText))));
130
+ };
131
+ exports.SelectDate = SelectDate;
132
+ const LogTimeModalAuthenticated = ({ project, freelancerId, showTimeModal, setShowTimeModal, isDateInvalid, setIsDateInvalid, validateDate, setSingleProjectData, projectData, isAuthenticated, selectedTab, submitProjectHoursMutation, GetAllProjectIrprDetailsForFreelancerDocument, getAuth0Roles, submitProjectHoursLambda, user, }) => {
133
+ var _a, _b, _c, _d;
134
+ const [timeLogDate, setTimeLogDate] = (0, react_1.useState)(new Date());
135
+ const [hours, setHours] = (0, react_1.useState)('');
136
+ const [minutes, setMinutes] = (0, react_1.useState)('');
137
+ const [isHoursInvalid, setIsHoursInvalid] = (0, react_1.useState)(false);
138
+ const [isMinutesInvalid, setIsMinutesInvalid] = (0, react_1.useState)(false);
139
+ const [isMinutesInvalidText, setIsMinutesInvalidText] = (0, react_1.useState)(exports.constants.MINUTES_ERROR_MESSAGE);
140
+ const [isHoursInvalidText, setIsHoursInvalidText] = (0, react_1.useState)(exports.constants.HOURS_ERROR_MESSAGE);
141
+ const [isHoursExceeded, setIsHoursExceeded] = (0, react_1.useState)(false);
142
+ const [taskDescription, setTaskDescription] = (0, react_1.useState)('');
143
+ const [isTaskdescriptionInvalid, setIsTaskdescriptionInvalid] = (0, react_1.useState)(false);
144
+ const [isTaskdescriptionInvalidText, setIsTaskdescriptionInvalidText] = (0, react_1.useState)(exports.constants.TASK_DESCRIPTION_ERROR_MESSAGE);
145
+ const [loading, setLoading] = (0, react_1.useState)(false);
146
+ const [error, setError] = (0, react_1.useState)(false);
147
+ const currProjectHours = parseFloat(projectData === null || projectData === void 0 ? void 0 : projectData.hoursInvoiced);
148
+ const { hoursPerWeek, minFloorHours } = (0, ActiveProjectCard_1.getAllProjectRecommendationData)({ projectData });
149
+ const firstDateOfMonth = (0, moment_1.default)().startOf('month').format('MM/DD/YY');
150
+ const lastDateOfMonth = (0, moment_1.default)().endOf('month').format('MM/DD/YY');
151
+ const isRecurringHourlyProject = ((_a = project === null || project === void 0 ? void 0 : project.projectScope) === null || _a === void 0 ? void 0 : _a.projectFrequencyId) === 1 || ((_b = project === null || project === void 0 ? void 0 : project.projectScope) === null || _b === void 0 ? void 0 : _b.projectFrequencyId) === 2;
152
+ const auth0Roles = user && getAuth0Roles(user);
153
+ const disableHoursRounding = auth0Roles && auth0Roles.includes('expert_disable_rounding');
154
+ const validateHours = (value) => {
155
+ const empty = value == '';
156
+ const maxvalue = parseInt(value) > TASK_HOURS_VALIDATION.MAX_LENGTH;
157
+ const minvalue = parseInt(value) < TASK_HOURS_VALIDATION.MIN_LENGTH;
158
+ if (empty || maxvalue || minvalue) {
159
+ setIsHoursInvalid(true);
160
+ }
161
+ else {
162
+ setIsHoursInvalid(false);
163
+ setIsHoursInvalidText(TASK_HOURS_VALIDATION.NON_EMPTY_ERROR_MSG);
164
+ }
165
+ if (value === "0" && minutes === "0") {
166
+ setIsHoursInvalid(true);
167
+ setIsHoursInvalidText(TASK_HOURS_VALIDATION.GREATER_THAN_ZERO);
168
+ }
169
+ if (maxvalue || minvalue) {
170
+ setIsHoursInvalidText(TASK_HOURS_VALIDATION.LENGTH_ERROR_MSG);
171
+ }
172
+ else {
173
+ return true;
174
+ }
175
+ return false;
176
+ };
177
+ (0, react_1.useEffect)(() => {
178
+ const hoursAndMinutes = addHoursAndMinutes(Number(hours), Number(minutes) || 0).toFixed(2);
179
+ if (Number(hoursAndMinutes) > 24) {
180
+ setIsHoursExceeded(true);
181
+ }
182
+ }, [hours, minutes]);
183
+ const validateMinutes = (value) => {
184
+ const empty = value == '';
185
+ const maxvalue = parseInt(value) > TASK_MIN_VALIDATION.MAX_LENGTH;
186
+ const minvalue = parseInt(value) < TASK_MIN_VALIDATION.MIN_LENGTH;
187
+ if (empty || maxvalue || minvalue) {
188
+ setIsMinutesInvalid(true);
189
+ }
190
+ else {
191
+ setIsMinutesInvalid(false);
192
+ setIsMinutesInvalidText(TASK_MIN_VALIDATION.NON_EMPTY_ERROR_MSG);
193
+ }
194
+ if (value === "0" && hours === "0") {
195
+ setIsMinutesInvalid(true);
196
+ setIsMinutesInvalidText(TASK_MIN_VALIDATION.GREATER_THAN_ZERO);
197
+ }
198
+ if (maxvalue || minvalue) {
199
+ setIsMinutesInvalidText(TASK_MIN_VALIDATION.LENGTH_ERROR_MSG);
200
+ }
201
+ else {
202
+ return true;
203
+ }
204
+ return false;
205
+ };
206
+ const validateTaskDescription = (value) => {
207
+ const arealength = value.trim().length < exports.TASK_DESCRIPTION_VALIDATION.MIN_LENGTH;
208
+ if (arealength) {
209
+ setIsTaskdescriptionInvalid(true);
210
+ }
211
+ else {
212
+ setIsTaskdescriptionInvalid(false);
213
+ }
214
+ if (arealength) {
215
+ setIsTaskdescriptionInvalidText(exports.TASK_DESCRIPTION_VALIDATION.LENGTH_VALIDATION_MESSAGE);
216
+ }
217
+ else {
218
+ return true;
219
+ }
220
+ return false;
221
+ };
222
+ const handleChange = (name, value) => {
223
+ setError(false);
224
+ if (name === 'hours') {
225
+ const numberOnly = value.replace(/\D/g, '');
226
+ setHours(numberOnly);
227
+ validateHours(numberOnly);
228
+ setMinutes(minutes || "0");
229
+ validateMinutes(minutes || "0");
230
+ setIsHoursExceeded(false);
231
+ }
232
+ else if (name === 'minutes') {
233
+ const numberOnly = value.replace(/\D/g, '');
234
+ setMinutes(numberOnly);
235
+ validateMinutes(numberOnly);
236
+ setHours(hours || "0");
237
+ validateHours(hours || "0");
238
+ setIsHoursExceeded(false);
239
+ }
240
+ else if (name === 'textarea') {
241
+ setTaskDescription(value);
242
+ validateTaskDescription(value);
243
+ }
244
+ };
245
+ const handleBlur = () => {
246
+ setHours(hours || '0');
247
+ validateHours(hours || '0');
248
+ setMinutes(minutes || '0');
249
+ validateMinutes(minutes || '0');
250
+ };
251
+ const handleSubmit = () => __awaiter(void 0, void 0, void 0, function* () {
252
+ setLoading(true);
253
+ const isDateValid = validateDate(timeLogDate);
254
+ const isHoursInValid = validateHours(hours);
255
+ const minutesInvalid = validateMinutes(minutes);
256
+ const taskDescriptionInvalid = validateTaskDescription(taskDescription);
257
+ if (isHoursInValid && minutesInvalid && taskDescriptionInvalid) {
258
+ const roundedTime = (0, exports.roundMinutes)(Number(minutes), Number(hours));
259
+ const totalHours = disableHoursRounding ? parseFloat(addHoursAndMinutes(Number(hours), Number(minutes) || 0).toFixed(2)) : parseFloat((roundedTime.hours + roundedTime.minutes / 60).toFixed(2));
260
+ let progressBarHours = 0;
261
+ if (isRecurringHourlyProject) {
262
+ progressBarHours = (0, moment_1.default)(timeLogDate).isBetween(firstDateOfMonth, lastDateOfMonth, null, '[]') ? totalHours : 0;
263
+ }
264
+ else {
265
+ progressBarHours = totalHours;
266
+ }
267
+ try {
268
+ const projectHours = {
269
+ date: (0, dayjs_1.default)(timeLogDate).format('MM/DD/YY'),
270
+ description: taskDescription,
271
+ hours: totalHours,
272
+ sourceId: 55,
273
+ freelancerId: freelancerId,
274
+ projectId: parseInt(project === null || project === void 0 ? void 0 : project.id)
275
+ };
276
+ if (isAuthenticated) {
277
+ yield submitProjectHoursMutation({
278
+ variables: {
279
+ input: projectHours,
280
+ },
281
+ refetchQueries: [
282
+ { query: GetAllProjectIrprDetailsForFreelancerDocument, variables: { freelancerId, projectType: 3, activeTabId: selectedTab } }
283
+ ]
284
+ });
285
+ }
286
+ else {
287
+ yield submitProjectHoursLambda(projectHours);
288
+ }
289
+ const totalNewHours = currProjectHours + progressBarHours;
290
+ const hoursLeftToLog = Number(hoursPerWeek);
291
+ setSingleProjectData((prev) => (Object.assign(Object.assign({}, prev), { hoursInvoiced: totalNewHours, weeklyMinHoursLogged: hoursLeftToLog > 0 ? progressBarHours >= hoursLeftToLog : true, minimumFloorHoursCompleted: totalNewHours >= minFloorHours })));
292
+ (0, react_hot_toast_1.default)(react_1.default.createElement(base_ui_1.Alert, { color: "success", icon: "success", label: `Logged hours successful` }), {
293
+ position: 'bottom-right',
294
+ style: { borderRadius: '8px' },
295
+ });
296
+ setLoading(false);
297
+ setShowTimeModal(false);
298
+ setTimeLogDate(null);
299
+ setHours('');
300
+ setMinutes('');
301
+ setTaskDescription('');
302
+ }
303
+ catch (error) {
304
+ //@ts-ignore
305
+ setLoading(false);
306
+ console.log("error updating Project Hours", error);
307
+ (0, react_hot_toast_1.default)(react_1.default.createElement(base_ui_1.Alert, { color: "danger", icon: "danger", label: `Failed to update logged hours` }), {
308
+ position: 'bottom-right',
309
+ style: { borderRadius: '8px' },
310
+ });
311
+ }
312
+ }
313
+ else {
314
+ setLoading(false);
315
+ }
316
+ });
317
+ const onCloseModal = () => {
318
+ setLoading(false);
319
+ setShowTimeModal(false);
320
+ setTimeLogDate(null);
321
+ setHours('');
322
+ setMinutes('');
323
+ setTaskDescription('');
324
+ };
325
+ return (react_1.default.createElement(base_ui_1.Modal, { open: showTimeModal, onClose: () => onCloseModal(), size: "sm", className: "z-[100]" },
326
+ react_1.default.createElement("div", { className: "flex flex-col gap-y-2" },
327
+ react_1.default.createElement("h1", { className: "text-lg font-bold" },
328
+ "Add time for ", (_c = project === null || project === void 0 ? void 0 : project.client) === null || _c === void 0 ? void 0 :
329
+ _c.name),
330
+ react_1.default.createElement("h1", { className: "text-md font-bold" },
331
+ "Project: ", project === null || project === void 0 ? void 0 :
332
+ project.name),
333
+ react_1.default.createElement("div", { className: 'text-xs italic mb-6' }, " Note: Entries are rounded up to the nearest 15-minute increment"),
334
+ react_1.default.createElement("p", { className: "font-bold" }, "Select Date"),
335
+ react_1.default.createElement(exports.SelectDate, { timeLogDate: timeLogDate, setTimeLogDate: setTimeLogDate, isInvalid: false, setIsDateInvalid: setIsDateInvalid, validateDate: validateDate, maxDate: project === null || project === void 0 ? void 0 : project.endDate }),
336
+ react_1.default.createElement("p", { className: "font-bold mt-2" }, "Enter Time"),
337
+ react_1.default.createElement("div", { className: "flex flex-col sm:flex-row gap-x-6" },
338
+ react_1.default.createElement(base_ui_1.Input, { label: "Hours", className: "sm:text-sm h-12", placeholder: "HH", name: "hours", onChange: (event) => handleChange('hours', event.target.value), onBlur: (_event) => handleBlur(), value: hours, isInvalid: isHoursInvalid, isInvalidText: isHoursInvalidText, maxLength: 3 }),
339
+ react_1.default.createElement(base_ui_1.Input, { label: "Minutes", className: "sm:text-sm h-12", placeholder: "MM", name: "minutes", onChange: (event) => handleChange('minutes', event.target.value), onBlur: (_event) => handleBlur(), value: minutes, isInvalid: isMinutesInvalid, isInvalidText: isMinutesInvalidText, maxLength: 2 })),
340
+ isHoursExceeded && react_1.default.createElement("div", { className: "text-red-800 text-xs mt-2" },
341
+ "Submitting over 24 hours for a single date is not allowed, please contact ",
342
+ react_1.default.createElement("a", { className: "text-blue-600", href: "mailto:projectsupport@paro.io" }, "projectsupport@paro.io"),
343
+ " if you are experiencing any issues"),
344
+ react_1.default.createElement("div", { className: "w-full" },
345
+ react_1.default.createElement("textarea", { value: taskDescription, onChange: (event) => handleChange('textarea', event.target.value), cols: 1, style: { resize: 'none' }, className: (0, classnames_1.default)({
346
+ 'p-2.5 mt-1 w-full bg-gray-100 focus:bg-white text-sm block sm:text-sm rounded focus:outline-none focus:ring-1 focus:ring-primary': true,
347
+ 'focus:outline-none focus:ring-danger focus:border-danger border border-danger': isTaskdescriptionInvalid,
348
+ 'focus:border-primary border border-gray-300': !isTaskdescriptionInvalid,
349
+ }), placeholder: "Task Description" }),
350
+ isTaskdescriptionInvalid && (react_1.default.createElement("div", { className: "block text-sm text-danger-dark mt-1" }, isTaskdescriptionInvalidText))),
351
+ react_1.default.createElement("div", { className: "flex flex-row gap-x-2 mt-12 mb-4" },
352
+ react_1.default.createElement(base_ui_1.Button, { type: "button", onClick: () => onCloseModal(), label: "CANCEL", className: "mt-4" }),
353
+ react_1.default.createElement(base_ui_1.Button, { type: "button", onClick: () => { handleSubmit(); }, label: "SUBMIT", className: "mt-4 w-1/2 sm:w-1/4", color: "primary", isLoading: loading, disabled: isHoursInvalid || isMinutesInvalid || isHoursExceeded || isTaskdescriptionInvalid || !taskDescription.length || !timeLogDate || error })),
354
+ error && react_1.default.createElement("div", { className: "w-full" },
355
+ "You cannot log over the max hours of ", (_d = projectData === null || projectData === void 0 ? void 0 : projectData.maxHours) !== null && _d !== void 0 ? _d : 0,
356
+ " for this project. Please reach out to your Customer Success Manager if you have communication from the Client that you can submit over this amount."))));
357
+ };
358
+ exports.LogTimeModalAuthenticated = LogTimeModalAuthenticated;