awing-library 2.1.123-beta → 2.1.125-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.
Files changed (39) hide show
  1. package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/Filter.d.ts +1 -1
  2. package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/Filter.js +17 -3
  3. package/lib/ACM-AXN/CampaignSchedule/Components/RowAdvance/component.js +13 -3
  4. package/lib/ACM-AXN/CampaignSchedule/Components/TableHeaderDragable.js +1 -1
  5. package/lib/ACM-AXN/CampaignSchedule/DataConfig.d.ts +1 -1
  6. package/lib/ACM-AXN/CampaignSchedule/DataConfig.js +8 -3
  7. package/lib/ACM-AXN/CampaignSchedule/DataConfigAXN.d.ts +1 -1
  8. package/lib/ACM-AXN/CampaignSchedule/DataConfigAXN.js +8 -3
  9. package/lib/ACM-AXN/CampaignSchedule/Recoil/Atom.d.ts +2 -1
  10. package/lib/ACM-AXN/CampaignSchedule/Recoil/Atom.js +7 -2
  11. package/lib/ACM-AXN/CampaignSchedule/container.d.ts +1 -1
  12. package/lib/ACM-AXN/CampaignSchedule/container.js +6 -1
  13. package/lib/ACM-AXN/CampaignSchedule/interface.d.ts +3 -0
  14. package/lib/ACM-AXN/Common/Constant.d.ts +17 -0
  15. package/lib/ACM-AXN/Common/Constant.js +18 -1
  16. package/lib/ACM-AXN/Common/Enum.d.ts +5 -0
  17. package/lib/ACM-AXN/Common/Enum.js +7 -1
  18. package/lib/ACM-AXN/Holiday/FormHoliday.js +67 -10
  19. package/lib/ACM-AXN/Holiday/Types.d.ts +18 -0
  20. package/lib/ACM-AXN/ScheduleCompletionRate/Container.js +29 -17
  21. package/lib/ACM-AXN/ScheduleCompletionRate/Detail/CompletionRate.js +13 -21
  22. package/lib/ACM-AXN/ScheduleCompletionRate/Detail/CompletionRate.test.js +3 -3
  23. package/lib/ACM-AXN/ScheduleCompletionRate/Detail/CompletionRateDate.js +15 -16
  24. package/lib/ACM-AXN/ScheduleCompletionRate/Detail/CompletionRateDate.test.js +3 -3
  25. package/lib/ACM-AXN/ScheduleCompletionRate/Detail/index.js +1 -1
  26. package/lib/ACM-AXN/ScheduleCompletionRate/Filter.js +19 -11
  27. package/lib/ACM-AXN/ScheduleCompletionRate/Recoils.d.ts +7 -6
  28. package/lib/ACM-AXN/ScheduleCompletionRate/Recoils.js +6 -1
  29. package/lib/ACM-AXN/ScheduleCompletionRate/SearchCampaign.d.ts +2 -2
  30. package/lib/ACM-AXN/ScheduleCompletionRate/Types.d.ts +67 -84
  31. package/lib/ACM-AXN/ScheduleCompletionRate/Types.js +21 -279
  32. package/lib/ACM-AXN/ScheduleCompletionRate/Utils.d.ts +22 -3
  33. package/lib/ACM-AXN/ScheduleCompletionRate/Utils.js +57 -8
  34. package/lib/ACM-AXN/ScheduleCompletionRate/index.js +3 -3
  35. package/lib/ACM-AXN/ScheduleCompletionRate/json.d.ts +61 -0
  36. package/lib/ACM-AXN/ScheduleCompletionRate/json.js +268 -0
  37. package/lib/translate/en/translation.json +3 -0
  38. package/lib/translate/vi/translation.json +3 -0
  39. package/package.json +1 -1
@@ -22,22 +22,23 @@ var jsx_runtime_1 = require("react/jsx-runtime");
22
22
  **/
23
23
  var react_1 = require("react");
24
24
  var moment_1 = __importDefault(require("moment"));
25
+ var Helpers_1 = require("../../../Utils/Helpers");
25
26
  var react_i18next_1 = require("react-i18next");
26
- var recoil_1 = require("recoil");
27
- var material_1 = require("@mui/material");
28
- var Utils_1 = require("../Utils");
29
27
  var Hooks_1 = __importDefault(require("../Hooks"));
30
- var Recoils_1 = require("../Recoils");
28
+ var material_1 = require("@mui/material");
31
29
  var ClassicDrawer_1 = __importDefault(require("../../../Commons/Components/ClassicDrawer"));
32
30
  var Router_1 = require("../../../AWING/Router");
31
+ var Utils_1 = require("../Utils");
32
+ var recoil_1 = require("recoil");
33
33
  var AWING_1 = require("../../../AWING");
34
- var Helpers_1 = require("../../../Utils/Helpers");
34
+ var Recoils_1 = require("../Recoils");
35
35
  function CompletionRate() {
36
36
  var t = (0, react_i18next_1.useTranslation)().t;
37
37
  var navigate = (0, Router_1.useNavigate)();
38
38
  var _a = (0, Router_1.useParams)(), campaignId = _a.campaignId, groupId = _a.groupId;
39
39
  var service = (0, Hooks_1.default)().service;
40
40
  var setScheduleCompletionRate = (0, recoil_1.useSetRecoilState)(Recoils_1.scheduleCompletionRateAtom);
41
+ var type = (0, recoil_1.useRecoilValue)(Recoils_1.ScheduleCompletionRateTypeViewState).type;
41
42
  var completionRateInfo = (0, recoil_1.useRecoilValue)((0, Recoils_1.detailCompletionRateItem)({
42
43
  campaignId: campaignId,
43
44
  groupId: groupId,
@@ -51,8 +52,9 @@ function CompletionRate() {
51
52
  service
52
53
  .scheduleCompletionRatesPaging((_b = (_a = scheduleCompletionRate === null || scheduleCompletionRate === void 0 ? void 0 : scheduleCompletionRate.filter) === null || _a === void 0 ? void 0 : _a.startDate) === null || _b === void 0 ? void 0 : _b.format('YYYY-MM-DD'), (_d = (_c = scheduleCompletionRate === null || scheduleCompletionRate === void 0 ? void 0 : scheduleCompletionRate.filter) === null || _c === void 0 ? void 0 : _c.endDate) === null || _d === void 0 ? void 0 : _d.format('YYYY-MM-DD'), campaignId, Number(groupId), 'date', queryInput.pageIndex, queryInput.pageSize)
53
54
  .then(function (res) {
54
- setScheduleGroupBy(res);
55
- setScheduleCompletionRate(function (oldState) { return (__assign(__assign({}, oldState), { detailCompletionRateDate: res.items || [] })); });
55
+ var valueNew = (0, Utils_1.converData)((res === null || res === void 0 ? void 0 : res.items) || [], type, completionRateInfo === null || completionRateInfo === void 0 ? void 0 : completionRateInfo.billingUnit);
56
+ setScheduleGroupBy(__assign(__assign({}, res), { items: valueNew.length ? valueNew : [] }));
57
+ setScheduleCompletionRate(function (oldState) { return (__assign(__assign({}, oldState), { detailCompletionRateDate: valueNew.length ? valueNew : [] })); });
56
58
  })
57
59
  .finally(function () {
58
60
  setLoading(false);
@@ -64,7 +66,7 @@ function CompletionRate() {
64
66
  };
65
67
  return ((0, jsx_runtime_1.jsx)(ClassicDrawer_1.default, { title: "".concat(t('ScheduleCompletionRate.Group'), ": ").concat(loading && !(completionRateInfo === null || completionRateInfo === void 0 ? void 0 : completionRateInfo.groupName)
66
68
  ? 'loading...'
67
- : (completionRateInfo === null || completionRateInfo === void 0 ? void 0 : completionRateInfo.groupName) || '', " "), childrenWrapperStyle: { padding: '24px' }, children: loading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(AWING_1.DataGrid, { spanningRows: (0, jsx_runtime_1.jsxs)(material_1.TableRow, { sx: {
69
+ : (completionRateInfo === null || completionRateInfo === void 0 ? void 0 : completionRateInfo.groupName) || '', " "), childrenWrapperStyle: { p: 3 }, children: loading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(AWING_1.DataGrid, { spanningRows: (0, jsx_runtime_1.jsxs)(material_1.TableRow, { sx: {
68
70
  flex: 1,
69
71
  background: 'lightgrey',
70
72
  }, children: [(0, jsx_runtime_1.jsx)(material_1.TableCell, { colSpan: 2, sx: {
@@ -92,14 +94,12 @@ function CompletionRate() {
92
94
  TableCellProps: {
93
95
  align: 'right',
94
96
  },
97
+ type: 'number',
95
98
  dynamicTableCellProps: function () {
96
99
  return {
97
100
  align: 'right',
98
101
  };
99
102
  },
100
- valueGetter: function (row) {
101
- return (0, Helpers_1.formatNumber)((row === null || row === void 0 ? void 0 : row.totalQuantity) || 0);
102
- }
103
103
  },
104
104
  {
105
105
  field: 'totalRun',
@@ -112,20 +112,12 @@ function CompletionRate() {
112
112
  align: 'right',
113
113
  };
114
114
  },
115
- valueGetter: function (row) {
116
- return (0, Helpers_1.formatNumber)((row === null || row === void 0 ? void 0 : row.totalRun) || 0);
117
- }
115
+ type: 'number',
118
116
  },
119
117
  {
120
118
  field: 'rate',
121
119
  headerName: "".concat(t('ScheduleCompletionRate.CompletionRate'), "(%)"),
122
- valueGetter: function (row) {
123
- return (0, Helpers_1.formatNumber)((row === null || row === void 0 ? void 0 : row.totalQuantity) !== 0
124
- ? (((row === null || row === void 0 ? void 0 : row.totalRun) || 0) /
125
- ((row === null || row === void 0 ? void 0 : row.totalQuantity) || 0)) *
126
- 100
127
- : 0);
128
- },
120
+ type: 'number',
129
121
  TableCellProps: {
130
122
  align: 'right',
131
123
  },
@@ -266,14 +266,14 @@ jest.mock('../Hooks', function () { return ({
266
266
  }); },
267
267
  }); });
268
268
  // mock react-router-dom
269
- jest.mock('../../../AWING/Router', function () { return (__assign(__assign({}, jest.requireActual('../../../AWING/Router')), { useParams: jest.fn(), useNavigate: jest.fn() })); });
270
- jest.mock('../../../AWING', function () { return (__assign(__assign({}, jest.requireActual('../../../AWING')), { DataGrid: function (props) {
269
+ jest.mock('AWING/Router', function () { return (__assign(__assign({}, jest.requireActual('AWING/Router')), { useParams: jest.fn(), useNavigate: jest.fn() })); });
270
+ jest.mock('AWING', function () { return (__assign(__assign({}, jest.requireActual('AWING')), { DataGrid: function (props) {
271
271
  return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { "data-testId": "title", children: "DataGrid" }), props.columns
272
272
  .filter(function (item) { return item.valueGetter; })
273
273
  .map(function (getter, idx) { return ((0, jsx_runtime_1.jsx)("span", { children: getter.valueGetter(mockScheduleGroupBy.items[0], idx) }, idx)); }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "onPageIndexChange", onClick: function () { return props.onPageIndexChange(0); } }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "onPageSizeChange", onClick: function () { return props.onPageSizeChange(1); } }), (0, jsx_runtime_1.jsx)("p", { "data-testid": "rowsPaginate", children: JSON.stringify(props.rows) }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "onRowClick", onClick: function () { return props.onRowClick(1); }, children: "onRowClick" })] }));
274
274
  }, CircularProgress: function () { return ((0, jsx_runtime_1.jsx)("div", { "data-testid": "CircularProgress", children: "CircularProgress" })); } })); });
275
275
  // Mock Filter
276
- jest.mock('../../../Commons/Components/ClassicDrawer', function () { return function (props) {
276
+ jest.mock('Commons/Components/ClassicDrawer', function () { return function (props) {
277
277
  return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { children: "Drawer Component" }), props.title, props.children] }));
278
278
  }; });
279
279
  var renderUi = function () {
@@ -23,20 +23,22 @@ var jsx_runtime_1 = require("react/jsx-runtime");
23
23
  var react_1 = require("react");
24
24
  var moment_1 = __importDefault(require("moment"));
25
25
  var recoil_1 = require("recoil");
26
+ var Router_1 = require("../../../AWING/Router");
27
+ var Helpers_1 = require("../../../Utils/Helpers");
26
28
  var react_i18next_1 = require("react-i18next");
27
- var material_1 = require("@mui/material");
28
- var Utils_1 = require("../Utils");
29
29
  var Hooks_1 = __importDefault(require("../Hooks"));
30
- var Router_1 = require("../../../AWING/Router");
31
- var Recoils_1 = require("../Recoils");
30
+ var material_1 = require("@mui/material");
32
31
  var ClassicDrawer_1 = __importDefault(require("../../../Commons/Components/ClassicDrawer"));
32
+ var Utils_1 = require("../Utils");
33
33
  var AWING_1 = require("../../../AWING");
34
- var Helpers_1 = require("../../../Utils/Helpers");
34
+ var Recoils_1 = require("../Recoils");
35
35
  function CompletionRateDate() {
36
36
  var t = (0, react_i18next_1.useTranslation)().t;
37
37
  var _a = (0, Router_1.useParams)(), campaignId = _a.campaignId, groupId = _a.groupId, date = _a.date;
38
38
  var service = (0, Hooks_1.default)().service;
39
39
  var completionRateDateInfo = (0, recoil_1.useRecoilValue)((0, Recoils_1.detailCompletionRateDateItem)(date));
40
+ console.log('completionRateDateInfo =================>', completionRateDateInfo);
41
+ var type = (0, recoil_1.useRecoilValue)(Recoils_1.ScheduleCompletionRateTypeViewState).type;
40
42
  var schedule = (0, recoil_1.useRecoilValue)(Recoils_1.scheduleCompletionRateAtom);
41
43
  var _b = (0, react_1.useState)(true), loading = _b[0], setLoading = _b[1];
42
44
  var _c = (0, react_1.useState)(Utils_1.QueryInputDetail), queryInput = _c[0], setQueryInput = _c[1];
@@ -44,21 +46,23 @@ function CompletionRateDate() {
44
46
  (0, react_1.useEffect)(function () {
45
47
  service
46
48
  .scheduleCompletionRatesPaging((0, moment_1.default)(date, 'DD-MM-YYYY').format('YYYY-MM-DD'), (0, moment_1.default)(date, 'DD-MM-YYYY').format('YYYY-MM-DD'), campaignId, Number(groupId), 'placeId', queryInput.pageIndex, queryInput.pageSize)
47
- .then(setScheduleGroupByDate)
49
+ .then(function (res) {
50
+ console.log('res =================>', res);
51
+ var valueNew = (0, Utils_1.converData)((res === null || res === void 0 ? void 0 : res.items) || [], type, completionRateDateInfo === null || completionRateDateInfo === void 0 ? void 0 : completionRateDateInfo.billingUnit);
52
+ setScheduleGroupByDate(__assign(__assign({}, res), { items: valueNew.length ? valueNew : [] }));
53
+ })
48
54
  .finally(function () {
49
55
  setLoading(false);
50
56
  });
51
57
  // eslint-disable-next-line react-hooks/exhaustive-deps
52
58
  }, [queryInput]);
53
- return ((0, jsx_runtime_1.jsx)(ClassicDrawer_1.default, { title: "".concat(t('ScheduleCompletionRate.Date'), ": ").concat(loading && !date ? 'loading...' : date || '', " "), childrenWrapperStyle: { padding: '24px' }, children: loading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(AWING_1.DataGrid, { spanningRows: (0, jsx_runtime_1.jsxs)(material_1.TableRow, { sx: {
59
+ return ((0, jsx_runtime_1.jsx)(ClassicDrawer_1.default, { title: "".concat(t('ScheduleCompletionRate.Date'), ": ").concat(loading && !date ? 'loading...' : date || '', " "), childrenWrapperStyle: { p: 3 }, children: loading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(AWING_1.DataGrid, { spanningRows: (0, jsx_runtime_1.jsxs)(material_1.TableRow, { sx: {
54
60
  flex: 1,
55
61
  background: 'lightgrey',
56
62
  }, children: [(0, jsx_runtime_1.jsx)(material_1.TableCell, { colSpan: 2, sx: {
57
63
  textAlign: 'center',
58
64
  fontWeight: 'bold',
59
- }, children: t('ScheduleCompletionRate.Total') }), (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", sx: { fontWeight: 'bold' }, children: (0, Helpers_1.formatNumber)((completionRateDateInfo === null || completionRateDateInfo === void 0 ? void 0 : completionRateDateInfo.totalQuantity) || 0) }), (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", sx: { fontWeight: 'bold' }, children: (0, Helpers_1.formatNumber)((completionRateDateInfo === null || completionRateDateInfo === void 0 ? void 0 : completionRateDateInfo.totalRun) || 0) }), (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", sx: { fontWeight: 'bold' }, children: (0, Helpers_1.formatNumber)(((completionRateDateInfo === null || completionRateDateInfo === void 0 ? void 0 : completionRateDateInfo.totalRun) /
60
- (completionRateDateInfo === null || completionRateDateInfo === void 0 ? void 0 : completionRateDateInfo.totalQuantity)) *
61
- 100 || 0) })] }), spanningRowsPosition: "top", columns: [
65
+ }, children: t('ScheduleCompletionRate.Total') }), (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", sx: { fontWeight: 'bold' }, children: (0, Helpers_1.formatNumber)((completionRateDateInfo === null || completionRateDateInfo === void 0 ? void 0 : completionRateDateInfo.totalQuantity) || 0) }), (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", sx: { fontWeight: 'bold' }, children: (0, Helpers_1.formatNumber)((completionRateDateInfo === null || completionRateDateInfo === void 0 ? void 0 : completionRateDateInfo.totalRun) || 0) }), (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", sx: { fontWeight: 'bold' }, children: (0, Helpers_1.formatNumber)((completionRateDateInfo === null || completionRateDateInfo === void 0 ? void 0 : completionRateDateInfo.rate) || 0) })] }), spanningRowsPosition: "top", columns: [
62
66
  {
63
67
  field: '#',
64
68
  headerName: '#',
@@ -108,12 +112,7 @@ function CompletionRateDate() {
108
112
  {
109
113
  field: 'rate',
110
114
  headerName: "".concat(t('ScheduleCompletionRate.CompletionRate'), "(%)"),
111
- valueGetter: function (row) {
112
- return (0, Helpers_1.formatNumber)(row.totalQuantity !== 0
113
- ? (row.totalRun / row.totalQuantity) *
114
- 100
115
- : 0);
116
- },
115
+ type: 'number',
117
116
  TableCellProps: {
118
117
  align: 'right',
119
118
  },
@@ -316,14 +316,14 @@ jest.mock('../Hooks', function () { return ({
316
316
  }); },
317
317
  }); });
318
318
  // mock react-router-dom
319
- jest.mock('../../../AWING/Router', function () { return (__assign(__assign({}, jest.requireActual('../../../AWING/Router')), { useParams: jest.fn() })); });
320
- jest.mock('../../../AWING', function () { return (__assign(__assign({}, jest.requireActual('../../../AWING')), { DataGrid: function (props) {
319
+ jest.mock('AWING/Router', function () { return (__assign(__assign({}, jest.requireActual('AWING/Router')), { useParams: jest.fn() })); });
320
+ jest.mock('AWING', function () { return (__assign(__assign({}, jest.requireActual('AWING')), { DataGrid: function (props) {
321
321
  return ((0, jsx_runtime_1.jsxs)("div", { children: [props.columns
322
322
  .filter(function (item) { return item.valueGetter; })
323
323
  .map(function (getter, idx) { return ((0, jsx_runtime_1.jsx)("span", { children: getter.valueGetter(mockScheduleGroupByDate.items[0], idx) }, idx)); }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "onPageIndexChange", onClick: function () { return props.onPageIndexChange(0); } }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "onPageSizeChange", onClick: function () { return props.onPageSizeChange(1); } }), (0, jsx_runtime_1.jsx)("p", { "data-testid": "rowsPaginate", children: JSON.stringify(props.rows) }), (0, jsx_runtime_1.jsx)("button", { "data-testid": "onRowClick", onClick: function () { return props.onRowClick(1); }, children: "onRowClick" })] }));
324
324
  }, CircularProgress: function () { return (0, jsx_runtime_1.jsx)("div", { children: "CircularProgress" }); } })); });
325
325
  // Mock Filter
326
- jest.mock('../../../Commons/Components/ClassicDrawer', function () { return function (props) {
326
+ jest.mock('Commons/Components/ClassicDrawer', function () { return function (props) {
327
327
  return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { children: "Drawer" }), props.title, props.children] }));
328
328
  }; });
329
329
  var renderUi = function () {
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var jsx_runtime_1 = require("react/jsx-runtime");
7
+ var Router_1 = require("../../../AWING/Router");
7
8
  var CompletionRate_1 = __importDefault(require("./CompletionRate"));
8
9
  var CompletionRateDate_1 = __importDefault(require("./CompletionRateDate"));
9
- var Router_1 = require("../../../AWING/Router");
10
10
  function Detail() {
11
11
  var paths = [
12
12
  {
@@ -31,17 +31,19 @@ var jsx_runtime_1 = require("react/jsx-runtime");
31
31
  **/
32
32
  var react_1 = require("react");
33
33
  var styles_1 = require("@mui/styles");
34
- var material_1 = require("@mui/material");
34
+ var moment_1 = __importDefault(require("moment"));
35
35
  var react_i18next_1 = require("react-i18next");
36
- var recoil_1 = require("recoil");
37
36
  var GetApp_1 = __importDefault(require("@mui/icons-material/GetApp"));
38
- var moment_1 = __importDefault(require("moment"));
37
+ var material_1 = require("@mui/material");
38
+ var Context_1 = require("../../Context");
39
39
  var Hooks_1 = __importDefault(require("./Hooks"));
40
40
  var SearchCampaign_1 = __importDefault(require("./SearchCampaign"));
41
41
  var DataSetConfig_1 = require("./DataSetConfig");
42
- var Recoils_1 = require("./Recoils");
43
- var Utils_1 = require("./Utils");
42
+ var Constant_1 = require("../../ACM-AXN/Common/Constant");
44
43
  var AWING_1 = require("../../AWING");
44
+ var Utils_1 = require("./Utils");
45
+ var recoil_1 = require("recoil");
46
+ var Recoils_1 = require("./Recoils");
45
47
  var exportFile_1 = require("../../ACM-AXN/CampaignSchedule/exportFile");
46
48
  var useStyles = (0, styles_1.makeStyles)(function () { return ({
47
49
  outlinedInput: {
@@ -69,9 +71,11 @@ function Filter(props) {
69
71
  var filter = props.filter, onUpdateFilter = props.onUpdateFilter;
70
72
  var t = (0, react_i18next_1.useTranslation)().t;
71
73
  var classes = useStyles();
72
- var _a = (0, Hooks_1.default)(), service = _a.service, appHelper = _a.appHelper;
74
+ var snackbar = (0, Context_1.useAwing)().appHelper.snackbar;
75
+ var service = (0, Hooks_1.default)().service;
73
76
  var schedule = (0, recoil_1.useRecoilValue)(Recoils_1.scheduleCompletionRateAtom);
74
77
  var setPlaces = (0, recoil_1.useSetRecoilState)(Recoils_1.scheduleCompletionRateAtom);
78
+ var _a = (0, recoil_1.useRecoilState)(Recoils_1.ScheduleCompletionRateTypeViewState), filterType = _a[0], setFilterType = _a[1];
75
79
  var _b = (0, react_1.useState)(false), isLoadings = _b[0], setIsLoadings = _b[1];
76
80
  var _c = (0, react_1.useState)(), dateRangeInput = _c[0], setDateRangeInput = _c[1];
77
81
  var _d = (0, react_1.useState)([
@@ -125,8 +129,8 @@ function Filter(props) {
125
129
  .scheduleCompletionRatesExport((_a = filter === null || filter === void 0 ? void 0 : filter.startDate) === null || _a === void 0 ? void 0 : _a.format('YYYY-MM-DD'), (_b = filter === null || filter === void 0 ? void 0 : filter.endDate) === null || _b === void 0 ? void 0 : _b.format('YYYY-MM-DD'), filter.campaignId, undefined)
126
130
  .then(function (res) {
127
131
  var _a, _b, _c, _d;
128
- var dataByCampaign = (_a = (0, DataSetConfig_1.DataSetConfigs)((0, Utils_1.convertExcelData)(res, campaigns, schedule.places, t), t, filter === null || filter === void 0 ? void 0 : filter.startDate, filter === null || filter === void 0 ? void 0 : filter.endDate)) === null || _a === void 0 ? void 0 : _a.sheetByCampaign;
129
- var dataByCampaignDetail = (_b = (0, DataSetConfig_1.DataSetConfigs)((0, Utils_1.convertExcelData)(res, campaigns, schedule.places, t), t, filter === null || filter === void 0 ? void 0 : filter.startDate, filter === null || filter === void 0 ? void 0 : filter.endDate)) === null || _b === void 0 ? void 0 : _b.sheetCampaignDetail;
132
+ var dataByCampaign = (_a = (0, DataSetConfig_1.DataSetConfigs)((0, Utils_1.convertExcelData)(res, campaigns, schedule.places, t, filterType.type), t, filter === null || filter === void 0 ? void 0 : filter.startDate, filter === null || filter === void 0 ? void 0 : filter.endDate)) === null || _a === void 0 ? void 0 : _a.sheetByCampaign;
133
+ var dataByCampaignDetail = (_b = (0, DataSetConfig_1.DataSetConfigs)((0, Utils_1.convertExcelData)(res, campaigns, schedule.places, t, filterType.type), t, filter === null || filter === void 0 ? void 0 : filter.startDate, filter === null || filter === void 0 ? void 0 : filter.endDate)) === null || _b === void 0 ? void 0 : _b.sheetCampaignDetail;
130
134
  var fileName = "AWING_DELIVERY_STATUS_BY_DAY_".concat((_c = filter === null || filter === void 0 ? void 0 : filter.startDate) === null || _c === void 0 ? void 0 : _c.format('DD-MM-YYYY'), " to ").concat((_d = filter === null || filter === void 0 ? void 0 : filter.endDate) === null || _d === void 0 ? void 0 : _d.format('YYYYMMDD'));
131
135
  var dataExport = [
132
136
  {
@@ -143,7 +147,7 @@ function Filter(props) {
143
147
  (0, exportFile_1.downloadWithDataSetMultiSheet)(fileName, dataExport);
144
148
  })
145
149
  .catch(function () {
146
- appHelper.snackbar('error');
150
+ snackbar('error');
147
151
  })
148
152
  .finally(function () {
149
153
  setIsLoadings(false);
@@ -163,8 +167,12 @@ function Filter(props) {
163
167
  display: 'flex',
164
168
  flexDirection: 'row',
165
169
  alignItems: 'center',
166
- width: '66%',
167
- }, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
170
+ width: '80%',
171
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { mr: 2, minWidth: 160 }, children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, size: "small", children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { id: "demo-simple-select-label", children: t('Common.TitleTypeView') }), (0, jsx_runtime_1.jsxs)(material_1.Select, { labelId: "demo-simple-select-label", id: "demo-simple-select", value: filterType.type, label: t('Common.TitleTypeView'), onChange: function (e) {
172
+ setFilterType({
173
+ type: e.target.value,
174
+ });
175
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: Constant_1.TypeView.billingUnit, children: t('Common.BillingUnit') }), (0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: Constant_1.TypeView.impression, children: t('Common.Impression') })] })] }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
168
176
  width: '260px',
169
177
  minWidth: '260px',
170
178
  marginRight: '16px',
@@ -3,14 +3,15 @@
3
3
  * @author dauquan1108@gmail.com on 03/13/2024.
4
4
  *
5
5
  **/
6
- import { FilterType, ScheduleCompletionRate, ScheduleCompletionRatePaging } from './Types';
7
- import { Place } from '../PlaceGroup/Types';
6
+ import { Place, FilterType, IScheduleCompletionRate, IScheduleCompletionRatePaging } from './Types';
7
+ import { IScheduleCompletionRateTypeView } from './Utils';
8
8
  export interface IScheduleCompletionRateState {
9
9
  places: Place[];
10
10
  filter: FilterType;
11
- detailCompletionRate: ScheduleCompletionRate[];
12
- detailCompletionRateDate: ScheduleCompletionRatePaging[];
11
+ detailCompletionRate: IScheduleCompletionRate[];
12
+ detailCompletionRateDate: IScheduleCompletionRatePaging[];
13
13
  }
14
14
  export declare const scheduleCompletionRateAtom: import("recoil").RecoilState<IScheduleCompletionRateState>;
15
- export declare const detailCompletionRateItem: (param: any) => import("recoil").RecoilValueReadOnly<ScheduleCompletionRate | undefined>;
16
- export declare const detailCompletionRateDateItem: (param: string) => import("recoil").RecoilValueReadOnly<ScheduleCompletionRatePaging | undefined>;
15
+ export declare const detailCompletionRateItem: (param: any) => import("recoil").RecoilValueReadOnly<IScheduleCompletionRate | undefined>;
16
+ export declare const detailCompletionRateDateItem: (param: string) => import("recoil").RecoilValueReadOnly<IScheduleCompletionRatePaging | undefined>;
17
+ export declare const ScheduleCompletionRateTypeViewState: import("recoil").RecoilState<IScheduleCompletionRateTypeView>;
@@ -8,9 +8,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8
8
  return (mod && mod.__esModule) ? mod : { "default": mod };
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.detailCompletionRateDateItem = exports.detailCompletionRateItem = exports.scheduleCompletionRateAtom = void 0;
11
+ exports.ScheduleCompletionRateTypeViewState = exports.detailCompletionRateDateItem = exports.detailCompletionRateItem = exports.scheduleCompletionRateAtom = void 0;
12
12
  var recoil_1 = require("recoil");
13
13
  var moment_1 = __importDefault(require("moment"));
14
+ var Constant_1 = require("../../ACM-AXN/Common/Constant");
14
15
  var Utils_1 = require("./Utils");
15
16
  exports.scheduleCompletionRateAtom = (0, recoil_1.atom)({
16
17
  key: 'scheduleCompletionRate',
@@ -44,3 +45,7 @@ exports.detailCompletionRateDateItem = (0, recoil_1.selectorFamily)({
44
45
  };
45
46
  },
46
47
  });
48
+ exports.ScheduleCompletionRateTypeViewState = (0, recoil_1.atom)({
49
+ key: 'ScheduleCompletionRateTypeViewState',
50
+ default: { type: Constant_1.TypeView.billingUnit },
51
+ });
@@ -3,10 +3,10 @@
3
3
  * @author dauquan1108@gmail.com on 03/27/2024.
4
4
  *
5
5
  **/
6
- import { FilterType, ICampaign } from './Types';
6
+ import { FilterType, Campaign } from './Types';
7
7
  interface PropsSearchCampaign {
8
8
  filter: FilterType;
9
- campaigns: ICampaign[];
9
+ campaigns: Campaign[];
10
10
  onUpdateFilter: (valueNew: FilterType) => void;
11
11
  }
12
12
  declare function SearchCampaign(props: PropsSearchCampaign): import("react/jsx-runtime").JSX.Element;
@@ -3,8 +3,6 @@
3
3
  * @author dauquan1108@gmail.com on 03/13/2024.
4
4
  *
5
5
  **/
6
- import { AlertColor } from '@mui/material';
7
- import { Place } from '../PlaceGroup/Types';
8
6
  import { Moment } from 'moment';
9
7
  export interface SortedByType {
10
8
  id: string;
@@ -20,11 +18,6 @@ export interface FilterType {
20
18
  endDate?: Moment;
21
19
  campaignId?: string;
22
20
  }
23
- export interface AppHelper {
24
- alert: (message: string, title?: string) => void;
25
- snackbar: (severity?: AlertColor, message?: string, autoHideDuration?: number) => void;
26
- confirm: (okFunction?: () => void, cancelFunction?: () => void, message?: string, title?: string) => void;
27
- }
28
21
  export interface Cancel {
29
22
  message: string | undefined;
30
23
  }
@@ -38,7 +31,6 @@ export interface ScheduleCompletionRatePropsContext {
38
31
  * props service: API cần thiết để vẽ giao diện.
39
32
  **/
40
33
  service: ScheduleCompletionRateService;
41
- appHelper: AppHelper;
42
34
  }
43
35
  export interface ScheduleCompletionRateService {
44
36
  scheduleCompletionRatesGet: (fromDate: string | undefined, toDate: string | undefined, cancelToken?: CancelToken) => Promise<ScheduleCompletionRate[]>;
@@ -47,6 +39,41 @@ export interface ScheduleCompletionRateService {
47
39
  placesGetAllByPlaceGroupHasPermission: (cancelToken?: CancelToken) => Promise<Place[]>;
48
40
  scheduleCompletionRatesPaging: (fromDate: string | undefined, toDate: string | undefined, campaignId: string | undefined, groupId: number | undefined, groupBy: string | undefined, pageIndex: number | undefined, pageSize: number | undefined, cancelToken?: CancelToken) => Promise<PagedList_1OfScheduleCompletionRatePaging>;
49
41
  }
42
+ export interface Place {
43
+ placeId?: string;
44
+ directoryId?: string;
45
+ directoryPath?: string | undefined;
46
+ name?: string | undefined;
47
+ ip?: string | undefined;
48
+ apControllerCode?: string | undefined;
49
+ authenticationMethodCode?: string | undefined;
50
+ authenticationProfilePrimaryId?: string;
51
+ authenticationProfileOptionalIds?: string | undefined;
52
+ address?: string | undefined;
53
+ longitude?: number | undefined;
54
+ latitude?: number | undefined;
55
+ description?: string | undefined;
56
+ isPlaceSupportHttpsAuthentication?: boolean;
57
+ domainId?: string;
58
+ communeCode?: string | undefined;
59
+ districtCode?: string | undefined;
60
+ provinceCode?: string | undefined;
61
+ placeSelectionParameter?: string | undefined;
62
+ status?: PlaceStatus;
63
+ isJoinNetwork?: boolean;
64
+ networkStatus?: PlaceNetworkStatus;
65
+ }
66
+ export declare enum PlaceNetworkStatus {
67
+ Not = 0,
68
+ Waiting = 1,
69
+ Joined = 2
70
+ }
71
+ export declare enum PlaceStatus {
72
+ Active = 0,
73
+ OnPause = 1,
74
+ Maintenance = 2,
75
+ InActive = 3
76
+ }
50
77
  export interface ConvertExcelData {
51
78
  campaignName?: string;
52
79
  groupName?: string;
@@ -56,38 +83,25 @@ export interface ConvertExcelData {
56
83
  totalRun?: number;
57
84
  rate?: number;
58
85
  }
59
- export declare class ScheduleCompletionRatePaging implements IScheduleCompletionRatePaging {
86
+ export interface ScheduleCompletionRatePaging {
60
87
  placeId?: string;
61
88
  groupId?: number;
62
- totalQuantity?: number;
63
- totalRun?: number;
89
+ runs?: AnalyticEventSummary[] | undefined;
90
+ expecteds?: AnalyticEventSummary[] | undefined;
64
91
  date?: string;
65
- constructor(data?: IScheduleCompletionRatePaging);
66
- init(_data?: any): void;
67
- static fromJS(data: any): ScheduleCompletionRatePaging;
68
- toJSON(data?: any): any;
69
92
  }
70
93
  export interface IScheduleCompletionRatePaging {
94
+ billingUnit?: AnalyticType;
71
95
  placeId?: string;
96
+ date?: string;
72
97
  groupId?: number;
98
+ runs?: AnalyticEventSummary[] | undefined;
99
+ expecteds?: AnalyticEventSummary[] | undefined;
100
+ rate?: number;
73
101
  totalQuantity?: number;
74
102
  totalRun?: number;
75
- date?: string;
76
103
  }
77
- export declare class PagedList_1OfScheduleCompletionRatePaging implements IPagedList_1OfScheduleCompletionRatePaging {
78
- items?: ScheduleCompletionRatePaging[] | undefined;
79
- pageCount?: number;
80
- totalItemCount?: number;
81
- pageNumber?: number;
82
- pageSize?: number;
83
- readonly hasPreviousPage?: boolean;
84
- readonly hasNextPage?: boolean;
85
- constructor(data?: IPagedList_1OfScheduleCompletionRatePaging);
86
- init(_data?: any): void;
87
- static fromJS(data: any): PagedList_1OfScheduleCompletionRatePaging;
88
- toJSON(data?: any): any;
89
- }
90
- export interface IPagedList_1OfScheduleCompletionRatePaging {
104
+ export interface PagedList_1OfScheduleCompletionRatePaging {
91
105
  items?: ScheduleCompletionRatePaging[] | undefined;
92
106
  pageCount?: number;
93
107
  totalItemCount?: number;
@@ -96,41 +110,20 @@ export interface IPagedList_1OfScheduleCompletionRatePaging {
96
110
  hasPreviousPage?: boolean;
97
111
  hasNextPage?: boolean;
98
112
  }
99
- export declare class ScheduleCompletionRateExport implements IScheduleCompletionRateExport {
100
- campaignId?: string;
101
- placeId?: string;
102
- groupId?: number;
103
- groupName?: string | undefined;
104
- totalQuantity?: number;
105
- totalRun?: number;
106
- date?: string;
107
- constructor(data?: IScheduleCompletionRateExport);
108
- init(_data?: any): void;
109
- static fromJS(data: any): ScheduleCompletionRateExport;
110
- toJSON(data?: any): any;
111
- }
112
- export interface IScheduleCompletionRateExport {
113
+ export interface ScheduleCompletionRateExport {
113
114
  campaignId?: string;
114
115
  placeId?: string;
115
116
  groupId?: number;
116
117
  groupName?: string | undefined;
117
- totalQuantity?: number;
118
- totalRun?: number;
118
+ runs?: AnalyticEventSummary[] | undefined;
119
+ expecteds?: AnalyticEventSummary[] | undefined;
119
120
  date?: string;
120
121
  }
121
- export interface ITimestamp {
122
+ export interface Timestamp {
122
123
  seconds?: string;
123
124
  nanos?: number;
124
125
  }
125
- export declare class Timestamp implements ITimestamp {
126
- seconds?: string;
127
- nanos?: number;
128
- constructor(data?: ITimestamp);
129
- init(_data?: any): void;
130
- static fromJS(data: any): Timestamp;
131
- toJSON(data?: any): any;
132
- }
133
- export interface ICampaign {
126
+ export interface Campaign {
134
127
  id?: string;
135
128
  directoryId?: string;
136
129
  directoryPath?: string | undefined;
@@ -138,48 +131,36 @@ export interface ICampaign {
138
131
  createdDate?: Timestamp;
139
132
  isNetwork?: boolean;
140
133
  }
141
- export declare class Campaign implements ICampaign {
142
- id?: string;
143
- directoryId?: string;
144
- directoryPath?: string | undefined;
145
- name?: string | undefined;
146
- createdDate?: Timestamp;
147
- constructor(data?: ICampaign);
148
- init(_data?: any): void;
149
- static fromJS(data: any): Campaign;
150
- toJSON(data?: any): any;
151
- }
152
- export interface ICampaignPlanModel {
134
+ export interface CampaignPlanModel {
153
135
  campaign?: Campaign;
154
136
  isNetworkCampaign?: boolean;
155
137
  }
156
- export declare class CampaignPlanModel implements ICampaignPlanModel {
157
- campaign?: Campaign;
158
- isNetworkCampaign?: boolean;
159
- constructor(data?: ICampaignPlanModel);
160
- init(_data?: any): void;
161
- static fromJS(data: any): CampaignPlanModel;
162
- toJSON(data?: any): any;
138
+ export declare enum AnalyticType {
139
+ View = 0,
140
+ Authentication = 1,
141
+ Click = 2,
142
+ Event = 3
163
143
  }
164
- export declare class ScheduleCompletionRate implements IScheduleCompletionRate {
144
+ export interface AnalyticEventSummary {
145
+ eventLabel?: string | undefined;
146
+ total?: number;
147
+ }
148
+ export interface ScheduleCompletionRate {
165
149
  campaignId?: string;
166
150
  campaignName?: string | undefined;
167
- isNetWorkCampaign?: boolean;
151
+ billingUnit?: AnalyticType;
152
+ isNetWork?: boolean;
168
153
  placeId?: string;
169
154
  groupId?: number;
170
155
  groupName?: string | undefined;
171
- totalQuantity?: number;
172
- totalRun?: number;
156
+ runs?: AnalyticEventSummary[] | undefined;
157
+ expecteds?: AnalyticEventSummary[] | undefined;
173
158
  fromDate?: string;
174
159
  toDate?: string;
175
- rate?: number;
176
- constructor(data?: IScheduleCompletionRate);
177
- init(_data?: any): void;
178
- static fromJS(data: any): ScheduleCompletionRate;
179
- toJSON(data?: any): any;
180
160
  }
181
161
  export interface IScheduleCompletionRate {
182
162
  campaignId?: string;
163
+ billingUnit?: AnalyticType;
183
164
  campaignName?: string | undefined;
184
165
  isNetWorkCampaign?: boolean;
185
166
  placeId?: string;
@@ -187,6 +168,8 @@ export interface IScheduleCompletionRate {
187
168
  groupName?: string | undefined;
188
169
  totalQuantity?: number;
189
170
  totalRun?: number;
171
+ runs?: AnalyticEventSummary[] | undefined;
172
+ expecteds?: AnalyticEventSummary[] | undefined;
190
173
  fromDate?: string;
191
174
  toDate?: string;
192
175
  rate?: number;