@paro.io/expert-shared-components 1.9.5 → 1.9.7
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.
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/lib/components/EarningsTracker/ActiveProjectCard.d.ts +52 -0
- package/lib/components/EarningsTracker/ActiveProjectCard.js +161 -0
- package/lib/components/EarningsTracker/CenterCardUI.d.ts +13 -0
- package/lib/components/EarningsTracker/CenterCardUI.js +134 -0
- package/lib/components/EarningsTracker/EarningsTracker.d.ts +52 -0
- package/lib/components/EarningsTracker/EarningsTracker.js +508 -0
- package/lib/components/EarningsTracker/EditDateModal.d.ts +22 -0
- package/lib/components/EarningsTracker/EditDateModal.js +149 -0
- package/lib/components/EarningsTracker/EmailModal.d.ts +14 -0
- package/lib/components/EarningsTracker/EmailModal.js +79 -0
- package/lib/components/EarningsTracker/EndProjectModal.d.ts +56 -0
- package/lib/components/EarningsTracker/EndProjectModal.js +221 -0
- package/lib/components/EarningsTracker/LeftCardUI.d.ts +18 -0
- package/lib/components/EarningsTracker/LeftCardUI.js +189 -0
- package/lib/components/EarningsTracker/LogTimeModalAuthenticated.d.ts +52 -0
- package/lib/components/EarningsTracker/LogTimeModalAuthenticated.js +358 -0
- package/lib/components/EarningsTracker/ProgressBar.d.ts +4 -0
- package/lib/components/EarningsTracker/ProgressBar.js +66 -0
- package/lib/components/EarningsTracker/ReviewRequestModal.d.ts +17 -0
- package/lib/components/EarningsTracker/ReviewRequestModal.js +135 -0
- package/lib/components/EarningsTracker/RightCardUI.d.ts +46 -0
- package/lib/components/EarningsTracker/RightCardUI.js +231 -0
- package/lib/components/EarningsTracker/index.d.ts +1 -0
- package/lib/components/EarningsTracker/index.js +5 -0
- package/lib/components/ExpertProfileHeader/ProfileSection.js +0 -9
- package/lib/components/HeaderNavBar/index.d.ts +1 -1
- package/lib/components/HeaderNavBar/index.js +7 -2
- package/lib/components/ProjectCard/ActiveProjectCard.d.ts +58 -0
- package/lib/components/ProjectCard/ActiveProjectCard.js +163 -0
- package/lib/components/ProjectCard/CenterCardUI.d.ts +13 -0
- package/lib/components/ProjectCard/CenterCardUI.js +134 -0
- package/lib/components/ProjectCard/EditDateModal.d.ts +22 -0
- package/lib/components/ProjectCard/EditDateModal.js +149 -0
- package/lib/components/ProjectCard/EmailModal.d.ts +14 -0
- package/lib/components/ProjectCard/EmailModal.js +79 -0
- package/lib/components/ProjectCard/EndProjectModal.d.ts +56 -0
- package/lib/components/ProjectCard/EndProjectModal.js +221 -0
- package/lib/components/ProjectCard/LeftCardUI.d.ts +18 -0
- package/lib/components/ProjectCard/LeftCardUI.js +177 -0
- package/lib/components/ProjectCard/LogTimeModalAuthenticated.d.ts +52 -0
- package/lib/components/ProjectCard/LogTimeModalAuthenticated.js +358 -0
- package/lib/components/ProjectCard/ProgressBar.d.ts +4 -0
- package/lib/components/ProjectCard/ProgressBar.js +66 -0
- package/lib/components/ProjectCard/ReviewRequestModal.d.ts +17 -0
- package/lib/components/ProjectCard/ReviewRequestModal.js +135 -0
- package/lib/components/ProjectCard/RightCardUI.d.ts +50 -0
- package/lib/components/ProjectCard/RightCardUI.js +237 -0
- package/lib/components/ProjectCard/index.d.ts +1 -0
- package/lib/components/ProjectCard/index.js +5 -0
- package/lib/components/ReviewsTab/ReviewModal.js +1 -1
- package/lib/components/ServiceLinesTemplate/index.js +3 -3
- package/lib/components/shared/Error.d.ts +6 -6
- package/lib/components/shared/Error.js +16 -40
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/package.json +4 -1
|
@@ -0,0 +1,149 @@
|
|
|
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.EditDateModal = void 0;
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
|
|
41
|
+
const base_ui_1 = require("@paro.io/base-ui");
|
|
42
|
+
const LogTimeModalAuthenticated_1 = require("./LogTimeModalAuthenticated");
|
|
43
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
44
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
45
|
+
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
46
|
+
dayjs_1.default.extend(utc_1.default);
|
|
47
|
+
dayjs_1.default.extend(timezone_1.default);
|
|
48
|
+
const options = [
|
|
49
|
+
{
|
|
50
|
+
label: 'Select a Reason',
|
|
51
|
+
value: '',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: 'The client has delayed the project',
|
|
55
|
+
value: 'The client has delayed the project',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: 'The expert has delayed the project',
|
|
59
|
+
value: 'The expert has delayed the project',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
label: 'Extension of the previous phase',
|
|
63
|
+
value: 'Extension of the previous phase',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: 'Other',
|
|
67
|
+
value: 'Other',
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
const EditDateModal = ({ freelancerId, freelancerEmail, project, previousDate, editDate, setEditDate, setIsDateInvalid, validateDate, isDateInvalid, changeType, expertName, isAuthenticated, selectedTab, createChangeRequestMutation, GetAllProjectIrprDetailsForFreelancerDocument, createChangeRequest, isTestEnv }) => {
|
|
71
|
+
const [date, setDate] = (0, react_1.useState)(null);
|
|
72
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
73
|
+
const [reason, setReason] = (0, react_1.useState)('');
|
|
74
|
+
const [inputReason, setInputReason] = (0, react_1.useState)('');
|
|
75
|
+
const todayDate = new Date();
|
|
76
|
+
const dateToUse = (project === null || project === void 0 ? void 0 : project.endDate) ? new Date(project === null || project === void 0 ? void 0 : project.endDate) : todayDate;
|
|
77
|
+
const maxDate = changeType === 'start' ? dateToUse : todayDate.setMonth((todayDate).getMonth() + 12);
|
|
78
|
+
const minDate = changeType === 'start' ? new Date(project === null || project === void 0 ? void 0 : project.startDate).setMonth((todayDate).getMonth() - 3) : project === null || project === void 0 ? void 0 : project.startDate;
|
|
79
|
+
const handleSubmitDate = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
+
var _a;
|
|
81
|
+
setLoading(true);
|
|
82
|
+
const projectTypes = ["ACTIVE", "ADHOC", "UPCOMING", "INACTIVE", "COMPLETED"];
|
|
83
|
+
try {
|
|
84
|
+
const changeRequestDetails = {
|
|
85
|
+
dateSubmitted: (0, dayjs_1.default)(new Date()).format('MM/DD/YYYY'),
|
|
86
|
+
changeReason: reason !== null && reason !== void 0 ? reason : inputReason,
|
|
87
|
+
changeType: `${changeType.charAt(0).toUpperCase() + changeType.slice(1)} Date`,
|
|
88
|
+
entityName: project === null || project === void 0 ? void 0 : project.name,
|
|
89
|
+
freelancerId: Number(freelancerId),
|
|
90
|
+
oldValue: (0, dayjs_1.default)(previousDate).format('MM/DD/YYYY'),
|
|
91
|
+
newValue: (0, dayjs_1.default)(date).format('MM/DD/YYYY'),
|
|
92
|
+
status: 'New',
|
|
93
|
+
projectType: projectTypes[selectedTab],
|
|
94
|
+
freelancerName: expertName,
|
|
95
|
+
email: freelancerEmail,
|
|
96
|
+
csmEmail: isTestEnv ? "admin@paro.io" : project === null || project === void 0 ? void 0 : project.csmEmail,
|
|
97
|
+
amEmail: isTestEnv ? "admin@paro.io" : (_a = project === null || project === void 0 ? void 0 : project.paroContact) === null || _a === void 0 ? void 0 : _a.email,
|
|
98
|
+
entityId: Number(project === null || project === void 0 ? void 0 : project.id),
|
|
99
|
+
};
|
|
100
|
+
isAuthenticated ? createChangeRequestMutation({
|
|
101
|
+
variables: {
|
|
102
|
+
input: changeRequestDetails
|
|
103
|
+
},
|
|
104
|
+
refetchQueries: [
|
|
105
|
+
{ query: GetAllProjectIrprDetailsForFreelancerDocument, variables: { freelancerId, projectType: 3, activeTabId: selectedTab } }
|
|
106
|
+
]
|
|
107
|
+
}) : yield createChangeRequest(changeRequestDetails);
|
|
108
|
+
(0, react_hot_toast_1.default)(react_1.default.createElement(base_ui_1.Alert, { color: "success", icon: "success", label: `Succesfully submitted ${changeType.charAt(0).toUpperCase() + changeType.slice(1)} Date Change Request` }), {
|
|
109
|
+
position: 'bottom-right',
|
|
110
|
+
style: { borderRadius: '8px' },
|
|
111
|
+
});
|
|
112
|
+
setLoading(false);
|
|
113
|
+
setDate(null);
|
|
114
|
+
setEditDate(false);
|
|
115
|
+
setReason('');
|
|
116
|
+
setInputReason('');
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
setLoading(false);
|
|
120
|
+
console.log(`Error updating ${changeType} date`, error);
|
|
121
|
+
(0, react_hot_toast_1.default)(react_1.default.createElement(base_ui_1.Alert, { color: "danger", icon: "danger", label: `Failed to update ${changeType.charAt(0).toUpperCase() + changeType.slice(1)} Date` }), {
|
|
122
|
+
position: 'bottom-right',
|
|
123
|
+
style: { borderRadius: '8px' },
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
const onCloseModal = () => {
|
|
128
|
+
setLoading(false);
|
|
129
|
+
setDate(null);
|
|
130
|
+
setEditDate(false);
|
|
131
|
+
setReason('');
|
|
132
|
+
setInputReason('');
|
|
133
|
+
};
|
|
134
|
+
return (react_1.default.createElement(base_ui_1.Modal, { open: editDate, onClose: () => onCloseModal(), size: "sm", className: "z-[100]" },
|
|
135
|
+
react_1.default.createElement("div", { className: "flex flex-col gap-y-2" },
|
|
136
|
+
react_1.default.createElement("h1", { className: "font-bold text-xl" }, `Change the ${changeType === 'start' ? 'Start' : 'End'} Date`),
|
|
137
|
+
react_1.default.createElement("p", { className: "text-md mb-6" }, `To make changes to the ${changeType === 'start' ? 'start' : 'end'} date please fill out the fields below.`),
|
|
138
|
+
react_1.default.createElement("p", { className: "font-bold" }, `What is the new ${changeType === 'start' ? 'start' : 'end'} date?`),
|
|
139
|
+
react_1.default.createElement(LogTimeModalAuthenticated_1.SelectDate, { timeLogDate: date, setTimeLogDate: setDate, isInvalid: false, setIsDateInvalid: setIsDateInvalid, validateDate: validateDate, maxDate: (0, dayjs_1.default)(maxDate).format('MM/DD/YYYY'), minDate: (0, dayjs_1.default)(minDate).format('MM/DD/YYYY') }),
|
|
140
|
+
isDateInvalid && react_1.default.createElement("div", { className: "text-red-800 text-xs" }, "Please enter a valid date"),
|
|
141
|
+
react_1.default.createElement("p", { className: "font-bold mt-2" }, "Please select a reason for change:"),
|
|
142
|
+
react_1.default.createElement("div", { className: "w-full sm:w-2/3 flex flex-col gap-y-2" },
|
|
143
|
+
react_1.default.createElement(base_ui_1.Autocomplete, { label: "", name: 'reason-select', value: reason, onSelect: (value) => setReason(value), options: options, isInvalid: reason === '', isInvalidText: "Reason can't be empty", size: 'md' }),
|
|
144
|
+
reason === 'Other' && (react_1.default.createElement(base_ui_1.Input, { type: "select", placeholder: `Please enter your reason for ${changeType === 'start' ? 'start' : 'end'} date change`, value: inputReason, onChange: (e) => setInputReason(e.target.value) }))),
|
|
145
|
+
react_1.default.createElement("div", { className: "flex flex-row gap-x-2 mt-12 mb-4" },
|
|
146
|
+
react_1.default.createElement(base_ui_1.Button, { type: "button", onClick: () => onCloseModal(), label: "CANCEL", className: "mt-4" }),
|
|
147
|
+
react_1.default.createElement(base_ui_1.Button, { type: "button", onClick: () => handleSubmitDate(), label: "SAVE", className: "mt-4", color: "primary", disabled: isDateInvalid || !reason || !date, isLoading: loading })))));
|
|
148
|
+
};
|
|
149
|
+
exports.EditDateModal = EditDateModal;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface EmailModalProps {
|
|
3
|
+
emailModal: boolean;
|
|
4
|
+
setEmailModal: (emailModal: boolean) => void;
|
|
5
|
+
emailText: string;
|
|
6
|
+
setEmailText: (emailText: string) => void;
|
|
7
|
+
setTicketModal: (ticketModal: boolean) => void;
|
|
8
|
+
project: any;
|
|
9
|
+
expertName: string;
|
|
10
|
+
sendParoSupportEmail: any;
|
|
11
|
+
isTestEnv: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const EmailModal: ({ emailModal, setEmailModal, emailText, setEmailText, setTicketModal, project, expertName, sendParoSupportEmail, isTestEnv }: EmailModalProps) => React.JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
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.EmailModal = void 0;
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
|
|
41
|
+
const base_ui_1 = require("@paro.io/base-ui");
|
|
42
|
+
const EmailModal = ({ emailModal, setEmailModal, emailText, setEmailText, setTicketModal, project, expertName, sendParoSupportEmail, isTestEnv }) => {
|
|
43
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
44
|
+
const handleSubmit = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
setLoading(true);
|
|
47
|
+
try {
|
|
48
|
+
yield sendParoSupportEmail({
|
|
49
|
+
csm_email: isTestEnv ? "admin@paro.io" : "projectsupport@paro.io",
|
|
50
|
+
am_email: isTestEnv ? "admin@paro.io" : (_a = project === null || project === void 0 ? void 0 : project.paroContact) === null || _a === void 0 ? void 0 : _a.email,
|
|
51
|
+
expert_name: expertName,
|
|
52
|
+
client_name: (_b = project === null || project === void 0 ? void 0 : project.client) === null || _b === void 0 ? void 0 : _b.name,
|
|
53
|
+
project_name: project === null || project === void 0 ? void 0 : project.name,
|
|
54
|
+
problem_description: emailText
|
|
55
|
+
});
|
|
56
|
+
(0, react_hot_toast_1.default)(react_1.default.createElement(base_ui_1.Alert, { color: "success", icon: "success", label: `Email sent successful` }), {
|
|
57
|
+
position: 'bottom-right',
|
|
58
|
+
style: { borderRadius: '8px' },
|
|
59
|
+
});
|
|
60
|
+
setTicketModal(true);
|
|
61
|
+
setEmailModal(false);
|
|
62
|
+
setEmailText("");
|
|
63
|
+
setLoading(false);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
setLoading(false);
|
|
67
|
+
console.log(`Error sending email`, error);
|
|
68
|
+
(0, react_hot_toast_1.default)(react_1.default.createElement(base_ui_1.Alert, { color: "danger", icon: "danger", label: `Failed to send email` }), {
|
|
69
|
+
position: 'bottom-right',
|
|
70
|
+
style: { borderRadius: '8px' },
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return (react_1.default.createElement(base_ui_1.Modal, { open: emailModal, onClose: () => setEmailModal(false), size: "sm", className: "z-[100]" },
|
|
75
|
+
react_1.default.createElement("h1", { className: "font-bold text-lg mb-2" }, "Please describe your problem or issue"),
|
|
76
|
+
react_1.default.createElement(base_ui_1.Input, { value: emailText, type: "text", placeholder: "Please describe your problem or issue", onChange: (e) => setEmailText(e.target.value) }),
|
|
77
|
+
react_1.default.createElement(base_ui_1.Button, { type: "button", onClick: () => { handleSubmit(); }, label: "SUBMIT", className: "mt-4", color: "primary", isLoading: loading })));
|
|
78
|
+
};
|
|
79
|
+
exports.EmailModal = EmailModal;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface EndProjectModalProps {
|
|
3
|
+
project: any;
|
|
4
|
+
freelancerId: number;
|
|
5
|
+
expertName: string;
|
|
6
|
+
showConfirmationModal: boolean;
|
|
7
|
+
setShowConfirmationModal: (showConfirmationModal: boolean) => void;
|
|
8
|
+
projectType: string;
|
|
9
|
+
isAuthenticated: boolean;
|
|
10
|
+
selectedTab: number;
|
|
11
|
+
projectTagsMap: any;
|
|
12
|
+
updateProjectStatusMutation: any;
|
|
13
|
+
GetAllProjectIrprDetailsForFreelancerDocument: any;
|
|
14
|
+
updateParoProjectTagsMutation: any;
|
|
15
|
+
GetParoProjectsDocument: any;
|
|
16
|
+
updateProjectTagReviewStatusMutation: any;
|
|
17
|
+
updateProjectStatus: any;
|
|
18
|
+
updateProjectTags: any;
|
|
19
|
+
}
|
|
20
|
+
export declare enum BillRateTypes {
|
|
21
|
+
'Hourly' = 1,
|
|
22
|
+
'Fixed' = 2
|
|
23
|
+
}
|
|
24
|
+
export declare enum ProjectFrequencies {
|
|
25
|
+
'Recurring monthly' = 1,
|
|
26
|
+
'Recurring quarterly' = 2,
|
|
27
|
+
'One Time' = 3
|
|
28
|
+
}
|
|
29
|
+
export declare const TASK_DESCRIPTION_VALIDATION: {
|
|
30
|
+
MAX_LENGTH: number;
|
|
31
|
+
MIN_LENGTH: number;
|
|
32
|
+
LENGTH_VALIDATION_MESSAGE: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const constants: {
|
|
35
|
+
MINUTES_ERROR_MESSAGE: string;
|
|
36
|
+
HOURS_ERROR_MESSAGE: string;
|
|
37
|
+
DATE_FORMAT: string;
|
|
38
|
+
MAX_DATE: Date;
|
|
39
|
+
MIN_DATE: Date;
|
|
40
|
+
DATE_VALIDATION_MESSAGE: string;
|
|
41
|
+
TASK_DESCRIPTION_ERROR_MESSAGE: string;
|
|
42
|
+
};
|
|
43
|
+
type SelectDateProps = {
|
|
44
|
+
timeLogDate: any;
|
|
45
|
+
setTimeLogDate: (e: any) => void;
|
|
46
|
+
isInvalid: boolean | "";
|
|
47
|
+
setIsDateInvalid: (e: any) => void;
|
|
48
|
+
validateDate: (e: any) => boolean;
|
|
49
|
+
showErrorText?: boolean;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
maxDate?: string;
|
|
52
|
+
minDate?: string;
|
|
53
|
+
};
|
|
54
|
+
export declare const SelectDate: ({ timeLogDate, setTimeLogDate, isInvalid, setIsDateInvalid, validateDate, showErrorText, disabled, maxDate, minDate }: SelectDateProps) => React.JSX.Element;
|
|
55
|
+
export declare const EndProjectModal: ({ project, freelancerId, expertName, showConfirmationModal, setShowConfirmationModal, projectType, isAuthenticated, selectedTab, projectTagsMap, updateProjectStatusMutation, GetAllProjectIrprDetailsForFreelancerDocument, updateParoProjectTagsMutation, GetParoProjectsDocument, updateProjectTagReviewStatusMutation, updateProjectStatus, updateProjectTags, }: EndProjectModalProps) => React.JSX.Element;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,221 @@
|
|
|
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.EndProjectModal = exports.SelectDate = exports.constants = exports.TASK_DESCRIPTION_VALIDATION = exports.ProjectFrequencies = exports.BillRateTypes = void 0;
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
|
|
41
|
+
const base_ui_1 = require("@paro.io/base-ui");
|
|
42
|
+
const pickers_1 = require("@material-ui/pickers");
|
|
43
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
44
|
+
const dayjs_1 = __importDefault(require("@date-io/dayjs"));
|
|
45
|
+
const core_1 = require("@material-ui/core");
|
|
46
|
+
var BillRateTypes;
|
|
47
|
+
(function (BillRateTypes) {
|
|
48
|
+
BillRateTypes[BillRateTypes["Hourly"] = 1] = "Hourly";
|
|
49
|
+
BillRateTypes[BillRateTypes["Fixed"] = 2] = "Fixed";
|
|
50
|
+
})(BillRateTypes || (exports.BillRateTypes = BillRateTypes = {}));
|
|
51
|
+
var ProjectFrequencies;
|
|
52
|
+
(function (ProjectFrequencies) {
|
|
53
|
+
ProjectFrequencies[ProjectFrequencies["Recurring monthly"] = 1] = "Recurring monthly";
|
|
54
|
+
ProjectFrequencies[ProjectFrequencies["Recurring quarterly"] = 2] = "Recurring quarterly";
|
|
55
|
+
ProjectFrequencies[ProjectFrequencies["One Time"] = 3] = "One Time";
|
|
56
|
+
})(ProjectFrequencies || (exports.ProjectFrequencies = ProjectFrequencies = {}));
|
|
57
|
+
const getMaxDateForAddTimeLog = () => {
|
|
58
|
+
const date = new Date();
|
|
59
|
+
date.setMonth(date.getMonth() + 1);
|
|
60
|
+
return date;
|
|
61
|
+
};
|
|
62
|
+
const getMinDateForAddTimeLog = () => {
|
|
63
|
+
const date = new Date();
|
|
64
|
+
date.setFullYear(date.getFullYear() - 1);
|
|
65
|
+
return date;
|
|
66
|
+
};
|
|
67
|
+
exports.TASK_DESCRIPTION_VALIDATION = {
|
|
68
|
+
MAX_LENGTH: 120,
|
|
69
|
+
MIN_LENGTH: 3,
|
|
70
|
+
LENGTH_VALIDATION_MESSAGE: `Task Description should be greater than 3 characters.`,
|
|
71
|
+
};
|
|
72
|
+
exports.constants = {
|
|
73
|
+
MINUTES_ERROR_MESSAGE: "Minutes can't be empty",
|
|
74
|
+
HOURS_ERROR_MESSAGE: "Hours can't be empty",
|
|
75
|
+
DATE_FORMAT: 'MM/DD/YYYY',
|
|
76
|
+
MAX_DATE: getMaxDateForAddTimeLog(),
|
|
77
|
+
MIN_DATE: getMinDateForAddTimeLog(),
|
|
78
|
+
DATE_VALIDATION_MESSAGE: 'Please enter valid date',
|
|
79
|
+
TASK_DESCRIPTION_ERROR_MESSAGE: "Task Description can't be empty",
|
|
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 SelectDate = ({ timeLogDate, setTimeLogDate, isInvalid, setIsDateInvalid, validateDate, showErrorText = true, disabled, maxDate, minDate }) => {
|
|
87
|
+
const theme = (0, core_1.useTheme)();
|
|
88
|
+
const mobileScreen = (0, core_1.useMediaQuery)(theme.breakpoints.down('sm'));
|
|
89
|
+
const handleDateChange = (date) => {
|
|
90
|
+
const currentDate = date.$d;
|
|
91
|
+
setTimeLogDate(currentDate);
|
|
92
|
+
validateDate(currentDate);
|
|
93
|
+
};
|
|
94
|
+
const onBlur = (event) => {
|
|
95
|
+
let currentDate = new Date(event.target.value);
|
|
96
|
+
currentDate = currentDate.toString() !== "Invalid Date" ? currentDate : "";
|
|
97
|
+
setTimeLogDate(currentDate);
|
|
98
|
+
validateDate(currentDate);
|
|
99
|
+
};
|
|
100
|
+
const getDatePicker = (showErrorText) => {
|
|
101
|
+
return (react_1.default.createElement(pickers_1.MuiPickersUtilsProvider, { utils: dayjs_1.default },
|
|
102
|
+
react_1.default.createElement(pickers_1.KeyboardDatePicker, { className: (0, classnames_1.default)({
|
|
103
|
+
"base-ui-date-picker": true,
|
|
104
|
+
"base-ui-date-picker-error": isInvalid,
|
|
105
|
+
}), "data-testid": "date-picker-inline", disableToolbar: true, variant: mobileScreen ? "dialog" : "inline", format: exports.constants.DATE_FORMAT, margin: "normal", placeholder: "Select Date", value: timeLogDate, onChange: () => {
|
|
106
|
+
setIsDateInvalid("");
|
|
107
|
+
}, 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 })));
|
|
108
|
+
};
|
|
109
|
+
return (react_1.default.createElement("div", { className: "mt-1" },
|
|
110
|
+
react_1.default.createElement("div", { className: "block w-full sm:w-1/3" }, getDatePicker(showErrorText))));
|
|
111
|
+
};
|
|
112
|
+
exports.SelectDate = SelectDate;
|
|
113
|
+
const EndProjectModal = ({ project, freelancerId, expertName, showConfirmationModal, setShowConfirmationModal, projectType, isAuthenticated, selectedTab, projectTagsMap, updateProjectStatusMutation, GetAllProjectIrprDetailsForFreelancerDocument, updateParoProjectTagsMutation, GetParoProjectsDocument, updateProjectTagReviewStatusMutation, updateProjectStatus, updateProjectTags, }) => {
|
|
114
|
+
const [completeProjectLoading, setCompleteProjectLoading] = (0, react_1.useState)(false);
|
|
115
|
+
const isTestEnv = true; //process.env.STAGE !== "prod"
|
|
116
|
+
const handleCompleteProject = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
118
|
+
setCompleteProjectLoading(true);
|
|
119
|
+
try {
|
|
120
|
+
const endProjectUpdateData = {
|
|
121
|
+
projectId: +(project === null || project === void 0 ? void 0 : project.id),
|
|
122
|
+
input: {
|
|
123
|
+
projectStatusId: 3,
|
|
124
|
+
isExpertEnded: true,
|
|
125
|
+
csmName: ((_a = project === null || project === void 0 ? void 0 : project.paroContact) === null || _a === void 0 ? void 0 : _a.firstName) + " " + ((_b = project === null || project === void 0 ? void 0 : project.paroContact) === null || _b === void 0 ? void 0 : _b.lastName),
|
|
126
|
+
aeName: ((_c = project === null || project === void 0 ? void 0 : project.paroContact) === null || _c === void 0 ? void 0 : _c.firstName) + " " + ((_d = project === null || project === void 0 ? void 0 : project.paroContact) === null || _d === void 0 ? void 0 : _d.lastName),
|
|
127
|
+
expertName: expertName,
|
|
128
|
+
projectName: project === null || project === void 0 ? void 0 : project.name,
|
|
129
|
+
clientName: (_e = project === null || project === void 0 ? void 0 : project.client) === null || _e === void 0 ? void 0 : _e.name,
|
|
130
|
+
projectType: projectType,
|
|
131
|
+
csmEmail: isTestEnv ? "admin@paro.io" : project === null || project === void 0 ? void 0 : project.csmEmail,
|
|
132
|
+
aeEmail: isTestEnv ? "admin@paro.io" : (_f = project === null || project === void 0 ? void 0 : project.paroContact) === null || _f === void 0 ? void 0 : _f.email,
|
|
133
|
+
startDate: project === null || project === void 0 ? void 0 : project.startDate,
|
|
134
|
+
endDate: project === null || project === void 0 ? void 0 : project.endDate,
|
|
135
|
+
projectFrequency: ProjectFrequencies[(_g = project === null || project === void 0 ? void 0 : project.projectScope) === null || _g === void 0 ? void 0 : _g.projectFrequencyId],
|
|
136
|
+
billType: BillRateTypes[(_h = project === null || project === void 0 ? void 0 : project.projectScope) === null || _h === void 0 ? void 0 : _h.freelanceRateTypeId],
|
|
137
|
+
freelancerId: freelancerId,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
let softwareTags = [], skillTags = [];
|
|
141
|
+
if (projectTagsMap[project === null || project === void 0 ? void 0 : project.id]) {
|
|
142
|
+
softwareTags = ((_j = project === null || project === void 0 ? void 0 : project.tags) === null || _j === void 0 ? void 0 : _j.reduce((acc, tag) => (tag === null || tag === void 0 ? void 0 : tag.field) === 'softwares' ? [...acc, tag.value] : acc, [])) || [];
|
|
143
|
+
skillTags = ((_k = project === null || project === void 0 ? void 0 : project.tags) === null || _k === void 0 ? void 0 : _k.reduce((acc, tag) => (tag === null || tag === void 0 ? void 0 : tag.field) === 'skills' ? [...acc, tag.value] : acc, [])) || [];
|
|
144
|
+
}
|
|
145
|
+
if (isAuthenticated) {
|
|
146
|
+
yield updateProjectStatusMutation({
|
|
147
|
+
variables: endProjectUpdateData,
|
|
148
|
+
refetchQueries: [
|
|
149
|
+
{ query: GetAllProjectIrprDetailsForFreelancerDocument, variables: { freelancerId, projectType: 3, activeTabId: selectedTab } }
|
|
150
|
+
]
|
|
151
|
+
});
|
|
152
|
+
if (projectTagsMap[project === null || project === void 0 ? void 0 : project.id]) {
|
|
153
|
+
yield updateParoProjectTagsMutation({
|
|
154
|
+
variables: {
|
|
155
|
+
projectId: project === null || project === void 0 ? void 0 : project.id,
|
|
156
|
+
input: [
|
|
157
|
+
...softwareTags,
|
|
158
|
+
...skillTags,
|
|
159
|
+
],
|
|
160
|
+
merge: true,
|
|
161
|
+
freelancerId
|
|
162
|
+
},
|
|
163
|
+
refetchQueries: [{
|
|
164
|
+
query: GetParoProjectsDocument,
|
|
165
|
+
variables: {
|
|
166
|
+
legacyFreelancerId: freelancerId
|
|
167
|
+
}
|
|
168
|
+
}]
|
|
169
|
+
});
|
|
170
|
+
yield updateProjectTagReviewStatusMutation({
|
|
171
|
+
variables: {
|
|
172
|
+
projectId: project === null || project === void 0 ? void 0 : project.id,
|
|
173
|
+
input: {
|
|
174
|
+
tagReviewStatus: 2
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
yield updateProjectStatus(endProjectUpdateData);
|
|
182
|
+
if (projectTagsMap[project === null || project === void 0 ? void 0 : project.id]) {
|
|
183
|
+
const updateProjectTagsData = {
|
|
184
|
+
projectId: project === null || project === void 0 ? void 0 : project.id,
|
|
185
|
+
softwareTags,
|
|
186
|
+
skillTags,
|
|
187
|
+
merge: true,
|
|
188
|
+
tagReviewStatus: 2,
|
|
189
|
+
freelancerId
|
|
190
|
+
};
|
|
191
|
+
yield updateProjectTags(updateProjectTagsData);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
(0, react_hot_toast_1.default)(react_1.default.createElement(base_ui_1.Alert, { color: "success", icon: "success", label: `Succesfully Ended Project` }), {
|
|
195
|
+
position: 'bottom-right',
|
|
196
|
+
style: { borderRadius: '8px' },
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
console.log("error ending project", error);
|
|
201
|
+
(0, react_hot_toast_1.default)(react_1.default.createElement(base_ui_1.Alert, { color: "danger", icon: "danger", label: `Failed to End Project` }), {
|
|
202
|
+
position: 'bottom-right',
|
|
203
|
+
style: { borderRadius: '8px' },
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
finally {
|
|
207
|
+
setCompleteProjectLoading(false);
|
|
208
|
+
setShowConfirmationModal(false);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
212
|
+
react_1.default.createElement(base_ui_1.Modal, { open: showConfirmationModal, onClose: () => setShowConfirmationModal(false), className: "z-[100]", size: "sm" },
|
|
213
|
+
react_1.default.createElement("div", { className: "flex flex-col items-center" },
|
|
214
|
+
react_1.default.createElement("h1", { className: "font-bold text-xl mb-6" }, "Are you sure ?"),
|
|
215
|
+
react_1.default.createElement("p", { className: "text-md mb-6 font-medium w-3/4" }, "When you end a project, you will no longer be able to bill additional hours and it will be removed from your active projects list."),
|
|
216
|
+
react_1.default.createElement("p", { className: "text-md mb-10 font-medium w-3/4" }, "By ending this project any other pending change request will be removed from the platform."),
|
|
217
|
+
react_1.default.createElement("div", { className: "flex flex-row gap-x-2" },
|
|
218
|
+
react_1.default.createElement(base_ui_1.Button, { type: "button", onClick: () => setShowConfirmationModal(false), label: "CANCEL", className: "mt-4" }),
|
|
219
|
+
react_1.default.createElement(base_ui_1.Button, { type: "button", onClick: () => { handleCompleteProject(); }, label: "END PROJECT", className: "mt-4", color: "primary", isLoading: completeProjectLoading }))))));
|
|
220
|
+
};
|
|
221
|
+
exports.EndProjectModal = EndProjectModal;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface LeftCardUIProps {
|
|
3
|
+
projectData: any;
|
|
4
|
+
projectRateType: string;
|
|
5
|
+
projectFrequencyType: string;
|
|
6
|
+
project: any;
|
|
7
|
+
isAuthenticated: boolean;
|
|
8
|
+
activeProject: any;
|
|
9
|
+
adhocProject: any;
|
|
10
|
+
freelancerId: number;
|
|
11
|
+
selectedTab: number;
|
|
12
|
+
updateProjectTaskMutation: any;
|
|
13
|
+
GetAllProjectIrprDetailsForFreelancerDocument: any;
|
|
14
|
+
updateProjectTask: any;
|
|
15
|
+
clientPortal: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const LeftCardUI: ({ projectData, projectRateType, projectFrequencyType, project, isAuthenticated, activeProject, adhocProject, freelancerId, selectedTab, updateProjectTaskMutation, GetAllProjectIrprDetailsForFreelancerDocument, updateProjectTask, clientPortal, }: LeftCardUIProps) => React.JSX.Element;
|
|
18
|
+
export {};
|