awing-library 2.1.27-beta → 2.1.28-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.
@@ -1,3 +1,3 @@
1
- import { IEnhancedPaginationProps } from "../../interface";
1
+ import { IEnhancedPaginationProps } from '../../interface';
2
2
  declare const EnhancedPagination: ({ total, children, pageSize, pageIndex, classes, className, colSpan, handleChangePage, handleChangeRowsPerPage, }: IEnhancedPaginationProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default EnhancedPagination;
@@ -10,11 +10,13 @@ var Pagination_1 = __importDefault(require("./Pagination"));
10
10
  var EnhancedPagination = function (_a) {
11
11
  var total = _a.total, children = _a.children, pageSize = _a.pageSize, pageIndex = _a.pageIndex, classes = _a.classes, className = _a.className, colSpan = _a.colSpan, handleChangePage = _a.handleChangePage, handleChangeRowsPerPage = _a.handleChangeRowsPerPage;
12
12
  var t = (0, react_i18next_1.useTranslation)().t;
13
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [children, (0, jsx_runtime_1.jsx)(material_1.TableRow, { children: (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", padding: "none", colSpan: colSpan, children: (0, jsx_runtime_1.jsx)(material_1.TablePagination, { className: "".concat(classes === null || classes === void 0 ? void 0 : classes.root, " ").concat(className), rowsPerPageOptions: [10, 20, 30], component: "div", count: total, rowsPerPage: pageSize, page: pageIndex, ActionsComponent: Pagination_1.default, labelRowsPerPage: t("Paging.RowPerPage"), onPageChange: function (e) { return handleChangePage(e); }, onRowsPerPageChange: function (e) {
13
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [children, (0, jsx_runtime_1.jsx)(material_1.TableRow, { children: (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", padding: "none", colSpan: colSpan, children: (0, jsx_runtime_1.jsx)(material_1.TablePagination, { className: "".concat(classes === null || classes === void 0 ? void 0 : classes.root, " ").concat(className), rowsPerPageOptions: [10, 20, 30], component: "div", count: total, rowsPerPage: pageSize, page: pageIndex, ActionsComponent: Pagination_1.default, labelRowsPerPage: t('Paging.RowPerPage'), onPageChange: function (e, newPage) {
14
+ handleChangePage(newPage);
15
+ }, onRowsPerPageChange: function (e) {
14
16
  return handleChangeRowsPerPage(e);
15
17
  }, SelectProps: {
16
18
  inputProps: {
17
- "aria-label": t("Paging.RowPerPage"),
19
+ 'aria-label': t('Paging.RowPerPage'),
18
20
  },
19
21
  native: true,
20
22
  } }) }) })] }));
@@ -115,11 +115,10 @@ var RowAdvanceContainer = function (_a) {
115
115
  };
116
116
  function getDetails(filterBy, groupBy, pageSize, pageIndex) {
117
117
  return __awaiter(this, void 0, void 0, function () {
118
- var fromDate, toDate, campaignId, placeIds, params, error_1, error_2;
118
+ var params, error_1, error_2;
119
119
  return __generator(this, function (_a) {
120
120
  switch (_a.label) {
121
121
  case 0:
122
- fromDate = filterBy.fromDate, toDate = filterBy.toDate, campaignId = filterBy.campaignId, placeIds = filterBy.placeIds;
123
122
  params = __assign(__assign({}, filterBy), { groupBy: groupBy, pageIndex: pageIndex, pageSize: pageSize });
124
123
  if (!groupBy) return [3 /*break*/, 5];
125
124
  _a.label = 1;
@@ -0,0 +1,4 @@
1
+ export declare const DataSetConfigsAXN: (t: any, exportData: any, domains: any, campaigns: any, places: any) => {
2
+ columns: any[];
3
+ data: any[];
4
+ }[];
@@ -0,0 +1,58 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DataSetConfigsAXN = void 0;
13
+ var Helpers_1 = require("../../Utils/Helpers");
14
+ var DataSetConfigsAXN = function (t, exportData, domains, campaigns, places) {
15
+ return [
16
+ {
17
+ columns: [t('Schedule.ReportCampaignSchedule')],
18
+ data: [],
19
+ },
20
+ {
21
+ columns: [
22
+ '#',
23
+ t('Schedule.Campaign'),
24
+ t('Schedule.Place'),
25
+ t('Schedule.Date'),
26
+ "".concat(t('Schedule.Rate'), " (%)"),
27
+ t('Schedule.Total'),
28
+ ],
29
+ data: __spreadArray([], exportData.map(function (data, index) {
30
+ var campaignName = campaigns[data.campaignId]
31
+ ? campaigns[data.campaignId].name
32
+ : "ID: ".concat(data.campaignId);
33
+ var placeName = places[data.placeId]
34
+ ? places[data.placeId].name
35
+ : "ID: ".concat(data.placeId);
36
+ var domainName = domains[data.domainId]
37
+ ? domains[data.domainId].name
38
+ : "ID: ".concat(data.domainId);
39
+ return [
40
+ { value: index + 1, style: { font: { sz: '13' } } },
41
+ { value: campaignName, style: { font: { sz: '13' } } },
42
+ { value: placeName, style: { font: { sz: '13' } } },
43
+ { value: domainName, style: { font: { sz: '13' } } },
44
+ {
45
+ value: (0, Helpers_1.timestampToStringDDMMYYYY)(data.date),
46
+ style: { font: { sz: '13' } },
47
+ },
48
+ { value: data.rate, style: { font: { sz: '13' } } },
49
+ {
50
+ value: data.totalQuantity,
51
+ style: { font: { sz: '12' } },
52
+ },
53
+ ];
54
+ }), true),
55
+ },
56
+ ];
57
+ };
58
+ exports.DataSetConfigsAXN = DataSetConfigsAXN;
@@ -1,3 +1,3 @@
1
1
  import { ICampaignScheduleContainerProps } from './interface';
2
- declare const CampaignScheduleContainer: ({ initialFilters, initialHeadCells, placeMultiSelectComponent, serviceCampaignSchedule, }: ICampaignScheduleContainerProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const CampaignScheduleContainer: ({ initialFilters, initialHeadCells, placeMultiSelectComponent, serviceCampaignSchedule, typeSystemAXN, }: ICampaignScheduleContainerProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default CampaignScheduleContainer;
@@ -62,40 +62,39 @@ 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 moment_1 = __importDefault(require("moment"));
66
65
  var react_1 = require("react");
66
+ var react_helmet_async_1 = require("react-helmet-async");
67
67
  var react_i18next_1 = require("react-i18next");
68
68
  var CircularProgress_1 = require("../../AWING/CircularProgress");
69
69
  var ContentHeader_1 = __importDefault(require("./Components/ContentHeader"));
70
70
  var ControlPanel_1 = __importDefault(require("./Components/ControlPanel"));
71
71
  var DataConfig_1 = require("./DataConfig");
72
+ var DataConfigAXN_1 = require("./DataConfigAXN");
72
73
  var Enum_1 = require("./Enum");
73
74
  var component_1 = __importDefault(require("./component"));
74
- var exportFile_1 = require("./exportFile");
75
- var react_helmet_async_1 = require("react-helmet-async");
76
75
  var CampaignScheduleContainer = function (_a) {
77
76
  var _b;
78
- var initialFilters = _a.initialFilters, initialHeadCells = _a.initialHeadCells, placeMultiSelectComponent = _a.placeMultiSelectComponent, serviceCampaignSchedule = _a.serviceCampaignSchedule;
77
+ var initialFilters = _a.initialFilters, initialHeadCells = _a.initialHeadCells, placeMultiSelectComponent = _a.placeMultiSelectComponent, serviceCampaignSchedule = _a.serviceCampaignSchedule, _c = _a.typeSystemAXN, typeSystemAXN = _c === void 0 ? false : _c;
79
78
  var t = (0, react_i18next_1.useTranslation)().t;
80
- var _c = (0, react_1.useState)(null), dragPlace = _c[0], setDragPlace = _c[1];
81
- var _d = (0, react_1.useState)(initialFilters), filters = _d[0], setFilters = _d[1];
79
+ var _d = (0, react_1.useState)(null), dragPlace = _d[0], setDragPlace = _d[1];
80
+ var _e = (0, react_1.useState)(initialFilters), filters = _e[0], setFilters = _e[1];
82
81
  var pagingGroupBy = serviceCampaignSchedule.pagingGroupBy, paging = serviceCampaignSchedule.paging, exportExcel = serviceCampaignSchedule.exportExcel, placesPermission = serviceCampaignSchedule.placesPermission, campaignPlan = serviceCampaignSchedule.campaignPlan, domains = serviceCampaignSchedule.domains;
83
- var _e = (0, react_1.useState)({
82
+ var _f = (0, react_1.useState)({
84
83
  campaigns: {},
85
84
  places: {},
86
85
  domains: {},
87
- }), options = _e[0], setOptions = _e[1];
88
- var _f = (0, react_1.useState)(initialHeadCells), headCells = _f[0], setHeadCells = _f[1];
89
- var _g = (0, react_1.useState)(), scheduleGroups = _g[0], setScheduleGroups = _g[1];
90
- var _h = (0, react_1.useState)(Enum_1.initialPage), page = _h[0], setPage = _h[1];
91
- var _j = (0, react_1.useState)({
86
+ }), options = _f[0], setOptions = _f[1];
87
+ var _g = (0, react_1.useState)(initialHeadCells), headCells = _g[0], setHeadCells = _g[1];
88
+ var _h = (0, react_1.useState)(), scheduleGroups = _h[0], setScheduleGroups = _h[1];
89
+ var _j = (0, react_1.useState)(Enum_1.initialPage), page = _j[0], setPage = _j[1];
90
+ var _k = (0, react_1.useState)({
92
91
  campaigns: false,
93
92
  places: false,
94
93
  export: false,
95
94
  pages: false,
96
- }), loadingFlags = _j[0], setLoadingFlags = _j[1];
97
- var _k = (0, react_1.useState)(initialHeadCells), panels = _k[0], setPanels = _k[1];
98
- var _l = (0, react_1.useState)(false), view = _l[0], setView = _l[1];
95
+ }), loadingFlags = _k[0], setLoadingFlags = _k[1];
96
+ var _l = (0, react_1.useState)(initialHeadCells), panels = _l[0], setPanels = _l[1];
97
+ var _m = (0, react_1.useState)(false), view = _m[0], setView = _m[1];
99
98
  var handleLoading = function (typeLoading, value) {
100
99
  setLoadingFlags(function (prevLoadingFlags) {
101
100
  var _a;
@@ -162,20 +161,8 @@ var CampaignScheduleContainer = function (_a) {
162
161
  getScheduleGroupsData();
163
162
  }, [page.pageSize, page.pageIndex, view, filters.campaignId]);
164
163
  var handleExportExcel = function () {
165
- handleLoading('export', true);
166
- var startDate = filters.startDate, endDate = filters.endDate, campaignId = filters.campaignId, placeIds = filters.placeIds;
167
- var excelName = "AWING_REPORT_TRAFFIC_DISTRIBUTION_".concat(startDate.format('DD-MM-YYYY'), "_TO_").concat(endDate.format('DD-MM-YYYY'));
168
- exportExcel((0, moment_1.default)(startDate).startOf('day').format('YYYY-MM-DD'), (0, moment_1.default)(endDate).endOf('day').format('YYYY-MM-DD'), campaignId, placeIds)
169
- .then(function (res) {
170
- var _a = (0, DataConfig_1.DataSetConfigs)(res, options.campaigns, options.places, t), results = _a.results, mergeConfigs = _a.mergeConfigs;
171
- (0, exportFile_1.downloadWithDataSet)(excelName, results, mergeConfigs);
172
- })
173
- .catch(function (err) {
174
- // snackbar("error");
175
- })
176
- .finally(function () {
177
- handleLoading('export', false);
178
- });
164
+ var params = __assign(__assign({}, filters), { options: options });
165
+ exportExcel(params, typeSystemAXN ? DataConfigAXN_1.DataSetConfigsAXN : DataConfig_1.DataSetConfigs, t);
179
166
  };
180
167
  var getAllPlaces = function () {
181
168
  if (placesPermission) {
@@ -5,6 +5,7 @@ export interface ICampaignScheduleContainerProps {
5
5
  initialHeadCells: IHeadCells[];
6
6
  placeMultiSelectComponent: (p?: any) => JSX.Element;
7
7
  serviceCampaignSchedule: any;
8
+ typeSystemAXN?: boolean;
8
9
  }
9
10
  export interface ILoadingFlags {
10
11
  campaigns?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.27-beta",
3
+ "version": "2.1.28-beta",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",