Skip to content

Commit fddd8b7

Browse files
committed
fix(INTERNAL-1851): decree fixes
1 parent 6dcfc69 commit fddd8b7

22 files changed

Lines changed: 132 additions & 56 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterEnum
2+
ALTER TYPE "UserCreationRequestStatus" ADD VALUE 'Completed';

prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ enum UserCreationRequestStatus {
167167
Approved
168168
Denied
169169
Canceled
170+
Completed
170171
}
171172

172173
model UserCreationRequest {

src/components/DecreeForm/DecreeForm.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export const DecreeForm: FC<DecreeFormProps> = ({
5757
resolver: zodResolver(userDecreeSchema),
5858
defaultValues,
5959
});
60-
6160
const {
6261
handleSubmit,
6362
setValue,
@@ -214,7 +213,7 @@ export const DecreeForm: FC<DecreeFormProps> = ({
214213
<UserFormWorkSpaceBlock
215214
id="work-space"
216215
className={s.FormBlock}
217-
requestType={type === 'toDecree' ? 'dismissal' : 'employment'}
216+
requestType={type}
218217
type={mode === 'read' ? 'readOnly' : 'edit'}
219218
/>
220219

src/components/RequestFormActions/RequestFormActions.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ export const RequestFormActions = ({
153153
requestType === UserCreationRequestType.externalFromMainOrgEmployee ||
154154
requestType === UserCreationRequestType.internalEmployee);
155155

156+
const isCompletedDecreeRequest = requestStatus === 'Completed' && requestType === UserCreationRequestType.toDecree;
157+
156158
return (
157159
<div className={s.FormActions}>
158160
{nullable(canEditRequest, () => (
@@ -172,7 +174,7 @@ export const RequestFormActions = ({
172174
</div>
173175
))}
174176

175-
{nullable(requestStatus !== 'Canceled', () => (
177+
{nullable(requestStatus !== 'Canceled' && !isCompletedDecreeRequest, () => (
176178
<Button
177179
ref={cancelRef}
178180
iconLeft={small && <IconDeniedOutline size="s" />}

src/components/UserCreateRequestsPage/UserCreateRequestsPage.i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
"Transfer intern to staff": "",
2020
"Transfer inside SD": "",
2121
"Draft": "",
22-
"New supplemental position": ""
22+
"New supplemental position": "",
23+
"Completed": ""
2324
}

src/components/UserCreateRequestsPage/UserCreateRequestsPage.i18n/ru.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
"Transfer intern to staff": "Перевод стажера в штат",
2020
"Transfer inside SD": "Перевод внутри SD",
2121
"Draft": "Черновик",
22-
"New supplemental position": "Новое совмещение"
22+
"New supplemental position": "Новое совмещение",
23+
"Completed": "Выполнена"
2324
}

src/components/UserCreateRequestsPage/UserCreateRequestsPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,12 @@ export const UserCreateRequestsPage = () => {
137137
id: request.id,
138138
}));
139139

140-
const statusText = (status: 'Approved' | 'Denied' | 'Canceled' | 'Draft' | null) => {
140+
const statusText = (status: 'Approved' | 'Denied' | 'Canceled' | 'Draft' | 'Completed' | null) => {
141141
if (status === 'Approved') return tr('Approved');
142142
if (status === 'Denied') return tr('Denied');
143143
if (status === 'Canceled') return tr('Canceled');
144144
if (status === 'Draft') return tr('Draft');
145+
if (status === 'Completed') return tr('Completed');
145146
return tr('Under concideration');
146147
};
147148

src/components/UserFormAttaches/UserFormAttaches.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ const Attaches = ({
3333
requestType: string;
3434
}) => {
3535
const requestQuery =
36-
requestType === 'transferInternToStaff' || requestType === UserCreationRequestType.transferInside
36+
requestType === 'transferInternToStaff' ||
37+
requestType === UserCreationRequestType.transferInside ||
38+
requestType === UserCreationRequestType.toDecree
3739
? trpc.userCreationRequest.getById.useQuery(id, { enabled: !!id })
3840
: trpc.scheduledDeactivation.getById.useQuery(id, { enabled: !!id });
3941

src/components/UserFormPersonalDataBlock/UserFormPersonalDataBlock.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,14 +313,10 @@ export const UserFormPersonalDataBlock = ({ className, id, type, readOnly = true
313313
>
314314
<FormControlInput
315315
readOnly={getReadOnly('personalEmail')}
316-
value={
317-
getReadOnly('personalEmail') && !watch('personalEmail')
318-
? tr('Not specified')
319-
: undefined
320-
}
316+
value={watch('personalEmail')}
321317
autoComplete="off"
322318
size="m"
323-
placeholder="name@mail.com"
319+
placeholder={getReadOnly('personalEmail') ? tr('Not specified') : 'name@mail.com'}
324320
outline
325321
{...register('personalEmail', { onChange: onEmailChange })}
326322
/>
@@ -345,12 +341,10 @@ export const UserFormPersonalDataBlock = ({ className, id, type, readOnly = true
345341
>
346342
<FormControlInput
347343
readOnly={getReadOnly('workEmail')}
348-
value={
349-
getReadOnly('workEmail') && !watch('workEmail') ? tr('Not specified') : undefined
350-
}
344+
value={watch('workEmail')}
351345
autoComplete="off"
352346
size="m"
353-
placeholder="email@example.com"
347+
placeholder={getReadOnly('workEmail') ? tr('Not specified') : 'email@example.com'}
354348
outline
355349
{...register('workEmail', { onChange: onEmailChange })}
356350
/>

src/components/UserFormWorkSpaceBlock/UserFormWorkSpaceBlock.i18n/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@
1414
"Not specified": "",
1515
"Required euipment": "",
1616
"Test devices": "",
17-
"Workspace № in format 6.01.195": ""
17+
"Workspace № in format 6.01.195": "",
18+
"Application №": "",
19+
"Application for return of equipment": ""
1820
}

0 commit comments

Comments
 (0)