robbyson-frontend-library 1.0.55 → 1.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/pages/base-app-page.component.js +23 -3
- package/dist/components/pages/base-app-page.styles.js +2 -1
- package/dist/constants/market.constants.js +10 -0
- package/dist/models/tree/tree.model.js +6 -6
- package/dist/types/tree/tree.types.js +3 -0
- package/dist/utils/date.utils.js +37 -7
- package/package.json +1 -1
- package/src/components/basic-button/basic-button.interface.ts +1 -0
- package/src/components/daily-chart/daily-chart.interface.ts +1 -1
- package/src/components/header-context-menu/header-context-menu.interface.ts +4 -1
- package/src/components/mountain-chart/mountain-chart.interface.ts +1 -0
- package/src/components/pages/base-app-page.component.tsx +46 -9
- package/src/components/pages/base-app-page.styles.ts +5 -0
- package/src/components/radio-button/radio-button.interface.ts +1 -0
- package/src/components/result-chart/result-chart.interface.ts +2 -1
- package/src/components/tab/tab.interface.ts +2 -1
- package/src/components/tree-date-picker/tree-date-picker.interface.ts +3 -3
- package/src/components/weekly-chart/weekly-chart.interface.ts +2 -1
- package/src/services/profile.service.interface.ts +2 -0
- package/src/services/tree.service.interface.ts +3 -2
- package/src/states/main-container/tree-app.state.interface.ts +3 -0
- package/src/states/profile-container/profile-app.state.interface.ts +1 -0
- package/src/types/tree/tree.types.ts +3 -0
- package/src/utils/date.utils.ts +46 -3
|
@@ -24,7 +24,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
24
24
|
};
|
|
25
25
|
import React from "react";
|
|
26
26
|
import { IoC } from "../../ioc";
|
|
27
|
-
import { PageContainer, Header, Title, ContextMenu, Content, LeftArrowLarge, } from "./base-app-page.styles";
|
|
27
|
+
import { PageContainer, Header, Title, ContextMenu, Content, LeftArrowLarge, GenericButton, } from "./base-app-page.styles";
|
|
28
28
|
import { RobbysonNavigate } from "../../utils";
|
|
29
29
|
import { QueryParamsFactory } from "../../factories/query-params.factory";
|
|
30
30
|
var BaseAppPage = /** @class */ (function (_super) {
|
|
@@ -32,10 +32,15 @@ var BaseAppPage = /** @class */ (function (_super) {
|
|
|
32
32
|
function BaseAppPage(props) {
|
|
33
33
|
var _this = _super.call(this, props) || this;
|
|
34
34
|
_this.headerLocale = "Header Locale";
|
|
35
|
+
_this._baseAppPageTitleRef = React.createRef();
|
|
36
|
+
_this._baseAppPaseTitle = "";
|
|
37
|
+
_this._profileHistoryService = IoC.GetInstance("ProfileService");
|
|
35
38
|
_this.translate = _this.translate.bind(_this);
|
|
36
39
|
_this.redirect = _this.redirect.bind(_this);
|
|
37
40
|
_this._localeService = IoC.GetInstance("LocaleService");
|
|
38
41
|
_this._themeService = IoC.GetInstance("ThemeService");
|
|
42
|
+
_this._profileHistoryService =
|
|
43
|
+
IoC.GetInstance("ProfileService");
|
|
39
44
|
return _this;
|
|
40
45
|
}
|
|
41
46
|
BaseAppPage.prototype.redirect = function () {
|
|
@@ -73,6 +78,18 @@ var BaseAppPage = /** @class */ (function (_super) {
|
|
|
73
78
|
}
|
|
74
79
|
return (_a = this._localeService).getLocaleByHandle.apply(_a, __spreadArray([text || ""], args, false));
|
|
75
80
|
};
|
|
81
|
+
BaseAppPage.prototype.focusOnTitle = function (title) {
|
|
82
|
+
if (title) {
|
|
83
|
+
this._baseAppPaseTitle = title;
|
|
84
|
+
}
|
|
85
|
+
var route = RobbysonNavigate.getRouteId();
|
|
86
|
+
var history = this._profileHistoryService.getSessionHistory();
|
|
87
|
+
if (this._baseAppPageTitleRef.current &&
|
|
88
|
+
history &&
|
|
89
|
+
history.endsWith(route)) {
|
|
90
|
+
this._baseAppPageTitleRef.current.focus();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
76
93
|
BaseAppPage.prototype.render = function () {
|
|
77
94
|
var _this = this;
|
|
78
95
|
QueryParamsFactory.validate(this.paramsValidValues, this.paramsDefaultValues);
|
|
@@ -80,8 +97,11 @@ var BaseAppPage = /** @class */ (function (_super) {
|
|
|
80
97
|
return (React.createElement(PageContainer, null,
|
|
81
98
|
React.createElement(Header, { usePageHeader: this._usePageHeader },
|
|
82
99
|
React.createElement("div", null,
|
|
83
|
-
React.createElement(
|
|
84
|
-
|
|
100
|
+
React.createElement(GenericButton, { onClick: function () { return _this.redirect(); }, "aria-label": "Voltar para a tela anterior" },
|
|
101
|
+
React.createElement(LeftArrowLarge, { src: this._themeService.getIconAssetUrl("left-arrow-large"), isOperacaoPage: isOperacaoPage })),
|
|
102
|
+
React.createElement(Title, { tabIndex: 0, ref: this._baseAppPageTitleRef, "aria-label": this._baseAppPaseTitle
|
|
103
|
+
? this._baseAppPaseTitle
|
|
104
|
+
: this.translate(this.headerLocale) }, this.translate(this.headerLocale))),
|
|
85
105
|
!this._avoidContextMenu && (React.createElement(ContextMenu, { className: "body-2-book" }, this.contextMenu()))),
|
|
86
106
|
React.createElement(Content, { contentMarginTop: this._contentMarginTop, usePageHeader: this._usePageHeader, avoidContextMenu: this._avoidContextMenu }, this.renderPage())));
|
|
87
107
|
};
|
|
@@ -47,4 +47,5 @@ export var LeftArrowLarge = styled(SVG)(templateObject_10 || (templateObject_10
|
|
|
47
47
|
var isOperacaoPage = _a.isOperacaoPage;
|
|
48
48
|
return (isOperacaoPage ? "grey" : "inherit");
|
|
49
49
|
}, LayoutDimensions.width.horizontalIpadMini + 1);
|
|
50
|
-
var
|
|
50
|
+
export var GenericButton = styled.button(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n background: none;\n border: none;\n"], ["\n background: none;\n border: none;\n"])));
|
|
51
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
@@ -19,6 +19,15 @@ export var PRODUCT_TYPE_BY_ID = {
|
|
|
19
19
|
// 6: "donation",
|
|
20
20
|
7: "voucher",
|
|
21
21
|
};
|
|
22
|
+
export var PRODUCT_TYPE_BY_ID_LOCALES = {
|
|
23
|
+
1: "main_enumeratorProductType_experiences",
|
|
24
|
+
2: "main_enumeratorProductType_customization",
|
|
25
|
+
3: "main_enumeratorProductType_material",
|
|
26
|
+
4: "main_enumeratorProductType_raffle",
|
|
27
|
+
// 5: "auction",
|
|
28
|
+
// 6: "donation",
|
|
29
|
+
7: "main_enumeratorProductType_voucher",
|
|
30
|
+
};
|
|
22
31
|
export var PRODUCT_ORDER_STATUS_ID;
|
|
23
32
|
(function (PRODUCT_ORDER_STATUS_ID) {
|
|
24
33
|
PRODUCT_ORDER_STATUS_ID[PRODUCT_ORDER_STATUS_ID["ORDERED"] = 1] = "ORDERED";
|
|
@@ -68,6 +77,7 @@ export var MarketConstants = {
|
|
|
68
77
|
PRODUCT_TYPE_ID: PRODUCT_TYPE_ID,
|
|
69
78
|
PRODUCT_TYPE_BY_ID: PRODUCT_TYPE_BY_ID,
|
|
70
79
|
PRODUCT_ORDER_STATUS_ID: PRODUCT_ORDER_STATUS_ID,
|
|
80
|
+
PRODUCT_TYPE_BY_ID_LOCALES: PRODUCT_TYPE_BY_ID_LOCALES,
|
|
71
81
|
PURCHASED_ORDERS_PROJECTION_FILTER: PURCHASED_ORDERS_PROJECTION_FILTER,
|
|
72
82
|
PURCHASED_ORDERS_SORT_FILTER: PURCHASED_ORDERS_SORT_FILTER,
|
|
73
83
|
PRODUCTS_PROJECTION_FILTER: PRODUCTS_PROJECTION_FILTER,
|
|
@@ -53,10 +53,10 @@ var TreeModel = /** @class */ (function (_super) {
|
|
|
53
53
|
__extends(TreeModel, _super);
|
|
54
54
|
function TreeModel(props) {
|
|
55
55
|
var _this = this;
|
|
56
|
-
var _a, _b, _c, _d;
|
|
56
|
+
var _a, _b, _c, _d, _e, _f;
|
|
57
57
|
_this = _super.call(this) || this;
|
|
58
58
|
_this._id = props === null || props === void 0 ? void 0 : props._id;
|
|
59
|
-
_this.data = (props === null || props === void 0 ? void 0 : props.data)
|
|
59
|
+
_this.data = ((_b = Object.keys((_a = props === null || props === void 0 ? void 0 : props.data) !== null && _a !== void 0 ? _a : {})) === null || _b === void 0 ? void 0 : _b.length) > 0 ? {
|
|
60
60
|
i: props === null || props === void 0 ? void 0 : props.data.i,
|
|
61
61
|
d: props === null || props === void 0 ? void 0 : props.data.d,
|
|
62
62
|
g: props === null || props === void 0 ? void 0 : props.data.g,
|
|
@@ -67,12 +67,12 @@ var TreeModel = /** @class */ (function (_super) {
|
|
|
67
67
|
goalRegister: props === null || props === void 0 ? void 0 : props.data.metaCadastrada,
|
|
68
68
|
fator: props === null || props === void 0 ? void 0 : props.data.fator,
|
|
69
69
|
m: {
|
|
70
|
-
maxCoins: (
|
|
71
|
-
qtdEarning: (
|
|
72
|
-
coinsGestor: (
|
|
70
|
+
maxCoins: (_c = props === null || props === void 0 ? void 0 : props.data.m) === null || _c === void 0 ? void 0 : _c.maxCoins,
|
|
71
|
+
qtdEarning: (_d = props === null || props === void 0 ? void 0 : props.data.m) === null || _d === void 0 ? void 0 : _d.qtdGanho,
|
|
72
|
+
coinsGestor: (_e = props === null || props === void 0 ? void 0 : props.data.m) === null || _e === void 0 ? void 0 : _e.coinsGestor
|
|
73
73
|
},
|
|
74
74
|
} : {};
|
|
75
|
-
if (((
|
|
75
|
+
if (((_f = props === null || props === void 0 ? void 0 : props.data) === null || _f === void 0 ? void 0 : _f.cd) !== undefined)
|
|
76
76
|
_this.data = (props === null || props === void 0 ? void 0 : props.data) != null ? __assign(__assign({}, props === null || props === void 0 ? void 0 : props.data), { cd: props === null || props === void 0 ? void 0 : props.data.cd }) : {};
|
|
77
77
|
_this.colors = props === null || props === void 0 ? void 0 : props.colors;
|
|
78
78
|
_this.highlightColors = props === null || props === void 0 ? void 0 : props.highlightColors;
|
|
@@ -38,6 +38,7 @@ export var TypeReferenceLetterEnum;
|
|
|
38
38
|
TypeReferenceLetterEnum["M"] = "monthly";
|
|
39
39
|
TypeReferenceLetterEnum["D"] = "daily";
|
|
40
40
|
TypeReferenceLetterEnum["W"] = "weekly";
|
|
41
|
+
TypeReferenceLetterEnum["S"] = "weekly";
|
|
41
42
|
})(TypeReferenceLetterEnum || (TypeReferenceLetterEnum = {}));
|
|
42
43
|
export var TreeActionTypes;
|
|
43
44
|
(function (TreeActionTypes) {
|
|
@@ -88,4 +89,6 @@ export var TreeActionTypes;
|
|
|
88
89
|
TreeActionTypes["SET_UNIQUE_ID"] = "SET_UNIQUE_ID";
|
|
89
90
|
TreeActionTypes["SET_USER_CURRENT_SELECTED"] = "SET_USER_CURRENT_SELECTED";
|
|
90
91
|
TreeActionTypes["SUCCESS_DATA_TREE"] = "SUCCESS_DATA_TREE";
|
|
92
|
+
TreeActionTypes["SET_REFERENCE_RESULT"] = "SET_REFERENCE_RESULT";
|
|
93
|
+
TreeActionTypes["SET_DATETREE_RESULT"] = "SET_DATETREE_RESULT";
|
|
91
94
|
})(TreeActionTypes || (TreeActionTypes = {}));
|
package/dist/utils/date.utils.js
CHANGED
|
@@ -32,6 +32,31 @@ var DateUtils = /** @class */ (function () {
|
|
|
32
32
|
timeZone: "UTC",
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
+
DateUtils.toLocaleDateString = function (dateString, locale) {
|
|
36
|
+
try {
|
|
37
|
+
if (!dateString) {
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
40
|
+
var date = void 0;
|
|
41
|
+
if (typeof dateString === "string") {
|
|
42
|
+
date = new Date(dateString.includes("T")
|
|
43
|
+
? dateString
|
|
44
|
+
: dateString + "T00:00:00Z");
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
date = new Date(dateString);
|
|
48
|
+
}
|
|
49
|
+
return new Intl.DateTimeFormat(locale, {
|
|
50
|
+
day: "numeric",
|
|
51
|
+
month: "long",
|
|
52
|
+
year: "numeric",
|
|
53
|
+
timeZone: "UTC",
|
|
54
|
+
}).format(date);
|
|
55
|
+
}
|
|
56
|
+
catch (_a) {
|
|
57
|
+
return "";
|
|
58
|
+
}
|
|
59
|
+
};
|
|
35
60
|
DateUtils.getRemainingTimeFromNow = function (compareDate, complementaryText) {
|
|
36
61
|
if (!compareDate)
|
|
37
62
|
return {
|
|
@@ -68,13 +93,18 @@ var DateUtils = /** @class */ (function () {
|
|
|
68
93
|
}
|
|
69
94
|
var minutes = Math.floor((secondsAsNumber % 3600) / 60);
|
|
70
95
|
var seconds = Math.floor((secondsAsNumber % 3600) % 60);
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
minutes
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
96
|
+
var formattedHours = parseFloat(hours) > 0 ? hours.padStart(2, "0") : "00";
|
|
97
|
+
var formattedMinutes = minutes === 0
|
|
98
|
+
? "00"
|
|
99
|
+
: minutes < 10
|
|
100
|
+
? "0" + minutes
|
|
101
|
+
: minutes.toString();
|
|
102
|
+
var formattedSeconds = seconds === 0
|
|
103
|
+
? "00"
|
|
104
|
+
: seconds < 10
|
|
105
|
+
? "0" + seconds
|
|
106
|
+
: seconds.toString();
|
|
107
|
+
var result = "".concat(formattedHours, ":").concat(formattedMinutes, ":").concat(formattedSeconds);
|
|
78
108
|
if (valueNegative) {
|
|
79
109
|
result = "- ".concat(result);
|
|
80
110
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ export interface IDailyChartProps extends IBaseComponentProp {
|
|
|
11
11
|
coin: number;
|
|
12
12
|
maxCoin: number;
|
|
13
13
|
result: string;
|
|
14
|
-
getDays?: (typeReference: TypeReferenceEnum, indicator_id: string) => Promise<void>;
|
|
14
|
+
getDays?: (treeNodeId: string, typeReference: TypeReferenceEnum, indicator_id: string) => Promise<void>;
|
|
15
15
|
goalResults: string;
|
|
16
16
|
hit:number;
|
|
17
17
|
date: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IBaseComponentProp } from "../base-component.prop.interface";
|
|
2
|
-
import { ISelectDatePicker, TabKey } from "../../components/tree-date-picker";
|
|
2
|
+
import { ISelectDatePicker, TabKey, Week } from "../../components/tree-date-picker";
|
|
3
3
|
import { TreeDTO } from "../../services";
|
|
4
4
|
|
|
5
5
|
export interface IHeaderContextMenuProps extends IBaseComponentProp {
|
|
@@ -10,8 +10,11 @@ export interface IHeaderContextMenuProps extends IBaseComponentProp {
|
|
|
10
10
|
calendarHideTabs?: boolean;
|
|
11
11
|
activeTab?: TabKey;
|
|
12
12
|
selectedMonth?: Date | null;
|
|
13
|
+
selectedDate?: Date;
|
|
13
14
|
showCalendar?: boolean;
|
|
14
15
|
textBreakpointsClasses?: HeaderTextBreakpointsClasses;
|
|
16
|
+
selectedWeek?: Week;
|
|
17
|
+
treeResultCalendar?: boolean;
|
|
15
18
|
onButtonClick?: (
|
|
16
19
|
buttonName: IHeaderContextMenuButtons,
|
|
17
20
|
linkTo?: string
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IoC } from "../../ioc";
|
|
3
|
-
import { ILocaleService, IThemeService } from "../../services";
|
|
4
|
-
|
|
3
|
+
import { ILocaleService, IProfileService, IThemeService } from "../../services";
|
|
5
4
|
import {
|
|
6
5
|
PageContainer,
|
|
7
6
|
Header,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
ContextMenu,
|
|
10
9
|
Content,
|
|
11
10
|
LeftArrowLarge,
|
|
11
|
+
GenericButton,
|
|
12
12
|
} from "./base-app-page.styles";
|
|
13
13
|
import { RobbysonNavigate } from "../../utils";
|
|
14
14
|
import { QueryParamsFactory } from "../../factories/query-params.factory";
|
|
@@ -24,6 +24,10 @@ export abstract class BaseAppPage<T, T1> extends React.Component<T, T1> {
|
|
|
24
24
|
protected _contentMarginTop?: number;
|
|
25
25
|
protected _usePageHeader?: boolean;
|
|
26
26
|
protected _avoidContextMenu?: boolean;
|
|
27
|
+
private _baseAppPageTitleRef = React.createRef<HTMLHeadingElement>();
|
|
28
|
+
private _baseAppPaseTitle = "";
|
|
29
|
+
private _profileHistoryService =
|
|
30
|
+
IoC.GetInstance<IProfileService>("ProfileService");
|
|
27
31
|
|
|
28
32
|
constructor(props: T) {
|
|
29
33
|
super(props);
|
|
@@ -31,6 +35,9 @@ export abstract class BaseAppPage<T, T1> extends React.Component<T, T1> {
|
|
|
31
35
|
this.redirect = this.redirect.bind(this);
|
|
32
36
|
this._localeService = IoC.GetInstance<ILocaleService>("LocaleService");
|
|
33
37
|
this._themeService = IoC.GetInstance<IThemeService>("ThemeService");
|
|
38
|
+
|
|
39
|
+
this._profileHistoryService =
|
|
40
|
+
IoC.GetInstance<IProfileService>("ProfileService");
|
|
34
41
|
}
|
|
35
42
|
private redirect(): void {
|
|
36
43
|
const state = RobbysonNavigate?.getHistoryState() as any;
|
|
@@ -65,6 +72,22 @@ export abstract class BaseAppPage<T, T1> extends React.Component<T, T1> {
|
|
|
65
72
|
return this._localeService.getLocaleByHandle(text || "", ...args);
|
|
66
73
|
}
|
|
67
74
|
|
|
75
|
+
protected focusOnTitle(title?: string): void {
|
|
76
|
+
if (title) {
|
|
77
|
+
this._baseAppPaseTitle = title;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const route = RobbysonNavigate.getRouteId();
|
|
81
|
+
const history = this._profileHistoryService.getSessionHistory();
|
|
82
|
+
if (
|
|
83
|
+
this._baseAppPageTitleRef.current &&
|
|
84
|
+
history &&
|
|
85
|
+
history.endsWith(route)
|
|
86
|
+
) {
|
|
87
|
+
this._baseAppPageTitleRef.current.focus();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
68
91
|
abstract contextMenu(): React.ReactNode;
|
|
69
92
|
|
|
70
93
|
abstract renderPage(): React.ReactNode;
|
|
@@ -80,14 +103,28 @@ export abstract class BaseAppPage<T, T1> extends React.Component<T, T1> {
|
|
|
80
103
|
<PageContainer>
|
|
81
104
|
<Header usePageHeader={this._usePageHeader}>
|
|
82
105
|
<div>
|
|
83
|
-
<
|
|
84
|
-
src={this._themeService.getIconAssetUrl(
|
|
85
|
-
"left-arrow-large"
|
|
86
|
-
)}
|
|
106
|
+
<GenericButton
|
|
87
107
|
onClick={() => this.redirect()}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
aria-label="Voltar para a tela anterior"
|
|
109
|
+
>
|
|
110
|
+
<LeftArrowLarge
|
|
111
|
+
src={this._themeService.getIconAssetUrl(
|
|
112
|
+
"left-arrow-large"
|
|
113
|
+
)}
|
|
114
|
+
isOperacaoPage={isOperacaoPage}
|
|
115
|
+
/>
|
|
116
|
+
</GenericButton>
|
|
117
|
+
<Title
|
|
118
|
+
tabIndex={0}
|
|
119
|
+
ref={this._baseAppPageTitleRef}
|
|
120
|
+
aria-label={
|
|
121
|
+
this._baseAppPaseTitle
|
|
122
|
+
? this._baseAppPaseTitle
|
|
123
|
+
: this.translate(this.headerLocale)
|
|
124
|
+
}
|
|
125
|
+
>
|
|
126
|
+
{this.translate(this.headerLocale)}
|
|
127
|
+
</Title>
|
|
91
128
|
</div>
|
|
92
129
|
|
|
93
130
|
{!this._avoidContextMenu && (
|
|
@@ -11,7 +11,7 @@ export interface IResultChartProps extends IBaseComponentProp {
|
|
|
11
11
|
maxCoin: string;
|
|
12
12
|
overlay?: boolean;
|
|
13
13
|
indicator_id: string;
|
|
14
|
-
getDays?: (typeReference: TypeReferenceEnum, indicator_id: string) => Promise<void>;
|
|
14
|
+
getDays?: (treeNodeId: string,typeReference: TypeReferenceEnum, indicator_id: string) => Promise<void>;
|
|
15
15
|
result: string;
|
|
16
16
|
goalResults: string;
|
|
17
17
|
hit:number;
|
|
@@ -19,6 +19,7 @@ export interface IResultChartProps extends IBaseComponentProp {
|
|
|
19
19
|
colorDivision: number[];
|
|
20
20
|
isInitialPosition?: boolean;
|
|
21
21
|
tabIndex?: number;
|
|
22
|
+
node_id?: string;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export interface IResultChartState {
|
|
@@ -35,11 +35,11 @@ export type Week = {
|
|
|
35
35
|
|
|
36
36
|
export type Weeks = Week[];
|
|
37
37
|
|
|
38
|
-
export type TabKey = "
|
|
38
|
+
export type TabKey = "daily" | "weekly" | "monthly" | "range";
|
|
39
39
|
|
|
40
40
|
export type DateTypeMap = {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
daily: Date | null;
|
|
42
|
+
weekly?: Date | null;
|
|
43
43
|
monthly: Date | null;
|
|
44
44
|
range: Date | null;
|
|
45
45
|
};
|
|
@@ -12,7 +12,7 @@ export interface IWeeklyChartProps extends IBaseComponentProp {
|
|
|
12
12
|
coin: string;
|
|
13
13
|
maxCoin: string;
|
|
14
14
|
overlay?: boolean;
|
|
15
|
-
getDays?: (typeReference: TypeReferenceEnum, indicator_id: string) => Promise<void>;
|
|
15
|
+
getDays?: (treeNodeId: string,typeReference: TypeReferenceEnum, indicator_id: string) => Promise<void>;
|
|
16
16
|
result: string;
|
|
17
17
|
goalResults: string;
|
|
18
18
|
indicator_id: string;
|
|
@@ -21,6 +21,7 @@ export interface IWeeklyChartProps extends IBaseComponentProp {
|
|
|
21
21
|
colorDivision: number[];
|
|
22
22
|
selectedReference ?: string;
|
|
23
23
|
tabIndex?: number;
|
|
24
|
+
node_id?: string;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export interface IWeeklyData {
|
|
@@ -20,6 +20,7 @@ export interface ITreeService {
|
|
|
20
20
|
getReportPerformance(
|
|
21
21
|
params: TreePerformanceParams
|
|
22
22
|
): Promise<TreeReportPerformanceModel[]>;
|
|
23
|
+
setReduxDateTree(date: string): void;
|
|
23
24
|
getIndicators({
|
|
24
25
|
params,
|
|
25
26
|
}: TreeDTO.IGetIndicatorsTreeDTO): Promise<TreeIndicatorModel[]>;
|
|
@@ -27,7 +28,7 @@ export interface ITreeService {
|
|
|
27
28
|
params,
|
|
28
29
|
}: TreeDTO.IGetAttributesTreeDTO): Promise<TreeAttributeModel[]>;
|
|
29
30
|
setDateTree(date: TreeDTO.ISelectedDateTreeDTO): void;
|
|
30
|
-
getDataTree(): Promise<any>;
|
|
31
|
+
getDataTree(isResult?: boolean): Promise<any>;
|
|
31
32
|
getDetailsTree(params: TreeDTO.IGetDetailsTreeDTO): Promise<TreeDetailModel>;
|
|
32
33
|
getTableTree(params: TreeDTO.IGetTableTreeDTO): Promise<TreeTableModel[]>;
|
|
33
34
|
selectedIndicator(params: TreeDTO.ISelectIndicatorsTreeDTO): void;
|
|
@@ -42,6 +43,7 @@ export interface ITreeService {
|
|
|
42
43
|
params: TreeDTO.IHandleBreadCrumbTreeDTO
|
|
43
44
|
): Promise<TreeDTO.IBreadcrumbData | TreeDTO.IBreadcrumbData[] | never[] | void>;
|
|
44
45
|
setUserCurrentSelected(params?: TreeDTO.IHandleSearchUser): void;
|
|
46
|
+
setNodeTree(node: string): void;
|
|
45
47
|
handleSearch(
|
|
46
48
|
params: TreeDTO.IHandleSearchTreeDTO
|
|
47
49
|
): Promise<TreeDTO.IHandleSearchUser[]>;
|
|
@@ -58,7 +60,6 @@ export interface ITreeService {
|
|
|
58
60
|
breadcrumbData: TreeDTO.IBreadcrumbData[];
|
|
59
61
|
minLevel: string;
|
|
60
62
|
}): [TreeModel["data"], TreeDTO.IBreadcrumbData[]];
|
|
61
|
-
getDataTree(params: TreeDTO.IGetDataTreeDTO): Promise<void>;
|
|
62
63
|
getSimulations(userId: number | undefined): Promise<void>;
|
|
63
64
|
getGraphData(simulationId?: string): Promise<void>;
|
|
64
65
|
insertSimulation(
|
|
@@ -27,6 +27,7 @@ interface ISimulationGroup {
|
|
|
27
27
|
export interface ITreeApp {
|
|
28
28
|
treeData: {
|
|
29
29
|
node: string | undefined;
|
|
30
|
+
node_result: string | undefined;
|
|
30
31
|
indicators: {
|
|
31
32
|
items: TreeIndicatorModel[];
|
|
32
33
|
selected: TreeIndicatorModel;
|
|
@@ -44,6 +45,7 @@ export interface ITreeApp {
|
|
|
44
45
|
initialReferenceDate: string;
|
|
45
46
|
};
|
|
46
47
|
reference: TypeReferenceEnum;
|
|
48
|
+
reference_result: TypeReferenceEnum;
|
|
47
49
|
attributes: {
|
|
48
50
|
items: TreeAttributeModel[];
|
|
49
51
|
selected: {
|
|
@@ -130,6 +132,7 @@ export interface ITreeApp {
|
|
|
130
132
|
errors: [];
|
|
131
133
|
};
|
|
132
134
|
selectedDate: string;
|
|
135
|
+
selectedDateResult: string;
|
|
133
136
|
isLoadingSimulation: boolean;
|
|
134
137
|
isLoadingTreeSimulation: boolean;
|
|
135
138
|
isLoading: boolean;
|
|
@@ -49,6 +49,7 @@ export enum TypeReferenceLetterEnum {
|
|
|
49
49
|
M = "monthly",
|
|
50
50
|
D = "daily",
|
|
51
51
|
W = "weekly",
|
|
52
|
+
S = "weekly",
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
export enum TreeActionTypes {
|
|
@@ -99,4 +100,6 @@ export enum TreeActionTypes {
|
|
|
99
100
|
SET_UNIQUE_ID = "SET_UNIQUE_ID",
|
|
100
101
|
SET_USER_CURRENT_SELECTED = "SET_USER_CURRENT_SELECTED",
|
|
101
102
|
SUCCESS_DATA_TREE = "SUCCESS_DATA_TREE",
|
|
103
|
+
SET_REFERENCE_RESULT = "SET_REFERENCE_RESULT",
|
|
104
|
+
SET_DATETREE_RESULT = "SET_DATETREE_RESULT"
|
|
102
105
|
}
|
package/src/utils/date.utils.ts
CHANGED
|
@@ -46,6 +46,38 @@ export class DateUtils {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
static toLocaleDateString(
|
|
50
|
+
dateString: string | Date,
|
|
51
|
+
locale: string
|
|
52
|
+
): string {
|
|
53
|
+
try {
|
|
54
|
+
if (!dateString) {
|
|
55
|
+
return "";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let date: Date;
|
|
59
|
+
|
|
60
|
+
if (typeof dateString === "string") {
|
|
61
|
+
date = new Date(
|
|
62
|
+
dateString.includes("T")
|
|
63
|
+
? dateString
|
|
64
|
+
: dateString + "T00:00:00Z"
|
|
65
|
+
);
|
|
66
|
+
} else {
|
|
67
|
+
date = new Date(dateString);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return new Intl.DateTimeFormat(locale, {
|
|
71
|
+
day: "numeric",
|
|
72
|
+
month: "long",
|
|
73
|
+
year: "numeric",
|
|
74
|
+
timeZone: "UTC",
|
|
75
|
+
}).format(date);
|
|
76
|
+
} catch {
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
49
81
|
static getRemainingTimeFromNow(
|
|
50
82
|
compareDate: Date,
|
|
51
83
|
complementaryText: string
|
|
@@ -97,9 +129,20 @@ export class DateUtils {
|
|
|
97
129
|
const minutes = Math.floor((secondsAsNumber % 3600) / 60);
|
|
98
130
|
const seconds = Math.floor((secondsAsNumber % 3600) % 60);
|
|
99
131
|
|
|
100
|
-
let formattedHours =
|
|
101
|
-
|
|
102
|
-
let
|
|
132
|
+
let formattedHours =
|
|
133
|
+
parseFloat(hours) > 0 ? hours.padStart(2, "0") : "00";
|
|
134
|
+
let formattedMinutes =
|
|
135
|
+
minutes === 0
|
|
136
|
+
? "00"
|
|
137
|
+
: minutes < 10
|
|
138
|
+
? "0" + minutes
|
|
139
|
+
: minutes.toString();
|
|
140
|
+
let formattedSeconds =
|
|
141
|
+
seconds === 0
|
|
142
|
+
? "00"
|
|
143
|
+
: seconds < 10
|
|
144
|
+
? "0" + seconds
|
|
145
|
+
: seconds.toString();
|
|
103
146
|
|
|
104
147
|
let result = `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;
|
|
105
148
|
|