@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.
- package/dist/assets/css/antd.css +836 -0
- package/dist/assets/css/variables.css +6 -0
- package/dist/assets/icons/index.js +424 -1
- package/dist/components/Button/index.module.scss +14 -2
- package/dist/components/Delete/Delete.js +22 -0
- package/dist/components/Delete/Delete.module.scss +22 -0
- package/dist/components/DeleteModal/DeleteModal.js +31 -0
- package/dist/components/DeleteModal/DeleteModal.module.scss +11 -0
- package/dist/components/Filter/index.js +1 -1
- package/dist/components/Input/index.js +1 -2
- package/dist/components/Input/index.module.scss +21 -12
- package/dist/components/ProfileOptions/index.js +109 -66
- package/dist/components/ProfileOptions/index.module.scss +144 -12
- package/dist/components/Success/Success.js +19 -0
- package/dist/components/Success/Success.module.scss +26 -0
- package/dist/components/Table/index.js +4 -2
- package/dist/components/ViewModal/index.js +30 -0
- package/dist/helpers/paginationLength.js +3 -0
- package/dist/helpers/querySearch.js +22 -0
- package/dist/index.js +6 -0
- package/dist/layout/Header/AppSelect/index.js +107 -0
- package/dist/layout/Header/AppSelect/index.module.scss +68 -0
- package/dist/layout/Header/index.js +6 -84
- package/dist/layout/Header/index.module.scss +8 -12
- package/dist/layout/Portal/index.js +23 -0
- package/dist/layout/QuestionnairesLayout/index.js +17 -0
- package/dist/layout/QuestionnairesLayout/index.module.scss +0 -0
- package/dist/layout/QuestionnairesSidebar/index.js +126 -0
- package/dist/layout/QuestionnairesSidebar/index.module.scss +76 -0
- package/dist/layout/Sidebar/index.js +147 -0
- package/dist/layout/Sidebar/index.module.scss +50 -0
- package/dist/pages/Platform/constant.js +29 -2
- package/dist/pages/Platform/index.js +19 -30
- package/dist/pages/Platform/index.module.scss +20 -5
- package/dist/pages/Questionnnaires/Questionnaires.module.scss +194 -0
- package/dist/pages/Questionnnaires/QuestionnairesApplicationFormContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesApplicationFormContent/index.js +255 -0
- package/dist/pages/Questionnnaires/QuestionnairesCountriesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesCountriesContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesDeliveryMethodContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesDeliveryMethodContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesDocumentRecieveMethodsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesDocumentRecieveMethodsContent/index.js +258 -0
- package/dist/pages/Questionnnaires/QuestionnairesDocumentTypeContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesDocumentTypeContent/index.js +284 -0
- package/dist/pages/Questionnnaires/QuestionnairesDocumentWhomContent/constant.js +82 -0
- package/dist/pages/Questionnnaires/QuestionnairesDocumentWhomContent/index.js +331 -0
- package/dist/pages/Questionnnaires/QuestionnairesExecutionRulesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesExecutionRulesContent/index.js +258 -0
- package/dist/pages/Questionnnaires/QuestionnairesMarginNoteTextsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesMarginNoteTextsContent/index.js +249 -0
- package/dist/pages/Questionnnaires/QuestionnairesOrganizationsContent/constant.js +88 -0
- package/dist/pages/Questionnnaires/QuestionnairesOrganizationsContent/index.js +320 -0
- package/dist/pages/Questionnnaires/QuestionnairesStreetsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesStreetsContent/index.js +240 -0
- package/dist/pages/Questionnnaires/QuestionnairesStructuresContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesStructuresContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesSubtopicContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesSubtopicContent/index.js +317 -0
- package/dist/pages/Questionnnaires/QuestionnairesTopicContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesTopicContent/index.js +271 -0
- package/dist/pages/Questionnnaires/index.js +5 -0
- package/dist/routes/QuestionnaireRoutes.js +108 -0
- package/dist/store/slices/global/index.js +96 -3
- package/dist/store/slices/questionnaire/index.js +2500 -0
- package/dist/store/slices/questionnaire/service.js +1557 -0
- package/dist/store/store.js +2 -1
- package/dist/utils/path.js +30 -1
- package/package.json +2 -2
|
@@ -0,0 +1,320 @@
|
|
|
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 { addOrganization, deleteOrganization, editOrganization, getOrganizations, organizationVisibility } from "../../../store/slices/questionnaire";
|
|
27
|
+
import { MaskedInput } from "antd-5-mask-input";
|
|
28
|
+
var Content = Layout.Content;
|
|
29
|
+
var Item = Form.Item;
|
|
30
|
+
var QuestionnairesOrganizationsContent = function QuestionnairesOrganizationsContent() {
|
|
31
|
+
var _useState = useState(210),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
innerW = _useState2[0],
|
|
34
|
+
setInnerW = _useState2[1];
|
|
35
|
+
var ref = useRef();
|
|
36
|
+
var dispatch = useDispatch();
|
|
37
|
+
var _useState3 = useState(0),
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
id = _useState4[0],
|
|
40
|
+
setId = _useState4[1];
|
|
41
|
+
var _useState5 = useState(1),
|
|
42
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
43
|
+
page = _useState6[0],
|
|
44
|
+
setPage = _useState6[1];
|
|
45
|
+
var _useState7 = useState(Cookies.get("pagination-size-questionnaire-organizations") ? JSON.parse(Cookies.get("pagination-size-questionnaire-organizations")) : 20),
|
|
46
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
47
|
+
size = _useState8[0],
|
|
48
|
+
setSize = _useState8[1];
|
|
49
|
+
var _useState9 = useState({
|
|
50
|
+
name: ""
|
|
51
|
+
}),
|
|
52
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
53
|
+
query = _useState10[0],
|
|
54
|
+
setQuery = _useState10[1];
|
|
55
|
+
var _useSelector = useSelector(function (state) {
|
|
56
|
+
return state.global;
|
|
57
|
+
}),
|
|
58
|
+
loading = _useSelector.loading,
|
|
59
|
+
organizationRender = _useSelector.organizationRender;
|
|
60
|
+
var organizations = useSelector(function (state) {
|
|
61
|
+
return state.questionnaire.organizations;
|
|
62
|
+
});
|
|
63
|
+
var paginationLength = setPaginationLength(organizations === null || organizations === void 0 ? void 0 : organizations.count, organizations === null || organizations === void 0 ? void 0 : organizations.size);
|
|
64
|
+
var onSubmit = useCallback(/*#__PURE__*/function () {
|
|
65
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
|
66
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
67
|
+
while (1) switch (_context.prev = _context.next) {
|
|
68
|
+
case 0:
|
|
69
|
+
dispatch(addOrganization(data));
|
|
70
|
+
case 1:
|
|
71
|
+
case "end":
|
|
72
|
+
return _context.stop();
|
|
73
|
+
}
|
|
74
|
+
}, _callee);
|
|
75
|
+
}));
|
|
76
|
+
return function (_x) {
|
|
77
|
+
return _ref.apply(this, arguments);
|
|
78
|
+
};
|
|
79
|
+
}(), [dispatch]);
|
|
80
|
+
var onEdit = useCallback(function (id, record) {
|
|
81
|
+
var data = {
|
|
82
|
+
id: id,
|
|
83
|
+
name: record === null || record === void 0 ? void 0 : record.name,
|
|
84
|
+
voen: record === null || record === void 0 ? void 0 : record.voen,
|
|
85
|
+
address: record === null || record === void 0 ? void 0 : record.address,
|
|
86
|
+
shortName: record === null || record === void 0 ? void 0 : record.shortName,
|
|
87
|
+
email: record === null || record === void 0 ? void 0 : record.email,
|
|
88
|
+
phone: record === null || record === void 0 ? void 0 : record.phone
|
|
89
|
+
};
|
|
90
|
+
dispatch(editOrganization(data));
|
|
91
|
+
}, [dispatch]);
|
|
92
|
+
var onStatusChange = useCallback(function (data, checked) {
|
|
93
|
+
var data_ = {
|
|
94
|
+
id: data === null || data === void 0 ? void 0 : data.id,
|
|
95
|
+
checked: checked
|
|
96
|
+
};
|
|
97
|
+
dispatch(organizationVisibility(data_));
|
|
98
|
+
}, [dispatch]);
|
|
99
|
+
var closeOnViewModal = useCallback(function () {
|
|
100
|
+
dispatch(setViewModalVisible(false));
|
|
101
|
+
}, [dispatch]);
|
|
102
|
+
var onClickModal = function onClickModal() {
|
|
103
|
+
var _ref$current;
|
|
104
|
+
ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.open();
|
|
105
|
+
};
|
|
106
|
+
var onEditClick = useCallback(function (data) {
|
|
107
|
+
var _ref$current2;
|
|
108
|
+
ref === null || ref === void 0 || (_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.setEdit(data);
|
|
109
|
+
}, []);
|
|
110
|
+
var onDelete = useCallback(function (id) {
|
|
111
|
+
setId(id);
|
|
112
|
+
}, []);
|
|
113
|
+
var handleColumnToggle = function handleColumnToggle(checked, dataIndex) {
|
|
114
|
+
setSelectedColumns(function (prevSelected) {
|
|
115
|
+
if (checked) {
|
|
116
|
+
return [].concat(_toConsumableArray(prevSelected), [dataIndex]);
|
|
117
|
+
} else {
|
|
118
|
+
return prevSelected.filter(function (col) {
|
|
119
|
+
return col !== dataIndex;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
var data = [];
|
|
125
|
+
if (organizations !== null && organizations !== void 0 && organizations.items) {
|
|
126
|
+
var _organizations$items;
|
|
127
|
+
data = organizations === null || organizations === void 0 || (_organizations$items = organizations.items) === null || _organizations$items === void 0 ? void 0 : _organizations$items.map(function (dataObj, i) {
|
|
128
|
+
return {
|
|
129
|
+
num: (organizations === null || organizations === void 0 ? void 0 : organizations.size) * (organizations === null || organizations === void 0 ? void 0 : organizations.page) + i + 1 - (organizations === null || organizations === void 0 ? void 0 : organizations.size),
|
|
130
|
+
id: dataObj === null || dataObj === void 0 ? void 0 : dataObj.id,
|
|
131
|
+
name: dataObj === null || dataObj === void 0 ? void 0 : dataObj.name,
|
|
132
|
+
voen: dataObj === null || dataObj === void 0 ? void 0 : dataObj.voen,
|
|
133
|
+
address: dataObj === null || dataObj === void 0 ? void 0 : dataObj.address,
|
|
134
|
+
shortName: dataObj === null || dataObj === void 0 ? void 0 : dataObj.shortName,
|
|
135
|
+
email: dataObj === null || dataObj === void 0 ? void 0 : dataObj.email,
|
|
136
|
+
phone: dataObj === null || dataObj === void 0 ? void 0 : dataObj.phone,
|
|
137
|
+
isActive: dataObj === null || dataObj === void 0 ? void 0 : dataObj.isActive,
|
|
138
|
+
className: "rowClassName1"
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
var columns = useMemo(function () {
|
|
143
|
+
return getStreetColumns(onEditClick, onDelete, onStatusChange, dispatch);
|
|
144
|
+
}, [onEditClick, onDelete, onStatusChange, dispatch]);
|
|
145
|
+
var _useState11 = useState(columns.map(function (col) {
|
|
146
|
+
return col.dataIndex;
|
|
147
|
+
})),
|
|
148
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
149
|
+
selectedColumns = _useState12[0],
|
|
150
|
+
setSelectedColumns = _useState12[1];
|
|
151
|
+
useEffect(function () {
|
|
152
|
+
if (window.innerWidth >= 1900) {
|
|
153
|
+
setInnerW(210);
|
|
154
|
+
} else {
|
|
155
|
+
setInnerW(155);
|
|
156
|
+
}
|
|
157
|
+
var data = {
|
|
158
|
+
page: page,
|
|
159
|
+
size: size,
|
|
160
|
+
query: query,
|
|
161
|
+
visibility: "nondeleted"
|
|
162
|
+
};
|
|
163
|
+
dispatch(getOrganizations(data));
|
|
164
|
+
}, [dispatch, page, organizationRender, size, query]);
|
|
165
|
+
var updateSize = function updateSize(newSize) {
|
|
166
|
+
setSize(newSize); // Update state
|
|
167
|
+
Cookies.set("pagination-size-questionnaire-organizations", JSON.stringify(newSize), {
|
|
168
|
+
expires: 7
|
|
169
|
+
}); // Save to cookies
|
|
170
|
+
};
|
|
171
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, loading ? /*#__PURE__*/React.createElement(Loading, null) : null, /*#__PURE__*/React.createElement(Layout, {
|
|
172
|
+
className: style.layout
|
|
173
|
+
}, /*#__PURE__*/React.createElement(Content, {
|
|
174
|
+
className: style.content
|
|
175
|
+
}, /*#__PURE__*/React.createElement("header", {
|
|
176
|
+
className: style.header
|
|
177
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
178
|
+
onClick: onClickModal,
|
|
179
|
+
color: "green"
|
|
180
|
+
}, " ", /*#__PURE__*/React.createElement(PlusIcon, null), " Soraq\xE7a \u0259lav\u0259 et"), /*#__PURE__*/React.createElement(Filter, {
|
|
181
|
+
columns: columns,
|
|
182
|
+
selectedColumns: selectedColumns,
|
|
183
|
+
setQuery: setQuery,
|
|
184
|
+
disabledElementCount: 3,
|
|
185
|
+
setPage: setPage
|
|
186
|
+
}))), /*#__PURE__*/React.createElement(Layout, {
|
|
187
|
+
className: style.layout1
|
|
188
|
+
}, /*#__PURE__*/React.createElement(Content, {
|
|
189
|
+
className: style.content
|
|
190
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
191
|
+
className: style.table_header
|
|
192
|
+
}, /*#__PURE__*/React.createElement("h2", null, "T\u0259\u015Fkilatlar"), /*#__PURE__*/React.createElement("div", {
|
|
193
|
+
className: style.buttons
|
|
194
|
+
}, /*#__PURE__*/React.createElement(ColSort, {
|
|
195
|
+
columns: columns,
|
|
196
|
+
selectedColumns: selectedColumns,
|
|
197
|
+
handleColumnToggle: handleColumnToggle
|
|
198
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
199
|
+
className: "bigTable"
|
|
200
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
201
|
+
selectedColumns: selectedColumns,
|
|
202
|
+
innerW: innerW,
|
|
203
|
+
dataSource: data,
|
|
204
|
+
columns: columns,
|
|
205
|
+
disableDrag: true
|
|
206
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
207
|
+
className: style.pagination
|
|
208
|
+
}, /*#__PURE__*/React.createElement(Pagination, {
|
|
209
|
+
size: size,
|
|
210
|
+
setSize: updateSize,
|
|
211
|
+
total: paginationLength,
|
|
212
|
+
page: page,
|
|
213
|
+
onChange: setPage
|
|
214
|
+
})), /*#__PURE__*/React.createElement(FormModal, {
|
|
215
|
+
ref: ref,
|
|
216
|
+
width: 454,
|
|
217
|
+
title: "Yeni soraqça yaratma",
|
|
218
|
+
titleEdit: "Soraqça redaktə etmə",
|
|
219
|
+
okText: "Yadda saxla",
|
|
220
|
+
cancelText: "Bağla",
|
|
221
|
+
onSubmit: onSubmit,
|
|
222
|
+
onEdit: onEdit,
|
|
223
|
+
className: "absolute",
|
|
224
|
+
centered: false
|
|
225
|
+
}, /*#__PURE__*/React.createElement(Item, {
|
|
226
|
+
rules: [{
|
|
227
|
+
required: true,
|
|
228
|
+
message: ""
|
|
229
|
+
}, {
|
|
230
|
+
min: 3,
|
|
231
|
+
message: "Ən azından 3 simvol olmalıdır"
|
|
232
|
+
}],
|
|
233
|
+
name: "name",
|
|
234
|
+
label: "Ad"
|
|
235
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
236
|
+
className: style.modal_input
|
|
237
|
+
})), /*#__PURE__*/React.createElement(Item, {
|
|
238
|
+
rules: [{
|
|
239
|
+
required: true,
|
|
240
|
+
message: ""
|
|
241
|
+
}, {
|
|
242
|
+
min: 3,
|
|
243
|
+
message: "Ən azından 3 simvol olmalıdır"
|
|
244
|
+
}],
|
|
245
|
+
name: "shortName",
|
|
246
|
+
label: "Qısa ad"
|
|
247
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
248
|
+
className: style.modal_input
|
|
249
|
+
})), /*#__PURE__*/React.createElement(Item, {
|
|
250
|
+
rules: [{
|
|
251
|
+
required: false,
|
|
252
|
+
message: ""
|
|
253
|
+
}, {
|
|
254
|
+
min: 3,
|
|
255
|
+
message: "Ən azından 3 simvol olmalıdır"
|
|
256
|
+
}],
|
|
257
|
+
name: "address",
|
|
258
|
+
label: "Ünvan"
|
|
259
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
260
|
+
className: style.modal_input
|
|
261
|
+
})), /*#__PURE__*/React.createElement(Item, {
|
|
262
|
+
rules: [{
|
|
263
|
+
required: false,
|
|
264
|
+
message: ""
|
|
265
|
+
}, {
|
|
266
|
+
min: 3,
|
|
267
|
+
message: "Ən azından 3 simvol olmalıdır"
|
|
268
|
+
}],
|
|
269
|
+
name: "voen",
|
|
270
|
+
label: "VÖEN"
|
|
271
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
272
|
+
type: "number",
|
|
273
|
+
className: style.modal_input
|
|
274
|
+
})), /*#__PURE__*/React.createElement(Item, {
|
|
275
|
+
rules: [{
|
|
276
|
+
required: false,
|
|
277
|
+
message: ""
|
|
278
|
+
}, {
|
|
279
|
+
min: 3,
|
|
280
|
+
message: "Ən azından 3 simvol olmalıdır"
|
|
281
|
+
}],
|
|
282
|
+
name: "email",
|
|
283
|
+
label: "Elektron poçt ünvanı"
|
|
284
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
285
|
+
type: "email",
|
|
286
|
+
className: style.modal_input
|
|
287
|
+
})), /*#__PURE__*/React.createElement(Item, {
|
|
288
|
+
name: "phone",
|
|
289
|
+
label: "Əlaqə nömrəsi",
|
|
290
|
+
rules: [{
|
|
291
|
+
required: false,
|
|
292
|
+
pattern: /^\+[0-9]{12}$/,
|
|
293
|
+
message: ""
|
|
294
|
+
}]
|
|
295
|
+
}, /*#__PURE__*/React.createElement(MaskedInput, {
|
|
296
|
+
type: "text",
|
|
297
|
+
mask: "+000000000000",
|
|
298
|
+
className: style.modal_input
|
|
299
|
+
}))), /*#__PURE__*/React.createElement(DeleteModal, {
|
|
300
|
+
onCancel: function onCancel() {
|
|
301
|
+
return dispatch(setDeleteModalVisible(false));
|
|
302
|
+
},
|
|
303
|
+
width: 280
|
|
304
|
+
}, /*#__PURE__*/React.createElement(Delete, {
|
|
305
|
+
onDelete: function onDelete() {
|
|
306
|
+
return dispatch(deleteOrganization(id));
|
|
307
|
+
},
|
|
308
|
+
onCancel: function onCancel() {
|
|
309
|
+
return dispatch(setDeleteModalVisible(false));
|
|
310
|
+
},
|
|
311
|
+
value: "Soraqçanı"
|
|
312
|
+
})), /*#__PURE__*/React.createElement(ViewModal, {
|
|
313
|
+
onCancel: closeOnViewModal,
|
|
314
|
+
width: 695
|
|
315
|
+
}, /*#__PURE__*/React.createElement(Success, {
|
|
316
|
+
onClick: closeOnViewModal,
|
|
317
|
+
value: "Soraqça"
|
|
318
|
+
}))))));
|
|
319
|
+
};
|
|
320
|
+
export default QuestionnairesOrganizationsContent;
|
|
@@ -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,240 @@
|
|
|
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 Filter from "../../../components/Filter";
|
|
25
|
+
import { addTopic, deleteTopic, editTopic, topicVisibility } from "../../../store/slices/questionnaire";
|
|
26
|
+
var Content = Layout.Content;
|
|
27
|
+
var Item = Form.Item;
|
|
28
|
+
var QuestionnairesStreetsContent = function QuestionnairesStreetsContent() {
|
|
29
|
+
var _useState = useState(null),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
innerW = _useState2[0],
|
|
32
|
+
setInnerW = _useState2[1];
|
|
33
|
+
var ref = useRef();
|
|
34
|
+
var dispatch = useDispatch();
|
|
35
|
+
var _useState3 = useState(0),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
id = _useState4[0],
|
|
38
|
+
setId = _useState4[1];
|
|
39
|
+
var _useState5 = useState(1),
|
|
40
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
|
+
page = _useState6[0],
|
|
42
|
+
setPage = _useState6[1];
|
|
43
|
+
var _useState7 = useState(Cookies.get("pagination-size-questionnaire-streets") ? JSON.parse(Cookies.get("pagination-size-questionnaire-streets")) : 20),
|
|
44
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
45
|
+
size = _useState8[0],
|
|
46
|
+
setSize = _useState8[1];
|
|
47
|
+
var _useState9 = useState({
|
|
48
|
+
name: ""
|
|
49
|
+
}),
|
|
50
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
51
|
+
query = _useState10[0],
|
|
52
|
+
setQuery = _useState10[1];
|
|
53
|
+
var _useSelector = useSelector(function (state) {
|
|
54
|
+
return state.global;
|
|
55
|
+
}),
|
|
56
|
+
loading = _useSelector.loading,
|
|
57
|
+
topicsRender = _useSelector.topicsRender;
|
|
58
|
+
var topics = useSelector(function (state) {
|
|
59
|
+
return state.questionnaire.topics;
|
|
60
|
+
});
|
|
61
|
+
var paginationLength = setPaginationLength(topics === null || topics === void 0 ? void 0 : topics.count, topics === null || topics === void 0 ? void 0 : topics.size);
|
|
62
|
+
var onSubmit = useCallback(/*#__PURE__*/function () {
|
|
63
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
|
64
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
65
|
+
while (1) switch (_context.prev = _context.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
dispatch(addTopic(data));
|
|
68
|
+
case 1:
|
|
69
|
+
case "end":
|
|
70
|
+
return _context.stop();
|
|
71
|
+
}
|
|
72
|
+
}, _callee);
|
|
73
|
+
}));
|
|
74
|
+
return function (_x) {
|
|
75
|
+
return _ref.apply(this, arguments);
|
|
76
|
+
};
|
|
77
|
+
}(), [dispatch]);
|
|
78
|
+
var onEdit = useCallback(function (id, record) {
|
|
79
|
+
var data = {
|
|
80
|
+
id: id,
|
|
81
|
+
name: record === null || record === void 0 ? void 0 : record.name
|
|
82
|
+
};
|
|
83
|
+
dispatch(editTopic(data));
|
|
84
|
+
}, [dispatch]);
|
|
85
|
+
var onStatusChange = useCallback(function (data, checked) {
|
|
86
|
+
var data_ = {
|
|
87
|
+
id: data === null || data === void 0 ? void 0 : data.id,
|
|
88
|
+
checked: checked
|
|
89
|
+
};
|
|
90
|
+
dispatch(topicVisibility(data_));
|
|
91
|
+
}, [dispatch]);
|
|
92
|
+
var closeOnViewModal = useCallback(function () {
|
|
93
|
+
dispatch(setViewModalVisible(false));
|
|
94
|
+
}, [dispatch]);
|
|
95
|
+
var onClickModal = function onClickModal() {
|
|
96
|
+
var _ref$current;
|
|
97
|
+
ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.open();
|
|
98
|
+
};
|
|
99
|
+
var onEditClick = useCallback(function (data) {
|
|
100
|
+
var _ref$current2;
|
|
101
|
+
ref === null || ref === void 0 || (_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.setEdit(data);
|
|
102
|
+
}, []);
|
|
103
|
+
var onDelete = useCallback(function (id) {
|
|
104
|
+
setId(id);
|
|
105
|
+
}, []);
|
|
106
|
+
var handleColumnToggle = function handleColumnToggle(checked, dataIndex) {
|
|
107
|
+
setSelectedColumns(function (prevSelected) {
|
|
108
|
+
if (checked) {
|
|
109
|
+
return [].concat(_toConsumableArray(prevSelected), [dataIndex]);
|
|
110
|
+
} else {
|
|
111
|
+
return prevSelected.filter(function (col) {
|
|
112
|
+
return col !== dataIndex;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
var data = [];
|
|
118
|
+
if (topics !== null && topics !== void 0 && topics.items) {
|
|
119
|
+
var _topics$items;
|
|
120
|
+
data = topics === null || topics === void 0 || (_topics$items = topics.items) === null || _topics$items === void 0 ? void 0 : _topics$items.map(function (dataObj, i) {
|
|
121
|
+
return {
|
|
122
|
+
num: (topics === null || topics === void 0 ? void 0 : topics.size) * (topics === null || topics === void 0 ? void 0 : topics.page) + i + 1 - (topics === null || topics === void 0 ? void 0 : topics.size),
|
|
123
|
+
id: dataObj === null || dataObj === void 0 ? void 0 : dataObj.id,
|
|
124
|
+
name: dataObj === null || dataObj === void 0 ? void 0 : dataObj.name,
|
|
125
|
+
isActive: dataObj === null || dataObj === void 0 ? void 0 : dataObj.isActive,
|
|
126
|
+
className: "rowClassName1"
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
var columns = useMemo(function () {
|
|
131
|
+
return getStreetColumns(onEditClick, onDelete, onStatusChange, dispatch);
|
|
132
|
+
}, [onEditClick, onDelete, onStatusChange, dispatch]);
|
|
133
|
+
var _useState11 = useState(columns.map(function (col) {
|
|
134
|
+
return col.dataIndex;
|
|
135
|
+
})),
|
|
136
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
137
|
+
selectedColumns = _useState12[0],
|
|
138
|
+
setSelectedColumns = _useState12[1];
|
|
139
|
+
useEffect(function () {
|
|
140
|
+
if (window.innerWidth >= 1900) {
|
|
141
|
+
setInnerW(210);
|
|
142
|
+
} else {
|
|
143
|
+
setInnerW(155);
|
|
144
|
+
}
|
|
145
|
+
// const data = {
|
|
146
|
+
// page: page,
|
|
147
|
+
// size: size,
|
|
148
|
+
// query: query,
|
|
149
|
+
// visibility: "nondeleted",
|
|
150
|
+
// };
|
|
151
|
+
// dispatch(getTopics(data));
|
|
152
|
+
}, [dispatch, page, topicsRender, size, query]);
|
|
153
|
+
var updateSize = function updateSize(newSize) {
|
|
154
|
+
setSize(newSize); // Update state
|
|
155
|
+
Cookies.set("pagination-size-questionnaire-streets", JSON.stringify(newSize), {
|
|
156
|
+
expires: 7
|
|
157
|
+
}); // Save to cookies
|
|
158
|
+
};
|
|
159
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, loading ? /*#__PURE__*/React.createElement(Loading, null) : null, /*#__PURE__*/React.createElement(Layout, {
|
|
160
|
+
className: style.layout
|
|
161
|
+
}, /*#__PURE__*/React.createElement(Content, {
|
|
162
|
+
className: style.content
|
|
163
|
+
}, /*#__PURE__*/React.createElement("header", {
|
|
164
|
+
className: style.header
|
|
165
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
166
|
+
onClick: onClickModal,
|
|
167
|
+
color: "green"
|
|
168
|
+
}, " ", /*#__PURE__*/React.createElement(PlusIcon, null), " Soraq\xE7a \u0259lav\u0259 et"), /*#__PURE__*/React.createElement(Filter, {
|
|
169
|
+
columns: columns,
|
|
170
|
+
selectedColumns: selectedColumns,
|
|
171
|
+
setQuery: setQuery,
|
|
172
|
+
disabledElementCount: 3,
|
|
173
|
+
setPage: setPage
|
|
174
|
+
}))), /*#__PURE__*/React.createElement(Layout, {
|
|
175
|
+
className: style.layout1
|
|
176
|
+
}, /*#__PURE__*/React.createElement(Content, {
|
|
177
|
+
className: style.content
|
|
178
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
className: style.table_header
|
|
180
|
+
}, /*#__PURE__*/React.createElement("h2", null, "K\xFC\xE7\u0259l\u0259r"), /*#__PURE__*/React.createElement("div", {
|
|
181
|
+
className: style.buttons
|
|
182
|
+
}, /*#__PURE__*/React.createElement(ColSort, {
|
|
183
|
+
columns: columns,
|
|
184
|
+
selectedColumns: selectedColumns,
|
|
185
|
+
handleColumnToggle: handleColumnToggle
|
|
186
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
187
|
+
className: "bigTable"
|
|
188
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
189
|
+
className: style.pagination
|
|
190
|
+
}, /*#__PURE__*/React.createElement(Pagination, {
|
|
191
|
+
size: size,
|
|
192
|
+
setSize: updateSize,
|
|
193
|
+
total: paginationLength,
|
|
194
|
+
page: page,
|
|
195
|
+
onChange: setPage
|
|
196
|
+
})), /*#__PURE__*/React.createElement(FormModal, {
|
|
197
|
+
ref: ref,
|
|
198
|
+
width: 454,
|
|
199
|
+
title: "Yeni soraqça yaratma",
|
|
200
|
+
titleEdit: "Soraqça redaktə etmə",
|
|
201
|
+
okText: "Yadda saxla",
|
|
202
|
+
cancelText: "Bağla",
|
|
203
|
+
onSubmit: onSubmit,
|
|
204
|
+
onEdit: onEdit,
|
|
205
|
+
className: "absolute",
|
|
206
|
+
centered: false
|
|
207
|
+
}, /*#__PURE__*/React.createElement(Item, {
|
|
208
|
+
rules: [{
|
|
209
|
+
required: true,
|
|
210
|
+
message: ""
|
|
211
|
+
}, {
|
|
212
|
+
min: 3,
|
|
213
|
+
message: "Ən azından 3 simvol olmalıdır"
|
|
214
|
+
}],
|
|
215
|
+
name: "name",
|
|
216
|
+
label: "Ad"
|
|
217
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
218
|
+
className: style.modal_input
|
|
219
|
+
}))), /*#__PURE__*/React.createElement(DeleteModal, {
|
|
220
|
+
onCancel: function onCancel() {
|
|
221
|
+
return dispatch(setDeleteModalVisible(false));
|
|
222
|
+
},
|
|
223
|
+
width: 280
|
|
224
|
+
}, /*#__PURE__*/React.createElement(Delete, {
|
|
225
|
+
onDelete: function onDelete() {
|
|
226
|
+
return dispatch(deleteTopic(id));
|
|
227
|
+
},
|
|
228
|
+
onCancel: function onCancel() {
|
|
229
|
+
return dispatch(setDeleteModalVisible(false));
|
|
230
|
+
},
|
|
231
|
+
value: "Soraqçanı"
|
|
232
|
+
})), /*#__PURE__*/React.createElement(ViewModal, {
|
|
233
|
+
onCancel: closeOnViewModal,
|
|
234
|
+
width: 695
|
|
235
|
+
}, /*#__PURE__*/React.createElement(Success, {
|
|
236
|
+
onClick: closeOnViewModal,
|
|
237
|
+
value: "Soraqça"
|
|
238
|
+
}))))));
|
|
239
|
+
};
|
|
240
|
+
export default QuestionnairesStreetsContent;
|
|
@@ -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: "Struktur",
|
|
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
|
+
};
|