@paro.io/expert-shared-components 1.12.21 → 1.12.23
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.
|
@@ -184,9 +184,9 @@ const DecisionSection = ({ dispute, onUpdateDispute, updateInvoiceMutation, upda
|
|
|
184
184
|
react_1.default.createElement("div", { className: "text-xs text-gray-500" }, project.disputeType === 'Hourly'
|
|
185
185
|
? `Disputed Hours: ${project.disputeHours}`
|
|
186
186
|
: `Dispute Amount: $${((_a = project.disputeAmount) === null || _a === void 0 ? void 0 : _a.toFixed(2)) || '0.00'}`)),
|
|
187
|
-
react_1.default.createElement("div", { className: "w-32" }, project.disputeType === 'Hourly' ? (react_1.default.createElement("input", { type: "number", step: "
|
|
187
|
+
react_1.default.createElement("div", { className: "w-32" }, project.disputeType === 'Hourly' ? (react_1.default.createElement("input", { type: "number", step: "1", min: "0", max: project.disputeHours, value: projectApprovedHours[project.projectId] || '', onChange: (e) => handleProjectHoursChange(project.projectId, parseFloat(e.target.value) || 0), className: "w-full px-2 py-1 border border-[#CCCCCC] rounded text-sm focus:outline-none focus:ring-2 focus:ring-[#248384]", placeholder: "Hours" })) : (react_1.default.createElement("div", { className: "relative" },
|
|
188
188
|
react_1.default.createElement("span", { className: "absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-500" }, "$"),
|
|
189
|
-
react_1.default.createElement("input", { type: "number", step: "
|
|
189
|
+
react_1.default.createElement("input", { type: "number", step: "1", min: "0", max: project.disputeAmount, value: projectApprovedHours[project.projectId] || '', onChange: (e) => handleProjectHoursChange(project.projectId, parseFloat(e.target.value) || 0), className: "w-full pl-2 pr-2 py-1 border border-[#CCCCCC] rounded text-sm focus:outline-none focus:ring-2 focus:ring-[#248384]", placeholder: "0.00" }))))));
|
|
190
190
|
})),
|
|
191
191
|
react_1.default.createElement("div", { className: "text-sm text-gray-600" }, dispute.disputeProjects.some((p) => p.disputeType === 'Hourly') &&
|
|
192
192
|
dispute.disputeProjects.some((p) => p.disputeType !== 'Hourly') ? (
|
|
@@ -10,35 +10,38 @@ const InvoiceHeader = ({ invoice, isInternal = false, isClient = false }) => {
|
|
|
10
10
|
var _a, _b, _c, _d, _e, _f;
|
|
11
11
|
const disputeAmount = (_a = invoice === null || invoice === void 0 ? void 0 : invoice.disputeProjects) === null || _a === void 0 ? void 0 : _a.reduce((acc, project) => acc + (project === null || project === void 0 ? void 0 : project.disputeAmount), 0);
|
|
12
12
|
return (react_1.default.createElement("div", { className: "bg-[#0F172A] w-full text-white px-6 py-4 rounded-t-lg flex items-center justify-between font-arial" },
|
|
13
|
-
react_1.default.createElement("div", { className: "flex items-center space-x-
|
|
13
|
+
react_1.default.createElement("div", { className: "flex items-center space-x-4 overflow-x-auto" },
|
|
14
|
+
react_1.default.createElement("div", { className: "flex-shrink-0" },
|
|
15
|
+
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Dispute #:"),
|
|
16
|
+
react_1.default.createElement("span", { className: "ml-1" }, invoice === null || invoice === void 0 ? void 0 : invoice.disputeId)),
|
|
17
|
+
react_1.default.createElement("div", { className: "flex-shrink-0" },
|
|
18
|
+
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Invoice #:"),
|
|
19
|
+
react_1.default.createElement("span", { className: "ml-1" }, (_b = invoice === null || invoice === void 0 ? void 0 : invoice.invoice) === null || _b === void 0 ? void 0 : _b.id)),
|
|
20
|
+
!isClient && (react_1.default.createElement("div", { className: "flex-shrink-0" },
|
|
21
|
+
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Client:"),
|
|
22
|
+
react_1.default.createElement("span", { className: "ml-1" }, (_c = invoice === null || invoice === void 0 ? void 0 : invoice.client) === null || _c === void 0 ? void 0 : _c.name))),
|
|
14
23
|
react_1.default.createElement("div", null,
|
|
15
|
-
react_1.default.createElement("span", { className: "text-sm font-bold" }, "
|
|
16
|
-
react_1.default.createElement("span", { className: "ml-
|
|
17
|
-
!isClient && (react_1.default.createElement("div", null,
|
|
18
|
-
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Client: "),
|
|
19
|
-
react_1.default.createElement("span", { className: "ml-2" }, (_c = invoice === null || invoice === void 0 ? void 0 : invoice.client) === null || _c === void 0 ? void 0 : _c.name))),
|
|
20
|
-
react_1.default.createElement("div", null,
|
|
21
|
-
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Amount: "),
|
|
22
|
-
react_1.default.createElement("span", { className: "ml-2" },
|
|
24
|
+
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Amount:"),
|
|
25
|
+
react_1.default.createElement("span", { className: "ml-1" },
|
|
23
26
|
"$",
|
|
24
27
|
disputeAmount)),
|
|
25
28
|
react_1.default.createElement("div", null,
|
|
26
|
-
react_1.default.createElement("span", { className: "text-sm font-bold" }, "
|
|
27
|
-
react_1.default.createElement("span", { className: "ml-
|
|
29
|
+
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Date:"),
|
|
30
|
+
react_1.default.createElement("span", { className: "ml-1" }, (0, dayjs_1.default)(invoice === null || invoice === void 0 ? void 0 : invoice.disputeDate).format('MMM D, YYYY'))),
|
|
28
31
|
react_1.default.createElement("div", null,
|
|
29
|
-
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Invoice Date:
|
|
30
|
-
react_1.default.createElement("span", { className: "ml-
|
|
32
|
+
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Invoice Date:"),
|
|
33
|
+
react_1.default.createElement("span", { className: "ml-1" }, (0, dayjs_1.default)((_d = invoice === null || invoice === void 0 ? void 0 : invoice.invoice) === null || _d === void 0 ? void 0 : _d.dateGenerated).format('MMM D, YYYY'))),
|
|
31
34
|
react_1.default.createElement("div", null,
|
|
32
|
-
react_1.default.createElement("span", { className: "text-sm font-bold" }, "
|
|
33
|
-
react_1.default.createElement("span", { className: "ml-
|
|
35
|
+
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Status:"),
|
|
36
|
+
react_1.default.createElement("span", { className: "ml-1" }, (invoice === null || invoice === void 0 ? void 0 : invoice.status) === "InProgress" ? "In Progress" : invoice === null || invoice === void 0 ? void 0 : invoice.status)),
|
|
34
37
|
(invoice === null || invoice === void 0 ? void 0 : invoice.approvedAmount) >= 0 && (invoice === null || invoice === void 0 ? void 0 : invoice.status) === 'Resolved' && (react_1.default.createElement("div", null,
|
|
35
|
-
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Approved Amount:
|
|
36
|
-
react_1.default.createElement("span", { className: "ml-
|
|
38
|
+
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Approved Amount:"),
|
|
39
|
+
react_1.default.createElement("span", { className: "ml-1" },
|
|
37
40
|
"$", invoice === null || invoice === void 0 ? void 0 :
|
|
38
41
|
invoice.approvedAmount))),
|
|
39
42
|
!isInternal && (react_1.default.createElement("div", null,
|
|
40
43
|
react_1.default.createElement("span", { className: "text-sm font-bold" }, "Expert Name: "),
|
|
41
|
-
react_1.default.createElement("span", { className: "ml-
|
|
44
|
+
react_1.default.createElement("span", { className: "ml-1" }, (_e = invoice === null || invoice === void 0 ? void 0 : invoice.freelancer) === null || _e === void 0 ? void 0 :
|
|
42
45
|
_e.firstName,
|
|
43
46
|
" ", (_f = invoice === null || invoice === void 0 ? void 0 : invoice.freelancer) === null || _f === void 0 ? void 0 :
|
|
44
47
|
_f.lastName))))));
|
|
@@ -69,12 +69,9 @@ const ProjectHoursAdjustmentModal = ({ isOpen, onClose, disputeProjects, dispute
|
|
|
69
69
|
setLoading(true);
|
|
70
70
|
try {
|
|
71
71
|
if ((_a = invoiceSummary === null || invoiceSummary === void 0 ? void 0 : invoiceSummary.getClientInvoiceSummaryByMonth) === null || _a === void 0 ? void 0 : _a.projects) {
|
|
72
|
-
// Group tasks by project based on disputeProjects
|
|
73
72
|
const projectSectionsData = [];
|
|
74
73
|
disputeProjects.forEach(disputeProject => {
|
|
75
|
-
// Find matching project in invoice summary
|
|
76
74
|
const invoiceProject = invoiceSummary.getClientInvoiceSummaryByMonth.projects.find((proj) => {
|
|
77
|
-
// Match by project name since we don't have direct projectId mapping
|
|
78
75
|
return proj.projectName === disputeProject.project.name;
|
|
79
76
|
});
|
|
80
77
|
if (invoiceProject) {
|
|
@@ -90,14 +87,23 @@ const ProjectHoursAdjustmentModal = ({ isOpen, onClose, disputeProjects, dispute
|
|
|
90
87
|
}
|
|
91
88
|
});
|
|
92
89
|
setProjectSections(projectSectionsData);
|
|
93
|
-
// Initialize adjusted hours for all tasks
|
|
94
90
|
const initialAdjustedHours = {};
|
|
95
91
|
projectSectionsData.forEach(section => {
|
|
96
92
|
section.tasks.forEach(task => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
if (section.disputeType !== 'Hourly') {
|
|
94
|
+
initialAdjustedHours[`${section.projectId}-${task.projectHourId}`] = {
|
|
95
|
+
originalAmount: parseFloat((task.hours * task.rate).toFixed(2)),
|
|
96
|
+
newAmount: parseFloat((task.hours * task.rate).toFixed(2)),
|
|
97
|
+
originalHours: parseFloat(task.hours.toFixed(2)),
|
|
98
|
+
newHours: parseFloat(task.hours.toFixed(2))
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
initialAdjustedHours[`${section.projectId}-${task.projectHourId}`] = {
|
|
103
|
+
originalHours: parseFloat(task.hours.toFixed(2)),
|
|
104
|
+
newHours: parseFloat(task.hours.toFixed(2))
|
|
105
|
+
};
|
|
106
|
+
}
|
|
101
107
|
});
|
|
102
108
|
});
|
|
103
109
|
setAdjustedHours(initialAdjustedHours);
|
|
@@ -118,9 +124,7 @@ const ProjectHoursAdjustmentModal = ({ isOpen, onClose, disputeProjects, dispute
|
|
|
118
124
|
const numericValue = parseFloat(newHours);
|
|
119
125
|
const originalHours = ((_a = adjustedHours[projectHourId]) === null || _a === void 0 ? void 0 : _a.originalHours) || 0;
|
|
120
126
|
setAdjustedHours(prev => (Object.assign(Object.assign({}, prev), { [projectHourId]: Object.assign(Object.assign({}, prev[projectHourId]), { newHours: numericValue }) })));
|
|
121
|
-
// Clear individual hour error
|
|
122
127
|
setErrors(prev => (Object.assign(Object.assign({}, prev), { [projectHourId]: '' })));
|
|
123
|
-
// Validate individual hour
|
|
124
128
|
if (numericValue > originalHours) {
|
|
125
129
|
setErrors(prev => (Object.assign(Object.assign({}, prev), { [projectHourId]: 'New hours cannot exceed original hours' })));
|
|
126
130
|
}
|
|
@@ -128,15 +132,28 @@ const ProjectHoursAdjustmentModal = ({ isOpen, onClose, disputeProjects, dispute
|
|
|
128
132
|
setErrors(prev => (Object.assign(Object.assign({}, prev), { [projectHourId]: 'Hours cannot be negative' })));
|
|
129
133
|
}
|
|
130
134
|
};
|
|
135
|
+
const handleAmountChange = (projectHourId, newAmount) => {
|
|
136
|
+
var _a;
|
|
137
|
+
const numericValue = parseFloat(newAmount);
|
|
138
|
+
const originalAmount = ((_a = adjustedHours[projectHourId]) === null || _a === void 0 ? void 0 : _a.originalAmount) || 0;
|
|
139
|
+
setAdjustedHours(prev => (Object.assign(Object.assign({}, prev), { [projectHourId]: Object.assign(Object.assign({}, prev[projectHourId]), { newAmount: numericValue }) })));
|
|
140
|
+
setErrors(prev => (Object.assign(Object.assign({}, prev), { [projectHourId]: '' })));
|
|
141
|
+
if (numericValue > originalAmount) {
|
|
142
|
+
setErrors(prev => (Object.assign(Object.assign({}, prev), { [projectHourId]: 'New Dispute Amount cannot exceed original Amount' })));
|
|
143
|
+
}
|
|
144
|
+
else if (numericValue < 0) {
|
|
145
|
+
setErrors(prev => (Object.assign(Object.assign({}, prev), { [projectHourId]: 'Dispute Amount cannot be negative' })));
|
|
146
|
+
}
|
|
147
|
+
};
|
|
131
148
|
const getProjectTotalHours = (projectId, type) => {
|
|
132
149
|
const section = projectSections.find(s => s.projectId === projectId);
|
|
133
150
|
if (!section)
|
|
134
151
|
return 0;
|
|
135
152
|
return section.tasks.reduce((total, task) => {
|
|
136
|
-
const adjustment = adjustedHours[task.projectHourId];
|
|
137
|
-
if (!adjustment
|
|
153
|
+
const adjustment = adjustedHours[`${projectId}-${task.projectHourId}`];
|
|
154
|
+
if (!adjustment)
|
|
138
155
|
return total;
|
|
139
|
-
return total + (type === 'original' ? adjustment.originalHours : adjustment.newHours);
|
|
156
|
+
return total + (type === 'original' ? adjustment.originalHours || 0 : adjustment.newHours || 0);
|
|
140
157
|
}, 0);
|
|
141
158
|
};
|
|
142
159
|
const getProjectTotalAmount = (projectId, type) => {
|
|
@@ -144,11 +161,11 @@ const ProjectHoursAdjustmentModal = ({ isOpen, onClose, disputeProjects, dispute
|
|
|
144
161
|
if (!section)
|
|
145
162
|
return 0;
|
|
146
163
|
return section.tasks.reduce((total, task) => {
|
|
147
|
-
const adjustment = adjustedHours[task.projectHourId];
|
|
164
|
+
const adjustment = adjustedHours[`${projectId}-${task.projectHourId}`];
|
|
148
165
|
if (!adjustment)
|
|
149
166
|
return total;
|
|
150
|
-
const
|
|
151
|
-
return total +
|
|
167
|
+
const newAmount = type === 'original' ? adjustment.originalAmount || 0 : adjustment.newAmount || 0;
|
|
168
|
+
return total + newAmount; // Calculate amount based on hours * rate
|
|
152
169
|
}, 0);
|
|
153
170
|
};
|
|
154
171
|
const getProjectReduction = (projectId) => {
|
|
@@ -167,32 +184,38 @@ const ProjectHoursAdjustmentModal = ({ isOpen, onClose, disputeProjects, dispute
|
|
|
167
184
|
let hasErrors = false;
|
|
168
185
|
const newErrors = {};
|
|
169
186
|
const newProjectErrors = {};
|
|
170
|
-
// Validate each project section
|
|
171
187
|
projectSections.forEach(section => {
|
|
172
188
|
const projectId = section.projectId;
|
|
173
|
-
const disputeHours = section.disputeHours;
|
|
174
|
-
// Use project-specific approved hours if available, otherwise use dispute hours
|
|
175
189
|
const maxAllowedReduction = projectApprovedHours[projectId] !== undefined
|
|
176
190
|
? projectApprovedHours[projectId]
|
|
177
191
|
: section.disputeType === 'Hourly'
|
|
178
192
|
? section.disputeHours
|
|
179
193
|
: section.disputeAmount;
|
|
180
|
-
// Validate individual hours within this project
|
|
181
194
|
section.tasks.forEach(task => {
|
|
182
|
-
var _a, _b;
|
|
195
|
+
var _a, _b, _c, _d;
|
|
183
196
|
const projectHourId = task.projectHourId;
|
|
184
|
-
const
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
197
|
+
const key = `${projectId}-${projectHourId}`;
|
|
198
|
+
const originalHours = ((_a = adjustedHours[key]) === null || _a === void 0 ? void 0 : _a.originalHours) || 0;
|
|
199
|
+
const newHours = (_b = adjustedHours[key]) === null || _b === void 0 ? void 0 : _b.newHours;
|
|
200
|
+
const newAmount = (_c = adjustedHours[key]) === null || _c === void 0 ? void 0 : _c.newAmount;
|
|
201
|
+
const originalAmount = ((_d = adjustedHours[key]) === null || _d === void 0 ? void 0 : _d.originalAmount) || 0;
|
|
202
|
+
if (newHours && newHours > originalHours) {
|
|
203
|
+
newErrors[key] = 'New hours cannot exceed original hours';
|
|
204
|
+
hasErrors = true;
|
|
205
|
+
}
|
|
206
|
+
else if (newHours && newHours < 0) {
|
|
207
|
+
newErrors[key] = 'Hours cannot be negative';
|
|
208
|
+
hasErrors = true;
|
|
209
|
+
}
|
|
210
|
+
else if (newAmount && newAmount < 0) {
|
|
211
|
+
newErrors[key] = 'Dispute Amount cannot be negative';
|
|
188
212
|
hasErrors = true;
|
|
189
213
|
}
|
|
190
|
-
else if (
|
|
191
|
-
newErrors[
|
|
214
|
+
else if (newAmount && newAmount > originalAmount) {
|
|
215
|
+
newErrors[key] = 'New Dispute Amount cannot exceed original Amount';
|
|
192
216
|
hasErrors = true;
|
|
193
217
|
}
|
|
194
218
|
});
|
|
195
|
-
// Validate project-level hour reduction
|
|
196
219
|
const projectReduction = getProjectReduction(projectId);
|
|
197
220
|
if (Math.abs(projectReduction - maxAllowedReduction) > 0.01) {
|
|
198
221
|
const reductionType = projectApprovedHours[projectId] !== undefined ? 'approved' : 'disputed';
|
|
@@ -204,44 +227,35 @@ const ProjectHoursAdjustmentModal = ({ isOpen, onClose, disputeProjects, dispute
|
|
|
204
227
|
setErrors(newErrors);
|
|
205
228
|
setProjectErrors(newProjectErrors);
|
|
206
229
|
if (!hasErrors) {
|
|
207
|
-
// Generate the submission data in the required format
|
|
208
230
|
let freelancerRate = 0;
|
|
209
231
|
const inputArray = [];
|
|
210
232
|
projectSections.forEach(section => {
|
|
211
233
|
section.tasks.forEach(task => {
|
|
212
234
|
const projectHourId = task.projectHourId;
|
|
213
|
-
const
|
|
235
|
+
const key = `${section.projectId}-${projectHourId}`;
|
|
236
|
+
const adjustedHour = adjustedHours[key];
|
|
237
|
+
const newHours = adjustedHour === null || adjustedHour === void 0 ? void 0 : adjustedHour.newHours;
|
|
214
238
|
freelancerRate = task.freelancerRate;
|
|
215
|
-
|
|
216
|
-
let calculatedHours = (adjustedHour === null || adjustedHour === void 0 ? void 0 : adjustedHour.newHours) || 0;
|
|
239
|
+
let calculatedHours = newHours || 0;
|
|
217
240
|
if (section.disputeType !== 'Hourly') {
|
|
218
|
-
// For non-hourly projects, calculate hour equivalent based on approved dispute amount ratio
|
|
219
241
|
const approvedDisputeAmount = projectApprovedHours[section.projectId] !== undefined
|
|
220
242
|
? projectApprovedHours[section.projectId]
|
|
221
243
|
: section.disputeAmount;
|
|
222
244
|
const totalProjectAmount = section.totalProjectAmount;
|
|
223
245
|
if (totalProjectAmount > 0) {
|
|
224
|
-
// Calculate the ratio of approved dispute amount to total project amount
|
|
225
246
|
const disputeRatio = approvedDisputeAmount / totalProjectAmount;
|
|
226
|
-
// Apply this ratio to the original hours for this task
|
|
227
247
|
const originalTaskHours = (adjustedHour === null || adjustedHour === void 0 ? void 0 : adjustedHour.originalHours) || 0;
|
|
228
|
-
// The reduction in hours should be proportional to the dispute ratio
|
|
229
248
|
const hourReduction = originalTaskHours * disputeRatio;
|
|
230
249
|
calculatedHours = originalTaskHours - hourReduction;
|
|
231
|
-
|
|
232
|
-
calculatedHours = Math.max(0, calculatedHours);
|
|
250
|
+
calculatedHours = Number(Math.max(0, calculatedHours).toFixed(4));
|
|
233
251
|
}
|
|
234
252
|
}
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
`${dispute.freelancer.firstName} ${dispute.freelancer.lastName}` : '';
|
|
238
|
-
// Generate internal user name
|
|
239
|
-
const internalUser = user ?
|
|
240
|
-
`${user.firstName} ${user.lastName}` : '';
|
|
253
|
+
const expertName = (dispute === null || dispute === void 0 ? void 0 : dispute.freelancer) ? `${dispute.freelancer.firstName} ${dispute.freelancer.lastName}` : '';
|
|
254
|
+
const internalUser = user ? `${user.firstName} ${user.lastName}` : '';
|
|
241
255
|
inputArray.push({
|
|
242
256
|
clientRate: task.rate,
|
|
243
257
|
freelancerRate: task.freelancerRate,
|
|
244
|
-
hours:
|
|
258
|
+
hours: calculatedHours,
|
|
245
259
|
projectId: section.projectId,
|
|
246
260
|
projectHourId: task.projectHourId,
|
|
247
261
|
projectName: section.projectName,
|
|
@@ -359,26 +373,24 @@ const ProjectHoursAdjustmentModal = ({ isOpen, onClose, disputeProjects, dispute
|
|
|
359
373
|
react_1.default.createElement("th", { className: "border border-gray-300 px-4 py-2 text-left" }, section.disputeType === 'Hourly' ? 'Original Hours' : 'Original Dispute $'),
|
|
360
374
|
react_1.default.createElement("th", { className: "border border-gray-300 px-4 py-2 text-left" }, section.disputeType === 'Hourly' ? 'Adjusted Hours' : 'Adjusted $ Amount'))),
|
|
361
375
|
react_1.default.createElement("tbody", null, section.tasks.map((task) => {
|
|
362
|
-
var _a, _b;
|
|
376
|
+
var _a, _b, _c;
|
|
363
377
|
const projectHourId = task.projectHourId;
|
|
364
378
|
const originalHours = task.hours;
|
|
365
379
|
const originalAmount = task.hours * task.rate;
|
|
366
|
-
const newHours = (_a = adjustedHours[projectHourId]) === null || _a === void 0 ? void 0 : _a.newHours;
|
|
367
|
-
const newAmount =
|
|
368
|
-
const hasError = errors[projectHourId];
|
|
369
|
-
return (react_1.default.createElement("tr", { key: projectHourId
|
|
380
|
+
const newHours = (_a = adjustedHours[`${section.projectId}-${projectHourId}`]) === null || _a === void 0 ? void 0 : _a.newHours;
|
|
381
|
+
const newAmount = (_b = adjustedHours[`${section.projectId}-${projectHourId}`]) === null || _b === void 0 ? void 0 : _b.newAmount;
|
|
382
|
+
const hasError = errors[`${section.projectId}-${projectHourId}`];
|
|
383
|
+
return (react_1.default.createElement("tr", { key: `${section.projectId}-${projectHourId}`, className: hasError ? 'bg-red-50' : '' },
|
|
370
384
|
react_1.default.createElement("td", { className: "border border-gray-300 px-4 py-2" }, formatDate(task.date)),
|
|
371
385
|
react_1.default.createElement("td", { className: "border border-gray-300 px-4 py-2" }, task.description),
|
|
372
386
|
react_1.default.createElement("td", { className: "border border-gray-300 px-4 py-2" }, section.disputeType === 'Hourly'
|
|
373
387
|
? originalHours.toFixed(2)
|
|
374
|
-
: `$${((
|
|
388
|
+
: `$${((_c = section.disputeAmount) === null || _c === void 0 ? void 0 : _c.toFixed(2)) || '0.00'}`),
|
|
375
389
|
react_1.default.createElement("td", { className: "border border-gray-300 px-4 py-2" },
|
|
376
390
|
react_1.default.createElement("div", null,
|
|
377
|
-
section.disputeType === 'Hourly' ? (react_1.default.createElement("input", { type: "number", step: "
|
|
391
|
+
section.disputeType === 'Hourly' ? (react_1.default.createElement("input", { type: "number", step: "1", max: originalHours, value: newHours !== undefined && newHours >= 0 ? newHours : '', onChange: (e) => handleHourChange(`${section.projectId}-${task.projectHourId}`, e.target.value), className: `w-full px-2 py-1 border rounded focus:outline-none focus:ring-2 focus:ring-blue-500 ${hasError ? 'border-red-500' : 'border-gray-300'}` })) : (react_1.default.createElement("div", { className: "flex items-center" },
|
|
378
392
|
react_1.default.createElement("span", { className: "mr-1" }, "$"),
|
|
379
|
-
react_1.default.createElement("input", { type: "number", step: "
|
|
380
|
-
react_1.default.createElement("span", { className: "ml-2" }, newHours.toFixed(2)),
|
|
381
|
-
react_1.default.createElement("span", { className: "ml-1 text-xs text-gray-500" }, "hrs"))),
|
|
393
|
+
react_1.default.createElement("input", { type: "number", step: "1", min: "0", max: originalAmount, value: newAmount !== undefined && newAmount >= 0 ? newAmount : '', onChange: (e) => handleAmountChange(`${section.projectId}-${task.projectHourId}`, (e.target.value).toString()), className: `w-32 px-2 py-1 border rounded focus:outline-none focus:ring-2 focus:ring-blue-500 ${hasError ? 'border-red-500' : 'border-gray-300'}`, placeholder: "$0.00" }))),
|
|
382
394
|
hasError && (react_1.default.createElement("div", { className: "text-red-500 text-xs mt-1" }, hasError))))));
|
|
383
395
|
}))))));
|
|
384
396
|
})),
|