Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Registration": "",
"Team": "",
"Work space": "",
"Comments": ""
"Comments": "",
"Required field": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Old organizational group": "Подразделение откуда переводится ",
"Write old organizational group name": "Введите название подразделения",
"Old supervisor": "Прошлый руководитель",
"Write old supervisor full name": "Введите ФИО руководителя"
"Write old supervisor full name": "Введите ФИО руководителя",
"Required field": "Обязательное поле"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useRef, useMemo, useEffect } from 'react';
import { z } from 'zod';
import { FormProvider, useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { Text } from '@taskany/bricks/harmony';
Expand Down Expand Up @@ -38,6 +39,26 @@ interface TransferUserInsidePageProps {
requestStatus?: UserCreationRequestStatus;
}

const schema = createTransferInsideSchema().superRefine(({ status, equipment, workMode }, ctx) => {
if (status !== UserCreationRequestStatus.Draft) {
if (equipment === '') {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: tr('Required field'),
path: ['equipment'],
});
}

if (workMode === '') {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: tr('Required field'),
path: ['workMode'],
});
}
}
});

export const TransferUserInsidePage = ({
requestId,
user,
Expand All @@ -59,6 +80,7 @@ export const TransferUserInsidePage = ({
const defaultValues: Partial<CreateTransferInside> = useMemo(
() => ({
type: UserCreationRequestType.transferInside,
status: request?.status,
disableAccount: request?.disableAccount,
userId: user.id,
email: user.email,
Expand Down Expand Up @@ -112,7 +134,7 @@ export const TransferUserInsidePage = ({
const rootRef = useRef<HTMLDivElement>(null);

const methods = useForm<CreateTransferInside>({
resolver: zodResolver(createTransferInsideSchema()),
resolver: zodResolver(schema),
defaultValues,
});

Expand Down
6 changes: 4 additions & 2 deletions src/modules/scheduledDeactivationMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ interface UserDissmissMailing {
organization: OrganizationUnit;
teamlead: string;
role: string;
sessionUserId: string;
sessionUserId?: string;
attaches?: Attach[];
phone: string;
sigmaMail?: string;
Expand Down Expand Up @@ -177,7 +177,9 @@ export const sendDismissalEmails = async ({
return;
}

const additionalEmails = [sessionUserId];
const additionalEmails: string[] = [];

if (sessionUserId) additionalEmails.push(sessionUserId);

if (request.creatorId) additionalEmails.push(request.creatorId);

Expand Down
Loading