feat: added unique request form code to forms
Tests / frontend-test (push) Successful in 1m7s

This commit is contained in:
Тимур Городецкий
2026-08-10 16:59:20 +05:00
parent 9aa8f88d66
commit dcf3f06121
12 changed files with 85 additions and 29 deletions
@@ -0,0 +1,11 @@
/**
* Уникальный код заявки: {requestTypeId}-{YY}{MM}-{itemId}.
* requestTypeId — id типа заявки во внешнем approval-route API (GET /api/request-types).
* YY/MM — год и месяц подачи, itemId — Id элемента в списке данных. Пример: 1-2608-12.
*/
export function buildRequestUniqueCode(requestTypeId: number, itemId: number, submittedAt: Date): string {
const yy = String(submittedAt.getFullYear()).slice(-2);
const month = submittedAt.getMonth() + 1;
const mm = month < 10 ? `0${month}` : String(month);
return `${requestTypeId}-${yy}${mm}-${itemId}`;
}