@nkhang1902/strapi-plugin-export-import-clsx 1.4.2 → 1.4.4

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.
@@ -56,9 +56,7 @@ const ExportButtonsEditView = (props) => {
56
56
 
57
57
  setIsExporting(true);
58
58
  try {
59
- const parts = window.location.pathname.split('/').filter(Boolean);
60
- const documentId = parts[parts.indexOf('event-manager') + 3];
61
- console.log(documentId)
59
+ const documentId = window.location.pathname.split('/').pop();
62
60
  const queryParams = new URLSearchParams({
63
61
  format: "excel",
64
62
  contentType: contentType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkhang1902/strapi-plugin-export-import-clsx",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "A powerful Strapi plugin for exporting and importing data with Excel support and advanced filtering",
5
5
  "main": "./strapi-server.js",
6
6
  "scripts": {
@@ -102,7 +102,6 @@ module.exports = ({ strapi }) => ({
102
102
  } catch (error) {
103
103
  strapi.log.error(`Failed to query entries:`, error);
104
104
  }
105
- console.log({entries})
106
105
 
107
106
  strapi.log.info(
108
107
  `Final result: ${
@@ -118,7 +117,9 @@ module.exports = ({ strapi }) => ({
118
117
  }
119
118
  }
120
119
 
121
- if (format === "excel") {
120
+ if (format === "excel" && mode === "participant") {
121
+ return this.convertExperienceParticipantsToExcel(entries[0]);
122
+ } else {
122
123
  return this.convertToExcel(exportData.data);
123
124
  }
124
125
 
@@ -394,6 +395,46 @@ module.exports = ({ strapi }) => ({
394
395
  return XLSX.write(workbook, { type: "buffer", bookType: "xlsx" });
395
396
  },
396
397
 
398
+ convertExperienceParticipantsToExcel(experienceData) {
399
+ const workbook = XLSX.utils.book_new();
400
+
401
+ const corporates = experienceData?.corporates ?? [];
402
+ const investors = experienceData?.investors ?? [];
403
+ const vipGuests = experienceData?.vipGuests ?? [];
404
+
405
+ const participants = [
406
+ ...corporates,
407
+ ...investors,
408
+ ...vipGuests,
409
+ ];
410
+ console.log(participants)
411
+
412
+ const data = participants.map((p) => ({
413
+ corporateName: p.corporateName ?? '',
414
+ tickerCode: p.tickerCode ?? '',
415
+ fullName:
416
+ p.fullName ??
417
+ [p.firstName, p.lastName].filter(Boolean).join(' ') ??
418
+ '',
419
+ firstName: p.firstName ?? '',
420
+ lastName: p.lastName ?? '',
421
+ businessEmail: p.businessEmail ?? '',
422
+ mobile: p.mobile ?? '',
423
+ }));
424
+
425
+ const worksheet = XLSX.utils.json_to_sheet(data);
426
+ XLSX.utils.book_append_sheet(
427
+ workbook,
428
+ worksheet,
429
+ 'Participants List'
430
+ );
431
+
432
+ return XLSX.write(workbook, {
433
+ type: 'buffer',
434
+ bookType: 'xlsx',
435
+ });
436
+ },
437
+
397
438
  async exportSingleEntry(contentType, entryId) {
398
439
  try {
399
440
  const entry = await strapi.entityService.findOne(contentType, entryId, {