From 01180bc757c594111e2d98afb89d247703656e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:50:54 -0500 Subject: [PATCH] just chaging enum values to work with the backend --- frontend-web-free/src/api/krowSDK.js | 2 -- .../src/components/events/EventForm.jsx | 6 ++--- .../src/components/events/EventFormWizard.jsx | 4 ++-- .../components/events/QuickReorderModal.jsx | 2 +- .../notifications/NotificationEngine.jsx | 10 ++++---- .../components/orders/OrderStatusUtils.jsx | 24 +++++++++---------- .../src/components/orders/RapidOrderChat.jsx | 2 +- .../orders/WorkerConfirmationCard.jsx | 4 ++-- .../src/components/tasks/TaskDetailModal.jsx | 6 ++--- .../src/components/ui/use-toast.jsx | 6 ++--- frontend-web-free/src/pages/Events.jsx | 22 ++++++++--------- frontend-web-free/src/pages/InviteVendor.jsx | 2 +- frontend-web-free/src/pages/Invoices.jsx | 2 +- frontend-web-free/src/pages/Onboarding.jsx | 4 ++-- frontend-web-free/src/pages/RapidOrder.jsx | 2 +- .../src/pages/SmartVendorOnboarding.jsx | 4 ++-- frontend-web-free/src/pages/TeamDetails.jsx | 2 +- frontend-web-free/src/pages/Teams.jsx | 4 ++-- .../src/pages/VendorDashboard.jsx | 2 +- frontend-web-free/src/pages/VendorOrders.jsx | 6 ++--- 20 files changed, 57 insertions(+), 59 deletions(-) diff --git a/frontend-web-free/src/api/krowSDK.js b/frontend-web-free/src/api/krowSDK.js index cd9b4be2..1d9d0cf6 100644 --- a/frontend-web-free/src/api/krowSDK.js +++ b/frontend-web-free/src/api/krowSDK.js @@ -552,9 +552,7 @@ Object.entries(dataconnectEntityConfig).forEach(([entityName, ops]) => { // Se asume que la mayoría de queries 'list' no aceptan variables, solo se pasan si existen. //const res = await fn(dataConnect, baseVariables); - console.log(`Calling ${ops.list} for ${entityName}`, { variables: baseVariables }); const res = await fn(dataConnect, baseVariables); - console.log(`Finished ${ops.list} for ${entityName}`, res); let items = normalizeResultToArray(res); 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 8ffd05cb..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, {