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