diff --git a/dataconnect/connector/activityLog/mutations.gql b/dataconnect/connector/activityLog/mutations.gql index c4e03c3c..85e6f795 100644 --- a/dataconnect/connector/activityLog/mutations.gql +++ b/dataconnect/connector/activityLog/mutations.gql @@ -3,7 +3,9 @@ mutation CreateActivityLog( $description: String!, $activityType: ActivityType!, $userId: String!, - $isRead: Boolean + $isRead: Boolean, + $iconType: String, + $iconColor: String ) @auth(level: USER) { activityLog_insert( data: { @@ -12,6 +14,8 @@ mutation CreateActivityLog( activityType: $activityType userId: $userId isRead: $isRead + iconType: $iconType + iconColor: $iconColor } ) } @@ -22,7 +26,9 @@ mutation UpdateActivityLog( $description: String, $activityType: ActivityType, $userId: String, - $isRead: Boolean + $isRead: Boolean, + $iconType: String, + $iconColor: String ) @auth(level: USER) { activityLog_update( id: $id, @@ -32,6 +38,8 @@ mutation UpdateActivityLog( activityType: $activityType userId: $userId isRead: $isRead + iconType: $iconType + iconColor: $iconColor } ) } diff --git a/dataconnect/connector/activityLog/queries.gql b/dataconnect/connector/activityLog/queries.gql index 24ed5458..d48bb119 100644 --- a/dataconnect/connector/activityLog/queries.gql +++ b/dataconnect/connector/activityLog/queries.gql @@ -6,6 +6,8 @@ query listActivityLog @auth(level: USER) { activityType userId isRead + iconType + iconColor } } @@ -19,6 +21,8 @@ query getActivityLogById( activityType userId isRead + iconType + iconColor } } @@ -40,5 +44,7 @@ query filterActivityLog( activityType userId isRead + iconType + iconColor } } diff --git a/dataconnect/connector/event/queries.gql b/dataconnect/connector/event/queries.gql index 0ff1c579..98f1b392 100644 --- a/dataconnect/connector/event/queries.gql +++ b/dataconnect/connector/event/queries.gql @@ -1,9 +1,13 @@ query listEvents ( $orderByDate: OrderDirection + $orderByCreatedDate: OrderDirection, $limit: Int ) @auth(level: USER) { events( - orderBy: { date: $orderByDate } + orderBy: [ + { date: $orderByDate } + { createdDate: $orderByCreatedDate } + ] limit: $limit ) { id @@ -101,20 +105,21 @@ query filterEvents( $contractType: ContractType, $clientEmail: String ) @auth(level: USER) { - events(where: { - status: { eq: $status } - businessId: { eq: $businessId } - vendorId: { eq: $vendorId } - isRecurring: { eq: $isRecurring } - isRapid: { eq: $isRapid } - isMultiDay: { eq: $isMultiDay } - recurrenceType: { eq: $recurrenceType } - date: { eq: $date } - hub: { eq: $hub } - eventLocation: { eq: $eventLocation } - contractType: { eq: $contractType } - clientEmail: { eq: $clientEmail } - }) { + events( + where: { + status: { eq: $status } + businessId: { eq: $businessId } + vendorId: { eq: $vendorId } + isRecurring: { eq: $isRecurring } + isRapid: { eq: $isRapid } + isMultiDay: { eq: $isMultiDay } + recurrenceType: { eq: $recurrenceType } + date: { eq: $date } + hub: { eq: $hub } + eventLocation: { eq: $eventLocation } + contractType: { eq: $contractType } + clientEmail: { eq: $clientEmail } + }) { id eventName status diff --git a/dataconnect/schema/activityLog.gql b/dataconnect/schema/activityLog.gql index db3564e6..985fa8af 100644 --- a/dataconnect/schema/activityLog.gql +++ b/dataconnect/schema/activityLog.gql @@ -15,7 +15,9 @@ type ActivityLog @table(name: "activity_logs") { activityType: ActivityType! userId: String! # user_id (FK lógica a User.id) isRead: Boolean @default(expr: "false") + iconType: String + iconColor: String createdDate: Timestamp @default(expr: "request.time") updatedDate: Timestamp @default(expr: "request.time") createdBy: String @default(expr: "auth.uid") -} +} \ No newline at end of file diff --git a/dataconnect/schema/event.gql b/dataconnect/schema/event.gql index 3e874d8d..cad6f68f 100644 --- a/dataconnect/schema/event.gql +++ b/dataconnect/schema/event.gql @@ -7,6 +7,10 @@ enum EventStatus { CONFIRMED COMPLETED CANCELED + PARTIAL + PARTIAL_STAFFED + FULLY_STAFFED + EVENT_CREATED } enum RecurrenceType { diff --git a/frontend-web-free/src/api/krowSDK.js b/frontend-web-free/src/api/krowSDK.js index 67a32446..1d9d0cf6 100644 --- a/frontend-web-free/src/api/krowSDK.js +++ b/frontend-web-free/src/api/krowSDK.js @@ -312,19 +312,39 @@ const dataconnectEntityConfig = { }, Sector:{ - + list: 'listSector', + get: 'getSectorById', + create: 'createSector', + update: 'updateSector', + delete: 'deleteSector', + filter: 'filterSector' }, Partner:{ - + list: 'listPartner', + get: 'getPartnerById', + create: 'createPartner', + update: 'updatePartner', + delete: 'deletePartner', + filter: 'filterPartner' }, Order:{ - + list: 'listOrder', + get: 'getOrderById', + create: 'createOrder', + update: 'updateOrder', + delete: 'deleteOrder', + filter: 'filterOrder' }, Shift:{ - + list: 'listShift', + get: 'getShiftById', + create: 'createShift', + update: 'updateShift', + delete: 'deleteShift', + filter: 'filterShift' } }; @@ -405,7 +425,7 @@ Object.entries(dataconnectEntityConfig).forEach(([entityName, ops]) => { // list ...(ops.list && { list: async (...args) => { - const fn = dcSdk[ops.list]; + /*const fn = dcSdk[ops.list]; if (typeof fn !== 'function') { throw new Error( `Data Connect operation "${ops.list}" not found for entity "${entityName}".` @@ -446,10 +466,8 @@ Object.entries(dataconnectEntityConfig).forEach(([entityName, ops]) => { } } - // COMMENT FIX: variables que realmente se mandan a DataConnect let variables = baseVariables; - // COMMENT FIX: caso especial para Team, que SÍ tiene orderBy/limit en el query if (entityName === "Team") { variables = variables || {}; if (sort) { @@ -464,7 +482,7 @@ Object.entries(dataconnectEntityConfig).forEach(([entityName, ops]) => { const res = await fn(dataConnect, variables); let items = normalizeResultToArray(res); - // COMMENT FIX: para entidades que NO tienen orderBy/limit en el query, + // para entidades que NO tienen orderBy/limit en el query, // aplicamos sort/limit en el front como fallback. if (entityName !== "Team" && sort) { const desc = sort.startsWith("-"); @@ -495,7 +513,83 @@ Object.entries(dataconnectEntityConfig).forEach(([entityName, ops]) => { } //console.log(items) //return items; + */ + const fn = dcSdk[ops.list]; + if (typeof fn !== 'function') { + throw new Error( + `Data Connect operation "${ops.list}" not found for entity "${entityName}".` + ); + } + try { + // --- Lógica de parseo de argumentos (se mantiene para compatibilidad) --- + let sort; + let limit; + let baseVariables; + + if (args.length === 1) { + const [a0] = args; + if (typeof a0 === "string") sort = a0; + else if (a0 && typeof a0 === "object") baseVariables = a0; + } else if (args.length === 2) { + const [a0, a1] = args; + if (typeof a0 === "string" && typeof a1 === "number") { + sort = a0; + limit = a1; + } else if (a0 && typeof a0 === "object") { + baseVariables = a0; + if (typeof a1 === "string") sort = a1; + } + } else if (args.length >= 3) { + const [a0, a1, a2] = args; + if (a0 && typeof a0 === "object") { + baseVariables = a0; + if (typeof a1 === "string") sort = a1; + if (typeof a2 === "number") limit = a2; + } + } + + // --- FIX: Se llama al backend SIN parámetros de orden/límite --- + // Se asume que la mayoría de queries 'list' no aceptan variables, solo se pasan si existen. + + //const res = await fn(dataConnect, baseVariables); + const res = await fn(dataConnect, baseVariables); + + let items = normalizeResultToArray(res); + + // --- FIX: SE RESTAURA el ordenamiento y límite en el CLIENTE --- + // Esto es necesario hasta que el backend pueda manejar estos parámetros. + if (sort) { + const isDesc = sort.startsWith("-"); + const field = isDesc ? sort.slice(1) : sort; + + items = items.slice().sort((a, b) => { + const av = a?.[field]; + const bv = b?.[field]; + + if (av == null && bv == null) return 0; + if (av == null) return 1; + if (bv == null) return -1; + + const da = new Date(av); + const db = new Date(bv); + if (!isNaN(da) && !isNaN(db)) { + return isDesc ? db - da : da - db; + } + + if (av < bv) return isDesc ? 1 : -1; + if (av > bv) return isDesc ? -1 : 1; + return 0; + }); + } + + if (typeof limit === "number") { + items = items.slice(0, limit); + } return items.map(toSnake); + } catch (err) { + console.error('list staff failed', err); + throw err; + } }, }), diff --git a/frontend-web-free/src/components/events/EventForm.jsx b/frontend-web-free/src/components/events/EventForm.jsx index 2b5c4348..f018b68a 100644 --- a/frontend-web-free/src/components/events/EventForm.jsx +++ b/frontend-web-free/src/components/events/EventForm.jsx @@ -312,17 +312,17 @@ export default function EventForm({ event, onSubmit, isSubmitting, currentUser } e.preventDefault(); let status; if (isDraft) { - status = "Draft"; + status = "DRAFT"; } else { switch (formData.order_type) { case "rapid": - status = "Active"; // Rapid requests are active immediately upon submission + status = "ACTIVE"; // Rapid requests are active immediately upon submission break; case "one_time": case "recurring": case "permanent": default: // In case of an unexpected order_type, default to Pending - status = "Pending"; // These types typically need approval/processing + status = "PENDING"; // These types typically need approval/processing break; } } diff --git a/frontend-web-free/src/components/events/EventFormWizard.jsx b/frontend-web-free/src/components/events/EventFormWizard.jsx index 72b48f1a..ab93f5e6 100644 --- a/frontend-web-free/src/components/events/EventFormWizard.jsx +++ b/frontend-web-free/src/components/events/EventFormWizard.jsx @@ -543,8 +543,8 @@ export default function EventFormWizard({ event, onSubmit, onRapidSubmit, isSubm }; const handleSubmit = (isDraft = false) => { - const status = isDraft ? "Draft" : - formData.order_type === "rapid" ? "Active" : "Pending"; + const status = isDraft ? "DRAFT" : + formData.order_type === "rapid" ? "ACTIVE" : "PENDING"; const totalRequested = formData.shifts.reduce((sum, shift) => { return sum + shift.roles.reduce((roleSum, role) => roleSum + (parseInt(role.count) || 0), 0); diff --git a/frontend-web-free/src/components/events/QuickReorderModal.jsx b/frontend-web-free/src/components/events/QuickReorderModal.jsx index e4724d91..17f7f221 100644 --- a/frontend-web-free/src/components/events/QuickReorderModal.jsx +++ b/frontend-web-free/src/components/events/QuickReorderModal.jsx @@ -81,7 +81,7 @@ export default function QuickReorderModal({ event, open, onOpenChange }) { date: format(date, 'yyyy-MM-dd'), requested: formData.requested, notes: formData.notes, - status: "Pending", + status: "PENDING", assigned: 0, assigned_staff: [] })); diff --git a/frontend-web-free/src/components/notifications/NotificationEngine.jsx b/frontend-web-free/src/components/notifications/NotificationEngine.jsx index f2d62ce7..e82a9dec 100644 --- a/frontend-web-free/src/components/notifications/NotificationEngine.jsx +++ b/frontend-web-free/src/components/notifications/NotificationEngine.jsx @@ -130,7 +130,7 @@ export function NotificationEngine() { user.id, '⏰ Shift Reminder', `Reminder: Your shift at ${event.event_name} is tomorrow`, - 'event_updated', + 'EVENT_UPDATED', event.id ); @@ -177,7 +177,7 @@ export function NotificationEngine() { clientUser.id, '📅 Upcoming Event', `Your event "${event.event_name}" is in 3 days`, - 'event_created', + 'EVENT_CREATED', event.id ); @@ -199,7 +199,7 @@ export function NotificationEngine() { useEffect(() => { const notifyVendorsNewLeads = async () => { const newEvents = events.filter(e => - e.status === 'Draft' || e.status === 'Pending' + e.status === 'DRAFT' || e.status === 'PENDING' ); const vendorUsers = users.filter(u => u.role === 'vendor'); @@ -212,7 +212,7 @@ export function NotificationEngine() { // Check if already notified const recentNotifs = await base44.entities.ActivityLog.filter({ userId: vendor.id, - activityType: 'event_created', + activityType: 'EVENT_CREATED', related_entity_id: event.id, }); @@ -222,7 +222,7 @@ export function NotificationEngine() { vendor.id, '🎯 New Lead Available', `New opportunity: ${event.event_name} needs ${event.requested || 0} staff`, - 'event_created', + 'EVENT_CREATED', event.id ); diff --git a/frontend-web-free/src/components/orders/OrderStatusUtils.jsx b/frontend-web-free/src/components/orders/OrderStatusUtils.jsx index 3cadf867..577d0f7c 100644 --- a/frontend-web-free/src/components/orders/OrderStatusUtils.jsx +++ b/frontend-web-free/src/components/orders/OrderStatusUtils.jsx @@ -1,16 +1,16 @@ // Utility to calculate order status based on current state export function calculateOrderStatus(event) { // Check explicit statuses first - if (event.status === "Canceled" || event.status === "Cancelled") { - return "Canceled"; + if (event.status === "CANCELLED" || event.status === "CANCELLED") { + return "CANCELLED"; } - if (event.status === "Draft") { - return "Draft"; + if (event.status === "DRAFT") { + return "DRAFT"; } - if (event.status === "Completed") { - return "Completed"; + if (event.status === "COMPLETED") { + return "COMPLETED"; } // Calculate status based on staffing @@ -18,20 +18,20 @@ export function calculateOrderStatus(event) { const assigned = event.assigned_staff?.length || 0; if (requested === 0) { - return "Draft"; // No staff requested yet + return "DRAFT"; // No staff requested yet } if (assigned === 0) { - return "Pending"; // Awaiting assignment + return "PENDING"; // Awaiting assignment } if (assigned < requested) { - return "Partial"; // Partially staffed + return "PARTIAL"; // Partially staffed } if (assigned >= requested) { - return "Confirmed"; // Fully staffed + return "CONFIRMED"; // Fully staffed } - - return "Pending"; + + return "PENDING"; } \ No newline at end of file diff --git a/frontend-web-free/src/components/orders/RapidOrderChat.jsx b/frontend-web-free/src/components/orders/RapidOrderChat.jsx index 51719c09..b267d291 100644 --- a/frontend-web-free/src/components/orders/RapidOrderChat.jsx +++ b/frontend-web-free/src/components/orders/RapidOrderChat.jsx @@ -130,7 +130,7 @@ Return a concise summary.`, const orderData = { event_name: `RAPID: ${detectedOrder.count} ${detectedOrder.role}${detectedOrder.count > 1 ? 's' : ''}`, is_rapid: true, - status: "Pending", + status: "PENDING", business_name: detectedOrder.business_name, hub: detectedOrder.hub, event_location: detectedOrder.location, diff --git a/frontend-web-free/src/components/orders/WorkerConfirmationCard.jsx b/frontend-web-free/src/components/orders/WorkerConfirmationCard.jsx index 832f70a6..daf5fab2 100644 --- a/frontend-web-free/src/components/orders/WorkerConfirmationCard.jsx +++ b/frontend-web-free/src/components/orders/WorkerConfirmationCard.jsx @@ -32,11 +32,11 @@ export default function WorkerConfirmationCard({ assignment, event }) { const getStatusColor = () => { switch (assignment.assignment_status) { - case "Confirmed": + case "CONFIRMED": return "bg-green-100 text-green-700 border-green-300"; case "Cancelled": return "bg-red-100 text-red-700 border-red-300"; - case "Pending": + case "PENDING": return "bg-yellow-100 text-yellow-700 border-yellow-300"; default: return "bg-slate-100 text-slate-700 border-slate-300"; diff --git a/frontend-web-free/src/components/tasks/TaskDetailModal.jsx b/frontend-web-free/src/components/tasks/TaskDetailModal.jsx index 774db343..22d88070 100644 --- a/frontend-web-free/src/components/tasks/TaskDetailModal.jsx +++ b/frontend-web-free/src/components/tasks/TaskDetailModal.jsx @@ -23,7 +23,7 @@ export default function TaskDetailModal({ task, open, onClose }) { const queryClient = useQueryClient(); const [comment, setComment] = useState(""); const [uploading, setUploading] = useState(false); - const [status, setStatus] = useState(task?.status || "pending"); + const [status, setStatus] = useState(task?.status || "PENDING"); const [activeTab, setActiveTab] = useState("updates"); const [emailNotification, setEmailNotification] = useState(false); const fileInputRef = useRef(null); @@ -244,10 +244,10 @@ export default function TaskDetailModal({ task, open, onClose }) { }; const statusOptions = [ - { value: "pending", label: "Pending", icon: Clock, color: "bg-slate-100 text-slate-700 border-slate-300" }, + { value: "PENDING", label: "Pending", icon: Clock, color: "bg-slate-100 text-slate-700 border-slate-300" }, { value: "in_progress", label: "In Progress", icon: Zap, color: "bg-blue-100 text-blue-700 border-blue-300" }, { value: "on_hold", label: "On Hold", icon: PauseCircle, color: "bg-orange-100 text-orange-700 border-orange-300" }, - { value: "completed", label: "Completed", icon: CheckCircle, color: "bg-green-100 text-green-700 border-green-300" }, + { value: "COMPLETED", label: "Completed", icon: CheckCircle, color: "bg-green-100 text-green-700 border-green-300" }, ]; return ( diff --git a/frontend-web-free/src/components/ui/use-toast.jsx b/frontend-web-free/src/components/ui/use-toast.jsx index cc33246c..e441deaf 100644 --- a/frontend-web-free/src/components/ui/use-toast.jsx +++ b/frontend-web-free/src/components/ui/use-toast.jsx @@ -105,11 +105,11 @@ async function createNotification(title, description, variant) { if (variant === "destructive" || title.includes("Failed") || title.includes("Error")) { icon_type = "alert"; icon_color = "red"; - activity_type = "event_updated"; + activity_type = "EVENT_UPDATED"; } else if (title.includes("Success") || title.includes("✅") || title.includes("Saved") || title.includes("Created")) { icon_type = "check"; icon_color = "green"; - activity_type = "event_created"; + activity_type = "EVENT_CREATED"; } else if (title.includes("Invoice") || title.includes("Payment")) { icon_type = "invoice"; icon_color = "purple"; @@ -117,7 +117,7 @@ async function createNotification(title, description, variant) { } else if (title.includes("Event") || title.includes("Order")) { icon_type = "calendar"; icon_color = "blue"; - activity_type = "event_created"; + activity_type = "EVENT_CREATED"; } else if (title.includes("User") || title.includes("Staff") || title.includes("Member")) { icon_type = "user"; icon_color = "green"; diff --git a/frontend-web-free/src/pages/Events.jsx b/frontend-web-free/src/pages/Events.jsx index 9a5c0951..b1397562 100644 --- a/frontend-web-free/src/pages/Events.jsx +++ b/frontend-web-free/src/pages/Events.jsx @@ -171,9 +171,9 @@ export default function Events() { if (totalAssigned >= totalRequested && totalRequested > 0) { newStatus = 'Fully Staffed'; } else if (totalAssigned > 0 && totalAssigned < totalRequested) { - newStatus = 'Partial Staffed'; + newStatus = 'PARTIAL_STAFFED'; } else if (totalAssigned === 0) { - newStatus = 'Pending'; + newStatus = 'PENDING'; } await base44.entities.Event.update(event.id, { @@ -212,7 +212,7 @@ export default function Events() { if (updatedAssignedStaff.length >= totalRequested && totalRequested > 0) { newStatus = 'Fully Staffed'; } else if (updatedAssignedStaff.length > 0 && updatedAssignedStaff.length < totalRequested) { - newStatus = 'Partial Staffed'; + newStatus = 'PARTIAL_STAFFED'; } await updateEventMutation.mutateAsync({ @@ -238,11 +238,11 @@ export default function Events() { let newStatus = event.status; if (updatedAssignedStaff.length >= totalRequested && totalRequested > 0) { - newStatus = 'Fully Staffed'; + newStatus = 'FULLY_STAFFED'; } else if (updatedAssignedStaff.length > 0 && updatedAssignedStaff.length < totalRequested) { - newStatus = 'Partial Staffed'; + newStatus = 'PARTIAL_STAFFED'; } else if (updatedAssignedStaff.length === 0) { - newStatus = 'Pending'; + newStatus = 'PENDING'; } await updateEventMutation.mutateAsync({ @@ -259,11 +259,11 @@ export default function Events() { const getStatusCounts = () => { const total = events.length; - const active = events.filter(e => e.status === "Active").length; - const pending = events.filter(e => e.status === "Pending").length; - const partialStaffed = events.filter(e => e.status === "Partial Staffed").length; - const fullyStaffed = events.filter(e => e.status === "Fully Staffed").length; - const completed = events.filter(e => e.status === "Completed").length; + const active = events.filter(e => e.status === "ACTIVE").length; + const pending = events.filter(e => e.status === "PENDING").length; + const partialStaffed = events.filter(e => e.status === "PARTIAL_STAFFED").length; + const fullyStaffed = events.filter(e => e.status === "FULLY_STAFFED").length; + const completed = events.filter(e => e.status === "COMPLETED").length; return { active: { count: active, percentage: total ? Math.round((active / total) * 100) : 0 }, diff --git a/frontend-web-free/src/pages/InviteVendor.jsx b/frontend-web-free/src/pages/InviteVendor.jsx index cd25adf9..89ea5fb1 100644 --- a/frontend-web-free/src/pages/InviteVendor.jsx +++ b/frontend-web-free/src/pages/InviteVendor.jsx @@ -53,7 +53,7 @@ export default function InviteVendor() { primary_contact_email: data.primary_contact_email, vendor_admin_fee: parseFloat(data.vendor_admin_fee), invited_by: user?.email || "admin", - invite_status: "pending", + invite_status: "PENDING", invite_sent_date: new Date().toISOString(), notes: data.notes }); diff --git a/frontend-web-free/src/pages/Invoices.jsx b/frontend-web-free/src/pages/Invoices.jsx index 10abff38..e0072028 100644 --- a/frontend-web-free/src/pages/Invoices.jsx +++ b/frontend-web-free/src/pages/Invoices.jsx @@ -260,7 +260,7 @@ export default function Invoices() { {getStatusCount("all")} diff --git a/frontend-web-free/src/pages/Onboarding.jsx b/frontend-web-free/src/pages/Onboarding.jsx index 27fccfd1..66b02804 100644 --- a/frontend-web-free/src/pages/Onboarding.jsx +++ b/frontend-web-free/src/pages/Onboarding.jsx @@ -34,7 +34,7 @@ export default function Onboarding() { queryKey: ['team-invite', inviteCode], queryFn: async () => { const allInvites = await base44.entities.TeamMemberInvite.list(); - const foundInvite = allInvites.find(inv => inv.invite_code === inviteCode && inv.invite_status === 'pending'); + const foundInvite = allInvites.find(inv => inv.invite_code === inviteCode && inv.invite_status === 'PENDING'); if (foundInvite) { // Pre-fill form with invite data @@ -109,7 +109,7 @@ export default function Onboarding() { } // Check if invite was already accepted - if (invite.invite_status !== 'pending') { + if (invite.invite_status !== 'PENDING') { throw new Error("This invitation has already been used. Please contact your team administrator for a new invitation."); } diff --git a/frontend-web-free/src/pages/RapidOrder.jsx b/frontend-web-free/src/pages/RapidOrder.jsx index 50d8108d..761137b3 100644 --- a/frontend-web-free/src/pages/RapidOrder.jsx +++ b/frontend-web-free/src/pages/RapidOrder.jsx @@ -227,7 +227,7 @@ Return a concise summary.`, const orderData = { event_name: `RAPID: ${exactCount} ${detectedOrder.role}${exactCount > 1 ? 's' : ''}`, is_rapid: true, - status: "Pending", + status: "PENDING", business_name: detectedOrder.business_name, hub: detectedOrder.hub, event_location: detectedOrder.location, diff --git a/frontend-web-free/src/pages/SmartVendorOnboarding.jsx b/frontend-web-free/src/pages/SmartVendorOnboarding.jsx index 8df82ac0..4016555a 100644 --- a/frontend-web-free/src/pages/SmartVendorOnboarding.jsx +++ b/frontend-web-free/src/pages/SmartVendorOnboarding.jsx @@ -560,10 +560,10 @@ export default function SmartVendorOnboarding() { w9_document: formData.w9_url, coi_document: formData.coi_url, insurance_certificate: formData.coi_url, - approval_status: "pending", + approval_status: "PENDING", is_active: false, // Updated contract note to reflect review not upload - notes: `Total Employees: ${formData.total_employees}, Software: ${formData.software_name || formData.software_type}, SOS: ${formData.sos_url ? 'Verified' : 'Pending'}, Contract: ${formData.contract_acknowledged ? 'Acknowledged' : 'Not Acknowledged'}. Contract Review Notes: ${formData.contract_review_notes}. NDA Signed: ${formData.nda_acknowledged ? 'Yes' : 'No'}` + notes: `Total Employees: ${formData.total_employees}, Software: ${formData.software_name || formData.software_type}, SOS: ${formData.sos_url ? 'Verified' : 'PENDING'}, Contract: ${formData.contract_acknowledged ? 'Acknowledged' : 'Not Acknowledged'}. Contract Review Notes: ${formData.contract_review_notes}. NDA Signed: ${formData.nda_acknowledged ? 'Yes' : 'No'}` }); // Create rate proposals with location-specific rates diff --git a/frontend-web-free/src/pages/TeamDetails.jsx b/frontend-web-free/src/pages/TeamDetails.jsx index ae77337a..d07ab453 100644 --- a/frontend-web-free/src/pages/TeamDetails.jsx +++ b/frontend-web-free/src/pages/TeamDetails.jsx @@ -133,7 +133,7 @@ export default function TeamDetails() { full_name: data.full_name, role: data.role, invited_by: user?.email || user?.full_name, - invite_status: "pending", + invite_status: "PENDING", invited_date: new Date().toISOString(), expires_at: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString() // 7 days }); diff --git a/frontend-web-free/src/pages/Teams.jsx b/frontend-web-free/src/pages/Teams.jsx index b2829fd8..3a198fae 100644 --- a/frontend-web-free/src/pages/Teams.jsx +++ b/frontend-web-free/src/pages/Teams.jsx @@ -264,7 +264,7 @@ export default function Teams() { hub: firstHub, department: firstDept, invited_by: user?.email || user?.full_name, - invite_status: "pending", + invite_status: "PENDING", invited_date: new Date().toISOString(), expires_at: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString() }); @@ -331,7 +331,7 @@ export default function Teams() { hub: data.hub || "", department: data.department || "", invited_by: user?.email || user?.full_name, - invite_status: "pending", + invite_status: "PENDING", invited_date: new Date().toISOString(), expires_at: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString() }); diff --git a/frontend-web-free/src/pages/VendorDashboard.jsx b/frontend-web-free/src/pages/VendorDashboard.jsx index c5e49754..fb4ea6fe 100644 --- a/frontend-web-free/src/pages/VendorDashboard.jsx +++ b/frontend-web-free/src/pages/VendorDashboard.jsx @@ -313,7 +313,7 @@ export default function VendorDashboard() { return Fully Staffed; } - if (order.status === "Pending") { + if (order.status === "PENDING") { return Pending; } diff --git a/frontend-web-free/src/pages/VendorOrders.jsx b/frontend-web-free/src/pages/VendorOrders.jsx index 92bed5e8..ca0d8c16 100644 --- a/frontend-web-free/src/pages/VendorOrders.jsx +++ b/frontend-web-free/src/pages/VendorOrders.jsx @@ -155,11 +155,11 @@ export default function VendorOrders() { let newStatus = event.status; if (totalAssigned >= totalRequested && totalRequested > 0) { - newStatus = 'Fully Staffed'; + newStatus = 'FULLY_STAFFED'; } else if (totalAssigned > 0 && totalAssigned < totalRequested) { - newStatus = 'Partial Staffed'; + newStatus = 'PARTIAL_STAFFED'; } else if (totalAssigned === 0) { - newStatus = 'Pending'; + newStatus = 'PENDING'; } await base44.entities.Event.update(event.id, { @@ -217,7 +217,7 @@ export default function VendorOrders() { return filtered; }, [eventsWithConflicts, searchTerm, activeTab]); - const getAssignmentStatus = (event) => {debugger; + const getAssignmentStatus = (event) => { const totalRequested = event.shifts?.reduce((accShift, shift) => { return accShift + (shift.roles?.reduce((accRole, role) => accRole + (role.count || 0), 0) || 0); }, 0) || 0;