fix: made user room number a string for added flexibility
This commit is contained in:
@@ -23,7 +23,7 @@ export class UserEditComponent {
|
|||||||
admin: 0
|
admin: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.groups = data.groups
|
this.groups = data.groups ? data.groups : []
|
||||||
var flags: Array<number> = []
|
var flags: Array<number> = []
|
||||||
if (data.user.admin) {
|
if (data.user.admin) {
|
||||||
if ((data.user.admin & 1) == 1) flags.push(1)
|
if ((data.user.admin & 1) == 1) flags.push(1)
|
||||||
@@ -45,13 +45,11 @@ export class UserEditComponent {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected editUser() {
|
protected editUser() {
|
||||||
console.log(this.form.value);
|
|
||||||
|
|
||||||
this.dialogRef.close({
|
this.dialogRef.close({
|
||||||
fname: this.form.get('fname')?.value,
|
fname: this.form.get('fname')?.value,
|
||||||
surname: this.form.get('surname')?.value,
|
surname: this.form.get('surname')?.value,
|
||||||
room: this.form.get('room')?.value.length == 0 ? undefined : this.form.get('room')?.value,
|
room: this.form.get('room')?.value,
|
||||||
uname: this.form.get('uname')?.value,
|
uname: this.form.get('uname')?.value,
|
||||||
groups: this.form.get('groups')?.value,
|
groups: this.form.get('groups')?.value,
|
||||||
flags: (() => {
|
flags: (() => {
|
||||||
|
|||||||
@@ -218,10 +218,10 @@ export class AdminCommService {
|
|||||||
//#region Clean
|
//#region Clean
|
||||||
clean = {
|
clean = {
|
||||||
getConfig: () => {
|
getConfig: () => {
|
||||||
return this.http.get<{rooms: number[], things: string[]}>(environment.apiEndpoint+`/admin/clean/config`, {withCredentials: true})
|
return this.http.get<{rooms: string[], things: string[]}>(environment.apiEndpoint+`/admin/clean/config`, {withCredentials: true})
|
||||||
},
|
},
|
||||||
getClean: (date: moment.Moment, room: number) => {
|
getClean: (date: moment.Moment, room: string) => {
|
||||||
return this.http.get<{_id: string, date: string, grade: number, gradeDate: string, notes: {label: string, weight: number}[], room: number, tips: string} | null>(environment.apiEndpoint+`/admin/clean/${date.toISOString()}/${room}`, {withCredentials: true})
|
return this.http.get<{_id: string, date: string, grade: number, gradeDate: string, notes: {label: string, weight: number}[], room: string, tips: string} | null>(environment.apiEndpoint+`/admin/clean/${date.toISOString()}/${room}`, {withCredentials: true})
|
||||||
},
|
},
|
||||||
postClean: (obj: Object) => {
|
postClean: (obj: Object) => {
|
||||||
return this.http.post<Status>(environment.apiEndpoint+`/admin/clean/`, obj, {withCredentials: true})
|
return this.http.post<Status>(environment.apiEndpoint+`/admin/clean/`, obj, {withCredentials: true})
|
||||||
@@ -231,7 +231,7 @@ export class AdminCommService {
|
|||||||
},
|
},
|
||||||
summary: {
|
summary: {
|
||||||
getSummary: (start: moment.Moment, end: moment.Moment) => {
|
getSummary: (start: moment.Moment, end: moment.Moment) => {
|
||||||
return this.http.get<{room: number, avg: number}[]>(environment.apiEndpoint+`/admin/clean/summary/${start.toISOString()}/${end.toISOString()}`, {withCredentials: true})
|
return this.http.get<{room: string, avg: number}[]>(environment.apiEndpoint+`/admin/clean/summary/${start.toISOString()}/${end.toISOString()}`, {withCredentials: true})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
attendence: {
|
attendence: {
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import { AttendenceComponent } from './attendence/attendence.component';
|
|||||||
styleUrl: './grades.component.scss'
|
styleUrl: './grades.component.scss'
|
||||||
})
|
})
|
||||||
export class GradesComponent implements OnInit, OnDestroy {
|
export class GradesComponent implements OnInit, OnDestroy {
|
||||||
rooms!: number[]
|
rooms!: string[]
|
||||||
room: number = 0;
|
room: string = "0";
|
||||||
date: moment.Moment;
|
date: moment.Moment;
|
||||||
grade: number = 6
|
grade: number = 6
|
||||||
gradeDate?: moment.Moment;
|
gradeDate?: moment.Moment;
|
||||||
@@ -158,7 +158,7 @@ export class GradesComponent implements OnInit, OnDestroy {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
roomNumber(value: number) {
|
roomNumber(value: string) {
|
||||||
this.room = value
|
this.room = value
|
||||||
this.downloadData()
|
this.downloadData()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { MatSort } from '@angular/material/sort';
|
|||||||
})
|
})
|
||||||
export class SummaryComponent implements OnInit, OnDestroy {
|
export class SummaryComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
data: MatTableDataSource<{room: number, avg: number}> = new MatTableDataSource<{room: number, avg: number}>();
|
data: MatTableDataSource<{room: string, avg: number}> = new MatTableDataSource<{room: string, avg: number}>();
|
||||||
collumns = ['room', 'avg']
|
collumns = ['room', 'avg']
|
||||||
|
|
||||||
dateSelector = this.fb.group({
|
dateSelector = this.fb.group({
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<mat-radio-button value="room">
|
<mat-radio-button value="room">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Pokój</mat-label>
|
<mat-label>Pokój</mat-label>
|
||||||
<input matInput type="number" formControlName="room">
|
<input matInput type="text" formControlName="room">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-radio-button>
|
</mat-radio-button>
|
||||||
<mat-radio-button value="group" *ngIf="ls.capCheck(8)">
|
<mat-radio-button value="group" *ngIf="ls.capCheck(8)">
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export class NotificationsComponent implements OnInit {
|
|||||||
form = new FormGroup<NotificationForm>({
|
form = new FormGroup<NotificationForm>({
|
||||||
recp: new FormGroup({
|
recp: new FormGroup({
|
||||||
uname: new FormControl<string>(''),
|
uname: new FormControl<string>(''),
|
||||||
room: new FormControl<number|null>(null),
|
room: new FormControl<string|null>(null),
|
||||||
group: new FormControl<string>(''),
|
group: new FormControl<string>(''),
|
||||||
type: new FormControl<"all" | "room" | "uname" | "group">('uname', {nonNullable: true})
|
type: new FormControl<"all" | "room" | "uname" | "group">('uname', {nonNullable: true})
|
||||||
}),
|
}),
|
||||||
@@ -47,7 +47,7 @@ interface NotificationForm {
|
|||||||
title: FormControl<string>;
|
title: FormControl<string>;
|
||||||
recp: FormGroup<{
|
recp: FormGroup<{
|
||||||
uname: FormControl<string | null>;
|
uname: FormControl<string | null>;
|
||||||
room: FormControl<number | null>;
|
room: FormControl<string | null>;
|
||||||
group: FormControl<string | null>;
|
group: FormControl<string | null>;
|
||||||
type: FormControl<"all" | "room" | "uname" | "group">;
|
type: FormControl<"all" | "room" | "uname" | "group">;
|
||||||
}>
|
}>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export class SettingsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveRoom(event: string[]) {
|
saveRoom(event: string[]) {
|
||||||
this.usettings.rooms = event.map(Number)
|
this.usettings.rooms = event
|
||||||
this.send()
|
this.send()
|
||||||
}
|
}
|
||||||
saveCleanThings(event: string[]) {
|
saveCleanThings(event: string[]) {
|
||||||
@@ -61,6 +61,6 @@ export class SettingsComponent implements OnInit {
|
|||||||
|
|
||||||
export interface IUSettings {
|
export interface IUSettings {
|
||||||
keyrooms: string[];
|
keyrooms: string[];
|
||||||
rooms: number[];
|
rooms: string[];
|
||||||
cleanThings: string[];
|
cleanThings: string[];
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from
|
|||||||
styleUrl: './room-chooser.component.scss'
|
styleUrl: './room-chooser.component.scss'
|
||||||
})
|
})
|
||||||
export class RoomChooserComponent implements OnChanges {
|
export class RoomChooserComponent implements OnChanges {
|
||||||
@Input() rooms: number[] = []
|
@Input() rooms: string[] = []
|
||||||
private _roomIndex: number = 0;
|
private _roomIndex: number = 0;
|
||||||
public get roomIndex(): number {
|
public get roomIndex(): number {
|
||||||
return this._roomIndex;
|
return this._roomIndex;
|
||||||
@@ -17,15 +17,15 @@ export class RoomChooserComponent implements OnChanges {
|
|||||||
}
|
}
|
||||||
this._roomIndex = value;
|
this._roomIndex = value;
|
||||||
}
|
}
|
||||||
private _room: number = this.rooms[this.roomIndex];
|
private _room: string = this.rooms[this.roomIndex];
|
||||||
protected get room_1(): number {
|
protected get room_1() {
|
||||||
return this._room;
|
return this._room;
|
||||||
}
|
}
|
||||||
protected set room_1(value: number) {
|
protected set room_1(value) {
|
||||||
this.room.emit(value)
|
this.room.emit(value)
|
||||||
this._room = value;
|
this._room = value;
|
||||||
}
|
}
|
||||||
@Output() room: EventEmitter<number> = new EventEmitter<number>();
|
@Output() room: EventEmitter<string> = new EventEmitter<string>();
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (changes["rooms"] && this.rooms) {
|
if (changes["rooms"] && this.rooms) {
|
||||||
|
|||||||
@@ -37,11 +37,7 @@ export class AuthClient {
|
|||||||
this.ls.capFlag = data.features
|
this.ls.capFlag = data.features
|
||||||
document.location.reload()
|
document.location.reload()
|
||||||
}
|
}
|
||||||
if (data.room) {
|
this.ls.room = data.room
|
||||||
this.ls.room = data.room
|
|
||||||
} else {
|
|
||||||
this.ls.room = undefined
|
|
||||||
}
|
|
||||||
if (data.menu.defaultItems) {
|
if (data.menu.defaultItems) {
|
||||||
this.ls.defaultItems = data.menu.defaultItems
|
this.ls.defaultItems = data.menu.defaultItems
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,19 +20,20 @@ export class LocalStorageService {
|
|||||||
public hasRoom() {
|
public hasRoom() {
|
||||||
if (localStorage.getItem('room')) {
|
if (localStorage.getItem('room')) {
|
||||||
return true
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get room() {
|
get room() {
|
||||||
return Number.parseInt(localStorage.getItem('room')!)
|
return localStorage.getItem('room')!
|
||||||
}
|
}
|
||||||
|
|
||||||
set room(value: number | undefined) {
|
set room(value: string) {
|
||||||
if (value == undefined) {
|
if (value == "") {
|
||||||
localStorage.removeItem('room')
|
localStorage.removeItem('room')
|
||||||
} else {
|
} else {
|
||||||
localStorage.setItem('room', value.toString())
|
localStorage.setItem('room', value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ interface UKey {
|
|||||||
|
|
||||||
interface AKey {
|
interface AKey {
|
||||||
room: string;
|
room: string;
|
||||||
whom?: {_id: string, uname: string, room: number};
|
whom?: {_id: string, uname: string, room: string};
|
||||||
borrow?: moment.Moment;
|
borrow?: moment.Moment;
|
||||||
tb?: moment.Moment;
|
tb?: moment.Moment;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ export interface Notification {
|
|||||||
title: string;
|
title: string;
|
||||||
recp: {
|
recp: {
|
||||||
uname: string | null;
|
uname: string | null;
|
||||||
room: number | null;
|
room: string | null;
|
||||||
type: "all" | "room" | "uname"
|
type: "all" | "room" | "uname"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user