subcontrcator: post a status update section- removed photo required option
This commit is contained in:
+14
-4
@@ -6280,9 +6280,9 @@ export const MockStoreProvider = ({ children }) => {
|
||||
|
||||
const addSubcontractorTaskActivity = (taskId, { note, photos = [] }, actor) => {
|
||||
const trimmed = note?.trim() || '';
|
||||
if (!trimmed || !photos.length) return;
|
||||
if (!trimmed) return;
|
||||
const now = new Date().toISOString();
|
||||
const normalizedPhotos = photos.map((p, i) => ({
|
||||
const normalizedPhotos = (photos || []).map((p, i) => ({
|
||||
id: p.id || `${Date.now()}_${i}_${Math.random().toString(36).slice(2, 7)}`,
|
||||
url: p.url,
|
||||
name: p.name || '',
|
||||
@@ -6298,7 +6298,7 @@ export const MockStoreProvider = ({ children }) => {
|
||||
companyName = t.companyName;
|
||||
assignedByUserId = t.assignedBy;
|
||||
subId = t.subcontractorId;
|
||||
const entry = {
|
||||
const activityEntry = {
|
||||
id: `a_${Date.now()}`,
|
||||
type: 'progress_update',
|
||||
status: t.status,
|
||||
@@ -6309,9 +6309,19 @@ export const MockStoreProvider = ({ children }) => {
|
||||
actorRole: actor?.role || 'Subcontractor',
|
||||
at: now,
|
||||
};
|
||||
const historyEntry = {
|
||||
id: `h_${Date.now()}`,
|
||||
status: t.status,
|
||||
actorId: actor?.id || t.subcontractorId,
|
||||
actorName: actor?.name || t.subcontractorName,
|
||||
comment: trimmed,
|
||||
at: now,
|
||||
isProgressUpdate: true,
|
||||
};
|
||||
return {
|
||||
...t,
|
||||
activities: [...(t.activities || []), entry],
|
||||
activities: [...(t.activities || []), activityEntry],
|
||||
statusHistory: [...(t.statusHistory || []), historyEntry],
|
||||
updatedAt: now,
|
||||
};
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user