@licklist/design 0.44.547 → 0.44.548

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.
@@ -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,CAAC;AAIlG,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc;UAUtB,MAAM;SACP,MAAM;eACA,OAAO;aACT,OAAO;cACN,MAAM,GAAG,MAAM;WAClB,MAAM,GAAG,MAAM;GA4DzB,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,CAAC;AAIlG,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC;AAEF,eAAO,MAAM,gCAAgC,SACrC,MAAM,kBACI,cAAc;UAUtB,MAAM;SACP,MAAM;eACA,OAAO;aACT,OAAO;cACN,MAAM,GAAG,MAAM;WAClB,MAAM,GAAG,MAAM;GAsEzB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@licklist/core/dist/Config"),o=require("luxon"),a={shortQuantity:"shortQuantity",total:"total",totalPerCategory:"totalPerCategory"};exports.TRANSLATION_KEYS=a,exports.convertEventStatisticToTableData=function(e,r){var n,c,l=0,i=0;if(!r)return[];var u=[],s=o.DateTime.fromISO(e).toUTC().toFormat(t.DATE_TIME_FULL_FORMAT);return null===(c=Object.values(null!==(n=null==r?void 0:r.productCategorySummary[s])&&void 0!==n?n:{}))||void 0===c||c.forEach((function(t){var o=t.totalPerCategory,e=t.productsSummary,r=void 0===e?[]:e,n=t.categoryName,c=t.eventId,s=0;l+=o||0,u.push({name:n,key:"".concat(c,".").concat(n),isBold:!0,isHeader:!0,quantity:a.shortQuantity,total:a.total}),null==r||r.forEach((function(t){var o=t.productsSold,a=t.name,e=t.totalQuantity,r=t.total;s+=o,u.push({name:a,key:"".concat(c,".").concat(n,".").concat(a),quantity:e?"".concat(o," / ").concat(e):String(o),total:String(r)})})),u.push({name:a.totalPerCategory,key:"".concat(c,".").concat(n,".").concat(a.totalPerCategory),quantity:s,total:o,isBold:!0}),i+=s})),u.push({name:a.total,key:"".concat(a.total,".").concat(l),quantity:i,total:l,isBold:!0}),u};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@licklist/core/dist/Config"),o=require("luxon"),a={shortQuantity:"shortQuantity",total:"total",totalPerCategory:"totalPerCategory"};exports.TRANSLATION_KEYS=a,exports.convertEventStatisticToTableData=function(r,e){var n,c,i=0,u=0;if(!e)return[];var l=[],y=o.DateTime.fromISO(r).toUTC().toFormat(t.DATE_FORMAT),s=null!==(c=null===(n=Object.keys(null==e?void 0:e.productCategorySummary))||void 0===n?void 0:n.filter((function(a){return o.DateTime.fromFormat(a,t.DATE_TIME_FULL_FORMAT).toFormat(t.DATE_FORMAT)===y})))&&void 0!==c?c:[];return s.map((function(t){return null==e?void 0:e.productCategorySummary[t]})).forEach((function(t){t.forEach((function(t){var o=t.totalPerCategory,r=t.productsSummary,e=void 0===r?[]:r,n=t.categoryName,c=t.eventId,y=0;i+=o||0,l.push({name:n,key:"".concat(c,".").concat(n),isBold:!0,isHeader:!0,quantity:a.shortQuantity,total:a.total}),null==e||e.forEach((function(t){var o=t.productsSold,a=t.name,r=t.totalQuantity,e=t.total;y+=o,l.push({name:a,key:"".concat(c,".").concat(n,".").concat(a),quantity:r?"".concat(o," / ").concat(r):String(o),total:String(e)})})),l.push({name:a.totalPerCategory,key:"".concat(c,".").concat(n,".").concat(a.totalPerCategory),quantity:y,total:o,isBold:!0}),u+=y}))})),l.push({name:a.total,key:"".concat(a.total,".").concat(i),quantity:u,total:i,isBold:!0}),l};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.547",
3
+ "version": "0.44.548",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -1,6 +1,6 @@
1
1
  import { EventStatistic } from "@licklist/core/dist/DataMapper/Provider/EventStatisticDataMapper";
2
2
  import { DateTime } from "luxon";
3
- import { DATE_TIME_FULL_FORMAT } from "@licklist/core/dist/Config";
3
+ import { DATE_FORMAT, DATE_TIME_FULL_FORMAT } from "@licklist/core/dist/Config";
4
4
 
5
5
  export const TRANSLATION_KEYS = {
6
6
  shortQuantity: "shortQuantity",
@@ -30,51 +30,61 @@ export const convertEventStatisticToTableData = (
30
30
 
31
31
  const summaryFormattedDate = DateTime.fromISO(date)
32
32
  .toUTC()
33
- .toFormat(DATE_TIME_FULL_FORMAT);
33
+ .toFormat(DATE_FORMAT);
34
34
 
35
- Object.values(
36
- eventStatistic?.productCategorySummary[summaryFormattedDate] ?? {}
37
- )?.forEach(
38
- ({ totalPerCategory, productsSummary = [], categoryName, eventId }) => {
39
- let quantity = 0;
35
+ const summaryDays =
36
+ Object.keys(eventStatistic?.productCategorySummary)?.filter(
37
+ (date) =>
38
+ DateTime.fromFormat(date, DATE_TIME_FULL_FORMAT).toFormat(
39
+ DATE_FORMAT
40
+ ) === summaryFormattedDate
41
+ ) ?? [];
40
42
 
41
- totalAmount += totalPerCategory || 0;
43
+ summaryDays
44
+ .map((day) => eventStatistic?.productCategorySummary[day])
45
+ .forEach((summaries) => {
46
+ summaries.forEach(
47
+ ({ totalPerCategory, productsSummary = [], categoryName, eventId }) => {
48
+ let quantity = 0;
42
49
 
43
- tableDataArray.push({
44
- name: categoryName,
45
- key: `${eventId}.${categoryName}`,
46
- isBold: true,
47
- isHeader: true,
48
- quantity: TRANSLATION_KEYS.shortQuantity,
49
- total: TRANSLATION_KEYS.total,
50
- });
50
+ totalAmount += totalPerCategory || 0;
51
51
 
52
- productsSummary?.forEach(
53
- ({ productsSold, name, totalQuantity, total }) => {
54
- quantity += productsSold;
52
+ tableDataArray.push({
53
+ name: categoryName,
54
+ key: `${eventId}.${categoryName}`,
55
+ isBold: true,
56
+ isHeader: true,
57
+ quantity: TRANSLATION_KEYS.shortQuantity,
58
+ total: TRANSLATION_KEYS.total,
59
+ });
60
+
61
+ productsSummary?.forEach(
62
+ ({ productsSold, name, totalQuantity, total }) => {
63
+ quantity += productsSold;
64
+
65
+ tableDataArray.push({
66
+ name,
67
+ key: `${eventId}.${categoryName}.${name}`,
68
+ quantity: totalQuantity
69
+ ? `${productsSold} / ${totalQuantity}`
70
+ : String(productsSold),
71
+ total: String(total),
72
+ });
73
+ }
74
+ );
55
75
 
56
76
  tableDataArray.push({
57
- name,
58
- key: `${eventId}.${categoryName}.${name}`,
59
- quantity: totalQuantity
60
- ? `${productsSold} / ${totalQuantity}`
61
- : String(productsSold),
62
- total: String(total),
77
+ name: TRANSLATION_KEYS.totalPerCategory,
78
+ key: `${eventId}.${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
79
+ quantity,
80
+ total: totalPerCategory,
81
+ isBold: true,
63
82
  });
83
+
84
+ totalQuantity += quantity;
64
85
  }
65
86
  );
66
-
67
- tableDataArray.push({
68
- name: TRANSLATION_KEYS.totalPerCategory,
69
- key: `${eventId}.${categoryName}.${TRANSLATION_KEYS.totalPerCategory}`,
70
- quantity,
71
- total: totalPerCategory,
72
- isBold: true,
73
- });
74
-
75
- totalQuantity += quantity;
76
- }
77
- );
87
+ });
78
88
 
79
89
  tableDataArray.push({
80
90
  name: TRANSLATION_KEYS.total,