@banch0u/core-project-test-repository 1.8.3 → 1.9.0

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 (69) hide show
  1. package/dist/assets/css/antd.css +836 -0
  2. package/dist/assets/css/variables.css +6 -0
  3. package/dist/assets/icons/index.js +424 -1
  4. package/dist/components/Button/index.module.scss +14 -2
  5. package/dist/components/Delete/Delete.js +22 -0
  6. package/dist/components/Delete/Delete.module.scss +22 -0
  7. package/dist/components/DeleteModal/DeleteModal.js +31 -0
  8. package/dist/components/DeleteModal/DeleteModal.module.scss +11 -0
  9. package/dist/components/Filter/index.js +1 -1
  10. package/dist/components/Input/index.js +1 -2
  11. package/dist/components/Input/index.module.scss +21 -12
  12. package/dist/components/ProfileOptions/index.js +109 -66
  13. package/dist/components/ProfileOptions/index.module.scss +144 -12
  14. package/dist/components/Success/Success.js +19 -0
  15. package/dist/components/Success/Success.module.scss +26 -0
  16. package/dist/components/Table/index.js +4 -2
  17. package/dist/components/ViewModal/index.js +30 -0
  18. package/dist/helpers/paginationLength.js +3 -0
  19. package/dist/helpers/querySearch.js +22 -0
  20. package/dist/index.js +6 -0
  21. package/dist/layout/Header/AppSelect/index.js +107 -0
  22. package/dist/layout/Header/AppSelect/index.module.scss +68 -0
  23. package/dist/layout/Header/index.js +6 -84
  24. package/dist/layout/Header/index.module.scss +8 -12
  25. package/dist/layout/Portal/index.js +23 -0
  26. package/dist/layout/QuestionnairesLayout/index.js +17 -0
  27. package/dist/layout/QuestionnairesLayout/index.module.scss +0 -0
  28. package/dist/layout/QuestionnairesSidebar/index.js +126 -0
  29. package/dist/layout/QuestionnairesSidebar/index.module.scss +76 -0
  30. package/dist/layout/Sidebar/index.js +147 -0
  31. package/dist/layout/Sidebar/index.module.scss +50 -0
  32. package/dist/pages/Platform/constant.js +29 -2
  33. package/dist/pages/Platform/index.js +19 -30
  34. package/dist/pages/Platform/index.module.scss +20 -5
  35. package/dist/pages/Questionnnaires/Questionnaires.module.scss +194 -0
  36. package/dist/pages/Questionnnaires/QuestionnairesApplicationFormContent/constant.js +58 -0
  37. package/dist/pages/Questionnnaires/QuestionnairesApplicationFormContent/index.js +255 -0
  38. package/dist/pages/Questionnnaires/QuestionnairesCountriesContent/constant.js +58 -0
  39. package/dist/pages/Questionnnaires/QuestionnairesCountriesContent/index.js +247 -0
  40. package/dist/pages/Questionnnaires/QuestionnairesDeliveryMethodContent/constant.js +58 -0
  41. package/dist/pages/Questionnnaires/QuestionnairesDeliveryMethodContent/index.js +247 -0
  42. package/dist/pages/Questionnnaires/QuestionnairesDocumentRecieveMethodsContent/constant.js +58 -0
  43. package/dist/pages/Questionnnaires/QuestionnairesDocumentRecieveMethodsContent/index.js +258 -0
  44. package/dist/pages/Questionnnaires/QuestionnairesDocumentTypeContent/constant.js +58 -0
  45. package/dist/pages/Questionnnaires/QuestionnairesDocumentTypeContent/index.js +284 -0
  46. package/dist/pages/Questionnnaires/QuestionnairesDocumentWhomContent/constant.js +82 -0
  47. package/dist/pages/Questionnnaires/QuestionnairesDocumentWhomContent/index.js +331 -0
  48. package/dist/pages/Questionnnaires/QuestionnairesExecutionRulesContent/constant.js +58 -0
  49. package/dist/pages/Questionnnaires/QuestionnairesExecutionRulesContent/index.js +258 -0
  50. package/dist/pages/Questionnnaires/QuestionnairesMarginNoteTextsContent/constant.js +58 -0
  51. package/dist/pages/Questionnnaires/QuestionnairesMarginNoteTextsContent/index.js +249 -0
  52. package/dist/pages/Questionnnaires/QuestionnairesOrganizationsContent/constant.js +88 -0
  53. package/dist/pages/Questionnnaires/QuestionnairesOrganizationsContent/index.js +320 -0
  54. package/dist/pages/Questionnnaires/QuestionnairesStreetsContent/constant.js +58 -0
  55. package/dist/pages/Questionnnaires/QuestionnairesStreetsContent/index.js +240 -0
  56. package/dist/pages/Questionnnaires/QuestionnairesStructuresContent/constant.js +58 -0
  57. package/dist/pages/Questionnnaires/QuestionnairesStructuresContent/index.js +247 -0
  58. package/dist/pages/Questionnnaires/QuestionnairesSubtopicContent/constant.js +58 -0
  59. package/dist/pages/Questionnnaires/QuestionnairesSubtopicContent/index.js +317 -0
  60. package/dist/pages/Questionnnaires/QuestionnairesTopicContent/constant.js +58 -0
  61. package/dist/pages/Questionnnaires/QuestionnairesTopicContent/index.js +271 -0
  62. package/dist/pages/Questionnnaires/index.js +5 -0
  63. package/dist/routes/QuestionnaireRoutes.js +108 -0
  64. package/dist/store/slices/global/index.js +96 -3
  65. package/dist/store/slices/questionnaire/index.js +2500 -0
  66. package/dist/store/slices/questionnaire/service.js +1557 -0
  67. package/dist/store/store.js +2 -1
  68. package/dist/utils/path.js +30 -1
  69. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { ContractsIcon, DocumentCirculationIcon, HRIcon } from "../../assets/icons";
2
+ import { ContractsIcon, DocumentCirculationIcon, HRIcon, ArchiveIcon, TransportIcon, LabIcon, UserIcon } from "../../assets/icons";
3
3
  var rootUrl;
4
4
  if (window.location.hostname === "localhost") {
5
5
  rootUrl = "http://localhost:" + window.location.port;
@@ -14,7 +14,7 @@ export var entryData = [{
14
14
  scopes: "docflow"
15
15
  }, {
16
16
  id: 2,
17
- value: " Kadrlar sistemi",
17
+ value: "Kadrlar sistemi",
18
18
  pathname: "".concat(rootUrl, "/hr/hr"),
19
19
  icon: /*#__PURE__*/React.createElement(HRIcon, null),
20
20
  scopes: "hr"
@@ -24,4 +24,31 @@ export var entryData = [{
24
24
  pathname: "".concat(rootUrl, "/contracts/unread-contract"),
25
25
  icon: /*#__PURE__*/React.createElement(ContractsIcon, null),
26
26
  scopes: "contracts"
27
+ }, {
28
+ id: 4,
29
+ value: "Şəxsi Kabinet",
30
+ pathname: "".concat(rootUrl, "/account/private"),
31
+ icon: /*#__PURE__*/React.createElement(UserIcon, null),
32
+ scopes: "account"
33
+ }, {
34
+ id: 5,
35
+ value: "Arxiv",
36
+ pathname: "".concat(rootUrl, "/archive/organization-administrative"),
37
+ icon: /*#__PURE__*/React.createElement(ArchiveIcon, null),
38
+ scopes: "archive",
39
+ construction: true
40
+ }, {
41
+ id: 6,
42
+ value: "Nəqliyyat",
43
+ pathname: "".concat(rootUrl, "/transport"),
44
+ icon: /*#__PURE__*/React.createElement(TransportIcon, null),
45
+ scopes: "transport",
46
+ construction: true
47
+ }, {
48
+ id: 7,
49
+ value: "Laboratoriya",
50
+ pathname: "".concat(rootUrl, "/lab"),
51
+ icon: /*#__PURE__*/React.createElement(LabIcon, null),
52
+ scopes: "lab",
53
+ construction: true
27
54
  }];
@@ -7,7 +7,7 @@ import { entryData } from "./constant";
7
7
  import { Link } from "react-router-dom";
8
8
  import { getProfileInfo, scopes } from "../../store/slices/auth";
9
9
  import { useSelector, useDispatch } from "react-redux";
10
- import { DsgLogo, SettingsCogIcon, UserIcon } from "../../assets/icons";
10
+ import { DsgLogo, SettingsCogIcon, ConstructionRibbon } from "../../assets/icons";
11
11
  import { SETTINGS_PERMISSIONS } from "../../utils/path";
12
12
  import { getCompanyInfo } from "../../store/slices/companyInfo";
13
13
  import api from "../../utils/axios";
@@ -107,39 +107,28 @@ var Platform = function Platform() {
107
107
  }, "Data Platform"), /*#__PURE__*/React.createElement("div", {
108
108
  className: style.links
109
109
  }, entryData === null || entryData === void 0 ? void 0 : entryData.map(function (item) {
110
- if (scopesData === "*") {
111
- return /*#__PURE__*/React.createElement(Link, {
112
- to: item === null || item === void 0 ? void 0 : item.pathname,
113
- key: item === null || item === void 0 ? void 0 : item.id
114
- }, item === null || item === void 0 ? void 0 : item.icon, /*#__PURE__*/React.createElement("div", {
115
- "data-no-invert": true
116
- }, item === null || item === void 0 ? void 0 : item.value));
117
- } else {
118
- if (!(scopesData !== null && scopesData !== void 0 && scopesData.includes(item.scopes))) {
119
- return /*#__PURE__*/React.createElement("div", {
120
- className: style.disableMenu,
121
- key: item === null || item === void 0 ? void 0 : item.id
122
- }, item === null || item === void 0 ? void 0 : item.icon, /*#__PURE__*/React.createElement("div", {
123
- "data-no-invert": true
124
- }, item === null || item === void 0 ? void 0 : item.value));
125
- } else {
126
- return /*#__PURE__*/React.createElement(Link, {
127
- to: item === null || item === void 0 ? void 0 : item.pathname,
128
- key: item === null || item === void 0 ? void 0 : item.id
129
- }, item === null || item === void 0 ? void 0 : item.icon, /*#__PURE__*/React.createElement("div", {
130
- "data-no-invert": true
131
- }, item === null || item === void 0 ? void 0 : item.value));
132
- }
110
+ if (item.construction && window.location.hostname.includes("intranet")) {
111
+ return null;
133
112
  }
134
- }), /*#__PURE__*/React.createElement(Link, {
135
- to: "".concat(rootUrl, "/accounts/private")
136
- }, /*#__PURE__*/React.createElement(UserIcon, null), /*#__PURE__*/React.createElement("div", {
137
- "data-no-invert": true
138
- }, "\u015E\u0259xsi kabinet")))), /*#__PURE__*/React.createElement("div", {
113
+ var isPrivate = item.scopes === "account";
114
+ var ItemContent = /*#__PURE__*/React.createElement(React.Fragment, null, item === null || item === void 0 ? void 0 : item.icon, /*#__PURE__*/React.createElement("div", {
115
+ "data-no-invert": true
116
+ }, item === null || item === void 0 ? void 0 : item.value));
117
+ return /*#__PURE__*/React.createElement("div", {
118
+ className: style.itemWrapper,
119
+ key: item === null || item === void 0 ? void 0 : item.id
120
+ }, (item === null || item === void 0 ? void 0 : item.construction) && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(ConstructionRibbon, null)), scopesData === "*" || isPrivate ? /*#__PURE__*/React.createElement(Link, {
121
+ to: item === null || item === void 0 ? void 0 : item.pathname
122
+ }, ItemContent) : !(scopesData !== null && scopesData !== void 0 && scopesData.includes(item.scopes)) ? /*#__PURE__*/React.createElement("div", {
123
+ className: style.disableMenu
124
+ }, ItemContent) : /*#__PURE__*/React.createElement(Link, {
125
+ to: item === null || item === void 0 ? void 0 : item.pathname
126
+ }, ItemContent));
127
+ }))), /*#__PURE__*/React.createElement("div", {
139
128
  className: style.settings_button,
140
129
  "data-no-invert-2": true
141
130
  }, scopesData === "*" ? /*#__PURE__*/React.createElement(Link, {
142
- to: "".concat(rootUrl, "/docflow/").concat(SETTINGS_PERMISSIONS)
131
+ to: "".concat(rootUrl, "/docflow").concat(SETTINGS_PERMISSIONS)
143
132
  }, /*#__PURE__*/React.createElement(SettingsCogIcon, null), /*#__PURE__*/React.createElement("div", {
144
133
  "data-no-invert": true
145
134
  }, "T\u0259nziml\u0259m\u0259l\u0259r")) : null));
@@ -3,19 +3,19 @@
3
3
  width: 100%;
4
4
  align-items: center;
5
5
  flex-direction: column;
6
- padding-top: 87px;
6
+ padding-top: 47px;
7
7
  height: 100vh;
8
8
  background: #f8f8f8;
9
9
  .logo {
10
10
  svg {
11
11
  width: 250px;
12
12
  height: auto;
13
- margin-bottom: 165px;
13
+ margin-bottom: 40px;
14
14
  }
15
15
  img {
16
16
  width: 250px;
17
17
  height: auto;
18
- margin-bottom: 85px;
18
+ margin-bottom: 40px;
19
19
  }
20
20
  }
21
21
  .buttons {
@@ -34,7 +34,8 @@
34
34
  margin-bottom: 37px;
35
35
  }
36
36
  .links {
37
- display: flex;
37
+ display: grid;
38
+ grid-template-columns: repeat(4, 1fr);
38
39
  justify-content: space-between;
39
40
  gap: 30px;
40
41
  a {
@@ -57,6 +58,8 @@
57
58
  color: var(--darkBlueColor);
58
59
  svg {
59
60
  margin-top: 45px;
61
+ height: 70px;
62
+ width: auto;
60
63
  }
61
64
  }
62
65
  .disableMenu {
@@ -78,8 +81,11 @@
78
81
  color: #979797;
79
82
  svg {
80
83
  margin-top: 45px;
84
+ height: 70px;
85
+ width: auto;
81
86
  path {
82
- fill: #979797;
87
+ filter: brightness(0) saturate(100%) invert(66%) sepia(0%)
88
+ saturate(2270%) hue-rotate(123deg) brightness(88%) contrast(94%);
83
89
  }
84
90
  }
85
91
  }
@@ -108,3 +114,12 @@
108
114
  }
109
115
  }
110
116
  }
117
+ .itemWrapper {
118
+ position: relative;
119
+ overflow: hidden;
120
+ span {
121
+ position: absolute;
122
+ top: 28px;
123
+ right: -7px;
124
+ }
125
+ }
@@ -0,0 +1,194 @@
1
+ .layout {
2
+ margin: 20px;
3
+ border-radius: 12px;
4
+ height: auto;
5
+ background: unset;
6
+ .content {
7
+ margin-bottom: 30px;
8
+ background: #fff;
9
+ border-radius: 12px;
10
+ max-height: calc(100vh - 85px) !important;
11
+ overflow: hidden;
12
+ .table_header {
13
+ padding: 14px;
14
+ padding-bottom: 18px;
15
+ display: flex;
16
+ justify-content: space-between;
17
+ align-items: center;
18
+ h2 {
19
+ font-size: 26px;
20
+ font-weight: 500;
21
+ line-height: 39px;
22
+ text-align: left;
23
+ }
24
+ .buttons {
25
+ display: flex;
26
+ gap: 10px;
27
+ .search {
28
+ width: 168px;
29
+ margin: 0 auto;
30
+ display: flex;
31
+ justify-content: center;
32
+ height: 36px;
33
+ font-size: 16px !important;
34
+ font-weight: 500 !important;
35
+ line-height: 24px !important;
36
+ text-align: left !important;
37
+ border-radius: 6px;
38
+ padding: 6px 10px !important;
39
+ .search_icon {
40
+ display: flex;
41
+ align-items: center;
42
+ cursor: pointer;
43
+ svg {
44
+ path {
45
+ transition: 250ms;
46
+ }
47
+ }
48
+ svg:hover {
49
+ path {
50
+ stroke: var(--darkBlueColor);
51
+ transition: 250ms;
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+ .layout1 {
60
+ // margin-left: 24px;
61
+ // margin-right: 20px;
62
+ // margin-top: 20px;
63
+ border-radius: 12px;
64
+ height: auto;
65
+ background: unset;
66
+ .content {
67
+ margin-bottom: 0px;
68
+ background: #fff !important;
69
+ border-radius: 12px;
70
+ max-height: calc(100vh - 85px) !important;
71
+ overflow: hidden;
72
+ display: block;
73
+ border: 1px solid var(--blue);
74
+ padding: 0 !important;
75
+ padding-bottom: 10px !important;
76
+
77
+ table {
78
+ // th {
79
+ // text-align: left !important;
80
+ // padding-left: 5px !important;
81
+ // }
82
+ th:nth-child(2),
83
+ th:nth-child(3) {
84
+ text-align: left !important;
85
+ padding-left: 20px !important;
86
+ }
87
+
88
+ // td {
89
+ // text-align: left !important;
90
+ // padding-left: 5px !important;
91
+ // }
92
+ td:nth-child(2),
93
+ td:nth-child(3) {
94
+ text-align: left !important;
95
+ padding-left: 20px !important;
96
+ }
97
+ }
98
+ }
99
+ }
100
+ .content:first-child {
101
+ // display: flex;
102
+ justify-content: space-between;
103
+ align-items: center;
104
+ padding: 0;
105
+ flex: unset;
106
+ padding: 15px;
107
+ margin-bottom: 20px;
108
+ background: var(--lightBlue);
109
+
110
+ .header {
111
+ display: flex;
112
+ width: 100%;
113
+ justify-content: space-between;
114
+ align-items: center;
115
+ button {
116
+ width: unset;
117
+ }
118
+ }
119
+ }
120
+
121
+ .pagination {
122
+ margin-left: 15px;
123
+ margin-top: 1px;
124
+ display: flex;
125
+ gap: 10px;
126
+ align-items: center;
127
+ p {
128
+ margin-top: 10px;
129
+ }
130
+ }
131
+ }
132
+
133
+ .search_filter {
134
+ button {
135
+ padding: 4px 8px;
136
+ font-size: 12px;
137
+ display: flex;
138
+ align-items: center;
139
+ justify-content: center;
140
+ gap: 2px;
141
+ width: 90px;
142
+ }
143
+ }
144
+
145
+ .number {
146
+ display: flex;
147
+ align-items: center;
148
+ justify-content: space-between;
149
+ p {
150
+ font-family: Inter !important;
151
+ font-size: 18px !important;
152
+ font-weight: 400 !important;
153
+ line-height: 21.78px !important;
154
+ }
155
+ .actions {
156
+ margin-left: 8%;
157
+ display: flex;
158
+ justify-content: center;
159
+ vertical-align: middle;
160
+ background: transparent !important;
161
+ margin-right: 9px;
162
+ gap: 10px;
163
+ svg {
164
+ cursor: pointer;
165
+ }
166
+ }
167
+ }
168
+ .actions > div {
169
+ background: #deeaf6;
170
+ display: flex;
171
+ align-items: center;
172
+ justify-content: center;
173
+ padding: 3px;
174
+ border-radius: 4px;
175
+ }
176
+ .actions > div:last-child {
177
+ background: #f6dedf;
178
+ display: flex;
179
+ align-items: center;
180
+ justify-content: center;
181
+ padding: 3px;
182
+ border-radius: 4px;
183
+ }
184
+ .modal_input {
185
+ // padding: 9px 16px !important;
186
+ // border: 1px solid #bdbdbd !important;
187
+ border-radius: 6px !important;
188
+ font-size: 16px !important;
189
+ font-weight: 500 !important;
190
+ line-height: 24px !important;
191
+ text-align: left !important;
192
+ height: 48px;
193
+ width: 100%;
194
+ }
@@ -0,0 +1,58 @@
1
+ import React from "react";
2
+ import { Switch, Tooltip } from "antd";
3
+ import style from "../Questionnaires.module.scss";
4
+ import { setDeleteModalVisible } from "../../../store/slices/global";
5
+ import { DeleteIconQ, EditIcon } from "../../../assets/icons";
6
+ export var getStreetColumns = function getStreetColumns(onEditClick, onDelete, onStatusChange, dispatch, innerW) {
7
+ return [{
8
+ title: "№",
9
+ dataIndex: "num",
10
+ showCheckbox: false,
11
+ ellipsis: true,
12
+ width: 35
13
+ }, {
14
+ title: "Mövzu",
15
+ dataIndex: "name",
16
+ width: innerW,
17
+ disabled: true,
18
+ ellipsis: true
19
+ }, {
20
+ title: "Status",
21
+ key: "status",
22
+ disabled: true,
23
+ filter: false,
24
+ render: function render(data) {
25
+ return /*#__PURE__*/React.createElement(Tooltip, {
26
+ placement: "top",
27
+ title: "Statusu d\u0259yi\u015F"
28
+ }, /*#__PURE__*/React.createElement(Switch, {
29
+ size: "medium",
30
+ checked: data === null || data === void 0 ? void 0 : data.isActive,
31
+ onChange: function onChange(checked) {
32
+ return onStatusChange(data, checked, dispatch);
33
+ }
34
+ }));
35
+ }
36
+ }, {
37
+ title: "",
38
+ key: "actions",
39
+ showCheckbox: false,
40
+ width: 80,
41
+ render: function render(data) {
42
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
43
+ className: style.number
44
+ }, /*#__PURE__*/React.createElement("div", {
45
+ className: style.actions
46
+ }, /*#__PURE__*/React.createElement("div", {
47
+ onClick: function onClick() {
48
+ return onEditClick(data);
49
+ }
50
+ }, /*#__PURE__*/React.createElement(EditIcon, null)), /*#__PURE__*/React.createElement("div", {
51
+ onClick: function onClick() {
52
+ onDelete(data === null || data === void 0 ? void 0 : data.id);
53
+ dispatch(setDeleteModalVisible(true));
54
+ }
55
+ }, /*#__PURE__*/React.createElement(DeleteIconQ, null)))));
56
+ }
57
+ }];
58
+ };
@@ -0,0 +1,255 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
+ import React from "react";
6
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
7
+ import Cookies from "js-cookie";
8
+ import style from "../Questionnaires.module.scss";
9
+ import { Form, Input, Layout } from "antd";
10
+ import { PlusIcon } from "../../../assets/icons";
11
+ import FormModal from "../../../components/FormModal";
12
+ import { useDispatch, useSelector } from "react-redux";
13
+ import Delete from "../../../components/Delete/Delete";
14
+ import DeleteModal from "../../../components/DeleteModal/DeleteModal";
15
+ import Success from "../../../components/Success/Success";
16
+ import { setDeleteModalVisible, setViewModalVisible } from "../../../store/slices/global";
17
+ import ViewModal from "../../../components/ViewModal";
18
+ import { getStreetColumns } from "./constant";
19
+ import Pagination from "../../../components/Pagination";
20
+ import ColSort from "../../../components/ColSort";
21
+ import { setPaginationLength } from "../../../helpers/paginationLength";
22
+ import Button from "../../../components/Button";
23
+ import Loading from "../../../components/Loading";
24
+ import Table from "../../../components/Table";
25
+ import Filter from "../../../components/Filter";
26
+ import { addApplicationForm, applicationFormVisibility, deleteApplicationForm, editApplicationForm, getApplicationForms } from "../../../store/slices/questionnaire";
27
+ var Content = Layout.Content;
28
+ var Item = Form.Item;
29
+ var QuestionnairesApplicationFormContent = function QuestionnairesApplicationFormContent() {
30
+ var _useState = useState(null),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ innerW = _useState2[0],
33
+ setInnerW = _useState2[1];
34
+ var ref = useRef();
35
+ var dispatch = useDispatch();
36
+ var _useState3 = useState(0),
37
+ _useState4 = _slicedToArray(_useState3, 2),
38
+ id = _useState4[0],
39
+ setId = _useState4[1];
40
+ var _useState5 = useState(1),
41
+ _useState6 = _slicedToArray(_useState5, 2),
42
+ page = _useState6[0],
43
+ setPage = _useState6[1];
44
+ var _useState7 = useState(Cookies.get("pagination-size-questionnaire-application-form") ? JSON.parse(Cookies.get("pagination-size-questionnaire-application-form")) : 20),
45
+ _useState8 = _slicedToArray(_useState7, 2),
46
+ size = _useState8[0],
47
+ setSize = _useState8[1];
48
+ var _useState9 = useState({
49
+ name: ""
50
+ }),
51
+ _useState10 = _slicedToArray(_useState9, 2),
52
+ query = _useState10[0],
53
+ setQuery = _useState10[1];
54
+ var _useSelector = useSelector(function (state) {
55
+ return state.global;
56
+ }),
57
+ loading = _useSelector.loading,
58
+ applicationFormRender = _useSelector.applicationFormRender;
59
+ var applicationForms = useSelector(function (state) {
60
+ return state.questionnaire.applicationForms;
61
+ });
62
+ var paginationLength = setPaginationLength(applicationForms === null || applicationForms === void 0 ? void 0 : applicationForms.count, applicationForms === null || applicationForms === void 0 ? void 0 : applicationForms.size);
63
+ var onSubmit = useCallback(/*#__PURE__*/function () {
64
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
65
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
66
+ while (1) switch (_context.prev = _context.next) {
67
+ case 0:
68
+ dispatch(addApplicationForm({
69
+ name: data === null || data === void 0 ? void 0 : data.name
70
+ }));
71
+ case 1:
72
+ case "end":
73
+ return _context.stop();
74
+ }
75
+ }, _callee);
76
+ }));
77
+ return function (_x) {
78
+ return _ref.apply(this, arguments);
79
+ };
80
+ }(), [dispatch]);
81
+ var onEdit = useCallback(function (id, record) {
82
+ var data = {
83
+ id: id,
84
+ name: record === null || record === void 0 ? void 0 : record.name
85
+ };
86
+ dispatch(editApplicationForm(data));
87
+ }, [dispatch]);
88
+ var onStatusChange = useCallback(function (data, checked) {
89
+ var data_ = {
90
+ id: data === null || data === void 0 ? void 0 : data.id,
91
+ checked: checked
92
+ };
93
+ dispatch(applicationFormVisibility(data_));
94
+ }, [dispatch]);
95
+ var closeOnViewModal = useCallback(function () {
96
+ dispatch(setViewModalVisible(false));
97
+ }, [dispatch]);
98
+ var onClickModal = function onClickModal() {
99
+ var _ref$current;
100
+ ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.open();
101
+ };
102
+ var onEditClick = useCallback(function (data) {
103
+ var _ref$current2;
104
+ ref === null || ref === void 0 || (_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.setEdit(data);
105
+ }, []);
106
+ var onDelete = useCallback(function (id) {
107
+ setId(id);
108
+ }, []);
109
+ var handleSearch = function handleSearch(value) {
110
+ setQuery({
111
+ name: value
112
+ });
113
+ setPage(1);
114
+ };
115
+ var handleColumnToggle = function handleColumnToggle(checked, dataIndex) {
116
+ setSelectedColumns(function (prevSelected) {
117
+ if (checked) {
118
+ return [].concat(_toConsumableArray(prevSelected), [dataIndex]);
119
+ } else {
120
+ return prevSelected.filter(function (col) {
121
+ return col !== dataIndex;
122
+ });
123
+ }
124
+ });
125
+ };
126
+ var data = [];
127
+ if (applicationForms !== null && applicationForms !== void 0 && applicationForms.items) {
128
+ var _applicationForms$ite;
129
+ data = applicationForms === null || applicationForms === void 0 || (_applicationForms$ite = applicationForms.items) === null || _applicationForms$ite === void 0 ? void 0 : _applicationForms$ite.map(function (dataObj, i) {
130
+ return {
131
+ num: (applicationForms === null || applicationForms === void 0 ? void 0 : applicationForms.size) * (applicationForms === null || applicationForms === void 0 ? void 0 : applicationForms.page) + i + 1 - (applicationForms === null || applicationForms === void 0 ? void 0 : applicationForms.size),
132
+ id: dataObj === null || dataObj === void 0 ? void 0 : dataObj.id,
133
+ name: dataObj === null || dataObj === void 0 ? void 0 : dataObj.name,
134
+ isActive: dataObj === null || dataObj === void 0 ? void 0 : dataObj.isActive,
135
+ className: "rowClassName1"
136
+ };
137
+ });
138
+ }
139
+ var columns = useMemo(function () {
140
+ return getStreetColumns(onEditClick, onDelete, onStatusChange, dispatch);
141
+ }, [onEditClick, onDelete, onStatusChange, dispatch]);
142
+ var _useState11 = useState(columns.map(function (col) {
143
+ return col.dataIndex;
144
+ })),
145
+ _useState12 = _slicedToArray(_useState11, 2),
146
+ selectedColumns = _useState12[0],
147
+ setSelectedColumns = _useState12[1];
148
+ useEffect(function () {
149
+ if (window.innerWidth >= 1900) {
150
+ setInnerW(210);
151
+ } else {
152
+ setInnerW(155);
153
+ }
154
+ var data = {
155
+ page: page,
156
+ size: size,
157
+ query: query,
158
+ visibility: "nondeleted"
159
+ };
160
+ dispatch(getApplicationForms(data));
161
+ }, [dispatch, page, applicationFormRender, size, query]);
162
+ var updateSize = function updateSize(newSize) {
163
+ setSize(newSize); // Update state
164
+ Cookies.set("pagination-size-questionnaire-application-form", JSON.stringify(newSize), {
165
+ expires: 7
166
+ }); // Save to cookies
167
+ };
168
+ return /*#__PURE__*/React.createElement(React.Fragment, null, loading ? /*#__PURE__*/React.createElement(Loading, null) : null, /*#__PURE__*/React.createElement(Layout, {
169
+ className: style.layout
170
+ }, /*#__PURE__*/React.createElement(Content, {
171
+ className: style.content
172
+ }, /*#__PURE__*/React.createElement("header", {
173
+ className: style.header
174
+ }, /*#__PURE__*/React.createElement(Button, {
175
+ onClick: onClickModal,
176
+ color: "green"
177
+ }, " ", /*#__PURE__*/React.createElement(PlusIcon, null), " Soraq\xE7a \u0259lav\u0259 et"), /*#__PURE__*/React.createElement(Filter, {
178
+ columns: columns,
179
+ selectedColumns: selectedColumns,
180
+ setQuery: setQuery,
181
+ disabledElementCount: 3,
182
+ setPage: setPage
183
+ }))), /*#__PURE__*/React.createElement(Layout, {
184
+ className: style.layout1
185
+ }, /*#__PURE__*/React.createElement(Content, {
186
+ className: style.content
187
+ }, /*#__PURE__*/React.createElement("div", {
188
+ className: style.table_header
189
+ }, /*#__PURE__*/React.createElement("h2", null, "M\xFCraci\u0259t formalar\u0131"), /*#__PURE__*/React.createElement("div", {
190
+ className: style.buttons
191
+ }, /*#__PURE__*/React.createElement(ColSort, {
192
+ columns: columns,
193
+ selectedColumns: selectedColumns,
194
+ handleColumnToggle: handleColumnToggle
195
+ }))), /*#__PURE__*/React.createElement("div", {
196
+ className: "bigTable"
197
+ }, /*#__PURE__*/React.createElement(Table, {
198
+ selectedColumns: selectedColumns,
199
+ innerW: innerW,
200
+ dataSource: data,
201
+ columns: columns,
202
+ disableDrag: true
203
+ })), /*#__PURE__*/React.createElement("div", {
204
+ className: style.pagination
205
+ }, /*#__PURE__*/React.createElement(Pagination, {
206
+ size: size,
207
+ setSize: updateSize,
208
+ total: paginationLength,
209
+ page: page,
210
+ onChange: setPage
211
+ })), /*#__PURE__*/React.createElement(FormModal, {
212
+ ref: ref,
213
+ width: 454,
214
+ title: "Yeni soraqça yaratma",
215
+ titleEdit: "Soraqça redaktə etmə",
216
+ okText: "Yadda saxla",
217
+ cancelText: "Bağla",
218
+ onSubmit: onSubmit,
219
+ onEdit: onEdit,
220
+ className: "absolute",
221
+ centered: false
222
+ }, /*#__PURE__*/React.createElement(Item, {
223
+ rules: [{
224
+ required: true,
225
+ message: ""
226
+ }, {
227
+ min: 3,
228
+ message: "Ən azından 3 simvol olmalıdır"
229
+ }],
230
+ name: "name",
231
+ label: "Ad"
232
+ }, /*#__PURE__*/React.createElement(Input, {
233
+ className: style.modal_input
234
+ }))), /*#__PURE__*/React.createElement(DeleteModal, {
235
+ onCancel: function onCancel() {
236
+ return dispatch(setDeleteModalVisible(false));
237
+ },
238
+ width: 280
239
+ }, /*#__PURE__*/React.createElement(Delete, {
240
+ onDelete: function onDelete() {
241
+ return dispatch(deleteApplicationForm(id));
242
+ },
243
+ onCancel: function onCancel() {
244
+ return dispatch(setDeleteModalVisible(false));
245
+ },
246
+ value: "Soraqçanı"
247
+ })), /*#__PURE__*/React.createElement(ViewModal, {
248
+ onCancel: closeOnViewModal,
249
+ width: 695
250
+ }, /*#__PURE__*/React.createElement(Success, {
251
+ onClick: closeOnViewModal,
252
+ value: "Soraqça"
253
+ }))))));
254
+ };
255
+ export default QuestionnairesApplicationFormContent;