update HR modules
This commit is contained in:
@@ -66,6 +66,24 @@ export interface Leave {
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export interface PortalOvertimeRequest {
|
||||
id: string
|
||||
attendanceId: string
|
||||
date: string
|
||||
hours: number
|
||||
reason: string
|
||||
status: string
|
||||
rejectedReason?: string
|
||||
createdAt: string
|
||||
employee?: {
|
||||
id: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
uniqueEmployeeId: string
|
||||
reportingToId?: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface PurchaseRequest {
|
||||
id: string
|
||||
requestNumber: string
|
||||
@@ -90,6 +108,24 @@ export interface Attendance {
|
||||
status: string
|
||||
}
|
||||
|
||||
export interface ManagedLeave {
|
||||
id: string
|
||||
leaveType: string
|
||||
startDate: string
|
||||
endDate: string
|
||||
days: number
|
||||
status: string
|
||||
reason?: string
|
||||
rejectedReason?: string
|
||||
employee: {
|
||||
id: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
uniqueEmployeeId: string
|
||||
reportingToId?: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface Salary {
|
||||
id: string
|
||||
month: number
|
||||
@@ -106,6 +142,24 @@ export interface Salary {
|
||||
}
|
||||
|
||||
export const portalAPI = {
|
||||
|
||||
getManagedLeaves: async (status?: string): Promise<ManagedLeave[]> => {
|
||||
const q = new URLSearchParams()
|
||||
if (status && status !== 'all') q.append('status', status)
|
||||
const response = await api.get(`/hr/portal/managed-leaves?${q.toString()}`)
|
||||
return response.data.data || []
|
||||
},
|
||||
|
||||
approveManagedLeave: async (id: string) => {
|
||||
const response = await api.post(`/hr/portal/managed-leaves/${id}/approve`)
|
||||
return response.data.data
|
||||
},
|
||||
|
||||
rejectManagedLeave: async (id: string, rejectedReason: string) => {
|
||||
const response = await api.post(`/hr/portal/managed-leaves/${id}/reject`, { rejectedReason })
|
||||
return response.data.data
|
||||
},
|
||||
|
||||
getMe: async (): Promise<PortalProfile> => {
|
||||
const response = await api.get('/hr/portal/me')
|
||||
return response.data.data
|
||||
@@ -121,6 +175,40 @@ export const portalAPI = {
|
||||
return response.data.data
|
||||
},
|
||||
|
||||
getOvertimeRequests: async (): Promise<PortalOvertimeRequest[]> => {
|
||||
const response = await api.get('/hr/portal/overtime-requests')
|
||||
return response.data.data || []
|
||||
},
|
||||
|
||||
submitOvertimeRequest: async (data: {
|
||||
date: string
|
||||
hours: number
|
||||
reason: string
|
||||
}): Promise<PortalOvertimeRequest> => {
|
||||
const response = await api.post('/hr/portal/overtime-requests', data)
|
||||
return response.data.data
|
||||
},
|
||||
|
||||
getManagedOvertimeRequests: async (): Promise<PortalOvertimeRequest[]> => {
|
||||
const response = await api.get('/hr/portal/managed-overtime-requests')
|
||||
return response.data.data || []
|
||||
},
|
||||
|
||||
approveManagedOvertimeRequest: async (attendanceId: string): Promise<PortalOvertimeRequest> => {
|
||||
const response = await api.post(`/hr/portal/managed-overtime-requests/${attendanceId}/approve`)
|
||||
return response.data.data
|
||||
},
|
||||
|
||||
rejectManagedOvertimeRequest: async (
|
||||
attendanceId: string,
|
||||
rejectedReason: string
|
||||
): Promise<PortalOvertimeRequest> => {
|
||||
const response = await api.post(`/hr/portal/managed-overtime-requests/${attendanceId}/reject`, {
|
||||
rejectedReason,
|
||||
})
|
||||
return response.data.data
|
||||
},
|
||||
|
||||
getLeaveBalance: async (year?: number): Promise<PortalProfile['stats']['leaveBalance']> => {
|
||||
const params = year ? `?year=${year}` : ''
|
||||
const response = await api.get(`/hr/portal/leave-balance${params}`)
|
||||
|
||||
Reference in New Issue
Block a user