@acorex/connectivity 19.2.17 → 19.2.20

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.
@@ -3,15 +3,13 @@ import { RootConfig, AXMFolderServiceImpl, AXMDocumentServiceImpl, AXMFolderServ
3
3
  import { RootConfig as RootConfig$3, AXMNotificationEntityService } from '@acorex/modules/notification-management';
4
4
  import * as i1$1 from '@acorex/platform/auth';
5
5
  import { AXPSessionService, AXPPermissionProviderService, AXPAuthModule } from '@acorex/platform/auth';
6
- import { AXPDataGenerator, AXPFileStorageService, AXPFileStorageStatus, AXPRegionalService, AXP_SEARCH_PROVIDER } from '@acorex/platform/common';
6
+ import { AXPDataGenerator, AXPFileTypeProviderService, AXPRegionalService, AXPFileStorageStatus, AXPFileStorageService, AXP_SEARCH_PROVIDER } from '@acorex/platform/common';
7
7
  import { AXPDexieEntityStorageService, AXPEntityDefinitionRegistryService, AXP_DATA_SEEDER_TOKEN, AXPEntityStorageService } from '@acorex/platform/layout/entity';
8
8
  import * as i0 from '@angular/core';
9
9
  import { inject, Injectable, NgModule, Injector } from '@angular/core';
10
10
  import * as i1 from '@acorex/modules/conversation';
11
11
  import { AXMConverstionModuleConst, AXMChatServiceImpl, AXMCommentServiceImpl, AXMChatModule, AXMChatService } from '@acorex/modules/conversation';
12
12
  import { AXPDataGenerator as AXPDataGenerator$1 } from '@acorex/platform/core';
13
- import { HttpClient } from '@angular/common/http';
14
- import { firstValueFrom } from 'rxjs';
15
13
  import Dexie from 'dexie';
16
14
  import { AXP_WIDGET_DATASOURCE_PROVIDER } from '@acorex/platform/layout/builder';
17
15
  import { RootConfig as RootConfig$1 } from '@acorex/modules/form-template-management';
@@ -20,6 +18,7 @@ import { RootConfig as RootConfig$2 } from '@acorex/modules/security-management'
20
18
  import { AXMOrganizationNodeType, RootConfig as RootConfig$4 } from '@acorex/modules/organization-management';
21
19
  import { RootConfig as RootConfig$5 } from '@acorex/modules/platform-management';
22
20
  import { AXTranslationService } from '@acorex/core/translation';
21
+ import { firstValueFrom } from 'rxjs';
23
22
  import { AXFileService } from '@acorex/core/file';
24
23
  import { RootConfig as RootConfig$6 } from '@acorex/modules/scheduler-job-management';
25
24
  import { RootConfig as RootConfig$7 } from '@acorex/modules/text-template-management';
@@ -551,84 +550,200 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
551
550
  }]
552
551
  }] });
553
552
 
554
- const DocumentTypeMocks = [
553
+ const checkbox$1 = '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"checkbox-editor","name":"checkbox-editor1","options":{"label":"i accept","readonly":false,"disabled":false},"defaultValue":false,"path":"accept-check-box"}],"name":"page-layout1"}],"name":"document"}';
554
+ const color$1 = '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"block-layout","name":"block-layout1","options":{"flexDirection":{"id":"ax-flex-row"},"flexJustifyContent":{"id":"ax-justify-normal"},"flexAlignItems":{"id":"ax-items-start"},"gap":2,"flexWrap":{"id":"ax-flex-nowrap"},"spacing":{"margin":"0px 0px 0px 0px","padding":"0px 0px 0px 0px"},"border":{"width":"0px","radius":"0px","color":"#000000","style":"none"},"flexOptions":{"gap":"0px","flexDirection":"row","flexWrap":"nowrap","justifyContent":"flex-start","alignItems":"flex-start"}}},"children":[{"type":"color-editor","name":"color-editor1","options":{"readonly":false,"disabled":false,"validations":{"required":{"rule":"required","message":"This field is required."}},"placeholder":"pick color"},"path":"color-box"}]}],"name":"page-layout1"}],"name":"document"}';
555
+ const titleInterface$1 = `{
556
+ "type": "document-layout",
557
+ "children": [
555
558
  {
556
- id: AXPDataGenerator$1.uuid(),
557
- name: 'OHS',
558
- title: 'Occupational Health and Safety Policy',
559
- maxSize: 5000,
560
- isEncrypted: false,
561
- meta: [
562
- {
563
- name: 'checkbox',
564
- title: 'Check Box',
565
- interface: '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"checkbox-editor","name":"checkbox-editor1","options":{"label":"i accept","readonly":false,"disabled":false},"defaultValue":false,"path":"accept-check-box"}],"name":"page-layout1"}],"name":"document"}',
566
- },
567
- ],
568
- type: {
569
- selectedItems: [
570
- {
571
- name: 'image.jpg',
572
- title: 'Image/JPEG',
573
- icon: 'fa-light fa-image ax-text-purple-500',
574
- },
575
- {
576
- name: 'image.png',
577
- title: 'Image/PNG',
578
- icon: 'fa-light fa-image ax-text-purple-500',
579
- },
559
+ "type": "page-layout",
560
+ "children": [
561
+ {
562
+ "type": "title-editor",
563
+ "name": "title-editor1",
564
+ "meta": {
565
+ "header": true
566
+ },
567
+ "options": {
568
+ "multiple": false,
569
+ "disabled": false,
570
+ "hasClearButton": false,
571
+ "validations": {
572
+ "regex": null,
573
+ "required": {
574
+ "rule": "required",
575
+ "message": "This field is required."
576
+ }
577
+ }
578
+ },
579
+ "defaultValue": "",
580
+ "path": "title"
581
+ }
582
+ ],
583
+ "name": "page-layout1"
584
+ }
585
+ ],
586
+ "name": "document"
587
+ }`;
588
+ const descriptionInterface$1 = `{
589
+ "type": "document-layout",
590
+ "children": [
591
+ {
592
+ "type": "page-layout",
593
+ "children": [
594
+ {
595
+ "type": "description-editor",
596
+ "name": "description-editor1",
597
+ "meta": {
598
+ "header": true
599
+ },
600
+ "options": {
601
+ "multiple": false,
602
+ "disabled": false,
603
+ "hasClearButton": false,
604
+ },
605
+ "defaultValue": "",
606
+ "path": "description"
607
+ }
608
+ ],
609
+ "name": "page-layout1"
610
+ }
611
+ ],
612
+ "name": "document"
613
+ }`;
614
+ const contractNumberInterface$1 = `{
615
+ "type": "document-layout",
616
+ "children": [
617
+ {
618
+ "type": "page-layout",
619
+ "children": [
620
+ {
621
+ "type": "number-editor",
622
+ "name": "number-editor1",
623
+ "meta": {
624
+ "header": true
625
+ },
626
+ "options": {
627
+ "multiple": false,
628
+ "disabled": false,
629
+ "hasClearButton": false,
630
+ },
631
+ "defaultValue": "",
632
+ "path": "contract-number"
633
+ }
634
+ ],
635
+ "name": "page-layout1"
636
+ }
637
+ ],
638
+ "name": "document"
639
+ }`;
640
+ const evaluatorInterface$1 = `{
641
+ "type": "document-layout",
642
+ "children": [
643
+ {
644
+ "type": "page-layout",
645
+ "children": [
646
+ {
647
+ "type": "text-editor",
648
+ "name": "text-editor1",
649
+ "meta": {
650
+ "header": true
651
+ },
652
+ "options": {
653
+ "multiple": false,
654
+ "disabled": false,
655
+ "hasClearButton": false,
656
+ },
657
+ "defaultValue": "",
658
+ "path": "evaluator"
659
+ }
660
+ ],
661
+ "name": "page-layout1"
662
+ }
663
+ ],
664
+ "name": "document"
665
+ }`;
666
+ async function DocumentTypeMockGenerator(injector) {
667
+ const fileTypeProvider = injector.get(AXPFileTypeProviderService);
668
+ const Items = await fileTypeProvider.items();
669
+ // Define the correct type for the items and use flatMap to create a flat array
670
+ const selectedItems = Items.flatMap((parent) => parent.extensions.map((extension) => ({
671
+ name: `${parent.name}.${extension.name}`,
672
+ title: `${parent.title}/${extension.title}`,
673
+ icon: extension.icon ? extension.icon : "",
674
+ })));
675
+ return [
676
+ {
677
+ id: AXPDataGenerator$1.uuid(),
678
+ name: 'risk-assessment-report',
679
+ title: 'Risk Assessment Report',
680
+ maxSize: 5000,
681
+ isEncrypted: false,
682
+ isMultiple: true,
683
+ meta: [
580
684
  {
581
- name: 'image.gif',
582
- title: 'Image/GIF',
583
- icon: 'fa-light fa-image ax-text-purple-500',
685
+ name: 'accept-check-box',
686
+ title: 'Agreement Box',
687
+ interface: checkbox$1,
584
688
  },
585
689
  ],
586
- context: {
587
- image: {
588
- width: '22',
589
- height: '33',
590
- },
591
- gift: {
592
- duration: '11',
690
+ type: {
691
+ selectedItems: [
692
+ {
693
+ name: 'image.jpg',
694
+ title: 'Image/JPEG',
695
+ icon: 'fa-light fa-image ax-text-purple-500',
696
+ },
697
+ {
698
+ name: 'image.png',
699
+ title: 'Image/PNG',
700
+ icon: 'fa-light fa-image ax-text-purple-500',
701
+ },
702
+ {
703
+ name: 'image.gif',
704
+ title: 'Image/GIF',
705
+ icon: 'fa-light fa-image ax-text-purple-500',
706
+ },
707
+ ],
708
+ context: {
709
+ image: {
710
+ width: '22',
711
+ height: '33',
712
+ },
713
+ gift: {
714
+ duration: '11',
715
+ },
593
716
  },
594
717
  },
595
718
  },
596
- },
597
- {
598
- id: AXPDataGenerator$1.uuid(),
599
- name: 'WHS',
600
- title: 'Workplace Health and Safety Guidelines',
601
- maxSize: 10000,
602
- isEncrypted: true,
603
- meta: [{ name: 'external', title: 'External', interface: '' }],
604
- type: {
605
- selectedItems: [
606
- {
607
- name: 'audio.mp3',
608
- title: 'MP3',
609
- icon: 'fa-light fa-file-audio ax-text-green-500',
610
- },
611
- {
612
- name: 'audio.wav',
613
- title: 'WAV',
614
- icon: 'fa-light fa-file-audio ax-text-green-500',
615
- },
616
- ],
617
- context: {
618
- audio: {
619
- bitrate: '320',
620
- duration: '180',
719
+ {
720
+ id: AXPDataGenerator$1.uuid(),
721
+ name: 'any',
722
+ title: 'Any Document',
723
+ maxSize: 50000,
724
+ isEncrypted: false,
725
+ isMultiple: false,
726
+ meta: [],
727
+ type: {
728
+ selectedItems: [],
729
+ context: {
730
+ audio: {
731
+ bitrate: '320',
732
+ duration: '180',
733
+ },
621
734
  },
622
735
  },
623
736
  },
624
- },
625
- ];
737
+ ];
738
+ }
626
739
 
627
740
  class AXCDocumentTypeDataSeeder {
628
741
  constructor() {
742
+ this.injector = inject(Injector);
629
743
  this.storageService = inject(AXPDexieEntityStorageService);
630
744
  }
631
745
  async seed() {
746
+ const DocumentTypeMocks = await DocumentTypeMockGenerator(this.injector);
632
747
  await this.storageService.initial(`${RootConfig.module.name}.${RootConfig.entities.documentType.name}`, DocumentTypeMocks);
633
748
  }
634
749
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXCDocumentTypeDataSeeder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -869,210 +984,226 @@ class AXMFileMockService extends AXMDocumentServiceImpl {
869
984
  }
870
985
  }
871
986
 
872
- /**
873
- * Document Management Mock Data Service Class
874
- * Manages simulated data for document management folders and files
875
- */
876
- class DocumentManagementMockDataService {
877
- /**
878
- *
879
- */
880
- constructor(injector) {
881
- this.injector = injector;
882
- // Protected data
883
- this._folders = [];
884
- this._files = [];
885
- this._initialized = false;
886
- // Inject required services
887
- this.http = this.injector.get(HttpClient);
888
- this.fileStorage = this.injector.get(AXPFileStorageService);
889
- }
890
- /**
891
- * Access to simulated folders
892
- */
893
- get folders() {
894
- return this._folders;
895
- }
896
- /**
897
- * Access to simulated files
898
- */
899
- get files() {
900
- return this._files;
901
- }
902
- /**
903
- * Check initialization status
904
- */
905
- get isInitialized() {
906
- return this._initialized;
907
- }
908
- /**
909
- * Initialize mock data without parameters
910
- * Uses dependency injection for services
911
- */
912
- async initialize() {
913
- if (this._initialized) {
914
- return;
915
- }
916
- const { folders, files } = await this.createMockData();
917
- // Clear previous data
918
- this._folders.length = 0;
919
- this._files.length = 0;
920
- // Add new data
921
- this._folders.push(...folders);
922
- this._files.push(...files);
923
- this._initialized = true;
924
- }
925
- /**
926
- * Fetch file as Blob
927
- */
928
- async fetchFileAsBlob(fileName, type) {
929
- try {
930
- // Use window.location.origin to get the base URL of the application
931
- const baseUrl = window.location.origin;
932
- const subPath = type === 'image' ? 'image' : 'pdf';
933
- const url = `${baseUrl}/assets/temp/${subPath}/${fileName}`;
934
- const response = await firstValueFrom(this.http.get(url, { responseType: 'blob' }));
935
- const blob = new Blob([response], { type: type === 'image' ? 'image/jpeg' : 'application/pdf' });
936
- const file = new File([blob], fileName, { type: blob.type });
937
- return file;
938
- }
939
- catch (error) {
940
- console.error(`Error fetching file ${fileName}:`, error);
941
- throw error;
942
- }
943
- }
944
- /**
945
- * Create mock data
946
- */
947
- async createMockData() {
948
- const allFolders = [];
949
- const allFiles = [];
950
- const rootFolder = {
951
- id: AXPDataGenerator$1.uuid(),
952
- name: 'WHS Documentation',
987
+ const allFolders = [];
988
+ const allFiles = [];
989
+ function getRandomSize() {
990
+ return AXPDataGenerator$1.number(500 * 1024, 10 * 1024 * 1024);
991
+ }
992
+ const rootFolder = {
993
+ id: AXPDataGenerator$1.uuid(),
994
+ name: 'WHS Documentation',
995
+ color: '#FFFFFF',
996
+ description: 'Root folder for WHS/OHS Documentation',
997
+ parentId: undefined,
998
+ isSystem: true,
999
+ isHidden: false,
1000
+ isDeleted: false,
1001
+ createdAt: new Date(),
1002
+ updatedAt: new Date(),
1003
+ createdBy: 'system',
1004
+ updatedBy: 'system',
1005
+ size: getRandomSize(),
1006
+ folders: [],
1007
+ documents: [],
1008
+ };
1009
+ // Updated sample file types with WHS/OHS specific examples
1010
+ const sampleFileTypes = [
1011
+ {
1012
+ ext: 'pdf',
1013
+ titles: ['Risk Assessment Report', 'Safety Audit Checklist', 'Emergency Response Plan', 'Safety Training Manual'],
1014
+ },
1015
+ {
1016
+ ext: 'docx',
1017
+ titles: ['Incident Investigation Form', 'Safety Meeting Minutes', 'Hazard Report Template', 'Safe Work Procedure'],
1018
+ },
1019
+ {
1020
+ ext: 'xlsx',
1021
+ titles: ['Incident Statistics', 'Safety Training Matrix', 'PPE Inventory List', 'Risk Register'],
1022
+ },
1023
+ {
1024
+ ext: 'jpg',
1025
+ titles: ['Hazard Photo', 'Safety Signage', 'Emergency Exit Plan', 'PPE Requirements Chart'],
1026
+ },
1027
+ {
1028
+ ext: 'png',
1029
+ titles: ['Safety Infographic', 'Evacuation Map', 'Incident Scene Photo', 'Safety Procedure Diagram'],
1030
+ },
1031
+ {
1032
+ ext: 'pptx',
1033
+ titles: ['Safety Induction', 'WHS Training Module', 'Safety Committee Presentation', 'Toolbox Talk'],
1034
+ },
1035
+ ];
1036
+ const sites = ['Main Factory', 'Warehouse Complex', 'Office Building', 'Construction Site'];
1037
+ const whsFolders = [
1038
+ {
1039
+ name: 'Policies and Procedures',
1040
+ subFolders: ['Safety Policies', 'Standard Operating Procedures', 'Emergency Procedures', 'Work Instructions'],
1041
+ commonFiles: [
1042
+ 'WHS Policy Manual.pdf',
1043
+ 'Emergency Response Plan.pdf',
1044
+ 'Safety Management System.docx',
1045
+ 'Risk Management Framework.pdf',
1046
+ ],
1047
+ },
1048
+ {
1049
+ name: 'Risk Management',
1050
+ subFolders: ['Risk Assessments', 'Hazard Reports', 'Control Measures', 'Safety Audits'],
1051
+ commonFiles: [
1052
+ 'Risk Assessment Matrix.xlsx',
1053
+ 'Hazard Register.xlsx',
1054
+ 'Control Measure Checklist.pdf',
1055
+ 'Audit Schedule.xlsx',
1056
+ ],
1057
+ },
1058
+ {
1059
+ name: 'Incident Management',
1060
+ subFolders: ['Incident Reports', 'Investigations', 'Corrective Actions', 'Statistics'],
1061
+ commonFiles: [
1062
+ 'Incident Report Form.docx',
1063
+ 'Investigation Guidelines.pdf',
1064
+ 'Corrective Action Register.xlsx',
1065
+ 'Monthly Statistics.xlsx',
1066
+ ],
1067
+ },
1068
+ {
1069
+ name: 'Training and Compliance',
1070
+ subFolders: ['Training Records', 'Certifications', 'Competency Assessments', 'Toolbox Talks'],
1071
+ commonFiles: [
1072
+ 'Training Matrix.xlsx',
1073
+ 'Induction Package.pdf',
1074
+ 'Competency Framework.docx',
1075
+ 'Training Calendar.xlsx',
1076
+ ],
1077
+ },
1078
+ {
1079
+ name: 'Safety Equipment',
1080
+ subFolders: ['PPE Records', 'Equipment Inspections', 'Maintenance Records', 'Safety Data Sheets'],
1081
+ commonFiles: [
1082
+ 'PPE Register.xlsx',
1083
+ 'Equipment Maintenance Schedule.xlsx',
1084
+ 'Safety Equipment Inventory.xlsx',
1085
+ 'PPE Guidelines.pdf',
1086
+ ],
1087
+ },
1088
+ ];
1089
+ sites.forEach((site) => {
1090
+ const siteFolderId = AXPDataGenerator$1.uuid();
1091
+ const siteFolder = {
1092
+ id: siteFolderId,
1093
+ name: site,
1094
+ color: '#FFFFFF',
1095
+ size: getRandomSize(),
1096
+ description: `WHS Documentation for ${site}`,
1097
+ parentId: rootFolder.id,
1098
+ isSystem: false,
1099
+ isHidden: false,
1100
+ isDeleted: false,
1101
+ createdAt: new Date(),
1102
+ updatedAt: new Date(),
1103
+ createdBy: 'system',
1104
+ updatedBy: 'system',
1105
+ tenantId: site,
1106
+ userId: undefined,
1107
+ folders: [],
1108
+ documents: [],
1109
+ };
1110
+ const safetyRoles = ['Safety Officer', 'Site Supervisor', 'WHS Representative'];
1111
+ safetyRoles.forEach((role) => {
1112
+ const roleFolderId = AXPDataGenerator$1.uuid();
1113
+ const roleFolder = {
1114
+ id: roleFolderId,
1115
+ name: role,
953
1116
  color: '#FFFFFF',
954
- description: 'Root folder for WHS/OHS Documentation',
955
- parentId: undefined,
956
- isSystem: true,
1117
+ size: getRandomSize(),
1118
+ description: `${role} Documentation`,
1119
+ parentId: siteFolder.id,
1120
+ isSystem: false,
957
1121
  isHidden: false,
958
1122
  isDeleted: false,
959
1123
  createdAt: new Date(),
960
1124
  updatedAt: new Date(),
961
1125
  createdBy: 'system',
962
1126
  updatedBy: 'system',
1127
+ tenantId: site,
1128
+ userId: role.toLowerCase().replace(/\s+/g, '_'),
963
1129
  folders: [],
964
1130
  documents: [],
965
1131
  };
966
- // Sites
967
- const sites = ['Main Factory', 'Warehouse Complex', 'Office Building', 'Construction Site'];
968
- // Sample file types with WHS/OHS specific examples
969
- const sampleFileTypes = [
970
- {
971
- ext: 'pdf',
972
- titles: [
973
- 'Risk Assessment Report',
974
- 'Safety Audit Checklist',
975
- 'Emergency Response Plan',
976
- 'Safety Training Manual',
977
- ],
978
- },
979
- {
980
- ext: 'docx',
981
- titles: [
982
- 'Incident Investigation Form',
983
- 'Safety Meeting Minutes',
984
- 'Hazard Report Template',
985
- 'Safe Work Procedure',
986
- ],
987
- },
988
- {
989
- ext: 'xlsx',
990
- titles: ['Incident Statistics', 'Safety Training Matrix', 'PPE Inventory List', 'Risk Register'],
991
- },
992
- {
993
- ext: 'jpg',
994
- titles: ['Hazard Photo', 'Safety Signage', 'Emergency Exit Plan', 'PPE Requirements Chart'],
995
- },
996
- {
997
- ext: 'png',
998
- titles: ['Safety Infographic', 'Evacuation Map', 'Incident Scene Photo', 'Safety Procedure Diagram'],
999
- },
1000
- {
1001
- ext: 'pptx',
1002
- titles: ['Safety Induction', 'WHS Training Module', 'Safety Committee Presentation', 'Toolbox Talk'],
1003
- },
1004
- ];
1005
- // WHS folders
1006
- const whsFolders = [
1007
- {
1008
- name: 'Policies and Procedures',
1009
- subFolders: ['Safety Policies', 'Standard Operating Procedures', 'Emergency Procedures', 'Work Instructions'],
1010
- commonFiles: [
1011
- 'WHS Policy Manual.pdf',
1012
- 'Emergency Response Plan.pdf',
1013
- 'Safety Management System.docx',
1014
- 'Risk Management Framework.pdf',
1015
- ],
1016
- },
1017
- {
1018
- name: 'Risk Management',
1019
- subFolders: ['Risk Assessments', 'Hazard Reports', 'Control Measures', 'Safety Audits'],
1020
- commonFiles: [
1021
- 'Risk Assessment Matrix.xlsx',
1022
- 'Hazard Register.xlsx',
1023
- 'Control Measure Checklist.pdf',
1024
- 'Audit Schedule.xlsx',
1025
- ],
1026
- },
1027
- {
1028
- name: 'Incident Management',
1029
- subFolders: ['Incident Reports', 'Investigations', 'Corrective Actions', 'Statistics'],
1030
- commonFiles: [
1031
- 'Incident Report Form.docx',
1032
- 'Investigation Guidelines.pdf',
1033
- 'Corrective Action Register.xlsx',
1034
- 'Monthly Statistics.xlsx',
1035
- ],
1036
- },
1037
- {
1038
- name: 'Training and Compliance',
1039
- subFolders: ['Training Records', 'Certifications', 'Competency Assessments', 'Toolbox Talks'],
1040
- commonFiles: [
1041
- 'Training Matrix.xlsx',
1042
- 'Induction Package.pdf',
1043
- 'Competency Framework.docx',
1044
- 'Training Calendar.xlsx',
1045
- ],
1046
- },
1047
- {
1048
- name: 'Safety Equipment',
1049
- subFolders: ['PPE Records', 'Equipment Inspections', 'Maintenance Records', 'Safety Data Sheets'],
1050
- commonFiles: [
1051
- 'PPE Register.xlsx',
1052
- 'Equipment Maintenance Schedule.xlsx',
1053
- 'Safety Equipment Inventory.xlsx',
1054
- 'PPE Guidelines.pdf',
1055
- ],
1056
- },
1057
- ];
1058
- // Available real assets
1059
- const REAL_IMAGES = ['1.jpg', '2.jpg', '3.jpg', '4.jpg'];
1060
- const REAL_PDFS = ['1.pdf'];
1061
- // Helper function to get random file name
1062
- const getRandomImageName = () => {
1063
- return REAL_IMAGES[Math.floor(Math.random() * REAL_IMAGES.length)];
1064
- };
1065
- const getRandomPdfName = () => {
1066
- return REAL_PDFS[Math.floor(Math.random() * REAL_PDFS.length)];
1132
+ sampleFileTypes.forEach((fileType) => {
1133
+ fileType.titles.forEach((title) => {
1134
+ if (Math.random() > 0.5) {
1135
+ const file = {
1136
+ id: AXPDataGenerator$1.uuid(),
1137
+ name: `${title.toLowerCase().replace(/\s+/g, '-')}.${fileType.ext}`,
1138
+ title: title,
1139
+ parentId: roleFolderId,
1140
+ size: getRandomSize(),
1141
+ createdAt: new Date(),
1142
+ updatedAt: new Date(),
1143
+ createdBy: 'system',
1144
+ updatedBy: 'system',
1145
+ fileId: `${window.location.origin}/assets/temp/${fileType.ext}/${Math.floor(Math.random() * 3) + 1}.${fileType.ext}`,
1146
+ meta: {
1147
+ type: fileType.ext == 'png' || fileType.ext == 'jpg' ? 'image' : fileType.ext,
1148
+ },
1149
+ };
1150
+ allFiles.push(file);
1151
+ roleFolder.documents?.push(file);
1152
+ }
1153
+ });
1154
+ });
1155
+ siteFolder.folders?.push(roleFolder);
1156
+ allFolders.push(roleFolder);
1157
+ });
1158
+ whsFolders.forEach((dept) => {
1159
+ const deptFolderId = AXPDataGenerator$1.uuid();
1160
+ const deptFolder = {
1161
+ id: deptFolderId,
1162
+ name: dept.name,
1163
+ color: '#' + Math.floor(Math.random() * 16777215).toString(16),
1164
+ size: getRandomSize(),
1165
+ description: `${dept.name} documentation`,
1166
+ parentId: siteFolder.id,
1167
+ isSystem: false,
1168
+ isHidden: false,
1169
+ isDeleted: false,
1170
+ createdAt: new Date(),
1171
+ updatedAt: new Date(),
1172
+ createdBy: 'system',
1173
+ updatedBy: 'system',
1174
+ tenantId: site,
1175
+ folders: [],
1176
+ documents: [],
1067
1177
  };
1068
- for await (const site of sites) {
1069
- const siteFolderId = AXPDataGenerator$1.uuid();
1070
- const siteFolder = {
1071
- id: siteFolderId,
1072
- name: site,
1073
- color: '#FFFFFF',
1074
- description: `WHS Documentation for ${site}`,
1075
- parentId: rootFolder.id,
1178
+ dept.commonFiles.forEach((fileName) => {
1179
+ const [name, extension] = fileName.split('.');
1180
+ const file = {
1181
+ id: AXPDataGenerator$1.uuid(),
1182
+ name: fileName,
1183
+ title: name,
1184
+ parentId: deptFolderId,
1185
+ size: getRandomSize(),
1186
+ createdAt: new Date(),
1187
+ updatedAt: new Date(),
1188
+ createdBy: 'system',
1189
+ updatedBy: 'system',
1190
+ fileId: `${window.location.origin}/assets/temp/${extension}/${Math.floor(Math.random() * 3) + 1}.${extension}`,
1191
+ meta: {
1192
+ type: extension == 'png' || extension == 'jpg' ? 'image' : extension,
1193
+ },
1194
+ };
1195
+ allFiles.push(file);
1196
+ deptFolder.documents?.push(file);
1197
+ });
1198
+ dept.subFolders.forEach((subFolderName) => {
1199
+ const subFolderId = AXPDataGenerator$1.uuid();
1200
+ const subFolder = {
1201
+ id: subFolderId,
1202
+ name: subFolderName,
1203
+ color: '#' + Math.floor(Math.random() * 16777215).toString(16),
1204
+ size: getRandomSize(),
1205
+ description: `${subFolderName} documentation`,
1206
+ parentId: deptFolderId,
1076
1207
  isSystem: false,
1077
1208
  isHidden: false,
1078
1209
  isDeleted: false,
@@ -1081,195 +1212,52 @@ class DocumentManagementMockDataService {
1081
1212
  createdBy: 'system',
1082
1213
  updatedBy: 'system',
1083
1214
  tenantId: site,
1084
- userId: undefined,
1085
1215
  folders: [],
1086
1216
  documents: [],
1087
1217
  };
1088
- try {
1089
- // Add image document
1090
- const imageName = getRandomImageName();
1091
- const imageFile = await this.fetchFileAsBlob(imageName, 'image');
1092
- const imageInfo = await this.fileStorage.save({
1093
- category: 'site-images',
1094
- file: imageFile,
1095
- refId: siteFolderId,
1096
- refType: 'site-folder',
1097
- isPrimary: true,
1098
- status: AXPFileStorageStatus.Committed,
1099
- });
1100
- const docImage = {
1101
- id: AXPDataGenerator$1.uuid(),
1102
- name: imageName,
1103
- title: 'Site Overview',
1104
- parentId: siteFolderId,
1105
- fileId: imageInfo.fileId,
1106
- meta: {
1107
- type: 'image',
1108
- size: imageFile.size,
1109
- uploadedAt: imageInfo.uploadedAt,
1110
- },
1111
- };
1112
- siteFolder.documents?.push(docImage);
1113
- allFiles.push(docImage);
1114
- // Add PDF document
1115
- const pdfName = getRandomPdfName();
1116
- const pdfFile = await this.fetchFileAsBlob(pdfName, 'pdf');
1117
- const pdfInfo = await this.fileStorage.save({
1118
- category: 'site-documents',
1119
- file: pdfFile,
1120
- refId: siteFolderId,
1121
- refType: 'site-folder',
1122
- isPrimary: false,
1123
- status: AXPFileStorageStatus.Committed,
1124
- });
1125
- const doc = {
1126
- id: AXPDataGenerator$1.uuid(),
1127
- name: pdfName,
1128
- title: 'Site Documentation',
1129
- parentId: siteFolderId,
1130
- fileId: pdfInfo.fileId,
1131
- meta: {
1132
- type: 'pdf',
1133
- size: pdfFile.size,
1134
- uploadedAt: pdfInfo.uploadedAt,
1135
- },
1136
- };
1137
- siteFolder.documents?.push(doc);
1138
- allFiles.push(doc);
1139
- }
1140
- catch (error) {
1141
- console.error(`Error processing files for site ${site}:`, error);
1142
- // Continue with next site even if current one fails
1143
- continue;
1144
- }
1145
- const safetyRoles = ['Safety Officer', 'Site Supervisor', 'WHS Representative'];
1146
- safetyRoles.forEach((role) => {
1147
- const roleFolderId = AXPDataGenerator$1.uuid();
1148
- const roleFolder = {
1149
- id: roleFolderId,
1150
- name: role,
1151
- color: '#FFFFFF',
1152
- description: `${role} Documentation`,
1153
- parentId: siteFolder.id,
1154
- isSystem: false,
1155
- isHidden: false,
1156
- isDeleted: false,
1157
- createdAt: new Date(),
1158
- updatedAt: new Date(),
1159
- createdBy: 'system',
1160
- updatedBy: 'system',
1161
- tenantId: site,
1162
- userId: role.toLowerCase().replace(/\s+/g, '_'),
1163
- folders: [],
1164
- documents: [],
1165
- };
1166
- // sampleFileTypes.forEach((fileType) => {
1167
- // fileType.titles.forEach((title) => {
1168
- // if (Math.random() > 0.5) {
1169
- // const file: AXMDocumentManagementDocumentEntityModel = {
1170
- // id: AXPDataGenerator.uuid(),
1171
- // name: `${title.toLowerCase().replace(/\s+/g, '-')}.${fileType.ext}`,
1172
- // title: title,
1173
- // parentId: roleFolderId,
1174
- // };
1175
- // allFiles.push(file);
1176
- // roleFolder.documents?.push(file);
1177
- // }
1178
- // });
1179
- // });
1180
- siteFolder.folders?.push(roleFolder);
1181
- allFolders.push(roleFolder);
1182
- });
1183
- whsFolders.forEach((dept) => {
1184
- const deptFolderId = AXPDataGenerator$1.uuid();
1185
- const deptFolder = {
1186
- id: deptFolderId,
1187
- name: dept.name,
1188
- color: '#' + Math.floor(Math.random() * 16777215).toString(16),
1189
- description: `${dept.name} documentation`,
1190
- parentId: siteFolder.id,
1191
- isSystem: false,
1192
- isHidden: false,
1193
- isDeleted: false,
1194
- createdAt: new Date(),
1195
- updatedAt: new Date(),
1196
- createdBy: 'system',
1197
- updatedBy: 'system',
1198
- tenantId: site,
1199
- folders: [],
1200
- documents: [],
1201
- };
1202
- // dept.commonFiles.forEach((fileName) => {
1203
- // const file: AXMDocumentManagementDocumentEntityModel = {
1204
- // id: AXPDataGenerator.uuid(),
1205
- // name: fileName,
1206
- // title: fileName.split('.')[0],
1207
- // parentId: deptFolderId,
1208
- // };
1209
- // allFiles.push(file);
1210
- // deptFolder.documents?.push(file);
1211
- // });
1212
- dept.subFolders.forEach((subFolderName) => {
1213
- const subFolderId = AXPDataGenerator$1.uuid();
1214
- const subFolder = {
1215
- id: subFolderId,
1216
- name: subFolderName,
1217
- color: '#' + Math.floor(Math.random() * 16777215).toString(16),
1218
- description: `${subFolderName} documentation`,
1219
- parentId: deptFolderId,
1220
- isSystem: false,
1221
- isHidden: false,
1222
- isDeleted: false,
1223
- createdAt: new Date(),
1224
- updatedAt: new Date(),
1225
- createdBy: 'system',
1226
- updatedBy: 'system',
1227
- tenantId: site,
1228
- folders: [],
1229
- documents: [],
1230
- };
1231
- // sampleFileTypes.forEach((fileType) => {
1232
- // fileType.titles.forEach((title) => {
1233
- // if (Math.random() > 0.7) {
1234
- // const file: AXMDocumentManagementDocumentEntityModel = {
1235
- // id: AXPDataGenerator.uuid(),
1236
- // name: `${title.toLowerCase().replace(/\s+/g, '-')}.${fileType.ext}`,
1237
- // title: title,
1238
- // parentId: subFolderId,
1239
- // };
1240
- // allFiles.push(file);
1241
- // subFolder.documents?.push(file);
1242
- // }
1243
- // });
1244
- // });
1245
- deptFolder.folders?.push(subFolder);
1246
- allFolders.push(subFolder);
1218
+ sampleFileTypes.forEach((fileType) => {
1219
+ fileType.titles.forEach((title) => {
1220
+ if (Math.random() > 0.7) {
1221
+ const file = {
1222
+ id: AXPDataGenerator$1.uuid(),
1223
+ name: `${title.toLowerCase().replace(/\s+/g, '-')}.${fileType.ext}`,
1224
+ title: title,
1225
+ parentId: subFolderId,
1226
+ fileId: `${window.location.origin}/assets/temp/${fileType.ext}/${Math.floor(Math.random() * 3) + 1}.${fileType.ext}`,
1227
+ size: getRandomSize(),
1228
+ createdAt: new Date(),
1229
+ updatedAt: new Date(),
1230
+ createdBy: 'system',
1231
+ updatedBy: 'system',
1232
+ meta: {
1233
+ type: fileType.ext == 'png' || fileType.ext == 'jpg' ? 'image' : fileType.ext,
1234
+ },
1235
+ };
1236
+ allFiles.push(file);
1237
+ subFolder.documents?.push(file);
1238
+ }
1247
1239
  });
1248
- siteFolder.folders?.push(deptFolder);
1249
- allFolders.push(deptFolder);
1250
1240
  });
1251
- rootFolder.folders?.push(siteFolder);
1252
- allFolders.push(siteFolder);
1253
- }
1254
- rootFolder.folders?.push(rootFolder);
1255
- allFolders.push(rootFolder);
1256
- return { folders: allFolders, files: allFiles };
1257
- }
1258
- }
1241
+ deptFolder.folders?.push(subFolder);
1242
+ allFolders.push(subFolder);
1243
+ });
1244
+ siteFolder.folders?.push(deptFolder);
1245
+ allFolders.push(deptFolder);
1246
+ });
1247
+ rootFolder.folders?.push(siteFolder);
1248
+ allFolders.push(siteFolder);
1249
+ });
1250
+ allFolders.push(rootFolder);
1251
+ const FOLDER_MOCK_DATA = allFolders;
1252
+ const FILE_MOCK_DATA = allFiles;
1259
1253
 
1260
1254
  class AXCFolderDataSeeder {
1261
1255
  constructor() {
1262
1256
  this.storageService = inject(AXPDexieEntityStorageService);
1263
- this.injector = inject(Injector);
1264
1257
  }
1265
1258
  async seed() {
1266
- const folders = await this.storageService.getAll(`${RootConfig.module.name}.${RootConfig.entities.folder.name}`);
1267
- if (folders.length === 0) {
1268
- const doc = new DocumentManagementMockDataService(this.injector);
1269
- await doc.initialize();
1270
- await this.storageService.initial(`${RootConfig.module.name}.${RootConfig.entities.folder.name}`, doc.folders);
1271
- await this.storageService.initial(`${RootConfig.module.name}.${RootConfig.entities.document.name}`, doc.files);
1272
- }
1259
+ await this.storageService.initial(`${RootConfig.module.name}.${RootConfig.entities.folder.name}`, FOLDER_MOCK_DATA);
1260
+ await this.storageService.initial(`${RootConfig.module.name}.${RootConfig.entities.document.name}`, FILE_MOCK_DATA);
1273
1261
  }
1274
1262
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXCFolderDataSeeder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1275
1263
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXCFolderDataSeeder }); }
@@ -2786,22 +2774,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2786
2774
  type: Injectable
2787
2775
  }], ctorParameters: () => [] });
2788
2776
 
2777
+ const OHS_ID = AXPDataGenerator$1.uuid();
2778
+ const METADATA_CATEGORY_MOCK = [
2779
+ {
2780
+ id: AXPDataGenerator$1.uuid(),
2781
+ title: 'General',
2782
+ },
2783
+ {
2784
+ id: OHS_ID,
2785
+ title: 'OHS',
2786
+ },
2787
+ {
2788
+ id: AXPDataGenerator$1.uuid(),
2789
+ title: 'General',
2790
+ parentId: OHS_ID,
2791
+ },
2792
+ {
2793
+ id: AXPDataGenerator$1.uuid(),
2794
+ title: 'License',
2795
+ parentId: OHS_ID,
2796
+ },
2797
+ ];
2789
2798
  const checkbox = '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"checkbox-editor","name":"checkbox-editor1","options":{"label":"i accept","readonly":false,"disabled":false},"defaultValue":false,"path":"accept-check-box"}],"name":"page-layout1"}],"name":"document"}';
2790
2799
  const color = '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"block-layout","name":"block-layout1","options":{"flexDirection":{"id":"ax-flex-row"},"flexJustifyContent":{"id":"ax-justify-normal"},"flexAlignItems":{"id":"ax-items-start"},"gap":2,"flexWrap":{"id":"ax-flex-nowrap"},"spacing":{"margin":"0px 0px 0px 0px","padding":"0px 0px 0px 0px"},"border":{"width":"0px","radius":"0px","color":"#000000","style":"none"},"flexOptions":{"gap":"0px","flexDirection":"row","flexWrap":"nowrap","justifyContent":"flex-start","alignItems":"flex-start"}}},"children":[{"type":"color-editor","name":"color-editor1","options":{"readonly":false,"disabled":false,"validations":{"required":{"rule":"required","message":"This field is required."}},"placeholder":"pick color"},"path":"color-box"}]}],"name":"page-layout1"}],"name":"document"}';
2800
+ const titleInterface = '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"title-editor","name":"title-editor1","meta":{"header":true},"options":{"multiple":false,"disabled":false,"hasClearButton":false,"validations":{"regex":null,"required":{"rule":"required","message":"This field is required."}}},"defaultValue":"","path":"title"}],"name":"page-layout1"}],"name":"document"}';
2801
+ const descriptionInterface = '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"description-editor","name":"description-editor1","meta":{"header":true},"options":{"multiple":false,"disabled":false,"hasClearButton":false},"defaultValue":"","path":"description"}],"name":"page-layout1"}],"name":"document"}';
2802
+ const contractNumberInterface = '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"number-editor","name":"number-editor1","meta":{"header":true},"options":{"multiple":false,"disabled":false,"hasClearButton":false},"defaultValue":"","path":"contract-number"}],"name":"page-layout1"}],"name":"document"}';
2803
+ const evaluatorInterface = '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"text-editor","name":"text-editor1","meta":{"header":true},"options":{"multiple":false,"disabled":false,"hasClearButton":false},"defaultValue":"","path":"evaluator"}],"name":"page-layout1"}],"name":"document"}';
2791
2804
  const METADATA_MOCK = [
2792
2805
  {
2793
2806
  id: AXPDataGenerator$1.uuid(),
2794
- name: 'checkbox',
2795
- title: 'Checkbox',
2807
+ name: 'title',
2808
+ title: 'Title',
2809
+ defaultValue: '',
2810
+ interface: titleInterface,
2811
+ categoryId: METADATA_CATEGORY_MOCK[0].id,
2812
+ },
2813
+ {
2814
+ id: AXPDataGenerator$1.uuid(),
2815
+ name: 'description',
2816
+ title: 'Description',
2817
+ defaultValue: '',
2818
+ interface: descriptionInterface,
2819
+ categoryId: METADATA_CATEGORY_MOCK[0].id,
2820
+ },
2821
+ {
2822
+ id: AXPDataGenerator$1.uuid(),
2823
+ name: 'agreement-check-box',
2824
+ title: 'Agreement Box',
2796
2825
  defaultValue: false,
2797
2826
  interface: checkbox,
2827
+ categoryId: METADATA_CATEGORY_MOCK[2].id,
2828
+ },
2829
+ {
2830
+ id: AXPDataGenerator$1.uuid(),
2831
+ name: 'contract-number',
2832
+ title: 'Contract Number',
2833
+ defaultValue: '',
2834
+ interface: contractNumberInterface,
2835
+ categoryId: METADATA_CATEGORY_MOCK[2].id,
2798
2836
  },
2799
2837
  {
2800
2838
  id: AXPDataGenerator$1.uuid(),
2801
- name: 'color',
2802
- title: 'Color',
2803
- defaultValue: '#000000',
2804
- interface: color,
2839
+ name: 'evaluator',
2840
+ title: 'Evaluator',
2841
+ defaultValue: '',
2842
+ interface: evaluatorInterface,
2843
+ categoryId: METADATA_CATEGORY_MOCK[3].id,
2805
2844
  },
2806
2845
  ];
2807
2846
 
@@ -2810,6 +2849,7 @@ class AXCMetaDataDefinitionDataSeeder {
2810
2849
  this.storageService = inject(AXPDexieEntityStorageService);
2811
2850
  }
2812
2851
  async seed() {
2852
+ await this.storageService.initial(`${RootConfig$5.module.name}.${RootConfig$5.entities.metaDataDefinitionCategory.name}`, METADATA_CATEGORY_MOCK);
2813
2853
  await this.storageService.initial(`${RootConfig$5.module.name}.${RootConfig$5.entities.metaDataDefinition.name}`, METADATA_MOCK);
2814
2854
  }
2815
2855
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXCMetaDataDefinitionDataSeeder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }