@licklist/design 0.71.12 → 0.71.14
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/events/event-statistic-modal/utils/index.d.ts.map +1 -1
- package/dist/events/event-statistic-modal/utils/index.js +24 -17
- package/dist/sales/modals/refund-modal/RefundModal.d.ts.map +1 -1
- package/dist/sales/modals/refund-modal/RefundModal.js +1 -0
- package/package.json +1 -1
- package/src/events/event-statistic-modal/utils/index.ts +58 -38
- package/src/sales/modals/refund-modal/RefundModal.tsx +1 -0
- package/yarn.lock +412 -299
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/event-statistic-modal/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AAKjG,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE;QACT,aAAa,EAAE,MAAM,CAAA;QACrB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/event-statistic-modal/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAA;AAKjG,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE;QACT,aAAa,EAAE,MAAM,CAAA;QACrB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc,sBAiI/B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateTime } from 'luxon';
|
|
2
2
|
import { DATE_FORMAT, DATE_TIME_FULL_FORMAT } from '@licklist/core/dist/Config';
|
|
3
|
-
import {
|
|
3
|
+
import { maxBy } from 'lodash';
|
|
4
4
|
|
|
5
5
|
function _array_like_to_array(arr, len) {
|
|
6
6
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -45,18 +45,20 @@ var convertEventStatisticToTableData = function(date, eventStatistic) {
|
|
|
45
45
|
return DateTime.fromFormat(date, DATE_TIME_FULL_FORMAT).toFormat(DATE_FORMAT) === summaryFormattedDate;
|
|
46
46
|
})) !== null && _Object_keys_filter !== void 0 ? _Object_keys_filter : [];
|
|
47
47
|
var summaryMap = new Map();
|
|
48
|
-
var allProductsSummary = values(eventStatistic === null || eventStatistic === void 0 ? void 0 : eventStatistic.productCategorySummary).flat().flatMap(function(categorySummary) {
|
|
49
|
-
return categorySummary.productsSummary;
|
|
50
|
-
});
|
|
51
|
-
var maxTotalQuantity = maxBy(allProductsSummary, 'id').totalQuantity || 0;
|
|
52
48
|
summaryDays.map(function(day) {
|
|
53
49
|
return eventStatistic === null || eventStatistic === void 0 ? void 0 : eventStatistic.productCategorySummary[day];
|
|
54
50
|
}).flat().sort(function(prev, next) {
|
|
55
51
|
return prev.categoryName === next.categoryName ? 0 : prev.categoryName > next.categoryName ? 1 : -1;
|
|
56
|
-
}).forEach(function(param
|
|
52
|
+
}).forEach(function(param, _, // all category at summaryDays
|
|
53
|
+
selfCategory) {
|
|
57
54
|
var totalPerCategory = param.totalPerCategory, _param_productsSummary = param.productsSummary, productsSummary = _param_productsSummary === void 0 ? [] : _param_productsSummary, categoryName = param.categoryName, eventId = param.eventId;
|
|
58
55
|
var quantity = 0;
|
|
59
56
|
totalAmount += totalPerCategory || 0;
|
|
57
|
+
var allProductSummaryAtCategory = selfCategory.filter(function(category) {
|
|
58
|
+
return category.categoryName === categoryName;
|
|
59
|
+
}).flatMap(function(categorySummary) {
|
|
60
|
+
return categorySummary.productsSummary;
|
|
61
|
+
});
|
|
60
62
|
if (!summaryMap.has("".concat(categoryName))) {
|
|
61
63
|
summaryMap.set("".concat(categoryName), {
|
|
62
64
|
name: categoryName,
|
|
@@ -67,24 +69,29 @@ var convertEventStatisticToTableData = function(date, eventStatistic) {
|
|
|
67
69
|
total: TRANSLATION_KEYS.total
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
|
-
productsSummary === null || productsSummary === void 0 ? void 0 : productsSummary.forEach(function(
|
|
71
|
-
var
|
|
72
|
-
quantity += productsSold;
|
|
72
|
+
productsSummary === null || productsSummary === void 0 ? void 0 : productsSummary.forEach(function(productSummary, productIndex) {
|
|
73
|
+
var _maxBy;
|
|
74
|
+
quantity += productSummary.productsSold;
|
|
73
75
|
var _summaryMap_get;
|
|
74
|
-
var existingProduct = (_summaryMap_get = summaryMap.get("".concat(categoryName, ".").concat(name))) !== null && _summaryMap_get !== void 0 ? _summaryMap_get : {
|
|
76
|
+
var existingProduct = (_summaryMap_get = summaryMap.get("".concat(categoryName, ".").concat(productSummary.name))) !== null && _summaryMap_get !== void 0 ? _summaryMap_get : {
|
|
75
77
|
metadata: {
|
|
76
78
|
_productsSold: 0,
|
|
77
79
|
_total: 0
|
|
78
80
|
}
|
|
79
81
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
var overrides = allProductSummaryAtCategory.filter(function(summary) {
|
|
83
|
+
return summary.originalProductId === productSummary.id;
|
|
84
|
+
});
|
|
85
|
+
var maxTotalQuantity = (_maxBy = maxBy(overrides, 'id')) === null || _maxBy === void 0 ? void 0 : _maxBy.totalQuantity;
|
|
86
|
+
var totalQuantity = maxTotalQuantity || (productSummary === null || productSummary === void 0 ? void 0 : productSummary.totalQuantity);
|
|
87
|
+
summaryMap.set("".concat(categoryName, ".").concat(productSummary.name), {
|
|
88
|
+
name: productSummary.name,
|
|
89
|
+
key: "".concat(eventId, ".").concat(categoryName).concat(productIndex).concat(productSummary.name),
|
|
90
|
+
quantity: totalQuantity ? "".concat(existingProduct.metadata._productsSold + productSummary.productsSold, " / ").concat(totalQuantity) : String(existingProduct.metadata._productsSold + productSummary.productsSold),
|
|
91
|
+
total: String(existingProduct.metadata._total + productSummary.total),
|
|
85
92
|
metadata: {
|
|
86
|
-
_productsSold: existingProduct.metadata._productsSold + productsSold,
|
|
87
|
-
_total: existingProduct.metadata._total + total
|
|
93
|
+
_productsSold: existingProduct.metadata._productsSold + productSummary.productsSold,
|
|
94
|
+
_total: existingProduct.metadata._total + productSummary.total
|
|
88
95
|
}
|
|
89
96
|
});
|
|
90
97
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefundModal.d.ts","sourceRoot":"","sources":["../../../../src/sales/modals/refund-modal/RefundModal.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAA;AAK9F,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,EAAE,gBAAgB,CAAA;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAMD,eAAO,MAAM,WAAW,mGASrB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"RefundModal.d.ts","sourceRoot":"","sources":["../../../../src/sales/modals/refund-modal/RefundModal.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAA;AAK9F,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,EAAE,gBAAgB,CAAA;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAMD,eAAO,MAAM,WAAW,mGASrB,gBAAgB,4CAoGlB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventStatistic } from '@licklist/core/dist/DataMapper/Provider/EventStatisticDataMapper'
|
|
2
2
|
import { DateTime } from 'luxon'
|
|
3
3
|
import { DATE_FORMAT, DATE_TIME_FULL_FORMAT } from '@licklist/core/dist/Config'
|
|
4
|
-
import {
|
|
4
|
+
import { maxBy } from 'lodash'
|
|
5
5
|
|
|
6
6
|
export const TRANSLATION_KEYS = {
|
|
7
7
|
shortQuantity: 'shortQuantity',
|
|
@@ -36,6 +36,7 @@ export const convertEventStatisticToTableData = (
|
|
|
36
36
|
const summaryFormattedDate = DateTime.fromISO(date)
|
|
37
37
|
.toUTC()
|
|
38
38
|
.toFormat(DATE_FORMAT)
|
|
39
|
+
|
|
39
40
|
const summaryDays =
|
|
40
41
|
Object.keys(eventStatistic?.productCategorySummary)?.filter(
|
|
41
42
|
(date) =>
|
|
@@ -45,11 +46,6 @@ export const convertEventStatisticToTableData = (
|
|
|
45
46
|
) ?? []
|
|
46
47
|
|
|
47
48
|
const summaryMap = new Map<string, TableDataRecord>()
|
|
48
|
-
const allProductsSummary = values(eventStatistic?.productCategorySummary)
|
|
49
|
-
.flat()
|
|
50
|
-
.flatMap((categorySummary) => categorySummary.productsSummary)
|
|
51
|
-
|
|
52
|
-
const maxTotalQuantity = maxBy(allProductsSummary, 'id').totalQuantity || 0
|
|
53
49
|
|
|
54
50
|
summaryDays
|
|
55
51
|
.map((day) => eventStatistic?.productCategorySummary[day])
|
|
@@ -62,9 +58,19 @@ export const convertEventStatisticToTableData = (
|
|
|
62
58
|
: -1,
|
|
63
59
|
)
|
|
64
60
|
.forEach(
|
|
65
|
-
(
|
|
61
|
+
(
|
|
62
|
+
{ totalPerCategory, productsSummary = [], categoryName, eventId },
|
|
63
|
+
_,
|
|
64
|
+
// all category at summaryDays
|
|
65
|
+
selfCategory,
|
|
66
|
+
) => {
|
|
66
67
|
let quantity = 0
|
|
67
68
|
totalAmount += totalPerCategory || 0
|
|
69
|
+
|
|
70
|
+
const allProductSummaryAtCategory = selfCategory
|
|
71
|
+
.filter((category) => category.categoryName === categoryName)
|
|
72
|
+
.flatMap((categorySummary) => categorySummary.productsSummary)
|
|
73
|
+
|
|
68
74
|
if (!summaryMap.has(`${categoryName}`)) {
|
|
69
75
|
summaryMap.set(`${categoryName}`, {
|
|
70
76
|
name: categoryName,
|
|
@@ -76,43 +82,56 @@ export const convertEventStatisticToTableData = (
|
|
|
76
82
|
})
|
|
77
83
|
}
|
|
78
84
|
|
|
79
|
-
productsSummary?.forEach(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
85
|
+
productsSummary?.forEach((productSummary, productIndex) => {
|
|
86
|
+
quantity += productSummary.productsSold
|
|
87
|
+
|
|
88
|
+
const existingProduct = summaryMap.get(
|
|
89
|
+
`${categoryName}.${productSummary.name}`,
|
|
90
|
+
) ?? {
|
|
91
|
+
metadata: {
|
|
92
|
+
_productsSold: 0,
|
|
93
|
+
_total: 0,
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const overrides = allProductSummaryAtCategory.filter(
|
|
98
|
+
(summary) => summary.originalProductId === productSummary.id,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
const maxTotalQuantity = maxBy(overrides, 'id')?.totalQuantity
|
|
102
|
+
|
|
103
|
+
const totalQuantity = maxTotalQuantity || productSummary?.totalQuantity
|
|
104
|
+
|
|
105
|
+
summaryMap.set(`${categoryName}.${productSummary.name}`, {
|
|
106
|
+
name: productSummary.name,
|
|
107
|
+
key: `${eventId}.${categoryName}${productIndex}${productSummary.name}`,
|
|
108
|
+
quantity: totalQuantity
|
|
109
|
+
? `${
|
|
110
|
+
existingProduct.metadata._productsSold +
|
|
111
|
+
productSummary.productsSold
|
|
112
|
+
} / ${totalQuantity}`
|
|
113
|
+
: String(
|
|
114
|
+
existingProduct.metadata._productsSold +
|
|
115
|
+
productSummary.productsSold,
|
|
116
|
+
),
|
|
117
|
+
total: String(
|
|
118
|
+
existingProduct.metadata._total + productSummary.total,
|
|
119
|
+
),
|
|
120
|
+
metadata: {
|
|
121
|
+
_productsSold:
|
|
122
|
+
existingProduct.metadata._productsSold +
|
|
123
|
+
productSummary.productsSold,
|
|
124
|
+
_total: existingProduct.metadata._total + productSummary.total,
|
|
125
|
+
},
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
|
|
109
129
|
const prevTotalPerCategory = summaryMap.get(
|
|
110
130
|
`${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
|
|
111
131
|
) ?? {
|
|
112
132
|
quantity: 0,
|
|
113
133
|
total: 0,
|
|
114
134
|
}
|
|
115
|
-
|
|
116
135
|
summaryMap.set(`${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`, {
|
|
117
136
|
name: TRANSLATION_KEYS.totalPerCategory,
|
|
118
137
|
key: `${eventId}.${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
|
|
@@ -120,6 +139,7 @@ export const convertEventStatisticToTableData = (
|
|
|
120
139
|
total: String(Number(prevTotalPerCategory.total) + totalPerCategory),
|
|
121
140
|
isBold: true,
|
|
122
141
|
})
|
|
142
|
+
|
|
123
143
|
totalQuantity += quantity
|
|
124
144
|
},
|
|
125
145
|
)
|