@paro.io/expert-shared-components 1.14.41 → 1.14.42
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 -21
- package/README.md +2 -2
- package/lib/components/ClientReferencesSection/DeleteButton.js +11 -11
- package/lib/components/ClientReferencesSection/ParoError.js +10 -10
- package/lib/components/ClientReferencesSection/TagsSection.js +2 -2
- package/lib/components/ClientReferencesSection/styles/BrandedTypography.js +2 -2
- package/lib/components/ClientReferencesSection/styles/Buttons.js +15 -15
- package/lib/components/ClientReferencesSection/styles/Name.js +5 -5
- package/lib/components/ClientReferencesSection/styles/NullContentConditionalColor.js +4 -4
- package/lib/components/ClientReferencesSection/styles/SectionBody.js +11 -11
- package/lib/components/ClientReferencesSection/styles/SectionTitle.js +6 -6
- package/lib/components/ClientReferencesSection/styles/Tags.js +2 -2
- package/lib/components/DiscussionThread/DiscussionThread.d.ts +25 -25
- package/lib/components/DiscussionThread/DiscussionThread.js +137 -137
- package/lib/components/DiscussionThread/chat.d.ts +22 -22
- package/lib/components/DiscussionThread/chat.js +106 -106
- package/lib/components/DiscussionThread/index.d.ts +1 -1
- package/lib/components/DiscussionThread/index.js +5 -5
- package/lib/components/DocumentCenter/ClientDocumentsTable.d.ts +3 -1
- package/lib/components/DocumentCenter/ClientDocumentsTable.js +6 -16
- package/lib/components/DocumentCenter/DocumentCenter.js +8 -1
- package/lib/components/DocumentCenter/DocumentTable.d.ts +15 -15
- package/lib/components/DocumentCenter/DocumentTable.js +350 -350
- package/lib/components/DocumentCenter/DragDropUpload.d.ts +10 -0
- package/lib/components/DocumentCenter/DragDropUpload.js +124 -0
- package/lib/components/DocumentCenter/MultiFileUploadSection.d.ts +17 -0
- package/lib/components/DocumentCenter/MultiFileUploadSection.js +672 -0
- package/lib/components/DocumentCenter/ParoDocumentsTable.js +2 -2
- package/lib/components/DocumentCenter/UploadFilesButton.d.ts +6 -6
- package/lib/components/DocumentCenter/UploadFilesButton.js +29 -29
- package/lib/components/DocumentCenter/index.d.ts +3 -1
- package/lib/components/DocumentCenter/index.js +5 -1
- package/lib/components/EarningsTracker/ActiveProjectCard.d.ts +52 -52
- package/lib/components/EarningsTracker/ActiveProjectCard.js +161 -161
- package/lib/components/EarningsTracker/CenterCardUI.d.ts +13 -13
- package/lib/components/EarningsTracker/CenterCardUI.js +134 -134
- package/lib/components/EarningsTracker/EarningsTracker.d.ts +52 -52
- package/lib/components/EarningsTracker/EarningsTracker.js +508 -508
- package/lib/components/EarningsTracker/EditDateModal.d.ts +22 -22
- package/lib/components/EarningsTracker/EditDateModal.js +149 -149
- package/lib/components/EarningsTracker/EmailModal.d.ts +14 -14
- package/lib/components/EarningsTracker/EmailModal.js +79 -79
- package/lib/components/EarningsTracker/EndProjectModal.d.ts +56 -56
- package/lib/components/EarningsTracker/EndProjectModal.js +221 -221
- package/lib/components/EarningsTracker/LeftCardUI.d.ts +18 -18
- package/lib/components/EarningsTracker/LeftCardUI.js +189 -189
- package/lib/components/EarningsTracker/LogTimeModalAuthenticated.d.ts +52 -52
- package/lib/components/EarningsTracker/LogTimeModalAuthenticated.js +358 -358
- package/lib/components/EarningsTracker/ProgressBar.d.ts +4 -4
- package/lib/components/EarningsTracker/ProgressBar.js +66 -66
- package/lib/components/EarningsTracker/ReviewRequestModal.d.ts +17 -17
- package/lib/components/EarningsTracker/ReviewRequestModal.js +135 -135
- package/lib/components/EarningsTracker/RightCardUI.d.ts +46 -46
- package/lib/components/EarningsTracker/RightCardUI.js +231 -231
- package/lib/components/EarningsTracker/index.d.ts +1 -1
- package/lib/components/EarningsTracker/index.js +5 -5
- package/lib/components/Escalations/CustomTag.d.ts +3 -3
- package/lib/components/Escalations/CustomTag.js +25 -25
- package/lib/components/Escalations/ViewReponseModal.d.ts +8 -8
- package/lib/components/Escalations/ViewReponseModal.js +27 -27
- package/lib/components/ExpertProfileHeader/ActionButtonSection.js +6 -6
- package/lib/components/ExpertProfileHeader/ProfileSection.js +7 -7
- package/lib/components/Invoices/TestDecisionSection.d.ts +1 -1
- package/lib/components/Invoices/TestDecisionSection.js +126 -126
- package/lib/components/OrganizationChart/OrganizationChart.d.ts +15 -15
- package/lib/components/OrganizationChart/OrganizationChart.js +312 -312
- package/lib/components/OrganizationChart/PersonCard.js +5 -5
- package/lib/components/OrganizationChart/utils.js +79 -79
- package/lib/components/ProjectCard/ProgressBar.js +4 -4
- package/lib/components/ProjectCard/ReviewRequestModal.js +5 -5
- package/lib/components/ProjectIntelligence/MissingInformation/index.js +1 -1
- package/lib/components/Reviews/Pagination.js +6 -6
- package/lib/components/ReviewsTab/RatingHeader.js +6 -6
- package/lib/components/ReviewsTab/expert-shared-components.code-workspace +20 -20
- package/lib/components/ReviewsTab/reviewRequestModal.js +5 -5
- package/lib/components/shared/Image.js +13 -13
- package/lib/components/shared/ProfileTextField.d.ts +18 -18
- package/lib/components/shared/ProfileTextField.js +16 -16
- package/lib/components/shared/StyledActionButtons.d.ts +7 -7
- package/lib/components/shared/StyledActionButtons.js +15 -15
- package/lib/components/shared/ToastNotification.d.ts +10 -10
- package/lib/components/shared/ToastNotification.js +63 -63
- package/package.json +67 -67
|
@@ -0,0 +1,672 @@
|
|
|
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.MultiFileUploadSection = void 0;
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const core_1 = require("@material-ui/core");
|
|
41
|
+
const ExpandMore_1 = __importDefault(require("@material-ui/icons/ExpandMore"));
|
|
42
|
+
const ExpandLess_1 = __importDefault(require("@material-ui/icons/ExpandLess"));
|
|
43
|
+
const date_fns_1 = require("date-fns");
|
|
44
|
+
const base_ui_1 = require("@paro.io/base-ui");
|
|
45
|
+
const base_icons_1 = require("@paro.io/base-icons");
|
|
46
|
+
const DragDropUpload_1 = require("./DragDropUpload");
|
|
47
|
+
const utils_1 = require("../shared/utils");
|
|
48
|
+
const UploadClient_1 = __importDefault(require("../shared/UploadClient"));
|
|
49
|
+
const ClientDocumentTypes = [
|
|
50
|
+
"Financial Documents",
|
|
51
|
+
"Contractual and Legal Documents",
|
|
52
|
+
"Operational and Management Documents",
|
|
53
|
+
"Tax and Compliance Documents",
|
|
54
|
+
"Project Specific Documents",
|
|
55
|
+
];
|
|
56
|
+
const ParoDocumentTypes = [
|
|
57
|
+
"EO Insurance",
|
|
58
|
+
"Resume",
|
|
59
|
+
"General Insurance",
|
|
60
|
+
"Certification",
|
|
61
|
+
];
|
|
62
|
+
const CHUNK_SIZE = 5 * 1024 * 1024;
|
|
63
|
+
const generateOptions = (array, clientOptions, isClientPortal) => {
|
|
64
|
+
return array.map((item, index) => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const name = isClientPortal ? (_a = item === null || item === void 0 ? void 0 : item.freelancer) === null || _a === void 0 ? void 0 : _a.name : (_b = item === null || item === void 0 ? void 0 : item.client) === null || _b === void 0 ? void 0 : _b.name;
|
|
67
|
+
const projectName = item === null || item === void 0 ? void 0 : item.name;
|
|
68
|
+
let newText = "";
|
|
69
|
+
const itemKey = (item === null || item === void 0 ? void 0 : item.id)
|
|
70
|
+
? `${item === null || item === void 0 ? void 0 : item.id}_${index}`
|
|
71
|
+
: item === null || item === void 0 ? void 0 : item.split(" ").join("_").concat(index);
|
|
72
|
+
if (clientOptions) {
|
|
73
|
+
if (name && projectName) {
|
|
74
|
+
newText = `${name} - ${projectName}`;
|
|
75
|
+
}
|
|
76
|
+
else if (name) {
|
|
77
|
+
newText = name;
|
|
78
|
+
}
|
|
79
|
+
else if (projectName) {
|
|
80
|
+
newText = projectName;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
newText = "N/A";
|
|
84
|
+
}
|
|
85
|
+
return Object.assign({ id: itemKey, value: newText, label: newText }, item);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
return {
|
|
89
|
+
id: itemKey,
|
|
90
|
+
value: item,
|
|
91
|
+
label: item,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
const MultiFileUploadSection = ({ paroDocuments, clientAndProjectsList, uploadExpertClientFiles, uploadInternalFile, foldername, refetchFiles, legacyFreelancerId, freelancerName, freelancerEmail, isClientPortal = false, documentUploadUrl, showAsPage, }) => {
|
|
97
|
+
var _a;
|
|
98
|
+
const [uploadItems, setUploadItems] = (0, react_1.useState)([]);
|
|
99
|
+
const [isUploading, setIsUploading] = (0, react_1.useState)(false);
|
|
100
|
+
const [showUploadSection, setShowUploadSection] = (0, react_1.useState)(true);
|
|
101
|
+
const [selectedExpert, setSelectedExpert] = (0, react_1.useState)(null);
|
|
102
|
+
const documentTypeOptions = paroDocuments
|
|
103
|
+
? generateOptions(ParoDocumentTypes, false, isClientPortal)
|
|
104
|
+
: generateOptions(ClientDocumentTypes, false, isClientPortal);
|
|
105
|
+
const clientOptions = clientAndProjectsList
|
|
106
|
+
? generateOptions(clientAndProjectsList, true, isClientPortal)
|
|
107
|
+
: [];
|
|
108
|
+
const defaultDocType = documentTypeOptions[0].value;
|
|
109
|
+
// Group projects by expert for client portal OR by client for expert portal
|
|
110
|
+
const expertGroups = react_1.default.useMemo(() => {
|
|
111
|
+
if (!clientAndProjectsList)
|
|
112
|
+
return [];
|
|
113
|
+
const groups = new Map();
|
|
114
|
+
clientAndProjectsList.forEach((project) => {
|
|
115
|
+
var _a, _b, _c, _d;
|
|
116
|
+
const id = isClientPortal ? (_a = project === null || project === void 0 ? void 0 : project.freelancer) === null || _a === void 0 ? void 0 : _a.id : (_b = project === null || project === void 0 ? void 0 : project.client) === null || _b === void 0 ? void 0 : _b.id;
|
|
117
|
+
const name = isClientPortal
|
|
118
|
+
? (_c = project === null || project === void 0 ? void 0 : project.freelancer) === null || _c === void 0 ? void 0 : _c.name
|
|
119
|
+
: (_d = project === null || project === void 0 ? void 0 : project.client) === null || _d === void 0 ? void 0 : _d.name;
|
|
120
|
+
const projectStatus = (project === null || project === void 0 ? void 0 : project.status) || (project === null || project === void 0 ? void 0 : project.projectStatus);
|
|
121
|
+
// Exclude completed, DOA, and churned projects
|
|
122
|
+
const excludedStatuses = ["complete", "completed", "doa", "churned"];
|
|
123
|
+
const isValidProject = projectStatus &&
|
|
124
|
+
!excludedStatuses.includes(projectStatus.toLowerCase());
|
|
125
|
+
if (id && name) {
|
|
126
|
+
if (!groups.has(id)) {
|
|
127
|
+
groups.set(id, {
|
|
128
|
+
expert: { id, name },
|
|
129
|
+
projects: [],
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
// Only add valid projects (not completed, DOA, or churned)
|
|
133
|
+
if (isValidProject) {
|
|
134
|
+
groups.get(id).projects.push(project);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
// Filter out experts/clients with zero valid projects
|
|
139
|
+
return Array.from(groups.values()).filter((group) => group.projects.length > 0);
|
|
140
|
+
}, [isClientPortal, clientAndProjectsList]);
|
|
141
|
+
const handleExpertSelection = (expert) => {
|
|
142
|
+
if ((selectedExpert === null || selectedExpert === void 0 ? void 0 : selectedExpert.id) === expert.id) {
|
|
143
|
+
// Deselect if clicking the same expert
|
|
144
|
+
setSelectedExpert(null);
|
|
145
|
+
// Clear all project assignments
|
|
146
|
+
setUploadItems((prev) => prev.map((item) => (Object.assign(Object.assign({}, item), { clientAndProject: undefined }))));
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
// Select new expert
|
|
150
|
+
setSelectedExpert(expert);
|
|
151
|
+
// Get expert's/client's valid projects (not completed, DOA, or churned)
|
|
152
|
+
const expertProjects = clientOptions.filter((opt) => {
|
|
153
|
+
var _a, _b;
|
|
154
|
+
const isMatch = isClientPortal
|
|
155
|
+
? ((_a = opt.freelancer) === null || _a === void 0 ? void 0 : _a.id) === expert.id
|
|
156
|
+
: ((_b = opt.client) === null || _b === void 0 ? void 0 : _b.id) === expert.id;
|
|
157
|
+
const projectStatus = opt.status || opt.projectStatus;
|
|
158
|
+
const excludedStatuses = ["complete", "completed", "doa", "churned"];
|
|
159
|
+
const isValidProject = projectStatus &&
|
|
160
|
+
!excludedStatuses.includes(projectStatus.toLowerCase());
|
|
161
|
+
return isMatch && isValidProject;
|
|
162
|
+
});
|
|
163
|
+
// If expert has only one active project, auto-assign it to all files
|
|
164
|
+
if (expertProjects.length === 1) {
|
|
165
|
+
setUploadItems((prev) => prev.map((item) => (Object.assign(Object.assign({}, item), { clientAndProject: expertProjects[0] }))));
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
// Clear all project assignments when switching to multi-project expert
|
|
169
|
+
setUploadItems((prev) => prev.map((item) => (Object.assign(Object.assign({}, item), { clientAndProject: undefined }))));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
// Get selected expert's/client's projects and count
|
|
174
|
+
const selectedExpertProjects = react_1.default.useMemo(() => {
|
|
175
|
+
if (!selectedExpert)
|
|
176
|
+
return [];
|
|
177
|
+
return clientOptions.filter((opt) => {
|
|
178
|
+
var _a, _b;
|
|
179
|
+
const isMatch = isClientPortal
|
|
180
|
+
? ((_a = opt.freelancer) === null || _a === void 0 ? void 0 : _a.id) === selectedExpert.id
|
|
181
|
+
: ((_b = opt.client) === null || _b === void 0 ? void 0 : _b.id) === selectedExpert.id;
|
|
182
|
+
const projectStatus = opt.status || opt.projectStatus;
|
|
183
|
+
const excludedStatuses = ["complete", "completed", "doa", "churned"];
|
|
184
|
+
const isValidProject = projectStatus &&
|
|
185
|
+
!excludedStatuses.includes(projectStatus.toLowerCase());
|
|
186
|
+
return isMatch && isValidProject;
|
|
187
|
+
});
|
|
188
|
+
}, [selectedExpert, clientOptions, isClientPortal]);
|
|
189
|
+
const hasMultipleProjects = selectedExpertProjects.length > 1;
|
|
190
|
+
const hasSingleProject = selectedExpertProjects.length === 1;
|
|
191
|
+
// Check if all files have projects assigned (for multi-project experts/clients)
|
|
192
|
+
const allFilesHaveProjects = react_1.default.useMemo(() => {
|
|
193
|
+
if (!hasMultipleProjects)
|
|
194
|
+
return true;
|
|
195
|
+
return uploadItems.every((item) => { var _a; return (_a = item.clientAndProject) === null || _a === void 0 ? void 0 : _a.value; });
|
|
196
|
+
}, [uploadItems, hasMultipleProjects]);
|
|
197
|
+
const handleFilesSelected = (files) => {
|
|
198
|
+
const newItems = files.map((file) => ({
|
|
199
|
+
id: `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
|
200
|
+
file,
|
|
201
|
+
documentName: file.name.substring(0, file.name.lastIndexOf(".")),
|
|
202
|
+
docType: defaultDocType,
|
|
203
|
+
clientAndProject: undefined, // Don't auto-assign, let user select
|
|
204
|
+
expiryDate: null,
|
|
205
|
+
status: "pending",
|
|
206
|
+
progress: 0,
|
|
207
|
+
}));
|
|
208
|
+
setUploadItems((prev) => [...prev, ...newItems]);
|
|
209
|
+
(0, utils_1.showToast)("success", `${files.length} file(s) added to upload queue`);
|
|
210
|
+
};
|
|
211
|
+
const removeItem = (id) => {
|
|
212
|
+
setUploadItems((prev) => prev.filter((item) => item.id !== id));
|
|
213
|
+
};
|
|
214
|
+
const updateItem = (id, updates) => {
|
|
215
|
+
setUploadItems((prev) => prev.map((item) => (item.id === id ? Object.assign(Object.assign({}, item), updates) : item)));
|
|
216
|
+
};
|
|
217
|
+
const validateItem = (item) => {
|
|
218
|
+
var _a;
|
|
219
|
+
if (!item.documentName.trim()) {
|
|
220
|
+
(0, utils_1.showToast)("warning", `Document name is required for ${item.file.name}`);
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
if (!paroDocuments && !((_a = item.clientAndProject) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
224
|
+
(0, utils_1.showToast)("warning", `Client & Project is required for ${item.file.name}`);
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
if (paroDocuments && item.docType === "EO Insurance") {
|
|
228
|
+
if (!item.expiryDate) {
|
|
229
|
+
(0, utils_1.showToast)("warning", `Expiry date is required for EO Insurance documents`);
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
if (item.dateError) {
|
|
233
|
+
(0, utils_1.showToast)("warning", `Please fix the date error: ${item.dateError}`);
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return true;
|
|
238
|
+
};
|
|
239
|
+
const uploadSingleFile = (item) => __awaiter(void 0, void 0, void 0, function* () {
|
|
240
|
+
try {
|
|
241
|
+
const fileExtension = item.file.name.substring(item.file.name.lastIndexOf(".") + 1);
|
|
242
|
+
const reader = new FileReader();
|
|
243
|
+
return new Promise((resolve) => {
|
|
244
|
+
reader.onloadend = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
245
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
246
|
+
const fileForUpload = String(reader.result).split(";base64,")[1];
|
|
247
|
+
const isLargeFile = item.file.size >= CHUNK_SIZE;
|
|
248
|
+
const fileNameWithExtension = `${item.documentName}.${fileExtension}`;
|
|
249
|
+
updateItem(item.id, { status: "uploading", progress: 10 });
|
|
250
|
+
try {
|
|
251
|
+
if (isLargeFile) {
|
|
252
|
+
const uploadClient = new UploadClient_1.default({
|
|
253
|
+
fileSelected: item.file,
|
|
254
|
+
fileName: fileNameWithExtension,
|
|
255
|
+
projectId: (_a = item.clientAndProject) === null || _a === void 0 ? void 0 : _a.id,
|
|
256
|
+
documentUploadUrl,
|
|
257
|
+
});
|
|
258
|
+
yield uploadClient.triggerMultipartUpload();
|
|
259
|
+
}
|
|
260
|
+
updateItem(item.id, { progress: 50 });
|
|
261
|
+
if (paroDocuments) {
|
|
262
|
+
const result = yield uploadInternalFile({
|
|
263
|
+
variables: {
|
|
264
|
+
input: {
|
|
265
|
+
foldername,
|
|
266
|
+
subfolder: item.docType,
|
|
267
|
+
filename: `${item.documentName}.${fileExtension}`,
|
|
268
|
+
data: fileForUpload,
|
|
269
|
+
expirationDate: item.docType === "EO Insurance" && item.expiryDate
|
|
270
|
+
? item.expiryDate.toISOString()
|
|
271
|
+
: "",
|
|
272
|
+
valid: true,
|
|
273
|
+
sourceOfEOInsurance: "Dashboard",
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
if ((_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.uploadFileData) {
|
|
278
|
+
updateItem(item.id, { status: "success", progress: 100 });
|
|
279
|
+
resolve(true);
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
throw new Error("Upload failed");
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
const result = yield uploadExpertClientFiles({
|
|
287
|
+
variables: {
|
|
288
|
+
input: {
|
|
289
|
+
clientId: (_d = (_c = item.clientAndProject) === null || _c === void 0 ? void 0 : _c.client) === null || _d === void 0 ? void 0 : _d.id,
|
|
290
|
+
clientName: (_f = (_e = item.clientAndProject) === null || _e === void 0 ? void 0 : _e.client) === null || _f === void 0 ? void 0 : _f.name,
|
|
291
|
+
email: isClientPortal
|
|
292
|
+
? (_h = (_g = item.clientAndProject) === null || _g === void 0 ? void 0 : _g.freelancer) === null || _h === void 0 ? void 0 : _h.name
|
|
293
|
+
: freelancerEmail,
|
|
294
|
+
fileName: `${item.documentName}.${fileExtension}`,
|
|
295
|
+
fileSize: item.file.size,
|
|
296
|
+
fileType: utils_1.DOCUMENT_TYPE_CONSTANTS[item.docType],
|
|
297
|
+
freelancerId: isClientPortal
|
|
298
|
+
? (_k = (_j = item.clientAndProject) === null || _j === void 0 ? void 0 : _j.freelancer) === null || _k === void 0 ? void 0 : _k.id
|
|
299
|
+
: legacyFreelancerId,
|
|
300
|
+
freelancerName: isClientPortal
|
|
301
|
+
? (_m = (_l = item.clientAndProject) === null || _l === void 0 ? void 0 : _l.freelancer) === null || _m === void 0 ? void 0 : _m.name
|
|
302
|
+
: freelancerName,
|
|
303
|
+
projectId: (_o = item.clientAndProject) === null || _o === void 0 ? void 0 : _o.id,
|
|
304
|
+
projectName: (_p = item.clientAndProject) === null || _p === void 0 ? void 0 : _p.name,
|
|
305
|
+
uploadedBy: isClientPortal ? "CLIENT" : "FREELANCER",
|
|
306
|
+
data: isLargeFile ? "" : fileForUpload,
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
});
|
|
310
|
+
if ((_q = result === null || result === void 0 ? void 0 : result.data) === null || _q === void 0 ? void 0 : _q.uploadExpertClientFilesData) {
|
|
311
|
+
updateItem(item.id, { status: "success", progress: 100 });
|
|
312
|
+
resolve(true);
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
throw new Error("Upload failed");
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
catch (error) {
|
|
320
|
+
updateItem(item.id, {
|
|
321
|
+
status: "error",
|
|
322
|
+
progress: 0,
|
|
323
|
+
error: "Upload failed",
|
|
324
|
+
});
|
|
325
|
+
resolve(false);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
reader.readAsDataURL(item.file);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
catch (error) {
|
|
332
|
+
updateItem(item.id, { status: "error", error: "Failed to process file" });
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
const handleUploadAll = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
337
|
+
const validItems = uploadItems.filter((item) => {
|
|
338
|
+
if (item.status === "success")
|
|
339
|
+
return false;
|
|
340
|
+
return validateItem(item);
|
|
341
|
+
});
|
|
342
|
+
if (validItems.length === 0) {
|
|
343
|
+
(0, utils_1.showToast)("warning", "No valid files to upload");
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
setIsUploading(true);
|
|
347
|
+
let successCount = 0;
|
|
348
|
+
let failCount = 0;
|
|
349
|
+
for (const item of validItems) {
|
|
350
|
+
const success = yield uploadSingleFile(item);
|
|
351
|
+
if (success) {
|
|
352
|
+
successCount++;
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
failCount++;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
setIsUploading(false);
|
|
359
|
+
if (successCount > 0) {
|
|
360
|
+
(0, utils_1.showToast)("success", `${successCount} file(s) uploaded successfully!`);
|
|
361
|
+
if (refetchFiles) {
|
|
362
|
+
yield refetchFiles();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (failCount > 0) {
|
|
366
|
+
(0, utils_1.showToast)("warning", `${failCount} file(s) failed to upload`);
|
|
367
|
+
}
|
|
368
|
+
if (failCount === 0) {
|
|
369
|
+
setUploadItems([]);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
const formatFileSize = (bytes) => {
|
|
373
|
+
if (bytes === 0)
|
|
374
|
+
return "0 Bytes";
|
|
375
|
+
const k = 1024;
|
|
376
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
377
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
378
|
+
return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + " " + sizes[i];
|
|
379
|
+
};
|
|
380
|
+
return (react_1.default.createElement(core_1.Box, { mb: 3 },
|
|
381
|
+
react_1.default.createElement(core_1.Paper, { elevation: 2, style: { padding: "20px", borderRadius: "12px" } },
|
|
382
|
+
react_1.default.createElement(core_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 },
|
|
383
|
+
react_1.default.createElement(core_1.Box, { display: "flex", alignItems: "center" },
|
|
384
|
+
react_1.default.createElement(core_1.Typography, { variant: "h6", className: "font-semibold" }, "Upload Documents"),
|
|
385
|
+
uploadItems.length > 0 && (react_1.default.createElement(core_1.Chip, { label: `${uploadItems.length} ${uploadItems.length === 1 ? "file" : "files"}`, color: "primary", size: "small", style: { marginLeft: "12px" } }))),
|
|
386
|
+
react_1.default.createElement(core_1.Tooltip, { title: showUploadSection ? "Collapse" : "Expand" },
|
|
387
|
+
react_1.default.createElement(core_1.IconButton, { onClick: () => setShowUploadSection(!showUploadSection), size: "small" }, showUploadSection ? react_1.default.createElement(ExpandLess_1.default, null) : react_1.default.createElement(ExpandMore_1.default, null)))),
|
|
388
|
+
react_1.default.createElement(core_1.Collapse, { in: showUploadSection },
|
|
389
|
+
react_1.default.createElement(core_1.Box, { mb: 3 },
|
|
390
|
+
react_1.default.createElement(DragDropUpload_1.DragDropUpload, { onFilesSelected: handleFilesSelected, maxFileSize: 10, maxFiles: 10, acceptedFileTypes: [
|
|
391
|
+
".pdf",
|
|
392
|
+
".doc",
|
|
393
|
+
".xls",
|
|
394
|
+
".csv",
|
|
395
|
+
".jpg",
|
|
396
|
+
".png",
|
|
397
|
+
], disabled: isUploading })),
|
|
398
|
+
uploadItems.length > 0 &&
|
|
399
|
+
!paroDocuments &&
|
|
400
|
+
expertGroups.length > 0 && (react_1.default.createElement(core_1.Box, { mb: 3, p: 2, style: { backgroundColor: "#F7FAFC", borderRadius: "8px" } },
|
|
401
|
+
react_1.default.createElement(core_1.Box, { display: "flex", alignItems: "center", mb: 2 },
|
|
402
|
+
react_1.default.createElement(core_1.Box, { style: {
|
|
403
|
+
width: "32px",
|
|
404
|
+
height: "32px",
|
|
405
|
+
borderRadius: "50%",
|
|
406
|
+
backgroundColor: "#48BB78",
|
|
407
|
+
color: "white",
|
|
408
|
+
display: "flex",
|
|
409
|
+
alignItems: "center",
|
|
410
|
+
justifyContent: "center",
|
|
411
|
+
fontWeight: "bold",
|
|
412
|
+
marginRight: "12px",
|
|
413
|
+
} }, "1"),
|
|
414
|
+
react_1.default.createElement(core_1.Typography, { variant: "subtitle1", style: { fontWeight: 600 } }, isClientPortal
|
|
415
|
+
? "SEND TO EXPERT — select who these files are for"
|
|
416
|
+
: "SEND TO CLIENT — select which client these files are for")),
|
|
417
|
+
react_1.default.createElement(core_1.Box, { display: "flex", flexWrap: "wrap", style: { gap: "8px" } }, expertGroups.map((group) => (react_1.default.createElement(core_1.Chip, { key: group.expert.id, label: react_1.default.createElement(core_1.Box, null,
|
|
418
|
+
react_1.default.createElement("strong", null, group.expert.name),
|
|
419
|
+
react_1.default.createElement(core_1.Box, { component: "span", ml: 1, style: { color: "#718096" } },
|
|
420
|
+
group.projects.length,
|
|
421
|
+
" ",
|
|
422
|
+
group.projects.length === 1
|
|
423
|
+
? "project"
|
|
424
|
+
: "projects")), onClick: () => handleExpertSelection(group.expert), clickable: true, disabled: group.projects.length === 0, color: "default", style: {
|
|
425
|
+
padding: "8px 12px",
|
|
426
|
+
height: "auto",
|
|
427
|
+
borderRadius: "20px",
|
|
428
|
+
border: (selectedExpert === null || selectedExpert === void 0 ? void 0 : selectedExpert.id) === group.expert.id
|
|
429
|
+
? "2px solid #3182CE"
|
|
430
|
+
: "1px solid #CBD5E0",
|
|
431
|
+
backgroundColor: (selectedExpert === null || selectedExpert === void 0 ? void 0 : selectedExpert.id) === group.expert.id
|
|
432
|
+
? "#EBF8FF"
|
|
433
|
+
: "white",
|
|
434
|
+
opacity: group.projects.length === 0 ? 0.5 : 1,
|
|
435
|
+
cursor: group.projects.length === 0
|
|
436
|
+
? "not-allowed"
|
|
437
|
+
: "pointer",
|
|
438
|
+
} })))),
|
|
439
|
+
selectedExpert && hasSingleProject && (react_1.default.createElement(core_1.Box, { mt: 2 },
|
|
440
|
+
react_1.default.createElement(core_1.Chip, { label: "AUTO-ASSIGNED", size: "small", style: {
|
|
441
|
+
backgroundColor: "#C6F6D5",
|
|
442
|
+
color: "#22543D",
|
|
443
|
+
fontWeight: 600,
|
|
444
|
+
} }),
|
|
445
|
+
react_1.default.createElement(core_1.Typography, { variant: "caption", style: { marginLeft: "8px", color: "#718096" } },
|
|
446
|
+
((_a = selectedExpertProjects[0]) === null || _a === void 0 ? void 0 : _a.name) || "Project",
|
|
447
|
+
" \u2014 only project with ",
|
|
448
|
+
selectedExpert.name))),
|
|
449
|
+
selectedExpert && hasMultipleProjects && (react_1.default.createElement(core_1.Box, { mt: 2 },
|
|
450
|
+
react_1.default.createElement(core_1.Chip, { label: `${selectedExpertProjects.length} PROJECTS`, size: "small", style: {
|
|
451
|
+
backgroundColor: "#FEF5E7",
|
|
452
|
+
color: "#D97706",
|
|
453
|
+
fontWeight: 600,
|
|
454
|
+
}, icon: react_1.default.createElement(base_icons_1.IconExclamation, { stroke: "#D97706" }) }),
|
|
455
|
+
react_1.default.createElement(core_1.Typography, { variant: "caption", style: { marginLeft: "8px", color: "#718096" } }, "Select which project each file is for below"))))),
|
|
456
|
+
uploadItems.length > 0 && (react_1.default.createElement(core_1.Box, null,
|
|
457
|
+
react_1.default.createElement(core_1.Box, null,
|
|
458
|
+
react_1.default.createElement(core_1.Grid, { container: true, spacing: 2 }, uploadItems.map((item, index) => {
|
|
459
|
+
var _a;
|
|
460
|
+
return (react_1.default.createElement(core_1.Grid, { item: true, xs: 12, key: item.id },
|
|
461
|
+
react_1.default.createElement(core_1.Paper, { elevation: 1, style: {
|
|
462
|
+
padding: "12px 16px",
|
|
463
|
+
backgroundColor: "white",
|
|
464
|
+
border: "1px solid #E2E8F0",
|
|
465
|
+
borderRadius: "4px",
|
|
466
|
+
} },
|
|
467
|
+
react_1.default.createElement(core_1.Grid, { container: true, spacing: 2 },
|
|
468
|
+
react_1.default.createElement(core_1.Grid, { item: true, xs: 12, sm: "auto", style: { display: "flex", alignItems: "center" } },
|
|
469
|
+
react_1.default.createElement(base_icons_1.IconDocument, { size: "lg" })),
|
|
470
|
+
react_1.default.createElement(core_1.Grid, { item: true, xs: 12, sm: true },
|
|
471
|
+
react_1.default.createElement(base_ui_1.Input, { type: "text", value: item.documentName, onChange: (e) => updateItem(item.id, {
|
|
472
|
+
documentName: e.target.value,
|
|
473
|
+
}), disabled: item.status === "uploading" ||
|
|
474
|
+
item.status === "success", placeholder: "Document name" }),
|
|
475
|
+
react_1.default.createElement(core_1.Typography, { variant: "caption", style: {
|
|
476
|
+
color: "#718096",
|
|
477
|
+
display: "block",
|
|
478
|
+
marginTop: "4px",
|
|
479
|
+
} },
|
|
480
|
+
item.file.name,
|
|
481
|
+
" \u2022",
|
|
482
|
+
" ",
|
|
483
|
+
formatFileSize(item.file.size))),
|
|
484
|
+
react_1.default.createElement(core_1.Grid, { item: true, xs: 12, sm: 3 },
|
|
485
|
+
react_1.default.createElement(base_ui_1.Select, { value: item.docType, onChange: (e) => {
|
|
486
|
+
updateItem(item.id, {
|
|
487
|
+
docType: e.target.value,
|
|
488
|
+
});
|
|
489
|
+
// Clear expiry date and error if switching away from EO Insurance
|
|
490
|
+
if (e.target.value !== "EO Insurance") {
|
|
491
|
+
updateItem(item.id, {
|
|
492
|
+
expiryDate: null,
|
|
493
|
+
dateError: null,
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
}, options: documentTypeOptions, disabled: item.status === "uploading" ||
|
|
497
|
+
item.status === "success", required: false })),
|
|
498
|
+
paroDocuments && item.docType === "EO Insurance" && (react_1.default.createElement(core_1.Grid, { item: true, xs: 12, sm: 3, style: { marginTop: "5px" } },
|
|
499
|
+
react_1.default.createElement(core_1.TextField, { type: "date", label: "Expiration Date", value: item.expiryDate
|
|
500
|
+
? new Date(item.expiryDate)
|
|
501
|
+
.toISOString()
|
|
502
|
+
.split("T")[0]
|
|
503
|
+
: "", color: "primary", onChange: (e) => {
|
|
504
|
+
const dateValue = e.target.value
|
|
505
|
+
? new Date(e.target.value)
|
|
506
|
+
: null;
|
|
507
|
+
if (dateValue) {
|
|
508
|
+
const currentDate = (0, date_fns_1.startOfDay)(new Date());
|
|
509
|
+
if ((0, date_fns_1.isBefore)(dateValue, currentDate)) {
|
|
510
|
+
updateItem(item.id, {
|
|
511
|
+
expiryDate: dateValue,
|
|
512
|
+
dateError: "The expiration date cannot be in the past.",
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
else {
|
|
516
|
+
updateItem(item.id, {
|
|
517
|
+
expiryDate: dateValue,
|
|
518
|
+
dateError: null,
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
updateItem(item.id, {
|
|
524
|
+
expiryDate: null,
|
|
525
|
+
dateError: null,
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
}, InputLabelProps: {
|
|
529
|
+
shrink: true,
|
|
530
|
+
}, disabled: item.status === "uploading" ||
|
|
531
|
+
item.status === "success", fullWidth: true, variant: "outlined", size: "small", required: true, error: !!item.dateError, helperText: item.dateError }))),
|
|
532
|
+
!paroDocuments && !hasSingleProject && (react_1.default.createElement(core_1.Grid, { item: true, xs: 12, sm: 3 },
|
|
533
|
+
react_1.default.createElement(base_ui_1.Select, { value: ((_a = item.clientAndProject) === null || _a === void 0 ? void 0 : _a.value) || "", onChange: (e) => {
|
|
534
|
+
// Handle empty selection
|
|
535
|
+
if (e.target.value === "") {
|
|
536
|
+
updateItem(item.id, {
|
|
537
|
+
clientAndProject: undefined,
|
|
538
|
+
});
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
const filteredOptions = selectedExpert
|
|
542
|
+
? clientOptions.filter((opt) => {
|
|
543
|
+
var _a, _b;
|
|
544
|
+
const isMatch = isClientPortal
|
|
545
|
+
? ((_a = opt.freelancer) === null || _a === void 0 ? void 0 : _a.id) ===
|
|
546
|
+
selectedExpert.id
|
|
547
|
+
: ((_b = opt.client) === null || _b === void 0 ? void 0 : _b.id) ===
|
|
548
|
+
selectedExpert.id;
|
|
549
|
+
const projectStatus = opt.status || opt.projectStatus;
|
|
550
|
+
const excludedStatuses = [
|
|
551
|
+
"complete",
|
|
552
|
+
"completed",
|
|
553
|
+
"doa",
|
|
554
|
+
"churned",
|
|
555
|
+
];
|
|
556
|
+
const isValidProject = projectStatus &&
|
|
557
|
+
!excludedStatuses.includes(projectStatus.toLowerCase());
|
|
558
|
+
return isMatch && isValidProject;
|
|
559
|
+
})
|
|
560
|
+
: clientOptions;
|
|
561
|
+
const selected = filteredOptions.find((opt) => opt.value === e.target.value);
|
|
562
|
+
updateItem(item.id, {
|
|
563
|
+
clientAndProject: selected,
|
|
564
|
+
});
|
|
565
|
+
}, options: [
|
|
566
|
+
{
|
|
567
|
+
id: "placeholder",
|
|
568
|
+
value: "",
|
|
569
|
+
label: "Which project?",
|
|
570
|
+
},
|
|
571
|
+
...(selectedExpert
|
|
572
|
+
? clientOptions.filter((opt) => {
|
|
573
|
+
var _a, _b;
|
|
574
|
+
const isMatch = isClientPortal
|
|
575
|
+
? ((_a = opt.freelancer) === null || _a === void 0 ? void 0 : _a.id) ===
|
|
576
|
+
selectedExpert.id
|
|
577
|
+
: ((_b = opt.client) === null || _b === void 0 ? void 0 : _b.id) ===
|
|
578
|
+
selectedExpert.id;
|
|
579
|
+
const projectStatus = opt.status || opt.projectStatus;
|
|
580
|
+
const excludedStatuses = [
|
|
581
|
+
"complete",
|
|
582
|
+
"completed",
|
|
583
|
+
"doa",
|
|
584
|
+
"churned",
|
|
585
|
+
];
|
|
586
|
+
const isValidProject = projectStatus &&
|
|
587
|
+
!excludedStatuses.includes(projectStatus.toLowerCase());
|
|
588
|
+
return isMatch && isValidProject;
|
|
589
|
+
})
|
|
590
|
+
: clientOptions.filter((opt) => {
|
|
591
|
+
const projectStatus = opt.status || opt.projectStatus;
|
|
592
|
+
const excludedStatuses = [
|
|
593
|
+
"complete",
|
|
594
|
+
"completed",
|
|
595
|
+
"doa",
|
|
596
|
+
"churned",
|
|
597
|
+
];
|
|
598
|
+
return (projectStatus &&
|
|
599
|
+
!excludedStatuses.includes(projectStatus.toLowerCase()));
|
|
600
|
+
})),
|
|
601
|
+
], disabled: item.status === "uploading" ||
|
|
602
|
+
item.status === "success" ||
|
|
603
|
+
!selectedExpert, required: false }))),
|
|
604
|
+
react_1.default.createElement(core_1.Grid, { item: true, xs: 12, sm: "auto", style: {
|
|
605
|
+
display: "flex",
|
|
606
|
+
alignItems: "center",
|
|
607
|
+
justifyContent: "flex-end",
|
|
608
|
+
} },
|
|
609
|
+
react_1.default.createElement(core_1.Tooltip, { title: "Remove file" },
|
|
610
|
+
react_1.default.createElement(core_1.IconButton, { onClick: () => removeItem(item.id), disabled: item.status === "uploading", size: "small" },
|
|
611
|
+
react_1.default.createElement(base_icons_1.IconTrash, { size: "md" }))))),
|
|
612
|
+
item.status === "uploading" && (react_1.default.createElement(core_1.Box, { mt: 1, ml: { xs: 0, sm: 6 } },
|
|
613
|
+
react_1.default.createElement(core_1.Typography, { variant: "caption", style: { color: "#3182CE" } },
|
|
614
|
+
"Uploading ",
|
|
615
|
+
item.progress,
|
|
616
|
+
"%..."))),
|
|
617
|
+
item.status === "success" && (react_1.default.createElement(core_1.Box, { mt: 1, ml: { xs: 0, sm: 6 } },
|
|
618
|
+
react_1.default.createElement(core_1.Typography, { variant: "caption", style: { color: "#38A169" } }, "\u2713 Upload successful"))),
|
|
619
|
+
item.status === "error" && (react_1.default.createElement(core_1.Box, { mt: 1, ml: { xs: 0, sm: 6 } },
|
|
620
|
+
react_1.default.createElement(core_1.Typography, { variant: "caption", style: { color: "#E53E3E" } }, "\u2717 Upload failed"))))));
|
|
621
|
+
}))),
|
|
622
|
+
react_1.default.createElement(core_1.Divider, { style: { marginTop: "24px" } }),
|
|
623
|
+
react_1.default.createElement(core_1.Box, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2, mt: 2 },
|
|
624
|
+
react_1.default.createElement(core_1.Box, null,
|
|
625
|
+
react_1.default.createElement(core_1.Typography, { variant: "body2", style: { color: "#718096" } }, paroDocuments ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
626
|
+
react_1.default.createElement("span", { style: { fontWeight: "bold" } }, uploadItems.filter((i) => i.status !== "success")
|
|
627
|
+
.length),
|
|
628
|
+
" ",
|
|
629
|
+
uploadItems.filter((i) => i.status !== "success")
|
|
630
|
+
.length === 1
|
|
631
|
+
? "file"
|
|
632
|
+
: "files")) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
633
|
+
react_1.default.createElement("span", { style: { fontWeight: "bold" } }, uploadItems.filter((i) => i.status !== "success")
|
|
634
|
+
.length),
|
|
635
|
+
" ",
|
|
636
|
+
"files \u2022",
|
|
637
|
+
" ",
|
|
638
|
+
react_1.default.createElement("span", { style: { color: "#718096" } },
|
|
639
|
+
react_1.default.createElement("span", { style: { fontWeight: "bold" } }, uploadItems.filter((i) => {
|
|
640
|
+
var _a;
|
|
641
|
+
return ((_a = i.clientAndProject) === null || _a === void 0 ? void 0 : _a.value) &&
|
|
642
|
+
i.status !== "success";
|
|
643
|
+
}).length),
|
|
644
|
+
" ",
|
|
645
|
+
"project-assigned"),
|
|
646
|
+
" ",
|
|
647
|
+
"\u2022",
|
|
648
|
+
" ",
|
|
649
|
+
react_1.default.createElement("span", { style: { color: "#D97706" } },
|
|
650
|
+
react_1.default.createElement("span", { style: { fontWeight: "bold" } }, uploadItems.filter((i) => {
|
|
651
|
+
var _a;
|
|
652
|
+
return !((_a = i.clientAndProject) === null || _a === void 0 ? void 0 : _a.value) &&
|
|
653
|
+
i.status !== "success";
|
|
654
|
+
}).length),
|
|
655
|
+
" ",
|
|
656
|
+
"need project"))))),
|
|
657
|
+
react_1.default.createElement(core_1.Box, null,
|
|
658
|
+
react_1.default.createElement(core_1.Box, { component: "span", ml: 1 },
|
|
659
|
+
react_1.default.createElement(base_ui_1.Button, { label: isUploading
|
|
660
|
+
? "Uploading..."
|
|
661
|
+
: `Upload ${uploadItems.filter((i) => i.status !== "success").length} Files`, onClick: handleUploadAll, disabled: uploadItems.length === 0 ||
|
|
662
|
+
isUploading ||
|
|
663
|
+
uploadItems.every((i) => i.status === "success") ||
|
|
664
|
+
(!paroDocuments && !selectedExpert) ||
|
|
665
|
+
(hasMultipleProjects && !allFilesHaveProjects) ||
|
|
666
|
+
uploadItems.some((i) => paroDocuments &&
|
|
667
|
+
i.docType === "EO Insurance" &&
|
|
668
|
+
(!i.expiryDate || !!i.dateError) &&
|
|
669
|
+
i.status !== "success"), color: "primary", isLoading: isUploading }))))))))));
|
|
670
|
+
};
|
|
671
|
+
exports.MultiFileUploadSection = MultiFileUploadSection;
|
|
672
|
+
exports.default = exports.MultiFileUploadSection;
|