@redneckz/wildless-cms-uni-blocks 0.14.1042 → 0.14.1044

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/bundle/bundle.umd.js +25 -9
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/model/FormTypeFieldDef.d.ts +1 -1
  4. package/bundle/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  5. package/bundle/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  6. package/bundle/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  7. package/dist/model/FormTypeFieldDef.d.ts +1 -1
  8. package/dist/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  9. package/dist/retail/components/DraftDialog/DraftDialog.js +3 -8
  10. package/dist/retail/components/DraftDialog/DraftDialog.js.map +1 -1
  11. package/dist/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  12. package/dist/retail/components/DraftDialog/DraftDialogContent.js +11 -0
  13. package/dist/retail/components/DraftDialog/DraftDialogContent.js.map +1 -0
  14. package/dist/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  15. package/dist/retail/components/DraftDialog/creditProgramCodes.js +17 -1
  16. package/dist/retail/components/DraftDialog/creditProgramCodes.js.map +1 -1
  17. package/dist/ui-kit/DatePicker/renderDatePickerForm.js +1 -1
  18. package/dist/ui-kit/DatePicker/renderDatePickerForm.js.map +1 -1
  19. package/dist/ui-kit/Input/Input.js +2 -2
  20. package/dist/ui-kit/Input/Input.js.map +1 -1
  21. package/lib/components/ApplicationForm/ApplicationForm.fixture.d.ts +2 -0
  22. package/lib/components/ApplicationForm/ApplicationForm.fixture.mobile.d.ts +1 -0
  23. package/lib/model/FormTypeFieldDef.d.ts +1 -1
  24. package/lib/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  25. package/lib/retail/components/DraftDialog/DraftDialog.js +5 -10
  26. package/lib/retail/components/DraftDialog/DraftDialog.js.map +1 -1
  27. package/lib/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  28. package/lib/retail/components/DraftDialog/DraftDialogContent.js +9 -0
  29. package/lib/retail/components/DraftDialog/DraftDialogContent.js.map +1 -0
  30. package/lib/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  31. package/lib/retail/components/DraftDialog/creditProgramCodes.js +15 -0
  32. package/lib/retail/components/DraftDialog/creditProgramCodes.js.map +1 -1
  33. package/lib/ui-kit/DatePicker/renderDatePickerForm.js +1 -1
  34. package/lib/ui-kit/DatePicker/renderDatePickerForm.js.map +1 -1
  35. package/lib/ui-kit/Input/Input.js +2 -2
  36. package/lib/ui-kit/Input/Input.js.map +1 -1
  37. package/mobile/bundle/bundle.umd.js +25 -9
  38. package/mobile/bundle/bundle.umd.min.js +1 -1
  39. package/mobile/bundle/model/FormTypeFieldDef.d.ts +1 -1
  40. package/mobile/bundle/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  41. package/mobile/bundle/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  42. package/mobile/bundle/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  43. package/mobile/dist/model/FormTypeFieldDef.d.ts +1 -1
  44. package/mobile/dist/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  45. package/mobile/dist/retail/components/DraftDialog/DraftDialog.js +3 -8
  46. package/mobile/dist/retail/components/DraftDialog/DraftDialog.js.map +1 -1
  47. package/mobile/dist/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  48. package/mobile/dist/retail/components/DraftDialog/DraftDialogContent.js +11 -0
  49. package/mobile/dist/retail/components/DraftDialog/DraftDialogContent.js.map +1 -0
  50. package/mobile/dist/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  51. package/mobile/dist/retail/components/DraftDialog/creditProgramCodes.js +17 -1
  52. package/mobile/dist/retail/components/DraftDialog/creditProgramCodes.js.map +1 -1
  53. package/mobile/dist/ui-kit/DatePicker/renderDatePickerForm.js +1 -1
  54. package/mobile/dist/ui-kit/DatePicker/renderDatePickerForm.js.map +1 -1
  55. package/mobile/dist/ui-kit/Input/Input.js +2 -2
  56. package/mobile/dist/ui-kit/Input/Input.js.map +1 -1
  57. package/mobile/lib/model/FormTypeFieldDef.d.ts +1 -1
  58. package/mobile/lib/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  59. package/mobile/lib/retail/components/DraftDialog/DraftDialog.js +5 -10
  60. package/mobile/lib/retail/components/DraftDialog/DraftDialog.js.map +1 -1
  61. package/mobile/lib/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  62. package/mobile/lib/retail/components/DraftDialog/DraftDialogContent.js +9 -0
  63. package/mobile/lib/retail/components/DraftDialog/DraftDialogContent.js.map +1 -0
  64. package/mobile/lib/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  65. package/mobile/lib/retail/components/DraftDialog/creditProgramCodes.js +15 -0
  66. package/mobile/lib/retail/components/DraftDialog/creditProgramCodes.js.map +1 -1
  67. package/mobile/lib/ui-kit/DatePicker/renderDatePickerForm.js +1 -1
  68. package/mobile/lib/ui-kit/DatePicker/renderDatePickerForm.js.map +1 -1
  69. package/mobile/lib/ui-kit/Input/Input.js +2 -2
  70. package/mobile/lib/ui-kit/Input/Input.js.map +1 -1
  71. package/mobile/src/components/ApplicationForm/ApplicationForm.example.json +50 -0
  72. package/mobile/src/model/FormTypeFieldDef.ts +2 -1
  73. package/mobile/src/retail/components/DraftDialog/DraftDialog.tsx +14 -39
  74. package/mobile/src/retail/components/DraftDialog/DraftDialogContent.tsx +49 -0
  75. package/mobile/src/retail/components/DraftDialog/creditProgramCodes.ts +24 -0
  76. package/mobile/src/ui-kit/DatePicker/renderDatePickerForm.tsx +1 -1
  77. package/mobile/src/ui-kit/Input/Input.tsx +2 -0
  78. package/package.json +1 -1
  79. package/src/components/ApplicationForm/ApplicationForm.example.json +50 -0
  80. package/src/components/ApplicationForm/ApplicationForm.fixture.mobile.tsx +53 -0
  81. package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +55 -0
  82. package/src/model/FormTypeFieldDef.ts +2 -1
  83. package/src/retail/components/DraftDialog/DraftDialog.tsx +14 -39
  84. package/src/retail/components/DraftDialog/DraftDialogContent.tsx +49 -0
  85. package/src/retail/components/DraftDialog/creditProgramCodes.ts +24 -0
  86. package/src/ui-kit/DatePicker/renderDatePickerForm.tsx +1 -1
  87. package/src/ui-kit/Input/Input.tsx +2 -0
@@ -1,18 +1,16 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { locationNavigator } from '../../../external/locationNavigator';
4
- import type { OnCloseProps } from '../../../model/OnCloseProps';
4
+ import { type OnCloseProps } from '../../../model/OnCloseProps';
5
5
  import { Dialog } from '../../../ui-kit/DialogManager/Dialog';
6
- import { Heading } from '../../../ui-kit/Heading/Heading';
7
- import { formatDate } from '../../../utils/formatDate';
8
6
  import { noop } from '../../../utils/noop';
9
7
  import { type Task } from '../../api/draftTasksKZO';
10
8
  import { sendMessage } from '../../api/sendMessage';
11
9
  import { useRetailFormStore } from '../../hooks/useRetailFormStore';
12
10
  import { type DraftTaskType } from '../../model/DraftTaskType';
13
11
  import { checkNewMicroservice } from '../../utils/checkNewMicroservice';
14
- import { creditProgramCodeToProductIdMap } from './creditProgramCodes';
15
- import { DraftActionButton } from './DraftActionButton';
12
+ import { creditProgramCodeToProductIdMap, getCreditProgramTaskType } from './creditProgramCodes';
13
+ import { DraftDialogContent } from './DraftDialogContent';
16
14
  import { parseDraftTask } from './parseDraftTask';
17
15
  import { getProductData } from './utils';
18
16
 
@@ -24,10 +22,6 @@ export interface DraftDialogProps extends OnCloseProps {
24
22
  sendAspects?: (userId: number, taskId: number) => void;
25
23
  }
26
24
 
27
- const getTaskTypeOrDebit = (taskType?: DraftTaskType, isDebit?: boolean) => {
28
- return taskType || (isDebit ? 'debit' : undefined);
29
- };
30
-
31
25
  export const DraftDialog = JSX<DraftDialogProps>(function ({
32
26
  task,
33
27
  taskType,
@@ -39,15 +33,13 @@ export const DraftDialog = JSX<DraftDialogProps>(function ({
39
33
  const retailFormStore = useRetailFormStore();
40
34
  const navigator = locationNavigator();
41
35
  const isNewMicroservice = checkNewMicroservice();
42
-
43
36
  const { participants, participant, creditProgram, createdDate = '', id: taskId } = task;
44
-
45
37
  const programmId: string = creditProgramCodeToProductIdMap[creditProgram.code];
46
- const productData = getProductData(getTaskTypeOrDebit(taskType, isDebit));
47
-
38
+ const productData = getProductData(
39
+ taskType ?? getCreditProgramTaskType(task.creditProgram.code, isDebit),
40
+ );
48
41
  const currentParticipant = participant || participants?.[0];
49
42
  const { id: participantId, profile } = currentParticipant || {};
50
-
51
43
  const handleGoToDraft = useCallback(() => {
52
44
  const taskFromDraft = parseDraftTask(task);
53
45
  retailFormStore.participantId = participantId ?? null;
@@ -56,13 +48,11 @@ export const DraftDialog = JSX<DraftDialogProps>(function ({
56
48
  retailFormStore.userId = profile?.id ?? null;
57
49
  retailFormStore.programId = programmId;
58
50
  retailFormStore.leadForm = taskFromDraft;
59
-
60
51
  if (profile?.id) {
61
52
  sendAspects(profile.id, taskId);
62
53
  }
63
54
  navigator.assign(productData.nextStepLink);
64
55
  }, []);
65
-
66
56
  const handleGoToNewTask = useCallback(async () => {
67
57
  if (isNewMicroservice) {
68
58
  try {
@@ -79,29 +69,14 @@ export const DraftDialog = JSX<DraftDialogProps>(function ({
79
69
 
80
70
  return (
81
71
  <Dialog onClose={onClose}>
82
- <div className="flex flex-col gap-lg items-center mt-xs mx-6xl">
83
- <Heading
84
- className="whitespace-pre-wrap text-center"
85
- title="Нашли черновик вашей заявки"
86
- headingType="h5"
87
- />
88
- <div className="flex flex-col gap-m max-w-lg">
89
- <DraftActionButton
90
- title="Продолжить заполнение черновика"
91
- icon="BankColorIcon"
92
- description={createdDate ? `Черновик от ${formatDate(new Date(createdDate))}` : ''}
93
- onClick={handleGoToDraft}
94
- name="go-to-draft-button"
95
- />
96
- <DraftActionButton
97
- title={isFromLead ? 'Продолжить заполнение текущей заявки' : 'Создать новую заявку'}
98
- icon="NewLoanIcon"
99
- description={productData.description}
100
- onClick={isFromLead ? onClose : handleGoToNewTask}
101
- name="go-to-current-task-button"
102
- />
103
- </div>
104
- </div>
72
+ <DraftDialogContent
73
+ createdDate={createdDate}
74
+ productData={productData}
75
+ isFromLead={isFromLead}
76
+ handleGoToDraft={handleGoToDraft}
77
+ handleGoToNewTask={handleGoToNewTask}
78
+ onClose={onClose}
79
+ />
105
80
  </Dialog>
106
81
  );
107
82
  });
@@ -0,0 +1,49 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { type OnCloseProps } from '../../../model/OnCloseProps';
3
+ import { Heading } from '../../../ui-kit/Heading/Heading';
4
+ import { formatDate } from '../../../utils/formatDate';
5
+ import { DraftActionButton } from './DraftActionButton';
6
+ import { type getProductData } from './utils';
7
+
8
+ export interface DraftDialogContentProps extends OnCloseProps {
9
+ createdDate: string;
10
+ productData: ReturnType<typeof getProductData>;
11
+ isFromLead: boolean;
12
+ handleGoToDraft: () => void;
13
+ handleGoToNewTask: () => void;
14
+ }
15
+
16
+ export const DraftDialogContent = JSX<DraftDialogContentProps>(function ({
17
+ createdDate,
18
+ productData,
19
+ isFromLead,
20
+ handleGoToDraft,
21
+ handleGoToNewTask,
22
+ onClose,
23
+ }) {
24
+ return (
25
+ <div className="flex flex-col gap-lg items-center mt-xs mx-6xl">
26
+ <Heading
27
+ className="whitespace-pre-wrap text-center"
28
+ title="Нашли черновик вашей заявки"
29
+ headingType="h5"
30
+ />
31
+ <div className="flex flex-col gap-m max-w-lg">
32
+ <DraftActionButton
33
+ title="Продолжить заполнение черновика"
34
+ icon="BankColorIcon"
35
+ description={createdDate ? `Черновик от ${formatDate(new Date(createdDate))}` : ''}
36
+ onClick={handleGoToDraft}
37
+ name="go-to-draft-button"
38
+ />
39
+ <DraftActionButton
40
+ title={isFromLead ? 'Продолжить заполнение текущей заявки' : 'Создать новую заявку'}
41
+ icon="NewLoanIcon"
42
+ description={productData.description}
43
+ onClick={isFromLead ? onClose : handleGoToNewTask}
44
+ name="go-to-current-task-button"
45
+ />
46
+ </div>
47
+ </div>
48
+ );
49
+ });
@@ -1,5 +1,7 @@
1
1
  /* eslint-disable camelcase */
2
2
 
3
+ import { type DraftTaskType } from '../../model/DraftTaskType';
4
+
3
5
  export const creditCodesToProgrammIdMap = {
4
6
  credit_cash: '10',
5
7
  credit_cash_single_doc: '28',
@@ -38,3 +40,25 @@ export const creditProgramCodeToProductIdMap = {
38
40
  ...cardCodesToProgrammIdMap,
39
41
  ...debitCardCodesToProgrammIdMap,
40
42
  };
43
+
44
+ export const getCreditProgramTaskType = (
45
+ creditProgramCode?: string,
46
+ isDebit?: boolean,
47
+ ): DraftTaskType | undefined => {
48
+ if (isDebit || (creditProgramCode && creditProgramCode in debitCardCodesToProgrammIdMap)) {
49
+ return 'debit';
50
+ }
51
+
52
+ if (!creditProgramCode) {
53
+ return undefined;
54
+ }
55
+
56
+ if (creditProgramCode in creditCodesToProgrammIdMap) {
57
+ return 'credit';
58
+ }
59
+ if (creditProgramCode in cardCodesToProgrammIdMap) {
60
+ return 'card';
61
+ }
62
+
63
+ return undefined;
64
+ };
@@ -5,7 +5,7 @@ import { style } from '../../utils/style';
5
5
  import { DatePickerInput } from './DatePickerInput';
6
6
 
7
7
  const formStyle =
8
- 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
8
+ 'flex justify-between items-center h-14 border rounded-md cursor-pointer overflow-hidden ' +
9
9
  'hover:border-black active:border-black focus:border-black';
10
10
 
11
11
  export const renderDatePickerForm = ({
@@ -14,6 +14,7 @@ export const Input = JSX<InputProps>(
14
14
  id,
15
15
  name,
16
16
  type = 'text',
17
+ maxLength,
17
18
  label,
18
19
  placeholder,
19
20
  value = '',
@@ -64,6 +65,7 @@ export const Input = JSX<InputProps>(
64
65
  onChange={handleChange}
65
66
  onFocus={onFocus}
66
67
  onBlur={onBlur}
68
+ maxlength={maxLength}
67
69
  />
68
70
  ) : (
69
71
  <input
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.1042",
3
+ "version": "0.14.1044",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -1883,5 +1883,55 @@
1883
1883
  }
1884
1884
  }
1885
1885
  }
1886
+ ],
1887
+ [
1888
+ "Управляющие директора",
1889
+ {
1890
+ "content": {
1891
+ "version": "primary",
1892
+ "padding": "",
1893
+ "title": "Заявка на открытие счёта",
1894
+ "typeForm": "YPR",
1895
+ "endpoint": "sendcorporatelead",
1896
+ "sections": [
1897
+ {
1898
+ "columns": 2,
1899
+ "inputs": [
1900
+ { "name": "dadataPartyNameSelect", "required": true },
1901
+ { "name": "dadataPartyInnSelect", "required": true }
1902
+ ]
1903
+ },
1904
+ {
1905
+ "inputs": [{ "name": "name", "required": true }]
1906
+ },
1907
+ {
1908
+ "columns": 2,
1909
+ "inputs": [
1910
+ { "name": "region", "required": true },
1911
+ { "name": "addressBranch", "required": true }
1912
+ ]
1913
+ },
1914
+ {
1915
+ "inputs": [
1916
+ {
1917
+ "name": "partnerComments",
1918
+ "required": true,
1919
+ "placeholder": "Комментарий для сотрудника РКМ",
1920
+ "maxLength": 300
1921
+ }
1922
+ ]
1923
+ }
1924
+ ],
1925
+ "button": {
1926
+ "text": "Открыть счёт",
1927
+ "version": "primary"
1928
+ },
1929
+ "link": {
1930
+ "text": "условиями передачи данных",
1931
+ "href": "/privacy-policy",
1932
+ "target": "_blank"
1933
+ }
1934
+ }
1935
+ }
1886
1936
  ]
1887
1937
  ]
@@ -974,4 +974,57 @@ export default {
974
974
  <DialogManager />
975
975
  </div>
976
976
  ),
977
+ directorsRKO: (
978
+ <div className="container grid grid-cols-12">
979
+ <ApplicationForm
980
+ className="col-span-12"
981
+ title="Заявка на открытие счёта"
982
+ typeForm="YPR"
983
+ endpoint="sendcorporatelead"
984
+ sections={[
985
+ {
986
+ columns: 2,
987
+ inputs: [
988
+ { name: 'dadataPartyNameSelect', required: true, label: 'Полное наименование' },
989
+ { name: 'dadataPartyInnSelect', required: true, label: 'Полное наименование' },
990
+ ],
991
+ },
992
+ {
993
+ columns: 2,
994
+ inputs: [
995
+ { name: 'phone', required: true },
996
+ { name: 'email', required: true },
997
+ ],
998
+ },
999
+ {
1000
+ inputs: [{ name: 'name', required: true }],
1001
+ },
1002
+ {
1003
+ columns: 2,
1004
+ inputs: [
1005
+ { name: 'region', required: true },
1006
+ { name: 'addressBranch', required: true },
1007
+ ],
1008
+ },
1009
+ {
1010
+ inputs: [
1011
+ {
1012
+ name: 'partnerComments',
1013
+ placeholder: 'Комментарий для сотрудника РКМ',
1014
+ required: true,
1015
+ maxLength: 300,
1016
+ },
1017
+ ],
1018
+ },
1019
+ ]}
1020
+ button={{
1021
+ text: 'Открыть счёт',
1022
+ version: 'primary',
1023
+ }}
1024
+ link={linkCorp}
1025
+ />
1026
+ <PopupManager />
1027
+ <DialogManager />
1028
+ </div>
1029
+ ),
977
1030
  };
@@ -5,6 +5,7 @@ import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
5
5
  import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
6
6
  import { ApplicationForm } from './ApplicationForm';
7
7
  import { type SubmitButtonProps } from './ApplicationFormContent';
8
+ import { VerifyPhoneDialog } from './VerifyPhoneDialog';
8
9
 
9
10
  const button: SubmitButtonProps = {
10
11
  text: 'Отправить заявку',
@@ -1191,4 +1192,58 @@ export default {
1191
1192
  <DialogManager />
1192
1193
  </div>
1193
1194
  ),
1195
+ directorsRKO: (
1196
+ <div className="container grid grid-cols-12">
1197
+ <ApplicationForm
1198
+ className="col-span-12"
1199
+ title="Заявка на открытие счёта"
1200
+ typeForm="YPR"
1201
+ endpoint="sendcorporatelead"
1202
+ sections={[
1203
+ {
1204
+ columns: 2,
1205
+ inputs: [
1206
+ { name: 'dadataPartyNameSelect', required: true },
1207
+ { name: 'dadataPartyInnSelect', required: true },
1208
+ ],
1209
+ },
1210
+ {
1211
+ columns: 2,
1212
+ inputs: [
1213
+ { name: 'phone', required: true },
1214
+ { name: 'email', required: true },
1215
+ ],
1216
+ },
1217
+ {
1218
+ inputs: [{ name: 'name', required: true }],
1219
+ },
1220
+ {
1221
+ columns: 2,
1222
+ inputs: [
1223
+ { name: 'region', required: true },
1224
+ { name: 'addressBranch', required: true },
1225
+ ],
1226
+ },
1227
+ {
1228
+ inputs: [
1229
+ {
1230
+ name: 'partnerComments',
1231
+ placeholder: 'Комментарий для сотрудника РКМ',
1232
+ required: true,
1233
+ maxLength: 300,
1234
+ },
1235
+ ],
1236
+ },
1237
+ ]}
1238
+ button={{
1239
+ text: 'Открыть счёт',
1240
+ version: 'primary',
1241
+ }}
1242
+ link={linkCorp}
1243
+ />
1244
+ <PopupManager />
1245
+ <DialogManager />
1246
+ </div>
1247
+ ),
1248
+ verifyPhoneDialog: <VerifyPhoneDialog phone="79999999999" />,
1194
1249
  };
@@ -28,4 +28,5 @@ export type FormTypeFieldDef =
28
28
  | 'UNIVERSAL'
29
29
  | 'PRACTICE'
30
30
  | 'CALC'
31
- | 'REF';
31
+ | 'REF'
32
+ | 'YPR';
@@ -1,18 +1,16 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { locationNavigator } from '../../../external/locationNavigator';
4
- import type { OnCloseProps } from '../../../model/OnCloseProps';
4
+ import { type OnCloseProps } from '../../../model/OnCloseProps';
5
5
  import { Dialog } from '../../../ui-kit/DialogManager/Dialog';
6
- import { Heading } from '../../../ui-kit/Heading/Heading';
7
- import { formatDate } from '../../../utils/formatDate';
8
6
  import { noop } from '../../../utils/noop';
9
7
  import { type Task } from '../../api/draftTasksKZO';
10
8
  import { sendMessage } from '../../api/sendMessage';
11
9
  import { useRetailFormStore } from '../../hooks/useRetailFormStore';
12
10
  import { type DraftTaskType } from '../../model/DraftTaskType';
13
11
  import { checkNewMicroservice } from '../../utils/checkNewMicroservice';
14
- import { creditProgramCodeToProductIdMap } from './creditProgramCodes';
15
- import { DraftActionButton } from './DraftActionButton';
12
+ import { creditProgramCodeToProductIdMap, getCreditProgramTaskType } from './creditProgramCodes';
13
+ import { DraftDialogContent } from './DraftDialogContent';
16
14
  import { parseDraftTask } from './parseDraftTask';
17
15
  import { getProductData } from './utils';
18
16
 
@@ -24,10 +22,6 @@ export interface DraftDialogProps extends OnCloseProps {
24
22
  sendAspects?: (userId: number, taskId: number) => void;
25
23
  }
26
24
 
27
- const getTaskTypeOrDebit = (taskType?: DraftTaskType, isDebit?: boolean) => {
28
- return taskType || (isDebit ? 'debit' : undefined);
29
- };
30
-
31
25
  export const DraftDialog = JSX<DraftDialogProps>(function ({
32
26
  task,
33
27
  taskType,
@@ -39,15 +33,13 @@ export const DraftDialog = JSX<DraftDialogProps>(function ({
39
33
  const retailFormStore = useRetailFormStore();
40
34
  const navigator = locationNavigator();
41
35
  const isNewMicroservice = checkNewMicroservice();
42
-
43
36
  const { participants, participant, creditProgram, createdDate = '', id: taskId } = task;
44
-
45
37
  const programmId: string = creditProgramCodeToProductIdMap[creditProgram.code];
46
- const productData = getProductData(getTaskTypeOrDebit(taskType, isDebit));
47
-
38
+ const productData = getProductData(
39
+ taskType ?? getCreditProgramTaskType(task.creditProgram.code, isDebit),
40
+ );
48
41
  const currentParticipant = participant || participants?.[0];
49
42
  const { id: participantId, profile } = currentParticipant || {};
50
-
51
43
  const handleGoToDraft = useCallback(() => {
52
44
  const taskFromDraft = parseDraftTask(task);
53
45
  retailFormStore.participantId = participantId ?? null;
@@ -56,13 +48,11 @@ export const DraftDialog = JSX<DraftDialogProps>(function ({
56
48
  retailFormStore.userId = profile?.id ?? null;
57
49
  retailFormStore.programId = programmId;
58
50
  retailFormStore.leadForm = taskFromDraft;
59
-
60
51
  if (profile?.id) {
61
52
  sendAspects(profile.id, taskId);
62
53
  }
63
54
  navigator.assign(productData.nextStepLink);
64
55
  }, []);
65
-
66
56
  const handleGoToNewTask = useCallback(async () => {
67
57
  if (isNewMicroservice) {
68
58
  try {
@@ -79,29 +69,14 @@ export const DraftDialog = JSX<DraftDialogProps>(function ({
79
69
 
80
70
  return (
81
71
  <Dialog onClose={onClose}>
82
- <div className="flex flex-col gap-lg items-center mt-xs mx-6xl">
83
- <Heading
84
- className="whitespace-pre-wrap text-center"
85
- title="Нашли черновик вашей заявки"
86
- headingType="h5"
87
- />
88
- <div className="flex flex-col gap-m max-w-lg">
89
- <DraftActionButton
90
- title="Продолжить заполнение черновика"
91
- icon="BankColorIcon"
92
- description={createdDate ? `Черновик от ${formatDate(new Date(createdDate))}` : ''}
93
- onClick={handleGoToDraft}
94
- name="go-to-draft-button"
95
- />
96
- <DraftActionButton
97
- title={isFromLead ? 'Продолжить заполнение текущей заявки' : 'Создать новую заявку'}
98
- icon="NewLoanIcon"
99
- description={productData.description}
100
- onClick={isFromLead ? onClose : handleGoToNewTask}
101
- name="go-to-current-task-button"
102
- />
103
- </div>
104
- </div>
72
+ <DraftDialogContent
73
+ createdDate={createdDate}
74
+ productData={productData}
75
+ isFromLead={isFromLead}
76
+ handleGoToDraft={handleGoToDraft}
77
+ handleGoToNewTask={handleGoToNewTask}
78
+ onClose={onClose}
79
+ />
105
80
  </Dialog>
106
81
  );
107
82
  });
@@ -0,0 +1,49 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { type OnCloseProps } from '../../../model/OnCloseProps';
3
+ import { Heading } from '../../../ui-kit/Heading/Heading';
4
+ import { formatDate } from '../../../utils/formatDate';
5
+ import { DraftActionButton } from './DraftActionButton';
6
+ import { type getProductData } from './utils';
7
+
8
+ export interface DraftDialogContentProps extends OnCloseProps {
9
+ createdDate: string;
10
+ productData: ReturnType<typeof getProductData>;
11
+ isFromLead: boolean;
12
+ handleGoToDraft: () => void;
13
+ handleGoToNewTask: () => void;
14
+ }
15
+
16
+ export const DraftDialogContent = JSX<DraftDialogContentProps>(function ({
17
+ createdDate,
18
+ productData,
19
+ isFromLead,
20
+ handleGoToDraft,
21
+ handleGoToNewTask,
22
+ onClose,
23
+ }) {
24
+ return (
25
+ <div className="flex flex-col gap-lg items-center mt-xs mx-6xl">
26
+ <Heading
27
+ className="whitespace-pre-wrap text-center"
28
+ title="Нашли черновик вашей заявки"
29
+ headingType="h5"
30
+ />
31
+ <div className="flex flex-col gap-m max-w-lg">
32
+ <DraftActionButton
33
+ title="Продолжить заполнение черновика"
34
+ icon="BankColorIcon"
35
+ description={createdDate ? `Черновик от ${formatDate(new Date(createdDate))}` : ''}
36
+ onClick={handleGoToDraft}
37
+ name="go-to-draft-button"
38
+ />
39
+ <DraftActionButton
40
+ title={isFromLead ? 'Продолжить заполнение текущей заявки' : 'Создать новую заявку'}
41
+ icon="NewLoanIcon"
42
+ description={productData.description}
43
+ onClick={isFromLead ? onClose : handleGoToNewTask}
44
+ name="go-to-current-task-button"
45
+ />
46
+ </div>
47
+ </div>
48
+ );
49
+ });
@@ -1,5 +1,7 @@
1
1
  /* eslint-disable camelcase */
2
2
 
3
+ import { type DraftTaskType } from '../../model/DraftTaskType';
4
+
3
5
  export const creditCodesToProgrammIdMap = {
4
6
  credit_cash: '10',
5
7
  credit_cash_single_doc: '28',
@@ -38,3 +40,25 @@ export const creditProgramCodeToProductIdMap = {
38
40
  ...cardCodesToProgrammIdMap,
39
41
  ...debitCardCodesToProgrammIdMap,
40
42
  };
43
+
44
+ export const getCreditProgramTaskType = (
45
+ creditProgramCode?: string,
46
+ isDebit?: boolean,
47
+ ): DraftTaskType | undefined => {
48
+ if (isDebit || (creditProgramCode && creditProgramCode in debitCardCodesToProgrammIdMap)) {
49
+ return 'debit';
50
+ }
51
+
52
+ if (!creditProgramCode) {
53
+ return undefined;
54
+ }
55
+
56
+ if (creditProgramCode in creditCodesToProgrammIdMap) {
57
+ return 'credit';
58
+ }
59
+ if (creditProgramCode in cardCodesToProgrammIdMap) {
60
+ return 'card';
61
+ }
62
+
63
+ return undefined;
64
+ };
@@ -5,7 +5,7 @@ import { style } from '../../utils/style';
5
5
  import { DatePickerInput } from './DatePickerInput';
6
6
 
7
7
  const formStyle =
8
- 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
8
+ 'flex justify-between items-center h-14 border rounded-md cursor-pointer overflow-hidden ' +
9
9
  'hover:border-black active:border-black focus:border-black';
10
10
 
11
11
  export const renderDatePickerForm = ({
@@ -14,6 +14,7 @@ export const Input = JSX<InputProps>(
14
14
  id,
15
15
  name,
16
16
  type = 'text',
17
+ maxLength,
17
18
  label,
18
19
  placeholder,
19
20
  value = '',
@@ -64,6 +65,7 @@ export const Input = JSX<InputProps>(
64
65
  onChange={handleChange}
65
66
  onFocus={onFocus}
66
67
  onBlur={onBlur}
68
+ maxlength={maxLength}
67
69
  />
68
70
  ) : (
69
71
  <input