bpm-core 0.0.131 → 0.0.133
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.
- package/cli/deploy/build.js +62 -0
- package/cli/deploy/git-operations-handler.js +104 -0
- package/cli/deploy/index.js +61 -0
- package/cli/deploy/jenkins-manager.js +107 -0
- package/cli/generate/index.js +10 -0
- package/cli/generate/mock/form-node.js +77 -0
- package/cli/generate/mock/index.js +209 -0
- package/cli/generate/mock/lov.js +18 -0
- package/cli/generate/new/angular-template/.editorconfig +13 -0
- package/cli/generate/new/angular-template/README.md +7 -0
- package/cli/generate/new/angular-template/angular.json.ejs +167 -0
- package/cli/generate/new/angular-template/build.sh +6 -0
- package/cli/generate/new/angular-template/extra-webpack.config.js.ejs +5 -0
- package/cli/generate/new/angular-template/karma.conf.js +44 -0
- package/cli/generate/new/angular-template/package.json.ejs +66 -0
- package/cli/generate/new/angular-template/protractor.conf.js +28 -0
- package/cli/generate/new/angular-template/src/app/app.component.html +35 -0
- package/cli/generate/new/angular-template/src/app/app.component.scss +0 -0
- package/cli/generate/new/angular-template/src/app/app.component.ts +81 -0
- package/cli/generate/new/angular-template/src/app/config/segment-dynamic-loader.config.ts.ejs +8 -0
- package/cli/generate/new/angular-template/src/app/i18n/ar.ts.ejs +18 -0
- package/cli/generate/new/angular-template/src/app/i18n/en.ts.ejs +18 -0
- package/cli/generate/new/angular-template/src/app/page-components/@@comp-template@@/@@.component.html.ejs +33 -0
- package/cli/generate/new/angular-template/src/app/page-components/@@comp-template@@/@@.component.ts.ejs +128 -0
- package/cli/generate/new/angular-template/src/app/page-components/@@comp-template@@/_html-field.ejs +97 -0
- package/cli/generate/new/angular-template/src/app/page-components/@@comp-template@@/_html-table.ejs +27 -0
- package/cli/generate/new/angular-template/src/app/page-components/@@comp-template@@/_ts-field.ejs +3 -0
- package/cli/generate/new/angular-template/src/app/shared/pipes/translate.pipe.ts +32 -0
- package/cli/generate/new/angular-template/src/app/shared/services/i18n.service.ts +32 -0
- package/cli/generate/new/angular-template/src/app/shared/services/segment-dynamic-loader.service.ts.ejs +49 -0
- package/cli/generate/new/angular-template/src/app/shared/services/state-machine.service.ts +119 -0
- package/cli/generate/new/angular-template/src/app/shared/types/lov.enum.ts.ejs +7 -0
- package/cli/generate/new/angular-template/src/app/templates/print-section/print-section.component.html +5 -0
- package/cli/generate/new/angular-template/src/app/templates/print-section/print-section.component.scss +0 -0
- package/cli/generate/new/angular-template/src/app/templates/print-section/print-section.component.ts.ejs +156 -0
- package/cli/generate/new/angular-template/src/app/templates/print.ts.ejs +392 -0
- package/cli/generate/new/angular-template/src/environments/environment.local.ts.ejs +40 -0
- package/cli/generate/new/angular-template/src/environments/environment.prod.ts +25 -0
- package/cli/generate/new/angular-template/src/environments/environment.ts +25 -0
- package/cli/generate/new/angular-template/src/favicon.ico +0 -0
- package/cli/generate/new/angular-template/src/index.html.ejs +14 -0
- package/cli/generate/new/angular-template/src/main.ts +49 -0
- package/cli/generate/new/angular-template/src/polyfills.ts +65 -0
- package/cli/generate/new/angular-template/src/styles.scss.ejs +121 -0
- package/cli/generate/new/angular-template/src/test.ts +26 -0
- package/cli/generate/new/angular-template/tsconfig.app.json +15 -0
- package/cli/generate/new/angular-template/tsconfig.json +50 -0
- package/cli/generate/new/angular-template/tsconfig.spec.json +18 -0
- package/cli/generate/new/angular-template/tslint.json +143 -0
- package/cli/generate/new/copy-and-generate.js +120 -0
- package/cli/generate/new/field.js +4 -0
- package/cli/generate/new/index.js +47 -0
- package/cli/generate/new/service-data.js +284 -0
- package/cli/index.js +14 -0
- package/cli/utilities/utilities.js +114 -0
- package/fesm2022/bpm-core.mjs +350 -395
- package/fesm2022/bpm-core.mjs.map +1 -1
- package/lib/components/shared-components/form-field/search-employee/search-employee.component.d.ts +6 -1
- package/lib/components/shared-components/form-field/shared-imports.d.ts +1 -1
- package/lib/components/shared-components/form-field/table-list/table-list.component.d.ts +1 -1
- package/lib/services/core.service.ts.d.ts +1 -0
- package/lib/testComponent/request-details-section/request-details-section.component.d.ts +0 -2
- package/package.json +2 -2
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"newProjectRoot": "projects",
|
|
5
|
+
"projects": {
|
|
6
|
+
"<%=serviceCode%>": {
|
|
7
|
+
"projectType": "application",
|
|
8
|
+
"schematics": {},
|
|
9
|
+
"root": "",
|
|
10
|
+
"sourceRoot": "src",
|
|
11
|
+
"prefix": "app",
|
|
12
|
+
"architect": {
|
|
13
|
+
"build": {
|
|
14
|
+
"builder": "@angular-builders/custom-webpack:browser",
|
|
15
|
+
"options": {
|
|
16
|
+
"customWebpackConfig": {
|
|
17
|
+
"path": "extra-webpack.config.js",
|
|
18
|
+
"mergeStrategies": {
|
|
19
|
+
"externals": "replace"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"allowedCommonJsDependencies": [
|
|
23
|
+
"file-saver","handlebars","moment"
|
|
24
|
+
],
|
|
25
|
+
"outputPath": "dist",
|
|
26
|
+
"index": "src/index.html",
|
|
27
|
+
"main": "src/main.ts",
|
|
28
|
+
"tsConfig": "tsconfig.app.json",
|
|
29
|
+
"polyfills": "src/polyfills.ts",
|
|
30
|
+
"aot": true,
|
|
31
|
+
"assets": [
|
|
32
|
+
"src/favicon.ico",
|
|
33
|
+
"src/assets",
|
|
34
|
+
{
|
|
35
|
+
"glob": "**/*",
|
|
36
|
+
"input": "node_modules/bpm-core/src/lib/assets",
|
|
37
|
+
"output": "/assets/"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"styles": [
|
|
41
|
+
"node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
|
|
42
|
+
"node_modules/intl-tel-input/build/css/intlTelInput.css",
|
|
43
|
+
"node_modules/ngx-toastr/toastr.css",
|
|
44
|
+
"node_modules/basic-ui-components/dist/assets/scss/base.scss",
|
|
45
|
+
"node_modules/bpm-core/src/lib/assets/scss/base.scss",
|
|
46
|
+
"src/styles.scss"
|
|
47
|
+
],
|
|
48
|
+
"scripts": [
|
|
49
|
+
"./node_modules/intl-tel-input/build/js/intlTelInput.min.js"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"configurations": {
|
|
53
|
+
"production": {
|
|
54
|
+
"fileReplacements": [
|
|
55
|
+
{
|
|
56
|
+
"replace": "src/environments/environment.ts",
|
|
57
|
+
"with": "src/environments/environment.prod.ts"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"optimization": true,
|
|
61
|
+
"outputHashing": "none",
|
|
62
|
+
"sourceMap": false,
|
|
63
|
+
"namedChunks": false,
|
|
64
|
+
"extractLicenses": true,
|
|
65
|
+
"vendorChunk": false,
|
|
66
|
+
"buildOptimizer": true,
|
|
67
|
+
"budgets": [
|
|
68
|
+
{
|
|
69
|
+
"type": "initial",
|
|
70
|
+
"maximumWarning": "4mb",
|
|
71
|
+
"maximumError": "6mb"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"type": "anyComponentStyle",
|
|
75
|
+
"maximumWarning": "6mb",
|
|
76
|
+
"maximumError": "6mb"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"local": {
|
|
81
|
+
"fileReplacements": [
|
|
82
|
+
{
|
|
83
|
+
"replace": "src/environments/environment.ts",
|
|
84
|
+
"with": "src/environments/environment.local.ts"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"development": {
|
|
89
|
+
"buildOptimizer": false,
|
|
90
|
+
"optimization": false,
|
|
91
|
+
"vendorChunk": true,
|
|
92
|
+
"extractLicenses": false,
|
|
93
|
+
"sourceMap": true,
|
|
94
|
+
"namedChunks": true,
|
|
95
|
+
"fileReplacements": [
|
|
96
|
+
{
|
|
97
|
+
"replace": "src/environments/environment.ts",
|
|
98
|
+
"with": "src/environments/environment.local.ts"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"serve": {
|
|
105
|
+
"builder": "@angular-devkit/build-angular:dev-server",
|
|
106
|
+
"options": {},
|
|
107
|
+
"configurations": {
|
|
108
|
+
"production": {
|
|
109
|
+
"buildTarget": "<%=serviceCode%>:build:production"
|
|
110
|
+
},
|
|
111
|
+
"local": {
|
|
112
|
+
"buildTarget": "<%=serviceCode%>:build:local"
|
|
113
|
+
},
|
|
114
|
+
"development": {
|
|
115
|
+
"buildTarget": "<%=serviceCode%>:build:development"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"defaultConfiguration": "development"
|
|
119
|
+
},
|
|
120
|
+
"extract-i18n": {
|
|
121
|
+
"builder": "@angular-devkit/build-angular:extract-i18n",
|
|
122
|
+
"options": {
|
|
123
|
+
"buildTarget": "<%=serviceCode%>:build"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"test": {
|
|
127
|
+
"builder": "@angular-devkit/build-angular:karma",
|
|
128
|
+
"options": {
|
|
129
|
+
"main": "src/test.ts",
|
|
130
|
+
"karmaConfig": "./karma.conf.js",
|
|
131
|
+
"polyfills": "src/polyfills.ts",
|
|
132
|
+
"tsConfig": "src/tsconfig.spec.json",
|
|
133
|
+
"assets": [
|
|
134
|
+
"src/favicon.ico",
|
|
135
|
+
"src/assets"
|
|
136
|
+
],
|
|
137
|
+
"styles": []
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"e2e": {
|
|
141
|
+
"builder": "@angular-devkit/build-angular:protractor",
|
|
142
|
+
"options": {
|
|
143
|
+
"protractorConfig": "e2e/protractor.conf.js"
|
|
144
|
+
},
|
|
145
|
+
"configurations": {
|
|
146
|
+
"production": {
|
|
147
|
+
"devServerTarget": "<%=serviceCode%>:serve:production"
|
|
148
|
+
},
|
|
149
|
+
"development": {
|
|
150
|
+
"devServerTarget": "<%=serviceCode%>:serve:development"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"defaultConfiguration": "development"
|
|
154
|
+
},
|
|
155
|
+
"lint": {
|
|
156
|
+
"builder": "@angular-eslint/builder:lint",
|
|
157
|
+
"options": {
|
|
158
|
+
"lintFilePatterns": [
|
|
159
|
+
"src/**/*.ts",
|
|
160
|
+
"src/**/*.html"
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
npx ng build --aot -c production --output-hashing none
|
|
2
|
+
mv ./dist/main.js ./dist/wm-main.bundle.js
|
|
3
|
+
mv ./dist/styles.css ./dist/wm-styles.bundle.css
|
|
4
|
+
mv ./dist/polyfills.js ./dist/wm-polyfills.bundle.js
|
|
5
|
+
mv ./dist/scripts.js ./dist/wm-scripts.bundle.js
|
|
6
|
+
mv ./dist/runtime.js ./dist/wm-inline.bundle.js
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Karma configuration file, see link for more information
|
|
2
|
+
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
+
|
|
4
|
+
module.exports = function (config) {
|
|
5
|
+
config.set({
|
|
6
|
+
basePath: '',
|
|
7
|
+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
+
plugins: [
|
|
9
|
+
require('karma-jasmine'),
|
|
10
|
+
require('karma-chrome-launcher'),
|
|
11
|
+
require('karma-jasmine-html-reporter'),
|
|
12
|
+
require('karma-coverage'),
|
|
13
|
+
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
+
],
|
|
15
|
+
client: {
|
|
16
|
+
jasmine: {
|
|
17
|
+
// you can add configuration options for Jasmine here
|
|
18
|
+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
+
// for example, you can disable the random execution with `random: false`
|
|
20
|
+
// or set a specific seed with `seed: 4321`
|
|
21
|
+
},
|
|
22
|
+
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
+
},
|
|
24
|
+
jasmineHtmlReporter: {
|
|
25
|
+
suppressAll: true // removes the duplicated traces
|
|
26
|
+
},
|
|
27
|
+
coverageReporter: {
|
|
28
|
+
dir: require('path').join(__dirname, './coverage/contractor-service'),
|
|
29
|
+
subdir: '.',
|
|
30
|
+
reporters: [
|
|
31
|
+
{ type: 'html' },
|
|
32
|
+
{ type: 'text-summary' }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
reporters: ['progress', 'kjhtml'],
|
|
36
|
+
port: 9876,
|
|
37
|
+
colors: true,
|
|
38
|
+
logLevel: config.LOG_INFO,
|
|
39
|
+
autoWatch: true,
|
|
40
|
+
browsers: ['Chrome'],
|
|
41
|
+
singleRun: false,
|
|
42
|
+
restartOnFileChange: true
|
|
43
|
+
});
|
|
44
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%=serviceCode%>",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"ng": "ng",
|
|
7
|
+
"start": "ng serve",
|
|
8
|
+
"build": "ng build --configuration production",
|
|
9
|
+
"test": "ng test",
|
|
10
|
+
"lint": "ng lint",
|
|
11
|
+
"e2e": "ng e2e"
|
|
12
|
+
},
|
|
13
|
+
"private": true,
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@angular-builders/custom-webpack": "^19.0.0",
|
|
16
|
+
"@angular/animations": "^19.0.0",
|
|
17
|
+
"@angular/cdk": "^19.0.0",
|
|
18
|
+
"@angular/common": "^19.0.0",
|
|
19
|
+
"@angular/compiler": "^19.0.0",
|
|
20
|
+
"@angular/core": "^19.0.0",
|
|
21
|
+
"@angular/forms": "^19.0.0",
|
|
22
|
+
"@angular/localize": "^19.0.0",
|
|
23
|
+
"@angular/material": "^19.0.0",
|
|
24
|
+
"@angular/platform-browser": "^19.0.0",
|
|
25
|
+
"@angular/platform-browser-dynamic": "^19.0.0",
|
|
26
|
+
"@angular/platform-server": "^19.0.0",
|
|
27
|
+
"@angular/router": "^19.0.0",
|
|
28
|
+
"@ncstate/sat-popover": "^13.1.0",
|
|
29
|
+
"basic-ui-components": "^0.0.6992",
|
|
30
|
+
"bootstrap": "^5.3.3",
|
|
31
|
+
"bpm-core": "^0.0.124",
|
|
32
|
+
"date-fns": "^4.1.0",
|
|
33
|
+
"express": "^4.18.2",
|
|
34
|
+
"file-saver": "^2.0.5",
|
|
35
|
+
"google-libphonenumber": "^3.2.42",
|
|
36
|
+
"handlebars": "^4.7.7",
|
|
37
|
+
"handlebars-loader": "^1.7.2",
|
|
38
|
+
"intl-tel-input": "^24.5.0",
|
|
39
|
+
"moment": "^2.29.4",
|
|
40
|
+
"moment-hijri": "^2.30.0",
|
|
41
|
+
"ng-dynamic-component": "^10.7.0",
|
|
42
|
+
"ngx-bootstrap": "^19.0.2",
|
|
43
|
+
"ngx-intl-tel-input-gg": "^1.0.12",
|
|
44
|
+
"ngx-mask": "^18.0.0",
|
|
45
|
+
"ngx-toastr": "^19.0.0",
|
|
46
|
+
"rxjs": "~7.8.0",
|
|
47
|
+
"tslib": "^2.3.0",
|
|
48
|
+
"zone.js": "~0.14.10"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@angular-devkit/build-angular": "^19.0.0",
|
|
52
|
+
"@angular/cli": "^19.0.0",
|
|
53
|
+
"@angular/compiler-cli": "^19.0.0",
|
|
54
|
+
"@types/express": "^4.17.17",
|
|
55
|
+
"@types/jasmine": "~5.1.0",
|
|
56
|
+
"@types/node": "^18.18.0",
|
|
57
|
+
"jasmine-core": "~5.2.0",
|
|
58
|
+
"karma": "~6.4.0",
|
|
59
|
+
"karma-chrome-launcher": "~3.2.0",
|
|
60
|
+
"karma-coverage": "~2.2.0",
|
|
61
|
+
"karma-jasmine": "~5.1.0",
|
|
62
|
+
"karma-jasmine-html-reporter": "~2.1.0",
|
|
63
|
+
"ng-packagr": "^18.2.1",
|
|
64
|
+
"typescript": "~5.5.2"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Protractor configuration file, see link for more information
|
|
2
|
+
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
|
3
|
+
|
|
4
|
+
const { SpecReporter } = require('jasmine-spec-reporter');
|
|
5
|
+
|
|
6
|
+
exports.config = {
|
|
7
|
+
allScriptsTimeout: 11000,
|
|
8
|
+
specs: [
|
|
9
|
+
'./e2e/**/*.e2e-spec.ts'
|
|
10
|
+
],
|
|
11
|
+
capabilities: {
|
|
12
|
+
'browserName': 'chrome'
|
|
13
|
+
},
|
|
14
|
+
directConnect: true,
|
|
15
|
+
baseUrl: 'http://localhost:4200/',
|
|
16
|
+
framework: 'jasmine',
|
|
17
|
+
jasmineNodeOpts: {
|
|
18
|
+
showColors: true,
|
|
19
|
+
defaultTimeoutInterval: 30000,
|
|
20
|
+
print: function() {}
|
|
21
|
+
},
|
|
22
|
+
onPrepare() {
|
|
23
|
+
require('ts-node').register({
|
|
24
|
+
project: 'e2e/tsconfig.e2e.json'
|
|
25
|
+
});
|
|
26
|
+
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<core-layout>
|
|
2
|
+
@if (!loading['form']) {
|
|
3
|
+
@if (noError) {
|
|
4
|
+
<core-service-header
|
|
5
|
+
[isLoading]="false"
|
|
6
|
+
[formTitle]="'formTitle' | translate"
|
|
7
|
+
[form]="form">
|
|
8
|
+
<app-print-section [form]="form">
|
|
9
|
+
</app-print-section>
|
|
10
|
+
</core-service-header>
|
|
11
|
+
<app-workflow-section
|
|
12
|
+
workflow
|
|
13
|
+
[segmentDynamicLoaderService]="segmentDynamicLoader"
|
|
14
|
+
[form]="form" [sections]="form?.['sections']">
|
|
15
|
+
<app-request-details-section
|
|
16
|
+
[section]="form.sections[0]" [form]="form" [lov]="form?.lovs" className="form-section"
|
|
17
|
+
[isReadOnly]="form.sections[0].header.readOnly"></app-request-details-section>
|
|
18
|
+
</app-workflow-section>
|
|
19
|
+
} @else {
|
|
20
|
+
@if (errorMessage?.length) {
|
|
21
|
+
<ds-message></ds-message>
|
|
22
|
+
@for (item of errorMessage; track $index) {
|
|
23
|
+
<div class="d-flex justify-content-center">
|
|
24
|
+
<span class="fc-coral fs-18" [innerHTML]="item?.['message']"></span>
|
|
25
|
+
</div>
|
|
26
|
+
}
|
|
27
|
+
} @else {
|
|
28
|
+
<ds-message label="{{'errorOccurred' | translate}}"></ds-message>
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
} @else {
|
|
32
|
+
<core-service-header header [formTitle]="'formTitle' | translate" [isLoading]="true">
|
|
33
|
+
</core-service-header>
|
|
34
|
+
}
|
|
35
|
+
</core-layout>
|
|
File without changes
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {AfterViewInit, Component, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA} from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
CoreService,
|
|
4
|
+
Form,
|
|
5
|
+
LayoutComponent,
|
|
6
|
+
ServiceHeaderComponent,
|
|
7
|
+
SidenavService,
|
|
8
|
+
WorkflowSectionComponent,
|
|
9
|
+
CoreI18nService
|
|
10
|
+
} from 'bpm-core';
|
|
11
|
+
import {DynamicComponentInjectorToken} from 'ng-dynamic-component';
|
|
12
|
+
import {RequestDetailsSectionComponent} from "./page-components/request-details-section/request-details-section.component";
|
|
13
|
+
import {SegmentDynamicLoaderService} from './shared/services/segment-dynamic-loader.service';
|
|
14
|
+
import {DOCUMENT, isPlatformBrowser} from "@angular/common";
|
|
15
|
+
import { Inject, PLATFORM_ID} from '@angular/core';
|
|
16
|
+
import {Router} from "@angular/router";
|
|
17
|
+
import {PrintSectionComponent} from "./templates/print-section/print-section.component";
|
|
18
|
+
import {I18nService} from "./shared/services/i18n.service";
|
|
19
|
+
import { TranslatePipe } from './shared/pipes/translate.pipe';
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'app-wm-root',
|
|
23
|
+
standalone: true,
|
|
24
|
+
templateUrl: './app.component.html',
|
|
25
|
+
styleUrl: './app.component.scss',
|
|
26
|
+
imports: [
|
|
27
|
+
LayoutComponent,
|
|
28
|
+
ServiceHeaderComponent,
|
|
29
|
+
WorkflowSectionComponent,
|
|
30
|
+
RequestDetailsSectionComponent,
|
|
31
|
+
PrintSectionComponent,
|
|
32
|
+
TranslatePipe
|
|
33
|
+
],
|
|
34
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
|
|
35
|
+
providers: [
|
|
36
|
+
{provide: DynamicComponentInjectorToken, useValue: { /* your value here */}}
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
})
|
|
40
|
+
export class AppComponent implements AfterViewInit {
|
|
41
|
+
loading = {
|
|
42
|
+
form: false
|
|
43
|
+
}
|
|
44
|
+
form: Form
|
|
45
|
+
noError = true;
|
|
46
|
+
errorMessage: [];
|
|
47
|
+
constructor(
|
|
48
|
+
public segmentDynamicLoader: SegmentDynamicLoaderService,
|
|
49
|
+
@Inject(DOCUMENT) private readonly document: Document,
|
|
50
|
+
private readonly router: Router,
|
|
51
|
+
private readonly sidenavService: SidenavService,
|
|
52
|
+
public i18n: I18nService,
|
|
53
|
+
private readonly coreService: CoreService,
|
|
54
|
+
@Inject(PLATFORM_ID) private readonly platformId: any
|
|
55
|
+
) {
|
|
56
|
+
this.loading['form'] = true
|
|
57
|
+
this.coreService.loadForm().subscribe({
|
|
58
|
+
next: (form: any) => {
|
|
59
|
+
if (form instanceof Form) {
|
|
60
|
+
this.form = form;
|
|
61
|
+
} else {
|
|
62
|
+
this.noError = false;
|
|
63
|
+
}
|
|
64
|
+
this.loading['form'] = false;
|
|
65
|
+
},
|
|
66
|
+
error: (err) => {
|
|
67
|
+
this.noError = false;
|
|
68
|
+
this.loading['form'] = false;
|
|
69
|
+
this.errorMessage = err?.error?.meta?.messages;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
ngAfterViewInit() {
|
|
75
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
76
|
+
const direction = this.i18n.getLanguage() == 'en' ? 'ltr' : 'rtl';
|
|
77
|
+
document.documentElement.setAttribute('dir', direction);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"fileName": "اسم الملف",
|
|
3
|
+
"fileDescription": "وصف الملف",
|
|
4
|
+
"comment": "ملاحظات",
|
|
5
|
+
"reset": "إعادة تهيئة",
|
|
6
|
+
"businessPhone": "هاتف العمل",
|
|
7
|
+
"nationality": "الجنسية",
|
|
8
|
+
"generalDepartmentName": "الإدارة العامة",
|
|
9
|
+
"departmentName": "القسم",
|
|
10
|
+
"humanResourcesLocation": "شئون الموظفين",
|
|
11
|
+
"employeeEmail": "البريد الإلكتروني",
|
|
12
|
+
"generalDepartmentCode": "رمز الإدارة العامة",
|
|
13
|
+
"jobPosition": "الوظيفة",
|
|
14
|
+
"fullName": "الإسم",
|
|
15
|
+
"requestDetailsTitle": "تفاصيل الطلب",
|
|
16
|
+
<% const arStr = JSON.stringify(ar); -%>
|
|
17
|
+
<%- arStr.substring(1, arStr.length - 1) %>
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"fileName": "File Name",
|
|
3
|
+
"fileDescription": "File Description",
|
|
4
|
+
"comment":"Comments",
|
|
5
|
+
"reset": "Reset",
|
|
6
|
+
"departmentName": "Department",
|
|
7
|
+
"generalDepartmentName": "General Dep.Name",
|
|
8
|
+
"nationality": "Nationality",
|
|
9
|
+
"businessPhone": "Business Phone",
|
|
10
|
+
"fullName":"Full Name",
|
|
11
|
+
"jobPosition": "Job Position",
|
|
12
|
+
"generalDepartmentCode": "General Dep. Code",
|
|
13
|
+
"employeeEmail": "Email",
|
|
14
|
+
"humanResourcesLocation": "HR location",
|
|
15
|
+
"requestDetailsTitle":"Request Details",
|
|
16
|
+
<% const enStr = JSON.stringify(en); -%>
|
|
17
|
+
<%- enStr.substring(1, enStr.length - 1) %>
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<form
|
|
3
|
+
[ngClass]="{
|
|
4
|
+
'form-section-divide form-section': !section?.header?.readOnly,
|
|
5
|
+
'info-section': section?.header?.readOnly
|
|
6
|
+
}"
|
|
7
|
+
[formGroup]="formGroup"
|
|
8
|
+
>
|
|
9
|
+
<% fields.forEach((field) => { -%>
|
|
10
|
+
<% if(field.componentName === 'table'){ %>
|
|
11
|
+
<%- include('_html-table', {field: field}) %>
|
|
12
|
+
<% } else { %>
|
|
13
|
+
<%- include('_html-field', {item: field}) %>
|
|
14
|
+
<% } %>
|
|
15
|
+
<% }); -%>
|
|
16
|
+
</form>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
@if (!section?.header?.readOnly) {
|
|
20
|
+
<div class="mt-4">
|
|
21
|
+
<lib-action-buttons
|
|
22
|
+
[lovOptions]="lov?.['decision']?.options"
|
|
23
|
+
[lovType]="lov?.['decision']?.type"
|
|
24
|
+
[section]="section"
|
|
25
|
+
[form]="form"
|
|
26
|
+
[sections]="form.sections"
|
|
27
|
+
[showApprovalCycle]="true"
|
|
28
|
+
[customCall]="false"
|
|
29
|
+
[fieldsForm]="formGroup"
|
|
30
|
+
(resetFormEmit)="resetForm()"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
|
|
2
|
+
<% importsManager.addImport(['Component', 'inject', 'Input', 'OnInit', 'CUSTOM_ELEMENTS_SCHEMA'], '@angular/core') -%>
|
|
3
|
+
<% importsManager.addImport(['FormControl', 'FormBuilder', 'Validators'], '@angular/forms') -%>
|
|
4
|
+
<% importsManager.addImport('ReactiveFormsModule', '@angular/forms', true) -%>
|
|
5
|
+
<% importsManager.addImport(['Section', 'Form', 'ActionStateService'], 'bpm-core') -%>
|
|
6
|
+
<% importsManager.addImport('ActionButtonsComponent', 'bpm-core', true) -%>
|
|
7
|
+
<% importsManager.addImport('TranslatePipe', 'src/app/shared/pipes/translate.pipe', true) -%>
|
|
8
|
+
<% importsManager.addImport('NgClass', '@angular/common', true) -%>
|
|
9
|
+
|
|
10
|
+
<% for(const field of fields){ -%>
|
|
11
|
+
<% if(field.componentName === 'table'){ -%>
|
|
12
|
+
interface <%= changeCase.pascalCase(field.arrayName + 'Item') %> {
|
|
13
|
+
<% for(const col of field.tableColumns){ -%>
|
|
14
|
+
<%= col.fieldName %>: <%= getFieldType(col) %>;
|
|
15
|
+
<% } -%>
|
|
16
|
+
}
|
|
17
|
+
<% } -%>
|
|
18
|
+
<% } -%>
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'app-<%= componentNameKebab %>',
|
|
22
|
+
templateUrl: './<%= componentNameKebab %>.component.html',
|
|
23
|
+
standalone: true,
|
|
24
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
25
|
+
imports: []
|
|
26
|
+
})
|
|
27
|
+
export class <%= componentNamePascal %>Component implements OnInit {
|
|
28
|
+
@Input() isReadOnly: boolean;
|
|
29
|
+
@Input() section: Section;
|
|
30
|
+
@Input() form: Form;
|
|
31
|
+
@Input() lov: any;
|
|
32
|
+
formGroup: ReturnType<typeof this.createForm>;
|
|
33
|
+
private fb = inject(FormBuilder);
|
|
34
|
+
private actionStateService = inject(ActionStateService);
|
|
35
|
+
|
|
36
|
+
ngOnInit(){
|
|
37
|
+
this.formGroup = this.createForm();
|
|
38
|
+
this.setFormValuesUsingSectionDetails();
|
|
39
|
+
if(!this.isReadOnly){
|
|
40
|
+
this.subscribeFormChanges();
|
|
41
|
+
this.formGroup.updateValueAndValidity();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
createForm() {
|
|
46
|
+
return this.fb.group({
|
|
47
|
+
<% for(const field of fields){ -%>
|
|
48
|
+
<% if(field.componentName === 'table'){ -%>
|
|
49
|
+
<%=field.arrayName%>: this.fb.array<ReturnType<typeof this.<%= changeCase.camelCase(`new ${field.arrayName} Item`) %>>>([]),
|
|
50
|
+
<% } else { -%>
|
|
51
|
+
<%- include('_ts-field', {field: field, defaultValue: undefined}) -%>
|
|
52
|
+
<% } -%>
|
|
53
|
+
<% } -%>
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
resetForm() {
|
|
58
|
+
this.actionStateService.resetAction$.next();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
<% for(const field of fields){ -%>
|
|
62
|
+
<% if(field.visibilityCheckCode){ -%>
|
|
63
|
+
get <%= changeCase.camelCase(`is ${field.fieldName || field.headerName} visible`) %>(): boolean {
|
|
64
|
+
return <%-field.visibilityCheckCode%>;
|
|
65
|
+
}
|
|
66
|
+
<% } -%>
|
|
67
|
+
<% } -%>
|
|
68
|
+
|
|
69
|
+
private subscribeFormChanges() {
|
|
70
|
+
this.formGroup.valueChanges.subscribe((value) => {
|
|
71
|
+
this.section.body.details = {
|
|
72
|
+
...this.section.body.details,
|
|
73
|
+
...this.formGroup.value,
|
|
74
|
+
};
|
|
75
|
+
<% if(fields.some(item => item.visibilityCheckCode)){ importsManager.addImport('updateValueAndValidity', 'bpm-core')-%>
|
|
76
|
+
updateValueAndValidity(this.formGroup);
|
|
77
|
+
<% } -%>
|
|
78
|
+
this.lov?.["decision"]?.options?.forEach((option) => {
|
|
79
|
+
let isActionValid = this.checkValidity(option.value);
|
|
80
|
+
this.actionStateService.setActionValid(option.value, isActionValid);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private checkValidity(action: string): boolean {
|
|
86
|
+
<% if(fields.some(item => item.fieldName === 'comment')){ -%>
|
|
87
|
+
switch (action) {
|
|
88
|
+
case "SENDBACK":
|
|
89
|
+
case "REJECT":
|
|
90
|
+
return !!this.formGroup.value?.comment;
|
|
91
|
+
default:
|
|
92
|
+
return this.formGroup.valid;
|
|
93
|
+
}
|
|
94
|
+
<% } else { -%>
|
|
95
|
+
return this.formGroup.valid;
|
|
96
|
+
<% } -%>
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private setFormValuesUsingSectionDetails(){
|
|
100
|
+
this.formGroup.patchValue(this.section.body.details);
|
|
101
|
+
<% for(const field of fields){ -%>
|
|
102
|
+
<% if(field.componentName === 'table'){ -%>
|
|
103
|
+
<% const tableArrConstName = changeCase.camelCase(field.arrayName); -%>
|
|
104
|
+
<% const typeName = changeCase.pascalCase(field.arrayName + 'Item'); -%>
|
|
105
|
+
<% const addNewItemMethodName = changeCase.camelCase(`new ${field.arrayName} Item`); -%>
|
|
106
|
+
const <%= tableArrConstName %>: <%=typeName%>[] = this.section.body.details?.<%= field.arrayName %>;
|
|
107
|
+
if(<%= tableArrConstName %>?.length){
|
|
108
|
+
<%= tableArrConstName %>.forEach(item => {
|
|
109
|
+
this.formGroup.controls.<%= field.arrayName %>.push(this.<%=addNewItemMethodName%>(item))
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
<% } -%>
|
|
113
|
+
<% } -%>
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
<% for(const field of fields){ -%>
|
|
117
|
+
<% if(field.componentName === 'table'){ -%>
|
|
118
|
+
private <%= changeCase.camelCase(`new ${field.arrayName} Item`) %>(item?: <%= changeCase.pascalCase(field.arrayName + 'Item') %>) {
|
|
119
|
+
return this.fb.group({
|
|
120
|
+
<% for(const col of field.tableColumns){ -%>
|
|
121
|
+
<%- include('_ts-field', {field: col, defaultValue: `item?.${col.fieldName}`}) -%>
|
|
122
|
+
<% } -%>
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
<% } -%>
|
|
126
|
+
<% } -%>
|
|
127
|
+
|
|
128
|
+
}
|