@acorex/connectivity 20.0.20 → 20.0.22
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.
@@ -12,6 +12,7 @@ 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';
|
@@ -2207,8 +2208,12 @@ const commonParameterGroups = [
|
|
2207
2208
|
widget: {
|
2208
2209
|
type: AXPWidgetsList.Editors.DateTimeBox,
|
2209
2210
|
options: {
|
2210
|
-
|
2211
|
-
|
2211
|
+
format: 'date',
|
2212
|
+
validations: [
|
2213
|
+
{
|
2214
|
+
rule: 'required',
|
2215
|
+
}
|
2216
|
+
]
|
2212
2217
|
}
|
2213
2218
|
},
|
2214
2219
|
},
|
@@ -2219,8 +2224,7 @@ const commonParameterGroups = [
|
|
2219
2224
|
widget: {
|
2220
2225
|
type: AXPWidgetsList.Editors.DateTimeBox,
|
2221
2226
|
options: {
|
2222
|
-
|
2223
|
-
format: 'yyyy-MM-dd'
|
2227
|
+
format: 'date',
|
2224
2228
|
}
|
2225
2229
|
},
|
2226
2230
|
},
|
@@ -2909,6 +2913,80 @@ const ergonomicsParameterGroups = [
|
|
2909
2913
|
}
|
2910
2914
|
];
|
2911
2915
|
//#endregion
|
2916
|
+
//#region ---- Column Definitions Generator ----
|
2917
|
+
function generateColumnsForReportType(reportTitle) {
|
2918
|
+
const titleLower = reportTitle.toLowerCase();
|
2919
|
+
if (titleLower.includes('balance sheet') || titleLower.includes('financial')) {
|
2920
|
+
return [
|
2921
|
+
{ field: 'account', title: 'Account', visible: true, width: 150, align: 'left' },
|
2922
|
+
{ field: 'accountCode', title: 'Code', visible: true, width: 100, align: 'left' },
|
2923
|
+
{ field: 'currentAmount', title: 'Current Amount', visible: true, width: 120, align: 'right' },
|
2924
|
+
{ field: 'previousAmount', title: 'Previous Amount', visible: true, width: 120, align: 'right' },
|
2925
|
+
{ field: 'variance', title: 'Variance', visible: true, width: 100, align: 'right' },
|
2926
|
+
{ field: 'percentage', title: 'Change %', visible: true, width: 80, align: 'right' },
|
2927
|
+
{ field: 'category', title: 'Category', visible: true, width: 100, align: 'left' },
|
2928
|
+
];
|
2929
|
+
}
|
2930
|
+
else if (titleLower.includes('income') || titleLower.includes('profit')) {
|
2931
|
+
return [
|
2932
|
+
{ field: 'lineItem', title: 'Line Item', visible: true, width: 150, align: 'left' },
|
2933
|
+
{ field: 'amount', title: 'Amount', visible: true, width: 120, align: 'right' },
|
2934
|
+
{ field: 'budget', title: 'Budget', visible: true, width: 120, align: 'right' },
|
2935
|
+
{ field: 'variance', title: 'Variance', visible: true, width: 100, align: 'right' },
|
2936
|
+
{ field: 'percentOfRevenue', title: '% of Revenue', visible: true, width: 100, align: 'right' },
|
2937
|
+
{ field: 'category', title: 'Category', visible: true, width: 100, align: 'left' },
|
2938
|
+
];
|
2939
|
+
}
|
2940
|
+
else if (titleLower.includes('employee') || titleLower.includes('performance')) {
|
2941
|
+
return [
|
2942
|
+
{ field: 'employeeId', title: 'Employee ID', visible: true, width: 100, align: 'left' },
|
2943
|
+
{ field: 'name', title: 'Name', visible: true, width: 150, align: 'left' },
|
2944
|
+
{ field: 'department', title: 'Department', visible: true, width: 120, align: 'left' },
|
2945
|
+
{ field: 'position', title: 'Position', visible: true, width: 120, align: 'left' },
|
2946
|
+
{ field: 'performanceScore', title: 'Score', visible: true, width: 80, align: 'center' },
|
2947
|
+
{ field: 'goalsCompleted', title: 'Goals Done', visible: true, width: 90, align: 'center' },
|
2948
|
+
{ field: 'totalGoals', title: 'Total Goals', visible: true, width: 90, align: 'center' },
|
2949
|
+
{ field: 'status', title: 'Status', visible: true, width: 80, align: 'center' },
|
2950
|
+
];
|
2951
|
+
}
|
2952
|
+
else if (titleLower.includes('sales') || titleLower.includes('revenue')) {
|
2953
|
+
return [
|
2954
|
+
{ field: 'salesRep', title: 'Sales Rep', visible: true, width: 120, align: 'left' },
|
2955
|
+
{ field: 'product', title: 'Product', visible: true, width: 100, align: 'left' },
|
2956
|
+
{ field: 'region', title: 'Region', visible: true, width: 80, align: 'left' },
|
2957
|
+
{ field: 'customer', title: 'Customer', visible: true, width: 150, align: 'left' },
|
2958
|
+
{ field: 'revenue', title: 'Revenue', visible: true, width: 100, align: 'right' },
|
2959
|
+
{ field: 'units', title: 'Units', visible: true, width: 80, align: 'right' },
|
2960
|
+
{ field: 'commission', title: 'Commission', visible: true, width: 100, align: 'right' },
|
2961
|
+
{ field: 'status', title: 'Status', visible: true, width: 80, align: 'center' },
|
2962
|
+
];
|
2963
|
+
}
|
2964
|
+
else if (titleLower.includes('incident') || titleLower.includes('safety')) {
|
2965
|
+
return [
|
2966
|
+
{ field: 'incidentId', title: 'Incident ID', visible: true, width: 100, align: 'left' },
|
2967
|
+
{ field: 'type', title: 'Type', visible: true, width: 120, align: 'left' },
|
2968
|
+
{ field: 'severity', title: 'Severity', visible: true, width: 80, align: 'center' },
|
2969
|
+
{ field: 'location', title: 'Location', visible: true, width: 120, align: 'left' },
|
2970
|
+
{ field: 'reportedBy', title: 'Reported By', visible: true, width: 120, align: 'left' },
|
2971
|
+
{ field: 'dateReported', title: 'Date Reported', visible: true, width: 100, align: 'center' },
|
2972
|
+
{ field: 'status', title: 'Status', visible: true, width: 100, align: 'center' },
|
2973
|
+
{ field: 'daysToResolve', title: 'Days to Resolve', visible: true, width: 100, align: 'right' },
|
2974
|
+
];
|
2975
|
+
}
|
2976
|
+
else {
|
2977
|
+
// Generic columns for other report types
|
2978
|
+
return [
|
2979
|
+
{ field: 'title', title: 'Title', visible: true, width: 200, align: 'left' },
|
2980
|
+
{ field: 'category', title: 'Category', visible: true, width: 100, align: 'left' },
|
2981
|
+
{ field: 'value', title: 'Value', visible: true, width: 80, align: 'right' },
|
2982
|
+
{ field: 'status', title: 'Status', visible: true, width: 80, align: 'center' },
|
2983
|
+
{ field: 'priority', title: 'Priority', visible: true, width: 80, align: 'center' },
|
2984
|
+
{ field: 'owner', title: 'Owner', visible: true, width: 120, align: 'left' },
|
2985
|
+
{ field: 'createdDate', title: 'Created', visible: true, width: 100, align: 'center' },
|
2986
|
+
];
|
2987
|
+
}
|
2988
|
+
}
|
2989
|
+
//#endregion
|
2912
2990
|
//#region ---- Mock Report Definitions ----
|
2913
2991
|
function generateReportDefinitions() {
|
2914
2992
|
const reports = [];
|
@@ -3241,22 +3319,7 @@ function generateReportDefinitions() {
|
|
3241
3319
|
},
|
3242
3320
|
layout: {
|
3243
3321
|
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
|
-
],
|
3322
|
+
columns: generateColumnsForReportType(report.title),
|
3260
3323
|
},
|
3261
3324
|
export: {
|
3262
3325
|
fileNameTemplate: 'Report_{date}_{user}',
|
@@ -3311,19 +3374,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
|
|
3311
3374
|
|
3312
3375
|
class AXCReportManagementMockModule {
|
3313
3376
|
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 }); }
|
3377
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: AXCReportManagementMockModule, imports: [AXPRuntimeModule] }); }
|
3315
3378
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCReportManagementMockModule, providers: [
|
3316
3379
|
{
|
3317
3380
|
provide: AXP_DATA_SEEDER_TOKEN,
|
3318
3381
|
useClass: AXPReportManagementDataSeeder,
|
3319
3382
|
multi: true,
|
3320
3383
|
},
|
3321
|
-
|
3384
|
+
provideCommandSetups([
|
3385
|
+
{
|
3386
|
+
key: 'ReportManagement.Report:Execute',
|
3387
|
+
command: () => Promise.resolve().then(function () { return execute_command; }).then((c) => c.AXMReportExecuteCommand),
|
3388
|
+
},
|
3389
|
+
]),
|
3390
|
+
], imports: [AXPRuntimeModule] }); }
|
3322
3391
|
}
|
3323
3392
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCReportManagementMockModule, decorators: [{
|
3324
3393
|
type: NgModule,
|
3325
3394
|
args: [{
|
3326
|
-
imports: [],
|
3395
|
+
imports: [AXPRuntimeModule],
|
3327
3396
|
exports: [],
|
3328
3397
|
declarations: [],
|
3329
3398
|
providers: [
|
@@ -3332,6 +3401,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
|
|
3332
3401
|
useClass: AXPReportManagementDataSeeder,
|
3333
3402
|
multi: true,
|
3334
3403
|
},
|
3404
|
+
provideCommandSetups([
|
3405
|
+
{
|
3406
|
+
key: 'ReportManagement.Report:Execute',
|
3407
|
+
command: () => Promise.resolve().then(function () { return execute_command; }).then((c) => c.AXMReportExecuteCommand),
|
3408
|
+
},
|
3409
|
+
]),
|
3335
3410
|
],
|
3336
3411
|
}]
|
3337
3412
|
}] });
|
@@ -6521,157 +6596,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
|
|
6521
6596
|
type: Injectable
|
6522
6597
|
}], ctorParameters: () => [] });
|
6523
6598
|
|
6524
|
-
class AXCLockService {
|
6525
|
-
constructor() {
|
6526
|
-
// Local Dexie database for storing lock information independent of AXPEntityStorageService
|
6527
|
-
//#region ---- Dexie In-Memory Lock Storage ----
|
6528
|
-
this.className = 'locks';
|
6529
|
-
//#endregion
|
6530
|
-
this.entityName = this.className;
|
6531
|
-
//#region ---- Cache Configuration & Management ----
|
6532
|
-
/**
|
6533
|
-
* Cache Time-To-Live in milliseconds. Default is 5 seconds but can be overridden
|
6534
|
-
* at runtime using {@link setCacheDuration}.
|
6535
|
-
*/
|
6536
|
-
this.cacheTTL = 5000;
|
6537
|
-
/** In-memory cache for lock information. */
|
6538
|
-
this.cacheMap = new Map();
|
6539
|
-
// Initialise a dedicated Dexie database for lock management to avoid any
|
6540
|
-
// dependency on the generic AXPEntityStorageService. Using a separate
|
6541
|
-
// database name ensures we don't conflict with the existing entity-store
|
6542
|
-
// schema while keeping things lightweight.
|
6543
|
-
this.db = new Dexie('ACoreXPlatformLocks');
|
6544
|
-
this.db.version(1).stores({ [this.className]: 'id, refId, refType, type' });
|
6545
|
-
// Start cache invalidation timer with the default TTL.
|
6546
|
-
this.startCacheTimer();
|
6547
|
-
}
|
6548
|
-
get lockTable() {
|
6549
|
-
return this.db[this.className];
|
6550
|
-
}
|
6551
|
-
/**
|
6552
|
-
* Generates a unique cache key based on the lock request parameters.
|
6553
|
-
*/
|
6554
|
-
getCacheKey(req) {
|
6555
|
-
return `${req.refId}|${req.refType}|${req.type ?? ''}`;
|
6556
|
-
}
|
6557
|
-
/**
|
6558
|
-
* Starts or restarts the interval that clears the cache.
|
6559
|
-
*/
|
6560
|
-
startCacheTimer() {
|
6561
|
-
if (this.cacheTimer) {
|
6562
|
-
clearInterval(this.cacheTimer);
|
6563
|
-
}
|
6564
|
-
this.cacheTimer = setInterval(() => this.cacheMap.clear(), this.cacheTTL);
|
6565
|
-
}
|
6566
|
-
/**
|
6567
|
-
* Allows consumers to change the cache duration (in milliseconds) at runtime.
|
6568
|
-
* The new duration is applied immediately.
|
6569
|
-
*/
|
6570
|
-
setCacheDuration(ms) {
|
6571
|
-
if (ms <= 0) {
|
6572
|
-
throw new Error('Cache duration must be greater than zero.');
|
6573
|
-
}
|
6574
|
-
this.cacheTTL = ms;
|
6575
|
-
this.startCacheTimer();
|
6576
|
-
}
|
6577
|
-
//#endregion
|
6578
|
-
lock(request) {
|
6579
|
-
//TODO locked by get info and save
|
6580
|
-
const entity = {
|
6581
|
-
id: AXPDataGenerator.uuid(),
|
6582
|
-
...request,
|
6583
|
-
lockedBy: {
|
6584
|
-
id: request.lockedBy.id,
|
6585
|
-
name: '',
|
6586
|
-
title: '',
|
6587
|
-
},
|
6588
|
-
};
|
6589
|
-
return this.lockTable.add(entity).then(() => {
|
6590
|
-
// Invalidate cache because underlying data has changed.
|
6591
|
-
this.cacheMap.clear();
|
6592
|
-
return entity;
|
6593
|
-
});
|
6594
|
-
}
|
6595
|
-
async unlock(request) {
|
6596
|
-
const items = await this.getItems(request);
|
6597
|
-
if (items.length > 0) {
|
6598
|
-
//TODO may be don't have id and multi primary key like this!!!!!
|
6599
|
-
await this.lockTable.delete(items[0].id);
|
6600
|
-
// Invalidate cache since data has changed.
|
6601
|
-
this.cacheMap.clear();
|
6602
|
-
}
|
6603
|
-
else {
|
6604
|
-
throw new Error('not found');
|
6605
|
-
}
|
6606
|
-
}
|
6607
|
-
async check(request) {
|
6608
|
-
try {
|
6609
|
-
await this.getInfo(request);
|
6610
|
-
return true;
|
6611
|
-
}
|
6612
|
-
catch {
|
6613
|
-
return false;
|
6614
|
-
}
|
6615
|
-
}
|
6616
|
-
async getInfo(request) {
|
6617
|
-
const key = this.getCacheKey(request);
|
6618
|
-
const cached = this.cacheMap.get(key);
|
6619
|
-
if (cached) {
|
6620
|
-
return cached;
|
6621
|
-
}
|
6622
|
-
const items = await this.getItems(request);
|
6623
|
-
if (items.length > 0) {
|
6624
|
-
this.cacheMap.set(key, items[0]);
|
6625
|
-
return items[0];
|
6626
|
-
}
|
6627
|
-
else {
|
6628
|
-
throw new Error('not found');
|
6629
|
-
}
|
6630
|
-
}
|
6631
|
-
async getItems(request) {
|
6632
|
-
const filters = [
|
6633
|
-
{
|
6634
|
-
field: 'refId',
|
6635
|
-
operator: {
|
6636
|
-
type: 'equal',
|
6637
|
-
},
|
6638
|
-
value: request.refId,
|
6639
|
-
},
|
6640
|
-
{
|
6641
|
-
field: 'refType',
|
6642
|
-
operator: {
|
6643
|
-
type: 'equal',
|
6644
|
-
},
|
6645
|
-
value: request.refType,
|
6646
|
-
},
|
6647
|
-
];
|
6648
|
-
// Add type filter only when it is provided in the request
|
6649
|
-
if (request.type !== undefined && request.type != null) {
|
6650
|
-
filters.push({
|
6651
|
-
field: 'type',
|
6652
|
-
operator: {
|
6653
|
-
type: 'equal',
|
6654
|
-
},
|
6655
|
-
value: request.type,
|
6656
|
-
});
|
6657
|
-
}
|
6658
|
-
// Build Dexie query dynamically
|
6659
|
-
let collection = this.lockTable.where(filters[0].field).equals(filters[0].value);
|
6660
|
-
if (filters.length > 1) {
|
6661
|
-
for (let i = 1; i < filters.length; i++) {
|
6662
|
-
const f = filters[i];
|
6663
|
-
collection = collection.and((item) => item[f.field] === f.value);
|
6664
|
-
}
|
6665
|
-
}
|
6666
|
-
return collection.toArray();
|
6667
|
-
}
|
6668
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
6669
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService }); }
|
6670
|
-
}
|
6671
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService, decorators: [{
|
6672
|
-
type: Injectable
|
6673
|
-
}], ctorParameters: () => [] });
|
6674
|
-
|
6675
6599
|
class AXCRegionalServiceImpl extends AXPRegionalService {
|
6676
6600
|
constructor() {
|
6677
6601
|
super(...arguments);
|
@@ -6802,10 +6726,6 @@ class AXCPlatformManagementMockModule {
|
|
6802
6726
|
provide: AXPRegionalService,
|
6803
6727
|
useClass: AXCRegionalServiceImpl,
|
6804
6728
|
},
|
6805
|
-
{
|
6806
|
-
provide: AXPLockService,
|
6807
|
-
useClass: AXCLockService,
|
6808
|
-
},
|
6809
6729
|
] }); }
|
6810
6730
|
}
|
6811
6731
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCPlatformManagementMockModule, decorators: [{
|
@@ -6847,10 +6767,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
|
|
6847
6767
|
provide: AXPRegionalService,
|
6848
6768
|
useClass: AXCRegionalServiceImpl,
|
6849
6769
|
},
|
6850
|
-
{
|
6851
|
-
provide: AXPLockService,
|
6852
|
-
useClass: AXCLockService,
|
6853
|
-
},
|
6854
6770
|
],
|
6855
6771
|
}]
|
6856
6772
|
}] });
|
@@ -9778,6 +9694,157 @@ class EntitySearchProvider {
|
|
9778
9694
|
}
|
9779
9695
|
}
|
9780
9696
|
|
9697
|
+
class AXCLockService {
|
9698
|
+
constructor() {
|
9699
|
+
// Local Dexie database for storing lock information independent of AXPEntityStorageService
|
9700
|
+
//#region ---- Dexie In-Memory Lock Storage ----
|
9701
|
+
this.className = 'locks';
|
9702
|
+
//#endregion
|
9703
|
+
this.entityName = this.className;
|
9704
|
+
//#region ---- Cache Configuration & Management ----
|
9705
|
+
/**
|
9706
|
+
* Cache Time-To-Live in milliseconds. Default is 5 seconds but can be overridden
|
9707
|
+
* at runtime using {@link setCacheDuration}.
|
9708
|
+
*/
|
9709
|
+
this.cacheTTL = 5000;
|
9710
|
+
/** In-memory cache for lock information. */
|
9711
|
+
this.cacheMap = new Map();
|
9712
|
+
// Initialise a dedicated Dexie database for lock management to avoid any
|
9713
|
+
// dependency on the generic AXPEntityStorageService. Using a separate
|
9714
|
+
// database name ensures we don't conflict with the existing entity-store
|
9715
|
+
// schema while keeping things lightweight.
|
9716
|
+
this.db = new Dexie('ACoreXPlatformLocks');
|
9717
|
+
this.db.version(1).stores({ [this.className]: 'id, refId, refType, type' });
|
9718
|
+
// Start cache invalidation timer with the default TTL.
|
9719
|
+
this.startCacheTimer();
|
9720
|
+
}
|
9721
|
+
get lockTable() {
|
9722
|
+
return this.db[this.className];
|
9723
|
+
}
|
9724
|
+
/**
|
9725
|
+
* Generates a unique cache key based on the lock request parameters.
|
9726
|
+
*/
|
9727
|
+
getCacheKey(req) {
|
9728
|
+
return `${req.refId}|${req.refType}|${req.type ?? ''}`;
|
9729
|
+
}
|
9730
|
+
/**
|
9731
|
+
* Starts or restarts the interval that clears the cache.
|
9732
|
+
*/
|
9733
|
+
startCacheTimer() {
|
9734
|
+
if (this.cacheTimer) {
|
9735
|
+
clearInterval(this.cacheTimer);
|
9736
|
+
}
|
9737
|
+
this.cacheTimer = setInterval(() => this.cacheMap.clear(), this.cacheTTL);
|
9738
|
+
}
|
9739
|
+
/**
|
9740
|
+
* Allows consumers to change the cache duration (in milliseconds) at runtime.
|
9741
|
+
* The new duration is applied immediately.
|
9742
|
+
*/
|
9743
|
+
setCacheDuration(ms) {
|
9744
|
+
if (ms <= 0) {
|
9745
|
+
throw new Error('Cache duration must be greater than zero.');
|
9746
|
+
}
|
9747
|
+
this.cacheTTL = ms;
|
9748
|
+
this.startCacheTimer();
|
9749
|
+
}
|
9750
|
+
//#endregion
|
9751
|
+
lock(request) {
|
9752
|
+
//TODO locked by get info and save
|
9753
|
+
const entity = {
|
9754
|
+
id: AXPDataGenerator.uuid(),
|
9755
|
+
...request,
|
9756
|
+
lockedBy: {
|
9757
|
+
id: request.lockedBy.id,
|
9758
|
+
name: '',
|
9759
|
+
title: '',
|
9760
|
+
},
|
9761
|
+
};
|
9762
|
+
return this.lockTable.add(entity).then(() => {
|
9763
|
+
// Invalidate cache because underlying data has changed.
|
9764
|
+
this.cacheMap.clear();
|
9765
|
+
return entity;
|
9766
|
+
});
|
9767
|
+
}
|
9768
|
+
async unlock(request) {
|
9769
|
+
const items = await this.getItems(request);
|
9770
|
+
if (items.length > 0) {
|
9771
|
+
//TODO may be don't have id and multi primary key like this!!!!!
|
9772
|
+
await this.lockTable.delete(items[0].id);
|
9773
|
+
// Invalidate cache since data has changed.
|
9774
|
+
this.cacheMap.clear();
|
9775
|
+
}
|
9776
|
+
else {
|
9777
|
+
throw new Error('not found');
|
9778
|
+
}
|
9779
|
+
}
|
9780
|
+
async check(request) {
|
9781
|
+
try {
|
9782
|
+
await this.getInfo(request);
|
9783
|
+
return true;
|
9784
|
+
}
|
9785
|
+
catch {
|
9786
|
+
return false;
|
9787
|
+
}
|
9788
|
+
}
|
9789
|
+
async getInfo(request) {
|
9790
|
+
const key = this.getCacheKey(request);
|
9791
|
+
const cached = this.cacheMap.get(key);
|
9792
|
+
if (cached) {
|
9793
|
+
return cached;
|
9794
|
+
}
|
9795
|
+
const items = await this.getItems(request);
|
9796
|
+
if (items.length > 0) {
|
9797
|
+
this.cacheMap.set(key, items[0]);
|
9798
|
+
return items[0];
|
9799
|
+
}
|
9800
|
+
else {
|
9801
|
+
throw new Error('not found');
|
9802
|
+
}
|
9803
|
+
}
|
9804
|
+
async getItems(request) {
|
9805
|
+
const filters = [
|
9806
|
+
{
|
9807
|
+
field: 'refId',
|
9808
|
+
operator: {
|
9809
|
+
type: 'equal',
|
9810
|
+
},
|
9811
|
+
value: request.refId,
|
9812
|
+
},
|
9813
|
+
{
|
9814
|
+
field: 'refType',
|
9815
|
+
operator: {
|
9816
|
+
type: 'equal',
|
9817
|
+
},
|
9818
|
+
value: request.refType,
|
9819
|
+
},
|
9820
|
+
];
|
9821
|
+
// Add type filter only when it is provided in the request
|
9822
|
+
if (request.type !== undefined && request.type != null) {
|
9823
|
+
filters.push({
|
9824
|
+
field: 'type',
|
9825
|
+
operator: {
|
9826
|
+
type: 'equal',
|
9827
|
+
},
|
9828
|
+
value: request.type,
|
9829
|
+
});
|
9830
|
+
}
|
9831
|
+
// Build Dexie query dynamically
|
9832
|
+
let collection = this.lockTable.where(filters[0].field).equals(filters[0].value);
|
9833
|
+
if (filters.length > 1) {
|
9834
|
+
for (let i = 1; i < filters.length; i++) {
|
9835
|
+
const f = filters[i];
|
9836
|
+
collection = collection.and((item) => item[f.field] === f.value);
|
9837
|
+
}
|
9838
|
+
}
|
9839
|
+
return collection.toArray();
|
9840
|
+
}
|
9841
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
9842
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService }); }
|
9843
|
+
}
|
9844
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCLockService, decorators: [{
|
9845
|
+
type: Injectable
|
9846
|
+
}], ctorParameters: () => [] });
|
9847
|
+
|
9781
9848
|
class AXCCommonMockModule {
|
9782
9849
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
9783
9850
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule }); }
|
@@ -9792,6 +9859,10 @@ class AXCCommonMockModule {
|
|
9792
9859
|
useClass: EntitySearchProvider,
|
9793
9860
|
multi: true,
|
9794
9861
|
},
|
9862
|
+
{
|
9863
|
+
provide: AXPLockService,
|
9864
|
+
useClass: AXCLockService,
|
9865
|
+
},
|
9795
9866
|
] }); }
|
9796
9867
|
}
|
9797
9868
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXCCommonMockModule, decorators: [{
|
@@ -9811,6 +9882,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
|
|
9811
9882
|
useClass: EntitySearchProvider,
|
9812
9883
|
multi: true,
|
9813
9884
|
},
|
9885
|
+
{
|
9886
|
+
provide: AXPLockService,
|
9887
|
+
useClass: AXCLockService,
|
9888
|
+
},
|
9814
9889
|
],
|
9815
9890
|
}]
|
9816
9891
|
}] });
|
@@ -10519,6 +10594,206 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
|
|
10519
10594
|
}]
|
10520
10595
|
}], ctorParameters: () => [{ type: i1.AXPAppStartUpService }, { type: i0.Injector }] });
|
10521
10596
|
|
10597
|
+
class AXMReportExecuteCommand {
|
10598
|
+
constructor() {
|
10599
|
+
this.queryService = inject(AXPQueryService);
|
10600
|
+
}
|
10601
|
+
//#region ---- Command Implementation ----
|
10602
|
+
async execute(input) {
|
10603
|
+
try {
|
10604
|
+
const { reportId, parameters, page = 1, pageSize = 50 } = input;
|
10605
|
+
// Find the report definition
|
10606
|
+
const reportDefinition = await this.queryService.fetch("ReportManagement.Report:GetById", reportId);
|
10607
|
+
if (!reportDefinition) {
|
10608
|
+
throw new Error(`Report with ID ${reportId} not found`);
|
10609
|
+
}
|
10610
|
+
// Generate mock data based on report type and parameters
|
10611
|
+
const mockData = this.generateMockDataForReport(reportDefinition, parameters, pageSize);
|
10612
|
+
// Simulate total records (more than current page)
|
10613
|
+
const total = Math.max(mockData.length, pageSize * 3 + Math.floor(Math.random() * 50));
|
10614
|
+
return {
|
10615
|
+
data: mockData,
|
10616
|
+
total,
|
10617
|
+
page,
|
10618
|
+
pageSize
|
10619
|
+
};
|
10620
|
+
}
|
10621
|
+
catch (error) {
|
10622
|
+
console.error('Error executing report:', error);
|
10623
|
+
throw new Error('Failed to execute report');
|
10624
|
+
}
|
10625
|
+
}
|
10626
|
+
//#endregion
|
10627
|
+
//#region ---- Mock Data Generation Based on Report Type ----
|
10628
|
+
generateMockDataForReport(reportDefinition, parameters, pageSize) {
|
10629
|
+
const reportTitle = reportDefinition.title.toLowerCase();
|
10630
|
+
const data = [];
|
10631
|
+
// Generate data based on report type
|
10632
|
+
if (reportTitle.includes('balance sheet') || reportTitle.includes('financial')) {
|
10633
|
+
return this.generateFinancialData(reportDefinition, parameters, pageSize);
|
10634
|
+
}
|
10635
|
+
else if (reportTitle.includes('income') || reportTitle.includes('profit')) {
|
10636
|
+
return this.generateIncomeData(reportDefinition, parameters, pageSize);
|
10637
|
+
}
|
10638
|
+
else if (reportTitle.includes('employee') || reportTitle.includes('performance')) {
|
10639
|
+
return this.generateEmployeeData(reportDefinition, parameters, pageSize);
|
10640
|
+
}
|
10641
|
+
else if (reportTitle.includes('sales') || reportTitle.includes('revenue')) {
|
10642
|
+
return this.generateSalesData(reportDefinition, parameters, pageSize);
|
10643
|
+
}
|
10644
|
+
else if (reportTitle.includes('incident') || reportTitle.includes('safety')) {
|
10645
|
+
return this.generateSafetyData(reportDefinition, parameters, pageSize);
|
10646
|
+
}
|
10647
|
+
else {
|
10648
|
+
return this.generateGenericData(reportDefinition, parameters, pageSize);
|
10649
|
+
}
|
10650
|
+
}
|
10651
|
+
generateFinancialData(reportDefinition, parameters, pageSize) {
|
10652
|
+
const data = [];
|
10653
|
+
const accounts = ['Cash', 'Accounts Receivable', 'Inventory', 'Equipment', 'Accounts Payable', 'Long-term Debt', 'Equity'];
|
10654
|
+
for (let i = 0; i < pageSize; i++) {
|
10655
|
+
data.push({
|
10656
|
+
id: AXPDataGenerator.uuid(),
|
10657
|
+
account: accounts[i % accounts.length],
|
10658
|
+
accountCode: `${1000 + i}`,
|
10659
|
+
currentAmount: AXPDataGenerator.number(10000, 1000000),
|
10660
|
+
previousAmount: AXPDataGenerator.number(10000, 1000000),
|
10661
|
+
variance: AXPDataGenerator.number(-50000, 50000),
|
10662
|
+
percentage: AXPDataGenerator.number(-25, 25),
|
10663
|
+
category: ['Assets', 'Liabilities', 'Equity'][i % 3],
|
10664
|
+
period: parameters['period'] || '2024-Q4',
|
10665
|
+
lastUpdated: this.getRandomPastDate(30)
|
10666
|
+
});
|
10667
|
+
}
|
10668
|
+
return data;
|
10669
|
+
}
|
10670
|
+
generateIncomeData(reportDefinition, parameters, pageSize) {
|
10671
|
+
const data = [];
|
10672
|
+
const items = ['Revenue', 'Cost of Goods Sold', 'Gross Profit', 'Operating Expenses', 'Operating Income', 'Interest Expense', 'Net Income'];
|
10673
|
+
for (let i = 0; i < pageSize; i++) {
|
10674
|
+
const amount = AXPDataGenerator.number(50000, 2000000);
|
10675
|
+
data.push({
|
10676
|
+
id: AXPDataGenerator.uuid(),
|
10677
|
+
lineItem: items[i % items.length],
|
10678
|
+
amount: amount,
|
10679
|
+
budget: amount * AXPDataGenerator.number(0.8, 1.2),
|
10680
|
+
variance: AXPDataGenerator.number(-100000, 100000),
|
10681
|
+
percentOfRevenue: AXPDataGenerator.number(0, 100),
|
10682
|
+
month: parameters['month'] || 'December',
|
10683
|
+
year: parameters['year'] || 2024,
|
10684
|
+
category: ['Revenue', 'Expenses', 'Other'][i % 3]
|
10685
|
+
});
|
10686
|
+
}
|
10687
|
+
return data;
|
10688
|
+
}
|
10689
|
+
generateEmployeeData(reportDefinition, parameters, pageSize) {
|
10690
|
+
const data = [];
|
10691
|
+
const departments = ['Engineering', 'Sales', 'Marketing', 'HR', 'Finance', 'Operations'];
|
10692
|
+
const positions = ['Manager', 'Senior Specialist', 'Specialist', 'Junior', 'Lead'];
|
10693
|
+
for (let i = 0; i < pageSize; i++) {
|
10694
|
+
data.push({
|
10695
|
+
id: AXPDataGenerator.uuid(),
|
10696
|
+
employeeId: `EMP${1000 + i}`,
|
10697
|
+
name: `${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}`,
|
10698
|
+
department: departments[i % departments.length],
|
10699
|
+
position: positions[i % positions.length],
|
10700
|
+
performanceScore: AXPDataGenerator.number(1, 5),
|
10701
|
+
goalsCompleted: AXPDataGenerator.number(0, 10),
|
10702
|
+
totalGoals: AXPDataGenerator.number(8, 12),
|
10703
|
+
reviewDate: this.getRandomPastDate(90),
|
10704
|
+
manager: `${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}`,
|
10705
|
+
hireDate: this.getRandomPastDate(1825), // ~5 years ago
|
10706
|
+
status: ['Active', 'On Leave', 'Probation'][i % 3]
|
10707
|
+
});
|
10708
|
+
}
|
10709
|
+
return data;
|
10710
|
+
}
|
10711
|
+
generateSalesData(reportDefinition, parameters, pageSize) {
|
10712
|
+
const data = [];
|
10713
|
+
const products = ['Product A', 'Product B', 'Product C', 'Service X', 'Service Y'];
|
10714
|
+
const regions = ['North', 'South', 'East', 'West', 'Central'];
|
10715
|
+
const companies = ['Acme Corp', 'Tech Solutions Inc', 'Global Industries', 'Innovative Systems', 'Business Partners LLC'];
|
10716
|
+
for (let i = 0; i < pageSize; i++) {
|
10717
|
+
data.push({
|
10718
|
+
id: AXPDataGenerator.uuid(),
|
10719
|
+
salesRep: `${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}`,
|
10720
|
+
product: products[i % products.length],
|
10721
|
+
region: regions[i % regions.length],
|
10722
|
+
revenue: AXPDataGenerator.number(1000, 100000),
|
10723
|
+
units: AXPDataGenerator.number(1, 500),
|
10724
|
+
commission: AXPDataGenerator.number(50, 5000),
|
10725
|
+
saleDate: this.getRandomPastDate(365),
|
10726
|
+
customer: companies[i % companies.length],
|
10727
|
+
status: ['Closed', 'Pending', 'In Progress'][i % 3],
|
10728
|
+
quarter: parameters['quarter'] || 'Q4 2024'
|
10729
|
+
});
|
10730
|
+
}
|
10731
|
+
return data;
|
10732
|
+
}
|
10733
|
+
generateSafetyData(reportDefinition, parameters, pageSize) {
|
10734
|
+
const data = [];
|
10735
|
+
const incidentTypes = ['Slip/Fall', 'Equipment Malfunction', 'Chemical Exposure', 'Cut/Laceration', 'Burn', 'Strain/Sprain'];
|
10736
|
+
const severities = ['Low', 'Medium', 'High', 'Critical'];
|
10737
|
+
const locations = ['Factory Floor', 'Warehouse', 'Office', 'Loading Dock', 'Laboratory'];
|
10738
|
+
for (let i = 0; i < pageSize; i++) {
|
10739
|
+
data.push({
|
10740
|
+
id: AXPDataGenerator.uuid(),
|
10741
|
+
incidentId: `INC${2024}${String(i + 1).padStart(4, '0')}`,
|
10742
|
+
type: incidentTypes[i % incidentTypes.length],
|
10743
|
+
severity: severities[i % severities.length],
|
10744
|
+
location: locations[i % locations.length],
|
10745
|
+
reportedBy: `${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}`,
|
10746
|
+
dateReported: this.getRandomPastDate(180),
|
10747
|
+
dateOccurred: this.getRandomPastDate(180),
|
10748
|
+
description: `Safety incident involving ${incidentTypes[i % incidentTypes.length].toLowerCase()}`,
|
10749
|
+
status: ['Open', 'Under Investigation', 'Closed', 'Pending'][i % 4],
|
10750
|
+
daysToResolve: AXPDataGenerator.number(1, 30),
|
10751
|
+
category: parameters['category'] || 'General Safety'
|
10752
|
+
});
|
10753
|
+
}
|
10754
|
+
return data;
|
10755
|
+
}
|
10756
|
+
generateGenericData(reportDefinition, parameters, pageSize) {
|
10757
|
+
const data = [];
|
10758
|
+
for (let i = 0; i < pageSize; i++) {
|
10759
|
+
data.push({
|
10760
|
+
id: AXPDataGenerator.uuid(),
|
10761
|
+
title: `${reportDefinition.title} Item ${i + 1}`,
|
10762
|
+
category: parameters['category'] || 'General',
|
10763
|
+
value: AXPDataGenerator.number(1, 1000),
|
10764
|
+
status: ['Active', 'Pending', 'Completed', 'Draft'][i % 4],
|
10765
|
+
createdDate: this.getRandomPastDate(365),
|
10766
|
+
updatedDate: this.getRandomPastDate(30),
|
10767
|
+
description: `Sample data item ${i + 1} for ${reportDefinition.title}`,
|
10768
|
+
priority: ['Low', 'Medium', 'High'][i % 3],
|
10769
|
+
owner: `${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}`,
|
10770
|
+
tags: [`tag${i % 5}`, `category${i % 3}`]
|
10771
|
+
});
|
10772
|
+
}
|
10773
|
+
return data;
|
10774
|
+
}
|
10775
|
+
//#endregion
|
10776
|
+
//#region ---- Helper Methods ----
|
10777
|
+
getRandomPastDate(daysAgo) {
|
10778
|
+
const now = new Date();
|
10779
|
+
const pastDate = new Date(now.getTime() - (daysAgo * 24 * 60 * 60 * 1000));
|
10780
|
+
return AXPDataGenerator.date(pastDate, now);
|
10781
|
+
}
|
10782
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXMReportExecuteCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
10783
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXMReportExecuteCommand, providedIn: 'root' }); }
|
10784
|
+
}
|
10785
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: AXMReportExecuteCommand, decorators: [{
|
10786
|
+
type: Injectable,
|
10787
|
+
args: [{
|
10788
|
+
providedIn: 'root',
|
10789
|
+
}]
|
10790
|
+
}] });
|
10791
|
+
|
10792
|
+
var execute_command = /*#__PURE__*/Object.freeze({
|
10793
|
+
__proto__: null,
|
10794
|
+
AXMReportExecuteCommand: AXMReportExecuteCommand
|
10795
|
+
});
|
10796
|
+
|
10522
10797
|
class AXPSecurityManagementMockWidgetDataSourceProvider {
|
10523
10798
|
async items() {
|
10524
10799
|
return [
|
@@ -10619,5 +10894,5 @@ class AXPSecurityManagementMockWidgetDataSourceProvider {
|
|
10619
10894
|
* Generated bundle index. Do not edit.
|
10620
10895
|
*/
|
10621
10896
|
|
10622
|
-
export { APPLICATIONS, APPLICATIONS_MODULES, AXCAppTermDataSeeder, AXCAppVersionDataSeeder, AXCApplicationManagementMockModule, AXCApplicationTemplateDataSeeder, AXCAuthMockModule, AXCCommonMockModule, AXCContactManagementMockModule, AXCConversationMockModule, AXCDashboardManagementMockModule, AXCDataManagementMockModule, AXCDocumentManagementMockModule, AXCFOrganizationManagementMockModule, AXCFileStorageService, AXCFormTemplateManagementMockModule, AXCGlobalVariablesDataSeeder, AXCIssueManagementMockModule, 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 };
|
10897
|
+
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
10898
|
//# sourceMappingURL=acorex-connectivity-mock.mjs.map
|