awing-library 2.1.221-dev → 2.1.223-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.
- package/lib/ACM-AXN/Campaign/Container.js +6 -23
- package/lib/ACM-AXN/Campaign/Container.test.js +1 -3
- package/lib/ACM-AXN/Campaign/CreateOrEdit/Recoils.js +1 -2
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabApprove/index.test.js +2 -4
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/EditAds.js +5 -5
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/SubCampaignDetail.js +30 -33
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/SubCampaignDetail.test.js +3 -13
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/SubCampaignList.js +24 -7
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/index.js +1 -2
- package/lib/ACM-AXN/Campaign/CreateOrEdit/index.js +3 -3
- package/lib/ACM-AXN/Campaign/Enum.d.ts +7 -4
- package/lib/ACM-AXN/Campaign/Enum.js +10 -7
- package/lib/ACM-AXN/Campaign/Types.d.ts +2 -4
- package/lib/ACM-AXN/Campaign/Utils.js +1 -1
- package/lib/AWING/DataForm/DataInput.js +6 -7
- package/lib/AWING/DataForm/interface.d.ts +0 -1
- package/lib/translate/en/translation.json +6 -1
- package/lib/translate/id/translation.json +6 -1
- package/lib/translate/vi/translation.json +6 -1
- package/package.json +1 -1
|
@@ -63,7 +63,7 @@ var CampaignContainer = function () {
|
|
|
63
63
|
var getCampaign = (0, react_1.useCallback)(function (params) {
|
|
64
64
|
var advancedObject = params.advancedObject, id = params.id, searchString = params.searchString, pageIndex = params.pageIndex, pageSize = params.pageSize;
|
|
65
65
|
setCollapseId([]);
|
|
66
|
-
var _a = advancedObject || {}, directoryId = _a.directoryId,
|
|
66
|
+
var _a = advancedObject || {}, directoryId = _a.directoryId, priority = _a.priority, status = _a.status, type = _a.type;
|
|
67
67
|
var startDate = '';
|
|
68
68
|
var endDate = '';
|
|
69
69
|
if (advancedObject === null || advancedObject === void 0 ? void 0 : advancedObject.date) {
|
|
@@ -80,10 +80,9 @@ var CampaignContainer = function () {
|
|
|
80
80
|
endDate: endDate,
|
|
81
81
|
pageIndex: pageIndex,
|
|
82
82
|
pageSize: pageSize,
|
|
83
|
-
isReserved: isReserved,
|
|
84
83
|
// placeIds: ,
|
|
85
84
|
priorities: priority && [priority],
|
|
86
|
-
status: status
|
|
85
|
+
status: status !== undefined ? [status] : undefined,
|
|
87
86
|
types: type && [type],
|
|
88
87
|
})
|
|
89
88
|
.then(setListCampaign)
|
|
@@ -135,11 +134,11 @@ var CampaignContainer = function () {
|
|
|
135
134
|
label: t('Campaign.AdvanceSearchStatus'),
|
|
136
135
|
type: 'autocomplete',
|
|
137
136
|
icon: (0, jsx_runtime_1.jsx)(icons_material_1.Place, { fontSize: "small" }),
|
|
138
|
-
options: Object.entries(Enum_1.
|
|
137
|
+
options: Object.entries(Enum_1.CampaignStatus).filter(function (item) { return !isNaN(Number(item[1])); }).map(function (_a) {
|
|
139
138
|
var key = _a[0], value = _a[1];
|
|
140
139
|
return ({
|
|
141
140
|
value: value,
|
|
142
|
-
text: t(['Campaign', key].join('.')),
|
|
141
|
+
text: t(['Campaign.Status', key].join('.')),
|
|
143
142
|
});
|
|
144
143
|
}),
|
|
145
144
|
},
|
|
@@ -169,22 +168,6 @@ var CampaignContainer = function () {
|
|
|
169
168
|
});
|
|
170
169
|
}),
|
|
171
170
|
},
|
|
172
|
-
{
|
|
173
|
-
fieldName: 'isReserved',
|
|
174
|
-
label: t('Campaign.AdvanceSearchType'),
|
|
175
|
-
type: 'autocomplete',
|
|
176
|
-
icon: (0, jsx_runtime_1.jsx)(icons_material_1.BookmarkBorder, { fontSize: "small" }),
|
|
177
|
-
options: [
|
|
178
|
-
{
|
|
179
|
-
value: true,
|
|
180
|
-
text: t('Campaign.Reserved'),
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
value: false,
|
|
184
|
-
text: t('Campaign.NoneReserved'),
|
|
185
|
-
},
|
|
186
|
-
],
|
|
187
|
-
},
|
|
188
171
|
{
|
|
189
172
|
fieldName: 'directoryId',
|
|
190
173
|
label: t('Common.Directory'),
|
|
@@ -225,7 +208,7 @@ var CampaignContainer = function () {
|
|
|
225
208
|
: icons_material_1.KeyboardArrowDown }) })] }));
|
|
226
209
|
}
|
|
227
210
|
else {
|
|
228
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { style: { paddingLeft: '32px' }, children: [(0, jsx_runtime_1.jsx)("span", { children: row === null || row === void 0 ? void 0 : row.campaignGroup.name }), (row === null || row === void 0 ? void 0 : row.campaignGroup.
|
|
211
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { style: { paddingLeft: '32px' }, children: [(0, jsx_runtime_1.jsx)("span", { children: row === null || row === void 0 ? void 0 : row.campaignGroup.name }), (row === null || row === void 0 ? void 0 : row.campaignGroup.status) ===
|
|
229
212
|
Enum_1.ACTIVE_CAMPAIGN_TICKET ? ((0, jsx_runtime_1.jsx)(icons_material_1.CheckCircle, { fontSize: 'small', sx: {
|
|
230
213
|
paddingLeft: '4px',
|
|
231
214
|
marginBottom: '-4px',
|
|
@@ -243,7 +226,7 @@ var CampaignContainer = function () {
|
|
|
243
226
|
fontFamily: '"Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2" !important',
|
|
244
227
|
}, children: (0, Utils_1.getCampaignPriority)(row === null || row === void 0 ? void 0 : row.campaignGroup.priority) }),
|
|
245
228
|
//Check trong ads có bất kỳ ad nào isReverved
|
|
246
|
-
(row === null || row === void 0 ? void 0 : row.campaignGroup.
|
|
229
|
+
(row === null || row === void 0 ? void 0 : row.campaignGroup.status) === Enum_1.CampaignStatus.Reserved && ((0, jsx_runtime_1.jsx)(material_1.Chip, { sx: {
|
|
247
230
|
backgroundColor: '#c49f47',
|
|
248
231
|
color: '#fff',
|
|
249
232
|
height: '18px',
|
|
@@ -85,11 +85,10 @@ var resData = {
|
|
|
85
85
|
id: 1,
|
|
86
86
|
campaignId: '5111120384159200990',
|
|
87
87
|
name: 'Lotusa',
|
|
88
|
-
|
|
88
|
+
status: 1,
|
|
89
89
|
priority: 0,
|
|
90
90
|
bookingAmount: 0,
|
|
91
91
|
bonusAmount: 0,
|
|
92
|
-
isReserved: false,
|
|
93
92
|
},
|
|
94
93
|
ads: [
|
|
95
94
|
{
|
|
@@ -250,7 +249,6 @@ jest.mock('AWING/PageManagement', function () { return ({
|
|
|
250
249
|
props.onChangeQueryInput({
|
|
251
250
|
advancedObject: {
|
|
252
251
|
status: '0',
|
|
253
|
-
isReserved: true,
|
|
254
252
|
priority: '0',
|
|
255
253
|
type: '1',
|
|
256
254
|
directoryId: '4684432198852342857',
|
|
@@ -52,10 +52,9 @@ exports.campaignModelState = (0, recoil_1.atom)({
|
|
|
52
52
|
id: 1,
|
|
53
53
|
name: 'Sub-Campaign 1',
|
|
54
54
|
priority: (0, Utils_1.getIndexPriority)(Enum_1.CampaignPriority.ClassB),
|
|
55
|
-
|
|
55
|
+
status: Enum_1.CampaignStatus.Draft,
|
|
56
56
|
bookingAmount: 10,
|
|
57
57
|
bonusAmount: 0,
|
|
58
|
-
isReserved: false,
|
|
59
58
|
billingUnit: 1,
|
|
60
59
|
},
|
|
61
60
|
ads: [],
|
|
@@ -134,11 +134,10 @@ var initCampaignData = {
|
|
|
134
134
|
id: 1,
|
|
135
135
|
campaignId: '4688923610550546635',
|
|
136
136
|
name: 'Premium',
|
|
137
|
-
|
|
137
|
+
status: 0,
|
|
138
138
|
priority: 1,
|
|
139
139
|
bookingAmount: 7143,
|
|
140
140
|
bonusAmount: 357,
|
|
141
|
-
isReserved: false,
|
|
142
141
|
billingUnit: 2,
|
|
143
142
|
},
|
|
144
143
|
ads: [
|
|
@@ -2668,11 +2667,10 @@ var initCampaignDataFetch = {
|
|
|
2668
2667
|
id: 1,
|
|
2669
2668
|
campaignId: '4992385398844444137',
|
|
2670
2669
|
name: 'Sub-Campaign 1',
|
|
2671
|
-
|
|
2670
|
+
status: 1,
|
|
2672
2671
|
priority: 1,
|
|
2673
2672
|
bookingAmount: 10,
|
|
2674
2673
|
bonusAmount: 0,
|
|
2675
|
-
isReserved: false,
|
|
2676
2674
|
billingUnit: 1,
|
|
2677
2675
|
},
|
|
2678
2676
|
ads: [
|
|
@@ -77,11 +77,11 @@ function EditAds(props) {
|
|
|
77
77
|
label: t('Campaign.Ad.Time'),
|
|
78
78
|
required: true,
|
|
79
79
|
},
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
80
|
+
// {
|
|
81
|
+
// fieldName: 'isReserved',
|
|
82
|
+
// type: 'checkbox',
|
|
83
|
+
// label: t('Campaign.Ad.Reserved'),
|
|
84
|
+
// },
|
|
85
85
|
{
|
|
86
86
|
fieldName: 'placeFilter',
|
|
87
87
|
type: 'text',
|
|
@@ -70,7 +70,7 @@ function SubCampaignDetail(props) {
|
|
|
70
70
|
*/
|
|
71
71
|
var translationText = {
|
|
72
72
|
name: t('Campaign.Name'),
|
|
73
|
-
|
|
73
|
+
status: t('Campaign.Ticket'),
|
|
74
74
|
BillingUnit: t('Campaign.BillingUnit.Title'),
|
|
75
75
|
priority: t('Campaign.Detail.Priority'),
|
|
76
76
|
booking: t('Campaign.BookingText'),
|
|
@@ -84,9 +84,9 @@ function SubCampaignDetail(props) {
|
|
|
84
84
|
onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { name: e.target.value })); });
|
|
85
85
|
}, error: subValid.name !== undefined && !subValid.name, helperText: subValid.name !== undefined && !subValid.name
|
|
86
86
|
? translationText.helperText
|
|
87
|
-
: '' }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: true, style: { padding: 8 }, children: (0, jsx_runtime_1.
|
|
88
|
-
onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), {
|
|
89
|
-
}, disabled: isCreate, children:
|
|
87
|
+
: '' }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: true, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "status", name: "status", variant: "standard", select: true, required: true, fullWidth: true, label: translationText.status, value: subCampaign.status, onChange: function (e) {
|
|
88
|
+
onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { status: Number(e.target.value) })); });
|
|
89
|
+
}, disabled: isCreate, children: Object.values(Enum_1.CampaignStatus).filter(function (item) { return !isNaN(Number(item)); }).map(function (status) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: status, children: t("Campaign.Status.".concat(Enum_1.CampaignStatus[status])) }, status)); }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: true, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "priority", select: true, required: true, variant: "standard", fullWidth: true, label: translationText.priority, value: isNaN(Number(subCampaign.priority))
|
|
90
90
|
? subCampaign.priority
|
|
91
91
|
: Object.values(Enum_1.CampaignPriority)[subCampaign.priority], onChange: function (e) {
|
|
92
92
|
var newPriority = Object.values(Enum_1.CampaignPriority).indexOf(e.target.value);
|
|
@@ -103,34 +103,31 @@ function SubCampaignDetail(props) {
|
|
|
103
103
|
setSubValid(function (pre) { return (__assign(__assign({}, pre), { bookingAmount: true, bonusAmount: true })); });
|
|
104
104
|
return newSubCamp;
|
|
105
105
|
});
|
|
106
|
-
}, children: Object.values(Enum_1.CampaignPriority).map(function (priority) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: priority, children: t("Campaign.".concat(priority)) }, priority)); }) }) })] }), (0, jsx_runtime_1.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
e.persist();
|
|
133
|
-
onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { isReserved: e.target.checked })); });
|
|
134
|
-
}, name: "isReserved", color: "primary" }), label: translationText.reserved, style: { marginTop: 6 } }) })] })] }));
|
|
106
|
+
}, children: Object.values(Enum_1.CampaignPriority).map(function (priority) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: priority, children: t("Campaign.".concat(priority)) }, priority)); }) }) })] }), (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, style: { padding: 8, paddingTop: 0 }, children: (0, Utils_1.checkPriority)(subCampaign.priority, Enum_1.CampaignPriority.ClassB) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "bookingAmount", required: true, fullWidth: true, variant: "standard", type: "number", label: translationText.booking, value: subCampaign.bookingAmount, onChange: function (e) {
|
|
107
|
+
onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { bookingAmount: Number(e.target.value), bonusAmount: Math.round(Number(e.target.value) * 0.05) })); });
|
|
108
|
+
}, onFocus: function (event) { return event.target.select(); }, error: subValid.bookingAmount !== undefined &&
|
|
109
|
+
!subValid.bookingAmount, helperText: subValid.bookingAmount !== undefined &&
|
|
110
|
+
!subValid.bookingAmount
|
|
111
|
+
? subCampaign.bookingAmount < 0
|
|
112
|
+
? translationText.notNegative
|
|
113
|
+
: translationText.helperText
|
|
114
|
+
: '' }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "bonusAmount", variant: "standard", fullWidth: true, type: "number", label: translationText.bonus, value: subCampaign.bonusAmount, onChange: function (e) {
|
|
115
|
+
var value = Number(e.target.value);
|
|
116
|
+
onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { bonusAmount: value })); });
|
|
117
|
+
}, onFocus: function (event) { return event.target.select(); }, error: subValid.bonusAmount !== undefined &&
|
|
118
|
+
!subValid.bonusAmount, helperText: subValid.bonusAmount !== undefined &&
|
|
119
|
+
!subValid.bonusAmount
|
|
120
|
+
? subCampaign.bonusAmount < 0
|
|
121
|
+
? translationText.notNegative
|
|
122
|
+
: translationText.helperText
|
|
123
|
+
: '' }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "billingUnit", required: true, select: true, variant: "standard", fullWidth: true, label: translationText.BillingUnit, value: String(subCampaign.billingUnit), onChange: function (e) {
|
|
124
|
+
onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { billingUnit: Number(e.target.value) })); });
|
|
125
|
+
}, error: !!subValid.billingUnit && !subValid.billingUnit, helperText: !!subValid.billingUnit && !subValid.billingUnit
|
|
126
|
+
? translationText.helperText
|
|
127
|
+
: '', children: Object.values(Enum_2.AnalyticType)
|
|
128
|
+
.filter(function (item) { return !isNaN(Number(item)); })
|
|
129
|
+
.filter(function (item) { return item !== Enum_2.AnalyticType.AuthenticationSuccess; })
|
|
130
|
+
.filter(Boolean)
|
|
131
|
+
.map(function (type) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: type, children: t("Campaign.BillingUnit.".concat((0, lodash_1.capitalize)((0, lodash_1.camelCase)(Enum_2.AnalyticType[type])))) }, type)); }) }) })] })) })] }));
|
|
135
132
|
}
|
|
136
133
|
exports.default = SubCampaignDetail;
|
|
@@ -23,9 +23,8 @@ var subCampaignMock = {
|
|
|
23
23
|
name: 'Test Campaign',
|
|
24
24
|
bookingAmount: 100000,
|
|
25
25
|
bonusAmount: 500000,
|
|
26
|
-
|
|
26
|
+
status: Enum_1.CampaignStatus.Draft,
|
|
27
27
|
priority: Enum_1.CampaignPriority.ClassB,
|
|
28
|
-
isReserved: false,
|
|
29
28
|
billingUnit: 1,
|
|
30
29
|
};
|
|
31
30
|
describe('<SubCampaignDetail />', function () {
|
|
@@ -36,19 +35,15 @@ describe('<SubCampaignDetail />', function () {
|
|
|
36
35
|
expect(react_1.screen.getByLabelText(/^Campaign.Detail.Priority.*$/).textContent).toBe('Campaign.PriorityB');
|
|
37
36
|
expect(react_1.screen.getByLabelText(/^Campaign.BookingText.*$/).value).toBe(subCampaignMock.bookingAmount.toString());
|
|
38
37
|
expect(react_1.screen.getByLabelText(/^Campaign.BonusText.*$/).value).toBe(subCampaignMock.bonusAmount.toString());
|
|
39
|
-
expect(
|
|
40
|
-
// eslint-disable-next-line testing-library/no-container
|
|
41
|
-
container.querySelector('input[name="isReserved"]').checked).toBe(subCampaignMock.isReserved);
|
|
42
38
|
});
|
|
43
39
|
it('should render with correct information classA', function () {
|
|
44
|
-
var subCampaign = __assign(__assign({}, subCampaignMock), { priority: Enum_1.CampaignPriority.ClassA,
|
|
40
|
+
var subCampaign = __assign(__assign({}, subCampaignMock), { priority: Enum_1.CampaignPriority.ClassA, status: Enum_1.CampaignStatus.Active });
|
|
45
41
|
var _a = (0, react_1.render)((0, jsx_runtime_1.jsx)(SubCampaignDetail_1.default, { subCampaign: subCampaign, onSubCampaignChange: function () { }, onChangeSubCampaignStatus: function () { } })), container = _a.container, getByLabelText = _a.getByLabelText, queryByLabelText = _a.queryByLabelText;
|
|
46
42
|
expect(react_1.screen.getByLabelText(/^Campaign.Name.*$/).value).toBe(subCampaign.name);
|
|
47
43
|
expect(react_1.screen.getByLabelText(/^Campaign.Ticket.*$/).textContent).toBe('Campaign.Active');
|
|
48
44
|
expect(react_1.screen.getByLabelText(/^Campaign.Detail.Priority.*$/).textContent).toBe('Campaign.PriorityA');
|
|
49
45
|
expect(react_1.screen.queryByLabelText(/^Campaign.BookingText.*$/)).toBeNull();
|
|
50
46
|
expect(react_1.screen.queryByLabelText(/^Campaign.BonusText.*$/)).toBeNull();
|
|
51
|
-
expect(container.querySelector('input[name="isReserved"]').checked).toBe(subCampaign.isReserved);
|
|
52
47
|
});
|
|
53
48
|
it('should update sub campaign', function () {
|
|
54
49
|
var state = __assign({}, subCampaignMock);
|
|
@@ -71,16 +66,11 @@ describe('<SubCampaignDetail />', function () {
|
|
|
71
66
|
react_1.fireEvent.change(bonusInput, { target: { valueAsNumber: 837483 } });
|
|
72
67
|
expect(onSubCampaignChange).toHaveBeenCalledTimes(3);
|
|
73
68
|
expect(state.bonusAmount).toBe(837483);
|
|
74
|
-
var isReservedCheckbox = container.querySelector('input[name="isReserved"]');
|
|
75
|
-
expect(isReservedCheckbox).not.toBeNull();
|
|
76
|
-
react_1.fireEvent.click(isReservedCheckbox);
|
|
77
|
-
expect(onSubCampaignChange).toHaveBeenCalledTimes(4);
|
|
78
|
-
expect(state.isReserved).toBe(true);
|
|
79
69
|
var selectParam = react_1.screen.getAllByRole('button');
|
|
80
70
|
react_1.fireEvent.mouseDown(selectParam[0]);
|
|
81
71
|
react_1.screen.getAllByRole('option')[0].click();
|
|
82
72
|
expect(onSubCampaignChange).toHaveBeenCalledTimes(5);
|
|
83
|
-
expect(state.
|
|
73
|
+
expect(state.status).toBe(Enum_1.CampaignStatus.Active);
|
|
84
74
|
react_1.fireEvent.mouseDown(selectParam[1]);
|
|
85
75
|
react_1.screen.getAllByRole('option')[2].click();
|
|
86
76
|
expect(onSubCampaignChange).toHaveBeenCalledTimes(6);
|
|
@@ -18,6 +18,9 @@ var Add_1 = __importDefault(require("@mui/icons-material/Add"));
|
|
|
18
18
|
var CheckCircle_1 = __importDefault(require("@mui/icons-material/CheckCircle"));
|
|
19
19
|
var Delete_1 = __importDefault(require("@mui/icons-material/Delete"));
|
|
20
20
|
var FileCopy_1 = __importDefault(require("@mui/icons-material/FileCopy"));
|
|
21
|
+
var WatchLater_1 = __importDefault(require("@mui/icons-material/WatchLater"));
|
|
22
|
+
var HourglassBottom_1 = __importDefault(require("@mui/icons-material/HourglassBottom"));
|
|
23
|
+
var HighlightOff_1 = __importDefault(require("@mui/icons-material/HighlightOff"));
|
|
21
24
|
var RemoveCircle_1 = __importDefault(require("@mui/icons-material/RemoveCircle"));
|
|
22
25
|
var material_1 = require("@mui/material");
|
|
23
26
|
var react_i18next_1 = require("react-i18next");
|
|
@@ -70,7 +73,7 @@ function SubCampaignPreview(_a) {
|
|
|
70
73
|
var subCampaign = _a.subCampaign, isSelected = _a.isSelected, onSelect = _a.onSelect, onMultiSelect = _a.onMultiSelect, onDuplicate = _a.onDuplicate, onDelete = _a.onDelete, error = _a.error;
|
|
71
74
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
72
75
|
var today = (0, Helpers_1.getToday)();
|
|
73
|
-
var isActive = ((_b = subCampaign.campaignGroup) === null || _b === void 0 ? void 0 : _b.
|
|
76
|
+
var isActive = ((_b = subCampaign.campaignGroup) === null || _b === void 0 ? void 0 : _b.status) === Enum_1.CampaignStatus.Active &&
|
|
74
77
|
((_c = subCampaign.ads) === null || _c === void 0 ? void 0 : _c.some(function (ad) {
|
|
75
78
|
return ad.status &&
|
|
76
79
|
(0, Helpers_1.convertTimestampToDateTime)(ad.startDate) <= today &&
|
|
@@ -84,6 +87,23 @@ function SubCampaignPreview(_a) {
|
|
|
84
87
|
numberHasRunText: t('Campaign.NumberHasRunText'),
|
|
85
88
|
reserved: t('Campaign.Reserved'),
|
|
86
89
|
};
|
|
90
|
+
var renderIcon = function () {
|
|
91
|
+
switch (subCampaign.campaignGroup.status) {
|
|
92
|
+
case Enum_1.CampaignStatus.Active:
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)(CheckCircle_1.default, { fontSize: "small", style: {
|
|
94
|
+
fontSize: '14px',
|
|
95
|
+
color: isActive ? '#008000' : '#8D8D8D',
|
|
96
|
+
} }));
|
|
97
|
+
case Enum_1.CampaignStatus.Reserved:
|
|
98
|
+
return ((0, jsx_runtime_1.jsx)(WatchLater_1.default, { fontSize: "small", style: { fontSize: '14px' }, color: "primary" }));
|
|
99
|
+
case Enum_1.CampaignStatus.Pending:
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(HourglassBottom_1.default, { fontSize: "small", style: { fontSize: '14px' }, color: "primary" }));
|
|
101
|
+
case Enum_1.CampaignStatus.Done:
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(HighlightOff_1.default, { fontSize: "small", style: { fontSize: '14px' }, color: "primary" }));
|
|
103
|
+
default:
|
|
104
|
+
return ((0, jsx_runtime_1.jsx)(RemoveCircle_1.default, { fontSize: "small", style: { fontSize: '14px' }, color: "primary" }));
|
|
105
|
+
}
|
|
106
|
+
};
|
|
87
107
|
return ((0, jsx_runtime_1.jsxs)(material_1.Card, { sx: {
|
|
88
108
|
width: 214,
|
|
89
109
|
height: 124,
|
|
@@ -104,11 +124,7 @@ function SubCampaignPreview(_a) {
|
|
|
104
124
|
fontWeight: '500',
|
|
105
125
|
}, children: [subCampaign.campaignGroup.name.length > 30
|
|
106
126
|
? "".concat(subCampaign.campaignGroup.name.substring(0, 30), "...")
|
|
107
|
-
: subCampaign.campaignGroup.name,
|
|
108
|
-
Enum_1.CampaignTicket.ACTIVE ? ((0, jsx_runtime_1.jsx)(CheckCircle_1.default, { fontSize: "small", style: {
|
|
109
|
-
fontSize: '14px',
|
|
110
|
-
color: isActive ? '#008000' : '#8D8D8D',
|
|
111
|
-
} })) : ((0, jsx_runtime_1.jsx)(RemoveCircle_1.default, { fontSize: "small", style: { fontSize: '14px' }, color: "primary" })), (0, jsx_runtime_1.jsx)(material_1.Typography, { component: 'span', sx: {
|
|
127
|
+
: subCampaign.campaignGroup.name, renderIcon(), (0, jsx_runtime_1.jsx)(material_1.Typography, { component: 'span', sx: {
|
|
112
128
|
fontFamily: '"Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2" !important',
|
|
113
129
|
fontSize: 18,
|
|
114
130
|
}, children: (0, Utils_1.getCampaignPriority)(subCampaign.campaignGroup.priority) })] }) }), action: (0, jsx_runtime_1.jsx)(AWING_1.Actions, { menus: __spreadArray([
|
|
@@ -131,7 +147,8 @@ function SubCampaignPreview(_a) {
|
|
|
131
147
|
? " (+".concat((0, Helpers_1.formatNumber)(subCampaign.campaignGroup.bonusAmount), ")")
|
|
132
148
|
: '' })] }) }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: translationText.bonus, placement: "right", arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", children: subCampaign.campaignGroup.numberHasRun
|
|
133
149
|
? "".concat(translationText.numberHasRunText, ": ").concat((0, Helpers_1.formatNumber)(subCampaign.campaignGroup.numberHasRun))
|
|
134
|
-
: '' }) })] }), (0, jsx_runtime_1.jsx)(material_1.CardActions, { style: { padding: '0 8px' }, children: subCampaign.campaignGroup.
|
|
150
|
+
: '' }) })] }), (0, jsx_runtime_1.jsx)(material_1.CardActions, { style: { padding: '0 8px' }, children: subCampaign.campaignGroup.status ===
|
|
151
|
+
Enum_1.CampaignStatus.Reserved && ((0, jsx_runtime_1.jsx)(material_1.Chip, { label: translationText.reserved, style: {
|
|
135
152
|
height: 18,
|
|
136
153
|
backgroundColor: '#c49f47',
|
|
137
154
|
color: 'white',
|
|
@@ -61,11 +61,10 @@ function TabSubCampaign() {
|
|
|
61
61
|
campaignGroup: {
|
|
62
62
|
id: newId,
|
|
63
63
|
name: 'Sub-Campaign ' + newId,
|
|
64
|
-
|
|
64
|
+
status: Enum_1.CampaignStatus.Draft,
|
|
65
65
|
priority: Enum_1.CampaignPriority.ClassB,
|
|
66
66
|
bookingAmount: 10,
|
|
67
67
|
bonusAmount: 0,
|
|
68
|
-
isReserved: false,
|
|
69
68
|
billingUnit: Enum_2.AnalyticType.Authentication,
|
|
70
69
|
},
|
|
71
70
|
ads: [],
|
|
@@ -227,8 +227,8 @@ var CreateOrEdit = function (props) {
|
|
|
227
227
|
subCampains[idx].ads[i].cantBeDelete = true;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
else if (subCamp.campaignGroup.
|
|
231
|
-
Enum_1.
|
|
230
|
+
else if (subCamp.campaignGroup.status ===
|
|
231
|
+
Enum_1.CampaignStatus.Active) {
|
|
232
232
|
subCampains[idx].campaignGroup.cantBeDelete =
|
|
233
233
|
true;
|
|
234
234
|
for (var i = 0; i < subCamp.ads.length; i++) {
|
|
@@ -244,7 +244,7 @@ var CreateOrEdit = function (props) {
|
|
|
244
244
|
campaignModel.campaign.name += ' - copy';
|
|
245
245
|
campaignModel.campaign.createdDate = undefined;
|
|
246
246
|
campaignModel.campaignGroups.forEach(function (g) {
|
|
247
|
-
g.campaignGroup.
|
|
247
|
+
g.campaignGroup.status = Enum_1.CampaignStatus.Draft;
|
|
248
248
|
if (!service.attributesGetByObjectTypeCode)
|
|
249
249
|
g.campaignGroup.billingUnit =
|
|
250
250
|
Enum_2.AnalyticType.Authentication;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const ACTIVE_CAMPAIGN_TICKET = 0;
|
|
2
1
|
export declare const EnumOperator: {
|
|
3
2
|
Equality: {
|
|
4
3
|
id: number;
|
|
@@ -113,10 +112,14 @@ export declare const BaseEvent: {
|
|
|
113
112
|
readonly 1: "Authentication";
|
|
114
113
|
readonly 4: "AuthenticationSuccess";
|
|
115
114
|
};
|
|
116
|
-
export declare enum
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
export declare enum CampaignStatus {
|
|
116
|
+
Draft = 0,
|
|
117
|
+
Reserved = 1,
|
|
118
|
+
Pending = 2,
|
|
119
|
+
Active = 3,
|
|
120
|
+
Done = 4
|
|
119
121
|
}
|
|
122
|
+
export declare const ACTIVE_CAMPAIGN_TICKET = CampaignStatus.Active;
|
|
120
123
|
export declare enum AdType {
|
|
121
124
|
BANNER_STATIC = 1,
|
|
122
125
|
BANNER_EFFECT = 2,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.CampaignApprovalStatus = exports.Operator = exports.CampaignRuleType = exports.AdType = exports.
|
|
4
|
+
exports.CampaignApprovalStatus = exports.Operator = exports.CampaignRuleType = exports.AdType = exports.ACTIVE_CAMPAIGN_TICKET = exports.CampaignStatus = exports.BaseEvent = exports.CampaignPriority = exports.DATE_FORMAT = exports.PlaceFilterOperandType = exports.DirectoryRoot = exports.CAMPAIGN_ANALYTIC_TYPE = exports.CAMPAIGN_STATUS = exports.EnumOperator = void 0;
|
|
5
5
|
var Enum_1 = require("../../ACM-AXN/Common/Enum");
|
|
6
|
-
exports.ACTIVE_CAMPAIGN_TICKET = 0;
|
|
7
6
|
exports.EnumOperator = {
|
|
8
7
|
Equality: { id: 0, text: "=", value: "Equality", type: "Comparison" },
|
|
9
8
|
NotEqual: { id: 1, text: "≠", value: "NotEqual", type: "Comparison" },
|
|
@@ -96,11 +95,15 @@ exports.BaseEvent = (_a = {},
|
|
|
96
95
|
_a[Enum_1.AnalyticType.Authentication] = 'Authentication',
|
|
97
96
|
_a[Enum_1.AnalyticType.AuthenticationSuccess] = 'AuthenticationSuccess',
|
|
98
97
|
_a);
|
|
99
|
-
var
|
|
100
|
-
(function (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
var CampaignStatus;
|
|
99
|
+
(function (CampaignStatus) {
|
|
100
|
+
CampaignStatus[CampaignStatus["Draft"] = 0] = "Draft";
|
|
101
|
+
CampaignStatus[CampaignStatus["Reserved"] = 1] = "Reserved";
|
|
102
|
+
CampaignStatus[CampaignStatus["Pending"] = 2] = "Pending";
|
|
103
|
+
CampaignStatus[CampaignStatus["Active"] = 3] = "Active";
|
|
104
|
+
CampaignStatus[CampaignStatus["Done"] = 4] = "Done";
|
|
105
|
+
})(CampaignStatus || (exports.CampaignStatus = CampaignStatus = {}));
|
|
106
|
+
exports.ACTIVE_CAMPAIGN_TICKET = CampaignStatus.Active;
|
|
104
107
|
var AdType;
|
|
105
108
|
(function (AdType) {
|
|
106
109
|
// DEFAULT = 0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AlertColor } from '@mui/material';
|
|
3
3
|
import { CampaignType } from './Utils';
|
|
4
|
-
import { AdType, CampaignPriority, CampaignRuleType,
|
|
4
|
+
import { AdType, CampaignPriority, CampaignRuleType, CampaignStatus, DirectoryRoot, Operator } from './Enum';
|
|
5
5
|
import { PrmissionService } from '../Permission/Types';
|
|
6
6
|
import { PageService, PageViewEvent } from '../Page/Types';
|
|
7
7
|
import { BaseChartComponent } from 'react-chartjs-2/dist/types';
|
|
@@ -66,7 +66,7 @@ export type CampaignGroup = {
|
|
|
66
66
|
id: number;
|
|
67
67
|
campaignId?: string;
|
|
68
68
|
name: string;
|
|
69
|
-
|
|
69
|
+
status: CampaignStatus;
|
|
70
70
|
/**
|
|
71
71
|
* Mức độ ưu tiên (A, B, C)
|
|
72
72
|
*/
|
|
@@ -76,7 +76,6 @@ export type CampaignGroup = {
|
|
|
76
76
|
/**
|
|
77
77
|
* Đặt chỗ
|
|
78
78
|
*/
|
|
79
|
-
isReserved: boolean;
|
|
80
79
|
/**
|
|
81
80
|
* Số lượng đã chạy (nếu có)
|
|
82
81
|
*/
|
|
@@ -248,7 +247,6 @@ export interface CampaignFilter {
|
|
|
248
247
|
endDate?: string;
|
|
249
248
|
pageIndex?: number;
|
|
250
249
|
pageSize?: number;
|
|
251
|
-
isReserved?: boolean;
|
|
252
250
|
placeIds?: string[];
|
|
253
251
|
priorities?: CampaignPriority[];
|
|
254
252
|
status?: number[];
|
|
@@ -66,7 +66,7 @@ var checkCampaignIsRunning = function (campaignGroupModel) {
|
|
|
66
66
|
var localTime = (0, moment_1.default)().format('YYYY-MM-DD');
|
|
67
67
|
var dateTimeNow = Number((0, moment_1.default)(localTime).format('X'));
|
|
68
68
|
//Check chỉ cần trong ad có chứa ngày hiện tại là được
|
|
69
|
-
var campaignTicket = campaignGroupModel.campaignGroup.
|
|
69
|
+
var campaignTicket = campaignGroupModel.campaignGroup.status === Enum_1.ACTIVE_CAMPAIGN_TICKET;
|
|
70
70
|
var campaignContainsCurrentDate = ((_a = campaignGroupModel.ads.filter(function (y) {
|
|
71
71
|
var _a, _b;
|
|
72
72
|
return dateTimeNow >= Number((_a = y.startDate) === null || _a === void 0 ? void 0 : _a.seconds) &&
|
|
@@ -128,13 +128,11 @@ function DataInput(props) {
|
|
|
128
128
|
}, [type, value]);
|
|
129
129
|
var handleParamValueChange = function () {
|
|
130
130
|
var newValue = Number(numberValue);
|
|
131
|
-
|
|
131
|
+
setNumberValue(newValue);
|
|
132
|
+
if (type === 'number' && Number(value) !== newValue) {
|
|
133
|
+
onChange(newValue, checkValidationValue(fieldDefinition, newValue));
|
|
134
|
+
}
|
|
132
135
|
};
|
|
133
|
-
(0, react_2.useEffect)(function () {
|
|
134
|
-
if (type === 'number' && Number(value) !== Number(numberValue))
|
|
135
|
-
handleParamValueChange();
|
|
136
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
137
|
-
}, [numberValue, type]);
|
|
138
136
|
switch (type) {
|
|
139
137
|
case 'logic-expression': {
|
|
140
138
|
return ((0, jsx_runtime_1.jsx)(LogicExpression_1.default, __assign({ cf: function (newValue, valid) {
|
|
@@ -216,7 +214,8 @@ function DataInput(props) {
|
|
|
216
214
|
return ((0, jsx_runtime_1.jsx)(AWING_1.NumberFormat, __assign({ id: fieldName.toString(), name: fieldName.toString(), fullWidth: true, variant: "standard" }, other, { value: numberValue !== null && numberValue !== void 0 ? numberValue : '', onChange: function (event) {
|
|
217
215
|
var newValue = event.target.value;
|
|
218
216
|
setNumberValue(newValue);
|
|
219
|
-
|
|
217
|
+
onChange(Number(newValue), checkValidationValue(fieldDefinition, Number(newValue)));
|
|
218
|
+
}, onBlur: handleParamValueChange, error: error, helperText: !disableHelperText && error
|
|
220
219
|
? (_h = fieldDefinition.helperText) !== null && _h !== void 0 ? _h : t('Common.InvalidData')
|
|
221
220
|
: '' })));
|
|
222
221
|
}
|
|
@@ -492,7 +492,12 @@
|
|
|
492
492
|
"Status": {
|
|
493
493
|
"Title": "Status",
|
|
494
494
|
"Status_0": "Active",
|
|
495
|
-
"Status_1": "Inactive"
|
|
495
|
+
"Status_1": "Inactive",
|
|
496
|
+
"Draft": "Draft",
|
|
497
|
+
"Reserved": "Reserved",
|
|
498
|
+
"Pending": "Under Approval",
|
|
499
|
+
"Active": "Active",
|
|
500
|
+
"Done": "Done"
|
|
496
501
|
},
|
|
497
502
|
"CreateForm": {
|
|
498
503
|
"GroupWizard": "Group Wizard",
|
|
@@ -492,7 +492,12 @@
|
|
|
492
492
|
"Status": {
|
|
493
493
|
"Title": "Status",
|
|
494
494
|
"Status_0": "Aktif",
|
|
495
|
-
"Status_1": "Tidak Aktif"
|
|
495
|
+
"Status_1": "Tidak Aktif",
|
|
496
|
+
"Draft": "Draf",
|
|
497
|
+
"Reserved": "Dipesan",
|
|
498
|
+
"Pending": "Menunggu",
|
|
499
|
+
"Active": "Aktif",
|
|
500
|
+
"Done": "Selesai"
|
|
496
501
|
},
|
|
497
502
|
"CreateForm": {
|
|
498
503
|
"GroupWizard": "Wizard Grup",
|
|
@@ -476,7 +476,12 @@
|
|
|
476
476
|
"Status": {
|
|
477
477
|
"Title": "Trạng thái",
|
|
478
478
|
"Status_0": "Đang hoạt động",
|
|
479
|
-
"Status_1": "Ngưng hoạt động"
|
|
479
|
+
"Status_1": "Ngưng hoạt động",
|
|
480
|
+
"Draft": "Khởi tạo",
|
|
481
|
+
"Reserved": "Đặt chỗ",
|
|
482
|
+
"Pending": "Phê duyệt",
|
|
483
|
+
"Active": "Hoạt động",
|
|
484
|
+
"Done": "Kết thúc"
|
|
480
485
|
},
|
|
481
486
|
"CreateForm": {
|
|
482
487
|
"GroupWizard": "Nhóm Wizard",
|