Fixed table add
This commit is contained in:
		| @@ -39,7 +39,6 @@ export class AuthUserComponent extends ComponentWithTable implements OnInit, OnD | ||||
|   ]; | ||||
|  | ||||
|   newUserTemplate: AuthUserDTO = { | ||||
|     id: 0, | ||||
|     firstName: "", | ||||
|     lastName: "", | ||||
|     email: "", | ||||
|   | ||||
| @@ -193,7 +193,6 @@ export class AchievementComponent extends ComponentWithTable implements OnInit, | ||||
|   } | ||||
|  | ||||
|   public newAchievementTemplate: Achievement = { | ||||
|     id: 0, | ||||
|     createdAt: "", | ||||
|     modifiedAt: "" | ||||
|   }; | ||||
| @@ -303,11 +302,8 @@ export class AchievementComponent extends ComponentWithTable implements OnInit, | ||||
|  | ||||
|   public addAchievement(table: Table): void { | ||||
|     const newAchievement = JSON.parse(JSON.stringify(this.newAchievementTemplate)); | ||||
|     newAchievement.id = this.achievements.length == 0 ? 1 : Math.max.apply(Math, this.achievements.map(l => { | ||||
|       return l.id ?? 0; | ||||
|     })) + 1; | ||||
|  | ||||
|     this.achievements.push(newAchievement); | ||||
|     this.achievements = [newAchievement, ...this.achievements]; | ||||
|  | ||||
|     table.initRowEdit(newAchievement); | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { Component, OnDestroy, OnInit, Query } from "@angular/core"; | ||||
| import { Component, OnDestroy, OnInit } from "@angular/core"; | ||||
| import { DataService } from "../../../../../../services/data/data.service"; | ||||
| import { ActivatedRoute, Router } from "@angular/router"; | ||||
| import { AutoRoleRule, AutoRoleRuleFilter } from "../../../../../../models/data/auto_role.model"; | ||||
| @@ -283,11 +283,8 @@ export class AutoRolesRulesComponent extends ComponentWithTable implements OnIni | ||||
|  | ||||
|   public addAutoRoleRule(table: Table): void { | ||||
|     const newAutoRole = JSON.parse(JSON.stringify(this.newAutoRoleTemplate)); | ||||
|     newAutoRole.id = this.rules.length == 0 ? 1 : Math.max.apply(Math, this.rules.map(u => { | ||||
|       return u.id ?? 0; | ||||
|     })) + 1; | ||||
|  | ||||
|     this.rules.push(newAutoRole); | ||||
|     this.rules = [newAutoRole, ...this.rules]; | ||||
|  | ||||
|     table.initRowEdit(newAutoRole); | ||||
|  | ||||
|   | ||||
| @@ -256,11 +256,8 @@ export class AutoRolesComponent extends ComponentWithTable implements OnInit, On | ||||
|  | ||||
|   public addAutoRole(table: Table): void { | ||||
|     const newAutoRole = JSON.parse(JSON.stringify(this.newAutoRoleTemplate)); | ||||
|     newAutoRole.id = this.auto_roles.length == 0 ? 1 : Math.max.apply(Math, this.auto_roles.map(u => { | ||||
|       return u.id ?? 0; | ||||
|     })) + 1; | ||||
|  | ||||
|     this.auto_roles.push(newAutoRole); | ||||
|     this.auto_roles = [newAutoRole, ...this.auto_roles]; | ||||
|  | ||||
|     table.initRowEdit(newAutoRole); | ||||
|  | ||||
|   | ||||
| @@ -144,7 +144,6 @@ export class LevelsComponent extends ComponentWithTable implements OnInit, OnDes | ||||
|   } | ||||
|  | ||||
|   public newLevelTemplate: Level = { | ||||
|     id: 0, | ||||
|     createdAt: "", | ||||
|     modifiedAt: "" | ||||
|   }; | ||||
| @@ -260,11 +259,8 @@ export class LevelsComponent extends ComponentWithTable implements OnInit, OnDes | ||||
|  | ||||
|   public addLevel(table: Table): void { | ||||
|     const newLevel = JSON.parse(JSON.stringify(this.newLevelTemplate)); | ||||
|     newLevel.id = this.levels.length == 0 ? 1 : Math.max.apply(Math, this.levels.map(l => { | ||||
|       return l.id ?? 0; | ||||
|     })) + 1; | ||||
|  | ||||
|     this.levels.push(newLevel); | ||||
|     this.levels = [newLevel, ...this.levels]; | ||||
|  | ||||
|     table.initRowEdit(newLevel); | ||||
|  | ||||
|   | ||||
| @@ -37,7 +37,6 @@ export class MembersComponent extends ComponentWithTable implements OnInit, OnDe | ||||
|   isEditingNew: boolean = false; | ||||
|  | ||||
|   newUserTemplate: User = { | ||||
|     id: 0, | ||||
|     discordId: 0, | ||||
|     name: "", | ||||
|     xp: 0, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user