@bigbinary/neeto-approvals-frontend 0.0.34 → 0.1.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/index.cjs.js +30 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +30 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4092,7 +4092,7 @@ var common$1 = {
|
|
|
4092
4092
|
status: "Status",
|
|
4093
4093
|
record_one: "Record",
|
|
4094
4094
|
record_other: "Records",
|
|
4095
|
-
note: "Note
|
|
4095
|
+
note: "Note",
|
|
4096
4096
|
approvedBy: "Approved by",
|
|
4097
4097
|
rejectedBy: "Rejected by",
|
|
4098
4098
|
cancelledBy: "Cancelled by",
|
|
@@ -4118,8 +4118,7 @@ var inputs = {
|
|
|
4118
4118
|
description: "Description",
|
|
4119
4119
|
approver: "Approver",
|
|
4120
4120
|
variableMapping: "Variable mapping",
|
|
4121
|
-
message: "Message"
|
|
4122
|
-
approverNote: "Approver's note"
|
|
4121
|
+
message: "Message"
|
|
4123
4122
|
},
|
|
4124
4123
|
placeholders: {
|
|
4125
4124
|
firstName: "Enter first name",
|
|
@@ -5028,17 +5027,17 @@ var ApprovalsDetails = function ApprovalsDetails(_ref) {
|
|
|
5028
5027
|
createdAt = approvalDetails.createdAt,
|
|
5029
5028
|
approverName = approvalDetails.approverName,
|
|
5030
5029
|
approverEmail = approvalDetails.approverEmail,
|
|
5031
|
-
_approvalDetails$
|
|
5032
|
-
|
|
5030
|
+
_approvalDetails$note = approvalDetails.note,
|
|
5031
|
+
initialNote = _approvalDetails$note === void 0 ? "" : _approvalDetails$note,
|
|
5033
5032
|
requesterName = approvalDetails.requesterName,
|
|
5034
5033
|
requesterEmail = approvalDetails.requesterEmail;
|
|
5035
|
-
var _useState = useState(
|
|
5034
|
+
var _useState = useState(initialNote),
|
|
5036
5035
|
_useState2 = _slicedToArray(_useState, 2),
|
|
5037
|
-
|
|
5038
|
-
|
|
5036
|
+
note = _useState2[0],
|
|
5037
|
+
setNote = _useState2[1];
|
|
5039
5038
|
useEffect(function () {
|
|
5040
|
-
|
|
5041
|
-
}, [
|
|
5039
|
+
setNote(initialNote);
|
|
5040
|
+
}, [initialNote]);
|
|
5042
5041
|
var requesterOrApproverDetails = status === STATUSES.cancelled ? "".concat(requesterName, " (").concat(requesterEmail, ")") : "".concat(approverName, " (").concat(approverEmail, ")");
|
|
5043
5042
|
var isCurrentUserApprover = ((_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 ? void 0 : (_window$globalProps$u = _window$globalProps.user) === null || _window$globalProps$u === void 0 ? void 0 : _window$globalProps$u.email) === approverEmail;
|
|
5044
5043
|
var getStatusLabel = function getStatusLabel() {
|
|
@@ -5048,13 +5047,13 @@ var ApprovalsDetails = function ApprovalsDetails(_ref) {
|
|
|
5048
5047
|
return STATUS_UPDATED_BY[status];
|
|
5049
5048
|
};
|
|
5050
5049
|
var handleOnClose = function handleOnClose() {
|
|
5051
|
-
|
|
5050
|
+
setNote("");
|
|
5052
5051
|
onClose();
|
|
5053
5052
|
};
|
|
5054
5053
|
var handleSubmit = function handleSubmit(status) {
|
|
5055
5054
|
onSubmit({
|
|
5056
5055
|
status: status,
|
|
5057
|
-
|
|
5056
|
+
note: note,
|
|
5058
5057
|
approvedAt: new Date()
|
|
5059
5058
|
});
|
|
5060
5059
|
};
|
|
@@ -5087,17 +5086,17 @@ var ApprovalsDetails = function ApprovalsDetails(_ref) {
|
|
|
5087
5086
|
})), isPending && isCurrentUserApprover && /*#__PURE__*/React.createElement(Textarea, {
|
|
5088
5087
|
className: "w-full",
|
|
5089
5088
|
disabled: !isPending,
|
|
5090
|
-
label: t("
|
|
5091
|
-
value:
|
|
5089
|
+
label: t("common.note"),
|
|
5090
|
+
value: note,
|
|
5092
5091
|
placeholder: t("inputs.placeholders.add_", {
|
|
5093
5092
|
what: t("common.note").toLocaleLowerCase()
|
|
5094
5093
|
}),
|
|
5095
|
-
onChange: withEventTargetValue(
|
|
5096
|
-
}), !isPending &&
|
|
5094
|
+
onChange: withEventTargetValue(setNote)
|
|
5095
|
+
}), !isPending && note && /*#__PURE__*/React.createElement("div", {
|
|
5097
5096
|
className: "w-full space-y-2"
|
|
5098
5097
|
}, /*#__PURE__*/React.createElement(Label, null, t("common.note")), /*#__PURE__*/React.createElement("div", {
|
|
5099
5098
|
className: "neeto-ui-bg-gray-100 p-4"
|
|
5100
|
-
},
|
|
5099
|
+
}, note))), isPending && isCurrentUserApprover && /*#__PURE__*/React.createElement(Pane.Footer, {
|
|
5101
5100
|
className: "flex gap-x-2"
|
|
5102
5101
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
5103
5102
|
label: t("buttons.approve"),
|
|
@@ -6282,16 +6281,16 @@ var show = function show(id) {
|
|
|
6282
6281
|
};
|
|
6283
6282
|
var accept = function accept(_ref) {
|
|
6284
6283
|
var id = _ref.id,
|
|
6285
|
-
|
|
6284
|
+
note = _ref.note;
|
|
6286
6285
|
return axios.patch("".concat(BASE_URL, "/public/requests/").concat(id, "/accept"), {
|
|
6287
|
-
|
|
6286
|
+
note: note
|
|
6288
6287
|
});
|
|
6289
6288
|
};
|
|
6290
6289
|
var decline = function decline(_ref2) {
|
|
6291
6290
|
var id = _ref2.id,
|
|
6292
|
-
|
|
6291
|
+
note = _ref2.note;
|
|
6293
6292
|
return axios.patch("".concat(BASE_URL, "/public/requests/").concat(id, "/decline"), {
|
|
6294
|
-
|
|
6293
|
+
note: note
|
|
6295
6294
|
});
|
|
6296
6295
|
};
|
|
6297
6296
|
var publicRequestsApi = {
|
|
@@ -6338,8 +6337,8 @@ var useDeclinePendingRequest = function useDeclinePendingRequest(options) {
|
|
|
6338
6337
|
var Public = function Public() {
|
|
6339
6338
|
var _useState = useState(""),
|
|
6340
6339
|
_useState2 = _slicedToArray(_useState, 2),
|
|
6341
|
-
|
|
6342
|
-
|
|
6340
|
+
note = _useState2[0],
|
|
6341
|
+
setNote = _useState2[1];
|
|
6343
6342
|
var _useParams = useParams(),
|
|
6344
6343
|
id = _useParams.id;
|
|
6345
6344
|
var _useTranslation = useTranslation(),
|
|
@@ -6348,8 +6347,8 @@ var Public = function Public() {
|
|
|
6348
6347
|
requestId: id
|
|
6349
6348
|
}, {
|
|
6350
6349
|
onSuccess: function onSuccess(_ref) {
|
|
6351
|
-
var
|
|
6352
|
-
|
|
6350
|
+
var note = _ref.approvalRequest.note;
|
|
6351
|
+
note && setNote(note);
|
|
6353
6352
|
}
|
|
6354
6353
|
}),
|
|
6355
6354
|
_useFetchPublicReques2 = _useFetchPublicReques.data,
|
|
@@ -6364,7 +6363,7 @@ var Public = function Public() {
|
|
|
6364
6363
|
declinePendingRequest = _useDeclinePendingReq.mutate,
|
|
6365
6364
|
isDeclining = _useDeclinePendingReq.isLoading;
|
|
6366
6365
|
var calloutStyle = approvalRequest.status === STATUSES.approved ? "success" : "danger";
|
|
6367
|
-
var hideTextArea = approvalRequest.status !== STATUSES.pending && isEmpty(
|
|
6366
|
+
var hideTextArea = approvalRequest.status !== STATUSES.pending && isEmpty(note);
|
|
6368
6367
|
if (isLoading) {
|
|
6369
6368
|
return /*#__PURE__*/React.createElement("div", {
|
|
6370
6369
|
className: "h-screen items-center justify-center"
|
|
@@ -6383,15 +6382,13 @@ var Public = function Public() {
|
|
|
6383
6382
|
}, approvalRequest.title), /*#__PURE__*/React.createElement(EditorContent, {
|
|
6384
6383
|
content: approvalRequest.message
|
|
6385
6384
|
}), !hideTextArea && /*#__PURE__*/React.createElement(Textarea, {
|
|
6386
|
-
label: t("
|
|
6385
|
+
label: t("common.note"),
|
|
6387
6386
|
placeholder: t("inputs.placeholders.add_", {
|
|
6388
6387
|
what: t("common.note").toLocaleLowerCase()
|
|
6389
6388
|
}),
|
|
6390
|
-
value:
|
|
6389
|
+
value: note,
|
|
6391
6390
|
disabled: approvalRequest.status !== STATUSES.pending,
|
|
6392
|
-
onChange:
|
|
6393
|
-
return setApproverNote(e.target.value);
|
|
6394
|
-
}
|
|
6391
|
+
onChange: withEventTargetValue(setNote)
|
|
6395
6392
|
}), approvalRequest.status === STATUSES.pending ? /*#__PURE__*/React.createElement("div", {
|
|
6396
6393
|
className: "mx-auto mt-8 flex space-x-6"
|
|
6397
6394
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -6399,7 +6396,7 @@ var Public = function Public() {
|
|
|
6399
6396
|
onClick: function onClick() {
|
|
6400
6397
|
return acceptPendingRequest({
|
|
6401
6398
|
id: approvalRequest.id,
|
|
6402
|
-
|
|
6399
|
+
note: note
|
|
6403
6400
|
});
|
|
6404
6401
|
},
|
|
6405
6402
|
loading: isAccepting
|
|
@@ -6408,7 +6405,7 @@ var Public = function Public() {
|
|
|
6408
6405
|
onClick: function onClick() {
|
|
6409
6406
|
return declinePendingRequest({
|
|
6410
6407
|
id: approvalRequest.id,
|
|
6411
|
-
|
|
6408
|
+
note: note
|
|
6412
6409
|
});
|
|
6413
6410
|
},
|
|
6414
6411
|
style: "secondary",
|