@bigbinary/neeto-approvals-frontend 0.2.1 → 0.2.3
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 +48 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +46 -35
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/types.d.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -11,8 +11,12 @@ import axios from 'axios';
|
|
|
11
11
|
import { useQuery, useQueryClient, useMutation } from 'react-query';
|
|
12
12
|
import { Form as Form$3, Input, Textarea as Textarea$1, Select } from '@bigbinary/neetoui/formik';
|
|
13
13
|
import { MenuHorizontal, Delete } from '@bigbinary/neeto-icons';
|
|
14
|
-
import { capitalize as capitalize$1, noop as noop$1,
|
|
14
|
+
import { isPresent, findBy, capitalize as capitalize$1, noop as noop$1, camelToSnakeCase, removeBy, findById } from '@bigbinary/neeto-commons-frontend/pure';
|
|
15
15
|
import { dateFormat, withEventTargetValue } from '@bigbinary/neeto-commons-frontend/utils';
|
|
16
|
+
import dayjs from 'dayjs';
|
|
17
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
18
|
+
import utc from 'dayjs/plugin/utc';
|
|
19
|
+
import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
16
20
|
import { EditorContent, isEditorEmpty, FormikEditor, substituteVariables } from '@bigbinary/neeto-editor';
|
|
17
21
|
import { useFormikContext, FieldArray } from 'formik';
|
|
18
22
|
import NeetoHeader from '@bigbinary/neeto-molecules/Header';
|
|
@@ -4775,6 +4779,45 @@ var useUpdateRequest = function useUpdateRequest(options) {
|
|
|
4775
4779
|
}));
|
|
4776
4780
|
};
|
|
4777
4781
|
|
|
4782
|
+
dayjs.extend(utc);
|
|
4783
|
+
dayjs.extend(timezone);
|
|
4784
|
+
var updateApprovalDetails = function updateApprovalDetails(_ref) {
|
|
4785
|
+
var requestsData = _ref.requestsData,
|
|
4786
|
+
approvalDetails = _ref.approvalDetails;
|
|
4787
|
+
if (isPresent(requestsData === null || requestsData === void 0 ? void 0 : requestsData.requests) && isPresent(approvalDetails)) {
|
|
4788
|
+
var request = findBy({
|
|
4789
|
+
id: approvalDetails.id
|
|
4790
|
+
}, requestsData.requests) || {};
|
|
4791
|
+
return request;
|
|
4792
|
+
}
|
|
4793
|
+
return {};
|
|
4794
|
+
};
|
|
4795
|
+
var timeInZone = function timeInZone(time) {
|
|
4796
|
+
var _globalProps$user, _globalProps$user2;
|
|
4797
|
+
((_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);
|
|
4798
|
+
return dayjs(time).tz();
|
|
4799
|
+
};
|
|
4800
|
+
var getApprovalFilter = function getApprovalFilter() {
|
|
4801
|
+
return {
|
|
4802
|
+
PENDING: {
|
|
4803
|
+
label: t$2("common.pending"),
|
|
4804
|
+
value: "PENDING"
|
|
4805
|
+
},
|
|
4806
|
+
TEMPLATES: {
|
|
4807
|
+
label: t$2("common.template", PLURAL),
|
|
4808
|
+
value: "TEMPLATES"
|
|
4809
|
+
},
|
|
4810
|
+
HISTORY: {
|
|
4811
|
+
label: t$2("common.history"),
|
|
4812
|
+
value: "HISTORY"
|
|
4813
|
+
},
|
|
4814
|
+
APPROVERS: {
|
|
4815
|
+
label: t$2("common.approver", PLURAL),
|
|
4816
|
+
value: "APPROVERS"
|
|
4817
|
+
}
|
|
4818
|
+
};
|
|
4819
|
+
};
|
|
4820
|
+
|
|
4778
4821
|
var HISTORY_TABLE_COLUMNS = [{
|
|
4779
4822
|
dataIndex: "approvalLabel",
|
|
4780
4823
|
key: "approvalLabel",
|
|
@@ -4815,7 +4858,7 @@ var HISTORY_TABLE_COLUMNS = [{
|
|
|
4815
4858
|
width: "25%",
|
|
4816
4859
|
title: t$2("common.created"),
|
|
4817
4860
|
render: function render(createdAt) {
|
|
4818
|
-
return dateFormat.fromNow(createdAt);
|
|
4861
|
+
return dateFormat.fromNow(timeInZone(createdAt));
|
|
4819
4862
|
}
|
|
4820
4863
|
}];
|
|
4821
4864
|
|
|
@@ -4891,7 +4934,7 @@ var ApprovalsDetails = function ApprovalsDetails(_ref) {
|
|
|
4891
4934
|
style: "body2"
|
|
4892
4935
|
}, requesterOrApproverDetails)), /*#__PURE__*/React.createElement("div", {
|
|
4893
4936
|
className: "flex space-x-10 p-2"
|
|
4894
|
-
}, /*#__PURE__*/React.createElement(Label, null, t("common.created")), /*#__PURE__*/React.createElement(Typography, null, dateFormat.extended(createdAt)))), /*#__PURE__*/React.createElement("div", {
|
|
4937
|
+
}, /*#__PURE__*/React.createElement(Label, null, t("common.created")), /*#__PURE__*/React.createElement(Typography, null, dateFormat.extended(timeInZone(createdAt))))), /*#__PURE__*/React.createElement("div", {
|
|
4895
4938
|
className: "w-full space-y-2"
|
|
4896
4939
|
}, /*#__PURE__*/React.createElement(Label, null, t("inputs.labels.message")), /*#__PURE__*/React.createElement(MemoizedEditorContent$1, {
|
|
4897
4940
|
className: "neeto-ui-bg-gray-100 p-4",
|
|
@@ -4928,38 +4971,6 @@ var ApprovalsDetails = function ApprovalsDetails(_ref) {
|
|
|
4928
4971
|
})));
|
|
4929
4972
|
};
|
|
4930
4973
|
|
|
4931
|
-
var updateApprovalDetails = function updateApprovalDetails(_ref) {
|
|
4932
|
-
var requestsData = _ref.requestsData,
|
|
4933
|
-
approvalDetails = _ref.approvalDetails;
|
|
4934
|
-
if (isPresent(requestsData === null || requestsData === void 0 ? void 0 : requestsData.requests) && isPresent(approvalDetails)) {
|
|
4935
|
-
var request = findBy({
|
|
4936
|
-
id: approvalDetails.id
|
|
4937
|
-
}, requestsData.requests) || {};
|
|
4938
|
-
return request;
|
|
4939
|
-
}
|
|
4940
|
-
return {};
|
|
4941
|
-
};
|
|
4942
|
-
var getApprovalFilter = function getApprovalFilter() {
|
|
4943
|
-
return {
|
|
4944
|
-
PENDING: {
|
|
4945
|
-
label: t$2("common.pending"),
|
|
4946
|
-
value: "PENDING"
|
|
4947
|
-
},
|
|
4948
|
-
TEMPLATES: {
|
|
4949
|
-
label: t$2("common.template", PLURAL),
|
|
4950
|
-
value: "TEMPLATES"
|
|
4951
|
-
},
|
|
4952
|
-
HISTORY: {
|
|
4953
|
-
label: t$2("common.history"),
|
|
4954
|
-
value: "HISTORY"
|
|
4955
|
-
},
|
|
4956
|
-
APPROVERS: {
|
|
4957
|
-
label: t$2("common.approver", PLURAL),
|
|
4958
|
-
value: "APPROVERS"
|
|
4959
|
-
}
|
|
4960
|
-
};
|
|
4961
|
-
};
|
|
4962
|
-
|
|
4963
4974
|
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4964
4975
|
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4965
4976
|
var History = function History(_ref) {
|