mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-04 23:03:39 +00:00
62 lines
2.7 KiB
TypeScript
62 lines
2.7 KiB
TypeScript
import { FileUploadField } from "./entities/file-upload-field.entity";
|
|
|
|
/**
|
|
* The DARS delegation paper — the document that evidences a company's Power of
|
|
* Attorney (EDRFREIGHT-358).
|
|
*
|
|
* Every other onboarding document is admin-managed: the rows in
|
|
* `file_upload_fields` are edited from the backoffice file-settings editor and
|
|
* the seeder deliberately inserts none. This one is different — a company that
|
|
* names a PoA must produce a delegation paper authenticated by the Documents
|
|
* Authentication and Registration Service, and that is a legal requirement
|
|
* rather than a configuration choice. So the field is defined here in code and
|
|
* injected into the company onboarding sets on read: no row to forget to seed,
|
|
* and deleting one in the editor cannot silently switch the requirement off.
|
|
*/
|
|
|
|
/** FileRecord `code` (and upload field key) of the live delegation paper. */
|
|
export const POA_DELEGATION_FILE_KEY = "poa_delegation_letter";
|
|
|
|
/** Code for a delegation paper staged in an open change request (not yet live). */
|
|
export const POA_DELEGATION_PENDING_CODE = "poa_delegation_letter_pending";
|
|
|
|
/** Customer-facing name of the document, used by the API and both web apps. */
|
|
export const POA_DELEGATION_LABEL = "DARS Delegation Paper";
|
|
|
|
/** Prefix of the setting codes the field is injected into. */
|
|
export const COMPANY_ONBOARDING_CODE_PREFIX = "company_onboarding_documents_";
|
|
|
|
/**
|
|
* The co-operative onboarding set — the third alternative to `_ethiopian` and
|
|
* `_foreign`, not an addition to them: a union or farm resolves to this set
|
|
* INSTEAD of its nationality's, because it holds no business licence and so
|
|
* owes a different list of papers. The delegation paper is injected into it
|
|
* like any other company onboarding set.
|
|
*/
|
|
export const COOPERATIVE_ONBOARDING_CODE = `${COMPANY_ONBOARDING_CODE_PREFIX}cooperative`;
|
|
|
|
const POA_DELEGATION_HELP =
|
|
"Delegation paper issued by the Documents Authentication and Registration " +
|
|
"Service (DARS) delegating the representative named above. Upload the " +
|
|
"authenticated copy — a plain letter is not accepted.";
|
|
|
|
/**
|
|
* The field descriptor. `isRequired` stays false because the paper is only due
|
|
* once a PoA has actually been named (or the company operates as a freight
|
|
* forwarder) — a rule that spans form fields as well as files, so it is
|
|
* enforced in CompaniesService rather than by this flag.
|
|
*/
|
|
export function poaDelegationField(displayOrder: number): FileUploadField {
|
|
return {
|
|
fileKey: POA_DELEGATION_FILE_KEY,
|
|
fileLabel: POA_DELEGATION_LABEL,
|
|
helpText: POA_DELEGATION_HELP,
|
|
isRequired: false,
|
|
isMultiple: false,
|
|
maxFiles: 1,
|
|
allowedExtensions: ["pdf", "jpg", "jpeg", "png"],
|
|
maxSizeMb: 50,
|
|
displayOrder,
|
|
} as FileUploadField;
|
|
}
|