@banch0u/core-project-test-repository 1.3.1 → 1.4.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/variables.css +1 -1
- package/dist/assets/icons/index.js +37 -0
- package/dist/components/FormModal/index.js +142 -0
- package/dist/components/FormModal/index.module.scss +14 -0
- package/dist/components/NotificationDropdown/index.js +161 -0
- package/dist/components/NotificationDropdown/index.module.scss +80 -0
- package/dist/components/NotificationSettingsContent/index.js +166 -0
- package/dist/components/NotificationSettingsContent/index.module.scss +70 -0
- package/dist/components/ProfileOptions/index.js +128 -0
- package/dist/components/ProfileOptions/index.module.scss +131 -0
- package/dist/index.js +14 -5
- package/dist/layout/Header/index.js +36 -0
- package/dist/layout/Header/index.module.scss +19 -0
- package/dist/store/coreProvider.js +9 -0
- package/dist/store/slices/global/index.js +10 -3
- package/dist/store/slices/notification/index.js +207 -0
- package/dist/store/slices/notification/service.js +121 -0
- package/dist/store/store.js +2 -1
- package/dist/utils/axios.js +7 -6
- package/package.json +1 -1
|
@@ -178,4 +178,41 @@ export var UserIcon = function UserIcon() {
|
|
|
178
178
|
d: "M39.82 57.3401H17.67L0 51.4901L18.42 45.3801H36.25L36.28 45.4001L17.88 51.4901L28.89 55.1301L41.11 45.3801H63.19L81.62 51.4901L63.94 57.3401H46.05L63.73 51.4901L52.03 47.6101",
|
|
179
179
|
fill: "#0E6AA9"
|
|
180
180
|
}));
|
|
181
|
+
};
|
|
182
|
+
export var CategoryIcon = function CategoryIcon() {
|
|
183
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
184
|
+
width: "30",
|
|
185
|
+
height: "30",
|
|
186
|
+
viewBox: "0 0 30 30",
|
|
187
|
+
fill: "none",
|
|
188
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
189
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
190
|
+
d: "M6.25 12.5H8.75C11.25 12.5 12.5 11.25 12.5 8.75V6.25C12.5 3.75 11.25 2.5 8.75 2.5H6.25C3.75 2.5 2.5 3.75 2.5 6.25V8.75C2.5 11.25 3.75 12.5 6.25 12.5Z",
|
|
191
|
+
stroke: "#141522",
|
|
192
|
+
strokeWidth: "1.875",
|
|
193
|
+
strokeMiterlimit: "10",
|
|
194
|
+
strokeLinecap: "round",
|
|
195
|
+
strokeLinejoin: "round"
|
|
196
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
197
|
+
d: "M21.25 12.5H23.75C26.25 12.5 27.5 11.25 27.5 8.75V6.25C27.5 3.75 26.25 2.5 23.75 2.5H21.25C18.75 2.5 17.5 3.75 17.5 6.25V8.75C17.5 11.25 18.75 12.5 21.25 12.5Z",
|
|
198
|
+
stroke: "#141522",
|
|
199
|
+
strokeWidth: "1.875",
|
|
200
|
+
strokeMiterlimit: "10",
|
|
201
|
+
strokeLinecap: "round",
|
|
202
|
+
strokeLinejoin: "round"
|
|
203
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
204
|
+
d: "M21.25 27.5H23.75C26.25 27.5 27.5 26.25 27.5 23.75V21.25C27.5 18.75 26.25 17.5 23.75 17.5H21.25C18.75 17.5 17.5 18.75 17.5 21.25V23.75C17.5 26.25 18.75 27.5 21.25 27.5Z",
|
|
205
|
+
stroke: "#141522",
|
|
206
|
+
strokeWidth: "1.875",
|
|
207
|
+
strokeMiterlimit: "10",
|
|
208
|
+
strokeLinecap: "round",
|
|
209
|
+
strokeLinejoin: "round"
|
|
210
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
211
|
+
d: "M6.25 27.5H8.75C11.25 27.5 12.5 26.25 12.5 23.75V21.25C12.5 18.75 11.25 17.5 8.75 17.5H6.25C3.75 17.5 2.5 18.75 2.5 21.25V23.75C2.5 26.25 3.75 27.5 6.25 27.5Z",
|
|
212
|
+
stroke: "#141522",
|
|
213
|
+
strokeWidth: "1.875",
|
|
214
|
+
strokeMiterlimit: "10",
|
|
215
|
+
strokeLinecap: "round",
|
|
216
|
+
strokeLinejoin: "round"
|
|
217
|
+
}));
|
|
181
218
|
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { Form, Modal } from "antd";
|
|
5
|
+
import React, { forwardRef, useCallback, useImperativeHandle, useState } from "react";
|
|
6
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
7
|
+
import { setCitizenSearchId, setSubtopicSelectDisabled } from "../../store/slices/global";
|
|
8
|
+
import style from "./index.module.scss";
|
|
9
|
+
import { Button } from "@banch0u/core-project-test-repository";
|
|
10
|
+
var FormModal = function FormModal(_ref, ref) {
|
|
11
|
+
var okText = _ref.okText,
|
|
12
|
+
cancelText = _ref.cancelText,
|
|
13
|
+
title = _ref.title,
|
|
14
|
+
titleEdit = _ref.titleEdit,
|
|
15
|
+
children = _ref.children,
|
|
16
|
+
width = _ref.width,
|
|
17
|
+
onSubmit = _ref.onSubmit,
|
|
18
|
+
onEdit = _ref.onEdit,
|
|
19
|
+
_ref$showButtons = _ref.showButtons,
|
|
20
|
+
showButtons = _ref$showButtons === void 0 ? true : _ref$showButtons,
|
|
21
|
+
customForm = _ref.customForm,
|
|
22
|
+
_ref$centered = _ref.centered,
|
|
23
|
+
centered = _ref$centered === void 0 ? true : _ref$centered,
|
|
24
|
+
className = _ref.className,
|
|
25
|
+
onCloseModal = _ref.onCloseModal,
|
|
26
|
+
setKey = _ref.setKey,
|
|
27
|
+
_ref$overlayClosable = _ref.overlayClosable,
|
|
28
|
+
overlayClosable = _ref$overlayClosable === void 0 ? true : _ref$overlayClosable,
|
|
29
|
+
_ref$closable = _ref.closable,
|
|
30
|
+
closable = _ref$closable === void 0 ? true : _ref$closable;
|
|
31
|
+
var useForm = Form.useForm;
|
|
32
|
+
var _useForm = useForm(),
|
|
33
|
+
_useForm2 = _slicedToArray(_useForm, 1),
|
|
34
|
+
form = _useForm2[0];
|
|
35
|
+
var dispatch = useDispatch();
|
|
36
|
+
if (customForm) {
|
|
37
|
+
customForm(form);
|
|
38
|
+
}
|
|
39
|
+
var _useState = useState(false),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
isVisible = _useState2[0],
|
|
42
|
+
setIsVisible = _useState2[1];
|
|
43
|
+
var _useState3 = useState(false),
|
|
44
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
|
+
_isEditing = _useState4[0],
|
|
46
|
+
setIsEditing = _useState4[1];
|
|
47
|
+
var loading = useSelector(function (state) {
|
|
48
|
+
return state.global.loading;
|
|
49
|
+
});
|
|
50
|
+
useImperativeHandle(ref, function () {
|
|
51
|
+
return {
|
|
52
|
+
open: function open() {
|
|
53
|
+
setIsVisible(true);
|
|
54
|
+
setIsEditing(false);
|
|
55
|
+
form.resetFields();
|
|
56
|
+
},
|
|
57
|
+
close: function close() {
|
|
58
|
+
closeModal();
|
|
59
|
+
},
|
|
60
|
+
setEdit: function setEdit(data) {
|
|
61
|
+
setIsVisible(true);
|
|
62
|
+
setIsEditing(true);
|
|
63
|
+
form.setFieldsValue(data);
|
|
64
|
+
},
|
|
65
|
+
isEditing: function isEditing() {
|
|
66
|
+
return _isEditing;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
var closeModal = function closeModal() {
|
|
71
|
+
if (onCloseModal) onCloseModal();
|
|
72
|
+
if (setKey) setKey(function (prevKey) {
|
|
73
|
+
return prevKey + 1;
|
|
74
|
+
});
|
|
75
|
+
setIsVisible(false);
|
|
76
|
+
};
|
|
77
|
+
var onFormSubmit = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
78
|
+
var data;
|
|
79
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
80
|
+
while (1) switch (_context.prev = _context.next) {
|
|
81
|
+
case 0:
|
|
82
|
+
_context.prev = 0;
|
|
83
|
+
data = form.getFieldsValue();
|
|
84
|
+
if (!(_isEditing && onEdit !== undefined)) {
|
|
85
|
+
_context.next = 7;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
_context.next = 5;
|
|
89
|
+
return onEdit(form.getFieldValue("id"), data);
|
|
90
|
+
case 5:
|
|
91
|
+
_context.next = 9;
|
|
92
|
+
break;
|
|
93
|
+
case 7:
|
|
94
|
+
_context.next = 9;
|
|
95
|
+
return onSubmit(data);
|
|
96
|
+
case 9:
|
|
97
|
+
form.resetFields();
|
|
98
|
+
setIsVisible(false);
|
|
99
|
+
_context.next = 15;
|
|
100
|
+
break;
|
|
101
|
+
case 13:
|
|
102
|
+
_context.prev = 13;
|
|
103
|
+
_context.t0 = _context["catch"](0);
|
|
104
|
+
case 15:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context.stop();
|
|
107
|
+
}
|
|
108
|
+
}, _callee, null, [[0, 13]]);
|
|
109
|
+
})), [form, _isEditing, onEdit, onSubmit]);
|
|
110
|
+
var onDelete = useCallback(function (id) {
|
|
111
|
+
onDelete(id);
|
|
112
|
+
}, []);
|
|
113
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
114
|
+
className: className === "absolute" ? style.absolute : null,
|
|
115
|
+
open: isVisible,
|
|
116
|
+
width: width,
|
|
117
|
+
title: _isEditing ? titleEdit : title,
|
|
118
|
+
okText: okText,
|
|
119
|
+
cancelText: cancelText,
|
|
120
|
+
onOk: form.submit,
|
|
121
|
+
onCancel: closeModal,
|
|
122
|
+
maskClosable: overlayClosable,
|
|
123
|
+
closable: closable,
|
|
124
|
+
footer: showButtons ? /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
className: style.buttons
|
|
126
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
127
|
+
color: "white",
|
|
128
|
+
onClick: closeModal
|
|
129
|
+
}, cancelText), /*#__PURE__*/React.createElement(Button, {
|
|
130
|
+
color: "green",
|
|
131
|
+
onClick: form.submit
|
|
132
|
+
}, okText)) : null,
|
|
133
|
+
centered: centered
|
|
134
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
135
|
+
disabled: loading,
|
|
136
|
+
onFinish: onFormSubmit,
|
|
137
|
+
form: form,
|
|
138
|
+
layout: "vertical",
|
|
139
|
+
requiredMark: false
|
|
140
|
+
}, children));
|
|
141
|
+
};
|
|
142
|
+
export default /*#__PURE__*/forwardRef(FormModal);
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import React, { useCallback, useRef, useState } from "react";
|
|
5
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
6
|
+
import { readNotification, readNotificationAll } from "../../store/slices/notification";
|
|
7
|
+
import { Button, Form, List, Typography } from "antd";
|
|
8
|
+
import { CheckOutlined, EyeOutlined, SettingOutlined } from "@ant-design/icons";
|
|
9
|
+
import { Modal } from "antd";
|
|
10
|
+
import style from "./index.module.scss";
|
|
11
|
+
import NotificationSettingsContent from "../NotificationSettingsContent";
|
|
12
|
+
import FormModal from "../FormModal";
|
|
13
|
+
var NotificationDropdown = function NotificationDropdown(_ref) {
|
|
14
|
+
var _notifications$notifi;
|
|
15
|
+
var size = _ref.size,
|
|
16
|
+
page = _ref.page,
|
|
17
|
+
setSize = _ref.setSize,
|
|
18
|
+
setPage = _ref.setPage;
|
|
19
|
+
var dispatch = useDispatch();
|
|
20
|
+
var ref = useRef();
|
|
21
|
+
var notifications = useSelector(function (state) {
|
|
22
|
+
return state.notification.notifications;
|
|
23
|
+
});
|
|
24
|
+
var _useState = useState(false),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
isSettingsOpen = _useState2[0],
|
|
27
|
+
setIsSettingsOpen = _useState2[1];
|
|
28
|
+
var notReadenCount = notifications === null || notifications === void 0 ? void 0 : notifications.notReadenCount;
|
|
29
|
+
var totalCount = notifications === null || notifications === void 0 ? void 0 : notifications.totalCount;
|
|
30
|
+
var items = (notifications === null || notifications === void 0 || (_notifications$notifi = notifications.notifications) === null || _notifications$notifi === void 0 ? void 0 : _notifications$notifi.items) || [];
|
|
31
|
+
var hasMore = items.length < totalCount;
|
|
32
|
+
var projects = ["", "Sənəd dövriyyəsi", "Kadrlar sistemi", "Müqavilələr", "Şəxsi kabinet"];
|
|
33
|
+
var parseNotification = function parseNotification(value) {
|
|
34
|
+
try {
|
|
35
|
+
return JSON.parse(value);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.error("Invalid JSON in notification:", value);
|
|
38
|
+
return {
|
|
39
|
+
Text: value
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var onOpenModal = function onOpenModal() {
|
|
44
|
+
var _ref$current;
|
|
45
|
+
ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.open();
|
|
46
|
+
};
|
|
47
|
+
var handleRead = function handleRead(id) {
|
|
48
|
+
return dispatch(readNotification({
|
|
49
|
+
id: id
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
var handleReadAll = function handleReadAll() {
|
|
53
|
+
dispatch(readNotificationAll());
|
|
54
|
+
};
|
|
55
|
+
var handleNotificationClick = /*#__PURE__*/function () {
|
|
56
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(value, id) {
|
|
57
|
+
var parsed, redirectByProject, url;
|
|
58
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
59
|
+
while (1) switch (_context.prev = _context.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
parsed = parseNotification(value);
|
|
62
|
+
_context.next = 3;
|
|
63
|
+
return handleRead(id);
|
|
64
|
+
case 3:
|
|
65
|
+
redirectByProject = {
|
|
66
|
+
1: "/docflow/document-circulation/unread-docs",
|
|
67
|
+
2: "/hr/hr",
|
|
68
|
+
3: "/contracts/unread-contract",
|
|
69
|
+
4: "/accounts/private"
|
|
70
|
+
};
|
|
71
|
+
url = redirectByProject[parsed.Project];
|
|
72
|
+
if (url) {
|
|
73
|
+
window.location.href = "".concat(window.location.origin).concat(url);
|
|
74
|
+
}
|
|
75
|
+
case 6:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context.stop();
|
|
78
|
+
}
|
|
79
|
+
}, _callee);
|
|
80
|
+
}));
|
|
81
|
+
return function handleNotificationClick(_x, _x2) {
|
|
82
|
+
return _ref2.apply(this, arguments);
|
|
83
|
+
};
|
|
84
|
+
}();
|
|
85
|
+
var handleLoadMore = function handleLoadMore() {
|
|
86
|
+
var newSize = size + 20;
|
|
87
|
+
setSize(newSize);
|
|
88
|
+
setPage(1); // always use page 1 when growing size
|
|
89
|
+
};
|
|
90
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: style.dropdownWrapper
|
|
92
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
className: style.header
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Typography.Text, {
|
|
95
|
+
strong: true
|
|
96
|
+
}, "Bildiri\u015Fl\u0259r (", totalCount, ")"), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: style.headerActions
|
|
98
|
+
}, notReadenCount > 0 && /*#__PURE__*/React.createElement(Button, {
|
|
99
|
+
size: "small",
|
|
100
|
+
icon: /*#__PURE__*/React.createElement(CheckOutlined, null),
|
|
101
|
+
onClick: handleReadAll,
|
|
102
|
+
type: "text"
|
|
103
|
+
}, "Ham\u0131s\u0131n\u0131 oxu"), /*#__PURE__*/React.createElement(Button, {
|
|
104
|
+
size: "small",
|
|
105
|
+
icon: /*#__PURE__*/React.createElement(SettingOutlined, null),
|
|
106
|
+
type: "text",
|
|
107
|
+
onClick: function onClick() {
|
|
108
|
+
return onOpenModal();
|
|
109
|
+
}
|
|
110
|
+
}))), /*#__PURE__*/React.createElement(List, {
|
|
111
|
+
dataSource: items,
|
|
112
|
+
locale: {
|
|
113
|
+
emptyText: "Bildiriş yoxdur"
|
|
114
|
+
},
|
|
115
|
+
renderItem: function renderItem(item) {
|
|
116
|
+
var parsed = parseNotification(item.text);
|
|
117
|
+
return /*#__PURE__*/React.createElement(List.Item, {
|
|
118
|
+
className: "".concat(style.notificationItem, " ").concat(!item.read ? style.unread : ""),
|
|
119
|
+
actions: [!item.read && /*#__PURE__*/React.createElement(Button, {
|
|
120
|
+
size: "small",
|
|
121
|
+
type: "link",
|
|
122
|
+
icon: /*#__PURE__*/React.createElement(EyeOutlined, null),
|
|
123
|
+
onClick: function onClick() {
|
|
124
|
+
return handleRead(item.id);
|
|
125
|
+
}
|
|
126
|
+
})]
|
|
127
|
+
}, /*#__PURE__*/React.createElement(List.Item.Meta, {
|
|
128
|
+
title: /*#__PURE__*/React.createElement("span", {
|
|
129
|
+
onClick: function onClick() {
|
|
130
|
+
return handleNotificationClick(item.text, item.id);
|
|
131
|
+
},
|
|
132
|
+
style: {
|
|
133
|
+
cursor: "pointer"
|
|
134
|
+
}
|
|
135
|
+
}, projects[parsed.Project] || "Bildiriş"),
|
|
136
|
+
description: /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
className: style.ellipsisText,
|
|
138
|
+
onClick: function onClick() {
|
|
139
|
+
return handleNotificationClick(item.text, item.id);
|
|
140
|
+
},
|
|
141
|
+
style: {
|
|
142
|
+
cursor: "pointer"
|
|
143
|
+
}
|
|
144
|
+
}, parsed.Text || "Bildiriş")
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
}), hasMore && /*#__PURE__*/React.createElement("div", {
|
|
148
|
+
className: style.loadMore
|
|
149
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
150
|
+
size: "small",
|
|
151
|
+
type: "text",
|
|
152
|
+
onClick: handleLoadMore
|
|
153
|
+
}, "Daha \xE7ox g\xF6st\u0259r"))), /*#__PURE__*/React.createElement(FormModal, {
|
|
154
|
+
ref: ref,
|
|
155
|
+
width: 695,
|
|
156
|
+
showButtons: false
|
|
157
|
+
}, /*#__PURE__*/React.createElement(NotificationSettingsContent, {
|
|
158
|
+
ref: ref
|
|
159
|
+
})));
|
|
160
|
+
};
|
|
161
|
+
export default NotificationDropdown;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
.dropdownWrapper {
|
|
2
|
+
width: 320px;
|
|
3
|
+
max-height: 420px;
|
|
4
|
+
overflow-y: auto;
|
|
5
|
+
overflow-x: hidden;
|
|
6
|
+
// padding: 10px;
|
|
7
|
+
background-color: #ffffff;
|
|
8
|
+
background-clip: padding-box;
|
|
9
|
+
border-radius: 8px;
|
|
10
|
+
outline: none;
|
|
11
|
+
scrollbar-gutter: stable;
|
|
12
|
+
box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
13
|
+
0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
14
|
+
|
|
15
|
+
ul {
|
|
16
|
+
padding: 0 !important;
|
|
17
|
+
margin: 0 !important;
|
|
18
|
+
list-style: none;
|
|
19
|
+
li {
|
|
20
|
+
padding: 12px 10px !important;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&::-webkit-scrollbar {
|
|
25
|
+
width: 6px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&::-webkit-scrollbar-thumb {
|
|
29
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
30
|
+
border-radius: 3px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.header {
|
|
35
|
+
position: sticky;
|
|
36
|
+
top: 0;
|
|
37
|
+
z-index: 10;
|
|
38
|
+
background: #fff;
|
|
39
|
+
padding: 10px 12px;
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
align-items: center;
|
|
43
|
+
border-bottom: 1px solid #f0f0f0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.notificationItem {
|
|
47
|
+
transition: background 0.3s;
|
|
48
|
+
|
|
49
|
+
&:hover {
|
|
50
|
+
background-color: #deeaf5;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.unread {
|
|
55
|
+
background-color: #f6f6f6;
|
|
56
|
+
font-weight: 600;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.loadMore {
|
|
60
|
+
text-align: center;
|
|
61
|
+
margin: 10px 0;
|
|
62
|
+
button {
|
|
63
|
+
color: var(--darkBlueColor);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
.ellipsisText {
|
|
67
|
+
display: -webkit-box;
|
|
68
|
+
-webkit-line-clamp: 3; // max 3 lines
|
|
69
|
+
-webkit-box-orient: vertical;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
text-overflow: ellipsis;
|
|
72
|
+
word-break: break-word;
|
|
73
|
+
line-height: 1.5;
|
|
74
|
+
max-height: calc(1.5em * 3); // 3 lines
|
|
75
|
+
}
|
|
76
|
+
.headerActions {
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: 8px;
|
|
80
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
6
|
+
import { Form, Switch, Typography, Row, Col, Select } from "antd";
|
|
7
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
8
|
+
import { editNotificationSettings, getNotificationSettings } from "../../store/slices/notification";
|
|
9
|
+
import style from "./index.module.scss";
|
|
10
|
+
import Button from "../Button";
|
|
11
|
+
var Title = Typography.Title,
|
|
12
|
+
Text = Typography.Text;
|
|
13
|
+
var Option = Select.Option;
|
|
14
|
+
var labels = {
|
|
15
|
+
internalIsActive: "Daxili bildirişlər",
|
|
16
|
+
emailIsActive: "Email bildirişləri",
|
|
17
|
+
visa: "Viza üçün",
|
|
18
|
+
sign: "İmza üçün",
|
|
19
|
+
reject: "İmtina üçün",
|
|
20
|
+
print: "Çap üçün"
|
|
21
|
+
};
|
|
22
|
+
var projectOptions = {
|
|
23
|
+
docFlowSettings: {
|
|
24
|
+
label: "Sənəd Dövriyyəsi",
|
|
25
|
+
keys: ["visa", "sign", "reject", "print"]
|
|
26
|
+
},
|
|
27
|
+
contractSettings: {
|
|
28
|
+
label: "Müqavilələr",
|
|
29
|
+
keys: ["visa", "sign", "reject"]
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var NotificationSettingsContent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
33
|
+
var _allValues$generalSet, _allValues$generalSet2, _allValues$generalSet3, _allValues$generalSet4;
|
|
34
|
+
var _Form$useForm = Form.useForm(),
|
|
35
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
36
|
+
form = _Form$useForm2[0];
|
|
37
|
+
var dispatch = useDispatch();
|
|
38
|
+
var initialValues = useSelector(function (state) {
|
|
39
|
+
return state.notification.notificationSettings;
|
|
40
|
+
});
|
|
41
|
+
var _useState = useState("docFlowSettings"),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
selectedProject = _useState2[0],
|
|
44
|
+
setSelectedProject = _useState2[1];
|
|
45
|
+
var _useState3 = useState({}),
|
|
46
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
+
allValues = _useState4[0],
|
|
48
|
+
setAllValues = _useState4[1];
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
dispatch(getNotificationSettings());
|
|
51
|
+
}, [dispatch]);
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
if (initialValues) {
|
|
54
|
+
setAllValues(initialValues);
|
|
55
|
+
form.setFieldsValue(initialValues);
|
|
56
|
+
}
|
|
57
|
+
}, [initialValues, form]);
|
|
58
|
+
var handleSwitchChange = function handleSwitchChange(namePath, checked) {
|
|
59
|
+
var updated = _objectSpread({}, allValues);
|
|
60
|
+
var target = updated;
|
|
61
|
+
namePath.forEach(function (key, i) {
|
|
62
|
+
if (i === namePath.length - 1) {
|
|
63
|
+
target[key] = checked;
|
|
64
|
+
} else {
|
|
65
|
+
target[key] = _objectSpread({}, target[key]);
|
|
66
|
+
target = target[key];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
setAllValues(updated);
|
|
70
|
+
form.setFieldsValue(updated);
|
|
71
|
+
};
|
|
72
|
+
var renderSwitches = function renderSwitches(type) {
|
|
73
|
+
return projectOptions[selectedProject].keys.map(function (key) {
|
|
74
|
+
var _allValues$selectedPr, _allValues$selectedPr2;
|
|
75
|
+
return /*#__PURE__*/React.createElement(Col, {
|
|
76
|
+
span: 12,
|
|
77
|
+
key: "".concat(selectedProject, "-").concat(type, "-").concat(key)
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
79
|
+
className: style.inlineSwitch,
|
|
80
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
81
|
+
className: style.formLabel
|
|
82
|
+
}, labels[key])
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
84
|
+
checked: (_allValues$selectedPr = allValues === null || allValues === void 0 || (_allValues$selectedPr2 = allValues[selectedProject]) === null || _allValues$selectedPr2 === void 0 || (_allValues$selectedPr2 = _allValues$selectedPr2[type]) === null || _allValues$selectedPr2 === void 0 ? void 0 : _allValues$selectedPr2[key]) !== null && _allValues$selectedPr !== void 0 ? _allValues$selectedPr : false,
|
|
85
|
+
onChange: function onChange(checked) {
|
|
86
|
+
return handleSwitchChange([selectedProject, type, key], checked);
|
|
87
|
+
}
|
|
88
|
+
})));
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
var onSubmit = useCallback(function (data) {
|
|
92
|
+
console.log(data, "ew");
|
|
93
|
+
dispatch(editNotificationSettings(data));
|
|
94
|
+
}, [dispatch]);
|
|
95
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: style.settingsWrapper
|
|
97
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
98
|
+
level: 5,
|
|
99
|
+
className: style.sectionTitle
|
|
100
|
+
}, "\xDCmumi Bildiri\u015F Ayarlar\u0131"), /*#__PURE__*/React.createElement(Row, {
|
|
101
|
+
gutter: [40, 0]
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Col, {
|
|
103
|
+
span: 12
|
|
104
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
105
|
+
className: style.inlineSwitch,
|
|
106
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
107
|
+
className: style.formLabel
|
|
108
|
+
}, labels.internalIsActive)
|
|
109
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
110
|
+
checked: (_allValues$generalSet = allValues === null || allValues === void 0 || (_allValues$generalSet2 = allValues.generalSettings) === null || _allValues$generalSet2 === void 0 ? void 0 : _allValues$generalSet2.internalIsActive) !== null && _allValues$generalSet !== void 0 ? _allValues$generalSet : false,
|
|
111
|
+
onChange: function onChange(checked) {
|
|
112
|
+
return handleSwitchChange(["generalSettings", "internalIsActive"], checked);
|
|
113
|
+
}
|
|
114
|
+
}))), /*#__PURE__*/React.createElement(Col, {
|
|
115
|
+
span: 12
|
|
116
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
117
|
+
className: style.inlineSwitch,
|
|
118
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
119
|
+
className: style.formLabel
|
|
120
|
+
}, labels.emailIsActive)
|
|
121
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
122
|
+
checked: (_allValues$generalSet3 = allValues === null || allValues === void 0 || (_allValues$generalSet4 = allValues.generalSettings) === null || _allValues$generalSet4 === void 0 ? void 0 : _allValues$generalSet4.emailIsActive) !== null && _allValues$generalSet3 !== void 0 ? _allValues$generalSet3 : false,
|
|
123
|
+
onChange: function onChange(checked) {
|
|
124
|
+
return handleSwitchChange(["generalSettings", "emailIsActive"], checked);
|
|
125
|
+
}
|
|
126
|
+
})))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
127
|
+
label: ""
|
|
128
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
129
|
+
value: selectedProject,
|
|
130
|
+
onChange: function onChange(val) {
|
|
131
|
+
return setSelectedProject(val);
|
|
132
|
+
},
|
|
133
|
+
className: style.modal_select
|
|
134
|
+
}, Object.entries(projectOptions).map(function (_ref) {
|
|
135
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
136
|
+
key = _ref2[0],
|
|
137
|
+
label = _ref2[1].label;
|
|
138
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
139
|
+
key: key,
|
|
140
|
+
value: key
|
|
141
|
+
}, label);
|
|
142
|
+
}))), /*#__PURE__*/React.createElement(Text, {
|
|
143
|
+
className: style.settingGroupTitle
|
|
144
|
+
}, "Daxili"), /*#__PURE__*/React.createElement(Row, {
|
|
145
|
+
gutter: [40, 0]
|
|
146
|
+
}, renderSwitches("internalSettings")), /*#__PURE__*/React.createElement(Text, {
|
|
147
|
+
className: style.settingGroupTitle
|
|
148
|
+
}, "Email"), /*#__PURE__*/React.createElement(Row, {
|
|
149
|
+
gutter: [40, 0]
|
|
150
|
+
}, renderSwitches("emailSettings")), /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
className: style.next_buttons_
|
|
152
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
153
|
+
onClick: function onClick(e) {
|
|
154
|
+
var _ref$current, _ref$current$close;
|
|
155
|
+
ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 || (_ref$current$close = _ref$current.close) === null || _ref$current$close === void 0 || _ref$current$close.call(_ref$current);
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
},
|
|
158
|
+
color: "white"
|
|
159
|
+
}, "L\u0259\u011Fv et"), /*#__PURE__*/React.createElement(Button, {
|
|
160
|
+
color: "green",
|
|
161
|
+
onClick: function onClick() {
|
|
162
|
+
return onSubmit(allValues);
|
|
163
|
+
}
|
|
164
|
+
}, "Yadda saxla")));
|
|
165
|
+
});
|
|
166
|
+
export default NotificationSettingsContent;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.settingsWrapper {
|
|
2
|
+
padding-right: 8px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.sectionTitle {
|
|
6
|
+
margin-bottom: 16px;
|
|
7
|
+
font-weight: 600;
|
|
8
|
+
color: #1f1f1f;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.settingGroupTitle {
|
|
12
|
+
margin: 12px 0 8px;
|
|
13
|
+
font-size: 16px;
|
|
14
|
+
color: #888;
|
|
15
|
+
font-weight: 500;
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.formLabel {
|
|
20
|
+
font-weight: 500;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.inlineSwitch {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
margin-bottom: 12px;
|
|
29
|
+
|
|
30
|
+
.ant-form-item-label {
|
|
31
|
+
flex: 1;
|
|
32
|
+
margin: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ant-form-item-control {
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
margin-left: 16px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ant-switch {
|
|
41
|
+
margin-left: auto;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.modal_select > div {
|
|
45
|
+
padding: 5px 16px !important;
|
|
46
|
+
// border-color: #bdbdbd !important;
|
|
47
|
+
border-radius: 6px !important;
|
|
48
|
+
height: 48px;
|
|
49
|
+
}
|
|
50
|
+
.modal_select {
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: auto;
|
|
53
|
+
height: 48px;
|
|
54
|
+
span {
|
|
55
|
+
font-size: 16px !important;
|
|
56
|
+
font-weight: 500 !important;
|
|
57
|
+
line-height: 24px !important;
|
|
58
|
+
text-align: left !important;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
.next_buttons_ {
|
|
62
|
+
display: flex;
|
|
63
|
+
justify-content: flex-end;
|
|
64
|
+
gap: 20px;
|
|
65
|
+
margin-top: 10px;
|
|
66
|
+
button {
|
|
67
|
+
border-radius: 6px;
|
|
68
|
+
padding: 9px 19px;
|
|
69
|
+
}
|
|
70
|
+
}
|