awing-library 2.1.96 → 2.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ACM-AXN/Campaign/CreateOrEdit/index.d.ts +5 -1
- package/lib/ACM-AXN/Campaign/CreateOrEdit/index.js +103 -33
- package/lib/ACM-AXN/Campaign/Types.d.ts +7 -0
- package/lib/ACM-AXN/Campaign/index.js +2 -2
- package/lib/ACM-AXN/GeoFencing/component.js +1 -1
- package/lib/AWING/BasicDataForm/BasicDataForm.js +3 -3
- package/lib/AWING/BasicDataForm/interface.d.ts +3 -0
- package/lib/AWING/DateRangePicker/component.js +10 -9
- package/lib/AWING/DateRangePicker/interface.d.ts +1 -0
- package/lib/AWING/GoogleMap/GGMap.d.ts +1 -1
- package/lib/AWING/GoogleMap/GGMap.js +151 -78
- package/lib/AWING/GoogleMap/interface.d.ts +10 -5
- package/lib/AWING/GoogleMap/utils.d.ts +25 -0
- package/lib/AWING/GoogleMap/utils.js +135 -0
- package/lib/Commons/Components/ClassicDrawer.js +3 -2
- package/lib/translate/en/translation.json +3 -1
- package/lib/translate/vi/translation.json +3 -1
- package/package.json +1 -1
|
@@ -21,6 +21,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
}
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
25
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
26
|
+
if (ar || !(i in from)) {
|
|
27
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
28
|
+
ar[i] = from[i];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
32
|
+
};
|
|
24
33
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
34
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
35
|
};
|
|
@@ -51,6 +60,7 @@ var usePath_1 = __importDefault(require("../../../Commons/Hooks/usePath"));
|
|
|
51
60
|
var Wrapper_1 = __importDefault(require("../../../AWING/HOC/Wrapper"));
|
|
52
61
|
var TabStatistic_1 = __importDefault(require("./TabStatistic"));
|
|
53
62
|
var Enum_2 = require("../../../ACM-AXN/Common/Enum");
|
|
63
|
+
var Context_1 = require("../../../Context");
|
|
54
64
|
var route = [
|
|
55
65
|
Constant_1.Constants.CAMPAIGN_INFORMATION,
|
|
56
66
|
Constant_1.Constants.CAMPAIGN_SUBCAMPAIGN,
|
|
@@ -58,7 +68,7 @@ var route = [
|
|
|
58
68
|
Constant_1.Constants.CAMPAIGN_CONNECT,
|
|
59
69
|
Constant_1.Constants.CAMPAIGN_PERMISSION,
|
|
60
70
|
];
|
|
61
|
-
var CreateOrEdit = function () {
|
|
71
|
+
var CreateOrEdit = function (props) {
|
|
62
72
|
var _a;
|
|
63
73
|
var _b = (0, Router_1.useParams)(), campaignId = _b.campaignId, tabName = _b.tabName;
|
|
64
74
|
var location = (0, Router_1.useLocation)();
|
|
@@ -66,6 +76,7 @@ var CreateOrEdit = function () {
|
|
|
66
76
|
var matchPath = (0, usePath_1.default)();
|
|
67
77
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
68
78
|
var _c = (0, Hooks_1.default)(), service = _c.service, otherProps = __rest(_c, ["service"]);
|
|
79
|
+
var confirm = (0, Context_1.useAwing)().appHelper.confirm;
|
|
69
80
|
var _d = (0, recoil_1.useRecoilState)(Recoils_1.campaignModelState), campaignData = _d[0], setCampaignData = _d[1];
|
|
70
81
|
var setCampaignPages = (0, recoil_1.useSetRecoilState)(atoms_1.campaignPageIdState);
|
|
71
82
|
var setDirectories = (0, recoil_1.useSetRecoilState)(Recoils_1.directoriesState);
|
|
@@ -74,13 +85,16 @@ var CreateOrEdit = function () {
|
|
|
74
85
|
var readyForSubmit = (0, recoil_1.useRecoilValue)(Recoils_1.readyForSubmitState);
|
|
75
86
|
var setCreate = (0, recoil_1.useSetRecoilState)(Recoils_1.isCreateState);
|
|
76
87
|
var _f = (0, react_1.useState)(), fullPlaces = _f[0], setFullPlaces = _f[1];
|
|
88
|
+
var _g = (0, react_1.useState)(false), validWizad = _g[0], setValidWizad = _g[1];
|
|
89
|
+
var _h = (0, react_1.useState)(false), editModeWizard = _h[0], setEditModeWizard = _h[1];
|
|
90
|
+
var childRefWizard = (0, react_1.useRef)(null);
|
|
77
91
|
var tabValid = {
|
|
78
92
|
tabInfomationValid: (0, recoil_1.useRecoilValue)(Recoils_1.tabInfomationValidState),
|
|
79
93
|
tabSubCampaignValid: (0, recoil_1.useRecoilValue)(Recoils_1.tabSubCampaignValidState),
|
|
80
94
|
tabPartnerValid: (0, recoil_1.useRecoilValue)(Recoils_1.tabPartnerValidState),
|
|
81
95
|
};
|
|
82
|
-
var
|
|
83
|
-
var
|
|
96
|
+
var _j = (0, react_1.useState)('0'), value = _j[0], setValue = _j[1];
|
|
97
|
+
var _k = (0, react_1.useState)(true), loading = _k[0], setLoading = _k[1];
|
|
84
98
|
var componentStatus = (0, react_1.useMemo)(function () {
|
|
85
99
|
return location.pathname.includes(Constant_1.Constants.CAMPAIGN_DETAIL) &&
|
|
86
100
|
!!campaignId
|
|
@@ -125,20 +139,35 @@ var CreateOrEdit = function () {
|
|
|
125
139
|
setValue(String(route.indexOf(tabName)));
|
|
126
140
|
}
|
|
127
141
|
}, [tabName]);
|
|
142
|
+
var getTabs = function () {
|
|
143
|
+
return !(campaignData.campaignWizard && !editModeWizard && (props === null || props === void 0 ? void 0 : props.quickWizard))
|
|
144
|
+
? [
|
|
145
|
+
{
|
|
146
|
+
label: t('Campaign.Info'),
|
|
147
|
+
isShow: true,
|
|
148
|
+
valid: 'tabInfomationValid',
|
|
149
|
+
component: (0, jsx_runtime_1.jsx)(TabInfomation_1.default, {}),
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
label: t('Campaign.SubCampaign'),
|
|
153
|
+
isShow: true,
|
|
154
|
+
valid: 'tabSubCampaignValid',
|
|
155
|
+
component: (0, jsx_runtime_1.jsx)(TabSubCampaign_1.default, {}),
|
|
156
|
+
},
|
|
157
|
+
]
|
|
158
|
+
: [
|
|
159
|
+
{
|
|
160
|
+
label: t('Campaign.Wizard'),
|
|
161
|
+
isShow: true,
|
|
162
|
+
component: props === null || props === void 0 ? void 0 : props.quickWizard({
|
|
163
|
+
ref: childRefWizard,
|
|
164
|
+
onSubmitWizard: handleSubmit,
|
|
165
|
+
}),
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
};
|
|
128
169
|
var tabsList = (0, react_1.useMemo)(function () {
|
|
129
|
-
return [
|
|
130
|
-
{
|
|
131
|
-
label: t('Campaign.Info'),
|
|
132
|
-
isShow: true,
|
|
133
|
-
valid: 'tabInfomationValid',
|
|
134
|
-
component: (0, jsx_runtime_1.jsx)(TabInfomation_1.default, {}),
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
label: t('Campaign.SubCampaign'),
|
|
138
|
-
isShow: true,
|
|
139
|
-
valid: 'tabSubCampaignValid',
|
|
140
|
-
component: (0, jsx_runtime_1.jsx)(TabSubCampaign_1.default, {}),
|
|
141
|
-
},
|
|
170
|
+
return __spreadArray(__spreadArray([], getTabs(), true), [
|
|
142
171
|
{
|
|
143
172
|
label: t('Campaign.Statistic'),
|
|
144
173
|
isShow: componentStatus === Constant_1.Constants.CAMPAIGN_DETAIL,
|
|
@@ -155,10 +184,10 @@ var CreateOrEdit = function () {
|
|
|
155
184
|
isShow: componentStatus === Constant_1.Constants.CAMPAIGN_DETAIL,
|
|
156
185
|
component: (0, jsx_runtime_1.jsx)(TabPermission_1.default, {}),
|
|
157
186
|
},
|
|
158
|
-
].filter(function (tab) { return tab.isShow; });
|
|
187
|
+
], false).filter(function (tab) { return tab.isShow; });
|
|
159
188
|
},
|
|
160
189
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
161
|
-
[t, componentStatus, Constant_1.Constants, campaignData]);
|
|
190
|
+
[t, componentStatus, Constant_1.Constants, campaignData, editModeWizard]);
|
|
162
191
|
var handleChangeTab = function (_event, newValue) {
|
|
163
192
|
navigate((0, Router_1.generatePath)(matchPath, {
|
|
164
193
|
campaignId: campaignId,
|
|
@@ -221,25 +250,52 @@ var CreateOrEdit = function () {
|
|
|
221
250
|
};
|
|
222
251
|
var handleSubmit = function () {
|
|
223
252
|
var _a;
|
|
224
|
-
if (!(0
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
253
|
+
if (campaignData.campaignWizard && !editModeWizard && (props === null || props === void 0 ? void 0 : props.quickWizard)) {
|
|
254
|
+
if (childRefWizard.current) {
|
|
255
|
+
return childRefWizard.current.onSubmit({
|
|
256
|
+
campaignPartner: campaignData.campaignPartner,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
230
259
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
260
|
+
else {
|
|
261
|
+
if (!(0, Utils_1.adsClassCValid)(campaignData.campaignGroups
|
|
262
|
+
.filter(function (x) {
|
|
263
|
+
return (0, Utils_1.checkPriority)(x.campaignGroup.priority, Enum_1.CampaignPriority.ClassC);
|
|
264
|
+
})
|
|
265
|
+
.flatMap(function (x) { return x.ads; }))) {
|
|
266
|
+
return Promise.reject(t('Campaign.CClassDuplicatePlace'));
|
|
267
|
+
}
|
|
268
|
+
var dataSubmit = __assign(__assign({}, campaignData), { campaignAttributes: campaignData.campaignAttributes.filter(Boolean), campaignWizard: undefined });
|
|
269
|
+
if (!((_a = dataSubmit.campaignPartner) === null || _a === void 0 ? void 0 : _a.isSendApi)) {
|
|
270
|
+
delete dataSubmit.campaignPartner;
|
|
271
|
+
}
|
|
272
|
+
if (componentStatus === Constant_1.Constants.CAMPAIGN_DETAIL) {
|
|
273
|
+
return service.campaignsPut(campaignId, dataSubmit);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
return service.campaignsPost(dataSubmit);
|
|
277
|
+
}
|
|
234
278
|
}
|
|
235
|
-
|
|
236
|
-
|
|
279
|
+
};
|
|
280
|
+
var handleDisableButtonSubmit = function () {
|
|
281
|
+
if (campaignData.campaignWizard && !editModeWizard && (props === null || props === void 0 ? void 0 : props.quickWizard)) {
|
|
282
|
+
return validWizad;
|
|
237
283
|
}
|
|
238
|
-
|
|
239
|
-
|
|
284
|
+
return !readyForSubmit || !confirmExit;
|
|
285
|
+
};
|
|
286
|
+
var handleClose = function () {
|
|
287
|
+
if (campaignData.campaignWizard && !editModeWizard && (props === null || props === void 0 ? void 0 : props.quickWizard)) {
|
|
288
|
+
if (childRefWizard.current) {
|
|
289
|
+
childRefWizard.current.resetData();
|
|
290
|
+
}
|
|
240
291
|
}
|
|
241
292
|
};
|
|
242
|
-
|
|
293
|
+
var handleSaveProfessionalEditing = function () {
|
|
294
|
+
return new Promise(function (resolve, reject) {
|
|
295
|
+
confirm(function () { var _a; return (_a = handleSubmit()) === null || _a === void 0 ? void 0 : _a.then(resolve); }, function () { return reject(); }, t("Campaign.SwitchToProfessionalEditMode"));
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
return ((0, jsx_runtime_1.jsx)(ClassicDrawer_1.default, { title: "".concat(t(['Campaign', campaignId ? 'TitleDetail' : 'Create'].join('.'))).concat(campaignId ? ": ".concat((_a = campaignData === null || campaignData === void 0 ? void 0 : campaignData.campaign) === null || _a === void 0 ? void 0 : _a.name) : '', "\n "), onSubmit: function () { return editModeWizard ? handleSaveProfessionalEditing() : handleSubmit(); }, disableButtonSubmit: handleDisableButtonSubmit(), confirmExit: confirmExit, childrenWrapperStyle: { padding: 0 }, onClose: handleClose, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, sx: {
|
|
243
299
|
display: 'flex',
|
|
244
300
|
flexDirection: 'column',
|
|
245
301
|
flexGrow: 1,
|
|
@@ -251,7 +307,21 @@ var CreateOrEdit = function () {
|
|
|
251
307
|
? !tabValid[tab === null || tab === void 0 ? void 0 : tab.valid]
|
|
252
308
|
: undefined, errContent: (0, jsx_runtime_1.jsx)("span", { style: {
|
|
253
309
|
marginLeft: '-5px',
|
|
254
|
-
}, children: "*" }) }) }, idx)); }) }) }),
|
|
310
|
+
}, children: "*" }) }) }, idx)); }) }) }), campaignData.campaignWizard && !editModeWizard &&
|
|
311
|
+
(props === null || props === void 0 ? void 0 : props.quickWizard) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [props === null || props === void 0 ? void 0 : props.quickWizard({
|
|
312
|
+
ref: childRefWizard,
|
|
313
|
+
onSubmitWizard: handleSubmit,
|
|
314
|
+
handleValidWizad: setValidWizad,
|
|
315
|
+
handleEditMode: setEditModeWizard,
|
|
316
|
+
sxEdit: {
|
|
317
|
+
display: value === '0'
|
|
318
|
+
? 'block'
|
|
319
|
+
: 'none',
|
|
320
|
+
},
|
|
321
|
+
type: props.type,
|
|
322
|
+
}), tabsList.map(function (tab, idx) {
|
|
323
|
+
return idx !== 0 && ((0, jsx_runtime_1.jsx)(lab_1.TabPanel, { sx: { padding: '0' }, value: String(idx), children: tab.component }, idx));
|
|
324
|
+
})] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: tabsList.map(function (tab, idx) { return ((0, jsx_runtime_1.jsx)(lab_1.TabPanel, { sx: { padding: '0' }, value: String(idx), children: tab.component }, idx)); }) }))] }) })) }) }));
|
|
255
325
|
};
|
|
256
326
|
// eslint-disable-next-line import/no-anonymous-default-export
|
|
257
327
|
exports.default = (0, Wrapper_1.default)(CreateOrEdit, { component: recoil_1.RecoilRoot });
|
|
@@ -43,6 +43,12 @@ export type CampaignModel = {
|
|
|
43
43
|
campaignGroups: CampaignGroupModel[];
|
|
44
44
|
campaignAttributes: CampaignAttribute[];
|
|
45
45
|
campaignPartner?: CampaignPartner;
|
|
46
|
+
campaignWizard?: {
|
|
47
|
+
id?: number;
|
|
48
|
+
campaignId?: string;
|
|
49
|
+
wizardGroupId?: number;
|
|
50
|
+
wizardId?: string;
|
|
51
|
+
};
|
|
46
52
|
};
|
|
47
53
|
export type Campaign = {
|
|
48
54
|
id: string;
|
|
@@ -272,5 +278,6 @@ export interface CampaignFeatureProps {
|
|
|
272
278
|
domainId: string;
|
|
273
279
|
configs: any;
|
|
274
280
|
isAxn?: boolean;
|
|
281
|
+
quickWizard?: (p?: any) => JSX.Element;
|
|
275
282
|
}
|
|
276
283
|
export {};
|
|
@@ -52,11 +52,11 @@ var Campaign = function (props) {
|
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
param: Constant_1.Constants.CAMPAIGN_DETAIL + '/:campaignId/:tabName/*',
|
|
55
|
-
element: (0, jsx_runtime_1.jsx)(CreateOrEdit_1.default, {}),
|
|
55
|
+
element: (0, jsx_runtime_1.jsx)(CreateOrEdit_1.default, { quickWizard: props.quickWizard }),
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
param: Constant_1.Constants.CAMPAIGN_CLONE + '/:campaignId/:tabName/*',
|
|
59
|
-
element: (0, jsx_runtime_1.jsx)(CreateOrEdit_1.default, {}),
|
|
59
|
+
element: ((0, jsx_runtime_1.jsx)(CreateOrEdit_1.default, { quickWizard: props.quickWizard, type: Constant_1.Constants.CAMPAIGN_CLONE })),
|
|
60
60
|
},
|
|
61
61
|
];
|
|
62
62
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Container_1.default, {}), (0, jsx_runtime_1.jsx)(Router_1.Routes, { children: paths.map(function (p) { return ((0, jsx_runtime_1.jsx)(Router_1.Route, { path: p.param, element: p.element }, p.param)); }) })] }));
|
|
@@ -55,6 +55,6 @@ function Component(props) {
|
|
|
55
55
|
}
|
|
56
56
|
}, error: !!(radius &&
|
|
57
57
|
Number(radius) <
|
|
58
|
-
((limit === null || limit === void 0 ? void 0 : limit.min) || constants_1.MIN_RADIUS)) }) })] })), (isOnlyMap || showMap) && ((0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, style: { position: "relative", marginTop: "16px" }, children: (0, jsx_runtime_1.jsx)(AWING_1.GoogleMap, {
|
|
58
|
+
((limit === null || limit === void 0 ? void 0 : limit.min) || constants_1.MIN_RADIUS)) }) })] })), (isOnlyMap || showMap) && ((0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, style: { position: "relative", marginTop: "16px" }, children: (0, jsx_runtime_1.jsx)(AWING_1.GoogleMap, { defaultLocation: { lat: (marker === null || marker === void 0 ? void 0 : marker.latitude) || 0, lng: (marker === null || marker === void 0 ? void 0 : marker.longitude) || 0 }, onUpdateLocation: onGoongMapSelect, apiKey: configs.GOOGLE_MAP_KEY, geofenceRadius: radius ? Number(radius) : 0 }) }))] })] }));
|
|
59
59
|
}
|
|
60
60
|
exports.default = Component;
|
|
@@ -161,7 +161,7 @@ var BasicDataForm = function (props) {
|
|
|
161
161
|
width: '100%',
|
|
162
162
|
}, children: actions }))] })), (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, spacing: 2, children: fields.map(function (fieldDef, index) {
|
|
163
163
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
164
|
-
var fieldName = fieldDef.fieldName, _t = fieldDef.type, type = _t === void 0 ? 'text' : _t, checkValid = fieldDef.checkValid, options = fieldDef.options, loading = fieldDef.loading, customeFieldChange = fieldDef.customeFieldChange, AsynchronousAutocompleteProps = fieldDef.AsynchronousAutocompleteProps, SearchProps = fieldDef.SearchProps, defaultValue = fieldDef.defaultValue, value = fieldDef.value, other = __rest(fieldDef, ["fieldName", "type", "checkValid", "options", "loading", "customeFieldChange", "AsynchronousAutocompleteProps", "SearchProps", "defaultValue", "value"]);
|
|
164
|
+
var fieldName = fieldDef.fieldName, _t = fieldDef.type, type = _t === void 0 ? 'text' : _t, checkValid = fieldDef.checkValid, options = fieldDef.options, loading = fieldDef.loading, customeFieldChange = fieldDef.customeFieldChange, AsynchronousAutocompleteProps = fieldDef.AsynchronousAutocompleteProps, AutocompleteBasicProps = fieldDef.AutocompleteBasicProps, SearchProps = fieldDef.SearchProps, defaultValue = fieldDef.defaultValue, value = fieldDef.value, other = __rest(fieldDef, ["fieldName", "type", "checkValid", "options", "loading", "customeFieldChange", "AsynchronousAutocompleteProps", "AutocompleteBasicProps", "SearchProps", "defaultValue", "value"]);
|
|
165
165
|
var fieldValue = value !== null && value !== void 0 ? value : currentObj[fieldName];
|
|
166
166
|
var showError = currentValid[fieldName] !== undefined &&
|
|
167
167
|
!currentValid[fieldName];
|
|
@@ -191,7 +191,7 @@ var BasicDataForm = function (props) {
|
|
|
191
191
|
.endAdornment] })) }), error: showError, helperText: showError
|
|
192
192
|
? (_a = fieldDef.helperText) !== null && _a !== void 0 ? _a : t('Common.InvalidData')
|
|
193
193
|
: '' })));
|
|
194
|
-
} }, index));
|
|
194
|
+
}, disableClearable: AutocompleteBasicProps === null || AutocompleteBasicProps === void 0 ? void 0 : AutocompleteBasicProps.disableClearable }, index));
|
|
195
195
|
break;
|
|
196
196
|
case 'checkbox':
|
|
197
197
|
currentField = ((0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, required: fieldDef.required, children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { id: fieldName, name: fieldName, checked: fieldValue, onChange: function (event) {
|
|
@@ -219,7 +219,7 @@ var BasicDataForm = function (props) {
|
|
|
219
219
|
} }, fieldDef.DateProps), fieldName));
|
|
220
220
|
break;
|
|
221
221
|
case 'date-range':
|
|
222
|
-
currentField = ((0, jsx_runtime_1.jsx)(DateRangePicker_1.default, __assign({ variant: "outlined", textFieldProps: {
|
|
222
|
+
currentField = ((0, jsx_runtime_1.jsx)(DateRangePicker_1.default, __assign({ required: fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.required, variant: "outlined", textFieldProps: {
|
|
223
223
|
fullWidth: true,
|
|
224
224
|
}, value: {
|
|
225
225
|
startDate: (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue[0]) || null,
|
|
@@ -37,6 +37,9 @@ export interface BasicFieldDefinition extends BaseTextFieldProps {
|
|
|
37
37
|
*/
|
|
38
38
|
customeFieldChange?(fieldValue: any): DataObject;
|
|
39
39
|
AsynchronousAutocompleteProps?: AsynchronousAutocompleteProps;
|
|
40
|
+
AutocompleteBasicProps?: {
|
|
41
|
+
disableClearable?: boolean;
|
|
42
|
+
};
|
|
40
43
|
SearchProps?: {
|
|
41
44
|
searchResult?: any;
|
|
42
45
|
error: boolean;
|
|
@@ -144,7 +144,7 @@ var defaultProps = {
|
|
|
144
144
|
};
|
|
145
145
|
var DateRangePickerWrapper = function (props) {
|
|
146
146
|
var classes = useStyles();
|
|
147
|
-
var value = props.value, error = props.error, helperText = props.helperText, _a = props.autoFocus, autoFocus = _a === void 0 ? false : _a, _b = props.autoFocusEndDate, autoFocusEndDate = _b === void 0 ? false : _b, _c = props.initialStartDate, initialStartDate = _c === void 0 ? null : _c, _d = props.initialEndDate, initialEndDate = _d === void 0 ? null : _d, _e = props.callback, callback = _e === void 0 ? function () { } : _e, _f = props.label, label = _f === void 0 ? null : _f, _g = props.isShowCalendarInfo, isShowCalendarInfo = _g === void 0 ? false : _g, variant = props.variant, openDirection = props.openDirection, _h = props.isDayBlocked, isDayBlocked = _h === void 0 ? function (day) { return false; } : _h, _j = props.handleValid, handleValid = _j === void 0 ? function () { } : _j, _k = props.handleDateRangePopover, handleDateRangePopover = _k === void 0 ? function () { } : _k, disableHelperText = props.disableHelperText, _l = props.isFutureDate, isFutureDate = _l === void 0 ? false : _l;
|
|
147
|
+
var value = props.value, error = props.error, helperText = props.helperText, _a = props.autoFocus, autoFocus = _a === void 0 ? false : _a, _b = props.autoFocusEndDate, autoFocusEndDate = _b === void 0 ? false : _b, _c = props.initialStartDate, initialStartDate = _c === void 0 ? null : _c, _d = props.initialEndDate, initialEndDate = _d === void 0 ? null : _d, _e = props.callback, callback = _e === void 0 ? function () { } : _e, _f = props.label, label = _f === void 0 ? null : _f, _g = props.isShowCalendarInfo, isShowCalendarInfo = _g === void 0 ? false : _g, variant = props.variant, openDirection = props.openDirection, _h = props.isDayBlocked, isDayBlocked = _h === void 0 ? function (day) { return false; } : _h, _j = props.handleValid, handleValid = _j === void 0 ? function () { } : _j, _k = props.handleDateRangePopover, handleDateRangePopover = _k === void 0 ? function () { } : _k, disableHelperText = props.disableHelperText, _l = props.isFutureDate, isFutureDate = _l === void 0 ? false : _l, _m = props.required, required = _m === void 0 ? false : _m;
|
|
148
148
|
var initialFocusedInput = null;
|
|
149
149
|
if (autoFocus) {
|
|
150
150
|
initialFocusedInput = constants_1.START_DATE;
|
|
@@ -152,12 +152,12 @@ var DateRangePickerWrapper = function (props) {
|
|
|
152
152
|
else if (autoFocusEndDate) {
|
|
153
153
|
initialFocusedInput = constants_1.END_DATE;
|
|
154
154
|
}
|
|
155
|
-
var
|
|
156
|
-
var
|
|
157
|
-
var
|
|
158
|
-
var
|
|
159
|
-
var
|
|
160
|
-
var
|
|
155
|
+
var _o = (0, react_1.useState)(initialFocusedInput), focusedInput = _o[0], setFocusedInput = _o[1];
|
|
156
|
+
var _p = (0, react_1.useState)(initialStartDate), startDate = _p[0], setStartDate = _p[1];
|
|
157
|
+
var _q = (0, react_1.useState)(initialEndDate), endDate = _q[0], setEndDate = _q[1];
|
|
158
|
+
var _r = (0, react_1.useState)(true), isValid = _r[0], setIsValid = _r[1];
|
|
159
|
+
var _s = (0, react_1.useState)("".concat(moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate).format('DD/MM/YYYY'), " - ").concat(moment(value ? value === null || value === void 0 ? void 0 : value.endDate : endDate).format('DD/MM/YYYY'))), inputValue = _s[0], setInputValue = _s[1];
|
|
160
|
+
var _t = (0, react_i18next_1.useTranslation)(), i18n = _t.i18n, t = _t.t;
|
|
161
161
|
var momentLanguage = (0, react_1.useMemo)(function () { var _a, _b; return ((_b = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.language) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[0]) || 'en'; }, [i18n.language]);
|
|
162
162
|
(0, react_1.useEffect)(function () {
|
|
163
163
|
if (value !== undefined) {
|
|
@@ -330,8 +330,9 @@ var DateRangePickerWrapper = function (props) {
|
|
|
330
330
|
'isDayBlocked',
|
|
331
331
|
'handleValid',
|
|
332
332
|
'handleDateRangePopover',
|
|
333
|
+
'required',
|
|
333
334
|
]);
|
|
334
|
-
var
|
|
335
|
+
var _u = react_1.default.useState(null), anchorElPopover = _u[0], setAnchorElPopover = _u[1];
|
|
335
336
|
var openPopper = Boolean(anchorElPopover);
|
|
336
337
|
var id = openPopper ? 'datePicker-popper' : undefined;
|
|
337
338
|
var popperRef = react_1.default.useRef();
|
|
@@ -352,7 +353,7 @@ var DateRangePickerWrapper = function (props) {
|
|
|
352
353
|
};
|
|
353
354
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_input_mask_1.default, { mask: "99/99/9999 - 99/99/9999", maskplaceholder: "dd/mm/yyyy - dd/mm/yyyy", value: inputValue, onChange: handleChangeInput, disabled: props.disabled, children: function () {
|
|
354
355
|
var _a;
|
|
355
|
-
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ "aria-describedby": id, variant: variant, label: label, error: !isValid || error, helperText: !disableHelperText
|
|
356
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ required: required, "aria-describedby": id, variant: variant, label: label, error: !isValid || error, helperText: !disableHelperText
|
|
356
357
|
? error
|
|
357
358
|
? helperText || t('Common.InvalidData')
|
|
358
359
|
: !isValid
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IGoogleMapProps } from './interface';
|
|
2
|
-
declare const GGMap: ({ defaultLocation, onUpdateLocation, apiKey,
|
|
2
|
+
declare const GGMap: ({ defaultLocation, onUpdateLocation, apiKey, geofenceRadius, sxMap, isDisplayAutoComplete, isTypeTracking, markerPositions, zoomCustomed }: IGoogleMapProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default GGMap;
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
@@ -7,25 +30,53 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
30
|
var material_1 = require("@mui/material");
|
|
8
31
|
var api_1 = require("@react-google-maps/api");
|
|
9
32
|
var lodash_1 = __importDefault(require("lodash"));
|
|
10
|
-
var react_1 = require("react");
|
|
33
|
+
var react_1 = __importStar(require("react"));
|
|
11
34
|
var react_i18next_1 = require("react-i18next");
|
|
35
|
+
var utils_1 = require("./utils");
|
|
12
36
|
var mapContainerStyle = {
|
|
13
37
|
height: '320px',
|
|
14
38
|
width: '100%',
|
|
15
39
|
};
|
|
16
40
|
var libraries = ['places'];
|
|
41
|
+
var stylesDefault = {
|
|
42
|
+
position: 'relative',
|
|
43
|
+
'& .pac-container.pac-logo': {
|
|
44
|
+
top: "55px!important",
|
|
45
|
+
left: "0!important",
|
|
46
|
+
}
|
|
47
|
+
};
|
|
17
48
|
var GGMap = function (_a) {
|
|
18
|
-
var _b, _c;
|
|
19
|
-
var defaultLocation = _a.defaultLocation, onUpdateLocation = _a.onUpdateLocation, apiKey = _a.apiKey, markerPosition = _a.markerPosition, geofenceRadius = _a.geofenceRadius;
|
|
49
|
+
var defaultLocation = _a.defaultLocation, onUpdateLocation = _a.onUpdateLocation, apiKey = _a.apiKey, geofenceRadius = _a.geofenceRadius, sxMap = _a.sxMap, _b = _a.isDisplayAutoComplete, isDisplayAutoComplete = _b === void 0 ? false : _b, _c = _a.isTypeTracking, isTypeTracking = _c === void 0 ? false : _c, markerPositions = _a.markerPositions, zoomCustomed = _a.zoomCustomed;
|
|
20
50
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
21
51
|
var _d = (0, react_1.useState)(), map = _d[0], setMap = _d[1];
|
|
22
52
|
var _e = (0, react_1.useState)(''), error = _e[0], setError = _e[1];
|
|
23
53
|
var autocompleteRef = (0, react_1.useRef)(null);
|
|
24
54
|
var boxRef = (0, react_1.useRef)(null);
|
|
25
|
-
var
|
|
55
|
+
var makerRefs = (0, react_1.useRef)([]);
|
|
56
|
+
var _f = (0, react_1.useState)(zoomCustomed || 5), zoom = _f[0], setZoom = _f[1];
|
|
26
57
|
var onLoad = function (autocomplete) {
|
|
27
58
|
autocompleteRef.current = autocomplete;
|
|
28
59
|
};
|
|
60
|
+
var markerConvert = (0, react_1.useMemo)(function () {
|
|
61
|
+
var _a;
|
|
62
|
+
var coordMap = (_a = markerPositions === null || markerPositions === void 0 ? void 0 : markerPositions.reduce(function (acc, _a) {
|
|
63
|
+
var longitude = _a.longitude, latitude = _a.latitude;
|
|
64
|
+
var key = "".concat(longitude, ",").concat(latitude);
|
|
65
|
+
if (acc[key]) {
|
|
66
|
+
acc[key].count += 1;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
acc[key] = { longitude: longitude, latitude: latitude, count: 1 };
|
|
70
|
+
}
|
|
71
|
+
return acc;
|
|
72
|
+
}, {})) !== null && _a !== void 0 ? _a : {};
|
|
73
|
+
return Object.values(coordMap).map(function (item, index, arr) {
|
|
74
|
+
var _a;
|
|
75
|
+
item.radius = ((_a = item.count) !== null && _a !== void 0 ? _a : 0) / arr.reduce(function (acc, item) { var _a; return acc + ((_a = item === null || item === void 0 ? void 0 : item.count) !== null && _a !== void 0 ? _a : 0); }, 0) * (Math.pow(2, 10 - Math.max(zoom, 4))) * 8000;
|
|
76
|
+
return item;
|
|
77
|
+
});
|
|
78
|
+
// Convert the object to an array
|
|
79
|
+
}, [markerPositions, zoom]);
|
|
29
80
|
var onPlaceChanged = function () {
|
|
30
81
|
var _a, _b, _c, _d;
|
|
31
82
|
if (autocompleteRef.current !== null) {
|
|
@@ -33,7 +84,7 @@ var GGMap = function (_a) {
|
|
|
33
84
|
if (place.geometry) {
|
|
34
85
|
var newLat = (_b = (_a = place === null || place === void 0 ? void 0 : place.geometry) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.lat();
|
|
35
86
|
var newLng = (_d = (_c = place === null || place === void 0 ? void 0 : place.geometry) === null || _c === void 0 ? void 0 : _c.location) === null || _d === void 0 ? void 0 : _d.lng();
|
|
36
|
-
onUpdateLocation({
|
|
87
|
+
onUpdateLocation && onUpdateLocation({
|
|
37
88
|
latitude: newLat !== null && newLat !== void 0 ? newLat : 0,
|
|
38
89
|
longitude: newLng !== null && newLng !== void 0 ? newLng : 0,
|
|
39
90
|
});
|
|
@@ -45,44 +96,13 @@ var GGMap = function (_a) {
|
|
|
45
96
|
console.log('Autocomplete is not loaded yet!');
|
|
46
97
|
}
|
|
47
98
|
};
|
|
48
|
-
var onLoadMap = function (mapInstance) {
|
|
99
|
+
var onLoadMap = react_1.default.useCallback(function (mapInstance) {
|
|
49
100
|
setMap(mapInstance);
|
|
50
|
-
};
|
|
51
|
-
//Lấy geo fencing
|
|
52
|
-
// const getDistance = (
|
|
53
|
-
// lat1: number,
|
|
54
|
-
// lon1: number,
|
|
55
|
-
// lat2: number,
|
|
56
|
-
// lon2: number
|
|
57
|
-
// ) => {
|
|
58
|
-
// const R = 6371e3; // Radius of the Earth in meters
|
|
59
|
-
// const φ1 = (lat1 * Math.PI) / 180;
|
|
60
|
-
// const φ2 = (lat2 * Math.PI) / 180;
|
|
61
|
-
// const Δφ = ((lat2 - lat1) * Math.PI) / 180;
|
|
62
|
-
// const Δλ = ((lon2 - lon1) * Math.PI) / 180;
|
|
63
|
-
// const a =
|
|
64
|
-
// Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
|
|
65
|
-
// Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
|
|
66
|
-
// const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
67
|
-
// const distance = R * c; // Distance in meters
|
|
68
|
-
// return distance;
|
|
69
|
-
// };
|
|
101
|
+
}, []);
|
|
70
102
|
//Lấy vị trí hiện tại của người dùng
|
|
71
103
|
var getCurrentLocation = function () {
|
|
72
|
-
var handleLocationGeoFencing = function (position) {
|
|
73
|
-
var userLat = position.coords.latitude;
|
|
74
|
-
var userLng = position.coords.longitude;
|
|
75
|
-
// const distance = getDistance(
|
|
76
|
-
// userLat,
|
|
77
|
-
// userLng,
|
|
78
|
-
// markerPosition.lat,
|
|
79
|
-
// markerPosition.lng
|
|
80
|
-
// );
|
|
81
|
-
// console.log("distance", distance);
|
|
82
|
-
};
|
|
83
104
|
var showPosition = function (position) {
|
|
84
|
-
|
|
85
|
-
onUpdateLocation({
|
|
105
|
+
onUpdateLocation && onUpdateLocation({
|
|
86
106
|
latitude: position.coords.latitude,
|
|
87
107
|
longitude: position.coords.longitude,
|
|
88
108
|
});
|
|
@@ -110,53 +130,106 @@ var GGMap = function (_a) {
|
|
|
110
130
|
setError('Geolocation is not supported by this browser.');
|
|
111
131
|
}
|
|
112
132
|
};
|
|
113
|
-
var onMapClick = function (e) {
|
|
133
|
+
var onMapClick = react_1.default.useCallback(function (e) {
|
|
114
134
|
var _a, _b, _c, _d;
|
|
115
|
-
onUpdateLocation({
|
|
135
|
+
onUpdateLocation && onUpdateLocation({
|
|
116
136
|
latitude: (_b = (_a = e === null || e === void 0 ? void 0 : e.latLng) === null || _a === void 0 ? void 0 : _a.lat()) !== null && _b !== void 0 ? _b : 0,
|
|
117
137
|
longitude: (_d = (_c = e === null || e === void 0 ? void 0 : e.latLng) === null || _c === void 0 ? void 0 : _c.lng()) !== null && _d !== void 0 ? _d : 0,
|
|
118
138
|
});
|
|
119
|
-
};
|
|
139
|
+
}, []);
|
|
120
140
|
(0, react_1.useEffect)(function () {
|
|
121
141
|
if (lodash_1.default.isNil(defaultLocation) || defaultLocation.lat === 0 || defaultLocation.lng === 0) {
|
|
122
142
|
getCurrentLocation();
|
|
123
143
|
}
|
|
124
144
|
}, [defaultLocation]);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
145
|
+
(0, react_1.useEffect)(function () {
|
|
146
|
+
if (map) {
|
|
147
|
+
makerRefs.current.forEach(function (marker) {
|
|
148
|
+
marker.setMap(null);
|
|
149
|
+
});
|
|
150
|
+
makerRefs.current = markerConvert.map(function (item) {
|
|
151
|
+
var _a, _b;
|
|
152
|
+
var maker = new google.maps.Circle({
|
|
153
|
+
center: { lat: (_a = item.latitude) !== null && _a !== void 0 ? _a : 0, lng: (_b = item.longitude) !== null && _b !== void 0 ? _b : 0 },
|
|
154
|
+
radius: item.radius,
|
|
155
|
+
strokeColor: '#4285F4',
|
|
156
|
+
strokeOpacity: 0.8,
|
|
157
|
+
strokeWeight: 2,
|
|
158
|
+
fillColor: "#4285F4",
|
|
159
|
+
fillOpacity: 0.35,
|
|
160
|
+
});
|
|
161
|
+
maker.setMap(map);
|
|
162
|
+
return maker;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
console.log(markerConvert);
|
|
166
|
+
}, [markerConvert]);
|
|
167
|
+
var handleZoom = (0, react_1.useCallback)(function (zoom) {
|
|
168
|
+
setZoom(zoom);
|
|
169
|
+
}, []);
|
|
170
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: sxMap ? sxMap : stylesDefault, ref: boxRef, children: (0, jsx_runtime_1.jsxs)(api_1.LoadScript, { googleMapsApiKey: apiKey || '', libraries: libraries, children: [!isDisplayAutoComplete &&
|
|
171
|
+
((0, jsx_runtime_1.jsx)(api_1.Autocomplete, { onPlaceChanged: onPlaceChanged, onLoad: onLoad, children: (0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: t('Common.PlaceHolderLocation'), onFocus: function () {
|
|
172
|
+
var _a;
|
|
173
|
+
var ggSuggest = document.querySelector('.pac-container.pac-logo');
|
|
174
|
+
if (ggSuggest) {
|
|
175
|
+
(_a = boxRef.current) === null || _a === void 0 ? void 0 : _a.append(ggSuggest);
|
|
176
|
+
}
|
|
177
|
+
}, style: {
|
|
178
|
+
boxSizing: "border-box",
|
|
179
|
+
border: "1px solid transparent",
|
|
180
|
+
width: "378px",
|
|
181
|
+
height: "40px",
|
|
182
|
+
padding: "0 12px",
|
|
183
|
+
borderRadius: "3px",
|
|
184
|
+
boxShadow: "0 2px 6px rgba(0, 0, 0, 0.3)",
|
|
185
|
+
fontSize: "14px",
|
|
186
|
+
outline: "none",
|
|
187
|
+
textOverflow: "ellipses",
|
|
188
|
+
position: 'inherit',
|
|
189
|
+
right: '3%',
|
|
190
|
+
margin: '10px 0',
|
|
191
|
+
zIndex: 99,
|
|
192
|
+
top: '50px',
|
|
193
|
+
} }) })), !isTypeTracking ? (0, jsx_runtime_1.jsx)(MaprenderWithoutTracking, { onLoadMap: onLoadMap, onMapClick: onMapClick, onZoomChanged: handleZoom, defaultLocation: defaultLocation !== null && defaultLocation !== void 0 ? defaultLocation : { lat: 21.0063107, lng: 105.8279467 }, geofenceRadius: geofenceRadius !== null && geofenceRadius !== void 0 ? geofenceRadius : 0, zoomCustomed: zoomCustomed !== null && zoomCustomed !== void 0 ? zoomCustomed : 10 }) : (0, jsx_runtime_1.jsx)(Maprender, { onLoadMap: onLoadMap, onMapClick: onMapClick, onZoomChanged: handleZoom })] }) }));
|
|
161
194
|
};
|
|
162
195
|
exports.default = GGMap;
|
|
196
|
+
var Maprender = react_1.default.memo(function (_a) {
|
|
197
|
+
var onLoadMap = _a.onLoadMap, onMapClick = _a.onMapClick, onZoomChanged = _a.onZoomChanged;
|
|
198
|
+
var mapInstance = (0, react_1.useRef)(null);
|
|
199
|
+
return (0, jsx_runtime_1.jsx)(api_1.GoogleMap, { id: "map", mapContainerStyle: { width: "100%", height: "".concat(521, "px") }, zoom: 3, center: {
|
|
200
|
+
lat: 21.0063107,
|
|
201
|
+
lng: 105.8279467
|
|
202
|
+
}, onZoomChanged: function () {
|
|
203
|
+
var _a, _b;
|
|
204
|
+
onZoomChanged((_b = (_a = mapInstance.current) === null || _a === void 0 ? void 0 : _a.getZoom()) !== null && _b !== void 0 ? _b : 0);
|
|
205
|
+
}, onLoad: function (instance) {
|
|
206
|
+
mapInstance.current = instance;
|
|
207
|
+
onLoadMap(instance);
|
|
208
|
+
}, onClick: onMapClick, options: {
|
|
209
|
+
disableDefaultUI: true,
|
|
210
|
+
styles: utils_1.mapStyles,
|
|
211
|
+
zoomControl: true,
|
|
212
|
+
streetViewControl: false,
|
|
213
|
+
mapTypeControl: false,
|
|
214
|
+
fullscreenControl: false,
|
|
215
|
+
minZoom: 2,
|
|
216
|
+
maxZoom: 13,
|
|
217
|
+
} });
|
|
218
|
+
});
|
|
219
|
+
var MaprenderWithoutTracking = react_1.default.memo(function (_a) {
|
|
220
|
+
var onLoadMap = _a.onLoadMap, onMapClick = _a.onMapClick, onZoomChanged = _a.onZoomChanged, defaultLocation = _a.defaultLocation, geofenceRadius = _a.geofenceRadius, zoomCustomed = _a.zoomCustomed;
|
|
221
|
+
var mapInstance = (0, react_1.useRef)(null);
|
|
222
|
+
return (0, jsx_runtime_1.jsx)(api_1.GoogleMap, { id: "map", mapContainerStyle: mapContainerStyle, zoom: zoomCustomed !== null && zoomCustomed !== void 0 ? zoomCustomed : 10, center: defaultLocation, onZoomChanged: function () {
|
|
223
|
+
var _a, _b;
|
|
224
|
+
onZoomChanged((_b = (_a = mapInstance.current) === null || _a === void 0 ? void 0 : _a.getZoom()) !== null && _b !== void 0 ? _b : 0);
|
|
225
|
+
}, onLoad: function (instance) {
|
|
226
|
+
mapInstance.current = instance;
|
|
227
|
+
onLoadMap(instance);
|
|
228
|
+
}, onClick: onMapClick, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(api_1.Marker, { position: defaultLocation !== null && defaultLocation !== void 0 ? defaultLocation : { lat: 21.0063107, lng: 105.8279467 } }), (0, jsx_runtime_1.jsx)(api_1.Circle, { center: defaultLocation, radius: geofenceRadius, options: {
|
|
229
|
+
fillColor: 'red',
|
|
230
|
+
fillOpacity: 0.2,
|
|
231
|
+
strokeColor: 'red',
|
|
232
|
+
strokeOpacity: 1,
|
|
233
|
+
strokeWeight: 2,
|
|
234
|
+
} })] }) });
|
|
235
|
+
});
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
import { DataObject } from "../../AWING/interface";
|
|
1
2
|
export interface IGoogleMapProps {
|
|
2
3
|
defaultLocation?: {
|
|
3
4
|
lat: number;
|
|
4
5
|
lng: number;
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
-
latitude: number;
|
|
8
|
-
longitude: number;
|
|
9
|
-
};
|
|
10
|
-
onUpdateLocation: (newValue: {
|
|
7
|
+
onUpdateLocation?: (newValue: {
|
|
11
8
|
latitude: number;
|
|
12
9
|
longitude: number;
|
|
13
10
|
}) => void;
|
|
14
11
|
apiKey: string;
|
|
15
12
|
geofenceRadius?: number;
|
|
13
|
+
sxMap?: DataObject;
|
|
14
|
+
isDisplayAutoComplete?: boolean;
|
|
15
|
+
isTypeTracking?: boolean;
|
|
16
|
+
markerPositions?: {
|
|
17
|
+
longitude: number | null;
|
|
18
|
+
latitude: number | null;
|
|
19
|
+
}[];
|
|
20
|
+
zoomCustomed?: number;
|
|
16
21
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const mapStyles: ({
|
|
2
|
+
elementType: string;
|
|
3
|
+
stylers: {
|
|
4
|
+
color: string;
|
|
5
|
+
}[];
|
|
6
|
+
featureType?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
elementType: string;
|
|
9
|
+
stylers: {
|
|
10
|
+
visibility: string;
|
|
11
|
+
}[];
|
|
12
|
+
featureType?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
featureType: string;
|
|
15
|
+
elementType: string;
|
|
16
|
+
stylers: {
|
|
17
|
+
color: string;
|
|
18
|
+
}[];
|
|
19
|
+
} | {
|
|
20
|
+
featureType: string;
|
|
21
|
+
stylers: {
|
|
22
|
+
visibility: string;
|
|
23
|
+
}[];
|
|
24
|
+
elementType?: undefined;
|
|
25
|
+
})[];
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapStyles = void 0;
|
|
4
|
+
exports.mapStyles = [
|
|
5
|
+
{
|
|
6
|
+
"elementType": "geometry",
|
|
7
|
+
"stylers": [
|
|
8
|
+
{
|
|
9
|
+
"color": "#dadce0"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"elementType": "labels.icon",
|
|
15
|
+
"stylers": [
|
|
16
|
+
{
|
|
17
|
+
"visibility": "off"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"elementType": "labels.text.fill",
|
|
23
|
+
"stylers": [
|
|
24
|
+
{
|
|
25
|
+
"color": "#212225"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"elementType": "labels.text.stroke",
|
|
31
|
+
"stylers": [
|
|
32
|
+
{
|
|
33
|
+
"color": "#dadce0"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"featureType": "administrative",
|
|
39
|
+
"elementType": "geometry",
|
|
40
|
+
"stylers": [
|
|
41
|
+
{
|
|
42
|
+
"color": "#f7f9fa"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"featureType": "administrative.country",
|
|
48
|
+
"elementType": "labels.text.fill",
|
|
49
|
+
"stylers": [
|
|
50
|
+
{
|
|
51
|
+
"color": "#80868b"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"featureType": "administrative.land_parcel",
|
|
57
|
+
"stylers": [
|
|
58
|
+
{
|
|
59
|
+
"visibility": "off"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"featureType": "administrative.locality",
|
|
65
|
+
"elementType": "labels.text.fill",
|
|
66
|
+
"stylers": [
|
|
67
|
+
{
|
|
68
|
+
"color": "#898989"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"featureType": "poi",
|
|
74
|
+
"elementType": "labels.text.fill",
|
|
75
|
+
"stylers": [
|
|
76
|
+
{
|
|
77
|
+
"color": "#212225"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"featureType": "poi.park",
|
|
83
|
+
"elementType": "labels.text.fill",
|
|
84
|
+
"stylers": [
|
|
85
|
+
{
|
|
86
|
+
"color": "#616161"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"featureType": "road",
|
|
92
|
+
"elementType": "geometry.fill",
|
|
93
|
+
"stylers": [
|
|
94
|
+
{
|
|
95
|
+
"color": "#c8c8c8"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"featureType": "road",
|
|
101
|
+
"elementType": "labels.text.fill",
|
|
102
|
+
"stylers": [
|
|
103
|
+
{
|
|
104
|
+
"color": "#8a8a8a"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"featureType": "transit",
|
|
110
|
+
"elementType": "labels.text.fill",
|
|
111
|
+
"stylers": [
|
|
112
|
+
{
|
|
113
|
+
"color": "#212225"
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"featureType": "water",
|
|
119
|
+
"elementType": "geometry",
|
|
120
|
+
"stylers": [
|
|
121
|
+
{
|
|
122
|
+
"color": "#f8f9fa"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"featureType": "water",
|
|
128
|
+
"elementType": "labels.text.fill",
|
|
129
|
+
"stylers": [
|
|
130
|
+
{
|
|
131
|
+
"color": "#f8f9fa"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
];
|
|
@@ -82,8 +82,9 @@ var Drawer = function (props) {
|
|
|
82
82
|
}, 700);
|
|
83
83
|
closeDrawer((typeof state === 'string' && state) ? state : CloseAction.Reload);
|
|
84
84
|
})
|
|
85
|
-
.catch(function () {
|
|
86
|
-
|
|
85
|
+
.catch(function (e) {
|
|
86
|
+
if (e)
|
|
87
|
+
snackbar('error');
|
|
87
88
|
})
|
|
88
89
|
.finally(function () {
|
|
89
90
|
setLoading(false);
|
|
@@ -512,7 +512,9 @@
|
|
|
512
512
|
"View": "Impression",
|
|
513
513
|
"Authentication": "Engagement / Spot",
|
|
514
514
|
"Click": "Click"
|
|
515
|
-
}
|
|
515
|
+
},
|
|
516
|
+
"Wizard": "Wizard",
|
|
517
|
+
"SwitchToProfessionalEditMode": "You have switched to Professional Edit Mode. If you agree, the data will be permanently changed, and you will no longer be able to revert to Wizard Edit Mode. Are you sure you want to proceed?"
|
|
516
518
|
},
|
|
517
519
|
"DirectoryManagement": {
|
|
518
520
|
"DirectoryName": "Directory Name",
|
|
@@ -496,7 +496,9 @@
|
|
|
496
496
|
"View": "Impression",
|
|
497
497
|
"Authentication": "Engagement / Spot",
|
|
498
498
|
"Click": "Click"
|
|
499
|
-
}
|
|
499
|
+
},
|
|
500
|
+
"Wizard": "Wizard",
|
|
501
|
+
"SwitchToProfessionalEditMode": "Bạn đã chuyển sang chế độ Chỉnh sửa chuyên nghiệp. Nếu bạn đồng ý, dữ liệu sẽ bị thay đổi và bạn sẽ không thể quay lại chế độ chỉnh sửa bằng Wizard. Bạn có chắc chắn muốn tiếp tục?"
|
|
500
502
|
},
|
|
501
503
|
"TemplateManagement": {
|
|
502
504
|
"Create": "Tạo mới template",
|