@paro.io/expert-shared-components 1.11.9 → 1.12.1
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/lib/components/Invoices/ClientDisputeProjectCard.d.ts +3 -1
- package/lib/components/Invoices/ClientDisputeProjectCard.js +106 -55
- package/lib/components/Invoices/InvoiceCard.d.ts +3 -1
- package/lib/components/Invoices/InvoiceCard.js +2 -2
- package/lib/components/ProjectCard/ActiveProjectCard.js +1 -20
- package/lib/components/ProjectCard/RightCardUI.d.ts +1 -2
- package/lib/components/ProjectCard/RightCardUI.js +2 -2
- package/lib/components/shared/UploadClient.js +15 -0
- package/package.json +1 -1
|
@@ -2,6 +2,8 @@ interface ClientDisputeProjectCardProps {
|
|
|
2
2
|
clientInvoice: any;
|
|
3
3
|
updateClientInvoiceDisputeMutation: any;
|
|
4
4
|
documentUploadUrl: string;
|
|
5
|
+
downloadDocumentUrl: string;
|
|
6
|
+
refetchInvoiceDisputes: any;
|
|
5
7
|
}
|
|
6
|
-
export declare const ClientDisputeProjectCard: ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, }: ClientDisputeProjectCardProps) => JSX.Element;
|
|
8
|
+
export declare const ClientDisputeProjectCard: ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, refetchInvoiceDisputes, }: ClientDisputeProjectCardProps) => JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -31,6 +31,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
34
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
38
|
exports.ClientDisputeProjectCard = void 0;
|
|
36
39
|
const react_1 = __importStar(require("react"));
|
|
@@ -39,6 +42,7 @@ const base_ui_2 = require("@paro.io/base-ui");
|
|
|
39
42
|
const core_1 = require("@material-ui/core");
|
|
40
43
|
const base_icons_1 = require("@paro.io/base-icons");
|
|
41
44
|
const FileUploader_1 = require("../FileUploader");
|
|
45
|
+
const DownloadClient_1 = __importDefault(require("../shared/DownloadClient"));
|
|
42
46
|
const useStyles = (0, core_1.makeStyles)((theme) => ({
|
|
43
47
|
root: {
|
|
44
48
|
width: "100%",
|
|
@@ -93,8 +97,7 @@ const ACCEPTED_FILE_TYPES = [
|
|
|
93
97
|
'image/png',
|
|
94
98
|
'text/csv',
|
|
95
99
|
];
|
|
96
|
-
const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, }) => {
|
|
97
|
-
var _a, _b;
|
|
100
|
+
const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, refetchInvoiceDisputes, }) => {
|
|
98
101
|
const [expandRow, setExpandRow] = (0, react_1.useState)(null);
|
|
99
102
|
const classes = useStyles();
|
|
100
103
|
const [projects, setProjects] = (0, react_1.useState)(clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects);
|
|
@@ -102,9 +105,39 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
|
|
|
102
105
|
const [editedExplanation, setEditedExplanation] = (0, react_1.useState)('');
|
|
103
106
|
const [updatedDispute, setUpdateDispute] = (0, react_1.useState)(false);
|
|
104
107
|
const [updatingDispute, setUpdatingDispute] = (0, react_1.useState)(false);
|
|
105
|
-
const
|
|
106
|
-
const clientDocumentLinks = (_b = disputeProject === null || disputeProject === void 0 ? void 0 : disputeProject.clientDocumentLinks) === null || _b === void 0 ? void 0 : _b.split(',');
|
|
108
|
+
const [uploadingFile, setUploadingFile] = (0, react_1.useState)(false);
|
|
107
109
|
const fileInputRef = (0, react_1.useRef)(null);
|
|
110
|
+
const handleDownloadPdf = ({ fileData, downloadFilename, streamData }) => {
|
|
111
|
+
var _a, _b;
|
|
112
|
+
let byteArray = streamData ? fileData : new Uint8Array();
|
|
113
|
+
if (!streamData) {
|
|
114
|
+
const byteCharacters = atob((_b = (_a = fileData === null || fileData === void 0 ? void 0 : fileData.data) === null || _a === void 0 ? void 0 : _a.getFile) === null || _b === void 0 ? void 0 : _b.data);
|
|
115
|
+
const byteNumbers = new Array(byteCharacters.length);
|
|
116
|
+
for (let i = 0; i < byteCharacters.length; i++) {
|
|
117
|
+
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
118
|
+
}
|
|
119
|
+
byteArray = new Uint8Array(byteNumbers);
|
|
120
|
+
}
|
|
121
|
+
const blob = new Blob([byteArray], { type: 'application/pdf' });
|
|
122
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
123
|
+
const newTab = window.open(blobUrl, '_blank');
|
|
124
|
+
const downloadLink = document.createElement('a');
|
|
125
|
+
downloadLink.href = blobUrl;
|
|
126
|
+
downloadLink.download = downloadFilename;
|
|
127
|
+
document.body.appendChild(downloadLink);
|
|
128
|
+
downloadLink.click();
|
|
129
|
+
document.body.removeChild(downloadLink);
|
|
130
|
+
URL.revokeObjectURL(blobUrl);
|
|
131
|
+
if (newTab) {
|
|
132
|
+
newTab.focus();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const handleDownloadDocument = (projectId, fileName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
136
|
+
const downloadFileName = `project-${projectId}/${fileName}`;
|
|
137
|
+
const downloadClient = new DownloadClient_1.default({ downloadDocumentUrl: downloadDocumentUrl, fileKey: downloadFileName });
|
|
138
|
+
const downloadData = yield downloadClient.downloadDocument();
|
|
139
|
+
handleDownloadPdf({ fileData: downloadData, downloadFilename: fileName, streamData: true });
|
|
140
|
+
});
|
|
108
141
|
(0, react_1.useEffect)(() => {
|
|
109
142
|
if (JSON.stringify(clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects) !== JSON.stringify(projects)) {
|
|
110
143
|
setUpdateDispute(true);
|
|
@@ -119,55 +152,70 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
|
|
|
119
152
|
setEditingRowId(null);
|
|
120
153
|
});
|
|
121
154
|
const handleChange = (e, field) => {
|
|
122
|
-
const updatedProject =
|
|
123
|
-
if (project.projectId === expandRow) {
|
|
124
|
-
return Object.assign(Object.assign({}, project), { clientDocumentLinks: [...project.clientDocumentLinks, ...e.filter((name) => !project.clientDocumentLinks.includes(name))] });
|
|
125
|
-
}
|
|
126
|
-
return project;
|
|
127
|
-
}) : projects.map((project) => {
|
|
155
|
+
const updatedProject = projects.map((project) => {
|
|
128
156
|
return Object.assign(Object.assign({}, project), { [field]: e.target.value });
|
|
129
157
|
});
|
|
130
158
|
setProjects(updatedProject);
|
|
131
159
|
};
|
|
132
|
-
const handleUpload = (event) => {
|
|
160
|
+
const handleUpload = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
161
|
+
setUploadingFile(true);
|
|
133
162
|
const selectedFiles = event.target.files;
|
|
134
163
|
if (!selectedFiles)
|
|
135
164
|
return;
|
|
136
|
-
const
|
|
165
|
+
const validFileNames = Array.from(selectedFiles)
|
|
137
166
|
.filter(file => validateFileUpload(file))
|
|
138
167
|
.map(file => file.name);
|
|
139
|
-
if (
|
|
168
|
+
if (validFileNames.length === 0)
|
|
140
169
|
return;
|
|
141
|
-
if (
|
|
142
|
-
Array.from(selectedFiles).
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
170
|
+
if (validFileNames && validFileNames.length > 0) {
|
|
171
|
+
const uploadPromises = Array.from(selectedFiles).map((selectedFile) => {
|
|
172
|
+
return new Promise((resolve, reject) => {
|
|
173
|
+
const reader = new FileReader();
|
|
174
|
+
reader.onloadend = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
175
|
+
var _a, _b, _c, _d, _e;
|
|
176
|
+
try {
|
|
177
|
+
yield (0, FileUploader_1.fileUploader)({
|
|
178
|
+
file: selectedFile,
|
|
179
|
+
documentName: selectedFile.name,
|
|
180
|
+
disputeId: clientInvoice.disputeId,
|
|
181
|
+
projectId: Number((_b = (_a = clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.projectId),
|
|
182
|
+
documentUploadUrl: documentUploadUrl,
|
|
183
|
+
updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation,
|
|
184
|
+
previousFiles: (_e = (_d = (_c = clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.clientDocumentLinks) !== null && _e !== void 0 ? _e : [],
|
|
185
|
+
isExpert: false,
|
|
186
|
+
}).then(() => {
|
|
187
|
+
refetchInvoiceDisputes();
|
|
188
|
+
});
|
|
189
|
+
resolve();
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
reject(error);
|
|
193
|
+
}
|
|
154
194
|
});
|
|
195
|
+
reader.readAsDataURL(selectedFile);
|
|
155
196
|
});
|
|
156
|
-
reader.readAsDataURL(selectedFile);
|
|
157
197
|
});
|
|
198
|
+
try {
|
|
199
|
+
yield Promise.all(uploadPromises);
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
console.error('Error uploading files:', error);
|
|
203
|
+
}
|
|
204
|
+
finally {
|
|
205
|
+
setUploadingFile(false);
|
|
206
|
+
}
|
|
158
207
|
}
|
|
159
|
-
handleChange(validFiles, "clientDocumentLinks");
|
|
160
208
|
if (fileInputRef.current) {
|
|
161
|
-
fileInputRef.current.value = '';
|
|
209
|
+
fileInputRef.current.value = ''; // Reset the file input
|
|
162
210
|
}
|
|
163
|
-
};
|
|
211
|
+
});
|
|
164
212
|
const handleSubmitDispute = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
165
213
|
setUpdatingDispute(true);
|
|
166
214
|
try {
|
|
167
215
|
yield updateClientInvoiceDisputeMutation({
|
|
168
216
|
variables: {
|
|
169
217
|
input: {
|
|
170
|
-
disputeId:
|
|
218
|
+
disputeId: clientInvoice.disputeId,
|
|
171
219
|
projectDisputes: projects.map((project) => ({
|
|
172
220
|
projectId: project.projectId,
|
|
173
221
|
disputeReasonCode: project.disputeReasonCode,
|
|
@@ -179,6 +227,8 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
|
|
|
179
227
|
})),
|
|
180
228
|
}
|
|
181
229
|
}
|
|
230
|
+
}).then(() => {
|
|
231
|
+
refetchInvoiceDisputes();
|
|
182
232
|
});
|
|
183
233
|
}
|
|
184
234
|
catch (error) {
|
|
@@ -198,41 +248,42 @@ const ClientDisputeProjectCard = ({ clientInvoice, updateClientInvoiceDisputeMut
|
|
|
198
248
|
}),
|
|
199
249
|
react_1.default.createElement(core_1.TableCell, { className: classes.tableCell }))), projects === null || projects === void 0 ? void 0 :
|
|
200
250
|
projects.map((row) => {
|
|
201
|
-
var _a;
|
|
202
|
-
return (react_1.default.createElement(react_1.default.Fragment, { key: row.projectId },
|
|
251
|
+
var _a, _b;
|
|
252
|
+
return (react_1.default.createElement(react_1.default.Fragment, { key: row === null || row === void 0 ? void 0 : row.projectId },
|
|
203
253
|
react_1.default.createElement(core_1.TableRow, null,
|
|
204
|
-
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell }, ((_a = row.project) === null || _a === void 0 ? void 0 : _a.name) || "N/A"),
|
|
205
|
-
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell }, row.disputeType),
|
|
206
|
-
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell }, row.disputeHours),
|
|
207
|
-
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell }, row.disputeAmount),
|
|
208
|
-
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell }, row.disputeReasonCode),
|
|
254
|
+
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell }, ((_a = row === null || row === void 0 ? void 0 : row.project) === null || _a === void 0 ? void 0 : _a.name) || "N/A"),
|
|
255
|
+
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell }, row === null || row === void 0 ? void 0 : row.disputeType),
|
|
256
|
+
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell }, row === null || row === void 0 ? void 0 : row.disputeHours),
|
|
257
|
+
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell }, row === null || row === void 0 ? void 0 : row.disputeAmount),
|
|
258
|
+
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell }, row === null || row === void 0 ? void 0 : row.disputeReasonCode),
|
|
209
259
|
react_1.default.createElement(core_1.TableCell, { align: "left", className: classes.tableCell },
|
|
210
|
-
react_1.default.createElement(core_1.IconButton, { onClick: () => setExpandRow(expandRow === row.projectId ? null : row.projectId) }, expandRow === row.projectId ? react_1.default.createElement(base_icons_1.IconChevronUp, null) : react_1.default.createElement(base_icons_1.IconChevronDown, null)))),
|
|
211
|
-
expandRow === row.projectId && (react_1.default.createElement(core_1.TableRow, { key: `expanded-${row.projectId}` },
|
|
260
|
+
react_1.default.createElement(core_1.IconButton, { onClick: () => setExpandRow(expandRow === (row === null || row === void 0 ? void 0 : row.projectId) ? null : row === null || row === void 0 ? void 0 : row.projectId) }, expandRow === (row === null || row === void 0 ? void 0 : row.projectId) ? react_1.default.createElement(base_icons_1.IconChevronUp, null) : react_1.default.createElement(base_icons_1.IconChevronDown, null)))),
|
|
261
|
+
expandRow === (row === null || row === void 0 ? void 0 : row.projectId) && (react_1.default.createElement(core_1.TableRow, { key: `expanded-${row === null || row === void 0 ? void 0 : row.projectId}` },
|
|
212
262
|
react_1.default.createElement(core_1.TableCell, { colSpan: headCells.length + 1, style: { paddingBottom: 0, paddingTop: 0 } },
|
|
213
263
|
react_1.default.createElement(core_1.Collapse, { in: true, timeout: "auto", unmountOnExit: true },
|
|
214
264
|
react_1.default.createElement(react_1.default.Fragment, null,
|
|
215
265
|
react_1.default.createElement(base_ui_1.Card, { className: "bg-[#F8F9FA] m-2 flex items-start justify-between rounded flex-col w-full p-6" },
|
|
216
266
|
react_1.default.createElement("b", { className: "mb-2 flex flex-row justify-start items-center" },
|
|
217
267
|
"Explanation:",
|
|
218
|
-
editingRowId === row.projectId ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
268
|
+
editingRowId === (row === null || row === void 0 ? void 0 : row.projectId) ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
219
269
|
react_1.default.createElement(base_ui_2.Input, { label: "", type: "text", className: "w-96 mx-4 overflow-ellipsis", value: editedExplanation, onChange: (e) => setEditedExplanation(e.target.value), placeholder: "Please provide an explanation", isInvalid: !editedExplanation, isInvalidText: "Please provide an explanation" }),
|
|
220
|
-
react_1.default.createElement(base_ui_2.Button, { label: "Save", size: "md", color: "success", className: "ml-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
270
|
+
react_1.default.createElement(base_ui_2.Button, { label: "Save", size: "md", color: "success", className: "ml-1 mt-1", onClick: () => { handleEditExplanation(row === null || row === void 0 ? void 0 : row.projectId); } }))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
271
|
+
react_1.default.createElement("span", { className: "font-normal mx-1" }, row === null || row === void 0 ? void 0 : row.clientExplanation),
|
|
272
|
+
react_1.default.createElement(core_1.Tooltip, { title: "Edit explanation", placement: "top", arrow: true },
|
|
273
|
+
react_1.default.createElement(core_1.IconButton, { onClick: () => {
|
|
274
|
+
setEditedExplanation(row === null || row === void 0 ? void 0 : row.clientExplanation);
|
|
275
|
+
setEditingRowId(row === null || row === void 0 ? void 0 : row.projectId);
|
|
276
|
+
} },
|
|
277
|
+
react_1.default.createElement(base_icons_1.IconPencil, { size: "sm" })))))),
|
|
225
278
|
react_1.default.createElement("b", { className: "flex flex-row flex-wrap justify-start items-center mt-2" },
|
|
226
279
|
"Supporting Documents:",
|
|
227
|
-
react_1.default.createElement("input", { id: "upload-file", type: "file", multiple:
|
|
228
|
-
react_1.default.createElement(base_ui_2.Button, { label: "Add File", iconLeft: react_1.default.createElement(base_icons_1.IconPlus, { size: "sm" }), onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, size: "sm", color: "info", className: "mx-2" }),
|
|
229
|
-
(
|
|
230
|
-
? row.clientDocumentLinks
|
|
231
|
-
: []).map((f, index) => (react_1.default.createElement("div", { key: index, className: "
|
|
232
|
-
react_1.default.createElement(base_ui_1.Tag, { variant: "subtle", color: "success", label: f, iconRight: react_1.default.createElement(base_icons_1.IconXCircle, null), onClick: () => {
|
|
233
|
-
|
|
234
|
-
? Object.assign(Object.assign({}, p), { clientDocumentLinks: p.clientDocumentLinks.filter((file) => file !== f) }) : p);
|
|
235
|
-
setProjects(updatedProjects);
|
|
280
|
+
react_1.default.createElement("input", { id: "upload-file", type: "file", multiple: false, accept: ".pdf,.doc,.docx,.jpeg,.png,.gif,.csv", style: { display: 'none' }, ref: fileInputRef, onChange: handleUpload }),
|
|
281
|
+
react_1.default.createElement(base_ui_2.Button, { label: "Add File", iconLeft: react_1.default.createElement(base_icons_1.IconPlus, { size: "sm" }), onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, size: "sm", color: "info", className: "mx-2", isLoading: uploadingFile }),
|
|
282
|
+
((row === null || row === void 0 ? void 0 : row.clientDocumentLinks)
|
|
283
|
+
? (typeof (row === null || row === void 0 ? void 0 : row.clientDocumentLinks) === 'string' ? (_b = row === null || row === void 0 ? void 0 : row.clientDocumentLinks) === null || _b === void 0 ? void 0 : _b.split(',') : [...row === null || row === void 0 ? void 0 : row.clientDocumentLinks])
|
|
284
|
+
: []).map((f, index) => (react_1.default.createElement("div", { key: index, className: "m-1" },
|
|
285
|
+
react_1.default.createElement(base_ui_1.Tag, { variant: "subtle", color: "success", label: f.split('%2F')[1], iconRight: react_1.default.createElement(base_icons_1.IconXCircle, null), onClick: () => {
|
|
286
|
+
handleDownloadDocument(row === null || row === void 0 ? void 0 : row.projectId, f.split('%2F')[1]);
|
|
236
287
|
} })))))))))))));
|
|
237
288
|
})),
|
|
238
289
|
updatedDispute && react_1.default.createElement("div", { className: "flex justify-end ml-auto mt-2" },
|
|
@@ -5,7 +5,9 @@ interface InvoiceCardProps {
|
|
|
5
5
|
chatMessages: any[];
|
|
6
6
|
updateClientInvoiceDisputeMutation: any;
|
|
7
7
|
documentUploadUrl: string;
|
|
8
|
+
downloadDocumentUrl: string;
|
|
8
9
|
isInternal?: boolean;
|
|
10
|
+
refetchInvoiceDisputes: any;
|
|
9
11
|
}
|
|
10
|
-
export declare const InvoiceCard: ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, isInternal, }: InvoiceCardProps) => JSX.Element;
|
|
12
|
+
export declare const InvoiceCard: ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, isInternal, refetchInvoiceDisputes, }: InvoiceCardProps) => JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -12,7 +12,7 @@ const DisputeSection_1 = require("./DisputeSection");
|
|
|
12
12
|
const DiscussionSection_1 = require("./DiscussionSection");
|
|
13
13
|
const DecisionSection_1 = require("./DecisionSection");
|
|
14
14
|
const ClientDisputeProjectCard_1 = require("./ClientDisputeProjectCard");
|
|
15
|
-
const InvoiceCard = ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, isInternal = false, }) => {
|
|
15
|
+
const InvoiceCard = ({ clientInvoice, createDisputeChatMessage, user, chatMessages, updateClientInvoiceDisputeMutation, documentUploadUrl, downloadDocumentUrl, isInternal = false, refetchInvoiceDisputes, }) => {
|
|
16
16
|
var _a, _b;
|
|
17
17
|
return (react_1.default.createElement(base_ui_1.Card, { className: "w-full bg-white rounded-lg shadow-sm overflow-hidden mb-4" },
|
|
18
18
|
react_1.default.createElement(InvoiceHeader_1.InvoiceHeader, { invoice: clientInvoice }),
|
|
@@ -21,7 +21,7 @@ const InvoiceCard = ({ clientInvoice, createDisputeChatMessage, user, chatMessag
|
|
|
21
21
|
isInternal ?
|
|
22
22
|
react_1.default.createElement(DisputeSection_1.DisputeSection, { dispute: clientInvoice, documentUploadUrl: documentUploadUrl, updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation })
|
|
23
23
|
:
|
|
24
|
-
react_1.default.createElement(ClientDisputeProjectCard_1.ClientDisputeProjectCard, { clientInvoice: clientInvoice, updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation, documentUploadUrl: documentUploadUrl }),
|
|
24
|
+
react_1.default.createElement(ClientDisputeProjectCard_1.ClientDisputeProjectCard, { clientInvoice: clientInvoice, updateClientInvoiceDisputeMutation: updateClientInvoiceDisputeMutation, documentUploadUrl: documentUploadUrl, downloadDocumentUrl: downloadDocumentUrl, refetchInvoiceDisputes: refetchInvoiceDisputes }),
|
|
25
25
|
(clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.chatEnabled) && (react_1.default.createElement(DiscussionSection_1.DiscussionSection, { disputeId: (_b = (_a = clientInvoice === null || clientInvoice === void 0 ? void 0 : clientInvoice.disputeProjects) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id, currentUser: user, messages: chatMessages, onCreateMessage: createDisputeChatMessage, isInternal: isInternal })),
|
|
26
26
|
isInternal &&
|
|
27
27
|
react_1.default.createElement(DecisionSection_1.DecisionSection, { dispute: clientInvoice, onUpdateDispute: updateClientInvoiceDisputeMutation }))));
|
|
@@ -133,7 +133,6 @@ const ActiveProjectCard = ({ project, projectsData, expertName, freelancerId, fr
|
|
|
133
133
|
const showRating = ratingValue && (0, dayjs_1.default)((0, dayjs_1.default)().tz('America/Los_Angeles').format('YYYY-MM-DD HH:mm:ss')).diff((0, dayjs_1.default)((_g = (_f = project === null || project === void 0 ? void 0 : project.rating) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.createdAt.replace('Z', '')).format('YYYY-MM-DD HH:mm:ss'), 'hours') > 48;
|
|
134
134
|
const displayName = clientPortal ? expertName : (_h = project === null || project === void 0 ? void 0 : project.client) === null || _h === void 0 ? void 0 : _h.name;
|
|
135
135
|
const editResponseTime = new Date().getDate() <= 7;
|
|
136
|
-
const disputedProject = true; //update required
|
|
137
136
|
return (react_1.default.createElement("div", { className: "w-full mb-8" },
|
|
138
137
|
internalPortal && changeRequests && changeRequests.length > 0 && (react_1.default.createElement("div", null, changeRequests
|
|
139
138
|
.filter((cr) => cr.entityId === project.id)
|
|
@@ -163,8 +162,6 @@ const ActiveProjectCard = ({ project, projectsData, expertName, freelancerId, fr
|
|
|
163
162
|
react_1.default.createElement("h1", null, displayName),
|
|
164
163
|
react_1.default.createElement("p", { className: "font-bold text-md mt-1" }, `${(_j = project === null || project === void 0 ? void 0 : project.name) !== null && _j !== void 0 ? _j : "Project"} ${(singleProjectData === null || singleProjectData === void 0 ? void 0 : singleProjectData.minFloorHours) ? "WITH" : "WITHOUT"} a min floor.`)),
|
|
165
164
|
react_1.default.createElement("div", { className: "flex flex-row gap-x-2 items-center ml-auto" },
|
|
166
|
-
disputedProject && react_1.default.createElement("div", { className: "pl-4 my-auto" },
|
|
167
|
-
react_1.default.createElement(base_ui_1.Tag, { variant: "subtle", color: "danger", label: "IN PROCESS" })),
|
|
168
165
|
showRating && react_1.default.createElement("div", { className: "flex flex-auto items-center justify-between" },
|
|
169
166
|
react_1.default.createElement(lab_1.Rating, { name: "read-only", value: Number(ratingValue), precision: 0.5, size: "large", readOnly: true, emptyIcon: react_1.default.createElement(Star_1.default, { fontSize: "inherit" }) })),
|
|
170
167
|
(singleProjectData === null || singleProjectData === void 0 ? void 0 : singleProjectData.minFloorHours) && !adhocProject ? react_1.default.createElement(core_1.Tooltip, { classes: { tooltip: classes.tooltip }, title: "Minimum Floor Hours is the minimum amount of hours needed to log for this project.", placement: "top", arrow: true },
|
|
@@ -179,26 +176,10 @@ const ActiveProjectCard = ({ project, projectsData, expertName, freelancerId, fr
|
|
|
179
176
|
react_1.default.createElement("p", { className: "font-bold text-md self-center" }, "NEW !")) : "",
|
|
180
177
|
react_1.default.createElement("div", { className: "h-10 w-14 bg-[#F1F5F9] rounded-md flex place-content-center" },
|
|
181
178
|
react_1.default.createElement(base_ui_1.Button, { onClick: () => { setExpand(!expand); }, className: "font-bold text-md p-8", icon: expand ? react_1.default.createElement(base_icons_1.IconChevronUp, null) : react_1.default.createElement(base_icons_1.IconChevronDown, null) })))),
|
|
182
|
-
disputedProject && react_1.default.createElement("div", { className: "flex flex-col p-4" },
|
|
183
|
-
react_1.default.createElement("b", { className: "text-red-500" }, "Invoice #12345 Disputed"),
|
|
184
|
-
" ",
|
|
185
|
-
react_1.default.createElement("div", { className: "flex flex-row justify-between items-center align-center bg-[#FDD7A5] p-2 rounded-md" },
|
|
186
|
-
selectedTab !== 6 && react_1.default.createElement("div", { className: `w-1/6 h-12 w-16 rounded-md flex place-content-center items-center bg-[#A73A43] text-[#F1F5F9]` },
|
|
187
|
-
react_1.default.createElement("h1", { className: "text-xl" }, "!")),
|
|
188
|
-
selectedTab === 6 && editResponseTime ?
|
|
189
|
-
react_1.default.createElement("p", { className: "w-full pl-2" }, "Your response has been received and is being reviewed by our team. The project remains paused during this review and you will not be able to submit time for this project.")
|
|
190
|
-
:
|
|
191
|
-
react_1.default.createElement("p", { className: "w-full pl-2" },
|
|
192
|
-
"Client has disputed $3,500.00. This project is paused until resolved and you will not be able to log hours.",
|
|
193
|
-
react_1.default.createElement("br", null),
|
|
194
|
-
"Reason: Incorrect Hours Logged"),
|
|
195
|
-
react_1.default.createElement("div", { className: "w-1/6 pl-2" },
|
|
196
|
-
react_1.default.createElement(base_ui_1.Button, { label: selectedTab === 6 && editResponseTime ? "EDIT RESPONSE" : "RESPOND TO DISPUTE", size: "sm", color: "primary", disabled: false, className: "w-full", onClick: () => { } }),
|
|
197
|
-
" "))),
|
|
198
179
|
expand && react_1.default.createElement("div", { className: `flex w-full p-4 gap-x-10 gap-y-10 ${projectRateType === "Fixed" ? "flex-col" : "flex-col md:flex-row"}` },
|
|
199
180
|
react_1.default.createElement(LeftCardUI_1.LeftCardUI, { projectData: singleProjectData, projectFrequencyType: projectFrequencyType, projectRateType: projectRateType, project: project, isAuthenticated: isAuthenticated, adhocProject: adhocProject, activeProject: activeProject, freelancerId: freelancerId, selectedTab: selectedTab, updateProjectTaskMutation: updateProjectTaskMutation, GetAllProjectIrprDetailsForFreelancerDocument: GetAllProjectIrprDetailsForFreelancerDocument, updateProjectTask: updateProjectTask, clientPortal: clientPortal }),
|
|
200
181
|
react_1.default.createElement("div", { className: "flex flex-col flex-grow md:flex-row gap-x-0 justify-around" },
|
|
201
182
|
react_1.default.createElement(CenterCardUI_1.CenterCardUI, { startDate: project === null || project === void 0 ? void 0 : project.startDate, endDate: project === null || project === void 0 ? void 0 : project.endDate, projectData: singleProjectData, projectRateType: projectRateType, project: project, projectFrequencyType: projectFrequencyType, adhocProject: adhocProject, clientPortal: clientPortal, internalPortal: internalPortal }),
|
|
202
|
-
react_1.default.createElement(RightCardUI_1.RightCardUI, { project: project, expertName: expertName, freelancerEmail: freelancerEmail, freelancerId: freelancerId, isAuthenticated: isAuthenticated, editEndDate: editEndDate, setEditEndDate: setEditEndDate, editStartDate: editStartDate, setEditStartDate: setEditStartDate, showTimeModal: showTimeModal, setShowTimeModal: setShowTimeModal, setSingleProjectData: setSingleProjectData, projectData: singleProjectData, checkStartDate: checkStartDate, activeProject: activeProject, projectRateType: projectRateType, projectFrequencyType: projectFrequencyType, upcomingProject: upcomingProject, selectedTab: selectedTab, showRating: !!showRating, projectTagsMap: projectTagsMap, updateProjectStatusMutation: updateProjectStatusMutation, GetAllProjectIrprDetailsForFreelancerDocument: GetAllProjectIrprDetailsForFreelancerDocument, updateParoProjectTagsMutation: updateParoProjectTagsMutation, GetParoProjectsDocument: GetParoProjectsDocument, updateProjectTagReviewStatusMutation: updateProjectTagReviewStatusMutation, updateProjectStatus: updateProjectStatus, updateProjectTags: updateProjectTags, getSowLazyQuery: getSowLazyQuery, sendParoSupportEmail: sendParoSupportEmail, createChangeRequestMutation: createChangeRequestMutation, createChangeRequest: createChangeRequest, createOrUpdateRatingRequestMutation: createOrUpdateRatingRequestMutation, submitProjectHoursMutation: submitProjectHoursMutation, getAuth0Roles: getAuth0Roles, submitProjectHoursLambda: submitProjectHoursLambda, createOrUpdateRating: createOrUpdateRating, getParoProjectsByClientIdDocument: getParoProjectsByClientIdDocument, user: user, internalPortal: internalPortal, csmUserGroup: csmUserGroup, clientPortal: clientPortal, signedSow: signedSow, isStageProd: isStageProd, isRequestReviewEnabled: isRequestReviewEnabled, updateDBProjectRequestStatus: updateDBProjectRequestStatus
|
|
183
|
+
react_1.default.createElement(RightCardUI_1.RightCardUI, { project: project, expertName: expertName, freelancerEmail: freelancerEmail, freelancerId: freelancerId, isAuthenticated: isAuthenticated, editEndDate: editEndDate, setEditEndDate: setEditEndDate, editStartDate: editStartDate, setEditStartDate: setEditStartDate, showTimeModal: showTimeModal, setShowTimeModal: setShowTimeModal, setSingleProjectData: setSingleProjectData, projectData: singleProjectData, checkStartDate: checkStartDate, activeProject: activeProject, projectRateType: projectRateType, projectFrequencyType: projectFrequencyType, upcomingProject: upcomingProject, selectedTab: selectedTab, showRating: !!showRating, projectTagsMap: projectTagsMap, updateProjectStatusMutation: updateProjectStatusMutation, GetAllProjectIrprDetailsForFreelancerDocument: GetAllProjectIrprDetailsForFreelancerDocument, updateParoProjectTagsMutation: updateParoProjectTagsMutation, GetParoProjectsDocument: GetParoProjectsDocument, updateProjectTagReviewStatusMutation: updateProjectTagReviewStatusMutation, updateProjectStatus: updateProjectStatus, updateProjectTags: updateProjectTags, getSowLazyQuery: getSowLazyQuery, sendParoSupportEmail: sendParoSupportEmail, createChangeRequestMutation: createChangeRequestMutation, createChangeRequest: createChangeRequest, createOrUpdateRatingRequestMutation: createOrUpdateRatingRequestMutation, submitProjectHoursMutation: submitProjectHoursMutation, getAuth0Roles: getAuth0Roles, submitProjectHoursLambda: submitProjectHoursLambda, createOrUpdateRating: createOrUpdateRating, getParoProjectsByClientIdDocument: getParoProjectsByClientIdDocument, user: user, internalPortal: internalPortal, csmUserGroup: csmUserGroup, clientPortal: clientPortal, signedSow: signedSow, isStageProd: isStageProd, isRequestReviewEnabled: isRequestReviewEnabled, updateDBProjectRequestStatus: updateDBProjectRequestStatus }))))));
|
|
203
184
|
};
|
|
204
185
|
exports.ActiveProjectCard = ActiveProjectCard;
|
|
@@ -46,7 +46,6 @@ interface RightCardUIProps {
|
|
|
46
46
|
isStageProd: string;
|
|
47
47
|
isRequestReviewEnabled: boolean;
|
|
48
48
|
updateDBProjectRequestStatus: any;
|
|
49
|
-
disputedProject: boolean;
|
|
50
49
|
}
|
|
51
|
-
export declare const RightCardUI: ({ project, expertName, freelancerId, freelancerEmail, isAuthenticated, editEndDate, setEditEndDate, editStartDate, setEditStartDate, showTimeModal, setShowTimeModal, setSingleProjectData, projectData, checkStartDate, activeProject, projectFrequencyType, projectRateType, upcomingProject, selectedTab, showRating, projectTagsMap, updateProjectStatusMutation, GetAllProjectIrprDetailsForFreelancerDocument, updateParoProjectTagsMutation, GetParoProjectsDocument, updateProjectTagReviewStatusMutation, updateProjectStatus, updateProjectTags, getSowLazyQuery, sendParoSupportEmail, createChangeRequestMutation, createChangeRequest, createOrUpdateRatingRequestMutation, submitProjectHoursMutation, getAuth0Roles, submitProjectHoursLambda, createOrUpdateRating, getParoProjectsByClientIdDocument, user, internalPortal, csmUserGroup, clientPortal, signedSow, isStageProd, isRequestReviewEnabled, updateDBProjectRequestStatus,
|
|
50
|
+
export declare const RightCardUI: ({ project, expertName, freelancerId, freelancerEmail, isAuthenticated, editEndDate, setEditEndDate, editStartDate, setEditStartDate, showTimeModal, setShowTimeModal, setSingleProjectData, projectData, checkStartDate, activeProject, projectFrequencyType, projectRateType, upcomingProject, selectedTab, showRating, projectTagsMap, updateProjectStatusMutation, GetAllProjectIrprDetailsForFreelancerDocument, updateParoProjectTagsMutation, GetParoProjectsDocument, updateProjectTagReviewStatusMutation, updateProjectStatus, updateProjectTags, getSowLazyQuery, sendParoSupportEmail, createChangeRequestMutation, createChangeRequest, createOrUpdateRatingRequestMutation, submitProjectHoursMutation, getAuth0Roles, submitProjectHoursLambda, createOrUpdateRating, getParoProjectsByClientIdDocument, user, internalPortal, csmUserGroup, clientPortal, signedSow, isStageProd, isRequestReviewEnabled, updateDBProjectRequestStatus, }: RightCardUIProps) => React.JSX.Element;
|
|
52
51
|
export {};
|
|
@@ -61,7 +61,7 @@ const TicketModal = ({ ticketModal, setTicketModal }) => {
|
|
|
61
61
|
react_1.default.createElement("p", { className: "font-bold text-md mb-2" }, "Thank you for reaching out to Paro Support, we will contact you within the next business day to follow up on your request."),
|
|
62
62
|
react_1.default.createElement(base_ui_1.Button, { type: "button", onClick: () => { setTicketModal(false); }, label: "OK", className: "mt-4", color: "primary" })));
|
|
63
63
|
};
|
|
64
|
-
const RightCardUI = ({ project, expertName, freelancerId, freelancerEmail, isAuthenticated, editEndDate, setEditEndDate, editStartDate, setEditStartDate, showTimeModal, setShowTimeModal, setSingleProjectData, projectData, checkStartDate, activeProject, projectFrequencyType, projectRateType, upcomingProject, selectedTab, showRating, projectTagsMap, updateProjectStatusMutation, GetAllProjectIrprDetailsForFreelancerDocument, updateParoProjectTagsMutation, GetParoProjectsDocument, updateProjectTagReviewStatusMutation, updateProjectStatus, updateProjectTags, getSowLazyQuery, sendParoSupportEmail, createChangeRequestMutation, createChangeRequest, createOrUpdateRatingRequestMutation, submitProjectHoursMutation, getAuth0Roles, submitProjectHoursLambda, createOrUpdateRating, getParoProjectsByClientIdDocument, user, internalPortal, csmUserGroup, clientPortal, signedSow, isStageProd, isRequestReviewEnabled, updateDBProjectRequestStatus,
|
|
64
|
+
const RightCardUI = ({ project, expertName, freelancerId, freelancerEmail, isAuthenticated, editEndDate, setEditEndDate, editStartDate, setEditStartDate, showTimeModal, setShowTimeModal, setSingleProjectData, projectData, checkStartDate, activeProject, projectFrequencyType, projectRateType, upcomingProject, selectedTab, showRating, projectTagsMap, updateProjectStatusMutation, GetAllProjectIrprDetailsForFreelancerDocument, updateParoProjectTagsMutation, GetParoProjectsDocument, updateProjectTagReviewStatusMutation, updateProjectStatus, updateProjectTags, getSowLazyQuery, sendParoSupportEmail, createChangeRequestMutation, createChangeRequest, createOrUpdateRatingRequestMutation, submitProjectHoursMutation, getAuth0Roles, submitProjectHoursLambda, createOrUpdateRating, getParoProjectsByClientIdDocument, user, internalPortal, csmUserGroup, clientPortal, signedSow, isStageProd, isRequestReviewEnabled, updateDBProjectRequestStatus, }) => {
|
|
65
65
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
66
66
|
const [expandClient, setExpandClient] = (0, react_1.useState)(false);
|
|
67
67
|
const [expandSupport, setExpandSupport] = (0, react_1.useState)(clientPortal);
|
|
@@ -186,7 +186,7 @@ const RightCardUI = ({ project, expertName, freelancerId, freelancerEmail, isAut
|
|
|
186
186
|
:
|
|
187
187
|
react_1.default.createElement(core_1.Tooltip, { classes: { tooltip: classes.tooltip }, title: (projectType === "One-time-Fixed" || projectType === "Recurring-Fixed") ? "Please reach out to your Customer Success Manager if you would like to submit time for Fixed Projects." : "", placement: "top", arrow: true },
|
|
188
188
|
react_1.default.createElement("div", null,
|
|
189
|
-
react_1.default.createElement(base_ui_1.Button, { label: "LOG YOUR TIME", disabled: !activeProject
|
|
189
|
+
react_1.default.createElement(base_ui_1.Button, { label: "LOG YOUR TIME", disabled: !activeProject, size: "sm", color: "primary", className: "w-full", onClick: () => { setShowTimeModal(true); } }))),
|
|
190
190
|
upcomingProject ? react_1.default.createElement(base_ui_1.Button, { label: "EDIT START DATE", disabled: false, size: "sm", className: "w-full", onClick: () => { setEditStartDate(true); } }) :
|
|
191
191
|
react_1.default.createElement(base_ui_1.Button, { label: "EDIT START DATE", disabled: !activeProject, size: "sm", className: "w-full", onClick: () => { setEditStartDate(true); } }),
|
|
192
192
|
checkStartDate ?
|
|
@@ -45,6 +45,11 @@ class UploadClient {
|
|
|
45
45
|
},
|
|
46
46
|
body: JSON.stringify(params),
|
|
47
47
|
});
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
const errorText = yield response.text(); // Read the response body as text (could be HTML)
|
|
50
|
+
console.error('Error response:', errorText);
|
|
51
|
+
throw new Error('Failed to start multipart upload');
|
|
52
|
+
}
|
|
48
53
|
let { responseData } = yield response.json();
|
|
49
54
|
this.state = Object.assign(Object.assign({}, this.state), { uploadId: responseData === null || responseData === void 0 ? void 0 : responseData.UploadId });
|
|
50
55
|
return this.uploadMultiPartFile();
|
|
@@ -71,6 +76,11 @@ class UploadClient {
|
|
|
71
76
|
method: 'POST',
|
|
72
77
|
body: JSON.stringify({ fileName: this.state.fileName, uploadId: this.state.uploadId, partNumber: index, method: 'get-presigned-url', bucketName: this.state.bucketName }),
|
|
73
78
|
});
|
|
79
|
+
if (!presignedUrlResponse.ok) {
|
|
80
|
+
const errorText = yield presignedUrlResponse.text();
|
|
81
|
+
console.error('Error getting presigned URL:', errorText);
|
|
82
|
+
throw new Error('Failed to get presigned URL');
|
|
83
|
+
}
|
|
74
84
|
const { responseData } = yield presignedUrlResponse.json();
|
|
75
85
|
// Add each upload part to promise array using presigned URL
|
|
76
86
|
let uploadResponse = fetch(responseData, {
|
|
@@ -104,6 +114,11 @@ class UploadClient {
|
|
|
104
114
|
},
|
|
105
115
|
body: JSON.stringify({ fileName: this.state.fileName, uploadId: this.state.uploadId, parts: partsArray, method: 'complete-upload', bucketName: this.state.bucketName }),
|
|
106
116
|
});
|
|
117
|
+
if (!response.ok) {
|
|
118
|
+
const errorText = yield response.text();
|
|
119
|
+
console.error('Error completing upload:', errorText);
|
|
120
|
+
throw new Error('Failed to complete multipart upload');
|
|
121
|
+
}
|
|
107
122
|
const { responseData } = yield response.json();
|
|
108
123
|
console.log('Upload Complete', responseData);
|
|
109
124
|
return `${JSON.stringify(responseData)}`;
|