diff --git a/angular.json b/angular.json
index 2ceac64..718930c 100644
--- a/angular.json
+++ b/angular.json
@@ -70,6 +70,30 @@
"with": "src/environments/environment.development.ts"
}
]
+ },
+ "swDevelopment": {
+ "buildOptimizer": false,
+ "optimization": false,
+ "vendorChunk": true,
+ "extractLicenses": false,
+ "sourceMap": true,
+ "namedChunks": true,
+ "outputHashing": "all",
+ "fileReplacements": [
+ {
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.swdev.ts"
+ }
+ ],
+ "assets": [
+ {
+ "glob": "ngsw-worker.js",
+ "input": "node_modules/@angular/servce-worker",
+ "output": "."
+ },
+ "src/ngsw.json",
+ "src/manifest.webmanifest"
+ ]
}
},
"defaultConfiguration": "production"
diff --git a/ngsw-config.json b/ngsw-config.json
index 07fb61d..f25973d 100644
--- a/ngsw-config.json
+++ b/ngsw-config.json
@@ -1,16 +1,16 @@
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
- "index": "./index.html",
+ "index": "/ipwa/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
- "/favicon.ico",
- "/manifest.webmanifest",
- "/*.css",
- "/*.js"
+ "/ipwa/favicon.ico",
+ "/ipwa/manifest.webmanifest",
+ "/ipwa/*.css",
+ "/ipwa/*.js"
]
}
},
@@ -20,8 +20,8 @@
"updateMode": "prefetch",
"resources": {
"files": [
- "./assets/**",
- "/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
+ "/ipwa/assets/**",
+ "/ipwa/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
]
}
}
diff --git a/package-lock.json b/package-lock.json
index fe0dadb..d59fc2c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "ipwa",
- "version": "1.0.1",
+ "version": "1.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
diff --git a/package.json b/package.json
index 47c1f11..04086e4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ipwa",
- "version": "1.0.1",
+ "version": "1.1.0",
"license": "GPL-3.0-or-later",
"scripts": {
"ng": "ng",
diff --git a/src/app/admin-view/account-mgmt/account-mgmt.component.html b/src/app/admin-view/account-mgmt/account-mgmt.component.html
index cba85bc..27dad79 100644
--- a/src/app/admin-view/account-mgmt/account-mgmt.component.html
+++ b/src/app/admin-view/account-mgmt/account-mgmt.component.html
@@ -3,7 +3,7 @@
Wyszukaj
-
+
@@ -24,17 +24,9 @@
| {{element.uname}} |
-
Akcje |
+
Karta użytkownika |
-
-
-
-
+
|
diff --git a/src/app/admin-view/account-mgmt/account-mgmt.component.ts b/src/app/admin-view/account-mgmt/account-mgmt.component.ts
index 8d6be8c..274e87a 100644
--- a/src/app/admin-view/account-mgmt/account-mgmt.component.ts
+++ b/src/app/admin-view/account-mgmt/account-mgmt.component.ts
@@ -4,10 +4,7 @@ import { MatDialog } from '@angular/material/dialog';
import { MatTableDataSource } from '@angular/material/table';
import { MatPaginator } from '@angular/material/paginator';
import { MatSnackBar } from '@angular/material/snack-bar';
-import { UserDeleteComponent } from './user-delete/user-delete.component';
import { UserEditComponent } from './user-edit/user-edit.component';
-import { catchError, throwError } from 'rxjs';
-import { UserResetComponent } from './user-reset/user-reset.component';
import { LocalStorageService } from 'src/app/services/local-storage.service';
import { Group } from 'src/app/types/group';
import User from 'src/app/types/user';
@@ -57,75 +54,9 @@ export class AccountMgmtComponent implements OnInit, AfterViewInit {
this.users.filter = value.toLowerCase().trim()
}
- edit(item: any) {
- this.dialog.open(UserEditComponent, {data: {user: item, groups: this.groups}}).afterClosed().subscribe(reply => {
- if (reply) {
- this.ac.accs.putAcc(item._id, reply).pipe(catchError((err)=>{
- this.sb.open("Wystąpił błąd. Skontaktuj się z obsługą programu.")
- return throwError(()=> new Error(err.message))
- })).subscribe((data)=> {
- if (data.status == 200) {
- this.sb.open("Użytkownik został zmodyfikowany.", undefined, {duration: 2500})
- this.ngOnInit()
- } else {
- this.sb.open("Wystąpił błąd. Skontaktuj się z obsługą programu.")
- }
- })
- }
- })
- }
-
- new() {
- this.dialog.open(UserEditComponent, {data: {groups: this.groups}}).afterClosed().subscribe(reply => {
- if (reply) {
- this.ac.accs.postAcc(reply).pipe(catchError((err)=>{
- this.sb.open("Wystąpił błąd. Skontaktuj się z obsługą programu.")
- return throwError(()=> new Error(err.message))
- })).subscribe((data)=> {
- if (data.status == 201) {
- this.sb.open("Użytkownik został utworzony.", undefined, {duration: 2500})
- this.ngOnInit()
- } else {
- this.sb.open("Wystąpił błąd. Skontaktuj się z obsługą programu.")
- }
- })
- }
- })
- }
-
- delete(id: string) {
- this.dialog.open(UserDeleteComponent).afterClosed().subscribe(reply => {
- if (reply) {
- this.ac.accs.deleteAcc(id).subscribe((res) => {
- if (res.status == 200) {
- this.sb.open("Użytkownik został usunięty.", undefined, {duration: 2500})
- this.ngOnInit()
- } else {
- this.sb.open("Wystąpił błąd. Skontaktuj się z obsługą programu.")
- console.error(res);
- }
- })
- }
- })
- }
-
- resetPass(id: string) {
- this.dialog.open(UserResetComponent).afterClosed().subscribe((res) => {
- if (res == true) {
- this.ac.accs.resetPass(id).subscribe((patch)=>{
- if (patch.status == 200) {
- this.sb.open("Hasło zostało zresetowane", undefined, {duration: 2500})
- }
- })
- }
- })
- }
-
- toggleLock(item: any) {
- this.ac.accs.putAcc(item._id, {locked: !item.locked}).subscribe((res) => {
- if (res.status == 200) {
- item.locked = !item.locked
- }
+ openUserCard(id?: string) {
+ this.dialog.open(UserEditComponent, {data: {id: id, type: id ? "edit" : "new", groups: this.groups}}).afterClosed().subscribe(r => {
+ if (r) this.ngOnInit()
})
}
diff --git a/src/app/admin-view/account-mgmt/user-edit/user-edit.component.html b/src/app/admin-view/account-mgmt/user-edit/user-edit.component.html
index 0d278b4..baad3aa 100644
--- a/src/app/admin-view/account-mgmt/user-edit/user-edit.component.html
+++ b/src/app/admin-view/account-mgmt/user-edit/user-edit.component.html
@@ -1,39 +1,67 @@
-