@bigbinary/neeto-approvals-frontend 1.1.0 → 1.2.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/Approvals.js +1086 -0
- package/dist/Approvals.js.map +1 -0
- package/dist/Form.js +219 -0
- package/dist/Form.js.map +1 -0
- package/dist/Public.js +174 -0
- package/dist/Public.js.map +1 -0
- package/dist/RequestDetailsPane.js +26 -0
- package/dist/RequestDetailsPane.js.map +1 -0
- package/dist/cjs/Approvals.js +1134 -0
- package/dist/cjs/Approvals.js.map +1 -0
- package/dist/cjs/Form.js +231 -0
- package/dist/cjs/Form.js.map +1 -0
- package/dist/cjs/Public.js +188 -0
- package/dist/cjs/Public.js.map +1 -0
- package/dist/cjs/RequestDetailsPane.js +32 -0
- package/dist/cjs/RequestDetailsPane.js.map +1 -0
- package/dist/cjs/index.js +62 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/constants-752da2ba.js +158 -0
- package/dist/constants-752da2ba.js.map +1 -0
- package/dist/constants-d561fb6c.js +194 -0
- package/dist/constants-d561fb6c.js.map +1 -0
- package/dist/index-458211fe.js +271 -0
- package/dist/index-458211fe.js.map +1 -0
- package/dist/index-c6f5a782.js +290 -0
- package/dist/index-c6f5a782.js.map +1 -0
- package/dist/index.js +50 -1919
- package/dist/index.js.map +1 -1
- package/dist/useTemplatesApi-5d82bdca.js +107 -0
- package/dist/useTemplatesApi-5d82bdca.js.map +1 -0
- package/dist/useTemplatesApi-dc60dcdd.js +97 -0
- package/dist/useTemplatesApi-dc60dcdd.js.map +1 -0
- package/package.json +23 -11
- package/dist/index.cjs.js +0 -1979
- package/dist/index.cjs.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,1920 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} : function (o) {
|
|
52
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
53
|
-
}, _typeof(o);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _toPrimitive(input, hint) {
|
|
57
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
58
|
-
var prim = input[Symbol.toPrimitive];
|
|
59
|
-
if (prim !== undefined) {
|
|
60
|
-
var res = prim.call(input, hint || "default");
|
|
61
|
-
if (_typeof(res) !== "object") return res;
|
|
62
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
63
|
-
}
|
|
64
|
-
return (hint === "string" ? String : Number)(input);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function _toPropertyKey(arg) {
|
|
68
|
-
var key = _toPrimitive(arg, "string");
|
|
69
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function _defineProperty(obj, key, value) {
|
|
73
|
-
key = _toPropertyKey(key);
|
|
74
|
-
if (key in obj) {
|
|
75
|
-
Object.defineProperty(obj, key, {
|
|
76
|
-
value: value,
|
|
77
|
-
enumerable: true,
|
|
78
|
-
configurable: true,
|
|
79
|
-
writable: true
|
|
80
|
-
});
|
|
81
|
-
} else {
|
|
82
|
-
obj[key] = value;
|
|
83
|
-
}
|
|
84
|
-
return obj;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function _arrayWithHoles(arr) {
|
|
88
|
-
if (Array.isArray(arr)) return arr;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function _iterableToArrayLimit(r, l) {
|
|
92
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
93
|
-
if (null != t) {
|
|
94
|
-
var e,
|
|
95
|
-
n,
|
|
96
|
-
i,
|
|
97
|
-
u,
|
|
98
|
-
a = [],
|
|
99
|
-
f = !0,
|
|
100
|
-
o = !1;
|
|
101
|
-
try {
|
|
102
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
103
|
-
if (Object(t) !== t) return;
|
|
104
|
-
f = !1;
|
|
105
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
106
|
-
} catch (r) {
|
|
107
|
-
o = !0, n = r;
|
|
108
|
-
} finally {
|
|
109
|
-
try {
|
|
110
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
111
|
-
} finally {
|
|
112
|
-
if (o) throw n;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return a;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function _arrayLikeToArray(arr, len) {
|
|
120
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
121
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
122
|
-
return arr2;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
126
|
-
if (!o) return;
|
|
127
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
128
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
129
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
130
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
131
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function _nonIterableRest() {
|
|
135
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function _slicedToArray(arr, i) {
|
|
139
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
var routes = {
|
|
143
|
-
home: "/",
|
|
144
|
-
approvals: "/approvals/",
|
|
145
|
-
pending: "pending",
|
|
146
|
-
history: "history",
|
|
147
|
-
templates: {
|
|
148
|
-
index: "templates",
|
|
149
|
-
"new": "templates/new",
|
|
150
|
-
edit: "templates/:id/edit"
|
|
151
|
-
},
|
|
152
|
-
"public": "approvals/public/request/:id"
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
var handleEmptyPage = function handleEmptyPage(data, pageProperties, handlePageChange) {
|
|
156
|
-
if (isEmpty(data) && pageProperties.page !== 1) {
|
|
157
|
-
handlePageChange(pageProperties.page - 1, pageProperties.pageSize);
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
var BASE_URL = "neeto_approvals";
|
|
162
|
-
var TEMPLATE_URL = "".concat(BASE_URL, "/templates");
|
|
163
|
-
|
|
164
|
-
var fetch$3 = function fetch(params, url) {
|
|
165
|
-
return axios.get(url, {
|
|
166
|
-
params: params
|
|
167
|
-
});
|
|
168
|
-
};
|
|
169
|
-
var update$1 = function update(_ref) {
|
|
170
|
-
var id = _ref.id,
|
|
171
|
-
payload = _ref.payload;
|
|
172
|
-
return axios.put("".concat(BASE_URL, "/requests/").concat(id), {
|
|
173
|
-
request: payload
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
var requestsApi = {
|
|
177
|
-
fetch: fetch$3,
|
|
178
|
-
update: update$1
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
var QUERY_KEYS = {
|
|
182
|
-
APPROVERS: "neeto-approvals-approvers",
|
|
183
|
-
TEMPLATES: "neeto-approvals-templates",
|
|
184
|
-
REQUESTS: "neeto-approvals-requests",
|
|
185
|
-
SHOW_TEMPLATE: "neeto-approvals-show-template",
|
|
186
|
-
SHOW_PUBLIC_REQUEST: "neeto-approvals-show-public-request",
|
|
187
|
-
VIEWS: "neeto-approvals-views"
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
function ownKeys$b(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; }
|
|
191
|
-
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
192
|
-
var useFetchRequests = function useFetchRequests(_ref) {
|
|
193
|
-
var requestUrl = _ref.requestUrl,
|
|
194
|
-
_ref$params = _ref.params,
|
|
195
|
-
params = _ref$params === void 0 ? {} : _ref$params,
|
|
196
|
-
_ref$options = _ref.options,
|
|
197
|
-
options = _ref$options === void 0 ? {} : _ref$options;
|
|
198
|
-
return useQuery(_objectSpread$b({
|
|
199
|
-
queryKey: [QUERY_KEYS.REQUESTS, params],
|
|
200
|
-
queryFn: function queryFn() {
|
|
201
|
-
return requestsApi.fetch(params, requestUrl);
|
|
202
|
-
},
|
|
203
|
-
select: function select(response) {
|
|
204
|
-
return response.data || response;
|
|
205
|
-
},
|
|
206
|
-
placeholderData: keepPreviousData
|
|
207
|
-
}, options));
|
|
208
|
-
};
|
|
209
|
-
var useUpdateRequest = function useUpdateRequest(options) {
|
|
210
|
-
return useMutationWithInvalidation(requestsApi.update, _objectSpread$b({
|
|
211
|
-
keysToInvalidate: [[QUERY_KEYS.REQUESTS], [QUERY_KEYS.VIEWS]]
|
|
212
|
-
}, options));
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
var usePaginate = function usePaginate() {
|
|
216
|
-
var _useState = useState({
|
|
217
|
-
page: DEFAULT_PAGE_INDEX,
|
|
218
|
-
pageSize: DEFAULT_PAGE_SIZE
|
|
219
|
-
}),
|
|
220
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
221
|
-
pageProperties = _useState2[0],
|
|
222
|
-
setPageProperties = _useState2[1];
|
|
223
|
-
var resetPageProperties = function resetPageProperties() {
|
|
224
|
-
return setPageProperties({
|
|
225
|
-
page: DEFAULT_PAGE_INDEX,
|
|
226
|
-
pageSize: DEFAULT_PAGE_SIZE
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
var handlePageChange = function handlePageChange(page, pageSize) {
|
|
230
|
-
setPageProperties({
|
|
231
|
-
page: page,
|
|
232
|
-
pageSize: pageSize
|
|
233
|
-
});
|
|
234
|
-
};
|
|
235
|
-
return {
|
|
236
|
-
pageProperties: pageProperties,
|
|
237
|
-
resetPageProperties: resetPageProperties,
|
|
238
|
-
handlePageChange: handlePageChange
|
|
239
|
-
};
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
var DEFAULT_FILTER_VALUES = {
|
|
243
|
-
searchTerm: "",
|
|
244
|
-
sortBy: "",
|
|
245
|
-
orderBy: ""
|
|
246
|
-
};
|
|
247
|
-
var SEARCH_DELAY = 750;
|
|
248
|
-
var STATUSES = {
|
|
249
|
-
approved: "approved",
|
|
250
|
-
rejected: "rejected",
|
|
251
|
-
pending: "pending",
|
|
252
|
-
cancelled: "cancelled"
|
|
253
|
-
};
|
|
254
|
-
var STATUS_TAG_STYLE = {
|
|
255
|
-
pending: "primary",
|
|
256
|
-
approved: "success",
|
|
257
|
-
rejected: "danger",
|
|
258
|
-
cancelled: "warning"
|
|
259
|
-
};
|
|
260
|
-
var APPROVAL_REQUEST_FORM_INITIAL_VALUES = {
|
|
261
|
-
message: "",
|
|
262
|
-
approver: {}
|
|
263
|
-
};
|
|
264
|
-
var STATUS_UPDATED_BY = {
|
|
265
|
-
rejected: t$1("neetoApprovals.common.rejectedBy"),
|
|
266
|
-
approved: t$1("neetoApprovals.common.approvedBy"),
|
|
267
|
-
cancelled: t$1("neetoApprovals.common.cancelledBy")
|
|
268
|
-
};
|
|
269
|
-
var DATA_CY_KEY = "data-cy";
|
|
270
|
-
var SORT_ORDER = {
|
|
271
|
-
ascend: "asc",
|
|
272
|
-
descend: "desc"
|
|
273
|
-
};
|
|
274
|
-
var REQUEST_FORM_VALIDATION_SCHEMA = yup.object().shape({
|
|
275
|
-
message: yup.string().test("message", t$1("neetoApprovals.validations.required", {
|
|
276
|
-
what: t$1("neetoApprovals.inputs.labels.message")
|
|
277
|
-
}), function (content) {
|
|
278
|
-
return !isEditorEmpty(content);
|
|
279
|
-
}),
|
|
280
|
-
approver: yup.object().required(t$1("neetoApprovals.validations.approver"))
|
|
281
|
-
});
|
|
282
|
-
var EVENTS = {
|
|
283
|
-
APPROVAL_TEMPLATE_CREATED: "approval_template_created"
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
var HISTORY_TABLE_COLUMNS = [{
|
|
287
|
-
dataIndex: "approvalLabel",
|
|
288
|
-
key: "approvalLabel",
|
|
289
|
-
sorter: true,
|
|
290
|
-
width: "25%",
|
|
291
|
-
title: t$1("neetoApprovals.common.id"),
|
|
292
|
-
render: function render(approvalLabel, _ref) {
|
|
293
|
-
var requestableUrl = _ref.requestableUrl;
|
|
294
|
-
var url = new URL(requestableUrl || window.location.origin);
|
|
295
|
-
return /*#__PURE__*/jsx(Button, {
|
|
296
|
-
label: approvalLabel,
|
|
297
|
-
style: "link",
|
|
298
|
-
to: url.pathname
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
}, {
|
|
302
|
-
dataIndex: "title",
|
|
303
|
-
key: "title",
|
|
304
|
-
sorter: true,
|
|
305
|
-
width: "25%",
|
|
306
|
-
title: t$1("neetoApprovals.common.title")
|
|
307
|
-
}, {
|
|
308
|
-
dataIndex: "status",
|
|
309
|
-
key: "status",
|
|
310
|
-
sorter: true,
|
|
311
|
-
width: "25%",
|
|
312
|
-
title: t$1("neetoApprovals.common.status"),
|
|
313
|
-
render: function render(status) {
|
|
314
|
-
return /*#__PURE__*/jsx(Tag, {
|
|
315
|
-
label: capitalize(status),
|
|
316
|
-
style: STATUS_TAG_STYLE[status]
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
}, {
|
|
320
|
-
dataIndex: "createdAt",
|
|
321
|
-
key: "createdAt",
|
|
322
|
-
sorter: true,
|
|
323
|
-
width: "25%",
|
|
324
|
-
title: t$1("neetoApprovals.common.created"),
|
|
325
|
-
render: function render(createdAt) {
|
|
326
|
-
return /*#__PURE__*/jsx(DateFormat.FromNow, {
|
|
327
|
-
date: createdAt,
|
|
328
|
-
typographyProps: {
|
|
329
|
-
style: "body2"
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
}];
|
|
334
|
-
|
|
335
|
-
var Footer = function Footer(_ref) {
|
|
336
|
-
var isLoading = _ref.isLoading,
|
|
337
|
-
handleSubmit = _ref.handleSubmit,
|
|
338
|
-
isCurrentUserApprover = _ref.isCurrentUserApprover,
|
|
339
|
-
isCurrentUserRequester = _ref.isCurrentUserRequester;
|
|
340
|
-
var _useTranslation = useTranslation(),
|
|
341
|
-
t = _useTranslation.t;
|
|
342
|
-
if (!isCurrentUserApprover && !isCurrentUserRequester) return null;
|
|
343
|
-
if (isCurrentUserApprover) {
|
|
344
|
-
return /*#__PURE__*/jsxs(Pane.Footer, {
|
|
345
|
-
className: "flex gap-x-2",
|
|
346
|
-
children: [/*#__PURE__*/jsx(Button, {
|
|
347
|
-
label: t("neetoApprovals.buttons.approve"),
|
|
348
|
-
loading: isLoading,
|
|
349
|
-
type: "submit",
|
|
350
|
-
onClick: function onClick() {
|
|
351
|
-
return handleSubmit(STATUSES.approved);
|
|
352
|
-
}
|
|
353
|
-
}), /*#__PURE__*/jsx(Button, {
|
|
354
|
-
label: t("neetoApprovals.buttons.decline"),
|
|
355
|
-
loading: isLoading,
|
|
356
|
-
style: "text",
|
|
357
|
-
onClick: function onClick() {
|
|
358
|
-
return handleSubmit(STATUSES.rejected);
|
|
359
|
-
}
|
|
360
|
-
})]
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
return /*#__PURE__*/jsx(Pane.Footer, {
|
|
364
|
-
className: "flex gap-x-2",
|
|
365
|
-
children: /*#__PURE__*/jsx(Button, {
|
|
366
|
-
label: t("neetoApprovals.buttons.cancelRequest"),
|
|
367
|
-
loading: isLoading,
|
|
368
|
-
type: "submit",
|
|
369
|
-
onClick: function onClick() {
|
|
370
|
-
return handleSubmit(STATUSES.cancelled);
|
|
371
|
-
}
|
|
372
|
-
})
|
|
373
|
-
});
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
dayjs.extend(utc);
|
|
377
|
-
dayjs.extend(timezone);
|
|
378
|
-
var updateApprovalDetails = function updateApprovalDetails(_ref) {
|
|
379
|
-
var requestsData = _ref.requestsData,
|
|
380
|
-
approvalDetails = _ref.approvalDetails;
|
|
381
|
-
if (isPresent(requestsData === null || requestsData === void 0 ? void 0 : requestsData.requests) && isPresent(approvalDetails)) {
|
|
382
|
-
var request = findBy({
|
|
383
|
-
id: approvalDetails.id
|
|
384
|
-
}, requestsData.requests) || {};
|
|
385
|
-
return request;
|
|
386
|
-
}
|
|
387
|
-
return {};
|
|
388
|
-
};
|
|
389
|
-
var timeInZone = function timeInZone(time) {
|
|
390
|
-
var _globalProps$user, _globalProps$user2;
|
|
391
|
-
((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.timeZone) && dayjs.tz.setDefault((_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.timeZone);
|
|
392
|
-
return dayjs(time).tz();
|
|
393
|
-
};
|
|
394
|
-
var getApprovalFilter = function getApprovalFilter() {
|
|
395
|
-
return {
|
|
396
|
-
PENDING: {
|
|
397
|
-
label: t$1("neetoApprovals.common.pending"),
|
|
398
|
-
value: "PENDING"
|
|
399
|
-
},
|
|
400
|
-
TEMPLATES: {
|
|
401
|
-
label: t$1("neetoApprovals.common.template", PLURAL),
|
|
402
|
-
value: "TEMPLATES"
|
|
403
|
-
},
|
|
404
|
-
HISTORY: {
|
|
405
|
-
label: t$1("neetoApprovals.common.history"),
|
|
406
|
-
value: "HISTORY"
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
var MemoizedEditorContent$1 = /*#__PURE__*/memo(EditorContent);
|
|
412
|
-
var RequestDetailsPane = function RequestDetailsPane(_ref) {
|
|
413
|
-
var _window$globalProps, _window$globalProps2;
|
|
414
|
-
var isOpen = _ref.isOpen,
|
|
415
|
-
onClose = _ref.onClose,
|
|
416
|
-
approvalDetails = _ref.approvalDetails,
|
|
417
|
-
_ref$isPending = _ref.isPending,
|
|
418
|
-
isPending = _ref$isPending === void 0 ? false : _ref$isPending;
|
|
419
|
-
var _useTranslation = useTranslation(),
|
|
420
|
-
t = _useTranslation.t;
|
|
421
|
-
var title = approvalDetails.title,
|
|
422
|
-
_approvalDetails$stat = approvalDetails.status,
|
|
423
|
-
status = _approvalDetails$stat === void 0 ? "" : _approvalDetails$stat,
|
|
424
|
-
message = approvalDetails.message,
|
|
425
|
-
createdAt = approvalDetails.createdAt,
|
|
426
|
-
approverName = approvalDetails.approverName,
|
|
427
|
-
approverEmail = approvalDetails.approverEmail,
|
|
428
|
-
_approvalDetails$note = approvalDetails.note,
|
|
429
|
-
initialNote = _approvalDetails$note === void 0 ? "" : _approvalDetails$note,
|
|
430
|
-
requesterName = approvalDetails.requesterName,
|
|
431
|
-
requesterEmail = approvalDetails.requesterEmail;
|
|
432
|
-
var _useState = useState(initialNote),
|
|
433
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
434
|
-
note = _useState2[0],
|
|
435
|
-
setNote = _useState2[1];
|
|
436
|
-
var _useUpdateRequest = useUpdateRequest(),
|
|
437
|
-
updatePendingRequest = _useUpdateRequest.mutate,
|
|
438
|
-
isUpdateRequestPending = _useUpdateRequest.isPending;
|
|
439
|
-
useEffect(function () {
|
|
440
|
-
setNote(initialNote);
|
|
441
|
-
}, [initialNote]);
|
|
442
|
-
var requesterOrApproverDetails = status === STATUSES.cancelled ? "".concat(requesterName, " (").concat(requesterEmail, ")") : "".concat(approverName, " (").concat(approverEmail, ")");
|
|
443
|
-
var isCurrentUserApprover = ((_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 || (_window$globalProps = _window$globalProps.user) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.email) === approverEmail;
|
|
444
|
-
var isCurrentUserRequester = ((_window$globalProps2 = window.globalProps) === null || _window$globalProps2 === void 0 || (_window$globalProps2 = _window$globalProps2.user) === null || _window$globalProps2 === void 0 ? void 0 : _window$globalProps2.email) === requesterEmail;
|
|
445
|
-
var getStatusLabel = function getStatusLabel() {
|
|
446
|
-
if (isPending) {
|
|
447
|
-
return t("neetoApprovals.common.waitingFor");
|
|
448
|
-
}
|
|
449
|
-
return STATUS_UPDATED_BY[status];
|
|
450
|
-
};
|
|
451
|
-
var handleOnClose = function handleOnClose() {
|
|
452
|
-
setNote("");
|
|
453
|
-
onClose();
|
|
454
|
-
};
|
|
455
|
-
var handleSubmit = function handleSubmit(status) {
|
|
456
|
-
return updatePendingRequest({
|
|
457
|
-
id: approvalDetails.id,
|
|
458
|
-
payload: _defineProperty({
|
|
459
|
-
status: status,
|
|
460
|
-
note: note
|
|
461
|
-
}, "".concat(status, "At"), new Date())
|
|
462
|
-
}, {
|
|
463
|
-
onSuccess: handleOnClose
|
|
464
|
-
});
|
|
465
|
-
};
|
|
466
|
-
return /*#__PURE__*/jsxs(Pane, {
|
|
467
|
-
isOpen: isOpen,
|
|
468
|
-
size: "large",
|
|
469
|
-
onClose: handleOnClose,
|
|
470
|
-
children: [/*#__PURE__*/jsxs(Pane.Header, {
|
|
471
|
-
className: "space-y-2",
|
|
472
|
-
children: [/*#__PURE__*/jsx(Typography, {
|
|
473
|
-
style: "h2",
|
|
474
|
-
children: title
|
|
475
|
-
}), /*#__PURE__*/jsx(Tag, {
|
|
476
|
-
label: capitalize(status),
|
|
477
|
-
style: STATUS_TAG_STYLE[status]
|
|
478
|
-
})]
|
|
479
|
-
}), /*#__PURE__*/jsxs(Pane.Body, {
|
|
480
|
-
className: "space-y-6",
|
|
481
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
482
|
-
className: "w-full divide-y border px-3",
|
|
483
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
484
|
-
className: "flex space-x-3 p-2",
|
|
485
|
-
children: [/*#__PURE__*/jsx(Label, {
|
|
486
|
-
className: "font-normal",
|
|
487
|
-
children: getStatusLabel()
|
|
488
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
489
|
-
style: "body2",
|
|
490
|
-
weight: "medium",
|
|
491
|
-
children: requesterOrApproverDetails
|
|
492
|
-
})]
|
|
493
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
494
|
-
className: "flex space-x-3 p-2",
|
|
495
|
-
children: [/*#__PURE__*/jsx(Label, {
|
|
496
|
-
className: "font-normal",
|
|
497
|
-
children: t("neetoApprovals.common.created")
|
|
498
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
499
|
-
style: "body2",
|
|
500
|
-
weight: "medium",
|
|
501
|
-
children: dateFormat.defaultWithTime(timeInZone(createdAt))
|
|
502
|
-
})]
|
|
503
|
-
})]
|
|
504
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
505
|
-
className: "w-full space-y-2",
|
|
506
|
-
children: [/*#__PURE__*/jsx(Label, {
|
|
507
|
-
children: t("neetoApprovals.inputs.labels.message")
|
|
508
|
-
}), /*#__PURE__*/jsx(MemoizedEditorContent$1, {
|
|
509
|
-
className: "neeto-ui-bg-gray-100 p-4",
|
|
510
|
-
content: message
|
|
511
|
-
})]
|
|
512
|
-
}), isPending && isCurrentUserApprover && /*#__PURE__*/jsx(Textarea, {
|
|
513
|
-
className: "w-full",
|
|
514
|
-
disabled: !isPending,
|
|
515
|
-
label: t("neetoApprovals.common.note"),
|
|
516
|
-
value: note,
|
|
517
|
-
placeholder: t("neetoApprovals.inputs.placeholders.add_", {
|
|
518
|
-
what: t("neetoApprovals.common.note")
|
|
519
|
-
}),
|
|
520
|
-
onChange: withEventTargetValue(setNote)
|
|
521
|
-
}), !isPending && note && /*#__PURE__*/jsxs("div", {
|
|
522
|
-
className: "w-full space-y-2",
|
|
523
|
-
children: [/*#__PURE__*/jsx(Label, {
|
|
524
|
-
children: t("neetoApprovals.common.note")
|
|
525
|
-
}), /*#__PURE__*/jsx("div", {
|
|
526
|
-
className: "neeto-ui-bg-gray-100 p-4",
|
|
527
|
-
children: note
|
|
528
|
-
})]
|
|
529
|
-
})]
|
|
530
|
-
}), isPending && /*#__PURE__*/jsx(Footer, {
|
|
531
|
-
handleSubmit: handleSubmit,
|
|
532
|
-
isCurrentUserApprover: isCurrentUserApprover,
|
|
533
|
-
isCurrentUserRequester: isCurrentUserRequester,
|
|
534
|
-
isLoading: isUpdateRequestPending
|
|
535
|
-
})]
|
|
536
|
-
});
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
function ownKeys$a(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; }
|
|
540
|
-
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
541
|
-
var History = function History(_ref) {
|
|
542
|
-
var helpDocUrl = _ref.helpDocUrl,
|
|
543
|
-
requestUrl = _ref.requestUrl;
|
|
544
|
-
var _useState = useState(DEFAULT_FILTER_VALUES),
|
|
545
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
546
|
-
filters = _useState2[0],
|
|
547
|
-
setFilters = _useState2[1];
|
|
548
|
-
var debouncedSearchTerm = useDebounce(filters.searchTerm, SEARCH_DELAY);
|
|
549
|
-
var _usePaginate = usePaginate(),
|
|
550
|
-
pageProperties = _usePaginate.pageProperties,
|
|
551
|
-
handlePageChange = _usePaginate.handlePageChange;
|
|
552
|
-
var _useState3 = useState({}),
|
|
553
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
554
|
-
approvalDetails = _useState4[0],
|
|
555
|
-
setApprovalDetails = _useState4[1];
|
|
556
|
-
var _useTranslation = useTranslation(),
|
|
557
|
-
t = _useTranslation.t;
|
|
558
|
-
var _useFetchRequests = useFetchRequests({
|
|
559
|
-
params: _objectSpread$a(_objectSpread$a(_objectSpread$a({}, pageProperties), filters), {}, {
|
|
560
|
-
searchTerm: debouncedSearchTerm.trim(),
|
|
561
|
-
status: [STATUSES.approved, STATUSES.rejected, STATUSES.cancelled]
|
|
562
|
-
}),
|
|
563
|
-
requestUrl: requestUrl
|
|
564
|
-
}),
|
|
565
|
-
data = _useFetchRequests.data;
|
|
566
|
-
var _ref2 = data || {},
|
|
567
|
-
_ref2$requests = _ref2.requests,
|
|
568
|
-
approvalHistories = _ref2$requests === void 0 ? {} : _ref2$requests,
|
|
569
|
-
_ref2$totalCount = _ref2.totalCount,
|
|
570
|
-
totalCount = _ref2$totalCount === void 0 ? 0 : _ref2$totalCount;
|
|
571
|
-
useEffect(function () {
|
|
572
|
-
if (!data) return;
|
|
573
|
-
handleEmptyPage(data === null || data === void 0 ? void 0 : data.requests, pageProperties, handlePageChange);
|
|
574
|
-
setApprovalDetails(function (approvalDetails) {
|
|
575
|
-
return updateApprovalDetails({
|
|
576
|
-
requestsData: data === null || data === void 0 ? void 0 : data.requests,
|
|
577
|
-
approvalDetails: approvalDetails
|
|
578
|
-
});
|
|
579
|
-
});
|
|
580
|
-
}, [data]);
|
|
581
|
-
var handleTableChange = function handleTableChange(_, __, sorter) {
|
|
582
|
-
setFilters(_objectSpread$a(_objectSpread$a({}, filters), {}, {
|
|
583
|
-
sortBy: camelToSnakeCase(sorter.field || ""),
|
|
584
|
-
orderBy: SORT_ORDER[sorter.order]
|
|
585
|
-
}));
|
|
586
|
-
};
|
|
587
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
588
|
-
children: [!isEmpty(approvalHistories) ? /*#__PURE__*/jsx(TableWrapper, {
|
|
589
|
-
className: "mt-6",
|
|
590
|
-
hasPagination: totalCount > pageProperties.pageSize,
|
|
591
|
-
children: /*#__PURE__*/jsx(Table$1, {
|
|
592
|
-
handlePageChange: handlePageChange,
|
|
593
|
-
totalCount: totalCount,
|
|
594
|
-
allowRowClick: true,
|
|
595
|
-
fixedHeight: true,
|
|
596
|
-
columnData: HISTORY_TABLE_COLUMNS,
|
|
597
|
-
currentPageNumber: pageProperties.page,
|
|
598
|
-
defaultPageSize: pageProperties.pageSize,
|
|
599
|
-
rowData: approvalHistories,
|
|
600
|
-
paginationProps: {
|
|
601
|
-
hideOnSinglePage: (approvalHistories === null || approvalHistories === void 0 ? void 0 : approvalHistories.length) < DEFAULT_PAGE_SIZE + 1
|
|
602
|
-
},
|
|
603
|
-
onChange: handleTableChange,
|
|
604
|
-
onRowClick: function onRowClick(_, approvalDetails) {
|
|
605
|
-
return setApprovalDetails(approvalDetails);
|
|
606
|
-
}
|
|
607
|
-
})
|
|
608
|
-
}) : /*#__PURE__*/jsx("div", {
|
|
609
|
-
className: "flex h-full w-full flex-grow items-center justify-center",
|
|
610
|
-
children: /*#__PURE__*/jsx(NoData, {
|
|
611
|
-
helpText: /*#__PURE__*/jsx(Trans, {
|
|
612
|
-
i18nKey: "neetoApprovals.common.noDataHelpTextLearnMore",
|
|
613
|
-
style: "link",
|
|
614
|
-
values: {
|
|
615
|
-
entity: t("neetoApprovals.common.history")
|
|
616
|
-
},
|
|
617
|
-
components: {
|
|
618
|
-
a: /*#__PURE__*/jsx(Button, {
|
|
619
|
-
style: "link",
|
|
620
|
-
target: "_blank",
|
|
621
|
-
to: {
|
|
622
|
-
pathname: helpDocUrl
|
|
623
|
-
}
|
|
624
|
-
})
|
|
625
|
-
}
|
|
626
|
-
}),
|
|
627
|
-
title: t("neetoApprovals.common.notFound_", {
|
|
628
|
-
what: t("neetoApprovals.common.record", PLURAL)
|
|
629
|
-
})
|
|
630
|
-
})
|
|
631
|
-
}), /*#__PURE__*/jsx(RequestDetailsPane, {
|
|
632
|
-
approvalDetails: approvalDetails,
|
|
633
|
-
isOpen: isPresent(approvalDetails),
|
|
634
|
-
onClose: function onClose() {
|
|
635
|
-
return setApprovalDetails({});
|
|
636
|
-
}
|
|
637
|
-
})]
|
|
638
|
-
});
|
|
639
|
-
};
|
|
640
|
-
|
|
641
|
-
var PENDING_TABLE_COLUMNS = removeBy({
|
|
642
|
-
key: "status"
|
|
643
|
-
}, HISTORY_TABLE_COLUMNS);
|
|
644
|
-
|
|
645
|
-
function ownKeys$9(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; }
|
|
646
|
-
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
647
|
-
var PendingRequests = function PendingRequests(_ref) {
|
|
648
|
-
var helpDocUrl = _ref.helpDocUrl,
|
|
649
|
-
requestUrl = _ref.requestUrl;
|
|
650
|
-
var _useState = useState(DEFAULT_FILTER_VALUES),
|
|
651
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
652
|
-
filters = _useState2[0],
|
|
653
|
-
setFilters = _useState2[1];
|
|
654
|
-
var _useState3 = useState({}),
|
|
655
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
656
|
-
approvalDetails = _useState4[0],
|
|
657
|
-
setApprovalDetails = _useState4[1];
|
|
658
|
-
var debouncedSearchTerm = useDebounce(filters.searchTerm, SEARCH_DELAY);
|
|
659
|
-
var _usePaginate = usePaginate(),
|
|
660
|
-
pageProperties = _usePaginate.pageProperties,
|
|
661
|
-
handlePageChange = _usePaginate.handlePageChange;
|
|
662
|
-
var _useTranslation = useTranslation(),
|
|
663
|
-
t = _useTranslation.t;
|
|
664
|
-
var _useFetchRequests = useFetchRequests({
|
|
665
|
-
params: _objectSpread$9(_objectSpread$9(_objectSpread$9({}, pageProperties), filters), {}, {
|
|
666
|
-
searchTerm: debouncedSearchTerm.trim(),
|
|
667
|
-
status: [STATUSES.pending]
|
|
668
|
-
}),
|
|
669
|
-
requestUrl: requestUrl
|
|
670
|
-
}),
|
|
671
|
-
data = _useFetchRequests.data;
|
|
672
|
-
var _ref2 = data || {},
|
|
673
|
-
_ref2$requests = _ref2.requests,
|
|
674
|
-
pendingRequests = _ref2$requests === void 0 ? {} : _ref2$requests,
|
|
675
|
-
_ref2$totalCount = _ref2.totalCount,
|
|
676
|
-
totalCount = _ref2$totalCount === void 0 ? 0 : _ref2$totalCount;
|
|
677
|
-
useEffect(function () {
|
|
678
|
-
if (!data) return;
|
|
679
|
-
handleEmptyPage(data === null || data === void 0 ? void 0 : data.requests, pageProperties, handlePageChange);
|
|
680
|
-
}, [data]);
|
|
681
|
-
var handleTableChange = function handleTableChange(_, __, sorter) {
|
|
682
|
-
setFilters(_objectSpread$9(_objectSpread$9({}, filters), {}, {
|
|
683
|
-
sortBy: camelToSnakeCase(sorter.field || ""),
|
|
684
|
-
orderBy: SORT_ORDER[sorter.order]
|
|
685
|
-
}));
|
|
686
|
-
};
|
|
687
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
688
|
-
children: [!isEmpty(pendingRequests) ? /*#__PURE__*/jsx(TableWrapper, {
|
|
689
|
-
className: "mt-6",
|
|
690
|
-
hasPagination: totalCount > pageProperties.pageSize,
|
|
691
|
-
children: /*#__PURE__*/jsx(Table$1, {
|
|
692
|
-
handlePageChange: handlePageChange,
|
|
693
|
-
totalCount: totalCount,
|
|
694
|
-
allowRowClick: true,
|
|
695
|
-
fixedHeight: true,
|
|
696
|
-
columnData: PENDING_TABLE_COLUMNS,
|
|
697
|
-
currentPageNumber: pageProperties.page,
|
|
698
|
-
defaultPageSize: pageProperties.pageSize,
|
|
699
|
-
rowData: pendingRequests,
|
|
700
|
-
paginationProps: {
|
|
701
|
-
hideOnSinglePage: (pendingRequests === null || pendingRequests === void 0 ? void 0 : pendingRequests.length) < DEFAULT_PAGE_SIZE + 1
|
|
702
|
-
},
|
|
703
|
-
onChange: handleTableChange,
|
|
704
|
-
onRowClick: function onRowClick(_, approvalDetails) {
|
|
705
|
-
return setApprovalDetails(approvalDetails);
|
|
706
|
-
}
|
|
707
|
-
})
|
|
708
|
-
}) : /*#__PURE__*/jsx("div", {
|
|
709
|
-
className: "flex h-full w-full flex-grow items-center justify-center",
|
|
710
|
-
children: /*#__PURE__*/jsx(NoData, {
|
|
711
|
-
helpText: /*#__PURE__*/jsx(Trans, {
|
|
712
|
-
i18nKey: "neetoApprovals.common.noDataHelpTextLearnMore",
|
|
713
|
-
style: "link",
|
|
714
|
-
components: {
|
|
715
|
-
a: /*#__PURE__*/jsx(Button, {
|
|
716
|
-
style: "link",
|
|
717
|
-
target: "_blank",
|
|
718
|
-
to: {
|
|
719
|
-
pathname: helpDocUrl
|
|
720
|
-
}
|
|
721
|
-
})
|
|
722
|
-
},
|
|
723
|
-
values: {
|
|
724
|
-
entity: t("neetoApprovals.common.pendingApproval", PLURAL)
|
|
725
|
-
}
|
|
726
|
-
}),
|
|
727
|
-
title: t("neetoApprovals.common.notFound_", {
|
|
728
|
-
what: t("neetoApprovals.common.pendingApproval", PLURAL)
|
|
729
|
-
})
|
|
730
|
-
})
|
|
731
|
-
}), /*#__PURE__*/jsx(RequestDetailsPane, {
|
|
732
|
-
approvalDetails: approvalDetails,
|
|
733
|
-
isPending: true,
|
|
734
|
-
isOpen: isPresent(approvalDetails),
|
|
735
|
-
onClose: function onClose() {
|
|
736
|
-
return setApprovalDetails({});
|
|
737
|
-
}
|
|
738
|
-
})]
|
|
739
|
-
});
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
743
|
-
if (source == null) return {};
|
|
744
|
-
var target = {};
|
|
745
|
-
var sourceKeys = Object.keys(source);
|
|
746
|
-
var key, i;
|
|
747
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
748
|
-
key = sourceKeys[i];
|
|
749
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
750
|
-
target[key] = source[key];
|
|
751
|
-
}
|
|
752
|
-
return target;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
function _objectWithoutProperties(source, excluded) {
|
|
756
|
-
if (source == null) return {};
|
|
757
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
758
|
-
var key, i;
|
|
759
|
-
if (Object.getOwnPropertySymbols) {
|
|
760
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
761
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
762
|
-
key = sourceSymbolKeys[i];
|
|
763
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
764
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
765
|
-
target[key] = source[key];
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
return target;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
var fetch$2 = function fetch(params) {
|
|
772
|
-
return axios.get(TEMPLATE_URL, {
|
|
773
|
-
params: params
|
|
774
|
-
});
|
|
775
|
-
};
|
|
776
|
-
var show$1 = function show(_ref) {
|
|
777
|
-
var id = _ref.id,
|
|
778
|
-
params = _ref.params;
|
|
779
|
-
return axios.get("".concat(TEMPLATE_URL, "/").concat(id), {
|
|
780
|
-
params: params
|
|
781
|
-
});
|
|
782
|
-
};
|
|
783
|
-
var create = function create(_ref2) {
|
|
784
|
-
var _ref2$url = _ref2.url,
|
|
785
|
-
url = _ref2$url === void 0 ? TEMPLATE_URL : _ref2$url,
|
|
786
|
-
payload = _ref2.payload;
|
|
787
|
-
return axios.post(url, payload);
|
|
788
|
-
};
|
|
789
|
-
var update = function update(_ref3) {
|
|
790
|
-
var id = _ref3.id,
|
|
791
|
-
payload = _ref3.payload,
|
|
792
|
-
_ref3$url = _ref3.url,
|
|
793
|
-
url = _ref3$url === void 0 ? BASE_URL : _ref3$url;
|
|
794
|
-
return axios.put("".concat(url, "/").concat(id), payload);
|
|
795
|
-
};
|
|
796
|
-
var destroy = function destroy(_ref4) {
|
|
797
|
-
var templateId = _ref4.templateId;
|
|
798
|
-
return axios["delete"]("".concat(TEMPLATE_URL, "/").concat(templateId));
|
|
799
|
-
};
|
|
800
|
-
var templatesApi = {
|
|
801
|
-
create: create,
|
|
802
|
-
fetch: fetch$2,
|
|
803
|
-
update: update,
|
|
804
|
-
destroy: destroy,
|
|
805
|
-
show: show$1
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
function ownKeys$8(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; }
|
|
809
|
-
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
810
|
-
var useFetchTemplates = function useFetchTemplates() {
|
|
811
|
-
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
812
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
813
|
-
return useQuery(_objectSpread$8({
|
|
814
|
-
queryKey: [QUERY_KEYS.TEMPLATES, params],
|
|
815
|
-
queryFn: function queryFn() {
|
|
816
|
-
return templatesApi.fetch(params);
|
|
817
|
-
},
|
|
818
|
-
select: function select(response) {
|
|
819
|
-
return response.data || response;
|
|
820
|
-
},
|
|
821
|
-
placeholderData: keepPreviousData
|
|
822
|
-
}, options));
|
|
823
|
-
};
|
|
824
|
-
var useFetchTemplate = function useFetchTemplate(_ref) {
|
|
825
|
-
var id = _ref.id,
|
|
826
|
-
params = _ref.params;
|
|
827
|
-
return useQuery({
|
|
828
|
-
queryKey: [QUERY_KEYS.SHOW_TEMPLATE, id, params],
|
|
829
|
-
queryFn: function queryFn() {
|
|
830
|
-
return templatesApi.show({
|
|
831
|
-
id: id,
|
|
832
|
-
params: params
|
|
833
|
-
});
|
|
834
|
-
},
|
|
835
|
-
enabled: !!id
|
|
836
|
-
});
|
|
837
|
-
};
|
|
838
|
-
var useCreateTemplate = function useCreateTemplate() {
|
|
839
|
-
return useMutationWithInvalidation(templatesApi.create, {
|
|
840
|
-
keysToInvalidate: [[QUERY_KEYS.TEMPLATES], [QUERY_KEYS.VIEWS]],
|
|
841
|
-
onSuccess: function onSuccess() {
|
|
842
|
-
return captureAnalyticsEvent(EVENTS.APPROVAL_TEMPLATE_CREATED);
|
|
843
|
-
}
|
|
844
|
-
});
|
|
845
|
-
};
|
|
846
|
-
var useUpdateTemplate = function useUpdateTemplate(options) {
|
|
847
|
-
return useMutationWithInvalidation(templatesApi.update, _objectSpread$8({
|
|
848
|
-
keysToInvalidate: [[QUERY_KEYS.TEMPLATES], function (_, _ref2) {
|
|
849
|
-
var id = _ref2.id;
|
|
850
|
-
return [QUERY_KEYS.SHOW_TEMPLATE, id];
|
|
851
|
-
}]
|
|
852
|
-
}, options));
|
|
853
|
-
};
|
|
854
|
-
var useDeleteTemplate = function useDeleteTemplate(options) {
|
|
855
|
-
return useMutationWithInvalidation(templatesApi.destroy, _objectSpread$8({
|
|
856
|
-
keysToInvalidate: [[QUERY_KEYS.TEMPLATES], [QUERY_KEYS.VIEWS]]
|
|
857
|
-
}, options));
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
var TEMPLATE_FORM_INITIAL_VALUES = {
|
|
861
|
-
name: "",
|
|
862
|
-
description: "",
|
|
863
|
-
message: ""
|
|
864
|
-
};
|
|
865
|
-
var TEMPLATE_FORM_VALIDATION_SCHEMA = yup.object().shape({
|
|
866
|
-
name: yup.string().trim().required(t$1("neetoApprovals.validations.required", {
|
|
867
|
-
what: t$1("neetoApprovals.common.name")
|
|
868
|
-
})),
|
|
869
|
-
message: yup.string().test("message", t$1("neetoApprovals.validations.required", {
|
|
870
|
-
what: t$1("neetoApprovals.inputs.labels.message")
|
|
871
|
-
}), function (content) {
|
|
872
|
-
return !isEditorEmpty(content);
|
|
873
|
-
})
|
|
874
|
-
});
|
|
875
|
-
|
|
876
|
-
var MessageEditor = withT(function (_ref) {
|
|
877
|
-
var t = _ref.t,
|
|
878
|
-
_ref$placeholders = _ref.placeholders,
|
|
879
|
-
placeholders = _ref$placeholders === void 0 ? [] : _ref$placeholders,
|
|
880
|
-
_ref$initialValue = _ref.initialValue,
|
|
881
|
-
initialValue = _ref$initialValue === void 0 ? "" : _ref$initialValue;
|
|
882
|
-
return /*#__PURE__*/jsx(FormikEditor, {
|
|
883
|
-
initialValue: initialValue,
|
|
884
|
-
required: true,
|
|
885
|
-
label: t("neetoApprovals.inputs.labels.message"),
|
|
886
|
-
name: "message",
|
|
887
|
-
rows: 3,
|
|
888
|
-
variables: placeholders,
|
|
889
|
-
placeholder: t("neetoApprovals.inputs.placeholders.enter_", {
|
|
890
|
-
what: t("neetoApprovals.inputs.labels.message")
|
|
891
|
-
})
|
|
892
|
-
});
|
|
893
|
-
});
|
|
894
|
-
|
|
895
|
-
var TemplateForm = function TemplateForm(_ref) {
|
|
896
|
-
var placeholders = _ref.placeholders,
|
|
897
|
-
initialData = _ref.initialData;
|
|
898
|
-
var _useTranslation = useTranslation(),
|
|
899
|
-
t = _useTranslation.t;
|
|
900
|
-
var _useFormikContext = useFormikContext(),
|
|
901
|
-
values = _useFormikContext.values,
|
|
902
|
-
setFieldValue = _useFormikContext.setFieldValue;
|
|
903
|
-
var handleDescriptionToggle = function handleDescriptionToggle(_ref2) {
|
|
904
|
-
var checked = _ref2.target.checked;
|
|
905
|
-
setFieldValue("descriptionEnabled", checked);
|
|
906
|
-
if (!checked) {
|
|
907
|
-
setFieldValue("description", "");
|
|
908
|
-
}
|
|
909
|
-
};
|
|
910
|
-
return /*#__PURE__*/jsxs("div", {
|
|
911
|
-
className: "flex w-full flex-col space-y-6",
|
|
912
|
-
children: [/*#__PURE__*/jsx(Input, {
|
|
913
|
-
autoFocus: true,
|
|
914
|
-
required: true,
|
|
915
|
-
label: t("neetoApprovals.common.name"),
|
|
916
|
-
name: "name",
|
|
917
|
-
placeholder: t("neetoApprovals.inputs.placeholders.name")
|
|
918
|
-
}), /*#__PURE__*/jsx(ToggleFeatureCard, {
|
|
919
|
-
switchName: "descriptionEnabled",
|
|
920
|
-
title: t("neetoApprovals.inputs.labels.description"),
|
|
921
|
-
switchProps: {
|
|
922
|
-
onChange: handleDescriptionToggle,
|
|
923
|
-
tooltipProps: {
|
|
924
|
-
enabledSwitchText: t("neetoApprovals.templates.descriptionToggle.enable"),
|
|
925
|
-
disabledSwitchText: t("neetoApprovals.templates.descriptionToggle.disable")
|
|
926
|
-
}
|
|
927
|
-
},
|
|
928
|
-
children: values.descriptionEnabled && /*#__PURE__*/jsx(Textarea$1, {
|
|
929
|
-
className: "w-full",
|
|
930
|
-
name: "description",
|
|
931
|
-
placeholder: t("neetoApprovals.inputs.placeholders.description")
|
|
932
|
-
})
|
|
933
|
-
}), /*#__PURE__*/jsx(MessageEditor, {
|
|
934
|
-
placeholders: placeholders,
|
|
935
|
-
initialValue: initialData.message
|
|
936
|
-
})]
|
|
937
|
-
});
|
|
938
|
-
};
|
|
939
|
-
|
|
940
|
-
var Form$2 = function Form(_ref) {
|
|
941
|
-
var isOpen = _ref.isOpen,
|
|
942
|
-
onClose = _ref.onClose,
|
|
943
|
-
_ref$initialData = _ref.initialData,
|
|
944
|
-
initialData = _ref$initialData === void 0 ? {} : _ref$initialData,
|
|
945
|
-
_ref$onSubmit = _ref.onSubmit,
|
|
946
|
-
onSubmit = _ref$onSubmit === void 0 ? noop : _ref$onSubmit,
|
|
947
|
-
_ref$isLoading = _ref.isLoading,
|
|
948
|
-
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
949
|
-
placeholders = _ref.placeholders;
|
|
950
|
-
var inputReference = useRef(null);
|
|
951
|
-
var _useTranslation = useTranslation(),
|
|
952
|
-
t = _useTranslation.t;
|
|
953
|
-
var header = isEmpty(initialData) ? t("neetoApprovals.common.addNew_", {
|
|
954
|
-
what: t("neetoApprovals.common.template", SINGULAR)
|
|
955
|
-
}) : t("neetoApprovals.common.edit_", {
|
|
956
|
-
what: t("neetoApprovals.common.template", SINGULAR)
|
|
957
|
-
});
|
|
958
|
-
return /*#__PURE__*/jsxs(Pane, {
|
|
959
|
-
isOpen: isOpen,
|
|
960
|
-
onClose: onClose,
|
|
961
|
-
initialFocusRef: inputReference,
|
|
962
|
-
size: "large",
|
|
963
|
-
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
964
|
-
children: /*#__PURE__*/jsx(Typography, {
|
|
965
|
-
style: "h2",
|
|
966
|
-
children: header
|
|
967
|
-
})
|
|
968
|
-
}), /*#__PURE__*/jsxs(FormikForm, {
|
|
969
|
-
formikProps: {
|
|
970
|
-
enableReinitialize: true,
|
|
971
|
-
initialValues: isPresent(initialData) ? initialData : TEMPLATE_FORM_INITIAL_VALUES,
|
|
972
|
-
validationSchema: TEMPLATE_FORM_VALIDATION_SCHEMA,
|
|
973
|
-
onSubmit: onSubmit
|
|
974
|
-
},
|
|
975
|
-
children: [/*#__PURE__*/jsx(Pane.Body, {
|
|
976
|
-
children: /*#__PURE__*/jsx(TemplateForm, {
|
|
977
|
-
initialData: initialData,
|
|
978
|
-
placeholders: placeholders
|
|
979
|
-
})
|
|
980
|
-
}), /*#__PURE__*/jsx(Pane.Footer, {
|
|
981
|
-
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
982
|
-
isSubmitting: isLoading,
|
|
983
|
-
cancelButtonProps: {
|
|
984
|
-
"data-cy": "neeto-approvals-templates-close-template-form-btn",
|
|
985
|
-
onClick: onClose
|
|
986
|
-
},
|
|
987
|
-
submitButtonProps: {
|
|
988
|
-
"data-cy": "neeto-approvals-templates-save-template-btn"
|
|
989
|
-
}
|
|
990
|
-
})
|
|
991
|
-
})]
|
|
992
|
-
})]
|
|
993
|
-
});
|
|
994
|
-
};
|
|
995
|
-
|
|
996
|
-
var Create = function Create(_ref) {
|
|
997
|
-
var templateUrl = _ref.templateUrl,
|
|
998
|
-
isOpen = _ref.isOpen,
|
|
999
|
-
onClose = _ref.onClose,
|
|
1000
|
-
templatePlaceholders = _ref.templatePlaceholders;
|
|
1001
|
-
var _useCreateTemplate = useCreateTemplate(),
|
|
1002
|
-
createTemplate = _useCreateTemplate.mutate,
|
|
1003
|
-
isPending = _useCreateTemplate.isPending;
|
|
1004
|
-
var onSubmit = function onSubmit(template) {
|
|
1005
|
-
var payload = {
|
|
1006
|
-
template: template
|
|
1007
|
-
};
|
|
1008
|
-
createTemplate({
|
|
1009
|
-
url: templateUrl,
|
|
1010
|
-
payload: payload
|
|
1011
|
-
}, {
|
|
1012
|
-
onSuccess: onClose
|
|
1013
|
-
});
|
|
1014
|
-
};
|
|
1015
|
-
return /*#__PURE__*/jsx(Form$2, {
|
|
1016
|
-
isOpen: isOpen,
|
|
1017
|
-
onClose: onClose,
|
|
1018
|
-
onSubmit: onSubmit,
|
|
1019
|
-
isLoading: isPending,
|
|
1020
|
-
placeholders: templatePlaceholders
|
|
1021
|
-
});
|
|
1022
|
-
};
|
|
1023
|
-
|
|
1024
|
-
function ownKeys$7(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; }
|
|
1025
|
-
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1026
|
-
var Edit = function Edit(_ref) {
|
|
1027
|
-
var templateUrl = _ref.templateUrl,
|
|
1028
|
-
template = _ref.template,
|
|
1029
|
-
setTemplate = _ref.setTemplate,
|
|
1030
|
-
isOpen = _ref.isOpen,
|
|
1031
|
-
onClose = _ref.onClose,
|
|
1032
|
-
templatePlaceholders = _ref.templatePlaceholders;
|
|
1033
|
-
var _useUpdateTemplate = useUpdateTemplate({
|
|
1034
|
-
onSuccess: function onSuccess() {
|
|
1035
|
-
return setTemplate({});
|
|
1036
|
-
}
|
|
1037
|
-
}),
|
|
1038
|
-
updateTemplate = _useUpdateTemplate.mutate,
|
|
1039
|
-
isUpdating = _useUpdateTemplate.isPending;
|
|
1040
|
-
var onSubmit = function onSubmit(template) {
|
|
1041
|
-
var payload = {
|
|
1042
|
-
template: template
|
|
1043
|
-
};
|
|
1044
|
-
updateTemplate({
|
|
1045
|
-
id: template.id,
|
|
1046
|
-
payload: payload,
|
|
1047
|
-
url: templateUrl
|
|
1048
|
-
});
|
|
1049
|
-
};
|
|
1050
|
-
var initialData = _objectSpread$7(_objectSpread$7({}, template), {}, {
|
|
1051
|
-
descriptionEnabled: !!template.description
|
|
1052
|
-
});
|
|
1053
|
-
return /*#__PURE__*/jsx(Form$2, {
|
|
1054
|
-
initialData: initialData,
|
|
1055
|
-
isOpen: isOpen,
|
|
1056
|
-
onClose: onClose,
|
|
1057
|
-
onSubmit: onSubmit,
|
|
1058
|
-
isLoading: isUpdating,
|
|
1059
|
-
placeholders: templatePlaceholders
|
|
1060
|
-
});
|
|
1061
|
-
};
|
|
1062
|
-
|
|
1063
|
-
var Field = function Field(_ref) {
|
|
1064
|
-
var label = _ref.label,
|
|
1065
|
-
value = _ref.value;
|
|
1066
|
-
return /*#__PURE__*/jsxs("div", {
|
|
1067
|
-
className: "flex flex-col items-start justify-center",
|
|
1068
|
-
children: [/*#__PURE__*/jsx(Label, {
|
|
1069
|
-
className: "mb-1 font-normal",
|
|
1070
|
-
children: label
|
|
1071
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
1072
|
-
style: "body1",
|
|
1073
|
-
weight: "medium",
|
|
1074
|
-
children: value
|
|
1075
|
-
})]
|
|
1076
|
-
});
|
|
1077
|
-
};
|
|
1078
|
-
var Field$1 = /*#__PURE__*/memo(Field);
|
|
1079
|
-
|
|
1080
|
-
var MemoizedEditorContent = /*#__PURE__*/memo(EditorContent);
|
|
1081
|
-
var TemplateDetails = function TemplateDetails(_ref) {
|
|
1082
|
-
var isOpen = _ref.isOpen,
|
|
1083
|
-
onClose = _ref.onClose,
|
|
1084
|
-
template = _ref.template;
|
|
1085
|
-
var _useTranslation = useTranslation(),
|
|
1086
|
-
t = _useTranslation.t;
|
|
1087
|
-
var name = template.name,
|
|
1088
|
-
description = template.description,
|
|
1089
|
-
message = template.message;
|
|
1090
|
-
return /*#__PURE__*/jsxs(Pane, {
|
|
1091
|
-
isOpen: isOpen,
|
|
1092
|
-
onClose: onClose,
|
|
1093
|
-
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
1094
|
-
className: "space-y-2",
|
|
1095
|
-
children: /*#__PURE__*/jsx(Typography, {
|
|
1096
|
-
style: "h2",
|
|
1097
|
-
children: t("neetoApprovals.common.templateDetails")
|
|
1098
|
-
})
|
|
1099
|
-
}), /*#__PURE__*/jsxs(Pane.Body, {
|
|
1100
|
-
className: "space-y-6",
|
|
1101
|
-
children: [/*#__PURE__*/jsx(Field$1, {
|
|
1102
|
-
label: t("neetoApprovals.common.name"),
|
|
1103
|
-
value: name
|
|
1104
|
-
}), /*#__PURE__*/jsx(Field$1, {
|
|
1105
|
-
label: t("neetoApprovals.inputs.labels.description"),
|
|
1106
|
-
value: description
|
|
1107
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
1108
|
-
className: "flex w-full flex-col space-y-4",
|
|
1109
|
-
children: [/*#__PURE__*/jsx(Label, {
|
|
1110
|
-
className: "mb-1 font-normal",
|
|
1111
|
-
children: t("neetoApprovals.inputs.labels.message")
|
|
1112
|
-
}), /*#__PURE__*/jsx(MemoizedEditorContent, {
|
|
1113
|
-
className: "neeto-ui-bg-gray-100 neeto-ui-rounded-lg p-3",
|
|
1114
|
-
content: message
|
|
1115
|
-
})]
|
|
1116
|
-
})]
|
|
1117
|
-
})]
|
|
1118
|
-
});
|
|
1119
|
-
};
|
|
1120
|
-
|
|
1121
|
-
var renderNoDataHelpText = function renderNoDataHelpText(_ref) {
|
|
1122
|
-
var entity = _ref.entity,
|
|
1123
|
-
url = _ref.url;
|
|
1124
|
-
return /*#__PURE__*/jsx(Trans, {
|
|
1125
|
-
i18nKey: "neetoApprovals.common.noDataHelpText",
|
|
1126
|
-
style: "link",
|
|
1127
|
-
values: {
|
|
1128
|
-
entity: entity.toLocaleLowerCase()
|
|
1129
|
-
},
|
|
1130
|
-
components: {
|
|
1131
|
-
a: /*#__PURE__*/jsx(Button, {
|
|
1132
|
-
style: "link",
|
|
1133
|
-
target: "_blank",
|
|
1134
|
-
to: {
|
|
1135
|
-
pathname: url
|
|
1136
|
-
}
|
|
1137
|
-
})
|
|
1138
|
-
}
|
|
1139
|
-
});
|
|
1140
|
-
};
|
|
1141
|
-
|
|
1142
|
-
var _excluded$1 = ["entity", "columnData", "rowData", "totalCount", "filters", "setFilters", "setIsPaneOpen", "helpDocUrl", "onEditClick", "onDeleteClick", "pageProperties"];
|
|
1143
|
-
function ownKeys$6(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; }
|
|
1144
|
-
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1145
|
-
var Table = function Table(_ref) {
|
|
1146
|
-
var entity = _ref.entity,
|
|
1147
|
-
columnData = _ref.columnData,
|
|
1148
|
-
rowData = _ref.rowData,
|
|
1149
|
-
totalCount = _ref.totalCount,
|
|
1150
|
-
filters = _ref.filters,
|
|
1151
|
-
setFilters = _ref.setFilters,
|
|
1152
|
-
setIsPaneOpen = _ref.setIsPaneOpen,
|
|
1153
|
-
helpDocUrl = _ref.helpDocUrl,
|
|
1154
|
-
onEditClick = _ref.onEditClick,
|
|
1155
|
-
onDeleteClick = _ref.onDeleteClick,
|
|
1156
|
-
pageProperties = _ref.pageProperties,
|
|
1157
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
1158
|
-
var _useTranslation = useTranslation(),
|
|
1159
|
-
t = _useTranslation.t;
|
|
1160
|
-
var columns = columnData({
|
|
1161
|
-
onEditClick: onEditClick,
|
|
1162
|
-
onDeleteClick: onDeleteClick
|
|
1163
|
-
});
|
|
1164
|
-
var handleTableChange = function handleTableChange(_, __, sorter) {
|
|
1165
|
-
setFilters(_objectSpread$6(_objectSpread$6({}, filters), {}, {
|
|
1166
|
-
sortBy: sorter.field,
|
|
1167
|
-
orderBy: SORT_ORDER[sorter.order]
|
|
1168
|
-
}));
|
|
1169
|
-
};
|
|
1170
|
-
var noDataProps = {
|
|
1171
|
-
primaryButtonProps: {
|
|
1172
|
-
label: t("neetoApprovals.common.addNew_", {
|
|
1173
|
-
what: t("neetoApprovals.common.template", SINGULAR)
|
|
1174
|
-
}),
|
|
1175
|
-
onClick: function onClick() {
|
|
1176
|
-
return setIsPaneOpen(true);
|
|
1177
|
-
}
|
|
1178
|
-
},
|
|
1179
|
-
helpText: renderNoDataHelpText({
|
|
1180
|
-
entity: entity,
|
|
1181
|
-
url: helpDocUrl
|
|
1182
|
-
})
|
|
1183
|
-
};
|
|
1184
|
-
if (isEmpty(rowData)) {
|
|
1185
|
-
return /*#__PURE__*/jsx("div", {
|
|
1186
|
-
className: "flex h-full w-full flex-grow items-center justify-center",
|
|
1187
|
-
children: /*#__PURE__*/jsx(NoData, _objectSpread$6({
|
|
1188
|
-
title: t("neetoApprovals.common.notFound_", {
|
|
1189
|
-
what: entity
|
|
1190
|
-
})
|
|
1191
|
-
}, !filters.searchTerm && noDataProps))
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
|
-
return /*#__PURE__*/jsx(TableWrapper, {
|
|
1195
|
-
className: "mt-6",
|
|
1196
|
-
hasPagination: totalCount > pageProperties.pageSize,
|
|
1197
|
-
children: /*#__PURE__*/jsx(Table$1, _objectSpread$6({
|
|
1198
|
-
fixedHeight: true,
|
|
1199
|
-
columnData: columns,
|
|
1200
|
-
currentPageNumber: pageProperties.page,
|
|
1201
|
-
defaultPageSize: pageProperties.pageSize,
|
|
1202
|
-
scroll: {
|
|
1203
|
-
x: 0
|
|
1204
|
-
},
|
|
1205
|
-
tableLayout: "fixed",
|
|
1206
|
-
paginationProps: {
|
|
1207
|
-
hideOnSinglePage: (rowData === null || rowData === void 0 ? void 0 : rowData.length) < DEFAULT_PAGE_SIZE + 1
|
|
1208
|
-
},
|
|
1209
|
-
onChange: handleTableChange
|
|
1210
|
-
}, _objectSpread$6({
|
|
1211
|
-
rowData: rowData,
|
|
1212
|
-
totalCount: totalCount
|
|
1213
|
-
}, otherProps)))
|
|
1214
|
-
});
|
|
1215
|
-
};
|
|
1216
|
-
|
|
1217
|
-
var columnData = function columnData(_ref) {
|
|
1218
|
-
var onEditClick = _ref.onEditClick,
|
|
1219
|
-
onDeleteClick = _ref.onDeleteClick;
|
|
1220
|
-
return [{
|
|
1221
|
-
dataIndex: "name",
|
|
1222
|
-
key: "name",
|
|
1223
|
-
sorter: true,
|
|
1224
|
-
title: i18next.t("neetoApprovals.common.name"),
|
|
1225
|
-
ellipsis: true,
|
|
1226
|
-
render: function render(_, template) {
|
|
1227
|
-
return /*#__PURE__*/jsxs("div", {
|
|
1228
|
-
className: "flex items-center justify-between gap-x-3",
|
|
1229
|
-
children: [/*#__PURE__*/jsx(Typography, {
|
|
1230
|
-
className: "truncate",
|
|
1231
|
-
style: "body2",
|
|
1232
|
-
children: template.name
|
|
1233
|
-
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
1234
|
-
dropdownProps: {
|
|
1235
|
-
strategy: "fixed",
|
|
1236
|
-
onClick: function onClick(e) {
|
|
1237
|
-
return e.stopPropagation();
|
|
1238
|
-
}
|
|
1239
|
-
},
|
|
1240
|
-
menuItems: [_defineProperty({
|
|
1241
|
-
key: "edit",
|
|
1242
|
-
label: i18next.t("neetoApprovals.common.edit"),
|
|
1243
|
-
onClick: function onClick(event) {
|
|
1244
|
-
return onEditClick(event, template);
|
|
1245
|
-
}
|
|
1246
|
-
}, DATA_CY_KEY, "neeto-approvals-templates-edit-template-btn"), _defineProperty({
|
|
1247
|
-
key: "delete",
|
|
1248
|
-
label: i18next.t("neetoApprovals.common.delete"),
|
|
1249
|
-
onClick: function onClick(event) {
|
|
1250
|
-
return onDeleteClick(event, template);
|
|
1251
|
-
}
|
|
1252
|
-
}, DATA_CY_KEY, "neeto-approvals-templates-delete-template-btn")]
|
|
1253
|
-
})]
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1256
|
-
}, {
|
|
1257
|
-
dataIndex: "description",
|
|
1258
|
-
key: "description",
|
|
1259
|
-
title: i18next.t("neetoApprovals.inputs.labels.description")
|
|
1260
|
-
}];
|
|
1261
|
-
};
|
|
1262
|
-
|
|
1263
|
-
var _excluded = ["searchTerm", "isNewTemplatePaneOpen", "setIsNewTemplatePaneOpen", "helpDocUrl"];
|
|
1264
|
-
function ownKeys$5(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; }
|
|
1265
|
-
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1266
|
-
var Templates = function Templates(_ref) {
|
|
1267
|
-
var searchTerm = _ref.searchTerm,
|
|
1268
|
-
isNewTemplatePaneOpen = _ref.isNewTemplatePaneOpen,
|
|
1269
|
-
setIsNewTemplatePaneOpen = _ref.setIsNewTemplatePaneOpen,
|
|
1270
|
-
helpDocUrl = _ref.helpDocUrl,
|
|
1271
|
-
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
1272
|
-
var _useState = useState(DEFAULT_FILTER_VALUES),
|
|
1273
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1274
|
-
filters = _useState2[0],
|
|
1275
|
-
setFilters = _useState2[1];
|
|
1276
|
-
var _useState3 = useState({}),
|
|
1277
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1278
|
-
selectedTemplate = _useState4[0],
|
|
1279
|
-
setSelectedTemplate = _useState4[1];
|
|
1280
|
-
var _useState5 = useState(false),
|
|
1281
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1282
|
-
isDeleteAlertOpen = _useState6[0],
|
|
1283
|
-
setIsDeleteAlertOpen = _useState6[1];
|
|
1284
|
-
var _useState7 = useState(false),
|
|
1285
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
1286
|
-
isEditPaneOpen = _useState8[0],
|
|
1287
|
-
setIsEditPaneOpen = _useState8[1];
|
|
1288
|
-
var _useState9 = useState(false),
|
|
1289
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
1290
|
-
isShowPaneOpen = _useState10[0],
|
|
1291
|
-
setIsShowPaneOpen = _useState10[1];
|
|
1292
|
-
var _usePaginate = usePaginate(),
|
|
1293
|
-
pageProperties = _usePaginate.pageProperties,
|
|
1294
|
-
handlePageChange = _usePaginate.handlePageChange,
|
|
1295
|
-
resetPageProperties = _usePaginate.resetPageProperties;
|
|
1296
|
-
var _useTranslation = useTranslation(),
|
|
1297
|
-
t = _useTranslation.t;
|
|
1298
|
-
var debouncedSearchTerm = useDebounce(searchTerm, SEARCH_DELAY);
|
|
1299
|
-
useEffect(function () {
|
|
1300
|
-
resetPageProperties();
|
|
1301
|
-
}, [searchTerm]);
|
|
1302
|
-
var _useFetchTemplates = useFetchTemplates(_objectSpread$5(_objectSpread$5(_objectSpread$5({}, pageProperties), filters), {}, {
|
|
1303
|
-
searchTerm: debouncedSearchTerm.trim()
|
|
1304
|
-
})),
|
|
1305
|
-
data = _useFetchTemplates.data,
|
|
1306
|
-
isTemplateLoading = _useFetchTemplates.isLoading;
|
|
1307
|
-
var _ref2 = data || {},
|
|
1308
|
-
_ref2$templates = _ref2.templates,
|
|
1309
|
-
templates = _ref2$templates === void 0 ? [] : _ref2$templates,
|
|
1310
|
-
_ref2$totalCount = _ref2.totalCount,
|
|
1311
|
-
totalCount = _ref2$totalCount === void 0 ? 0 : _ref2$totalCount;
|
|
1312
|
-
useEffect(function () {
|
|
1313
|
-
if (data) {
|
|
1314
|
-
handleEmptyPage(data === null || data === void 0 ? void 0 : data.templates, pageProperties, handlePageChange);
|
|
1315
|
-
}
|
|
1316
|
-
}, [data]);
|
|
1317
|
-
var _useDeleteTemplate = useDeleteTemplate(),
|
|
1318
|
-
deleteTemplate = _useDeleteTemplate.mutate,
|
|
1319
|
-
isDeleting = _useDeleteTemplate.isPending;
|
|
1320
|
-
useEffect(function () {
|
|
1321
|
-
if (!isEmpty(selectedTemplate)) return;
|
|
1322
|
-
setIsDeleteAlertOpen(false);
|
|
1323
|
-
setIsEditPaneOpen(false);
|
|
1324
|
-
setIsShowPaneOpen(false);
|
|
1325
|
-
}, [selectedTemplate]);
|
|
1326
|
-
var onEditClick = function onEditClick(event, template) {
|
|
1327
|
-
event.stopPropagation();
|
|
1328
|
-
setSelectedTemplate(template);
|
|
1329
|
-
setIsEditPaneOpen(true);
|
|
1330
|
-
};
|
|
1331
|
-
var onRowClick = function onRowClick(_, templateDetails) {
|
|
1332
|
-
setSelectedTemplate(templateDetails);
|
|
1333
|
-
setIsShowPaneOpen(true);
|
|
1334
|
-
};
|
|
1335
|
-
var onDeleteClick = function onDeleteClick(event, template) {
|
|
1336
|
-
event.stopPropagation();
|
|
1337
|
-
setSelectedTemplate(template);
|
|
1338
|
-
setIsDeleteAlertOpen(true);
|
|
1339
|
-
};
|
|
1340
|
-
var handleDelete = function handleDelete(templateId) {
|
|
1341
|
-
deleteTemplate({
|
|
1342
|
-
templateId: templateId
|
|
1343
|
-
});
|
|
1344
|
-
setSelectedTemplate({});
|
|
1345
|
-
};
|
|
1346
|
-
var entity = t("neetoApprovals.common.template", PLURAL);
|
|
1347
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
1348
|
-
children: [isTemplateLoading ? /*#__PURE__*/jsx(PageLoader, {}) : /*#__PURE__*/jsx(Table, {
|
|
1349
|
-
columnData: columnData,
|
|
1350
|
-
entity: entity,
|
|
1351
|
-
filters: filters,
|
|
1352
|
-
handlePageChange: handlePageChange,
|
|
1353
|
-
helpDocUrl: helpDocUrl,
|
|
1354
|
-
onDeleteClick: onDeleteClick,
|
|
1355
|
-
onEditClick: onEditClick,
|
|
1356
|
-
onRowClick: onRowClick,
|
|
1357
|
-
pageProperties: pageProperties,
|
|
1358
|
-
searchTerm: searchTerm,
|
|
1359
|
-
setFilters: setFilters,
|
|
1360
|
-
totalCount: totalCount,
|
|
1361
|
-
rowData: templates,
|
|
1362
|
-
setIsPaneOpen: setIsNewTemplatePaneOpen
|
|
1363
|
-
}), /*#__PURE__*/jsx(Create, _objectSpread$5({
|
|
1364
|
-
isOpen: isNewTemplatePaneOpen,
|
|
1365
|
-
onClose: function onClose() {
|
|
1366
|
-
return setIsNewTemplatePaneOpen(false);
|
|
1367
|
-
}
|
|
1368
|
-
}, otherProps)), /*#__PURE__*/jsx(Edit, _objectSpread$5(_objectSpread$5({
|
|
1369
|
-
isOpen: isEditPaneOpen,
|
|
1370
|
-
setTemplate: setSelectedTemplate,
|
|
1371
|
-
template: selectedTemplate
|
|
1372
|
-
}, otherProps), {}, {
|
|
1373
|
-
onClose: function onClose() {
|
|
1374
|
-
return setIsEditPaneOpen(false);
|
|
1375
|
-
}
|
|
1376
|
-
})), /*#__PURE__*/jsx(Alert, {
|
|
1377
|
-
isOpen: isDeleteAlertOpen,
|
|
1378
|
-
isSubmitting: isDeleting,
|
|
1379
|
-
submitButtonLabel: t("neetoApprovals.buttons.delete"),
|
|
1380
|
-
message: /*#__PURE__*/jsx(Trans, {
|
|
1381
|
-
i18nKey: "neetoApprovals.alerts.deleting_",
|
|
1382
|
-
values: {
|
|
1383
|
-
what: t("neetoApprovals.common.template", SINGULAR),
|
|
1384
|
-
name: selectedTemplate === null || selectedTemplate === void 0 ? void 0 : selectedTemplate.name
|
|
1385
|
-
}
|
|
1386
|
-
}),
|
|
1387
|
-
title: t("neetoApprovals.common.delete_", {
|
|
1388
|
-
what: t("neetoApprovals.common.template", SINGULAR)
|
|
1389
|
-
}),
|
|
1390
|
-
onClose: function onClose() {
|
|
1391
|
-
return setSelectedTemplate({});
|
|
1392
|
-
},
|
|
1393
|
-
onSubmit: function onSubmit() {
|
|
1394
|
-
return handleDelete(selectedTemplate === null || selectedTemplate === void 0 ? void 0 : selectedTemplate.id);
|
|
1395
|
-
}
|
|
1396
|
-
}), /*#__PURE__*/jsx(TemplateDetails, {
|
|
1397
|
-
isOpen: isShowPaneOpen,
|
|
1398
|
-
template: selectedTemplate,
|
|
1399
|
-
onClose: function onClose() {
|
|
1400
|
-
return setSelectedTemplate({});
|
|
1401
|
-
}
|
|
1402
|
-
})]
|
|
1403
|
-
});
|
|
1404
|
-
};
|
|
1405
|
-
|
|
1406
|
-
function ownKeys$4(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; }
|
|
1407
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1408
|
-
var createRoutes = function createRoutes(_ref) {
|
|
1409
|
-
var config = _ref.config,
|
|
1410
|
-
isNewTemplatePaneOpen = _ref.isNewTemplatePaneOpen,
|
|
1411
|
-
searchTerm = _ref.searchTerm,
|
|
1412
|
-
setIsNewTemplatePaneOpen = _ref.setIsNewTemplatePaneOpen;
|
|
1413
|
-
return [{
|
|
1414
|
-
component: function component() {
|
|
1415
|
-
return /*#__PURE__*/jsx(Templates, _objectSpread$4({}, _objectSpread$4({
|
|
1416
|
-
isNewTemplatePaneOpen: isNewTemplatePaneOpen,
|
|
1417
|
-
searchTerm: searchTerm,
|
|
1418
|
-
setIsNewTemplatePaneOpen: setIsNewTemplatePaneOpen
|
|
1419
|
-
}, config)));
|
|
1420
|
-
},
|
|
1421
|
-
path: "".concat(config.approvalsPath).concat(routes.templates.index),
|
|
1422
|
-
actionBlock: function actionBlock() {
|
|
1423
|
-
return /*#__PURE__*/jsx(Button, {
|
|
1424
|
-
"data-cy": "neeto-approvals-templates-add-new-button",
|
|
1425
|
-
label: t$1("neetoApprovals.common.addNew_", {
|
|
1426
|
-
what: t$1("neetoApprovals.common.template", SINGULAR)
|
|
1427
|
-
}),
|
|
1428
|
-
onClick: function onClick() {
|
|
1429
|
-
return setIsNewTemplatePaneOpen(true);
|
|
1430
|
-
}
|
|
1431
|
-
});
|
|
1432
|
-
},
|
|
1433
|
-
searchPlaceholder: t$1("neetoApprovals.inputs.placeholders.search_", {
|
|
1434
|
-
what: t$1("neetoApprovals.common.template", PLURAL)
|
|
1435
|
-
})
|
|
1436
|
-
}, {
|
|
1437
|
-
component: function component() {
|
|
1438
|
-
return /*#__PURE__*/jsx(PendingRequests, _objectSpread$4({}, config));
|
|
1439
|
-
},
|
|
1440
|
-
path: "".concat(config.approvalsPath).concat(routes.pending)
|
|
1441
|
-
}, {
|
|
1442
|
-
component: function component() {
|
|
1443
|
-
return /*#__PURE__*/jsx(History, _objectSpread$4({}, config));
|
|
1444
|
-
},
|
|
1445
|
-
path: "".concat(config.approvalsPath).concat(routes.history)
|
|
1446
|
-
}];
|
|
1447
|
-
};
|
|
1448
|
-
|
|
1449
|
-
var Header = function Header(_ref) {
|
|
1450
|
-
var _currentTab$actionBlo;
|
|
1451
|
-
var appRoutes = _ref.appRoutes,
|
|
1452
|
-
breadcrumbs = _ref.breadcrumbs;
|
|
1453
|
-
var _useTranslation = useTranslation(),
|
|
1454
|
-
t = _useTranslation.t;
|
|
1455
|
-
var _useLocation = useLocation(),
|
|
1456
|
-
pathname = _useLocation.pathname;
|
|
1457
|
-
var currentTab = findBy({
|
|
1458
|
-
path: pathname
|
|
1459
|
-
}, appRoutes);
|
|
1460
|
-
return /*#__PURE__*/jsx(NeetoHeader, {
|
|
1461
|
-
breadcrumbs: breadcrumbs,
|
|
1462
|
-
actionBlock: currentTab === null || currentTab === void 0 || (_currentTab$actionBlo = currentTab.actionBlock) === null || _currentTab$actionBlo === void 0 ? void 0 : _currentTab$actionBlo.call(currentTab),
|
|
1463
|
-
title: t("neetoApprovals.common.approval", PLURAL),
|
|
1464
|
-
searchProps: (currentTab === null || currentTab === void 0 ? void 0 : currentTab.searchPlaceholder) && {
|
|
1465
|
-
placeholder: currentTab === null || currentTab === void 0 ? void 0 : currentTab.searchPlaceholder
|
|
1466
|
-
}
|
|
1467
|
-
});
|
|
1468
|
-
};
|
|
1469
|
-
|
|
1470
|
-
var fetch$1 = function fetch() {
|
|
1471
|
-
return axios.get("".concat(BASE_URL, "/views"));
|
|
1472
|
-
};
|
|
1473
|
-
var viewsApi = {
|
|
1474
|
-
fetch: fetch$1
|
|
1475
|
-
};
|
|
1476
|
-
|
|
1477
|
-
function ownKeys$3(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; }
|
|
1478
|
-
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1479
|
-
var useFetchViews = function useFetchViews() {
|
|
1480
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1481
|
-
return useQuery(_objectSpread$3({
|
|
1482
|
-
queryKey: [QUERY_KEYS.VIEWS],
|
|
1483
|
-
queryFn: viewsApi.fetch,
|
|
1484
|
-
select: function select(response) {
|
|
1485
|
-
return response.data || response;
|
|
1486
|
-
}
|
|
1487
|
-
}, options));
|
|
1488
|
-
};
|
|
1489
|
-
|
|
1490
|
-
var Tab = function Tab(_ref) {
|
|
1491
|
-
var _pathname$split$;
|
|
1492
|
-
var approvalsPath = _ref.approvalsPath;
|
|
1493
|
-
var _useLocation = useLocation(),
|
|
1494
|
-
pathname = _useLocation.pathname;
|
|
1495
|
-
var history = useHistory();
|
|
1496
|
-
var approvalFilter = getApprovalFilter();
|
|
1497
|
-
var approvalFilterKeys = keys(approvalFilter);
|
|
1498
|
-
var category = (_pathname$split$ = pathname.split(routes.approvals)[1]) === null || _pathname$split$ === void 0 ? void 0 : _pathname$split$.toLocaleUpperCase();
|
|
1499
|
-
var isActive = function isActive(filter) {
|
|
1500
|
-
return category.includes(filter);
|
|
1501
|
-
};
|
|
1502
|
-
var getRoute = function getRoute(filter) {
|
|
1503
|
-
return "".concat(approvalsPath).concat(filter.toLowerCase());
|
|
1504
|
-
};
|
|
1505
|
-
var _useFetchViews = useFetchViews(),
|
|
1506
|
-
_useFetchViews$data = _useFetchViews.data,
|
|
1507
|
-
_useFetchViews$data2 = _useFetchViews$data === void 0 ? {} : _useFetchViews$data,
|
|
1508
|
-
_useFetchViews$data2$ = _useFetchViews$data2.views,
|
|
1509
|
-
views = _useFetchViews$data2$ === void 0 ? {} : _useFetchViews$data2$;
|
|
1510
|
-
return /*#__PURE__*/jsx(NeetoUITab, {
|
|
1511
|
-
children: approvalFilterKeys.map(function (filter) {
|
|
1512
|
-
return /*#__PURE__*/jsxs(NeetoUITab.Item, {
|
|
1513
|
-
active: isActive(filter),
|
|
1514
|
-
count: views[filter === null || filter === void 0 ? void 0 : filter.toLocaleLowerCase()],
|
|
1515
|
-
label: approvalFilter[filter].label,
|
|
1516
|
-
onClick: function onClick() {
|
|
1517
|
-
return history.push(getRoute(filter));
|
|
1518
|
-
},
|
|
1519
|
-
children: [approvalFilter[filter].label, " (", views[filter === null || filter === void 0 ? void 0 : filter.toLocaleLowerCase()] || 0, ")"]
|
|
1520
|
-
}, filter);
|
|
1521
|
-
})
|
|
1522
|
-
});
|
|
1523
|
-
};
|
|
1524
|
-
|
|
1525
|
-
function ownKeys$2(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; }
|
|
1526
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1527
|
-
var Approvals = function Approvals(_ref) {
|
|
1528
|
-
var config = _ref.config;
|
|
1529
|
-
var _useQueryParams = useQueryParams(),
|
|
1530
|
-
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
1531
|
-
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
1532
|
-
var _useState = useState(false),
|
|
1533
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1534
|
-
isNewTemplatePaneOpen = _useState2[0],
|
|
1535
|
-
setIsNewTemplatePaneOpen = _useState2[1];
|
|
1536
|
-
var appRoutes = createRoutes({
|
|
1537
|
-
config: config,
|
|
1538
|
-
searchTerm: searchTerm,
|
|
1539
|
-
isNewTemplatePaneOpen: isNewTemplatePaneOpen,
|
|
1540
|
-
setIsNewTemplatePaneOpen: setIsNewTemplatePaneOpen
|
|
1541
|
-
});
|
|
1542
|
-
return /*#__PURE__*/jsx("div", {
|
|
1543
|
-
className: "w-full overflow-y-auto",
|
|
1544
|
-
children: /*#__PURE__*/jsxs(Container, {
|
|
1545
|
-
children: [/*#__PURE__*/jsx(Header, _objectSpread$2({}, _objectSpread$2({
|
|
1546
|
-
appRoutes: appRoutes
|
|
1547
|
-
}, config))), /*#__PURE__*/jsx(Tab, {
|
|
1548
|
-
approvalsPath: config.approvalsPath
|
|
1549
|
-
}), /*#__PURE__*/jsxs(Switch, {
|
|
1550
|
-
children: [appRoutes.map(function (_ref2) {
|
|
1551
|
-
var path = _ref2.path,
|
|
1552
|
-
component = _ref2.component;
|
|
1553
|
-
return /*#__PURE__*/createElement(Route, {
|
|
1554
|
-
component: component,
|
|
1555
|
-
path: path,
|
|
1556
|
-
exact: true,
|
|
1557
|
-
key: path
|
|
1558
|
-
});
|
|
1559
|
-
}), /*#__PURE__*/jsx(Redirect, {
|
|
1560
|
-
exact: true,
|
|
1561
|
-
from: config.approvalsPath
|
|
1562
|
-
// eslint-disable-next-line @bigbinary/neeto/use-common-routes
|
|
1563
|
-
,
|
|
1564
|
-
to: "".concat(config.approvalsPath).concat(routes.pending)
|
|
1565
|
-
})]
|
|
1566
|
-
})]
|
|
1567
|
-
})
|
|
1568
|
-
});
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
|
-
var fetch = function fetch(params) {
|
|
1572
|
-
return axios.get("".concat(BASE_URL, "/approvers"), {
|
|
1573
|
-
params: params
|
|
1574
|
-
});
|
|
1575
|
-
};
|
|
1576
|
-
var approversApi = {
|
|
1577
|
-
fetch: fetch
|
|
1578
|
-
};
|
|
1579
|
-
|
|
1580
|
-
function ownKeys$1(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; }
|
|
1581
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1582
|
-
var useFetchApprovers = function useFetchApprovers() {
|
|
1583
|
-
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1584
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1585
|
-
return useQuery(_objectSpread$1({
|
|
1586
|
-
queryKey: [QUERY_KEYS.APPROVERS, params],
|
|
1587
|
-
queryFn: function queryFn() {
|
|
1588
|
-
return approversApi.fetch(params);
|
|
1589
|
-
},
|
|
1590
|
-
select: function select(response) {
|
|
1591
|
-
return response.data || response;
|
|
1592
|
-
}
|
|
1593
|
-
}, options));
|
|
1594
|
-
};
|
|
1595
|
-
|
|
1596
|
-
var Form$1 = function Form(_ref) {
|
|
1597
|
-
var _globalProps$user;
|
|
1598
|
-
var _ref$requestableId = _ref.requestableId,
|
|
1599
|
-
requestableId = _ref$requestableId === void 0 ? "" : _ref$requestableId,
|
|
1600
|
-
selectedTemplateData = _ref.selectedTemplateData,
|
|
1601
|
-
setSelectedTemplateData = _ref.setSelectedTemplateData;
|
|
1602
|
-
var _useTranslation = useTranslation(),
|
|
1603
|
-
t = _useTranslation.t;
|
|
1604
|
-
var _useFormikContext = useFormikContext(),
|
|
1605
|
-
setFieldValue = _useFormikContext.setFieldValue;
|
|
1606
|
-
var inputRef = useRef(null);
|
|
1607
|
-
var _useState = useState(null),
|
|
1608
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1609
|
-
approverId = _useState2[0],
|
|
1610
|
-
setApproverId = _useState2[1];
|
|
1611
|
-
var _useState3 = useState(null),
|
|
1612
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1613
|
-
templateId = _useState4[0],
|
|
1614
|
-
setTemplateId = _useState4[1];
|
|
1615
|
-
var params = {
|
|
1616
|
-
requestableId: requestableId,
|
|
1617
|
-
approverId: approverId,
|
|
1618
|
-
approvalRequestorId: (_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.id
|
|
1619
|
-
};
|
|
1620
|
-
var _useFetchTemplates = useFetchTemplates(),
|
|
1621
|
-
_useFetchTemplates$da = _useFetchTemplates.data,
|
|
1622
|
-
_useFetchTemplates$da2 = _useFetchTemplates$da === void 0 ? {} : _useFetchTemplates$da,
|
|
1623
|
-
_useFetchTemplates$da3 = _useFetchTemplates$da2.templates,
|
|
1624
|
-
templates = _useFetchTemplates$da3 === void 0 ? [] : _useFetchTemplates$da3;
|
|
1625
|
-
var _useFetchTemplate = useFetchTemplate({
|
|
1626
|
-
id: templateId,
|
|
1627
|
-
params: params
|
|
1628
|
-
}),
|
|
1629
|
-
_useFetchTemplate$dat = _useFetchTemplate.data,
|
|
1630
|
-
_useFetchTemplate$dat2 = _useFetchTemplate$dat === void 0 ? {} : _useFetchTemplate$dat,
|
|
1631
|
-
_useFetchTemplate$dat3 = _useFetchTemplate$dat2.template,
|
|
1632
|
-
template = _useFetchTemplate$dat3 === void 0 ? {} : _useFetchTemplate$dat3;
|
|
1633
|
-
var _useFetchApprovers = useFetchApprovers(),
|
|
1634
|
-
_useFetchApprovers$da = _useFetchApprovers.data,
|
|
1635
|
-
_useFetchApprovers$da2 = _useFetchApprovers$da === void 0 ? {} : _useFetchApprovers$da,
|
|
1636
|
-
_useFetchApprovers$da3 = _useFetchApprovers$da2.approvers,
|
|
1637
|
-
approvers = _useFetchApprovers$da3 === void 0 ? [] : _useFetchApprovers$da3;
|
|
1638
|
-
var approverOptions = useMemo(function () {
|
|
1639
|
-
return approvers.map(function (approver) {
|
|
1640
|
-
return {
|
|
1641
|
-
label: approver.name,
|
|
1642
|
-
value: approver.id
|
|
1643
|
-
};
|
|
1644
|
-
});
|
|
1645
|
-
}, [approvers]);
|
|
1646
|
-
var templateOptions = templates.map(function (template) {
|
|
1647
|
-
return {
|
|
1648
|
-
label: template.name,
|
|
1649
|
-
value: template.id
|
|
1650
|
-
};
|
|
1651
|
-
});
|
|
1652
|
-
var updateMessage = function updateMessage() {
|
|
1653
|
-
var _inputRef$current;
|
|
1654
|
-
var message = template.parsedMessage || template.message;
|
|
1655
|
-
setFieldValue("message", message);
|
|
1656
|
-
inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || (_inputRef$current = _inputRef$current.editor) === null || _inputRef$current === void 0 || (_inputRef$current = _inputRef$current.commands) === null || _inputRef$current === void 0 || _inputRef$current.setContent(message);
|
|
1657
|
-
};
|
|
1658
|
-
var handleTemplateChange = function handleTemplateChange(selectedTemplate) {
|
|
1659
|
-
setTemplateId(selectedTemplate.value);
|
|
1660
|
-
};
|
|
1661
|
-
var handleApproverChange = function handleApproverChange(approver) {
|
|
1662
|
-
setApproverId(approver.value);
|
|
1663
|
-
setFieldValue("approver", approver);
|
|
1664
|
-
};
|
|
1665
|
-
useEffect(function () {
|
|
1666
|
-
if (isEmpty(template)) return;
|
|
1667
|
-
setSelectedTemplateData(template);
|
|
1668
|
-
updateMessage();
|
|
1669
|
-
}, [template]);
|
|
1670
|
-
return /*#__PURE__*/jsxs("div", {
|
|
1671
|
-
className: "w-full space-y-6",
|
|
1672
|
-
children: [/*#__PURE__*/jsx(Select, {
|
|
1673
|
-
label: t("neetoApprovals.select.approval"),
|
|
1674
|
-
options: templateOptions,
|
|
1675
|
-
onChange: function onChange(selectedTemplate) {
|
|
1676
|
-
return handleTemplateChange(selectedTemplate);
|
|
1677
|
-
}
|
|
1678
|
-
}), (selectedTemplateData === null || selectedTemplateData === void 0 ? void 0 : selectedTemplateData.message) && /*#__PURE__*/jsxs(Fragment, {
|
|
1679
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
1680
|
-
className: "flex space-x-6",
|
|
1681
|
-
children: /*#__PURE__*/jsx(Select, {
|
|
1682
|
-
required: true,
|
|
1683
|
-
label: t("neetoApprovals.inputs.labels.approver"),
|
|
1684
|
-
name: "approver",
|
|
1685
|
-
options: approverOptions,
|
|
1686
|
-
placeholder: t("neetoApprovals.inputs.placeholders.select_", {
|
|
1687
|
-
what: t("neetoApprovals.common.approver", SINGULAR)
|
|
1688
|
-
}),
|
|
1689
|
-
onChange: handleApproverChange
|
|
1690
|
-
})
|
|
1691
|
-
}), /*#__PURE__*/jsx("div", {
|
|
1692
|
-
className: "space-y-2",
|
|
1693
|
-
children: /*#__PURE__*/jsx(FormikEditor, {
|
|
1694
|
-
required: true,
|
|
1695
|
-
label: t("neetoApprovals.inputs.labels.message"),
|
|
1696
|
-
name: "message",
|
|
1697
|
-
ref: inputRef,
|
|
1698
|
-
rows: 3,
|
|
1699
|
-
placeholder: t("neetoApprovals.inputs.placeholders.enter_", {
|
|
1700
|
-
what: t("neetoApprovals.inputs.labels.message")
|
|
1701
|
-
})
|
|
1702
|
-
})
|
|
1703
|
-
})]
|
|
1704
|
-
})]
|
|
1705
|
-
});
|
|
1706
|
-
};
|
|
1707
|
-
|
|
1708
|
-
var Form = function Form(_ref) {
|
|
1709
|
-
var isOpen = _ref.isOpen,
|
|
1710
|
-
setIsPaneOpen = _ref.setIsPaneOpen,
|
|
1711
|
-
onSubmit = _ref.onSubmit,
|
|
1712
|
-
isLoading = _ref.isLoading,
|
|
1713
|
-
_ref$requestableId = _ref.requestableId,
|
|
1714
|
-
requestableId = _ref$requestableId === void 0 ? "" : _ref$requestableId;
|
|
1715
|
-
var _useState = useState({}),
|
|
1716
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1717
|
-
selectedTemplateData = _useState2[0],
|
|
1718
|
-
setSelectedTemplateData = _useState2[1];
|
|
1719
|
-
var _useTranslation = useTranslation(),
|
|
1720
|
-
t = _useTranslation.t;
|
|
1721
|
-
var onClose = function onClose() {
|
|
1722
|
-
setIsPaneOpen(false);
|
|
1723
|
-
setSelectedTemplateData({});
|
|
1724
|
-
};
|
|
1725
|
-
var handleSubmit = function handleSubmit(values) {
|
|
1726
|
-
onSubmit({
|
|
1727
|
-
message: values.message,
|
|
1728
|
-
approverId: values.approver.value
|
|
1729
|
-
}, selectedTemplateData, onClose);
|
|
1730
|
-
};
|
|
1731
|
-
return /*#__PURE__*/jsxs(Pane, {
|
|
1732
|
-
isOpen: isOpen,
|
|
1733
|
-
onClose: onClose,
|
|
1734
|
-
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
1735
|
-
children: /*#__PURE__*/jsx(Typography, {
|
|
1736
|
-
style: "h2",
|
|
1737
|
-
children: t("neetoApprovals.common.add_", {
|
|
1738
|
-
what: t("neetoApprovals.common.approval", SINGULAR)
|
|
1739
|
-
})
|
|
1740
|
-
})
|
|
1741
|
-
}), /*#__PURE__*/jsxs(FormikForm, {
|
|
1742
|
-
formikProps: {
|
|
1743
|
-
onSubmit: handleSubmit,
|
|
1744
|
-
initialValues: APPROVAL_REQUEST_FORM_INITIAL_VALUES,
|
|
1745
|
-
validationSchema: REQUEST_FORM_VALIDATION_SCHEMA
|
|
1746
|
-
},
|
|
1747
|
-
children: [/*#__PURE__*/jsx(Pane.Body, {
|
|
1748
|
-
children: /*#__PURE__*/jsx(Form$1, {
|
|
1749
|
-
requestableId: requestableId,
|
|
1750
|
-
selectedTemplateData: selectedTemplateData,
|
|
1751
|
-
setSelectedTemplateData: setSelectedTemplateData
|
|
1752
|
-
})
|
|
1753
|
-
}), /*#__PURE__*/jsx(Pane.Footer, {
|
|
1754
|
-
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
1755
|
-
cancelButtonProps: {
|
|
1756
|
-
onClick: onClose
|
|
1757
|
-
},
|
|
1758
|
-
isSubmitting: isLoading
|
|
1759
|
-
})
|
|
1760
|
-
})]
|
|
1761
|
-
})]
|
|
1762
|
-
});
|
|
1763
|
-
};
|
|
1764
|
-
|
|
1765
|
-
var show = function show(id) {
|
|
1766
|
-
return axios.get("".concat(BASE_URL, "/public/requests/").concat(id));
|
|
1767
|
-
};
|
|
1768
|
-
var accept = function accept(_ref) {
|
|
1769
|
-
var id = _ref.id,
|
|
1770
|
-
note = _ref.note;
|
|
1771
|
-
return axios.patch("".concat(BASE_URL, "/public/requests/").concat(id, "/accept"), {
|
|
1772
|
-
note: note
|
|
1773
|
-
});
|
|
1774
|
-
};
|
|
1775
|
-
var decline = function decline(_ref2) {
|
|
1776
|
-
var id = _ref2.id,
|
|
1777
|
-
note = _ref2.note;
|
|
1778
|
-
return axios.patch("".concat(BASE_URL, "/public/requests/").concat(id, "/decline"), {
|
|
1779
|
-
note: note
|
|
1780
|
-
});
|
|
1781
|
-
};
|
|
1782
|
-
var publicRequestsApi = {
|
|
1783
|
-
show: show,
|
|
1784
|
-
accept: accept,
|
|
1785
|
-
decline: decline
|
|
1786
|
-
};
|
|
1787
|
-
|
|
1788
|
-
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; }
|
|
1789
|
-
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; }
|
|
1790
|
-
var useFetchPublicRequest = function useFetchPublicRequest(_ref, options) {
|
|
1791
|
-
var requestId = _ref.requestId;
|
|
1792
|
-
return useQuery(_objectSpread({
|
|
1793
|
-
queryKey: [QUERY_KEYS.SHOW_PUBLIC_REQUEST, requestId],
|
|
1794
|
-
queryFn: function queryFn() {
|
|
1795
|
-
return publicRequestsApi.show(requestId);
|
|
1796
|
-
}
|
|
1797
|
-
}, options));
|
|
1798
|
-
};
|
|
1799
|
-
var useAcceptPendingRequest = function useAcceptPendingRequest(options) {
|
|
1800
|
-
return useMutationWithInvalidation(publicRequestsApi.accept, _objectSpread({
|
|
1801
|
-
keysToInvalidate: [[QUERY_KEYS.SHOW_PUBLIC_REQUEST], [QUERY_KEYS.REQUESTS], [QUERY_KEYS.VIEWS]]
|
|
1802
|
-
}, options));
|
|
1803
|
-
};
|
|
1804
|
-
var useDeclinePendingRequest = function useDeclinePendingRequest(options) {
|
|
1805
|
-
return useMutationWithInvalidation(publicRequestsApi.decline, _objectSpread({
|
|
1806
|
-
keysToInvalidate: [[QUERY_KEYS.SHOW_PUBLIC_REQUEST], [QUERY_KEYS.REQUESTS], [QUERY_KEYS.VIEWS]]
|
|
1807
|
-
}, options));
|
|
1808
|
-
};
|
|
1809
|
-
|
|
1810
|
-
var Public = function Public() {
|
|
1811
|
-
var _t;
|
|
1812
|
-
var _useState = useState(""),
|
|
1813
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1814
|
-
note = _useState2[0],
|
|
1815
|
-
setNote = _useState2[1];
|
|
1816
|
-
var _useParams = useParams(),
|
|
1817
|
-
id = _useParams.id;
|
|
1818
|
-
var _useTranslation = useTranslation(),
|
|
1819
|
-
t = _useTranslation.t;
|
|
1820
|
-
var _useFetchPublicReques = useFetchPublicRequest({
|
|
1821
|
-
requestId: id
|
|
1822
|
-
}),
|
|
1823
|
-
data = _useFetchPublicReques.data,
|
|
1824
|
-
isLoading = _useFetchPublicReques.isLoading;
|
|
1825
|
-
var _ref = data || {},
|
|
1826
|
-
_ref$approvalRequest = _ref.approvalRequest,
|
|
1827
|
-
approvalRequest = _ref$approvalRequest === void 0 ? {} : _ref$approvalRequest;
|
|
1828
|
-
useEffect(function () {
|
|
1829
|
-
var _data$approvalRequest;
|
|
1830
|
-
if (data !== null && data !== void 0 && (_data$approvalRequest = data.approvalRequest) !== null && _data$approvalRequest !== void 0 && _data$approvalRequest.note) {
|
|
1831
|
-
setNote(data.approvalRequest.note);
|
|
1832
|
-
}
|
|
1833
|
-
}, [data]);
|
|
1834
|
-
var _useAcceptPendingRequ = useAcceptPendingRequest(),
|
|
1835
|
-
acceptPendingRequest = _useAcceptPendingRequ.mutate,
|
|
1836
|
-
isAccepting = _useAcceptPendingRequ.isPending;
|
|
1837
|
-
var _useDeclinePendingReq = useDeclinePendingRequest(),
|
|
1838
|
-
declinePendingRequest = _useDeclinePendingReq.mutate,
|
|
1839
|
-
isDeclining = _useDeclinePendingReq.isPending;
|
|
1840
|
-
var calloutStyle = approvalRequest.status === STATUSES.approved ? "success" : "danger";
|
|
1841
|
-
var hideTextArea = approvalRequest.status !== STATUSES.pending && isEmpty(note);
|
|
1842
|
-
if (isLoading) {
|
|
1843
|
-
return /*#__PURE__*/jsx("div", {
|
|
1844
|
-
className: "h-screen items-center justify-center",
|
|
1845
|
-
children: /*#__PURE__*/jsx(PageLoader, {})
|
|
1846
|
-
});
|
|
1847
|
-
}
|
|
1848
|
-
return /*#__PURE__*/jsxs(Container, {
|
|
1849
|
-
children: [/*#__PURE__*/jsx(NeetoHeader, {
|
|
1850
|
-
title: t("neetoApprovals.common.approval", PLURAL)
|
|
1851
|
-
}), /*#__PURE__*/jsx("div", {
|
|
1852
|
-
className: "flex h-screen w-full flex-col items-center",
|
|
1853
|
-
children: /*#__PURE__*/jsx("div", {
|
|
1854
|
-
className: "neeto-ui-shadow-s w-2/5 rounded border p-6",
|
|
1855
|
-
children: approvalRequest ? /*#__PURE__*/jsxs("div", {
|
|
1856
|
-
className: "flex w-full flex-col space-y-6",
|
|
1857
|
-
children: [/*#__PURE__*/jsx(Typography, {
|
|
1858
|
-
style: "h2",
|
|
1859
|
-
children: approvalRequest.title
|
|
1860
|
-
}), /*#__PURE__*/jsx(EditorContent, {
|
|
1861
|
-
content: approvalRequest.message
|
|
1862
|
-
}), !hideTextArea && /*#__PURE__*/jsx(Textarea, {
|
|
1863
|
-
label: t("neetoApprovals.common.note"),
|
|
1864
|
-
placeholder: t("neetoApprovals.inputs.placeholders.add_", {
|
|
1865
|
-
what: (_t = t("neetoApprovals.common.note")) === null || _t === void 0 ? void 0 : _t.toLocaleLowerCase()
|
|
1866
|
-
}),
|
|
1867
|
-
value: note,
|
|
1868
|
-
disabled: approvalRequest.status !== STATUSES.pending,
|
|
1869
|
-
onChange: withEventTargetValue(setNote)
|
|
1870
|
-
}), approvalRequest.status === STATUSES.pending ? /*#__PURE__*/jsxs("div", {
|
|
1871
|
-
className: "mx-auto mt-8 flex space-x-6",
|
|
1872
|
-
children: [/*#__PURE__*/jsx(Button, {
|
|
1873
|
-
label: t("neetoApprovals.buttons.approve"),
|
|
1874
|
-
onClick: function onClick() {
|
|
1875
|
-
return acceptPendingRequest({
|
|
1876
|
-
id: approvalRequest.id,
|
|
1877
|
-
note: note
|
|
1878
|
-
});
|
|
1879
|
-
},
|
|
1880
|
-
loading: isAccepting
|
|
1881
|
-
}), /*#__PURE__*/jsx(Button, {
|
|
1882
|
-
label: t("neetoApprovals.buttons.decline"),
|
|
1883
|
-
onClick: function onClick() {
|
|
1884
|
-
return declinePendingRequest({
|
|
1885
|
-
id: approvalRequest.id,
|
|
1886
|
-
note: note
|
|
1887
|
-
});
|
|
1888
|
-
},
|
|
1889
|
-
style: "secondary",
|
|
1890
|
-
loading: isDeclining
|
|
1891
|
-
})]
|
|
1892
|
-
}) : /*#__PURE__*/jsx(Callout, {
|
|
1893
|
-
style: calloutStyle,
|
|
1894
|
-
children: /*#__PURE__*/jsx(Typography, {
|
|
1895
|
-
style: "body1",
|
|
1896
|
-
children: /*#__PURE__*/jsx(Trans, {
|
|
1897
|
-
i18nKey: "neetoApprovals.typography.approvalRequest",
|
|
1898
|
-
values: {
|
|
1899
|
-
status: approvalRequest.status
|
|
1900
|
-
}
|
|
1901
|
-
})
|
|
1902
|
-
})
|
|
1903
|
-
})]
|
|
1904
|
-
}) : /*#__PURE__*/jsx(Typography, {
|
|
1905
|
-
style: "h4",
|
|
1906
|
-
className: "text-center",
|
|
1907
|
-
children: t("neetoApprovals.common.notFound")
|
|
1908
|
-
})
|
|
1909
|
-
})
|
|
1910
|
-
})]
|
|
1911
|
-
});
|
|
1912
|
-
};
|
|
1913
|
-
|
|
1914
|
-
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
1915
|
-
|
|
1916
|
-
var css = ".neeto-approvals-dropdown__button{border-radius:0!important;font-weight:var(--neeto-ui-font-normal);min-height:34px;min-width:150px;text-align:left;width:100%}.neeto-approvals-scrollbar__inner{height:200px;width:100%}.neeto-approvals-scrollbar__outer{height:150px;left:0;overflow:\"hidden\";position:\"absolute\";top:0;visibility:\"hidden\";width:200px}.neeto-ui-subheader .neeto-ui-subheader__left-wrapper .neeto-ui-subheader__left{max-width:none}td.ant-table-column-sort{background:transparent}.neeto-approvals-empty-state{align-items:center;display:flex;height:100%;justify-content:center;width:100%}.neeto-approvals-empty-state__image{align-items:center;display:flex;justify-content:center;margin-bottom:2rem}.neeto-approvals-empty-state__title--with-action-block{margin-bottom:1rem}.neeto-approvals-empty-state__action-block{display:flex;justify-content:center}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9iYXNlL19iYXNlLnNjc3MiLCJhcHAvamF2YXNjcmlwdC9zcmMvc3R5bGVzaGVldHMvYXBwbGljYXRpb24uc2NzcyIsImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9iYXNlL19vdmVycmlkZXMuc2NzcyIsImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9jb21wb25lbnRzL19lbXB0eS1zdGF0ZS5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGtDQUNFLHlCQUFBLENBQ0EsdUNBQUEsQ0FDQSxlQUFBLENBQ0EsZUFBQSxDQUNBLGVBQUEsQ0FDQSxVQ0NGLENER0Usa0NBRUUsWUFBQSxDQURBLFVDQ0osQ0RHRSxrQ0FLRSxZQUFBLENBRkEsTUFBQSxDQUdBLGlCQUFBLENBTEEsbUJBQUEsQ0FDQSxLQUFBLENBS0EsbUJBQUEsQ0FIQSxXQ0VKLENDbkJJLGdGQUNFLGNEc0JOLENDaEJBLHlCQUNFLHNCRG1CRixDRTdCQSw2QkFDRSxrQkFBQSxDQUNBLFlBQUEsQ0FDQSxXQUFBLENBQ0Esc0JBQUEsQ0FDQSxVRmdDRixDRTlCRSxvQ0FHRSxrQkFBQSxDQUZBLFlBQUEsQ0FDQSxzQkFBQSxDQUVBLGtCRmdDSixDRTVCSSx1REFDRSxrQkY4Qk4sQ0UxQkUsMkNBQ0UsWUFBQSxDQUNBLHNCRjRCSiIsInNvdXJjZXNDb250ZW50IjpbIi5uZWV0by1hcHByb3ZhbHMtZHJvcGRvd25fX2J1dHRvbiB7XG4gIGJvcmRlci1yYWRpdXM6IDAgIWltcG9ydGFudDtcbiAgZm9udC13ZWlnaHQ6IHZhcigtLW5lZXRvLXVpLWZvbnQtbm9ybWFsKTtcbiAgbWluLWhlaWdodDogMzRweDtcbiAgbWluLXdpZHRoOiAxNTBweDtcbiAgdGV4dC1hbGlnbjogbGVmdDtcbiAgd2lkdGg6IDEwMCU7XG59XG5cbi5uZWV0by1hcHByb3ZhbHMtc2Nyb2xsYmFyIHtcbiAgJl9faW5uZXIge1xuICAgIHdpZHRoOiAxMDAlO1xuICAgIGhlaWdodDogMjAwcHg7XG4gIH1cblxuICAmX19vdXRlciB7XG4gICAgcG9zaXRpb246IFwiYWJzb2x1dGVcIjtcbiAgICB0b3A6IDBweDtcbiAgICBsZWZ0OiAwcHg7XG4gICAgd2lkdGg6IDIwMHB4O1xuICAgIGhlaWdodDogMTUwcHg7XG4gICAgb3ZlcmZsb3c6IFwiaGlkZGVuXCI7XG4gICAgdmlzaWJpbGl0eTogXCJoaWRkZW5cIjtcbiAgfVxufVxuIiwiLm5lZXRvLWFwcHJvdmFscy1kcm9wZG93bl9fYnV0dG9uIHtcbiAgYm9yZGVyLXJhZGl1czogMCAhaW1wb3J0YW50O1xuICBmb250LXdlaWdodDogdmFyKC0tbmVldG8tdWktZm9udC1ub3JtYWwpO1xuICBtaW4taGVpZ2h0OiAzNHB4O1xuICBtaW4td2lkdGg6IDE1MHB4O1xuICB0ZXh0LWFsaWduOiBsZWZ0O1xuICB3aWR0aDogMTAwJTtcbn1cblxuLm5lZXRvLWFwcHJvdmFscy1zY3JvbGxiYXJfX2lubmVyIHtcbiAgd2lkdGg6IDEwMCU7XG4gIGhlaWdodDogMjAwcHg7XG59XG4ubmVldG8tYXBwcm92YWxzLXNjcm9sbGJhcl9fb3V0ZXIge1xuICBwb3NpdGlvbjogXCJhYnNvbHV0ZVwiO1xuICB0b3A6IDBweDtcbiAgbGVmdDogMHB4O1xuICB3aWR0aDogMjAwcHg7XG4gIGhlaWdodDogMTUwcHg7XG4gIG92ZXJmbG93OiBcImhpZGRlblwiO1xuICB2aXNpYmlsaXR5OiBcImhpZGRlblwiO1xufVxuXG4ubmVldG8tdWktc3ViaGVhZGVyIC5uZWV0by11aS1zdWJoZWFkZXJfX2xlZnQtd3JhcHBlciAubmVldG8tdWktc3ViaGVhZGVyX19sZWZ0IHtcbiAgbWF4LXdpZHRoOiBub25lO1xufVxuXG50ZC5hbnQtdGFibGUtY29sdW1uLXNvcnQge1xuICBiYWNrZ3JvdW5kOiB0cmFuc3BhcmVudDtcbn1cblxuLm5lZXRvLWFwcHJvdmFscy1lbXB0eS1zdGF0ZSB7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGhlaWdodDogMTAwJTtcbiAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gIHdpZHRoOiAxMDAlO1xufVxuLm5lZXRvLWFwcHJvdmFscy1lbXB0eS1zdGF0ZV9faW1hZ2Uge1xuICBkaXNwbGF5OiBmbGV4O1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgbWFyZ2luLWJvdHRvbTogMnJlbTtcbn1cbi5uZWV0by1hcHByb3ZhbHMtZW1wdHktc3RhdGVfX3RpdGxlLS13aXRoLWFjdGlvbi1ibG9jayB7XG4gIG1hcmdpbi1ib3R0b206IDFyZW07XG59XG4ubmVldG8tYXBwcm92YWxzLWVtcHR5LXN0YXRlX19hY3Rpb24tYmxvY2sge1xuICBkaXNwbGF5OiBmbGV4O1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbn0iLCIubmVldG8tdWktc3ViaGVhZGVyIHtcbiAgLm5lZXRvLXVpLXN1YmhlYWRlcl9fbGVmdC13cmFwcGVyIHtcbiAgICAubmVldG8tdWktc3ViaGVhZGVyX19sZWZ0IHtcbiAgICAgIG1heC13aWR0aDogbm9uZTtcbiAgICB9XG4gIH1cbn1cblxuLy8gQW50IERlc2lnbiBPdmVycmlkZXNcbnRkLmFudC10YWJsZS1jb2x1bW4tc29ydCB7XG4gIGJhY2tncm91bmQ6IHRyYW5zcGFyZW50O1xufVxuIiwiLm5lZXRvLWFwcHJvdmFscy1lbXB0eS1zdGF0ZSB7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGhlaWdodDogMTAwJTtcbiAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gIHdpZHRoOiAxMDAlO1xuXG4gICZfX2ltYWdlIHtcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAgbWFyZ2luLWJvdHRvbTogMnJlbTtcbiAgfVxuXG4gICZfX3RpdGxlIHtcbiAgICAmLS13aXRoLWFjdGlvbi1ibG9jayB7XG4gICAgICBtYXJnaW4tYm90dG9tOiAxcmVtO1xuICAgIH1cbiAgfVxuXG4gICZfX2FjdGlvbi1ibG9jayB7XG4gICAgZGlzcGxheTogZmxleDtcbiAgICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgfVxufVxuIl19 */";
|
|
1917
|
-
n(css,{});
|
|
1918
|
-
|
|
1919
|
-
export { Approvals, Form, Public, RequestDetailsPane };
|
|
1
|
+
export { default as Approvals } from './Approvals.js';
|
|
2
|
+
export { default as Form } from './Form.js';
|
|
3
|
+
export { default as Public } from './Public.js';
|
|
4
|
+
export { R as RequestDetailsPane } from './index-458211fe.js';
|
|
5
|
+
import './constants-752da2ba.js';
|
|
6
|
+
import 'i18next';
|
|
7
|
+
import '@bigbinary/neeto-editor/utils';
|
|
8
|
+
import 'yup';
|
|
9
|
+
import 'react';
|
|
10
|
+
import '@bigbinary/neeto-commons-frontend/react-utils';
|
|
11
|
+
import '@bigbinary/neeto-molecules/Container';
|
|
12
|
+
import 'react-router-dom';
|
|
13
|
+
import '@bigbinary/neeto-commons-frontend/constants';
|
|
14
|
+
import '@bigbinary/neetoui/Button';
|
|
15
|
+
import '@bigbinary/neeto-cist';
|
|
16
|
+
import '@bigbinary/neeto-molecules/TableWrapper';
|
|
17
|
+
import '@bigbinary/neetoui/Table';
|
|
18
|
+
import '@bigbinary/neetoui/NoData';
|
|
19
|
+
import 'ramda';
|
|
20
|
+
import 'react-i18next';
|
|
21
|
+
import '@bigbinary/neeto-molecules/DateFormat';
|
|
22
|
+
import '@bigbinary/neetoui/Tag';
|
|
23
|
+
import 'react/jsx-runtime';
|
|
24
|
+
import '@bigbinary/neeto-molecules/PageLoader';
|
|
25
|
+
import '@bigbinary/neetoui/Alert';
|
|
26
|
+
import './useTemplatesApi-dc60dcdd.js';
|
|
27
|
+
import '@tanstack/react-query';
|
|
28
|
+
import '@bigbinary/neeto-commons-frontend/utils';
|
|
29
|
+
import 'axios';
|
|
30
|
+
import '@bigbinary/neetoui/Pane';
|
|
31
|
+
import '@bigbinary/neetoui/Typography';
|
|
32
|
+
import '@bigbinary/neetoui/formik/ActionBlock';
|
|
33
|
+
import '@bigbinary/neetoui/formik/Form';
|
|
34
|
+
import 'formik';
|
|
35
|
+
import '@bigbinary/neeto-molecules/ToggleFeatureCard';
|
|
36
|
+
import '@bigbinary/neetoui/formik/Input';
|
|
37
|
+
import '@bigbinary/neetoui/formik/Textarea';
|
|
38
|
+
import '@bigbinary/neeto-editor/FormikEditor';
|
|
39
|
+
import '@bigbinary/neeto-editor/EditorContent';
|
|
40
|
+
import '@bigbinary/neetoui/Label';
|
|
41
|
+
import '@bigbinary/neeto-molecules/MoreDropdown';
|
|
42
|
+
import '@bigbinary/neeto-molecules/Header';
|
|
43
|
+
import '@bigbinary/neetoui/Tab';
|
|
44
|
+
import '@bigbinary/neeto-commons-frontend/initializers';
|
|
45
|
+
import '@bigbinary/neetoui/Select';
|
|
46
|
+
import '@bigbinary/neetoui/Callout';
|
|
47
|
+
import '@bigbinary/neetoui/Textarea';
|
|
48
|
+
import 'dayjs';
|
|
49
|
+
import 'dayjs/plugin/timezone';
|
|
50
|
+
import 'dayjs/plugin/utc';
|
|
1920
51
|
//# sourceMappingURL=index.js.map
|