feat(staff): Restrict staff permissions and add schedule view
- Backend: Restrict staff from accessing resources, customers, services, and tasks APIs - Frontend: Hide management sidebar links from staff members - Add StaffSchedule page with vertical timeline view of appointments - Add StaffHelp page with staff-specific documentation - Return linked_resource_id and can_edit_schedule in user profile for staff 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -185,3 +185,44 @@ export async function rescheduleJob(
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an appointment's time via PATCH to /appointments/{id}/
|
||||
* Used for drag-and-drop rescheduling on the mobile timeline
|
||||
*/
|
||||
export async function updateAppointmentTime(
|
||||
appointmentId: number,
|
||||
data: { start_time: string; end_time: string }
|
||||
): Promise<JobListItem> {
|
||||
const token = await getAuthToken();
|
||||
const userData = await getUserData();
|
||||
const subdomain = userData?.business_subdomain;
|
||||
const apiUrl = getAppointmentsApiUrl();
|
||||
|
||||
const response = await axios.patch<any>(`${apiUrl}/appointments/${appointmentId}/`, data, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...(token && { Authorization: `Token ${token}` }),
|
||||
...(subdomain && { 'X-Business-Subdomain': subdomain }),
|
||||
},
|
||||
});
|
||||
|
||||
// Transform response to match JobListItem format
|
||||
const apt = response.data;
|
||||
const start = new Date(apt.start_time);
|
||||
const end = new Date(apt.end_time);
|
||||
const durationMinutes = Math.round((end.getTime() - start.getTime()) / 60000);
|
||||
|
||||
return {
|
||||
id: apt.id,
|
||||
title: apt.title || apt.service_name || 'Appointment',
|
||||
start_time: apt.start_time,
|
||||
end_time: apt.end_time,
|
||||
status: apt.status as JobStatus,
|
||||
status_display: jobStatusLabels[apt.status as JobStatus] || apt.status,
|
||||
customer_name: apt.customer_name || null,
|
||||
address: apt.address || apt.location || null,
|
||||
service_name: apt.service_name || null,
|
||||
duration_minutes: durationMinutes,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user