modification just for test staff crud
This commit is contained in:
@@ -14,35 +14,35 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
employee_name: "",
|
||||
manager: "",
|
||||
contact_number: "",
|
||||
phone: "",
|
||||
//phone: "",
|
||||
email: "", // Added email field
|
||||
department: "",
|
||||
hub_location: "",
|
||||
event_location: "",
|
||||
//event_location: "",
|
||||
track: "",
|
||||
address: "",
|
||||
city: "",
|
||||
//address: "",
|
||||
//city: "",
|
||||
position: "",
|
||||
position_2: "",
|
||||
initial: "",
|
||||
//position_2: "",
|
||||
//initial: "",
|
||||
profile_type: "",
|
||||
employment_type: "",
|
||||
english: "",
|
||||
english_required: false,
|
||||
check_in: "",
|
||||
replaced_by: "",
|
||||
ro: "",
|
||||
mon: "",
|
||||
schedule_days: "",
|
||||
invoiced: false,
|
||||
action: "",
|
||||
//english_required: false,
|
||||
//check_in: "",
|
||||
//replaced_by: "",
|
||||
//ro: "",
|
||||
//mon: "",
|
||||
//schedule_days: "",
|
||||
//invoiced: false,
|
||||
//action: "",
|
||||
notes: "",
|
||||
accounting_comments: "",
|
||||
//accounting_comments: "",
|
||||
rating: 0,
|
||||
shift_coverage_percentage: 100,
|
||||
cancellation_count: 0,
|
||||
no_show_count: 0, // Added no_show_count field
|
||||
total_shifts: 0,
|
||||
//shift_coverage_percentage: 100,
|
||||
//cancellation_count: 0,
|
||||
//no_show_count: 0, // Added no_show_count field
|
||||
//total_shifts: 0,
|
||||
reliability_score: 100
|
||||
});
|
||||
|
||||
@@ -81,7 +81,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="initial" className="text-slate-700 font-medium">Initials</Label>
|
||||
<Input
|
||||
id="initial"
|
||||
@@ -90,7 +90,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
maxLength={3}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="position" className="text-slate-700 font-medium">Primary Skill</Label>
|
||||
@@ -103,7 +103,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="position_2" className="text-slate-700 font-medium">Secondary Skill</Label>
|
||||
<Input
|
||||
id="position_2"
|
||||
@@ -112,7 +112,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
placeholder="e.g., Dishwasher, Prep Cook"
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="profile_type" className="text-slate-700 font-medium">Skill Level</Label>
|
||||
@@ -121,9 +121,9 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
<SelectValue placeholder="Select skill level" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="Skilled">Skilled</SelectItem>
|
||||
<SelectItem value="Beginner">Beginner</SelectItem>
|
||||
<SelectItem value="Cross-Trained">Cross-Trained</SelectItem>
|
||||
<SelectItem value="SKILLED">Skilled</SelectItem>
|
||||
<SelectItem value="BEGINNER">Beginner</SelectItem>
|
||||
<SelectItem value="CROSS_TRAINED">Cross-Trained</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
@@ -135,13 +135,13 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
<SelectValue placeholder="Select type" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="Full Time">Full Time</SelectItem>
|
||||
<SelectItem value="Part Time">Part Time</SelectItem>
|
||||
<SelectItem value="On call">On call</SelectItem>
|
||||
<SelectItem value="Weekends">Weekends</SelectItem>
|
||||
<SelectItem value="Specific Days">Specific Days</SelectItem>
|
||||
<SelectItem value="Seasonal">Seasonal</SelectItem>
|
||||
<SelectItem value="Medical Leave">Medical Leave</SelectItem>
|
||||
<SelectItem value="FULL_TIME">Full Time</SelectItem>
|
||||
<SelectItem value="PART_TIME">Part Time</SelectItem>
|
||||
<SelectItem value="ON_CALL">On call</SelectItem>
|
||||
<SelectItem value="WEEKENDS">Weekends</SelectItem>
|
||||
<SelectItem value="SPECIFIC_DAYS">Specific Days</SelectItem>
|
||||
<SelectItem value="SEASONAL">Seasonal</SelectItem>
|
||||
<SelectItem value="MEDICAL_LEAVE">Medical Leave</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
@@ -187,7 +187,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="phone" className="text-slate-700 font-medium">Additional Phone</Label>
|
||||
<Input
|
||||
id="phone"
|
||||
@@ -196,7 +196,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('phone', e.target.value)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -234,7 +234,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="shift_coverage_percentage" className="text-slate-700 font-medium">Shift Coverage %</Label>
|
||||
<Input
|
||||
id="shift_coverage_percentage"
|
||||
@@ -245,9 +245,9 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('shift_coverage_percentage', parseInt(e.target.value) || 0)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="cancellation_count" className="text-slate-700 font-medium">Cancellation Count</Label>
|
||||
<Input
|
||||
id="cancellation_count"
|
||||
@@ -257,10 +257,10 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('cancellation_count', parseInt(e.target.value) || 0)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
{/* New No Show Count field */}
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="no_show_count" className="text-slate-700 font-medium">No Show Count</Label>
|
||||
<Input
|
||||
id="no_show_count"
|
||||
@@ -270,10 +270,10 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('no_show_count', parseInt(e.target.value) || 0)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
{/* End new No Show Count field */}
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="total_shifts" className="text-slate-700 font-medium">Total Shifts</Label>
|
||||
<Input
|
||||
id="total_shifts"
|
||||
@@ -283,9 +283,9 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('total_shifts', parseInt(e.target.value) || 0)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2 flex items-end">
|
||||
{/* <div className="space-y-2 flex items-end">
|
||||
<div className="flex items-center space-x-2">
|
||||
<Checkbox
|
||||
id="invoiced"
|
||||
@@ -296,7 +296,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
Invoiced
|
||||
</Label>
|
||||
</div>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -314,19 +314,19 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
<SelectValue placeholder="Select department" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="Operations">Operations</SelectItem>
|
||||
<SelectItem value="Sales">Sales</SelectItem>
|
||||
<SelectItem value="OPERATIONS">Operations</SelectItem>
|
||||
<SelectItem value="SALES">Sales</SelectItem>
|
||||
<SelectItem value="HR">HR</SelectItem>
|
||||
<SelectItem value="Finance">Finance</SelectItem>
|
||||
<SelectItem value="FINANCE">Finance</SelectItem>
|
||||
<SelectItem value="IT">IT</SelectItem>
|
||||
<SelectItem value="Marketing">Marketing</SelectItem>
|
||||
<SelectItem value="Customer Service">Customer Service</SelectItem>
|
||||
<SelectItem value="Logistics">Logistics</SelectItem>
|
||||
<SelectItem value="MARKETING">Marketing</SelectItem>
|
||||
<SelectItem value="CUSTOMER_SERVICE">Customer Service</SelectItem>
|
||||
<SelectItem value="LOGISTICS">Logistics</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="city" className="text-slate-700 font-medium">City</Label>
|
||||
<Input
|
||||
id="city"
|
||||
@@ -335,7 +335,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
placeholder="e.g., San Francisco"
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="hub_location" className="text-slate-700 font-medium">Hub Location</Label>
|
||||
@@ -347,7 +347,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="event_location" className="text-slate-700 font-medium">Event Location</Label>
|
||||
<Input
|
||||
id="event_location"
|
||||
@@ -355,7 +355,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('event_location', e.target.value)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="track" className="text-slate-700 font-medium">Track</Label>
|
||||
@@ -367,7 +367,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 md:col-span-2">
|
||||
{/* <div className="space-y-2 md:col-span-2">
|
||||
<Label htmlFor="address" className="text-slate-700 font-medium">Address</Label>
|
||||
<Textarea
|
||||
id="address"
|
||||
@@ -376,7 +376,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
rows={2}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -394,15 +394,15 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
<SelectValue placeholder="Select level" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="Fluent">Fluent</SelectItem>
|
||||
<SelectItem value="Intermediate">Intermediate</SelectItem>
|
||||
<SelectItem value="Basic">Basic</SelectItem>
|
||||
<SelectItem value="None">None</SelectItem>
|
||||
<SelectItem value="FLUENT">Fluent</SelectItem>
|
||||
<SelectItem value="INTERMEDIATE">Intermediate</SelectItem>
|
||||
<SelectItem value="BASIC">Basic</SelectItem>
|
||||
<SelectItem value="NONE">None</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 flex items-end">
|
||||
{/* <div className="space-y-2 flex items-end">
|
||||
<div className="flex items-center space-x-2">
|
||||
<Checkbox
|
||||
id="english_required"
|
||||
@@ -413,9 +413,9 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
English Required
|
||||
</Label>
|
||||
</div>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="check_in" className="text-slate-700 font-medium">Last Check-in</Label>
|
||||
<Input
|
||||
id="check_in"
|
||||
@@ -424,9 +424,9 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('check_in', e.target.value)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="schedule_days" className="text-slate-700 font-medium">Schedule Days</Label>
|
||||
<Input
|
||||
id="schedule_days"
|
||||
@@ -435,7 +435,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
placeholder="e.g., Mon-Fri, 9AM-5PM"
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -446,7 +446,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
</CardHeader>
|
||||
<CardContent className="p-6">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="replaced_by" className="text-slate-700 font-medium">Replaced By</Label>
|
||||
<Input
|
||||
id="replaced_by"
|
||||
@@ -454,9 +454,9 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('replaced_by', e.target.value)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="action" className="text-slate-700 font-medium">Action</Label>
|
||||
<Input
|
||||
id="action"
|
||||
@@ -464,9 +464,9 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('action', e.target.value)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="ro" className="text-slate-700 font-medium">R.O</Label>
|
||||
<Input
|
||||
id="ro"
|
||||
@@ -474,9 +474,9 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('ro', e.target.value)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* <div className="space-y-2">
|
||||
<Label htmlFor="mon" className="text-slate-700 font-medium">MON</Label>
|
||||
<Input
|
||||
id="mon"
|
||||
@@ -484,7 +484,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
onChange={(e) => handleChange('mon', e.target.value)}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<div className="space-y-2 md:col-span-2">
|
||||
<Label htmlFor="notes" className="text-slate-700 font-medium">Notes</Label>
|
||||
@@ -497,7 +497,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 md:col-span-2">
|
||||
{/* <div className="space-y-2 md:col-span-2">
|
||||
<Label htmlFor="accounting_comments" className="text-slate-700 font-medium">Accounting Comments</Label>
|
||||
<Textarea
|
||||
id="accounting_comments"
|
||||
@@ -506,7 +506,7 @@ export default function StaffForm({ staff, onSubmit, isSubmitting }) {
|
||||
rows={3}
|
||||
className="border-slate-200"
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -27,6 +27,10 @@ export default function EditStaff() {
|
||||
queryClient.invalidateQueries({ queryKey: ['staff'] });
|
||||
navigate(createPageUrl("Dashboard"));
|
||||
},
|
||||
onError: (error, variables) => {
|
||||
console.log("data: ",variables);
|
||||
console.error("Update failed", error);
|
||||
},
|
||||
});
|
||||
|
||||
const handleSubmit = (staffData) => {
|
||||
|
||||
Reference in New Issue
Block a user