awing-library 2.1.194-dev → 2.1.196-dev
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.
|
@@ -60,6 +60,7 @@ var usePath_1 = __importDefault(require("../../../Commons/Hooks/usePath"));
|
|
|
60
60
|
var Wrapper_1 = __importDefault(require("../../../AWING/HOC/Wrapper"));
|
|
61
61
|
var TabStatistic_1 = __importDefault(require("./TabStatistic"));
|
|
62
62
|
var Enum_2 = require("../../../ACM-AXN/Common/Enum");
|
|
63
|
+
var Context_1 = require("../../../Context");
|
|
63
64
|
var route = [
|
|
64
65
|
Constant_1.Constants.CAMPAIGN_INFORMATION,
|
|
65
66
|
Constant_1.Constants.CAMPAIGN_SUBCAMPAIGN,
|
|
@@ -75,6 +76,7 @@ var CreateOrEdit = function (props) {
|
|
|
75
76
|
var matchPath = (0, usePath_1.default)();
|
|
76
77
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
77
78
|
var _c = (0, Hooks_1.default)(), service = _c.service, otherProps = __rest(_c, ["service"]);
|
|
79
|
+
var confirm = (0, Context_1.useAwing)().appHelper.confirm;
|
|
78
80
|
var _d = (0, recoil_1.useRecoilState)(Recoils_1.campaignModelState), campaignData = _d[0], setCampaignData = _d[1];
|
|
79
81
|
var setCampaignPages = (0, recoil_1.useSetRecoilState)(atoms_1.campaignPageIdState);
|
|
80
82
|
var setDirectories = (0, recoil_1.useSetRecoilState)(Recoils_1.directoriesState);
|
|
@@ -84,14 +86,15 @@ var CreateOrEdit = function (props) {
|
|
|
84
86
|
var setCreate = (0, recoil_1.useSetRecoilState)(Recoils_1.isCreateState);
|
|
85
87
|
var _f = (0, react_1.useState)(), fullPlaces = _f[0], setFullPlaces = _f[1];
|
|
86
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];
|
|
87
90
|
var childRefWizard = (0, react_1.useRef)(null);
|
|
88
91
|
var tabValid = {
|
|
89
92
|
tabInfomationValid: (0, recoil_1.useRecoilValue)(Recoils_1.tabInfomationValidState),
|
|
90
93
|
tabSubCampaignValid: (0, recoil_1.useRecoilValue)(Recoils_1.tabSubCampaignValidState),
|
|
91
94
|
tabPartnerValid: (0, recoil_1.useRecoilValue)(Recoils_1.tabPartnerValidState),
|
|
92
95
|
};
|
|
93
|
-
var
|
|
94
|
-
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];
|
|
95
98
|
var componentStatus = (0, react_1.useMemo)(function () {
|
|
96
99
|
return location.pathname.includes(Constant_1.Constants.CAMPAIGN_DETAIL) &&
|
|
97
100
|
!!campaignId
|
|
@@ -137,7 +140,7 @@ var CreateOrEdit = function (props) {
|
|
|
137
140
|
}
|
|
138
141
|
}, [tabName]);
|
|
139
142
|
var getTabs = function () {
|
|
140
|
-
return !(campaignData.campaignWizard && (props === null || props === void 0 ? void 0 : props.quickWizard))
|
|
143
|
+
return !(campaignData.campaignWizard && !editModeWizard && (props === null || props === void 0 ? void 0 : props.quickWizard))
|
|
141
144
|
? [
|
|
142
145
|
{
|
|
143
146
|
label: t('Campaign.Info'),
|
|
@@ -184,7 +187,7 @@ var CreateOrEdit = function (props) {
|
|
|
184
187
|
], false).filter(function (tab) { return tab.isShow; });
|
|
185
188
|
},
|
|
186
189
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
187
|
-
[t, componentStatus, Constant_1.Constants, campaignData]);
|
|
190
|
+
[t, componentStatus, Constant_1.Constants, campaignData, editModeWizard]);
|
|
188
191
|
var handleChangeTab = function (_event, newValue) {
|
|
189
192
|
navigate((0, Router_1.generatePath)(matchPath, {
|
|
190
193
|
campaignId: campaignId,
|
|
@@ -247,7 +250,7 @@ var CreateOrEdit = function (props) {
|
|
|
247
250
|
};
|
|
248
251
|
var handleSubmit = function () {
|
|
249
252
|
var _a;
|
|
250
|
-
if (campaignData.campaignWizard && (props === null || props === void 0 ? void 0 : props.quickWizard)) {
|
|
253
|
+
if (campaignData.campaignWizard && !editModeWizard && (props === null || props === void 0 ? void 0 : props.quickWizard)) {
|
|
251
254
|
if (childRefWizard.current) {
|
|
252
255
|
return childRefWizard.current.onSubmit({
|
|
253
256
|
campaignPartner: campaignData.campaignPartner,
|
|
@@ -262,7 +265,7 @@ var CreateOrEdit = function (props) {
|
|
|
262
265
|
.flatMap(function (x) { return x.ads; }))) {
|
|
263
266
|
return Promise.reject(t('Campaign.CClassDuplicatePlace'));
|
|
264
267
|
}
|
|
265
|
-
var dataSubmit = __assign(__assign({}, campaignData), { campaignAttributes: campaignData.campaignAttributes.filter(Boolean) });
|
|
268
|
+
var dataSubmit = __assign(__assign({}, campaignData), { campaignAttributes: campaignData.campaignAttributes.filter(Boolean), campaignWizard: undefined });
|
|
266
269
|
if (!((_a = dataSubmit.campaignPartner) === null || _a === void 0 ? void 0 : _a.isSendApi)) {
|
|
267
270
|
delete dataSubmit.campaignPartner;
|
|
268
271
|
}
|
|
@@ -275,19 +278,24 @@ var CreateOrEdit = function (props) {
|
|
|
275
278
|
}
|
|
276
279
|
};
|
|
277
280
|
var handleDisableButtonSubmit = function () {
|
|
278
|
-
if (campaignData.campaignWizard && (props === null || props === void 0 ? void 0 : props.quickWizard)) {
|
|
281
|
+
if (campaignData.campaignWizard && !editModeWizard && (props === null || props === void 0 ? void 0 : props.quickWizard)) {
|
|
279
282
|
return validWizad;
|
|
280
283
|
}
|
|
281
284
|
return !readyForSubmit || !confirmExit;
|
|
282
285
|
};
|
|
283
286
|
var handleClose = function () {
|
|
284
|
-
if (campaignData.campaignWizard && (props === null || props === void 0 ? void 0 : props.quickWizard)) {
|
|
287
|
+
if (campaignData.campaignWizard && !editModeWizard && (props === null || props === void 0 ? void 0 : props.quickWizard)) {
|
|
285
288
|
if (childRefWizard.current) {
|
|
286
289
|
childRefWizard.current.resetData();
|
|
287
290
|
}
|
|
288
291
|
}
|
|
289
292
|
};
|
|
290
|
-
|
|
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).catch(reject); }, undefined, 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: {
|
|
291
299
|
display: 'flex',
|
|
292
300
|
flexDirection: 'column',
|
|
293
301
|
flexGrow: 1,
|
|
@@ -299,11 +307,12 @@ var CreateOrEdit = function (props) {
|
|
|
299
307
|
? !tabValid[tab === null || tab === void 0 ? void 0 : tab.valid]
|
|
300
308
|
: undefined, errContent: (0, jsx_runtime_1.jsx)("span", { style: {
|
|
301
309
|
marginLeft: '-5px',
|
|
302
|
-
}, children: "*" }) }) }, idx)); }) }) }), campaignData.campaignWizard &&
|
|
310
|
+
}, children: "*" }) }) }, idx)); }) }) }), campaignData.campaignWizard && !editModeWizard &&
|
|
303
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({
|
|
304
312
|
ref: childRefWizard,
|
|
305
313
|
onSubmitWizard: handleSubmit,
|
|
306
314
|
handleValidWizad: setValidWizad,
|
|
315
|
+
handleEditMode: setEditModeWizard,
|
|
307
316
|
sxEdit: {
|
|
308
317
|
display: value === '0'
|
|
309
318
|
? 'block'
|
|
@@ -138,7 +138,7 @@ var GGMap = function (_a) {
|
|
|
138
138
|
};
|
|
139
139
|
}, [markerPosition]);
|
|
140
140
|
var calculateRadius = function (currentZoom) {
|
|
141
|
-
return Math.max(100000 * Math.pow(2, 5 - currentZoom),
|
|
141
|
+
return Math.max(100000 * Math.pow(2, 5 - (currentZoom / 20)), 250);
|
|
142
142
|
};
|
|
143
143
|
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 &&
|
|
144
144
|
((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 () {
|
|
@@ -186,7 +186,7 @@ var GGMap = function (_a) {
|
|
|
186
186
|
} })] })
|
|
187
187
|
: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: markerConvert === null || markerConvert === void 0 ? void 0 : markerConvert.map(function (coordinates, index, positions) {
|
|
188
188
|
var _a, _b, _c;
|
|
189
|
-
return (0, jsx_runtime_1.jsx)(api_1.CircleF, { center: { lat: (_a = coordinates.latitude) !== null && _a !== void 0 ? _a : 0, lng: (_b = coordinates.longitude) !== null && _b !== void 0 ? _b : 0 }, radius: calculateRadius(zoom * ((
|
|
189
|
+
return (0, jsx_runtime_1.jsx)(api_1.CircleF, { center: { lat: (_a = coordinates.latitude) !== null && _a !== void 0 ? _a : 0, lng: (_b = coordinates.longitude) !== null && _b !== void 0 ? _b : 0 }, radius: calculateRadius(zoom * ((_c = coordinates === null || coordinates === void 0 ? void 0 : coordinates.count) !== null && _c !== void 0 ? _c : 0)), options: {
|
|
190
190
|
strokeColor: '#4285F4',
|
|
191
191
|
strokeOpacity: 0.8,
|
|
192
192
|
strokeWeight: 2,
|
|
@@ -513,7 +513,8 @@
|
|
|
513
513
|
"Authentication": "Engagement / Spot",
|
|
514
514
|
"Click": "Click"
|
|
515
515
|
},
|
|
516
|
-
"Wizard": "Wizard"
|
|
516
|
+
"Wizard": "Wizard",
|
|
517
|
+
"SwitchToProfessionalEditMode": "You have switched to Professional Edit Mode. If you save, 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?"
|
|
517
518
|
},
|
|
518
519
|
"DirectoryManagement": {
|
|
519
520
|
"DirectoryName": "Directory Name",
|
|
@@ -497,7 +497,8 @@
|
|
|
497
497
|
"Authentication": "Engagement / Spot",
|
|
498
498
|
"Click": "Click"
|
|
499
499
|
},
|
|
500
|
-
"Wizard": "Wizard"
|
|
500
|
+
"Wizard": "Wizard",
|
|
501
|
+
"SwitchToProfessionalEditMode": "Bạn đã chuyển sang chế độ Chỉnh sửa chuyên nghiệp. Nếu bạn lưu lại, 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?"
|
|
501
502
|
},
|
|
502
503
|
"TemplateManagement": {
|
|
503
504
|
"Create": "Tạo mới template",
|