just chaging enum values to work with the backend
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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: []
|
||||
}));
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -260,7 +260,7 @@ export default function Invoices() {
|
||||
<Badge className="ml-2 bg-yellow-400 text-yellow-900 hover:bg-yellow-400 border-0 font-bold">{getStatusCount("all")}</Badge>
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="pending"
|
||||
value="PENDING"
|
||||
className="data-[state=active]:bg-blue-600 data-[state=active]:text-white bg-white text-slate-700 hover:bg-slate-50 transition-all rounded-md px-3 py-2"
|
||||
>
|
||||
<Clock className="w-4 h-4 mr-2" />
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -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()
|
||||
});
|
||||
|
||||
@@ -313,7 +313,7 @@ export default function VendorDashboard() {
|
||||
return <Badge className="bg-green-600 text-white text-xs border-0 px-2.5 py-0.5 font-bold flex items-center gap-1"><CheckCircle className="w-3 h-3" />Fully Staffed</Badge>;
|
||||
}
|
||||
|
||||
if (order.status === "Pending") {
|
||||
if (order.status === "PENDING") {
|
||||
return <Badge className="bg-orange-500 text-white text-xs border-0 px-2.5 py-0.5 font-bold flex items-center gap-1"><Clock className="w-3 h-3" />Pending</Badge>;
|
||||
}
|
||||
|
||||
|
||||
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user