feat(Makefile): patch Layout.jsx queryKey for local development feat(frontend-web): mock base44 client for local development with role switching feat(frontend-web): add event assignment modal with conflict detection and bulk assign feat(frontend-web): add client dashboard with key metrics and quick actions feat(frontend-web): add layout component with role-based navigation feat(frontend-web): update various pages to use "@/components" alias feat(frontend-web): update create event page with ai assistant toggle feat(frontend-web): update dashboard page with new components feat(frontend-web): update events page with quick assign popover feat(frontend-web): update invite vendor page with hover card feat(frontend-web): update messages page with conversation list and message thread feat(frontend-web): update operator dashboard page with new components feat(frontend-web): update partner management page with new components feat(frontend-web): update permissions page with new components feat(frontend-web): update procurement dashboard page with new components feat(frontend-web): update smart vendor onboarding page with new components feat(frontend-web): update staff directory page with new components feat(frontend-web): update teams page with new components feat(frontend-web): update user management page with new components feat(frontend-web): update vendor compliance page with new components feat(frontend-web): update main.jsx to include react query provider feat: add vendor marketplace page feat: add global import fix to prepare-export script feat: add patch-layout-query-key script to fix query key feat: update patch-base44-client script to use a more robust method
49 lines
1.6 KiB
JavaScript
49 lines
1.6 KiB
JavaScript
import React, { useState } from "react";
|
|
import { base44 } from "@/api/base44Client";
|
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
import { useNavigate } from "react-router-dom";
|
|
import { createPageUrl } from "@/utils";
|
|
import { Button } from "@/components/ui/button";
|
|
import { ArrowLeft } from "lucide-react";
|
|
import StaffForm from "@/components/staff/StaffForm";
|
|
|
|
export default function AddStaff() {
|
|
const navigate = useNavigate();
|
|
const queryClient = useQueryClient();
|
|
|
|
const createStaffMutation = useMutation({
|
|
mutationFn: (staffData) => base44.entities.Staff.create(staffData),
|
|
onSuccess: () => {
|
|
queryClient.invalidateQueries({ queryKey: ['staff'] });
|
|
navigate(createPageUrl("Dashboard"));
|
|
},
|
|
});
|
|
|
|
const handleSubmit = (staffData) => {
|
|
createStaffMutation.mutate(staffData);
|
|
};
|
|
|
|
return (
|
|
<div className="p-4 md:p-8">
|
|
<div className="max-w-4xl mx-auto">
|
|
<div className="mb-8">
|
|
<Button
|
|
variant="ghost"
|
|
onClick={() => navigate(createPageUrl("Dashboard"))}
|
|
className="mb-4 hover:bg-slate-100"
|
|
>
|
|
<ArrowLeft className="w-4 h-4 mr-2" />
|
|
Back to Dashboard
|
|
</Button>
|
|
<h1 className="text-3xl md:text-4xl font-bold text-slate-900 mb-2">Add New Staff Member</h1>
|
|
<p className="text-slate-600">Fill in the details to add a new team member</p>
|
|
</div>
|
|
|
|
<StaffForm
|
|
onSubmit={handleSubmit}
|
|
isSubmitting={createStaffMutation.isPending}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
} |