@banch0u/core-project-test-repository 1.9.0 → 1.9.2
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 +3 -3
- package/dist/assets/css/variables.css +2 -0
- package/dist/components/Button/index.module.scss +5 -5
- package/dist/components/ColSort/index.module.scss +22 -0
- package/dist/components/Input/index.js +35 -6
- package/dist/components/Input/index.module.scss +45 -22
- package/dist/components/Select/index.js +47 -61
- package/dist/components/Select/index.module.scss +32 -0
- package/dist/components/ViewMoreModal/index.js +30 -0
- package/dist/layout/QuestionnairesLayout/index.module.scss +3 -0
- package/dist/layout/QuestionnairesSidebar/index.js +147 -19
- package/dist/layout/QuestionnairesSidebar/index.module.scss +4 -3
- package/dist/pages/Questionnnaires/Questionnaires.module.scss +4 -3
- package/dist/pages/Questionnnaires/{QuestionnairesStreetsContent → QuestionnairesAcademicdegreesContent}/constant.js +1 -1
- package/dist/pages/Questionnnaires/QuestionnairesAcademicdegreesContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesAreasContent/constant.js +63 -0
- package/dist/pages/Questionnnaires/QuestionnairesAreasContent/index.js +271 -0
- package/dist/pages/Questionnnaires/QuestionnairesBrandsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/{QuestionnairesStreetsContent → QuestionnairesBrandsContent}/index.js +35 -28
- package/dist/pages/Questionnnaires/QuestionnairesCategoriesContent/constant.js +69 -0
- package/dist/pages/Questionnnaires/QuestionnairesCategoriesContent/index.js +304 -0
- package/dist/pages/Questionnnaires/QuestionnairesChassisTypesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesChassisTypesContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesColorsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesColorsContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesCompaniesContent/constant.js +62 -0
- package/dist/pages/Questionnnaires/QuestionnairesCompaniesContent/index.js +278 -0
- package/dist/pages/Questionnnaires/QuestionnairesDisabilitystatusesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesDisabilitystatusesContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesDocumentTypeContent/constant.js +1 -1
- package/dist/pages/Questionnnaires/QuestionnairesDrivingcategoriesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesDrivingcategoriesContent/index.js +250 -0
- package/dist/pages/Questionnnaires/QuestionnairesEducationinstitutionsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesEducationinstitutionsContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesEducationlevelsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesEducationlevelsContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesEducationpaymentsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesEducationpaymentsContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesEngineTypesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesEngineTypesContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesGearboxTypesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesGearboxTypesContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesGeneralstructurestatusesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesGeneralstructurestatusesContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesGeneralstructuretypesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesGeneralstructuretypesContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesHallsContent/constant.js +67 -0
- package/dist/pages/Questionnnaires/QuestionnairesHallsContent/index.js +294 -0
- package/dist/pages/Questionnnaires/QuestionnairesHonorarytitlesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesHonorarytitlesContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesIssuedAuthoritiesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesIssuedAuthoritiesContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesMilitarycategoriesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesMilitarycategoriesContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesMilitarygroupsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesMilitarygroupsContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesMilitaryranksContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesMilitaryranksContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesMilitarystaffsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesMilitarystaffsContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesModelsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesModelsContent/index.js +290 -0
- package/dist/pages/Questionnnaires/QuestionnairesOwnershipTypesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesOwnershipTypesContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesPositionsContent/constant.js +72 -0
- package/dist/pages/Questionnnaires/QuestionnairesPositionsContent/index.js +428 -0
- package/dist/pages/Questionnnaires/QuestionnairesRegionsContent/constant.js +68 -0
- package/dist/pages/Questionnnaires/QuestionnairesRegionsContent/index.js +320 -0
- package/dist/pages/Questionnnaires/QuestionnairesReprimandtypesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesReprimandtypesContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesSpecialdaysContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesSpecialdaysContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesSpecializationsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesSpecializationsContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesTransmitterTypesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesTransmitterTypesContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesVehicleTypesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesVehicleTypesContent/index.js +247 -0
- package/dist/pages/Questionnnaires/QuestionnairesWarparticipantsContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesWarparticipantsContent/index.js +269 -0
- package/dist/pages/Questionnnaires/QuestionnairesWorkschedulesContent/constant.js +58 -0
- package/dist/pages/Questionnnaires/QuestionnairesWorkschedulesContent/index.js +269 -0
- package/dist/routes/QuestionnaireRoutes.js +250 -19
- package/dist/store/slices/global/index.js +225 -3
- package/dist/store/slices/questionnaire/index.js +7592 -47
- package/dist/store/slices/questionnaire/service.js +3921 -2
- package/dist/utils/path.js +82 -15
- package/package.json +1 -1
|
@@ -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 { addColor, colorVisibility, deleteColor, editColor, getColor } from "../../../store/slices/questionnaire";
|
|
27
|
+
var Content = Layout.Content;
|
|
28
|
+
var Item = Form.Item;
|
|
29
|
+
var QuestionnairesColorsContent = function QuestionnairesColorsContent() {
|
|
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-colors") ? JSON.parse(Cookies.get("pagination-size-questionnaire-colors")) : 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
|
+
colorRender = _useSelector.colorRender;
|
|
59
|
+
var color = useSelector(function (state) {
|
|
60
|
+
return state.questionnaire.color;
|
|
61
|
+
});
|
|
62
|
+
var paginationLength = setPaginationLength(color === null || color === void 0 ? void 0 : color.count, color === null || color === void 0 ? void 0 : color.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(addColor(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(editColor(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(colorVisibility(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 (color !== null && color !== void 0 && color.items) {
|
|
120
|
+
var _color$items;
|
|
121
|
+
data = color === null || color === void 0 || (_color$items = color.items) === null || _color$items === void 0 ? void 0 : _color$items.map(function (dataObj, i) {
|
|
122
|
+
return {
|
|
123
|
+
num: (color === null || color === void 0 ? void 0 : color.size) * (color === null || color === void 0 ? void 0 : color.page) + i + 1 - (color === null || color === void 0 ? void 0 : color.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(getColor(data));
|
|
153
|
+
}, [dispatch, page, colorRender, query, size]);
|
|
154
|
+
var updateSize = function updateSize(newSize) {
|
|
155
|
+
setSize(newSize); // Update state
|
|
156
|
+
Cookies.set("pagination-size-questionnaire-colors", 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, "R\u0259ngl\u0259r"), /*#__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: 2,
|
|
220
|
+
message: "Ən azından 2 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(deleteColor(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 QuestionnairesColorsContent;
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
key: "name",
|
|
15
|
+
title: "Ad",
|
|
16
|
+
dataIndex: "name",
|
|
17
|
+
disabled: true
|
|
18
|
+
}, {
|
|
19
|
+
key: "fullName",
|
|
20
|
+
title: "Tam ad",
|
|
21
|
+
dataIndex: "fullName",
|
|
22
|
+
disabled: false
|
|
23
|
+
}, {
|
|
24
|
+
title: "Status",
|
|
25
|
+
key: "status",
|
|
26
|
+
disabled: true,
|
|
27
|
+
filter: false,
|
|
28
|
+
render: function render(data) {
|
|
29
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
30
|
+
placement: "top",
|
|
31
|
+
title: "Statusu d\u0259yi\u015F"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
33
|
+
size: "medium",
|
|
34
|
+
checked: data === null || data === void 0 ? void 0 : data.isActive,
|
|
35
|
+
onChange: function onChange(checked) {
|
|
36
|
+
return onStatusChange(data, checked, dispatch);
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
title: "",
|
|
42
|
+
key: "actions",
|
|
43
|
+
showCheckbox: false,
|
|
44
|
+
width: 80,
|
|
45
|
+
render: function render(data) {
|
|
46
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: style.number
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: style.actions
|
|
50
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
onClick: function onClick() {
|
|
52
|
+
return onEditClick(data);
|
|
53
|
+
}
|
|
54
|
+
}, /*#__PURE__*/React.createElement(EditIcon, null)), /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
onClick: function onClick() {
|
|
56
|
+
onDelete(data === null || data === void 0 ? void 0 : data.id);
|
|
57
|
+
dispatch(setDeleteModalVisible(true));
|
|
58
|
+
}
|
|
59
|
+
}, /*#__PURE__*/React.createElement(DeleteIconQ, null)))));
|
|
60
|
+
}
|
|
61
|
+
}];
|
|
62
|
+
};
|
|
@@ -0,0 +1,278 @@
|
|
|
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 React from "react";
|
|
9
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
10
|
+
import Cookies from "js-cookie";
|
|
11
|
+
import style from "../Questionnaires.module.scss";
|
|
12
|
+
import { Checkbox, Form, Input, Layout } from "antd";
|
|
13
|
+
import { PlusIcon } from "../../../assets/icons";
|
|
14
|
+
import FormModal from "../../../components/FormModal";
|
|
15
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
16
|
+
import Delete from "../../../components/Delete/Delete";
|
|
17
|
+
import DeleteModal from "../../../components/DeleteModal/DeleteModal";
|
|
18
|
+
import Success from "../../../components/Success/Success";
|
|
19
|
+
import { setDeleteModalVisible, setViewModalVisible } from "../../../store/slices/global";
|
|
20
|
+
import ViewModal from "../../../components/ViewModal";
|
|
21
|
+
import { getStreetColumns } from "./constant";
|
|
22
|
+
import Pagination from "../../../components/Pagination";
|
|
23
|
+
import ColSort from "../../../components/ColSort";
|
|
24
|
+
import { setPaginationLength } from "../../../helpers/paginationLength";
|
|
25
|
+
import Button from "../../../components/Button";
|
|
26
|
+
import Loading from "../../../components/Loading";
|
|
27
|
+
import Table from "../../../components/Table";
|
|
28
|
+
import Filter from "../../../components/Filter";
|
|
29
|
+
import { addCompanies, deleteCompanies, companiesVisibility, editCompanies, getCompanies } from "../../../store/slices/questionnaire";
|
|
30
|
+
var Content = Layout.Content;
|
|
31
|
+
var Item = Form.Item;
|
|
32
|
+
var QuestionnairesDocumentTypeContent = function QuestionnairesDocumentTypeContent() {
|
|
33
|
+
var _useState = useState(null),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
innerW = _useState2[0],
|
|
36
|
+
setInnerW = _useState2[1];
|
|
37
|
+
var ref = useRef();
|
|
38
|
+
var dispatch = useDispatch();
|
|
39
|
+
var _useState3 = useState(0),
|
|
40
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
+
id = _useState4[0],
|
|
42
|
+
setId = _useState4[1];
|
|
43
|
+
var _useState5 = useState(1),
|
|
44
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
45
|
+
page = _useState6[0],
|
|
46
|
+
setPage = _useState6[1];
|
|
47
|
+
var _useState7 = useState(Cookies.get("pagination-size-questionnaire-document-type") ? JSON.parse(Cookies.get("pagination-size-questionnaire-document-type")) : 20),
|
|
48
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
49
|
+
size = _useState8[0],
|
|
50
|
+
setSize = _useState8[1];
|
|
51
|
+
var _useState9 = useState({
|
|
52
|
+
name: ""
|
|
53
|
+
}),
|
|
54
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
55
|
+
query = _useState10[0],
|
|
56
|
+
setQuery = _useState10[1];
|
|
57
|
+
var _useSelector = useSelector(function (state) {
|
|
58
|
+
return state.global;
|
|
59
|
+
}),
|
|
60
|
+
loading = _useSelector.loading,
|
|
61
|
+
companiesRender = _useSelector.companiesRender;
|
|
62
|
+
var companies = useSelector(function (state) {
|
|
63
|
+
return state.questionnaire.companies;
|
|
64
|
+
});
|
|
65
|
+
var paginationLength = setPaginationLength(companies === null || companies === void 0 ? void 0 : companies.count, companies === null || companies === void 0 ? void 0 : companies.size);
|
|
66
|
+
var onSubmit = useCallback(/*#__PURE__*/function () {
|
|
67
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
|
68
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
69
|
+
while (1) switch (_context.prev = _context.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
dispatch(addCompanies(_objectSpread({}, data)));
|
|
72
|
+
case 1:
|
|
73
|
+
case "end":
|
|
74
|
+
return _context.stop();
|
|
75
|
+
}
|
|
76
|
+
}, _callee);
|
|
77
|
+
}));
|
|
78
|
+
return function (_x) {
|
|
79
|
+
return _ref.apply(this, arguments);
|
|
80
|
+
};
|
|
81
|
+
}(), [dispatch]);
|
|
82
|
+
var onEdit = useCallback(function (id, record) {
|
|
83
|
+
var data = {
|
|
84
|
+
id: id,
|
|
85
|
+
name: record === null || record === void 0 ? void 0 : record.name,
|
|
86
|
+
fullName: record === null || record === void 0 ? void 0 : record.fullName,
|
|
87
|
+
isCurrentCompany: record === null || record === void 0 ? void 0 : record.isCurrentCompany
|
|
88
|
+
};
|
|
89
|
+
dispatch(editCompanies(data));
|
|
90
|
+
}, [dispatch]);
|
|
91
|
+
var onStatusChange = useCallback(function (data, checked) {
|
|
92
|
+
var data_ = {
|
|
93
|
+
id: data === null || data === void 0 ? void 0 : data.id,
|
|
94
|
+
checked: checked
|
|
95
|
+
};
|
|
96
|
+
dispatch(companiesVisibility(data_));
|
|
97
|
+
}, [dispatch]);
|
|
98
|
+
var closeOnViewModal = useCallback(function () {
|
|
99
|
+
dispatch(setViewModalVisible(false));
|
|
100
|
+
}, [dispatch]);
|
|
101
|
+
var onClickModal = function onClickModal() {
|
|
102
|
+
var _ref$current;
|
|
103
|
+
ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.open();
|
|
104
|
+
};
|
|
105
|
+
var onEditClick = useCallback(function (data) {
|
|
106
|
+
var _ref$current2;
|
|
107
|
+
ref === null || ref === void 0 || (_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.setEdit(data);
|
|
108
|
+
}, []);
|
|
109
|
+
var onDelete = useCallback(function (id) {
|
|
110
|
+
setId(id);
|
|
111
|
+
}, []);
|
|
112
|
+
var handleSearch = function handleSearch(value) {
|
|
113
|
+
setQuery({
|
|
114
|
+
name: value
|
|
115
|
+
});
|
|
116
|
+
setPage(1);
|
|
117
|
+
};
|
|
118
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
119
|
+
if (e.key === "Enter") {
|
|
120
|
+
handleSearch(e.target.value);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
var handleColumnToggle = function handleColumnToggle(checked, dataIndex) {
|
|
124
|
+
setSelectedColumns(function (prevSelected) {
|
|
125
|
+
if (checked) {
|
|
126
|
+
return [].concat(_toConsumableArray(prevSelected), [dataIndex]);
|
|
127
|
+
} else {
|
|
128
|
+
return prevSelected.filter(function (col) {
|
|
129
|
+
return col !== dataIndex;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
var data = [];
|
|
135
|
+
if (companies !== null && companies !== void 0 && companies.items) {
|
|
136
|
+
var _companies$items;
|
|
137
|
+
data = companies === null || companies === void 0 || (_companies$items = companies.items) === null || _companies$items === void 0 ? void 0 : _companies$items.map(function (dataObj, i) {
|
|
138
|
+
return {
|
|
139
|
+
num: (companies === null || companies === void 0 ? void 0 : companies.size) * (companies === null || companies === void 0 ? void 0 : companies.page) + i + 1 - (companies === null || companies === void 0 ? void 0 : companies.size),
|
|
140
|
+
id: dataObj === null || dataObj === void 0 ? void 0 : dataObj.id,
|
|
141
|
+
name: dataObj === null || dataObj === void 0 ? void 0 : dataObj.name,
|
|
142
|
+
fullName: dataObj === null || dataObj === void 0 ? void 0 : dataObj.fullName,
|
|
143
|
+
isCurrentCompany: dataObj === null || dataObj === void 0 ? void 0 : dataObj.isCurrentCompany,
|
|
144
|
+
isActive: dataObj === null || dataObj === void 0 ? void 0 : dataObj.isActive,
|
|
145
|
+
className: "rowClassName1"
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
var columns = useMemo(function () {
|
|
150
|
+
return getStreetColumns(onEditClick, onDelete, onStatusChange, dispatch);
|
|
151
|
+
}, [onEditClick, onDelete, onStatusChange, dispatch]);
|
|
152
|
+
var _useState11 = useState(columns.map(function (col) {
|
|
153
|
+
return col.dataIndex;
|
|
154
|
+
})),
|
|
155
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
156
|
+
selectedColumns = _useState12[0],
|
|
157
|
+
setSelectedColumns = _useState12[1];
|
|
158
|
+
useEffect(function () {
|
|
159
|
+
if (window.innerWidth >= 1900) {
|
|
160
|
+
setInnerW(210);
|
|
161
|
+
} else {
|
|
162
|
+
setInnerW(155);
|
|
163
|
+
}
|
|
164
|
+
var data = {
|
|
165
|
+
page: page,
|
|
166
|
+
size: size,
|
|
167
|
+
query: query,
|
|
168
|
+
visibility: "nondeleted"
|
|
169
|
+
};
|
|
170
|
+
dispatch(getCompanies(data));
|
|
171
|
+
}, [dispatch, page, companiesRender, size, query]);
|
|
172
|
+
var updateSize = function updateSize(newSize) {
|
|
173
|
+
setSize(newSize); // Update state
|
|
174
|
+
Cookies.set("pagination-size-questionnaire-document-type", JSON.stringify(newSize), {
|
|
175
|
+
expires: 7
|
|
176
|
+
}); // Save to cookies
|
|
177
|
+
};
|
|
178
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, loading ? /*#__PURE__*/React.createElement(Loading, null) : null, /*#__PURE__*/React.createElement(Layout, {
|
|
179
|
+
className: style.layout
|
|
180
|
+
}, /*#__PURE__*/React.createElement(Content, {
|
|
181
|
+
className: style.content
|
|
182
|
+
}, /*#__PURE__*/React.createElement("header", {
|
|
183
|
+
className: style.header
|
|
184
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
185
|
+
onClick: onClickModal,
|
|
186
|
+
color: "green"
|
|
187
|
+
}, " ", /*#__PURE__*/React.createElement(PlusIcon, null), " Soraq\xE7a \u0259lav\u0259 et"), /*#__PURE__*/React.createElement(Filter, {
|
|
188
|
+
columns: columns,
|
|
189
|
+
selectedColumns: selectedColumns,
|
|
190
|
+
setQuery: setQuery,
|
|
191
|
+
disabledElementCount: 3,
|
|
192
|
+
setPage: setPage
|
|
193
|
+
}))), /*#__PURE__*/React.createElement(Layout, {
|
|
194
|
+
className: style.layout1
|
|
195
|
+
}, /*#__PURE__*/React.createElement(Content, {
|
|
196
|
+
className: style.content
|
|
197
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
198
|
+
className: style.table_header
|
|
199
|
+
}, /*#__PURE__*/React.createElement("h2", null, "\u015Eirk\u0259tl\u0259r"), /*#__PURE__*/React.createElement("div", {
|
|
200
|
+
className: style.buttons
|
|
201
|
+
}, /*#__PURE__*/React.createElement(ColSort, {
|
|
202
|
+
columns: columns,
|
|
203
|
+
selectedColumns: selectedColumns,
|
|
204
|
+
handleColumnToggle: handleColumnToggle
|
|
205
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
className: "bigTable"
|
|
207
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
208
|
+
selectedColumns: selectedColumns,
|
|
209
|
+
innerW: innerW,
|
|
210
|
+
dataSource: data,
|
|
211
|
+
columns: columns,
|
|
212
|
+
disableDrag: true
|
|
213
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
214
|
+
className: style.pagination
|
|
215
|
+
}, /*#__PURE__*/React.createElement(Pagination, {
|
|
216
|
+
size: size,
|
|
217
|
+
setSize: updateSize,
|
|
218
|
+
total: paginationLength,
|
|
219
|
+
page: page,
|
|
220
|
+
onChange: setPage
|
|
221
|
+
})), /*#__PURE__*/React.createElement(FormModal, {
|
|
222
|
+
ref: ref,
|
|
223
|
+
width: 454,
|
|
224
|
+
title: "Yeni soraqça yaratma",
|
|
225
|
+
titleEdit: "Soraqça redaktə etmə",
|
|
226
|
+
okText: "Yadda saxla",
|
|
227
|
+
cancelText: "Bağla",
|
|
228
|
+
onSubmit: onSubmit,
|
|
229
|
+
onEdit: onEdit,
|
|
230
|
+
className: "absolute",
|
|
231
|
+
centered: false
|
|
232
|
+
}, /*#__PURE__*/React.createElement(Item, {
|
|
233
|
+
className: style.label,
|
|
234
|
+
rules: [{
|
|
235
|
+
required: true,
|
|
236
|
+
message: ""
|
|
237
|
+
}],
|
|
238
|
+
name: "name",
|
|
239
|
+
label: "Ad"
|
|
240
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
241
|
+
className: style.modal_input,
|
|
242
|
+
type: "text"
|
|
243
|
+
})), /*#__PURE__*/React.createElement(Item, {
|
|
244
|
+
rules: [{
|
|
245
|
+
required: true,
|
|
246
|
+
message: ""
|
|
247
|
+
}],
|
|
248
|
+
name: "fullName",
|
|
249
|
+
label: "Tam ad"
|
|
250
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
251
|
+
className: style.modal_input,
|
|
252
|
+
type: "text"
|
|
253
|
+
})), /*#__PURE__*/React.createElement(Item, {
|
|
254
|
+
className: style.label,
|
|
255
|
+
name: "isCurrentCompany",
|
|
256
|
+
valuePropName: "checked"
|
|
257
|
+
}, /*#__PURE__*/React.createElement(Checkbox, null, "Cari \u015Firk\u0259tdir"))), /*#__PURE__*/React.createElement(DeleteModal, {
|
|
258
|
+
onCancel: function onCancel() {
|
|
259
|
+
return dispatch(setDeleteModalVisible(false));
|
|
260
|
+
},
|
|
261
|
+
width: 280
|
|
262
|
+
}, /*#__PURE__*/React.createElement(Delete, {
|
|
263
|
+
onDelete: function onDelete() {
|
|
264
|
+
return dispatch(deleteCompanies(id));
|
|
265
|
+
},
|
|
266
|
+
onCancel: function onCancel() {
|
|
267
|
+
return dispatch(setDeleteModalVisible(false));
|
|
268
|
+
},
|
|
269
|
+
value: "Soraqçanı"
|
|
270
|
+
})), /*#__PURE__*/React.createElement(ViewModal, {
|
|
271
|
+
onCancel: closeOnViewModal,
|
|
272
|
+
width: 695
|
|
273
|
+
}, /*#__PURE__*/React.createElement(Success, {
|
|
274
|
+
onClick: closeOnViewModal,
|
|
275
|
+
value: "Soraqça"
|
|
276
|
+
}))))));
|
|
277
|
+
};
|
|
278
|
+
export default QuestionnairesDocumentTypeContent;
|
|
@@ -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: "Ad",
|
|
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
|
+
};
|