awing-library 2.1.2-beta → 2.1.5-beta
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/lib/ACM-AXN/Page/CreateOrEdit/Utils.d.ts +1 -1
- package/lib/ACM-AXN/TransactionLog/Constant.d.ts +10 -0
- package/lib/ACM-AXN/TransactionLog/Constant.js +13 -0
- package/lib/ACM-AXN/TransactionLog/Container.d.ts +7 -0
- package/lib/ACM-AXN/TransactionLog/Container.js +189 -0
- package/lib/ACM-AXN/TransactionLog/Context.d.ts +8 -0
- package/lib/ACM-AXN/TransactionLog/Context.js +10 -0
- package/lib/ACM-AXN/TransactionLog/Detail.d.ts +7 -0
- package/lib/ACM-AXN/TransactionLog/Detail.js +204 -0
- package/lib/ACM-AXN/TransactionLog/Hooks.d.ts +7 -0
- package/lib/ACM-AXN/TransactionLog/Hooks.js +17 -0
- package/lib/ACM-AXN/TransactionLog/Types.d.ts +273 -0
- package/lib/ACM-AXN/TransactionLog/Types.js +413 -0
- package/lib/ACM-AXN/TransactionLog/Utils.d.ts +128 -0
- package/lib/ACM-AXN/TransactionLog/Utils.js +166 -0
- package/lib/ACM-AXN/TransactionLog/index.d.ts +8 -0
- package/lib/ACM-AXN/TransactionLog/index.js +36 -0
- package/lib/translate/en/translation.json +12 -0
- package/lib/translate/vi/translation.json +12 -0
- package/package.json +3 -2
|
@@ -4,7 +4,7 @@ export declare const isObjectType: (value: unknown) => value is object;
|
|
|
4
4
|
export declare const isObject: <T extends object>(value: unknown) => value is T;
|
|
5
5
|
export declare const composeKey: <F extends (...p: any[]) => any, G extends (...p: any[]) => any>(f: F, g: G) => F;
|
|
6
6
|
export declare const concatKey: (parent: string | string[]) => (child: string | string[]) => string[];
|
|
7
|
-
export declare const setObject: <O extends {}>(obj: O, arrKey:
|
|
7
|
+
export declare const setObject: <O extends {}>(obj: O, arrKey: Array<keyof O>, value: unknown) => void;
|
|
8
8
|
export declare const convertTreeArrayToFlatArray: (treeArray: DataObject[]) => any[];
|
|
9
9
|
export declare const convertValueByType: (type: string, val: any) => any;
|
|
10
10
|
export declare const getFieldsValid: (templateDatas: TemplateData[]) => boolean[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @author dauquan1108@gmail.com on 12/25/2023.
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Constants = void 0;
|
|
9
|
+
exports.Constants = {
|
|
10
|
+
DETAIL_PATH: 'Detail',
|
|
11
|
+
PAGE_SIZE_DEFAULT: 10,
|
|
12
|
+
TRANSACTION_LOG_PATH: 'TransactionLog',
|
|
13
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @author dauquan1108@gmail.com on 12/25/2023.
|
|
19
|
+
*
|
|
20
|
+
**/
|
|
21
|
+
var react_1 = require("react");
|
|
22
|
+
var moment_1 = __importDefault(require("moment"));
|
|
23
|
+
var react_i18next_1 = require("react-i18next");
|
|
24
|
+
var Constant_1 = require("./Constant");
|
|
25
|
+
var Hooks_1 = __importDefault(require("./Hooks"));
|
|
26
|
+
var Router_1 = require("../../AWING/Router");
|
|
27
|
+
var AWING_1 = require("../../AWING");
|
|
28
|
+
var Helpers_1 = require("../../Utils/Helpers");
|
|
29
|
+
var Utils_1 = require("./Utils");
|
|
30
|
+
function Container() {
|
|
31
|
+
var navigate = (0, Router_1.useNavigate)();
|
|
32
|
+
var t = (0, react_i18next_1.useTranslation)().t;
|
|
33
|
+
var service = (0, Hooks_1.default)().service;
|
|
34
|
+
var _a = (0, react_1.useState)(false), loading = _a[0], setLoading = _a[1];
|
|
35
|
+
var _b = (0, react_1.useState)(), transactionLog = _b[0], setTransactionLog = _b[1];
|
|
36
|
+
var _c = (0, react_1.useState)(), users = _c[0], setUsers = _c[1];
|
|
37
|
+
(0, react_1.useEffect)(function () {
|
|
38
|
+
getUsers();
|
|
39
|
+
}, []);
|
|
40
|
+
var getUsers = (0, react_1.useCallback)(function () {
|
|
41
|
+
service.usersGet().then(function (res) {
|
|
42
|
+
setUsers(__spreadArray([Utils_1.accountAdmin], res, true));
|
|
43
|
+
});
|
|
44
|
+
}, []);
|
|
45
|
+
var queryData = (0, react_1.useCallback)(function (queryInput) {
|
|
46
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
47
|
+
var valueFilterNew = {
|
|
48
|
+
startDate: ((_a = queryInput === null || queryInput === void 0 ? void 0 : queryInput.advancedObject) === null || _a === void 0 ? void 0 : _a.date)
|
|
49
|
+
? (0, moment_1.default)(queryInput.advancedObject.date[0]).format('YYYY-MM-DD')
|
|
50
|
+
: (0, moment_1.default)().subtract(7, 'day').format('YYYY-MM-DD'),
|
|
51
|
+
endDate: ((_b = queryInput === null || queryInput === void 0 ? void 0 : queryInput.advancedObject) === null || _b === void 0 ? void 0 : _b.date)
|
|
52
|
+
? (0, moment_1.default)(queryInput.advancedObject.date[1]).format('YYYY-MM-DD')
|
|
53
|
+
: (0, moment_1.default)().format('YYYY-MM-DD'),
|
|
54
|
+
pageIndex: (queryInput === null || queryInput === void 0 ? void 0 : queryInput.pageIndex) ? queryInput.pageIndex : 0,
|
|
55
|
+
pageSize: (queryInput === null || queryInput === void 0 ? void 0 : queryInput.pageSize)
|
|
56
|
+
? queryInput.pageSize
|
|
57
|
+
: Constant_1.Constants.PAGE_SIZE_DEFAULT,
|
|
58
|
+
objectIds: (queryInput === null || queryInput === void 0 ? void 0 : queryInput.searchString)
|
|
59
|
+
? [queryInput.searchString]
|
|
60
|
+
: [],
|
|
61
|
+
userIds: ((_c = queryInput === null || queryInput === void 0 ? void 0 : queryInput.advancedObject) === null || _c === void 0 ? void 0 : _c.userIds)
|
|
62
|
+
? [(_d = queryInput === null || queryInput === void 0 ? void 0 : queryInput.advancedObject) === null || _d === void 0 ? void 0 : _d.userIds]
|
|
63
|
+
: [],
|
|
64
|
+
transactionTypes: ((_e = queryInput === null || queryInput === void 0 ? void 0 : queryInput.advancedObject) === null || _e === void 0 ? void 0 : _e.transactionType)
|
|
65
|
+
? [(_f = queryInput === null || queryInput === void 0 ? void 0 : queryInput.advancedObject) === null || _f === void 0 ? void 0 : _f.transactionType]
|
|
66
|
+
: [],
|
|
67
|
+
transactionStatusCodes: ((_g = queryInput === null || queryInput === void 0 ? void 0 : queryInput.advancedObject) === null || _g === void 0 ? void 0 : _g.statusCode) ||
|
|
68
|
+
((_h = queryInput === null || queryInput === void 0 ? void 0 : queryInput.advancedObject) === null || _h === void 0 ? void 0 : _h.statusCode) === Utils_1.STATUS_CODE.Start
|
|
69
|
+
? [queryInput.advancedObject.statusCode]
|
|
70
|
+
: [],
|
|
71
|
+
};
|
|
72
|
+
setLoading(true);
|
|
73
|
+
service
|
|
74
|
+
.transactionLogsPaging(valueFilterNew)
|
|
75
|
+
.then(setTransactionLog)
|
|
76
|
+
.finally(function () {
|
|
77
|
+
setLoading(false);
|
|
78
|
+
});
|
|
79
|
+
}, []);
|
|
80
|
+
var handlerClickRow = (0, react_1.useCallback)(function (id) {
|
|
81
|
+
navigate("/".concat(Constant_1.Constants.TRANSACTION_LOG_PATH, "/").concat(Constant_1.Constants.DETAIL_PATH, "/").concat(id));
|
|
82
|
+
}, []);
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)(AWING_1.PageManagement, { title: t('TransactionLog.Title'), onChangeQueryInput: queryData, inputSearchPlaceholder: t('TransactionLog.SearchPlaceholder'), onlyNumberSearch: true, advancedSearchFields: [
|
|
84
|
+
{
|
|
85
|
+
fieldName: 'date',
|
|
86
|
+
label: t('TransactionLog.Date'),
|
|
87
|
+
type: 'date-range',
|
|
88
|
+
isDayBlocked: function (day) {
|
|
89
|
+
return day.isAfter((0, moment_1.default)().endOf('day'));
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
fieldName: 'transactionType',
|
|
94
|
+
label: t('TransactionLog.TransactionType'),
|
|
95
|
+
type: 'autocomplete',
|
|
96
|
+
options: Object.entries(Utils_1.TRANSACTION_TYPE).map(function (_a) {
|
|
97
|
+
var text = _a[0], value = _a[1];
|
|
98
|
+
if (value === Utils_1.TRANSACTION_TYPE.None) {
|
|
99
|
+
return {
|
|
100
|
+
value: '',
|
|
101
|
+
text: t('Common.SelectAll'),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return { value: value, text: text };
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
fieldName: 'statusCode',
|
|
111
|
+
label: t('TransactionLog.Status'),
|
|
112
|
+
type: 'autocomplete',
|
|
113
|
+
options: Object.entries(Utils_1.STATUS_CODE).map(function (_a) {
|
|
114
|
+
var text = _a[0], value = _a[1];
|
|
115
|
+
if (value === Utils_1.STATUS_CODE.All) {
|
|
116
|
+
return {
|
|
117
|
+
value: '',
|
|
118
|
+
text: t('Common.SelectAll'),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return { value: value, text: text };
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
fieldName: 'userIds',
|
|
128
|
+
label: t('TransactionLog.Username'),
|
|
129
|
+
type: 'autocomplete',
|
|
130
|
+
options: users
|
|
131
|
+
? __spreadArray([
|
|
132
|
+
{
|
|
133
|
+
value: '',
|
|
134
|
+
text: t('Common.SelectAll'),
|
|
135
|
+
}
|
|
136
|
+
], users.map(function (item) { return ({
|
|
137
|
+
value: item === null || item === void 0 ? void 0 : item.userId,
|
|
138
|
+
text: (item === null || item === void 0 ? void 0 : item.username) || (item === null || item === void 0 ? void 0 : item.name) || '',
|
|
139
|
+
}); }), true) : [],
|
|
140
|
+
},
|
|
141
|
+
], loading: loading, getRowId: function (row) { return row.id; }, columns: [
|
|
142
|
+
{
|
|
143
|
+
field: 'id',
|
|
144
|
+
headerName: '#',
|
|
145
|
+
width: 60,
|
|
146
|
+
valueGetter: function (row, idx, stt) { return stt; },
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
field: 'transactionType',
|
|
150
|
+
headerName: t('TransactionLog.TransactionType'),
|
|
151
|
+
width: 300,
|
|
152
|
+
valueGetter: function (row) {
|
|
153
|
+
var index = Object.values(Utils_1.TRANSACTION_TYPE).indexOf(row.transactionType);
|
|
154
|
+
return Object.keys(Utils_1.TRANSACTION_TYPE)[index];
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
field: 'objectId',
|
|
159
|
+
headerName: t('TransactionLog.ObjectID'),
|
|
160
|
+
width: 220,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
field: 'userId',
|
|
164
|
+
headerName: t('TransactionLog.Username'),
|
|
165
|
+
width: 200,
|
|
166
|
+
valueGetter: function (row) {
|
|
167
|
+
var user = users === null || users === void 0 ? void 0 : users.find(function (item) { return item.userId === row.userId; });
|
|
168
|
+
return (user === null || user === void 0 ? void 0 : user.username) || (user === null || user === void 0 ? void 0 : user.name) || row.userId;
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
field: 'statusCode',
|
|
173
|
+
headerName: t('TransactionLog.Status'),
|
|
174
|
+
width: 150,
|
|
175
|
+
valueGetter: function (row) {
|
|
176
|
+
var index = Object.values(Utils_1.STATUS_CODE).indexOf(row.statusCode);
|
|
177
|
+
return Object.keys(Utils_1.STATUS_CODE)[index];
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
field: 'endDate',
|
|
182
|
+
headerName: t('TransactionLog.Date'),
|
|
183
|
+
valueGetter: function (row) {
|
|
184
|
+
return (0, Helpers_1.timestampToStringDDMMYYYYHHmm)(row.endDate);
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
], rows: (transactionLog === null || transactionLog === void 0 ? void 0 : transactionLog.items) || [], totalOfRows: (transactionLog === null || transactionLog === void 0 ? void 0 : transactionLog.totalItemCount) || 0, onRowClick: handlerClickRow }));
|
|
188
|
+
}
|
|
189
|
+
exports.default = Container;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @author dauquan1108@gmail.com on 19/02/2024.
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.TransactionLogContext = void 0;
|
|
9
|
+
var react_1 = require("react");
|
|
10
|
+
exports.TransactionLogContext = (0, react_1.createContext)({});
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @author dauquan1108@gmail.com on 12/25/2023.
|
|
69
|
+
*
|
|
70
|
+
**/
|
|
71
|
+
var react_1 = require("react");
|
|
72
|
+
var material_1 = require("@mui/material");
|
|
73
|
+
var react_router_dom_1 = require("react-router-dom");
|
|
74
|
+
var react_i18next_1 = require("react-i18next");
|
|
75
|
+
var react_diff_viewer_1 = __importStar(require("react-diff-viewer"));
|
|
76
|
+
var Hooks_1 = __importDefault(require("./Hooks"));
|
|
77
|
+
var ClassicDrawer_1 = __importDefault(require("../../Commons/Components/ClassicDrawer"));
|
|
78
|
+
var Helpers_1 = require("../../Utils/Helpers");
|
|
79
|
+
var AWING_1 = require("../../AWING");
|
|
80
|
+
var Utils_1 = require("./Utils");
|
|
81
|
+
var newStyles = {
|
|
82
|
+
variables: {
|
|
83
|
+
light: {
|
|
84
|
+
codeFoldGutterBackground: '#6F767E',
|
|
85
|
+
codeFoldBackground: '#E2E4E5',
|
|
86
|
+
addedBackground: '#ececec',
|
|
87
|
+
wordAddedBackground: '#cecdcd',
|
|
88
|
+
addedGutterBackground: '#ececec',
|
|
89
|
+
removedBackground: '#ececec',
|
|
90
|
+
wordRemovedBackground: '#cecdcd',
|
|
91
|
+
removedGutterBackground: '#ececec',
|
|
92
|
+
},
|
|
93
|
+
titleBlock: {
|
|
94
|
+
fontFamily: 'Roboto',
|
|
95
|
+
fontSize: '12px',
|
|
96
|
+
fontWeight: 'bold',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
contentText: {
|
|
100
|
+
fontSize: '14px',
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
function Detail() {
|
|
104
|
+
var _this = this;
|
|
105
|
+
var _a;
|
|
106
|
+
var id = (0, react_router_dom_1.useParams)().id;
|
|
107
|
+
var t = (0, react_i18next_1.useTranslation)().t;
|
|
108
|
+
var service = (0, Hooks_1.default)().service;
|
|
109
|
+
var _b = (0, react_1.useState)(false), loading = _b[0], setLoading = _b[1];
|
|
110
|
+
var _c = (0, react_1.useState)(), user = _c[0], setUser = _c[1];
|
|
111
|
+
var _d = (0, react_1.useState)(), transactionLog = _d[0], setTransactionLog = _d[1];
|
|
112
|
+
(0, react_1.useEffect)(function () {
|
|
113
|
+
var fetchData = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
114
|
+
var transactionLog_1, error_1;
|
|
115
|
+
return __generator(this, function (_a) {
|
|
116
|
+
switch (_a.label) {
|
|
117
|
+
case 0:
|
|
118
|
+
_a.trys.push([0, 5, 6, 7]);
|
|
119
|
+
setLoading(true);
|
|
120
|
+
if (!id) return [3 /*break*/, 4];
|
|
121
|
+
return [4 /*yield*/, service.transactionLogsGet(Number(id))];
|
|
122
|
+
case 1:
|
|
123
|
+
transactionLog_1 = _a.sent();
|
|
124
|
+
if (!transactionLog_1) return [3 /*break*/, 4];
|
|
125
|
+
setTransactionLog(transactionLog_1);
|
|
126
|
+
if (!(transactionLog_1.userId === Utils_1.accountAdmin.userId)) return [3 /*break*/, 2];
|
|
127
|
+
// userId trùng với id của admin thì không cần call API nữa
|
|
128
|
+
setUser(Utils_1.accountAdmin);
|
|
129
|
+
return [3 /*break*/, 4];
|
|
130
|
+
case 2:
|
|
131
|
+
// Trường hợp userId không trùng với id của admin thì thực hiện call API lấy ra user có id bằng với userId.
|
|
132
|
+
return [4 /*yield*/, service.usersGet().then(function (res) {
|
|
133
|
+
setUser(res.find(function (item) {
|
|
134
|
+
return item.userId ===
|
|
135
|
+
transactionLog_1.userId;
|
|
136
|
+
}));
|
|
137
|
+
})];
|
|
138
|
+
case 3:
|
|
139
|
+
// Trường hợp userId không trùng với id của admin thì thực hiện call API lấy ra user có id bằng với userId.
|
|
140
|
+
_a.sent();
|
|
141
|
+
_a.label = 4;
|
|
142
|
+
case 4: return [3 /*break*/, 7];
|
|
143
|
+
case 5:
|
|
144
|
+
error_1 = _a.sent();
|
|
145
|
+
console.error('Call API DetailTransactionLog Error:', error_1);
|
|
146
|
+
return [3 /*break*/, 7];
|
|
147
|
+
case 6:
|
|
148
|
+
setLoading(false);
|
|
149
|
+
return [7 /*endfinally*/];
|
|
150
|
+
case 7: return [2 /*return*/];
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}); };
|
|
154
|
+
fetchData();
|
|
155
|
+
}, []);
|
|
156
|
+
var request = (transactionLog === null || transactionLog === void 0 ? void 0 : transactionLog.request)
|
|
157
|
+
? (0, Utils_1.tryParseJSONObject)(transactionLog.request)
|
|
158
|
+
: null;
|
|
159
|
+
var oldModel = (request === null || request === void 0 ? void 0 : request.OldModel)
|
|
160
|
+
? (0, Utils_1.tryParseJSONObject)(request.OldModel)
|
|
161
|
+
: '';
|
|
162
|
+
var newModel = (request === null || request === void 0 ? void 0 : request.NewModel)
|
|
163
|
+
? (0, Utils_1.tryParseJSONObject)(request.NewModel)
|
|
164
|
+
: '';
|
|
165
|
+
return ((0, jsx_runtime_1.jsx)(ClassicDrawer_1.default, { title: t('TransactionLog.TitleDetail'), childrenWrapperStyle: { padding: 0 }, children: loading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(AWING_1.BasicDataForm, { fields: [
|
|
166
|
+
{
|
|
167
|
+
fieldName: 'transactionType',
|
|
168
|
+
type: 'text',
|
|
169
|
+
label: t('TransactionLog.TransactionType'),
|
|
170
|
+
required: true,
|
|
171
|
+
inputProps: { readOnly: true },
|
|
172
|
+
defaultValue: Object.keys(Utils_1.TRANSACTION_TYPE)[Object.values(Utils_1.TRANSACTION_TYPE).indexOf(Number(transactionLog === null || transactionLog === void 0 ? void 0 : transactionLog.transactionType))],
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
fieldName: 'objectId',
|
|
176
|
+
type: 'text',
|
|
177
|
+
label: t('TransactionLog.ObjectID'),
|
|
178
|
+
required: true,
|
|
179
|
+
inputProps: { readOnly: true },
|
|
180
|
+
defaultValue: (transactionLog === null || transactionLog === void 0 ? void 0 : transactionLog.objectId) || '',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
fieldName: 'userId',
|
|
184
|
+
type: 'text',
|
|
185
|
+
label: t('TransactionLog.Username'),
|
|
186
|
+
required: true,
|
|
187
|
+
inputProps: { readOnly: true },
|
|
188
|
+
defaultValue: (user === null || user === void 0 ? void 0 : user.username) ||
|
|
189
|
+
(user === null || user === void 0 ? void 0 : user.name) ||
|
|
190
|
+
(user === null || user === void 0 ? void 0 : user.userId),
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
fieldName: 'endDate',
|
|
194
|
+
type: 'text',
|
|
195
|
+
label: t('TransactionLog.Date'),
|
|
196
|
+
required: true,
|
|
197
|
+
inputProps: { readOnly: true },
|
|
198
|
+
defaultValue: (0, Helpers_1.timestampToStringDDMMYYYYHHmm)({
|
|
199
|
+
seconds: Number((_a = transactionLog === null || transactionLog === void 0 ? void 0 : transactionLog.endDate) === null || _a === void 0 ? void 0 : _a.seconds) || 0,
|
|
200
|
+
}),
|
|
201
|
+
},
|
|
202
|
+
] }), (0, jsx_runtime_1.jsx)(material_1.Grid, { component: "div", ml: 3, mr: 3, mb: 3, children: (0, jsx_runtime_1.jsx)(react_diff_viewer_1.default, { oldValue: JSON.stringify(newModel, undefined, 4), newValue: JSON.stringify(oldModel, undefined, 4), splitView: true, styles: newStyles, compareMethod: react_diff_viewer_1.DiffMethod.LINES, leftTitle: t('TransactionLog.New'), rightTitle: t('TransactionLog.Old') }) })] })) }));
|
|
203
|
+
}
|
|
204
|
+
exports.default = Detail;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @author dauquan1108@gmail.com on 19/02/2024.
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
var react_1 = require("react");
|
|
9
|
+
var Context_1 = require("./Context");
|
|
10
|
+
var useTransactionLogProps = function () {
|
|
11
|
+
var placeGroupProps = (0, react_1.useContext)(Context_1.TransactionLogContext);
|
|
12
|
+
var props = (0, react_1.useMemo)(function () {
|
|
13
|
+
return placeGroupProps;
|
|
14
|
+
}, [placeGroupProps]);
|
|
15
|
+
return props;
|
|
16
|
+
};
|
|
17
|
+
exports.default = useTransactionLogProps;
|