cyc-base 0.0.2 → 1.0.1

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.
Files changed (31) hide show
  1. package/.editorconfig +17 -0
  2. package/.vscode/extensions.json +4 -0
  3. package/.vscode/launch.json +20 -0
  4. package/.vscode/tasks.json +42 -0
  5. package/README.md +4 -0
  6. package/angular.json +36 -0
  7. package/package.json +44 -16
  8. package/projects/cyc-base/README.md +26 -0
  9. package/projects/cyc-base/ng-package.json +7 -0
  10. package/projects/cyc-base/package.json +12 -0
  11. package/projects/cyc-base/src/classes/BasePage.ts +82 -0
  12. package/projects/cyc-base/src/classes/CommonPage.ts +211 -0
  13. package/projects/cyc-base/src/classes/ExtendedCommonPage.ts +125 -0
  14. package/projects/cyc-base/src/classes/FirebasePage.ts +66 -0
  15. package/projects/cyc-base/src/classes/SecurePage.ts +229 -0
  16. package/projects/cyc-base/src/components/mat-nav-bar/mat-nav-bar.component.html +21 -0
  17. package/projects/cyc-base/src/components/mat-nav-bar/mat-nav-bar.component.scss +5 -0
  18. package/projects/cyc-base/src/components/mat-nav-bar/mat-nav-bar.component.spec.ts +22 -0
  19. package/projects/cyc-base/src/components/mat-nav-bar/mat-nav-bar.component.ts +47 -0
  20. package/projects/cyc-base/src/lib/cyc-base.spec.ts +23 -0
  21. package/projects/cyc-base/src/lib/cyc-base.ts +15 -0
  22. package/projects/cyc-base/src/lib/shared-db.spec.ts +16 -0
  23. package/projects/cyc-base/src/lib/shared-db.ts +182 -0
  24. package/projects/cyc-base/src/public-api.ts +18 -0
  25. package/projects/cyc-base/tsconfig.lib.json +18 -0
  26. package/projects/cyc-base/tsconfig.lib.prod.json +11 -0
  27. package/projects/cyc-base/tsconfig.spec.json +15 -0
  28. package/tsconfig.json +39 -0
  29. package/fesm2022/cyc-base.mjs +0 -730
  30. package/fesm2022/cyc-base.mjs.map +0 -1
  31. package/index.d.ts +0 -333
package/.editorconfig ADDED
@@ -0,0 +1,17 @@
1
+ # Editor configuration, see https://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ indent_style = space
7
+ indent_size = 2
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.ts]
12
+ quote_type = single
13
+ ij_typescript_use_double_quotes = false
14
+
15
+ [*.md]
16
+ max_line_length = off
17
+ trim_trailing_whitespace = false
@@ -0,0 +1,4 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3
+ "recommendations": ["angular.ng-template"]
4
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3
+ "version": "0.2.0",
4
+ "configurations": [
5
+ {
6
+ "name": "ng serve",
7
+ "type": "chrome",
8
+ "request": "launch",
9
+ "preLaunchTask": "npm: start",
10
+ "url": "http://localhost:4200/"
11
+ },
12
+ {
13
+ "name": "ng test",
14
+ "type": "chrome",
15
+ "request": "launch",
16
+ "preLaunchTask": "npm: test",
17
+ "url": "http://localhost:9876/debug.html"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3
+ "version": "2.0.0",
4
+ "tasks": [
5
+ {
6
+ "type": "npm",
7
+ "script": "start",
8
+ "isBackground": true,
9
+ "problemMatcher": {
10
+ "owner": "typescript",
11
+ "pattern": "$tsc",
12
+ "background": {
13
+ "activeOnStart": true,
14
+ "beginsPattern": {
15
+ "regexp": "(.*?)"
16
+ },
17
+ "endsPattern": {
18
+ "regexp": "bundle generation complete"
19
+ }
20
+ }
21
+ }
22
+ },
23
+ {
24
+ "type": "npm",
25
+ "script": "test",
26
+ "isBackground": true,
27
+ "problemMatcher": {
28
+ "owner": "typescript",
29
+ "pattern": "$tsc",
30
+ "background": {
31
+ "activeOnStart": true,
32
+ "beginsPattern": {
33
+ "regexp": "(.*?)"
34
+ },
35
+ "endsPattern": {
36
+ "regexp": "bundle generation complete"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ]
42
+ }
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ # CYC Base Library
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.2.0.
4
+
1
5
  ## Building
2
6
 
3
7
  To build the library, run:
package/angular.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+ "version": 1,
4
+ "cli": {
5
+ "packageManager": "yarn"
6
+ },
7
+ "newProjectRoot": "projects",
8
+ "projects": {
9
+ "cyc-base": {
10
+ "projectType": "library",
11
+ "root": "projects/cyc-base",
12
+ "sourceRoot": "projects/cyc-base/src",
13
+ "prefix": "lib",
14
+ "architect": {
15
+ "build": {
16
+ "builder": "@angular/build:ng-packagr",
17
+ "configurations": {
18
+ "production": {
19
+ "tsConfig": "projects/cyc-base/tsconfig.lib.prod.json"
20
+ },
21
+ "development": {
22
+ "tsConfig": "projects/cyc-base/tsconfig.lib.json"
23
+ }
24
+ },
25
+ "defaultConfiguration": "production"
26
+ },
27
+ "test": {
28
+ "builder": "@angular/build:karma",
29
+ "options": {
30
+ "tsConfig": "projects/cyc-base/tsconfig.spec.json"
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
package/package.json CHANGED
@@ -1,23 +1,51 @@
1
1
  {
2
2
  "name": "cyc-base",
3
- "version": "0.0.2",
4
- "peerDependencies": {
5
- "@angular/common": "^20.3.0",
6
- "@angular/core": "^20.3.0"
3
+ "version": "1.0.1",
4
+ "scripts": {
5
+ "ng": "ng",
6
+ "start": "ng serve",
7
+ "build": "ng build",
8
+ "watch": "ng build --watch --configuration development",
9
+ "test": "ng test"
10
+ },
11
+ "prettier": {
12
+ "printWidth": 100,
13
+ "singleQuote": true,
14
+ "overrides": [
15
+ {
16
+ "files": "*.html",
17
+ "options": {
18
+ "parser": "angular"
19
+ }
20
+ }
21
+ ]
7
22
  },
8
23
  "dependencies": {
24
+ "@angular/cdk": "20.2.14",
25
+ "@angular/common": "^20.2.0",
26
+ "@angular/compiler": "^20.2.0",
27
+ "@angular/core": "^20.2.0",
28
+ "@angular/forms": "^20.2.0",
29
+ "@angular/material": "20.2.14",
30
+ "@angular/platform-browser": "^20.2.0",
31
+ "@angular/router": "^20.2.0",
32
+ "cyc-type-def": "^5.1.1",
33
+ "firebase": "^12.7.0",
34
+ "rxjs": "~7.8.0",
9
35
  "tslib": "^2.3.0"
10
36
  },
11
- "sideEffects": false,
12
- "module": "fesm2022/cyc-base.mjs",
13
- "typings": "index.d.ts",
14
- "exports": {
15
- "./package.json": {
16
- "default": "./package.json"
17
- },
18
- ".": {
19
- "types": "./index.d.ts",
20
- "default": "./fesm2022/cyc-base.mjs"
21
- }
37
+ "devDependencies": {
38
+ "@angular/build": "^20.3.14",
39
+ "@angular/cli": "^20.2.0",
40
+ "@angular/compiler-cli": "^20.2.0",
41
+ "@types/jasmine": "~5.1.0",
42
+ "jasmine-core": "~5.9.0",
43
+ "karma": "~6.4.0",
44
+ "karma-chrome-launcher": "~3.2.0",
45
+ "karma-coverage": "~2.2.0",
46
+ "karma-jasmine": "~5.1.0",
47
+ "karma-jasmine-html-reporter": "~2.1.0",
48
+ "ng-packagr": "^20.3.0",
49
+ "typescript": "~5.9.2"
22
50
  }
23
- }
51
+ }
@@ -0,0 +1,26 @@
1
+ ## Building
2
+
3
+ To build the library, run:
4
+
5
+ ```bash
6
+ ng build cyc-base
7
+ ```
8
+
9
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
10
+
11
+ ### Publishing the Library
12
+
13
+ Once the project is built, you can publish your library by following these steps:
14
+
15
+ 1. Navigate to the `dist` directory:
16
+
17
+ ```bash
18
+ cd dist/cyc-base
19
+ ```
20
+
21
+ 2. Run the `npm publish` command to publish your library to the npm registry:
22
+ ```bash
23
+ npm config set //registry.npmjs.org/:_authToken=YOUR_NPM_TOKEN
24
+ npm publish
25
+ npm config delete //registry.npmjs.org/:_authToken
26
+ ```
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/cyc-base",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "cyc-base",
3
+ "version": "0.0.2",
4
+ "peerDependencies": {
5
+ "@angular/common": "^20.3.0",
6
+ "@angular/core": "^20.3.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false
12
+ }
@@ -0,0 +1,82 @@
1
+ import { onValue, ref } from 'firebase/database';
2
+ import { onAuthStateChanged, User } from 'firebase/auth';
3
+ import { Router } from '@angular/router';
4
+ import { PERMISSION } from 'cyc-type-def';
5
+ import { SecurePage } from './SecurePage';
6
+
7
+ export class BasePage extends SecurePage {
8
+ t1!: Date;
9
+ t2!: Date;
10
+
11
+ constructor(router: Router, isSecure: boolean) {
12
+ super(router, isSecure);
13
+
14
+ this.isSecure = isSecure;
15
+ this.router = router;
16
+
17
+ this.load();
18
+ }
19
+
20
+ load() {
21
+ onAuthStateChanged(this.auth, (user) => {
22
+ this.readUser(user);
23
+ // this.loadUser(user);
24
+ });
25
+ }
26
+
27
+ readUser(user: User | null) {
28
+ this.firebaseUser = user;
29
+ if (user) {
30
+ // console.log(user.email);
31
+ const userRef = ref(this.db, 'move_follow_up_2023/users/' + user.uid);
32
+ onValue(userRef, (v) => {
33
+ if (v.exists()) {
34
+ this.user = v.val();
35
+ // console.log(this.user.name);
36
+
37
+ if (
38
+ this.user.permission == PERMISSION.NOT_VERIFIED &&
39
+ this.isSecure
40
+ ) {
41
+ // not verified user
42
+ // redirect to home page
43
+ this.router.navigate(['']);
44
+ // this.router.navigate(['']);
45
+ }
46
+
47
+ // if (this.user.permissions) {
48
+ // this.isSuperUser = this.user.permissions.includes(
49
+ // PERMISSION.SUPER_USER
50
+ // );
51
+ // }
52
+
53
+ this.checkPermission(this.user);
54
+ this.readData();
55
+
56
+ this.initSettings(this.user);
57
+ } else {
58
+ // user logged in but no data
59
+ // redirect to home page (how he came to here?)
60
+ if (this.isSecure) this.router.navigate(['']);
61
+ // this.router.navigate(['']);
62
+ this.readData();
63
+ }
64
+ });
65
+ } else {
66
+ // user not logged in
67
+ // redirect to home page
68
+ if (this.isSecure) this.router.navigate(['']);
69
+ // this.router.navigate(['']);
70
+ this.readData();
71
+ }
72
+ }
73
+
74
+ timerStart() {
75
+ this.t1 = new Date();
76
+ }
77
+
78
+ timerEnd() {
79
+ this.t2 = new Date();
80
+ console.log(this.t2.getTime() - this.t1.getTime());
81
+ }
82
+ }
@@ -0,0 +1,211 @@
1
+ import { Cluster, SmallTeam, CG, AppUser, PERMISSION, compareCG } from 'cyc-type-def';
2
+ import { Observable, Subscription } from 'rxjs';
3
+ // import { AppData } from '../../app/services/shared-db.service';
4
+ // import { compareCG } from '../util/sort.util';
5
+ import { User } from 'firebase/auth';
6
+ import { AppData } from '../lib/shared-db';
7
+ // import { SettingDefaults, Settings } from '../constants/settings.constant';
8
+ // import { environment } from '../../environments/environment';
9
+
10
+ /**
11
+ * Holds only the common data stored in `SharedDbService`,
12
+ * - Pastoral team
13
+ * - User
14
+ *
15
+ * ---
16
+ * For other frequently used variables (not stored in `SharedDbService`), see `ExtendedCommonPage`.
17
+ *
18
+ * **Provides:**
19
+ * `Cluster`, `SmallTeam`, `CG`, `AppUser`, `User`
20
+ */
21
+ export class CommonPage {
22
+ protected subscription?: Subscription;
23
+ protected subscriptionAuth?: Subscription;
24
+
25
+ user!: AppUser;
26
+ firebaseUser!: User | null;
27
+
28
+ /** deleted record included */
29
+ arrClusterForRef: { [key: string]: Cluster };
30
+ /** deleted record included */
31
+ arrStForRef: { [key: string]: SmallTeam };
32
+ /** deleted record included */
33
+ arrCgForRef: { [key: string]: CG };
34
+
35
+ /** array of clusters, excluding deleted records */
36
+ arrCluster: Cluster[];
37
+ /** array of small teams, excluding deleted records */
38
+ arrSt: SmallTeam[];
39
+ /** array of CGs, excluding deleted records */
40
+ arrCg: CG[];
41
+
42
+ constructor() {
43
+ this.arrClusterForRef = {};
44
+ this.arrStForRef = {};
45
+ this.arrCgForRef = {};
46
+
47
+ this.arrCluster = [];
48
+ this.arrSt = [];
49
+ this.arrCg = [];
50
+ }
51
+
52
+ /**
53
+ * subscribe to clusters, small teams, CGs observable
54
+ * @param observerble
55
+ */
56
+ subscribeObserverble(observerble: Observable<AppData>) {
57
+ this.subscription = observerble.subscribe((snapshot) => {
58
+ this.arrClusterForRef = snapshot.arrClusterForRef || {};
59
+ this.arrCluster = Object.values(this.arrClusterForRef).filter((x) => !x.deleted);
60
+
61
+ this.arrStForRef = snapshot.arrStForRef || {};
62
+ this.arrSt = Object.values(this.arrStForRef).filter((x) => !x.deleted);
63
+
64
+ this.arrCgForRef = snapshot.arrCgForRef || {};
65
+ this.arrCg = Object.values(this.arrCgForRef).filter((x) => !x.deleted);
66
+
67
+ // this.firebaseUser = snapshot.firebaseUser || null;
68
+ // if (snapshot.user) this.user = snapshot.user;
69
+
70
+ // this.checkAccessAndLoadData();
71
+ });
72
+ }
73
+
74
+ subscribeAuthObserverble(
75
+ observerble: Observable<{ user: AppUser; firebaseUser: User } | undefined>
76
+ ) {
77
+ this.subscriptionAuth = observerble.subscribe((v) => {
78
+ // console.log(v);
79
+ // console.log('subscriptionAuth');
80
+
81
+ if (v) {
82
+ this.firebaseUser = v.firebaseUser;
83
+ this.user = v.user;
84
+
85
+ // if (!environment.production) {
86
+ // console.log(this.user.id);
87
+ // }
88
+
89
+ // init setting if not exist
90
+ this.initSettings(this.user);
91
+ } else {
92
+ }
93
+
94
+ this.checkAccessAndLoadData();
95
+ });
96
+ }
97
+
98
+ /**
99
+ * unsubscribe all observables
100
+ */
101
+ unSubscribeObserverble(): void {
102
+ this.subscription?.unsubscribe();
103
+ this.subscriptionAuth?.unsubscribe();
104
+ }
105
+
106
+ /** get array of clusters, including deleted records */
107
+ get arrClusterWithDel() {
108
+ return Object.values(this.arrClusterForRef);
109
+ }
110
+
111
+ /** get array of small team, including deleted records */
112
+ get arrStWithDel() {
113
+ return Object.values(this.arrStForRef);
114
+ }
115
+
116
+ /** get array of CGs, including deleted records */
117
+ get arrCgWithDel() {
118
+ return Object.values(this.arrCgForRef);
119
+ }
120
+
121
+ /**
122
+ * Returns small teams under a specified cluster.
123
+ *
124
+ * Optionally filters based on user access permissions.
125
+ *
126
+ * By default, not including deleted small teams.
127
+ *
128
+ * @param idCluster - The cluster ID to filter small teams by.
129
+ * @param byUserAccess - If true, applies user permission-based filtering. Defaults to false.
130
+ * @returns An array of filtered small teams.
131
+ */
132
+ filteredSmallTeam(idCluster: string | undefined, byUserAccess: boolean = false) {
133
+ if (!byUserAccess) {
134
+ return this.arrSt.filter((x) => x.cluster == idCluster);
135
+ } else {
136
+ if (this.user.permissions) {
137
+ if (
138
+ this.user.permissions.includes(PERMISSION.SUPER_USER) ||
139
+ this.user.permissions.includes(PERMISSION.PASTORAL_ADMIN)
140
+ ) {
141
+ return this.arrSt.filter((x) => x.cluster == idCluster);
142
+ } else if (
143
+ this.user.permissions.includes(PERMISSION.TL) ||
144
+ this.user.permissions.includes(PERMISSION.SCGL) ||
145
+ this.user.permissions.includes(PERMISSION.CGL)
146
+ ) {
147
+ return (this.arrSt = this.arrSt.filter((x) => x.id == this.user.pastoral_team?.st));
148
+ }
149
+ }
150
+
151
+ return [];
152
+ }
153
+ }
154
+
155
+ filteredSmallTeamWithDel(idCluster: string) {
156
+ return this.arrStWithDel.filter((x) => x.cluster == idCluster);
157
+ }
158
+
159
+ /**
160
+ * by default, not including deleted CG
161
+ * @param idCluster
162
+ * @returns array of CG under selected cluster and small team
163
+ */
164
+ filteredCg(idSt: string | undefined) {
165
+ return this.arrCg.filter((x) => x.st == idSt).sort(compareCG);
166
+ }
167
+
168
+ filteredCgWithDel(idSt: string) {
169
+ return this.arrCgWithDel.filter((x) => x.st == idSt);
170
+ }
171
+
172
+ /**
173
+ * Returns the list of clusters accessible to the current user based on their permissions.
174
+ *
175
+ * @returns {Cluster[]} Filtered cluster list according to user role.
176
+ */
177
+ get arrClusterByUserAccess() {
178
+ if (this.user.permissions) {
179
+ if (
180
+ this.user.permissions.includes(PERMISSION.SUPER_USER) ||
181
+ this.user.permissions.includes(PERMISSION.PASTORAL_ADMIN)
182
+ ) {
183
+ return this.arrCluster;
184
+ } else if (
185
+ this.user.permissions.includes(PERMISSION.TL) ||
186
+ this.user.permissions.includes(PERMISSION.SCGL) ||
187
+ this.user.permissions.includes(PERMISSION.CGL)
188
+ ) {
189
+ return this.arrCluster.filter((x) => x.id == this.user.pastoral_team?.cluster);
190
+ }
191
+ }
192
+
193
+ return [];
194
+ }
195
+
196
+ /**
197
+ * init setting if not exist
198
+ * @param user
199
+ */
200
+ initSettings(user: AppUser) {}
201
+ // initSettings(user: AppUser) {
202
+ // if (!user.settings) user.settings = {};
203
+ // for (let s of Object.values(Settings)) {
204
+ // if (user.settings?.[s] === undefined) {
205
+ // user.settings[s] = SettingDefaults[s];
206
+ // }
207
+ // }
208
+ // }
209
+
210
+ checkAccessAndLoadData() {}
211
+ }
@@ -0,0 +1,125 @@
1
+ import {
2
+ AppUser,
3
+ Attendance,
4
+ CG,
5
+ Cluster,
6
+ MsjClassBatch,
7
+ MsjClassTime,
8
+ MsjClassType,
9
+ MsjStudBatch,
10
+ PERMISSION,
11
+ Sheep,
12
+ SmallTeam,
13
+ Title,
14
+ } from 'cyc-type-def';
15
+ import { CommonPage } from './CommonPage';
16
+
17
+ /**
18
+ * Holds additional frequently used variables **not** stored in `SharedDbService`,
19
+ * such as:
20
+ * - `Sheep`
21
+ * - `Title`
22
+ *
23
+ * ---
24
+ * **For data stored in `SharedDbService`**
25
+ * (pastoral team and user), see `CommonPage`.
26
+ *
27
+ * ---
28
+ * @extends ExtendedCommonPage
29
+ */
30
+ export class ExtendedCommonPage extends CommonPage {
31
+ // title
32
+ arrTitleForRef: { [key: string]: Title } = {};
33
+ arrTitle: Title[] = [];
34
+
35
+ // sheep
36
+ arrSheepForRef: { [key: string]: Sheep } = {};
37
+ arrSheep: Sheep[] = [];
38
+
39
+ // user
40
+ arrUserForRef: { [key: string]: AppUser } = {};
41
+ arrUser: AppUser[] = [];
42
+
43
+ // attendance
44
+ arrAttendance: Attendance[] = [];
45
+
46
+ // msj
47
+ arrMsjClassTypeForRef: { [key: string]: MsjClassType } = {};
48
+ arrMsjClassBatchForRef: { [key: string]: MsjClassBatch } = {};
49
+ arrMsjClassTimeForRef: { [key: string]: MsjClassTime } = {};
50
+ arrMsjStudBatch: MsjStudBatch[] = [];
51
+
52
+ // selection
53
+ cluster: Cluster | undefined;
54
+ st: SmallTeam | undefined;
55
+ cg: CG | undefined;
56
+ sheep: Sheep | undefined;
57
+ title: Title | undefined;
58
+ msjClassType: MsjClassType | undefined;
59
+ msjClassBatch: MsjClassBatch | undefined;
60
+ msjClassTime: MsjClassTime | undefined;
61
+
62
+ loading = false;
63
+
64
+ constructor() {
65
+ super();
66
+ }
67
+
68
+ get arrTitleReserve() {
69
+ return this.arrTitle.slice().reverse();
70
+ }
71
+
72
+ get arrMsjClassType() {
73
+ return Object.values(this.arrMsjClassTypeForRef).filter((x) => !x.deleted);
74
+ }
75
+
76
+ get arrMsjClassBatch() {
77
+ return Object.values(this.arrMsjClassBatchForRef).filter((x) => !x.deleted);
78
+ }
79
+
80
+ get arrMsjClassTime() {
81
+ return Object.values(this.arrMsjClassTimeForRef).filter((x) => !x.deleted);
82
+ }
83
+
84
+ filteredMsjClassBatch(idMsjClassType: string) {
85
+ return this.arrMsjClassBatch
86
+ .filter((x) => x.idMsjClassType == idMsjClassType)
87
+ .sort((b: MsjClassBatch, a: MsjClassBatch) => {
88
+ a.dt = new Date(
89
+ new Date(a.yearTimestamp).getFullYear(),
90
+ new Date(a.monthTimestamp).getMonth()
91
+ );
92
+ b.dt = new Date(
93
+ new Date(b.yearTimestamp).getFullYear(),
94
+ new Date(b.monthTimestamp).getMonth()
95
+ );
96
+ if (a.dt.getFullYear() == b.dt.getFullYear()) {
97
+ return a.dt.getMonth() - b.dt.getMonth();
98
+ } else {
99
+ return a.dt.getFullYear() - b.dt.getFullYear();
100
+ }
101
+ });
102
+ }
103
+
104
+ filteredMsjClassTime(idMsjClassBatch: string) {
105
+ return this.arrMsjClassTime.filter(
106
+ (x) => x.idMsjClassBatch == idMsjClassBatch
107
+ );
108
+ }
109
+
110
+ get isSuperUser() {
111
+ if (this.user && this.user.permissions) {
112
+ return this.user.permissions.includes(PERMISSION.SUPER_USER);
113
+ } else {
114
+ return false;
115
+ }
116
+ }
117
+
118
+ get isPastoralAdmin() {
119
+ if (this.user && this.user.permissions) {
120
+ return this.user.permissions.includes(PERMISSION.PASTORAL_ADMIN);
121
+ } else {
122
+ return false;
123
+ }
124
+ }
125
+ }