@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
@@ -0,0 +1,247 @@
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 { addStructure, deleteStructure, editStructure, getStructures, structureVisibility } from "../../../store/slices/questionnaire";
27
+ var Content = Layout.Content;
28
+ var Item = Form.Item;
29
+ var QuestionnairesStructuresContent = function QuestionnairesStructuresContent() {
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-structures") ? JSON.parse(Cookies.get("pagination-size-questionnaire-structures")) : 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
+ structureRender = _useSelector.structureRender;
59
+ var structures = useSelector(function (state) {
60
+ return state.questionnaire.structures;
61
+ });
62
+ var paginationLength = setPaginationLength(structures === null || structures === void 0 ? void 0 : structures.count, structures === null || structures === void 0 ? void 0 : structures.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(addStructure(data));
69
+ case 1:
70
+ case "end":
71
+ return _context.stop();
72
+ }
73
+ }, _callee);
74
+ }));
75
+ return function (_x) {
76
+ return _ref.apply(this, arguments);
77
+ };
78
+ }(), [dispatch]);
79
+ var onEdit = useCallback(function (id, record) {
80
+ var data = {
81
+ id: id,
82
+ name: record === null || record === void 0 ? void 0 : record.name
83
+ };
84
+ dispatch(editStructure(data));
85
+ }, [dispatch]);
86
+ var onStatusChange = useCallback(function (data, checked) {
87
+ var data_ = {
88
+ id: data === null || data === void 0 ? void 0 : data.id,
89
+ checked: checked
90
+ };
91
+ dispatch(structureVisibility(data_));
92
+ }, [dispatch]);
93
+ var closeOnViewModal = useCallback(function () {
94
+ dispatch(setViewModalVisible(false));
95
+ }, [dispatch]);
96
+ var onClickModal = function onClickModal() {
97
+ var _ref$current;
98
+ ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.open();
99
+ };
100
+ var onEditClick = useCallback(function (data) {
101
+ var _ref$current2;
102
+ ref === null || ref === void 0 || (_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.setEdit(data);
103
+ }, []);
104
+ var onDelete = useCallback(function (id) {
105
+ setId(id);
106
+ }, []);
107
+ var handleColumnToggle = function handleColumnToggle(checked, dataIndex) {
108
+ setSelectedColumns(function (prevSelected) {
109
+ if (checked) {
110
+ return [].concat(_toConsumableArray(prevSelected), [dataIndex]);
111
+ } else {
112
+ return prevSelected.filter(function (col) {
113
+ return col !== dataIndex;
114
+ });
115
+ }
116
+ });
117
+ };
118
+ var data = [];
119
+ if (structures !== null && structures !== void 0 && structures.items) {
120
+ var _structures$items;
121
+ data = structures === null || structures === void 0 || (_structures$items = structures.items) === null || _structures$items === void 0 ? void 0 : _structures$items.map(function (dataObj, i) {
122
+ return {
123
+ num: (structures === null || structures === void 0 ? void 0 : structures.size) * (structures === null || structures === void 0 ? void 0 : structures.page) + i + 1 - (structures === null || structures === void 0 ? void 0 : structures.size),
124
+ id: dataObj === null || dataObj === void 0 ? void 0 : dataObj.id,
125
+ name: dataObj === null || dataObj === void 0 ? void 0 : dataObj.name,
126
+ isActive: dataObj === null || dataObj === void 0 ? void 0 : dataObj.isActive,
127
+ className: "rowClassName1"
128
+ };
129
+ });
130
+ }
131
+ var columns = useMemo(function () {
132
+ return getStreetColumns(onEditClick, onDelete, onStatusChange, dispatch);
133
+ }, [onEditClick, onDelete, onStatusChange, dispatch]);
134
+ var _useState11 = useState(columns.map(function (col) {
135
+ return col.dataIndex;
136
+ })),
137
+ _useState12 = _slicedToArray(_useState11, 2),
138
+ selectedColumns = _useState12[0],
139
+ setSelectedColumns = _useState12[1];
140
+ useEffect(function () {
141
+ if (window.innerWidth >= 1900) {
142
+ setInnerW(210);
143
+ } else {
144
+ setInnerW(155);
145
+ }
146
+ var data = {
147
+ page: page,
148
+ size: size,
149
+ query: query,
150
+ visibility: "nondeleted"
151
+ };
152
+ dispatch(getStructures(data));
153
+ }, [dispatch, page, structureRender, size, query]);
154
+ var updateSize = function updateSize(newSize) {
155
+ setSize(newSize); // Update state
156
+ Cookies.set("pagination-size-questionnaire-structures", JSON.stringify(newSize), {
157
+ expires: 7
158
+ }); // Save to cookies
159
+ };
160
+ return /*#__PURE__*/React.createElement(React.Fragment, null, loading ? /*#__PURE__*/React.createElement(Loading, null) : null, /*#__PURE__*/React.createElement(Layout, {
161
+ className: style.layout
162
+ }, /*#__PURE__*/React.createElement(Content, {
163
+ className: style.content
164
+ }, /*#__PURE__*/React.createElement("header", {
165
+ className: style.header
166
+ }, /*#__PURE__*/React.createElement(Button, {
167
+ onClick: onClickModal,
168
+ color: "green"
169
+ }, " ", /*#__PURE__*/React.createElement(PlusIcon, null), " Soraq\xE7a \u0259lav\u0259 et"), /*#__PURE__*/React.createElement(Filter, {
170
+ columns: columns,
171
+ selectedColumns: selectedColumns,
172
+ setQuery: setQuery,
173
+ disabledElementCount: 3,
174
+ setPage: setPage
175
+ }))), /*#__PURE__*/React.createElement(Layout, {
176
+ className: style.layout1
177
+ }, /*#__PURE__*/React.createElement(Content, {
178
+ className: style.content
179
+ }, /*#__PURE__*/React.createElement("div", {
180
+ className: style.table_header
181
+ }, /*#__PURE__*/React.createElement("h2", null, "Strukturlar"), /*#__PURE__*/React.createElement("div", {
182
+ className: style.buttons
183
+ }, /*#__PURE__*/React.createElement(ColSort, {
184
+ columns: columns,
185
+ selectedColumns: selectedColumns,
186
+ handleColumnToggle: handleColumnToggle
187
+ }))), /*#__PURE__*/React.createElement("div", {
188
+ className: "bigTable"
189
+ }, /*#__PURE__*/React.createElement(Table, {
190
+ selectedColumns: selectedColumns,
191
+ innerW: innerW,
192
+ dataSource: data,
193
+ columns: columns,
194
+ disableDrag: true
195
+ })), /*#__PURE__*/React.createElement("div", {
196
+ className: style.pagination
197
+ }, /*#__PURE__*/React.createElement(Pagination, {
198
+ size: size,
199
+ setSize: updateSize,
200
+ total: paginationLength,
201
+ page: page,
202
+ onChange: setPage
203
+ })), /*#__PURE__*/React.createElement(FormModal, {
204
+ ref: ref,
205
+ width: 454,
206
+ title: "Yeni soraqça yaratma",
207
+ titleEdit: "Soraqça redaktə etmə",
208
+ okText: "Yadda saxla",
209
+ cancelText: "Bağla",
210
+ onSubmit: onSubmit,
211
+ onEdit: onEdit,
212
+ className: "absolute",
213
+ centered: false
214
+ }, /*#__PURE__*/React.createElement(Item, {
215
+ rules: [{
216
+ required: true,
217
+ message: ""
218
+ }, {
219
+ min: 3,
220
+ message: "Ən azından 3 simvol olmalıdır"
221
+ }],
222
+ name: "name",
223
+ label: "Ad"
224
+ }, /*#__PURE__*/React.createElement(Input, {
225
+ className: style.modal_input
226
+ }))), /*#__PURE__*/React.createElement(DeleteModal, {
227
+ onCancel: function onCancel() {
228
+ return dispatch(setDeleteModalVisible(false));
229
+ },
230
+ width: 280
231
+ }, /*#__PURE__*/React.createElement(Delete, {
232
+ onDelete: function onDelete() {
233
+ return dispatch(deleteStructure(id));
234
+ },
235
+ onCancel: function onCancel() {
236
+ return dispatch(setDeleteModalVisible(false));
237
+ },
238
+ value: "Soraqçanı"
239
+ })), /*#__PURE__*/React.createElement(ViewModal, {
240
+ onCancel: closeOnViewModal,
241
+ width: 695
242
+ }, /*#__PURE__*/React.createElement(Success, {
243
+ onClick: closeOnViewModal,
244
+ value: "Soraqça"
245
+ }))))));
246
+ };
247
+ export default QuestionnairesStructuresContent;
@@ -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: "Alt 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,317 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ import Select from "../../../components/Select";
9
+ import React from "react";
10
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
11
+ import Cookies from "js-cookie";
12
+ import style from "../Questionnaires.module.scss";
13
+ import { Form, Input, Layout, Select as AntdSelect } from "antd";
14
+ import { PlusIcon } from "../../../assets/icons";
15
+ import FormModal from "../../../components/FormModal";
16
+ import { useDispatch, useSelector } from "react-redux";
17
+ import Delete from "../../../components/Delete/Delete";
18
+ import DeleteModal from "../../../components/DeleteModal/DeleteModal";
19
+ import Success from "../../../components/Success/Success";
20
+ import { setDeleteModalVisible, setViewModalVisible } from "../../../store/slices/global";
21
+ import ViewModal from "../../../components/ViewModal";
22
+ import { getStreetColumns } from "./constant";
23
+ import Pagination from "../../../components/Pagination";
24
+ import ColSort from "../../../components/ColSort";
25
+ import { setPaginationLength } from "../../../helpers/paginationLength";
26
+ import Button from "../../../components/Button";
27
+ import Loading from "../../../components/Loading";
28
+ import Table from "../../../components/Table";
29
+ import Filter from "../../../components/Filter";
30
+ import { addSubtopic, deleteSubtopic, editSubtopic, getSubtopics, getTopicsAll, subtopicVisibility } from "../../../store/slices/questionnaire";
31
+ var Content = Layout.Content;
32
+ var Item = Form.Item;
33
+ var Option = AntdSelect.Option;
34
+ var QuestionnairesTopicContent = function QuestionnairesTopicContent() {
35
+ var _useState = useState(null),
36
+ _useState2 = _slicedToArray(_useState, 2),
37
+ innerW = _useState2[0],
38
+ setInnerW = _useState2[1];
39
+ var ref = useRef();
40
+ var dispatch = useDispatch();
41
+ var _useState3 = useState(0),
42
+ _useState4 = _slicedToArray(_useState3, 2),
43
+ id = _useState4[0],
44
+ setId = _useState4[1];
45
+ var _useState5 = useState(1),
46
+ _useState6 = _slicedToArray(_useState5, 2),
47
+ page = _useState6[0],
48
+ setPage = _useState6[1];
49
+ var _useState7 = useState(Cookies.get("pagination-size-questionnaire-subtopic") ? JSON.parse(Cookies.get("pagination-size-questionnaire-subtopic")) : 20),
50
+ _useState8 = _slicedToArray(_useState7, 2),
51
+ size = _useState8[0],
52
+ setSize = _useState8[1];
53
+ var _useState9 = useState(null),
54
+ _useState10 = _slicedToArray(_useState9, 2),
55
+ subtopicSelect = _useState10[0],
56
+ setSubtopicSelect = _useState10[1];
57
+ var _useState11 = useState({
58
+ name: ""
59
+ }),
60
+ _useState12 = _slicedToArray(_useState11, 2),
61
+ query = _useState12[0],
62
+ setQuery = _useState12[1];
63
+ var _useState13 = useState(1),
64
+ _useState14 = _slicedToArray(_useState13, 2),
65
+ typeSelect = _useState14[0],
66
+ setTypeSelect = _useState14[1];
67
+ var _useSelector = useSelector(function (state) {
68
+ return state.global;
69
+ }),
70
+ loading = _useSelector.loading,
71
+ subtopicsRender = _useSelector.subtopicsRender;
72
+ var subtopics = useSelector(function (state) {
73
+ return state.questionnaire.subtopics;
74
+ });
75
+ var topicsAll = useSelector(function (state) {
76
+ return state.questionnaire.topicsAll;
77
+ });
78
+ var paginationLength = setPaginationLength(subtopics === null || subtopics === void 0 ? void 0 : subtopics.count, subtopics === null || subtopics === void 0 ? void 0 : subtopics.size);
79
+ var onSubmit = useCallback(/*#__PURE__*/function () {
80
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
81
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
82
+ while (1) switch (_context.prev = _context.next) {
83
+ case 0:
84
+ dispatch(addSubtopic(_objectSpread(_objectSpread({}, data), {}, {
85
+ topicId: subtopicSelect,
86
+ appealtype: typeSelect
87
+ })));
88
+ case 1:
89
+ case "end":
90
+ return _context.stop();
91
+ }
92
+ }, _callee);
93
+ }));
94
+ return function (_x) {
95
+ return _ref.apply(this, arguments);
96
+ };
97
+ }(), [dispatch, subtopicSelect]);
98
+ var onEdit = useCallback(function (id, record) {
99
+ var data = {
100
+ id: id,
101
+ name: record === null || record === void 0 ? void 0 : record.name,
102
+ topicId: subtopicSelect,
103
+ appealtype: typeSelect
104
+ };
105
+ dispatch(editSubtopic(data));
106
+ }, [dispatch, subtopicSelect, typeSelect]);
107
+ var closeOnViewModal = useCallback(function () {
108
+ dispatch(setViewModalVisible(false));
109
+ }, [dispatch]);
110
+ var onClickModal = function onClickModal() {
111
+ var _ref$current;
112
+ ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.open();
113
+ };
114
+ var onEditClick = useCallback(function (data) {
115
+ var _ref$current2;
116
+ ref === null || ref === void 0 || (_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.setEdit(data);
117
+ }, []);
118
+ var onDelete = useCallback(function (id) {
119
+ setId(id);
120
+ }, []);
121
+ var onStatusChange = useCallback(function (data, checked) {
122
+ var data_ = {
123
+ id: data === null || data === void 0 ? void 0 : data.id,
124
+ checked: checked
125
+ };
126
+ dispatch(subtopicVisibility(data_));
127
+ }, [dispatch]);
128
+ var handleSearch = function handleSearch(value) {
129
+ setQuery({
130
+ name: value
131
+ });
132
+ setPage(1);
133
+ };
134
+ var data = [];
135
+ if (subtopics !== null && subtopics !== void 0 && subtopics.items) {
136
+ var _subtopics$items;
137
+ data = subtopics === null || subtopics === void 0 || (_subtopics$items = subtopics.items) === null || _subtopics$items === void 0 ? void 0 : _subtopics$items.map(function (dataObj, i) {
138
+ return {
139
+ num: (subtopics === null || subtopics === void 0 ? void 0 : subtopics.size) * (subtopics === null || subtopics === void 0 ? void 0 : subtopics.page) + i + 1 - (subtopics === null || subtopics === void 0 ? void 0 : subtopics.size),
140
+ id: dataObj === null || dataObj === void 0 ? void 0 : dataObj.id,
141
+ name: dataObj === null || dataObj === void 0 ? void 0 : dataObj.name,
142
+ isActive: dataObj === null || dataObj === void 0 ? void 0 : dataObj.isActive,
143
+ className: "rowClassName1"
144
+ };
145
+ });
146
+ }
147
+ var columns = useMemo(function () {
148
+ return getStreetColumns(onEditClick, onDelete, onStatusChange, dispatch);
149
+ }, [onEditClick, onDelete, onStatusChange, dispatch]);
150
+ var handleColumnToggle = function handleColumnToggle(checked, dataIndex) {
151
+ setSelectedColumns(function (prevSelected) {
152
+ if (checked) {
153
+ return [].concat(_toConsumableArray(prevSelected), [dataIndex]);
154
+ } else {
155
+ return prevSelected.filter(function (col) {
156
+ return col !== dataIndex;
157
+ });
158
+ }
159
+ });
160
+ };
161
+ var _useState15 = useState(columns.map(function (col) {
162
+ return col.dataIndex;
163
+ })),
164
+ _useState16 = _slicedToArray(_useState15, 2),
165
+ selectedColumns = _useState16[0],
166
+ setSelectedColumns = _useState16[1];
167
+ useEffect(function () {
168
+ if (topicsAll) {
169
+ var _topicsAll$;
170
+ setSubtopicSelect(topicsAll === null || topicsAll === void 0 || (_topicsAll$ = topicsAll[0]) === null || _topicsAll$ === void 0 ? void 0 : _topicsAll$.id);
171
+ }
172
+ }, [topicsAll]);
173
+ useEffect(function () {
174
+ dispatch(getTopicsAll({
175
+ visibility: "nondeleted",
176
+ appealtypes: typeSelect
177
+ }));
178
+ }, [dispatch, typeSelect]);
179
+ useEffect(function () {
180
+ if (window.innerWidth >= 1900) {
181
+ setInnerW(210);
182
+ } else {
183
+ setInnerW(155);
184
+ }
185
+ var data = {
186
+ page: page,
187
+ size: size,
188
+ topicId: subtopicSelect,
189
+ query: query,
190
+ visibility: "nondeleted",
191
+ appealtypes: typeSelect
192
+ };
193
+ if (subtopicSelect !== null) {
194
+ dispatch(getSubtopics(data));
195
+ }
196
+ }, [dispatch, page, subtopicsRender, size, subtopicSelect, query, typeSelect]);
197
+ var updateSize = function updateSize(newSize) {
198
+ setSize(newSize); // Update state
199
+ Cookies.set("pagination-size-questionnaire-subtopic", JSON.stringify(newSize), {
200
+ expires: 7
201
+ }); // Save to cookies
202
+ };
203
+ return /*#__PURE__*/React.createElement(React.Fragment, null, loading ? /*#__PURE__*/React.createElement(Loading, null) : null, /*#__PURE__*/React.createElement(Layout, {
204
+ className: style.layout
205
+ }, /*#__PURE__*/React.createElement(Content, {
206
+ className: style.content
207
+ }, /*#__PURE__*/React.createElement("header", {
208
+ className: style.header
209
+ }, /*#__PURE__*/React.createElement(Button, {
210
+ onClick: onClickModal,
211
+ color: "green"
212
+ }, /*#__PURE__*/React.createElement(PlusIcon, null), " Soraq\xE7a \u0259lav\u0259 et"), /*#__PURE__*/React.createElement(Filter, {
213
+ columns: columns,
214
+ selectedColumns: selectedColumns,
215
+ setQuery: setQuery,
216
+ disabledElementCount: 3,
217
+ setPage: setPage
218
+ }))), /*#__PURE__*/React.createElement(Layout, {
219
+ className: style.layout1
220
+ }, /*#__PURE__*/React.createElement(Content, {
221
+ className: style.content
222
+ }, /*#__PURE__*/React.createElement("div", {
223
+ className: style.table_header
224
+ }, /*#__PURE__*/React.createElement("h2", null, "Alt m\xF6vzular"), /*#__PURE__*/React.createElement("div", {
225
+ className: style.buttons
226
+ }, /*#__PURE__*/React.createElement(Select, {
227
+ size: "sm",
228
+ width: 200,
229
+ allowClear: false,
230
+ value: typeSelect,
231
+ defaultValue: "",
232
+ onChange: function onChange(value) {
233
+ setTypeSelect(value);
234
+ }
235
+ }, /*#__PURE__*/React.createElement(Option, {
236
+ value: 1
237
+ }, "T\u0259\u015Fkilat"), /*#__PURE__*/React.createElement(Option, {
238
+ value: 2
239
+ }, "V\u0259t\u0259nda\u015F")), /*#__PURE__*/React.createElement(Select, {
240
+ size: "sm",
241
+ width: 200,
242
+ allowClear: false,
243
+ value: subtopicSelect,
244
+ defaultValue: "",
245
+ onChange: function onChange(value) {
246
+ setSubtopicSelect(value);
247
+ }
248
+ }, topicsAll === null || topicsAll === void 0 ? void 0 : topicsAll.map(function (item) {
249
+ return /*#__PURE__*/React.createElement(Option, {
250
+ key: item.id,
251
+ value: item.id
252
+ }, item.name);
253
+ })), /*#__PURE__*/React.createElement(ColSort, {
254
+ columns: columns,
255
+ selectedColumns: selectedColumns,
256
+ handleColumnToggle: handleColumnToggle
257
+ }))), /*#__PURE__*/React.createElement("div", {
258
+ className: "bigTable"
259
+ }, /*#__PURE__*/React.createElement(Table, {
260
+ selectedColumns: selectedColumns,
261
+ innerW: innerW,
262
+ dataSource: data,
263
+ columns: columns,
264
+ disableDrag: true
265
+ })), /*#__PURE__*/React.createElement("div", {
266
+ className: style.pagination
267
+ }, /*#__PURE__*/React.createElement(Pagination, {
268
+ size: size,
269
+ setSize: updateSize,
270
+ total: paginationLength,
271
+ page: page,
272
+ onChange: setPage
273
+ })), /*#__PURE__*/React.createElement(FormModal, {
274
+ ref: ref,
275
+ width: 454,
276
+ title: "Yeni soraqça yaratma",
277
+ titleEdit: "Soraqça redaktə etmə",
278
+ okText: "Yadda saxla",
279
+ cancelText: "Bağla",
280
+ onSubmit: onSubmit,
281
+ onEdit: onEdit,
282
+ className: "absolute",
283
+ centered: false
284
+ }, /*#__PURE__*/React.createElement(Item, {
285
+ rules: [{
286
+ required: true,
287
+ message: ""
288
+ }, {
289
+ min: 3,
290
+ message: "Ən azından 3 simvol olmalıdır"
291
+ }],
292
+ name: "name",
293
+ label: "Ad"
294
+ }, /*#__PURE__*/React.createElement(Input, {
295
+ className: style.modal_input
296
+ }))), /*#__PURE__*/React.createElement(DeleteModal, {
297
+ onCancel: function onCancel() {
298
+ return dispatch(setDeleteModalVisible(false));
299
+ },
300
+ width: 280
301
+ }, /*#__PURE__*/React.createElement(Delete, {
302
+ onDelete: function onDelete() {
303
+ return dispatch(deleteSubtopic(id));
304
+ },
305
+ onCancel: function onCancel() {
306
+ return dispatch(setDeleteModalVisible(false));
307
+ },
308
+ value: "Soraqçanı"
309
+ })), /*#__PURE__*/React.createElement(ViewModal, {
310
+ onCancel: closeOnViewModal,
311
+ width: 695
312
+ }, /*#__PURE__*/React.createElement(Success, {
313
+ onClick: closeOnViewModal,
314
+ value: "Soraqça"
315
+ }))))));
316
+ };
317
+ export default QuestionnairesTopicContent;
@@ -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
+ };