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
@@ -1,3 +1,3 @@
1
1
  import { IFiltersProps } from '../../interface';
2
- declare const Filters: ({ campaigns, handleFilters, loadingFlags, placeMultiSelectComponent: PlaceMultiSelect, handleExportExcel, disabledCampaignFilter, isFutureDate }: IFiltersProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Filters: ({ campaigns, handleFilters, loadingFlags, placeMultiSelectComponent: PlaceMultiSelect, handleExportExcel, disabledCampaignFilter, isFutureDate, }: IFiltersProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Filters;
@@ -22,6 +22,9 @@ var AWING_1 = require("../../../../AWING");
22
22
  var lodash_1 = __importDefault(require("lodash"));
23
23
  var moment_1 = __importDefault(require("moment"));
24
24
  var react_i18next_1 = require("react-i18next");
25
+ var Constant_1 = require("../../../../ACM-AXN/Common/Constant");
26
+ var recoil_1 = require("recoil");
27
+ var Atom_1 = require("../../Recoil/Atom");
25
28
  var useStyles = (0, styles_1.makeStyles)(function () { return ({
26
29
  outlinedInput: {
27
30
  '& .MuiOutlinedInput-input': {
@@ -80,13 +83,18 @@ var Filters = function (_a) {
80
83
  var _b, _c;
81
84
  var campaigns = _a.campaigns, handleFilters = _a.handleFilters, loadingFlags = _a.loadingFlags, PlaceMultiSelect = _a.placeMultiSelectComponent, handleExportExcel = _a.handleExportExcel, _d = _a.disabledCampaignFilter, disabledCampaignFilter = _d === void 0 ? false : _d, isFutureDate = _a.isFutureDate;
82
85
  var t = (0, react_i18next_1.useTranslation)().t;
86
+ var _e = (0, recoil_1.useRecoilState)(Atom_1.CampaignScheduleTypeViewState), typeView = _e[0], setTypeView = _e[1];
83
87
  var campaignOptions = __assign(__assign({}, campaigns), { 0: { campaignId: 0, name: t('Common.SelectAll') } });
84
88
  var classes = useStyles();
85
89
  var handleChangeDateRange = function (value) {
86
90
  handleFilters('startDate', value.startDate);
87
91
  handleFilters('endDate', value.endDate);
88
92
  };
89
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: disabledCampaignFilter ? 6 : 4, className: classes.dateRangePicker, children: (0, jsx_runtime_1.jsx)(AWING_1.DateRangePicker, { isShowCalendarInfo: true, isFutureDate: isFutureDate !== null && isFutureDate !== void 0 ? isFutureDate : true, label: "".concat(t('Common.StartDate'), " - ").concat(t('Common.EndDate')), callback: handleChangeDateRange, initialStartDate: (0, moment_1.default)(), initialEndDate: (0, moment_1.default)(), variant: "outlined", textFieldProps: {
93
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!disabledCampaignFilter && ((0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 2, 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: typeView.type, label: t('Common.TitleTypeView'), onChange: function (e) {
94
+ setTypeView({
95
+ type: e.target.value,
96
+ });
97
+ }, 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.Grid, { item: true, xs: disabledCampaignFilter ? 6 : 3, className: classes.dateRangePicker, children: (0, jsx_runtime_1.jsx)(AWING_1.DateRangePicker, { isShowCalendarInfo: true, isFutureDate: isFutureDate !== null && isFutureDate !== void 0 ? isFutureDate : true, label: "".concat(t('Common.StartDate'), " - ").concat(t('Common.EndDate')), callback: handleChangeDateRange, initialStartDate: (0, moment_1.default)(), initialEndDate: (0, moment_1.default)(), variant: "outlined", textFieldProps: {
90
98
  fullWidth: true,
91
99
  className: classes.outlinedInput,
92
100
  }, isDayBlocked: function (day) {
@@ -103,13 +111,19 @@ var Filters = function (_a) {
103
111
  return option.Id === value.Id;
104
112
  }, onChange: function (event, campaign) {
105
113
  handleFilters('campaignId', campaign === null || campaign === void 0 ? void 0 : campaign.id);
106
- }, renderInput: function (params) { return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({}, params, { label: t('Schedule.CampaignName'), sx: { backgroundColor: 'white' }, variant: "outlined" }))); }, defaultValue: { Id: 0, name: t('Common.SelectAll') } }) })), (0, jsx_runtime_1.jsxs)(material_1.Grid, { item: true, xs: disabledCampaignFilter ? 6 : 4, className: classes.ellipsisPlaceFilter, children: [(0, jsx_runtime_1.jsx)(PlaceMultiSelect, { isDisplayTextField: true, onChange: function (placeIds) {
114
+ }, renderInput: function (params) { return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({}, params, { label: t('Schedule.CampaignName'), sx: { backgroundColor: 'white' }, variant: "outlined" }))); }, defaultValue: { Id: 0, name: t('Common.SelectAll') } }) })), (0, jsx_runtime_1.jsxs)(material_1.Grid, { item: true, xs: disabledCampaignFilter ? 6 : 3, className: classes.ellipsisPlaceFilter, children: [(0, jsx_runtime_1.jsx)(PlaceMultiSelect, { isDisplayTextField: true, onChange: function (placeIds) {
107
115
  return handleFilters('placeIds', placeIds);
108
116
  } }), (0, jsx_runtime_1.jsx)(material_1.Button, { sx: {
109
117
  height: '40px',
110
118
  position: 'relative !important',
111
119
  marginLeft: '1rem',
112
120
  marginTop: '6px',
113
- }, variant: "contained", onClick: handleExportExcel, title: t('Common.Download'), disabled: loadingFlags === null || loadingFlags === void 0 ? void 0 : loadingFlags.export, color: "inherit", children: (loadingFlags === null || loadingFlags === void 0 ? void 0 : loadingFlags.export) ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(GetApp_1.default, {})) })] })] }));
121
+ }, variant: "contained", onClick: handleExportExcel, title: t('Common.Download'), disabled: loadingFlags === null || loadingFlags === void 0 ? void 0 : loadingFlags.export, color: "inherit", children: (loadingFlags === null || loadingFlags === void 0 ? void 0 : loadingFlags.export) ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, { styleWrap: {
122
+ display: 'flex',
123
+ justifyContent: 'center',
124
+ }, styleIcon: {
125
+ width: '25px !important',
126
+ height: '25px !important',
127
+ } })) : ((0, jsx_runtime_1.jsx)(GetApp_1.default, {})) })] })] }));
114
128
  };
115
129
  exports.default = Filters;
@@ -12,6 +12,9 @@ var Enum_1 = require("../../Enum");
12
12
  var Helpers_1 = require("../../../../Utils/Helpers");
13
13
  var react_1 = __importDefault(require("react"));
14
14
  var react_i18next_1 = require("react-i18next");
15
+ var recoil_1 = require("recoil");
16
+ var Atom_1 = require("../../Recoil/Atom");
17
+ var Constant_1 = require("../../../../ACM-AXN/Common/Constant");
15
18
  var useStyles = (0, styles_1.makeStyles)(function () { return ({
16
19
  styledCommonRow: {
17
20
  '&.MuiTableRow-root': {
@@ -79,9 +82,11 @@ var useStyles = (0, styles_1.makeStyles)(function () { return ({
79
82
  },
80
83
  }); });
81
84
  var RowAdvanceComponent = function (_a) {
85
+ var _b, _c, _d;
82
86
  var headCells = _a.headCells, row = _a.row, priorityGroupLevel = _a.priorityGroupLevel, stt = _a.stt, groupNames = _a.groupNames, options = _a.options, handleOnClick = _a.handleOnClick, open = _a.open, expandDisabled = _a.expandDisabled;
83
87
  var classes = useStyles();
84
88
  var t = (0, react_i18next_1.useTranslation)().t;
89
+ var type = (0, recoil_1.useRecoilValue)(Atom_1.CampaignScheduleTypeViewState).type;
85
90
  var fieldNameShowOn = groupNames[priorityGroupLevel - 1];
86
91
  var colSpanFirstCell = priorityGroupLevel;
87
92
  var startDate = (row === null || row === void 0 ? void 0 : row.fromDate)
@@ -91,10 +96,15 @@ var RowAdvanceComponent = function (_a) {
91
96
  ? (0, Helpers_1.timestampToStringDDMMYYYY)(row === null || row === void 0 ? void 0 : row.toDate)
92
97
  : (0, Helpers_1.timestampToStringDDMMYYYY)(row === null || row === void 0 ? void 0 : row.date);
93
98
  var fromDateToDate = startDate === endDate ? startDate : startDate + ' - ' + endDate;
94
- var totalRate = !(row === null || row === void 0 ? void 0 : row.rate) ? '' : (0, Helpers_1.formatNumber)(Number(row === null || row === void 0 ? void 0 : row.rate));
99
+ var isBillingUnit = type === Constant_1.TypeView.billingUnit;
100
+ var totalRate = !(row === null || row === void 0 ? void 0 : row.rate)
101
+ ? ''
102
+ : (0, Helpers_1.formatNumber)(isBillingUnit ? row === null || row === void 0 ? void 0 : row.rateBilling : (_b = row === null || row === void 0 ? void 0 : row.rate) !== null && _b !== void 0 ? _b : 0);
95
103
  var totalView = (row === null || row === void 0 ? void 0 : row.quantity) !== undefined
96
- ? (0, Helpers_1.formatNumber)(row === null || row === void 0 ? void 0 : row.quantity)
97
- : (0, Helpers_1.formatNumber)(row === null || row === void 0 ? void 0 : row.totalQuantity);
104
+ ? (0, Helpers_1.formatNumber)(isBillingUnit ? row === null || row === void 0 ? void 0 : row.quantityBilling : (_c = row === null || row === void 0 ? void 0 : row.quantity) !== null && _c !== void 0 ? _c : 0)
105
+ : (0, Helpers_1.formatNumber)(isBillingUnit
106
+ ? row === null || row === void 0 ? void 0 : row.totalQuantityBilling
107
+ : (_d = row === null || row === void 0 ? void 0 : row.totalQuantity) !== null && _d !== void 0 ? _d : 0);
98
108
  var ctr = (0, Helpers_1.formatNumber)(((row === null || row === void 0 ? void 0 : row.click) / (row === null || row === void 0 ? void 0 : row.view)) * 100);
99
109
  function styledRow(priority) {
100
110
  if ((groupNames === null || groupNames === void 0 ? void 0 : groupNames.length) === 1 && priorityGroupLevel === 1) {
@@ -95,7 +95,7 @@ var TableHeaderDragable = function (_a) {
95
95
  case Enum_1.HEAD_CELL_IDS.RATE:
96
96
  return "".concat(t('Schedule.Rate'), " (%)");
97
97
  case Enum_1.HEAD_CELL_IDS.TOTAL:
98
- return "".concat(t('Schedule.Total'), " (").concat(t('Common.Impression'), ")");
98
+ return t('Schedule.Total');
99
99
  default:
100
100
  return '';
101
101
  }
@@ -1,4 +1,4 @@
1
- export declare const DataSetConfigs: (exportData: any, campaigns: any, places: any, t: any) => {
1
+ export declare const DataSetConfigs: (exportData: any, campaigns: any, places: any, t: any, isBilling: boolean) => {
2
2
  results: {
3
3
  columns: any[];
4
4
  data: any[];
@@ -11,7 +11,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DataSetConfigs = void 0;
13
13
  var Helpers_1 = require("../../Utils/Helpers");
14
- var DataSetConfigs = function (exportData, campaigns, places, t) {
14
+ var DataSetConfigs = function (exportData, campaigns, places, t, isBilling) {
15
15
  var results = [
16
16
  {
17
17
  columns: [t('Schedule.ReportCampaignSchedule')],
@@ -43,9 +43,14 @@ var DataSetConfigs = function (exportData, campaigns, places, t) {
43
43
  value: (0, Helpers_1.timestampToStringDDMMYYYY)(data.date),
44
44
  style: { font: { sz: '13' } },
45
45
  },
46
- { value: data.rate, style: { font: { sz: '13' } } },
47
46
  {
48
- value: data.totalQuantity,
47
+ value: (0, Helpers_1.formatNumber)(isBilling ? data.rateBilling : data.rate || 0),
48
+ style: { font: { sz: '13' } },
49
+ },
50
+ {
51
+ value: (0, Helpers_1.formatNumber)(isBilling
52
+ ? data.totalQuantityBilling
53
+ : data.totalQuantity || 0),
49
54
  style: { font: { sz: '12' } },
50
55
  },
51
56
  ];
@@ -1,4 +1,4 @@
1
- export declare const DataSetConfigsAXN: (t: any, exportData: any, domains: any, campaigns: any, places: any) => {
1
+ export declare const DataSetConfigsAXN: (t: any, exportData: any, domains: any, campaigns: any, places: any, isBilling: boolean) => {
2
2
  columns: any[];
3
3
  data: any[];
4
4
  }[];
@@ -11,7 +11,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DataSetConfigsAXN = void 0;
13
13
  var Helpers_1 = require("../../Utils/Helpers");
14
- var DataSetConfigsAXN = function (t, exportData, domains, campaigns, places) {
14
+ var DataSetConfigsAXN = function (t, exportData, domains, campaigns, places, isBilling) {
15
15
  return [
16
16
  {
17
17
  columns: [t('Schedule.ReportCampaignSchedule')],
@@ -45,9 +45,14 @@ var DataSetConfigsAXN = function (t, exportData, domains, campaigns, places) {
45
45
  value: (0, Helpers_1.timestampToStringDDMMYYYY)(data.date),
46
46
  style: { font: { sz: '13' } },
47
47
  },
48
- { value: data.rate, style: { font: { sz: '13' } } },
49
48
  {
50
- value: data.totalQuantity,
49
+ value: (0, Helpers_1.formatNumber)(isBilling ? data.rateBilling : data.rate || 0),
50
+ style: { font: { sz: '13' } },
51
+ },
52
+ {
53
+ value: (0, Helpers_1.formatNumber)(isBilling
54
+ ? data.totalQuantityBilling
55
+ : data.totalQuantity || 0),
51
56
  style: { font: { sz: '12' } },
52
57
  },
53
58
  ];
@@ -1,2 +1,3 @@
1
- import { IPlaceGroupPermission } from "../interface";
1
+ import { IPlaceGroupPermission, ITypeView } from '../interface';
2
2
  export declare const placeGroupPermissionState: import("recoil").RecoilState<IPlaceGroupPermission>;
3
+ export declare const CampaignScheduleTypeViewState: import("recoil").RecoilState<ITypeView>;
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.placeGroupPermissionState = void 0;
3
+ exports.CampaignScheduleTypeViewState = exports.placeGroupPermissionState = void 0;
4
4
  var recoil_1 = require("recoil");
5
+ var Constant_1 = require("../../../ACM-AXN/Common/Constant");
5
6
  // Khi bắt đầu load sẽ thực hiện lấy thông tin placeGroupPermission cho placefilter.
6
7
  exports.placeGroupPermissionState = (0, recoil_1.atom)({
7
- key: "PlaceGroupPermissionState",
8
+ key: 'PlaceGroupPermissionState',
8
9
  default: { placeGroups: [], places: [] },
9
10
  });
11
+ exports.CampaignScheduleTypeViewState = (0, recoil_1.atom)({
12
+ key: 'CampaignScheduleTypeViewState',
13
+ default: { type: Constant_1.TypeView.billingUnit },
14
+ });
@@ -1,3 +1,3 @@
1
1
  import { ICampaignScheduleContainerProps } from './interface';
2
- declare const CampaignScheduleContainer: ({ initialFilters, initialHeadCells, placeMultiSelectComponent, serviceCampaignSchedule, typeSystemAXN, title, disabledCampaignFilter, isFutureDate }: ICampaignScheduleContainerProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const CampaignScheduleContainer: ({ initialFilters, initialHeadCells, placeMultiSelectComponent, serviceCampaignSchedule, typeSystemAXN, title, disabledCampaignFilter, isFutureDate, }: ICampaignScheduleContainerProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default CampaignScheduleContainer;
@@ -62,6 +62,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
62
62
  var jsx_runtime_1 = require("react/jsx-runtime");
63
63
  var material_1 = require("@mui/material");
64
64
  var lodash_1 = __importDefault(require("lodash"));
65
+ var recoil_1 = require("recoil");
65
66
  var react_1 = require("react");
66
67
  var react_helmet_async_1 = require("react-helmet-async");
67
68
  var react_i18next_1 = require("react-i18next");
@@ -72,10 +73,13 @@ var DataConfig_1 = require("./DataConfig");
72
73
  var DataConfigAXN_1 = require("./DataConfigAXN");
73
74
  var Enum_1 = require("./Enum");
74
75
  var component_1 = __importDefault(require("./component"));
76
+ var Atom_1 = require("./Recoil/Atom");
77
+ var Constant_1 = require("../../ACM-AXN/Common/Constant");
75
78
  var CampaignScheduleContainer = function (_a) {
76
79
  var _b;
77
80
  var initialFilters = _a.initialFilters, initialHeadCells = _a.initialHeadCells, placeMultiSelectComponent = _a.placeMultiSelectComponent, serviceCampaignSchedule = _a.serviceCampaignSchedule, _c = _a.typeSystemAXN, typeSystemAXN = _c === void 0 ? false : _c, title = _a.title, disabledCampaignFilter = _a.disabledCampaignFilter, isFutureDate = _a.isFutureDate;
78
81
  var t = (0, react_i18next_1.useTranslation)().t;
82
+ var type = (0, recoil_1.useRecoilValue)(Atom_1.CampaignScheduleTypeViewState).type;
79
83
  var _d = (0, react_1.useState)(null), dragPlace = _d[0], setDragPlace = _d[1];
80
84
  var _e = (0, react_1.useState)(initialFilters), filters = _e[0], setFilters = _e[1];
81
85
  var pagingGroupBy = serviceCampaignSchedule.pagingGroupBy, paging = serviceCampaignSchedule.paging, exportExcel = serviceCampaignSchedule.exportExcel, placesPermission = serviceCampaignSchedule.placesPermission, campaignPlan = serviceCampaignSchedule.campaignPlan, domains = serviceCampaignSchedule.domains;
@@ -172,8 +176,9 @@ var CampaignScheduleContainer = function (_a) {
172
176
  getScheduleGroupsData();
173
177
  }, [page.pageSize, page.pageIndex, view, filters.campaignId]);
174
178
  var handleExportExcel = function () {
179
+ var isBillingUnit = type === Constant_1.TypeView.billingUnit;
175
180
  var params = __assign(__assign({}, filters), { options: options });
176
- exportExcel(params, typeSystemAXN ? DataConfigAXN_1.DataSetConfigsAXN : DataConfig_1.DataSetConfigs, t);
181
+ exportExcel(params, typeSystemAXN ? DataConfigAXN_1.DataSetConfigsAXN : DataConfig_1.DataSetConfigs, t, isBillingUnit);
177
182
  };
178
183
  var getAllPlaces = function () {
179
184
  if (placesPermission) {
@@ -194,6 +194,9 @@ export interface IGroupPanelProps {
194
194
  onDrop: any;
195
195
  panels: any;
196
196
  }
197
+ export interface ITypeView {
198
+ type: number;
199
+ }
197
200
  export interface IFiltersProps {
198
201
  campaigns: {};
199
202
  handleFilters: (field: string, value: any) => void;
@@ -140,3 +140,20 @@ export declare const Constants: {
140
140
  PAGE: string;
141
141
  PAGE_CREATE_DIRECTORY: string;
142
142
  };
143
+ /**
144
+ * ValueAnalyticType dùng để truy xuất dữ liệu trong các file "runs" và "expecteds" filter phần thống kê.
145
+ **/
146
+ export declare const ValueAnalyticType: {
147
+ VIEW: string;
148
+ AUTHENTICATION: string;
149
+ CLICK: string;
150
+ };
151
+ /**
152
+ * TypeView kịch bản filter trong phần thống kê.
153
+ * billingUnit: 0, // Đơn vị tính, dựa vào trường "billingUnit" => 1: "Authentication", 2: "Click"
154
+ * impression: 1, // Lượt hiển thị, "View"
155
+ **/
156
+ export declare const TypeView: {
157
+ billingUnit: number;
158
+ impression: number;
159
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Constants = void 0;
3
+ exports.TypeView = exports.ValueAnalyticType = exports.Constants = void 0;
4
4
  exports.Constants = {
5
5
  API_ENDPOINT: window.REACT_APP_API_ENDPOINT,
6
6
  // Notification
@@ -130,3 +130,20 @@ exports.Constants = {
130
130
  PAGE: 'Page',
131
131
  PAGE_CREATE_DIRECTORY: 'CreateDirectory',
132
132
  };
133
+ /**
134
+ * ValueAnalyticType dùng để truy xuất dữ liệu trong các file "runs" và "expecteds" filter phần thống kê.
135
+ **/
136
+ exports.ValueAnalyticType = {
137
+ VIEW: 'View',
138
+ AUTHENTICATION: 'Authentication',
139
+ CLICK: 'Click',
140
+ };
141
+ /**
142
+ * TypeView kịch bản filter trong phần thống kê.
143
+ * billingUnit: 0, // Đơn vị tính, dựa vào trường "billingUnit" => 1: "Authentication", 2: "Click"
144
+ * impression: 1, // Lượt hiển thị, "View"
145
+ **/
146
+ exports.TypeView = {
147
+ billingUnit: 0, // Đơn vị tính
148
+ impression: 1, // Lượt hiển thị
149
+ };
@@ -30,3 +30,8 @@ export declare enum JobTypeEnum {
30
30
  Cron = "Cron",
31
31
  Trigger = "Trigger"
32
32
  }
33
+ export declare enum AnalyticType {
34
+ VIEW = 0,// Impression
35
+ AUTHENTICATION = 1,// Engagement / Spot
36
+ CLICK = 2
37
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JobTypeEnum = exports.VERIFIED_STATUS = exports.VALID_PROCESS_CODE = exports.TrackingType = exports.PathType = exports.FileTypeCode = exports.PageCode = void 0;
3
+ exports.AnalyticType = exports.JobTypeEnum = exports.VERIFIED_STATUS = exports.VALID_PROCESS_CODE = exports.TrackingType = exports.PathType = exports.FileTypeCode = exports.PageCode = void 0;
4
4
  var PageCode;
5
5
  (function (PageCode) {
6
6
  PageCode[PageCode["Wlc"] = 0] = "Wlc";
@@ -41,3 +41,9 @@ var JobTypeEnum;
41
41
  JobTypeEnum["Cron"] = "Cron";
42
42
  JobTypeEnum["Trigger"] = "Trigger";
43
43
  })(JobTypeEnum || (exports.JobTypeEnum = JobTypeEnum = {}));
44
+ var AnalyticType;
45
+ (function (AnalyticType) {
46
+ AnalyticType[AnalyticType["VIEW"] = 0] = "VIEW";
47
+ AnalyticType[AnalyticType["AUTHENTICATION"] = 1] = "AUTHENTICATION";
48
+ AnalyticType[AnalyticType["CLICK"] = 2] = "CLICK";
49
+ })(AnalyticType || (exports.AnalyticType = AnalyticType = {}));
@@ -1,24 +1,52 @@
1
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
+ };
2
14
  Object.defineProperty(exports, "__esModule", { value: true });
3
15
  var jsx_runtime_1 = require("react/jsx-runtime");
4
- var AWING_1 = require("../../AWING");
5
16
  var react_i18next_1 = require("react-i18next");
17
+ var react_1 = require("react");
18
+ var Hooks_1 = __importDefault(require("./Hooks"));
19
+ var AWING_1 = require("../../AWING");
6
20
  var Utils_1 = require("./Utils");
7
21
  var FormHoliday = function (props) {
8
22
  var t = (0, react_i18next_1.useTranslation)().t;
23
+ var service = (0, Hooks_1.default)().service;
9
24
  var holidays = props.holidays, onUpdate = props.onUpdate, isAllFieldReadOnly = props.isAllFieldReadOnly;
10
- return ((0, jsx_runtime_1.jsx)(AWING_1.BasicDataForm, { oldValue: holidays, onUpdate: onUpdate
11
- ? function (formValid, value) {
12
- return onUpdate(formValid ? value : {});
13
- }
14
- : undefined, fields: [
25
+ var _a = (0, react_1.useState)([]), domains = _a[0], setDomains = _a[1];
26
+ var _b = (0, react_1.useState)(true), loading = _b[0], setLoading = _b[1];
27
+ (0, react_1.useEffect)(function () {
28
+ if (service === null || service === void 0 ? void 0 : service.isAcmAdmin) {
29
+ service.domainsGetAll &&
30
+ service
31
+ .domainsGetAll()
32
+ .then(setDomains)
33
+ .finally(function () { return setLoading(false); });
34
+ }
35
+ else {
36
+ setLoading(false);
37
+ }
38
+ }, [service]);
39
+ var fields = (0, react_1.useMemo)(function () {
40
+ var result = [
15
41
  {
16
42
  fieldName: 'name',
17
43
  label: t('HolidayForm.Name'),
18
44
  type: 'text',
19
45
  required: true,
20
46
  length: 100,
21
- inputProps: { readOnly: isAllFieldReadOnly ? true : false },
47
+ inputProps: {
48
+ readOnly: isAllFieldReadOnly ? true : false,
49
+ },
22
50
  },
23
51
  {
24
52
  fieldName: 'calendarType',
@@ -32,7 +60,9 @@ var FormHoliday = function (props) {
32
60
  text: t("CalendarType.".concat(key)),
33
61
  });
34
62
  }),
35
- inputProps: { readOnly: isAllFieldReadOnly ? true : false },
63
+ inputProps: {
64
+ readOnly: isAllFieldReadOnly ? true : false,
65
+ },
36
66
  },
37
67
  {
38
68
  fieldName: 'recurrenceType',
@@ -46,8 +76,35 @@ var FormHoliday = function (props) {
46
76
  text: t("RecurrenceType.".concat(key)),
47
77
  });
48
78
  }),
49
- inputProps: { readOnly: isAllFieldReadOnly ? true : false },
79
+ inputProps: {
80
+ readOnly: isAllFieldReadOnly ? true : false,
81
+ },
50
82
  },
51
- ] }));
83
+ ];
84
+ if (service === null || service === void 0 ? void 0 : service.isAcmAdmin) {
85
+ result.splice(1, 0, {
86
+ fieldName: 'domainId',
87
+ label: t('Holiday.Domain'),
88
+ type: 'autocomplete',
89
+ required: true,
90
+ defaultValue: '99',
91
+ options: __spreadArray([
92
+ {
93
+ value: '99',
94
+ text: t('Common.None'),
95
+ }
96
+ ], domains.map(function (item) { return ({
97
+ value: item.domainId,
98
+ text: (item === null || item === void 0 ? void 0 : item.name) || '',
99
+ }); }), true),
100
+ });
101
+ }
102
+ return result;
103
+ }, [domains, service === null || service === void 0 ? void 0 : service.isAcmAdmin, t, isAllFieldReadOnly]);
104
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(AWING_1.BasicDataForm, { oldValue: holidays, onUpdate: onUpdate
105
+ ? function (formValid, value) {
106
+ return onUpdate(formValid ? value : {});
107
+ }
108
+ : undefined, fields: fields })) }));
52
109
  };
53
110
  exports.default = FormHoliday;
@@ -23,6 +23,24 @@ export interface HolidayService {
23
23
  holidaysGetDetail: (id: number, cancelToken?: CancelToken) => Promise<HolidayDetail>;
24
24
  holidaysGetDetailByHolidayId: (holidayId: number, cancelToken?: CancelToken) => Promise<HolidayDetail[]>;
25
25
  holidaysDeleteDetail: (id: number, cancelToken?: CancelToken) => Promise<void>;
26
+ /**
27
+ * isAcmAdmin: Kiểm tra xem có phải là trang ACM Admin.
28
+ **/
29
+ isAcmAdmin?: boolean;
30
+ domainsGetAll?: (cancelToken?: CancelToken) => Promise<Domain[]>;
31
+ }
32
+ export interface Domain {
33
+ domainId?: string;
34
+ domainTariffId?: number;
35
+ directoryPath?: string | undefined;
36
+ name?: string | undefined;
37
+ joinNetwork?: boolean;
38
+ description?: string | undefined;
39
+ license?: string | undefined;
40
+ requiredCustomerData?: boolean | undefined;
41
+ url?: string | undefined;
42
+ customizeCustomerFormPath?: string | undefined;
43
+ contactPhoneNumber?: string | undefined;
26
44
  }
27
45
  export interface Holiday {
28
46
  id?: number;
@@ -22,29 +22,30 @@ var jsx_runtime_1 = require("react/jsx-runtime");
22
22
  **/
23
23
  var react_1 = require("react");
24
24
  var react_i18next_1 = require("react-i18next");
25
- var recoil_1 = require("recoil");
26
25
  var material_1 = require("@mui/material");
26
+ var recoil_1 = require("recoil");
27
+ var react_helmet_async_1 = require("react-helmet-async");
27
28
  var AccessTime_1 = __importDefault(require("@mui/icons-material/AccessTime"));
28
29
  var Filter_1 = __importDefault(require("./Filter"));
29
- var Constant_1 = require("../../ACM-AXN/Common/Constant");
30
+ var Context_1 = __importDefault(require("../../Context"));
30
31
  var Hooks_1 = __importDefault(require("./Hooks"));
31
32
  var Router_1 = require("../../AWING/Router");
32
- var Recoils_1 = require("./Recoils");
33
+ var Constant_1 = require("../../ACM-AXN/Common/Constant");
33
34
  var Utils_1 = require("./Utils");
34
- var Helpers_1 = require("../../Utils/Helpers");
35
35
  var AWING_1 = require("../../AWING");
36
- var react_helmet_async_1 = require("react-helmet-async");
37
- var Context_1 = __importDefault(require("../../Context"));
36
+ var Recoils_1 = require("./Recoils");
37
+ var Helpers_1 = require("../../Utils/Helpers");
38
38
  function Container() {
39
39
  var navigate = (0, Router_1.useNavigate)();
40
40
  var i18next = (0, react_1.useContext)(Context_1.default).i18next;
41
41
  var t = (0, react_i18next_1.useTranslation)(undefined, { i18n: i18next }).t;
42
42
  var service = (0, Hooks_1.default)().service;
43
43
  var setScheduleCompletionRate = (0, recoil_1.useSetRecoilState)(Recoils_1.scheduleCompletionRateAtom);
44
+ var type = (0, recoil_1.useRecoilValue)(Recoils_1.ScheduleCompletionRateTypeViewState).type;
44
45
  var _a = (0, react_1.useState)(false), loading = _a[0], setLoading = _a[1];
45
46
  var _b = (0, react_1.useState)([]), sortModels = _b[0], setSortModels = _b[1];
46
47
  var _c = (0, react_1.useState)([]), schedules = _c[0], setSchedules = _c[1];
47
- var _d = (0, react_1.useState)([]), fullSchedules = _d[0], setFullSchedules = _d[1];
48
+ var _d = (0, react_1.useState)([]), defaultFullSchedules = _d[0], setDefaultFullSchedules = _d[1];
48
49
  var _e = (0, react_1.useState)(Utils_1.DefaultValueFilter), filter = _e[0], setFilter = _e[1];
49
50
  var _f = (0, react_1.useState)(Utils_1.QueryInputDetail), queryInput = _f[0], setQueryInput = _f[1];
50
51
  (0, react_1.useEffect)(function () {
@@ -53,20 +54,22 @@ function Container() {
53
54
  service
54
55
  .scheduleCompletionRatesGet((_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'))
55
56
  .then(function (res) {
56
- var valueNew = res.map(function (item) { return (__assign(__assign({}, item), { rate: (item.totalRun / item.totalQuantity) * 100 || 0 })); });
57
- setFullSchedules(valueNew);
58
- setSchedules(valueNew);
59
- setScheduleCompletionRate(function (oldState) { return (__assign(__assign({}, oldState), { filter: filter, detailCompletionRate: valueNew })); });
57
+ var valueNew = (0, Utils_1.converData)(res, type);
58
+ updateData(valueNew);
59
+ // Dư liệu mặc định chưa update
60
+ setDefaultFullSchedules(res);
60
61
  })
61
62
  .finally(function () {
62
63
  setLoading(false);
63
64
  });
64
65
  // eslint-disable-next-line react-hooks/exhaustive-deps
65
- }, [service, filter.startDate, filter.endDate]);
66
+ }, [filter.startDate, filter.endDate]);
66
67
  (0, react_1.useEffect)(function () {
67
- var dataFilter = fullSchedules.filter(function (item) { return item.campaignId === filter.campaignId; });
68
- setSchedules(dataFilter.length > 0 ? dataFilter : fullSchedules);
69
- }, [filter.campaignId, fullSchedules]);
68
+ var dataFilter = defaultFullSchedules.filter(function (item) { return item.campaignId === filter.campaignId; });
69
+ var valueNew = (0, Utils_1.converData)(dataFilter.length > 0 ? dataFilter : defaultFullSchedules, type);
70
+ updateData(valueNew);
71
+ // eslint-disable-next-line react-hooks/exhaustive-deps
72
+ }, [filter.campaignId, defaultFullSchedules, type]);
70
73
  (0, react_1.useEffect)(function () {
71
74
  sortModels.length &&
72
75
  setSchedules(function (prev) {
@@ -78,6 +81,12 @@ function Container() {
78
81
  });
79
82
  });
80
83
  }, [sortModels]);
84
+ var updateData = function (dataNew) {
85
+ // Hiển thị dữ liệu DataGrid
86
+ setSchedules(dataNew);
87
+ // update recoils
88
+ setScheduleCompletionRate(function (oldState) { return (__assign(__assign({}, oldState), { filter: filter, detailCompletionRate: dataNew })); });
89
+ };
81
90
  var handleUpdateFilter = function (valueNew) {
82
91
  setFilter(function (oldValue) { return (__assign(__assign({}, oldValue), valueNew)); });
83
92
  };
@@ -85,7 +94,7 @@ function Container() {
85
94
  var _a = paths.split('.'), _r = _a[0], campaignId = _a[1], groupId = _a[2];
86
95
  navigate("".concat(Constant_1.Constants.DETAIL_PATH, "/").concat(campaignId, "/").concat(groupId));
87
96
  };
88
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_helmet_async_1.HelmetProvider, { children: (0, jsx_runtime_1.jsx)(react_helmet_async_1.Helmet, { children: (0, jsx_runtime_1.jsx)("title", { children: t('ScheduleCompletionRate.Title') }) }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h5", component: "h1", color: "inherit", noWrap: true, fontWeight: 'bold', sx: { marginBottom: function (theme) { return theme.spacing(2); } }, children: t('ScheduleCompletionRate.Title') }), (0, jsx_runtime_1.jsxs)(material_1.Paper, { elevation: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { padding: '24px 16px 0' }, children: (0, jsx_runtime_1.jsx)(Filter_1.default, { filter: filter, onUpdateFilter: handleUpdateFilter }) }), loading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(AWING_1.DataGrid, { columns: [
97
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_helmet_async_1.HelmetProvider, { children: (0, jsx_runtime_1.jsx)(react_helmet_async_1.Helmet, { children: (0, jsx_runtime_1.jsx)("title", { children: t('ScheduleCompletionRate.Title') }) }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h5", component: "h1", color: "inherit", noWrap: true, fontWeight: 'bold', sx: { mb: 2 }, children: t('ScheduleCompletionRate.Title') }), (0, jsx_runtime_1.jsxs)(material_1.Paper, { elevation: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { pt: 3, pl: 2, pr: 2 }, children: (0, jsx_runtime_1.jsx)(Filter_1.default, { filter: filter, onUpdateFilter: handleUpdateFilter }) }), loading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(AWING_1.DataGrid, { columns: [
89
98
  {
90
99
  field: '#',
91
100
  headerName: '#',
@@ -99,7 +108,7 @@ function Container() {
99
108
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("span", { children: [(row === null || row === void 0 ? void 0 : row.campaignId) !== -1
100
109
  ? (row === null || row === void 0 ? void 0 : row.campaignName) ||
101
110
  "ID:\n ".concat(row === null || row === void 0 ? void 0 : row.campaignId)
102
- : t('ScheduleCompletionRate.CampaignDefault'), (row === null || row === void 0 ? void 0 : row.isNetWorkCampaign) && ((0, jsx_runtime_1.jsx)("span", { style: {
111
+ : t('ScheduleCompletionRate.CampaignDefault'), (row === null || row === void 0 ? void 0 : row.isNetWork) && ((0, jsx_runtime_1.jsx)("span", { style: {
103
112
  backgroundColor: '#c49f47',
104
113
  color: '#ffffff',
105
114
  fontSize: '13px',
@@ -176,6 +185,9 @@ function Container() {
176
185
  };
177
186
  },
178
187
  type: 'number',
188
+ valueGetter: function (row) {
189
+ return (0, Helpers_1.formatNumber)(row.rate.toFixed(2));
190
+ },
179
191
  },
180
192
  ], rows: (0, Helpers_1.offlinePaginate)(schedules, queryInput.pageIndex, queryInput.pageSize), sortModel: sortModels, onSortModelChange: setSortModels, getRowId: function (row) {
181
193
  return [(0, Helpers_1.generateUUID)(), row.campaignId, row.groupId].join('.');