63 lines
2.0 KiB
JavaScript
63 lines
2.0 KiB
JavaScript
import { request } from '../lib/apiClient'
|
|
|
|
/* ============================================================
|
|
forms.js — backend/candidate_forms/app.py.
|
|
|
|
The digitized hiring forms: Annexure A (Employee Requisition), and the two
|
|
halves of Annexure E — Interview Analysis (technical + behavioral) and
|
|
HR Evaluation (form_type stays "cultural_fit"). Dual-key like assessments:
|
|
exactly one of inbox_id / manual_upload_candidate_id.
|
|
|
|
Permissioned with the interviews module tags (interviews.view to read,
|
|
interviews.create to fill, interviews.edit to amend). Creating is
|
|
stage-gated SERVER-side: the application must be at INTERVIEW / OFFER /
|
|
HIRED (or legacy APPROVED), else 409 — the UI hint mirrors, never replaces,
|
|
that rule.
|
|
|
|
Field and criterion labels come from GET /forms/definitions, which is the
|
|
single authority for the paper forms' exact wording — do not hardcode
|
|
labels in components.
|
|
============================================================ */
|
|
|
|
export const FORM_TYPES = ['requisition', 'interview_analysis', 'cultural_fit']
|
|
|
|
/** Mirror of backend candidate_forms/plugins.py FORM_READY_STATUSES. */
|
|
export const FORM_READY_STATUSES = ['INTERVIEW', 'OFFER', 'HIRED', 'APPROVED']
|
|
|
|
export function definitions() {
|
|
return request('/forms/definitions')
|
|
}
|
|
|
|
export function list({ formId, inboxId, manualUploadCandidateId, jobPostId, formType, top, skip } = {}) {
|
|
return request('/forms/fetch', {
|
|
params: {
|
|
form_id: formId,
|
|
inbox_id: inboxId,
|
|
manual_upload_candidate_id: manualUploadCandidateId,
|
|
job_post_id: jobPostId,
|
|
form_type: formType,
|
|
top,
|
|
skip,
|
|
},
|
|
})
|
|
}
|
|
|
|
export function create(body) {
|
|
return request('/forms/create', { method: 'POST', body })
|
|
}
|
|
|
|
export function update(formId, body) {
|
|
return request('/forms/update', {
|
|
method: 'PATCH',
|
|
params: { form_id: formId },
|
|
body,
|
|
})
|
|
}
|
|
|
|
export function remove(formId) {
|
|
return request('/forms/delete', {
|
|
method: 'DELETE',
|
|
params: { form_id: formId },
|
|
})
|
|
}
|