@acorex/connectivity 20.0.21 → 20.0.23

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.
@@ -7,11 +7,12 @@ import * as i2 from '@acorex/platform/auth';
7
7
  import { AXPSessionService, AXP_APPLICATION_LOADER, AXP_FEATURE_LOADER, AXP_PERMISSION_LOADER, AXP_TENANT_LOADER, AXPAuthModule } from '@acorex/platform/auth';
8
8
  import * as i0 from '@angular/core';
9
9
  import { inject, Injectable, NgModule } from '@angular/core';
10
- import { AXPLockService, AXPFileStorageStatus, AXPRegionalService, AXPFileStorageService, AXP_SEARCH_PROVIDER } from '@acorex/platform/common';
10
+ import { AXPLockService, AXPFileStorageStatus, AXPFileStorageService, AXPRegionalService, AXP_SEARCH_PROVIDER } from '@acorex/platform/common';
11
11
  import { AXSafePipe } from '@acorex/core/pipes';
12
12
  import { RootConfig, AXMUsersEntityService, AXMSessionStatusTypes, AXMDeviceSessionsServiceImpl, AXMDeviceSessionsService } from '@acorex/modules/security-management';
13
13
  import { AXMFormTemplateTypes, RootConfig as RootConfig$1, AXMFormTemplateManagementCategoryEntityServiceImpl, AXMFormTemplateManagementCategoryEntityService, AXMPermissionsKeys } from '@acorex/modules/form-template-management';
14
14
  import { AXMOrganizationNodeType, RootConfig as RootConfig$2 } from '@acorex/modules/organization-management';
15
+ import { AXPRuntimeModule, provideCommandSetups, AXPQueryService } from '@acorex/platform/runtime';
15
16
  import { RootConfig as RootConfig$3 } from '@acorex/modules/report-management';
16
17
  import { AXPWidgetsList } from '@acorex/modules/common';
17
18
  import { RootConfig as RootConfig$4 } from '@acorex/modules/contact-management';
@@ -22,7 +23,6 @@ import { filter, throttleTime, take, of, delay, firstValueFrom } from 'rxjs';
22
23
  import { AXMPermissionsKeys as AXMPermissionsKeys$1, RootConfig as RootConfig$e } from '@acorex/modules/issue-management';
23
24
  import { RootConfig as RootConfig$7, AXMMetaDataDefinitionCategoryServiceImpl, AXMMetaDataDefinitionService, AXMMetaDataDefinitionCategoryService } from '@acorex/modules/platform-management';
24
25
  import { AXFileService } from '@acorex/core/file';
25
- import { AXTranslationService } from '@acorex/core/translation';
26
26
  import { RootConfig as RootConfig$8 } from '@acorex/modules/text-template-management';
27
27
  import { RootConfig as RootConfig$9 } from '@acorex/modules/scheduler-job-management';
28
28
  import { APPLICATION_SOURCE_NAME, MODULE_SOURCE_NAME, ENTITY_SOURCE_NAME, FEATURE_SOURCE_NAME, PERMISSION_SOURCE_NAME, PROPERTY_SOURCE_NAME, AXPModuleDesignerService } from '@acorex/modules/application-management';
@@ -30,6 +30,7 @@ import { RootConfig as RootConfig$b } from '@acorex/modules/training-management'
30
30
  import { RootConfig as RootConfig$c } from '@acorex/modules/project-management';
31
31
  import { RootConfig as RootConfig$d, AXMFolderServiceImpl, AXMDocumentServiceImpl, AXMFolderService, AXMDocumentService } from '@acorex/modules/document-management';
32
32
  import { RootConfig as RootConfig$f } from '@acorex/modules/log-management';
33
+ import { AXTranslationService } from '@acorex/core/translation';
33
34
  import { RootConfig as RootConfig$g } from '@acorex/modules/calendar-management';
34
35
  import { RootConfig as RootConfig$h } from '@acorex/modules/data-management';
35
36
  import { convertArrayToDataSource } from '@acorex/cdk/common';
@@ -194,13 +195,50 @@ class AXPDexieEntityStorageService extends Dexie {
194
195
  isCurrent: true
195
196
  });
196
197
  }
197
- async initial(entityName, collection) {
198
- const exists = await this.table('entity-store').where({ entityName }).count();
198
+ //#region ---- Initialization Methods ----
199
+ /**
200
+ * Seed the storage with the provided collection only if it has not been
201
+ * inserted before.
202
+ *
203
+ * Rather than relying on the total record count, we inspect whether the first
204
+ * item of the incoming collection (identified by its `id`) already exists in
205
+ * the table for the given `entityName`. If it exists, the data has already
206
+ * been seeded and no action is taken; otherwise, the entire collection is
207
+ * bulk-inserted.
208
+ */
209
+ async initial(entityName, collection, options = { mergeType: 'merge', uniqueKeys: ['name'] }) {
210
+ // Return early when collection is empty
211
+ if (!collection?.length) {
212
+ return collection;
213
+ }
214
+ // Build existence check based on provided unique keys rather than hard-coded `id`
215
+ const firstItem = collection[0];
216
+ const uniqueKeys = options.uniqueKeys;
217
+ let exists = 0;
218
+ if (await this.table('entity-store').where({ entityName }).count() > 0) {
219
+ for (const key of uniqueKeys) {
220
+ const existingRecord = await this.table('entity-store')
221
+ .where({ entityName })
222
+ .filter((rec) => rec[key] === firstItem[key])
223
+ .first();
224
+ if (existingRecord) {
225
+ exists = 1;
226
+ break; // Stop iterating once a match is found
227
+ }
228
+ }
229
+ }
199
230
  if (exists === 0) {
200
- await this.table('entity-store').bulkAdd(collection.map((item) => ({ ...item, entityName })));
231
+ if (options?.mergeType === 'merge') {
232
+ await this.table('entity-store').bulkAdd(collection.map((item) => ({ ...item, entityName })));
233
+ }
234
+ else {
235
+ await this.table('entity-store').where({ entityName }).delete();
236
+ await this.table('entity-store').bulkAdd(collection.map((item) => ({ ...item, entityName })));
237
+ }
201
238
  }
202
239
  return collection;
203
240
  }
241
+ //#endregion
204
242
  async getOne(entityName, id) {
205
243
  return await this.table('entity-store').where({ entityName, id: id }).first();
206
244
  }
@@ -2207,8 +2245,12 @@ const commonParameterGroups = [
2207
2245
  widget: {
2208
2246
  type: AXPWidgetsList.Editors.DateTimeBox,
2209
2247
  options: {
2210
- showTime: false,
2211
- format: 'yyyy-MM-dd'
2248
+ format: 'date',
2249
+ validations: [
2250
+ {
2251
+ rule: 'required',
2252
+ }
2253
+ ]
2212
2254
  }
2213
2255
  },
2214
2256
  },
@@ -2219,8 +2261,7 @@ const commonParameterGroups = [
2219
2261
  widget: {
2220
2262
  type: AXPWidgetsList.Editors.DateTimeBox,
2221
2263
  options: {
2222
- showTime: false,
2223
- format: 'yyyy-MM-dd'
2264
+ format: 'date',
2224
2265
  }
2225
2266
  },
2226
2267
  },
@@ -2909,6 +2950,80 @@ const ergonomicsParameterGroups = [
2909
2950
  }
2910
2951
  ];
2911
2952
  //#endregion
2953
+ //#region ---- Column Definitions Generator ----
2954
+ function generateColumnsForReportType(reportTitle) {
2955
+ const titleLower = reportTitle.toLowerCase();
2956
+ if (titleLower.includes('balance sheet') || titleLower.includes('financial')) {
2957
+ return [
2958
+ { field: 'account', title: 'Account', visible: true, width: 150, align: 'left' },
2959
+ { field: 'accountCode', title: 'Code', visible: true, width: 100, align: 'left' },
2960
+ { field: 'currentAmount', title: 'Current Amount', visible: true, width: 120, align: 'right' },
2961
+ { field: 'previousAmount', title: 'Previous Amount', visible: true, width: 120, align: 'right' },
2962
+ { field: 'variance', title: 'Variance', visible: true, width: 100, align: 'right' },
2963
+ { field: 'percentage', title: 'Change %', visible: true, width: 80, align: 'right' },
2964
+ { field: 'category', title: 'Category', visible: true, width: 100, align: 'left' },
2965
+ ];
2966
+ }
2967
+ else if (titleLower.includes('income') || titleLower.includes('profit')) {
2968
+ return [
2969
+ { field: 'lineItem', title: 'Line Item', visible: true, width: 150, align: 'left' },
2970
+ { field: 'amount', title: 'Amount', visible: true, width: 120, align: 'right' },
2971
+ { field: 'budget', title: 'Budget', visible: true, width: 120, align: 'right' },
2972
+ { field: 'variance', title: 'Variance', visible: true, width: 100, align: 'right' },
2973
+ { field: 'percentOfRevenue', title: '% of Revenue', visible: true, width: 100, align: 'right' },
2974
+ { field: 'category', title: 'Category', visible: true, width: 100, align: 'left' },
2975
+ ];
2976
+ }
2977
+ else if (titleLower.includes('employee') || titleLower.includes('performance')) {
2978
+ return [
2979
+ { field: 'employeeId', title: 'Employee ID', visible: true, width: 100, align: 'left' },
2980
+ { field: 'name', title: 'Name', visible: true, width: 150, align: 'left' },
2981
+ { field: 'department', title: 'Department', visible: true, width: 120, align: 'left' },
2982
+ { field: 'position', title: 'Position', visible: true, width: 120, align: 'left' },
2983
+ { field: 'performanceScore', title: 'Score', visible: true, width: 80, align: 'center' },
2984
+ { field: 'goalsCompleted', title: 'Goals Done', visible: true, width: 90, align: 'center' },
2985
+ { field: 'totalGoals', title: 'Total Goals', visible: true, width: 90, align: 'center' },
2986
+ { field: 'status', title: 'Status', visible: true, width: 80, align: 'center' },
2987
+ ];
2988
+ }
2989
+ else if (titleLower.includes('sales') || titleLower.includes('revenue')) {
2990
+ return [
2991
+ { field: 'salesRep', title: 'Sales Rep', visible: true, width: 120, align: 'left' },
2992
+ { field: 'product', title: 'Product', visible: true, width: 100, align: 'left' },
2993
+ { field: 'region', title: 'Region', visible: true, width: 80, align: 'left' },
2994
+ { field: 'customer', title: 'Customer', visible: true, width: 150, align: 'left' },
2995
+ { field: 'revenue', title: 'Revenue', visible: true, width: 100, align: 'right' },
2996
+ { field: 'units', title: 'Units', visible: true, width: 80, align: 'right' },
2997
+ { field: 'commission', title: 'Commission', visible: true, width: 100, align: 'right' },
2998
+ { field: 'status', title: 'Status', visible: true, width: 80, align: 'center' },
2999
+ ];
3000
+ }
3001
+ else if (titleLower.includes('incident') || titleLower.includes('safety')) {
3002
+ return [
3003
+ { field: 'incidentId', title: 'Incident ID', visible: true, width: 100, align: 'left' },
3004
+ { field: 'type', title: 'Type', visible: true, width: 120, align: 'left' },
3005
+ { field: 'severity', title: 'Severity', visible: true, width: 80, align: 'center' },
3006
+ { field: 'location', title: 'Location', visible: true, width: 120, align: 'left' },
3007
+ { field: 'reportedBy', title: 'Reported By', visible: true, width: 120, align: 'left' },
3008
+ { field: 'dateReported', title: 'Date Reported', visible: true, width: 100, align: 'center' },
3009
+ { field: 'status', title: 'Status', visible: true, width: 100, align: 'center' },
3010
+ { field: 'daysToResolve', title: 'Days to Resolve', visible: true, width: 100, align: 'right' },
3011
+ ];
3012
+ }
3013
+ else {
3014
+ // Generic columns for other report types
3015
+ return [
3016
+ { field: 'title', title: 'Title', visible: true, width: 200, align: 'left' },
3017
+ { field: 'category', title: 'Category', visible: true, width: 100, align: 'left' },
3018
+ { field: 'value', title: 'Value', visible: true, width: 80, align: 'right' },
3019
+ { field: 'status', title: 'Status', visible: true, width: 80, align: 'center' },
3020
+ { field: 'priority', title: 'Priority', visible: true, width: 80, align: 'center' },
3021
+ { field: 'owner', title: 'Owner', visible: true, width: 120, align: 'left' },
3022
+ { field: 'createdDate', title: 'Created', visible: true, width: 100, align: 'center' },
3023
+ ];
3024
+ }
3025
+ }
3026
+ //#endregion
2912
3027
  //#region ---- Mock Report Definitions ----
2913
3028
  function generateReportDefinitions() {
2914
3029
  const reports = [];
@@ -3241,22 +3356,7 @@ function generateReportDefinitions() {
3241
3356
  },
3242
3357
  layout: {
3243
3358
  type: 'table',
3244
- columns: [
3245
- {
3246
- field: 'name',
3247
- title: 'Name',
3248
- visible: true,
3249
- width: 100,
3250
- align: 'left',
3251
- },
3252
- {
3253
- field: 'age',
3254
- title: 'Age',
3255
- visible: true,
3256
- width: 100,
3257
- align: 'left',
3258
- },
3259
- ],
3359
+ columns: generateColumnsForReportType(report.title),
3260
3360
  },
3261
3361
  export: {
3262
3362
  fileNameTemplate: 'Report_{date}_{user}',
@@ -3311,19 +3411,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
3311
3411
 
3312
3412
  class AXCReportManagementMockModule {
3313
3413
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCReportManagementMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3314
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: AXCReportManagementMockModule }); }
3414
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: AXCReportManagementMockModule, imports: [AXPRuntimeModule] }); }
3315
3415
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCReportManagementMockModule, providers: [
3316
3416
  {
3317
3417
  provide: AXP_DATA_SEEDER_TOKEN,
3318
3418
  useClass: AXPReportManagementDataSeeder,
3319
3419
  multi: true,
3320
3420
  },
3321
- ] }); }
3421
+ provideCommandSetups([
3422
+ {
3423
+ key: 'ReportManagement.Report:Execute',
3424
+ command: () => Promise.resolve().then(function () { return execute_command; }).then((c) => c.AXMReportExecuteCommand),
3425
+ },
3426
+ ]),
3427
+ ], imports: [AXPRuntimeModule] }); }
3322
3428
  }
3323
3429
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCReportManagementMockModule, decorators: [{
3324
3430
  type: NgModule,
3325
3431
  args: [{
3326
- imports: [],
3432
+ imports: [AXPRuntimeModule],
3327
3433
  exports: [],
3328
3434
  declarations: [],
3329
3435
  providers: [
@@ -3332,6 +3438,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
3332
3438
  useClass: AXPReportManagementDataSeeder,
3333
3439
  multi: true,
3334
3440
  },
3441
+ provideCommandSetups([
3442
+ {
3443
+ key: 'ReportManagement.Report:Execute',
3444
+ command: () => Promise.resolve().then(function () { return execute_command; }).then((c) => c.AXMReportExecuteCommand),
3445
+ },
3446
+ ]),
3335
3447
  ],
3336
3448
  }]
3337
3449
  }] });
@@ -6521,100 +6633,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
6521
6633
  type: Injectable
6522
6634
  }], ctorParameters: () => [] });
6523
6635
 
6524
- class AXCRegionalServiceImpl extends AXPRegionalService {
6525
- constructor() {
6526
- super(...arguments);
6527
- this.languageService = inject(AXTranslationService);
6528
- }
6529
- async getCountries() {
6530
- const lang = await firstValueFrom(this.languageService.langChanges$);
6531
- const { countries } = await import('./acorex-connectivity-mock-countries-DHRrtbwM.mjs');
6532
- return countries.map((country) => {
6533
- if (lang == country.regional) {
6534
- return {
6535
- ...country,
6536
- title: country.native,
6537
- };
6538
- }
6539
- else {
6540
- return country;
6541
- }
6542
- });
6543
- }
6544
- async getProvinces(countryId) {
6545
- const lang = await firstValueFrom(this.languageService.langChanges$);
6546
- const country = await this.getCountries();
6547
- const data = country
6548
- .filter((c) => !countryId || c.code === countryId)
6549
- .flatMap((c) => c.provinces?.map((province) => {
6550
- if (lang == c.regional) {
6551
- return {
6552
- ...province,
6553
- title: province.native,
6554
- };
6555
- }
6556
- else {
6557
- return province;
6558
- }
6559
- }) ?? []);
6560
- return data;
6561
- }
6562
- async getCities(filter = {}) {
6563
- const { countryId, provinceId } = filter;
6564
- const countries = await this.getCountries();
6565
- const lang = await firstValueFrom(this.languageService.langChanges$);
6566
- const filteredCountries = countryId ? countries.filter((c) => c.code === countryId) : countries;
6567
- const provinces = filteredCountries.flatMap((c) => c.provinces ?? []);
6568
- const filteredProvinces = provinceId ? provinces.filter((p) => p.code === provinceId) : provinces;
6569
- filteredProvinces.forEach((province) => {
6570
- province.cities = province.cities?.map((city) => {
6571
- const country = countries.find((c) => c.provinces?.some((p) => p.code === province.code));
6572
- if (country && lang == country.regional) {
6573
- return {
6574
- ...city,
6575
- title: city.native,
6576
- };
6577
- }
6578
- else {
6579
- return city;
6580
- }
6581
- });
6582
- });
6583
- return filteredProvinces.flatMap((p) => p.cities ?? []);
6584
- }
6585
- async getCurrencies() {
6586
- const { currencies } = await import('./acorex-connectivity-mock-currencies-B-x3Mxql.mjs');
6587
- return currencies;
6588
- }
6589
- async getLocaleProfiles() {
6590
- const { profiles } = await import('./acorex-connectivity-mock-profiles-MJ9xFTtp.mjs');
6591
- return profiles.filter((c) => ['en-US', 'fa-IR'].some((e) => e == c.localeInfo.code));
6592
- }
6593
- async getLanguages() {
6594
- return (await this.getLocaleProfiles()).map((c) => ({ code: c.localeInfo.code, title: c.title }));
6595
- }
6596
- async getAvailableLanguages() {
6597
- return (await this.getLanguages()).filter((c) => ['fa-IR', 'en-US'].some((e) => e == c.code));
6598
- }
6599
- async getTimeZones() {
6600
- const { timeZones } = await import('./acorex-connectivity-mock-timezones-CnNQ6EXw.mjs');
6601
- return timeZones;
6602
- }
6603
- async getBrowserTimeZoneCode() {
6604
- const { timeZones } = await import('./acorex-connectivity-mock-timezones-CnNQ6EXw.mjs');
6605
- const now = new Date();
6606
- // Calculate offset in hours and minutes
6607
- const offsetMinutes = now.getTimezoneOffset();
6608
- const offsetHours = Math.floor(-offsetMinutes / 60);
6609
- const offsetRemainder = Math.abs(offsetMinutes % 60);
6610
- // Format the offset properly
6611
- const formattedOffset = `UTC${offsetHours >= 0 ? '+' : ''}${offsetHours}${offsetRemainder ? `:${offsetRemainder.toString().padStart(2, '0')}` : ''}`;
6612
- // Find matching time zone
6613
- const matchedZone = timeZones.find((zone) => zone.code === formattedOffset);
6614
- return matchedZone ? matchedZone.code : 'UTC';
6615
- }
6616
- }
6617
-
6618
6636
  class AXCPlatformManagementMockModule {
6619
6637
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCPlatformManagementMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
6620
6638
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: AXCPlatformManagementMockModule }); }
@@ -6647,10 +6665,6 @@ class AXCPlatformManagementMockModule {
6647
6665
  provide: AXPFileStorageService,
6648
6666
  useClass: AXCFileStorageService,
6649
6667
  },
6650
- {
6651
- provide: AXPRegionalService,
6652
- useClass: AXCRegionalServiceImpl,
6653
- },
6654
6668
  ] }); }
6655
6669
  }
6656
6670
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCPlatformManagementMockModule, decorators: [{
@@ -6688,10 +6702,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
6688
6702
  provide: AXPFileStorageService,
6689
6703
  useClass: AXCFileStorageService,
6690
6704
  },
6691
- {
6692
- provide: AXPRegionalService,
6693
- useClass: AXCRegionalServiceImpl,
6694
- },
6695
6705
  ],
6696
6706
  }]
6697
6707
  }] });
@@ -8462,6 +8472,7 @@ const DOCUMENT_TYPES = [
8462
8472
  title: 'Risk Assessment Report',
8463
8473
  maxSize: 5000,
8464
8474
  isEncrypted: false,
8475
+ enableVersioning: true,
8465
8476
  isMultiple: true,
8466
8477
  meta: [
8467
8478
  {
@@ -8505,6 +8516,7 @@ const DOCUMENT_TYPES = [
8505
8516
  title: 'Upload File',
8506
8517
  maxSize: 50000,
8507
8518
  isEncrypted: false,
8519
+ enableVersioning: false,
8508
8520
  isMultiple: false,
8509
8521
  meta: [],
8510
8522
  type: {
@@ -9770,6 +9782,100 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
9770
9782
  type: Injectable
9771
9783
  }], ctorParameters: () => [] });
9772
9784
 
9785
+ class AXCRegionalServiceImpl extends AXPRegionalService {
9786
+ constructor() {
9787
+ super(...arguments);
9788
+ this.languageService = inject(AXTranslationService);
9789
+ }
9790
+ async getCountries() {
9791
+ const lang = await firstValueFrom(this.languageService.langChanges$);
9792
+ const { countries } = await import('./acorex-connectivity-mock-countries-DHRrtbwM.mjs');
9793
+ return countries.map((country) => {
9794
+ if (lang == country.regional) {
9795
+ return {
9796
+ ...country,
9797
+ title: country.native,
9798
+ };
9799
+ }
9800
+ else {
9801
+ return country;
9802
+ }
9803
+ });
9804
+ }
9805
+ async getProvinces(countryId) {
9806
+ const lang = await firstValueFrom(this.languageService.langChanges$);
9807
+ const country = await this.getCountries();
9808
+ const data = country
9809
+ .filter((c) => !countryId || c.code === countryId)
9810
+ .flatMap((c) => c.provinces?.map((province) => {
9811
+ if (lang == c.regional) {
9812
+ return {
9813
+ ...province,
9814
+ title: province.native,
9815
+ };
9816
+ }
9817
+ else {
9818
+ return province;
9819
+ }
9820
+ }) ?? []);
9821
+ return data;
9822
+ }
9823
+ async getCities(filter = {}) {
9824
+ const { countryId, provinceId } = filter;
9825
+ const countries = await this.getCountries();
9826
+ const lang = await firstValueFrom(this.languageService.langChanges$);
9827
+ const filteredCountries = countryId ? countries.filter((c) => c.code === countryId) : countries;
9828
+ const provinces = filteredCountries.flatMap((c) => c.provinces ?? []);
9829
+ const filteredProvinces = provinceId ? provinces.filter((p) => p.code === provinceId) : provinces;
9830
+ filteredProvinces.forEach((province) => {
9831
+ province.cities = province.cities?.map((city) => {
9832
+ const country = countries.find((c) => c.provinces?.some((p) => p.code === province.code));
9833
+ if (country && lang == country.regional) {
9834
+ return {
9835
+ ...city,
9836
+ title: city.native,
9837
+ };
9838
+ }
9839
+ else {
9840
+ return city;
9841
+ }
9842
+ });
9843
+ });
9844
+ return filteredProvinces.flatMap((p) => p.cities ?? []);
9845
+ }
9846
+ async getCurrencies() {
9847
+ const { currencies } = await import('./acorex-connectivity-mock-currencies-B-x3Mxql.mjs');
9848
+ return currencies;
9849
+ }
9850
+ async getLocaleProfiles() {
9851
+ const { profiles } = await import('./acorex-connectivity-mock-profiles-MJ9xFTtp.mjs');
9852
+ return profiles.filter((c) => ['en-US', 'fa-IR'].some((e) => e == c.localeInfo.code));
9853
+ }
9854
+ async getLanguages() {
9855
+ return (await this.getLocaleProfiles()).map((c) => ({ code: c.localeInfo.code, title: c.title }));
9856
+ }
9857
+ async getAvailableLanguages() {
9858
+ return (await this.getLanguages()).filter((c) => ['fa-IR', 'en-US'].some((e) => e == c.code));
9859
+ }
9860
+ async getTimeZones() {
9861
+ const { timeZones } = await import('./acorex-connectivity-mock-timezones-CnNQ6EXw.mjs');
9862
+ return timeZones;
9863
+ }
9864
+ async getBrowserTimeZoneCode() {
9865
+ const { timeZones } = await import('./acorex-connectivity-mock-timezones-CnNQ6EXw.mjs');
9866
+ const now = new Date();
9867
+ // Calculate offset in hours and minutes
9868
+ const offsetMinutes = now.getTimezoneOffset();
9869
+ const offsetHours = Math.floor(-offsetMinutes / 60);
9870
+ const offsetRemainder = Math.abs(offsetMinutes % 60);
9871
+ // Format the offset properly
9872
+ const formattedOffset = `UTC${offsetHours >= 0 ? '+' : ''}${offsetHours}${offsetRemainder ? `:${offsetRemainder.toString().padStart(2, '0')}` : ''}`;
9873
+ // Find matching time zone
9874
+ const matchedZone = timeZones.find((zone) => zone.code === formattedOffset);
9875
+ return matchedZone ? matchedZone.code : 'UTC';
9876
+ }
9877
+ }
9878
+
9773
9879
  class AXCCommonMockModule {
9774
9880
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
9775
9881
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule }); }
@@ -9788,6 +9894,10 @@ class AXCCommonMockModule {
9788
9894
  provide: AXPLockService,
9789
9895
  useClass: AXCLockService,
9790
9896
  },
9897
+ {
9898
+ provide: AXPRegionalService,
9899
+ useClass: AXCRegionalServiceImpl
9900
+ }
9791
9901
  ] }); }
9792
9902
  }
9793
9903
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, decorators: [{
@@ -9811,6 +9921,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
9811
9921
  provide: AXPLockService,
9812
9922
  useClass: AXCLockService,
9813
9923
  },
9924
+ {
9925
+ provide: AXPRegionalService,
9926
+ useClass: AXCRegionalServiceImpl
9927
+ }
9814
9928
  ],
9815
9929
  }]
9816
9930
  }] });
@@ -10519,6 +10633,206 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
10519
10633
  }]
10520
10634
  }], ctorParameters: () => [{ type: i1.AXPAppStartUpService }, { type: i0.Injector }] });
10521
10635
 
10636
+ class AXMReportExecuteCommand {
10637
+ constructor() {
10638
+ this.queryService = inject(AXPQueryService);
10639
+ }
10640
+ //#region ---- Command Implementation ----
10641
+ async execute(input) {
10642
+ try {
10643
+ const { reportId, parameters, page = 1, pageSize = 50 } = input;
10644
+ // Find the report definition
10645
+ const reportDefinition = await this.queryService.fetch("ReportManagement.Report:GetById", reportId);
10646
+ if (!reportDefinition) {
10647
+ throw new Error(`Report with ID ${reportId} not found`);
10648
+ }
10649
+ // Generate mock data based on report type and parameters
10650
+ const mockData = this.generateMockDataForReport(reportDefinition, parameters, pageSize);
10651
+ // Simulate total records (more than current page)
10652
+ const total = Math.max(mockData.length, pageSize * 3 + Math.floor(Math.random() * 50));
10653
+ return {
10654
+ data: mockData,
10655
+ total,
10656
+ page,
10657
+ pageSize
10658
+ };
10659
+ }
10660
+ catch (error) {
10661
+ console.error('Error executing report:', error);
10662
+ throw new Error('Failed to execute report');
10663
+ }
10664
+ }
10665
+ //#endregion
10666
+ //#region ---- Mock Data Generation Based on Report Type ----
10667
+ generateMockDataForReport(reportDefinition, parameters, pageSize) {
10668
+ const reportTitle = reportDefinition.title.toLowerCase();
10669
+ const data = [];
10670
+ // Generate data based on report type
10671
+ if (reportTitle.includes('balance sheet') || reportTitle.includes('financial')) {
10672
+ return this.generateFinancialData(reportDefinition, parameters, pageSize);
10673
+ }
10674
+ else if (reportTitle.includes('income') || reportTitle.includes('profit')) {
10675
+ return this.generateIncomeData(reportDefinition, parameters, pageSize);
10676
+ }
10677
+ else if (reportTitle.includes('employee') || reportTitle.includes('performance')) {
10678
+ return this.generateEmployeeData(reportDefinition, parameters, pageSize);
10679
+ }
10680
+ else if (reportTitle.includes('sales') || reportTitle.includes('revenue')) {
10681
+ return this.generateSalesData(reportDefinition, parameters, pageSize);
10682
+ }
10683
+ else if (reportTitle.includes('incident') || reportTitle.includes('safety')) {
10684
+ return this.generateSafetyData(reportDefinition, parameters, pageSize);
10685
+ }
10686
+ else {
10687
+ return this.generateGenericData(reportDefinition, parameters, pageSize);
10688
+ }
10689
+ }
10690
+ generateFinancialData(reportDefinition, parameters, pageSize) {
10691
+ const data = [];
10692
+ const accounts = ['Cash', 'Accounts Receivable', 'Inventory', 'Equipment', 'Accounts Payable', 'Long-term Debt', 'Equity'];
10693
+ for (let i = 0; i < pageSize; i++) {
10694
+ data.push({
10695
+ id: AXPDataGenerator.uuid(),
10696
+ account: accounts[i % accounts.length],
10697
+ accountCode: `${1000 + i}`,
10698
+ currentAmount: AXPDataGenerator.number(10000, 1000000),
10699
+ previousAmount: AXPDataGenerator.number(10000, 1000000),
10700
+ variance: AXPDataGenerator.number(-50000, 50000),
10701
+ percentage: AXPDataGenerator.number(-25, 25),
10702
+ category: ['Assets', 'Liabilities', 'Equity'][i % 3],
10703
+ period: parameters['period'] || '2024-Q4',
10704
+ lastUpdated: this.getRandomPastDate(30)
10705
+ });
10706
+ }
10707
+ return data;
10708
+ }
10709
+ generateIncomeData(reportDefinition, parameters, pageSize) {
10710
+ const data = [];
10711
+ const items = ['Revenue', 'Cost of Goods Sold', 'Gross Profit', 'Operating Expenses', 'Operating Income', 'Interest Expense', 'Net Income'];
10712
+ for (let i = 0; i < pageSize; i++) {
10713
+ const amount = AXPDataGenerator.number(50000, 2000000);
10714
+ data.push({
10715
+ id: AXPDataGenerator.uuid(),
10716
+ lineItem: items[i % items.length],
10717
+ amount: amount,
10718
+ budget: amount * AXPDataGenerator.number(0.8, 1.2),
10719
+ variance: AXPDataGenerator.number(-100000, 100000),
10720
+ percentOfRevenue: AXPDataGenerator.number(0, 100),
10721
+ month: parameters['month'] || 'December',
10722
+ year: parameters['year'] || 2024,
10723
+ category: ['Revenue', 'Expenses', 'Other'][i % 3]
10724
+ });
10725
+ }
10726
+ return data;
10727
+ }
10728
+ generateEmployeeData(reportDefinition, parameters, pageSize) {
10729
+ const data = [];
10730
+ const departments = ['Engineering', 'Sales', 'Marketing', 'HR', 'Finance', 'Operations'];
10731
+ const positions = ['Manager', 'Senior Specialist', 'Specialist', 'Junior', 'Lead'];
10732
+ for (let i = 0; i < pageSize; i++) {
10733
+ data.push({
10734
+ id: AXPDataGenerator.uuid(),
10735
+ employeeId: `EMP${1000 + i}`,
10736
+ name: `${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}`,
10737
+ department: departments[i % departments.length],
10738
+ position: positions[i % positions.length],
10739
+ performanceScore: AXPDataGenerator.number(1, 5),
10740
+ goalsCompleted: AXPDataGenerator.number(0, 10),
10741
+ totalGoals: AXPDataGenerator.number(8, 12),
10742
+ reviewDate: this.getRandomPastDate(90),
10743
+ manager: `${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}`,
10744
+ hireDate: this.getRandomPastDate(1825), // ~5 years ago
10745
+ status: ['Active', 'On Leave', 'Probation'][i % 3]
10746
+ });
10747
+ }
10748
+ return data;
10749
+ }
10750
+ generateSalesData(reportDefinition, parameters, pageSize) {
10751
+ const data = [];
10752
+ const products = ['Product A', 'Product B', 'Product C', 'Service X', 'Service Y'];
10753
+ const regions = ['North', 'South', 'East', 'West', 'Central'];
10754
+ const companies = ['Acme Corp', 'Tech Solutions Inc', 'Global Industries', 'Innovative Systems', 'Business Partners LLC'];
10755
+ for (let i = 0; i < pageSize; i++) {
10756
+ data.push({
10757
+ id: AXPDataGenerator.uuid(),
10758
+ salesRep: `${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}`,
10759
+ product: products[i % products.length],
10760
+ region: regions[i % regions.length],
10761
+ revenue: AXPDataGenerator.number(1000, 100000),
10762
+ units: AXPDataGenerator.number(1, 500),
10763
+ commission: AXPDataGenerator.number(50, 5000),
10764
+ saleDate: this.getRandomPastDate(365),
10765
+ customer: companies[i % companies.length],
10766
+ status: ['Closed', 'Pending', 'In Progress'][i % 3],
10767
+ quarter: parameters['quarter'] || 'Q4 2024'
10768
+ });
10769
+ }
10770
+ return data;
10771
+ }
10772
+ generateSafetyData(reportDefinition, parameters, pageSize) {
10773
+ const data = [];
10774
+ const incidentTypes = ['Slip/Fall', 'Equipment Malfunction', 'Chemical Exposure', 'Cut/Laceration', 'Burn', 'Strain/Sprain'];
10775
+ const severities = ['Low', 'Medium', 'High', 'Critical'];
10776
+ const locations = ['Factory Floor', 'Warehouse', 'Office', 'Loading Dock', 'Laboratory'];
10777
+ for (let i = 0; i < pageSize; i++) {
10778
+ data.push({
10779
+ id: AXPDataGenerator.uuid(),
10780
+ incidentId: `INC${2024}${String(i + 1).padStart(4, '0')}`,
10781
+ type: incidentTypes[i % incidentTypes.length],
10782
+ severity: severities[i % severities.length],
10783
+ location: locations[i % locations.length],
10784
+ reportedBy: `${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}`,
10785
+ dateReported: this.getRandomPastDate(180),
10786
+ dateOccurred: this.getRandomPastDate(180),
10787
+ description: `Safety incident involving ${incidentTypes[i % incidentTypes.length].toLowerCase()}`,
10788
+ status: ['Open', 'Under Investigation', 'Closed', 'Pending'][i % 4],
10789
+ daysToResolve: AXPDataGenerator.number(1, 30),
10790
+ category: parameters['category'] || 'General Safety'
10791
+ });
10792
+ }
10793
+ return data;
10794
+ }
10795
+ generateGenericData(reportDefinition, parameters, pageSize) {
10796
+ const data = [];
10797
+ for (let i = 0; i < pageSize; i++) {
10798
+ data.push({
10799
+ id: AXPDataGenerator.uuid(),
10800
+ title: `${reportDefinition.title} Item ${i + 1}`,
10801
+ category: parameters['category'] || 'General',
10802
+ value: AXPDataGenerator.number(1, 1000),
10803
+ status: ['Active', 'Pending', 'Completed', 'Draft'][i % 4],
10804
+ createdDate: this.getRandomPastDate(365),
10805
+ updatedDate: this.getRandomPastDate(30),
10806
+ description: `Sample data item ${i + 1} for ${reportDefinition.title}`,
10807
+ priority: ['Low', 'Medium', 'High'][i % 3],
10808
+ owner: `${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}`,
10809
+ tags: [`tag${i % 5}`, `category${i % 3}`]
10810
+ });
10811
+ }
10812
+ return data;
10813
+ }
10814
+ //#endregion
10815
+ //#region ---- Helper Methods ----
10816
+ getRandomPastDate(daysAgo) {
10817
+ const now = new Date();
10818
+ const pastDate = new Date(now.getTime() - (daysAgo * 24 * 60 * 60 * 1000));
10819
+ return AXPDataGenerator.date(pastDate, now);
10820
+ }
10821
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXMReportExecuteCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
10822
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXMReportExecuteCommand, providedIn: 'root' }); }
10823
+ }
10824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXMReportExecuteCommand, decorators: [{
10825
+ type: Injectable,
10826
+ args: [{
10827
+ providedIn: 'root',
10828
+ }]
10829
+ }] });
10830
+
10831
+ var execute_command = /*#__PURE__*/Object.freeze({
10832
+ __proto__: null,
10833
+ AXMReportExecuteCommand: AXMReportExecuteCommand
10834
+ });
10835
+
10522
10836
  class AXPSecurityManagementMockWidgetDataSourceProvider {
10523
10837
  async items() {
10524
10838
  return [
@@ -10619,5 +10933,5 @@ class AXPSecurityManagementMockWidgetDataSourceProvider {
10619
10933
  * Generated bundle index. Do not edit.
10620
10934
  */
10621
10935
 
10622
- export { APPLICATIONS, APPLICATIONS_MODULES, AXCAppTermDataSeeder, AXCAppVersionDataSeeder, AXCApplicationManagementMockModule, AXCApplicationTemplateDataSeeder, AXCAuthMockModule, AXCCommonMockModule, AXCContactManagementMockModule, AXCConversationMockModule, AXCDashboardManagementMockModule, AXCDataManagementMockModule, AXCDocumentManagementMockModule, AXCFOrganizationManagementMockModule, AXCFileStorageService, AXCFormTemplateManagementMockModule, AXCGlobalVariablesDataSeeder, AXCIssueManagementMockModule, AXCLockService, AXCLogManagementMockModule, AXCMetaDataDefinitionDataSeeder, AXCMockModule, AXCNotificationManagementMockModule, AXCPlatformManagementMockModule, AXCProjectManagementMockModule, AXCReportManagementMockModule, AXCSchedulerJobDataSeeder, AXCSchedulerJobManagementMockModule, AXCSecurityManagementMockModule, AXCTextTemplateCategoryDataSeeder, AXCTextTemplateDataSeeder, AXCTextTemplateManagementMockModule, AXCTrainingManagementMockModule, AXMAiResponderService, AXPDashboardDataSeeder, AXPDexieEntityStorageService, AXPMessageDataSeeder, AXPReportManagementDataSeeder, AXPRoomDataSeeder, AXPSecurityManagementMockWidgetDataSourceProvider, AXPSecurityManagementRoleDataSeeder, AXPSecurityManagementUserDataSeeder, CATEGORY_REPORT_MAPPING, DASHBOARDS, EDITIONS, ENTITIES, FEATURES, GLOBAL_VARIABLES, MOCKStrategy, MODULES, PERMISSIONS, PROPERTIES, REPORT_CATEGORIES, REPORT_DEFINITIONS, TEXT_TEMPLATES, TEXT_TEMPLATE_CATEGORY, generateRandomDashboard };
10936
+ export { APPLICATIONS, APPLICATIONS_MODULES, AXCAppTermDataSeeder, AXCAppVersionDataSeeder, AXCApplicationManagementMockModule, AXCApplicationTemplateDataSeeder, AXCAuthMockModule, AXCCommonMockModule, AXCContactManagementMockModule, AXCConversationMockModule, AXCDashboardManagementMockModule, AXCDataManagementMockModule, AXCDocumentManagementMockModule, AXCFOrganizationManagementMockModule, AXCFileStorageService, AXCFormTemplateManagementMockModule, AXCGlobalVariablesDataSeeder, AXCIssueManagementMockModule, AXCLockService, AXCLogManagementMockModule, AXCMetaDataDefinitionDataSeeder, AXCMockModule, AXCNotificationManagementMockModule, AXCPlatformManagementMockModule, AXCProjectManagementMockModule, AXCReportManagementMockModule, AXCSchedulerJobDataSeeder, AXCSchedulerJobManagementMockModule, AXCSecurityManagementMockModule, AXCTextTemplateCategoryDataSeeder, AXCTextTemplateDataSeeder, AXCTextTemplateManagementMockModule, AXCTrainingManagementMockModule, AXMAiResponderService, AXMReportExecuteCommand, AXPDashboardDataSeeder, AXPDexieEntityStorageService, AXPMessageDataSeeder, AXPReportManagementDataSeeder, AXPRoomDataSeeder, AXPSecurityManagementMockWidgetDataSourceProvider, AXPSecurityManagementRoleDataSeeder, AXPSecurityManagementUserDataSeeder, CATEGORY_REPORT_MAPPING, DASHBOARDS, EDITIONS, ENTITIES, FEATURES, GLOBAL_VARIABLES, MOCKStrategy, MODULES, PERMISSIONS, PROPERTIES, REPORT_CATEGORIES, REPORT_DEFINITIONS, TEXT_TEMPLATES, TEXT_TEMPLATE_CATEGORY, generateRandomDashboard };
10623
10937
  //# sourceMappingURL=acorex-connectivity-mock.mjs.map