diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 46b122e..179a7f7 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -47,11 +47,13 @@ import {FilterMatChipMessage} from "./pages/internal-components/search-filters/F
import {FilterMatChipServer} from "./pages/internal-components/search-filters/base/FilterMatChipServer";
import {FilterMatChipDateBegin} from "./pages/internal-components/search-filters/base/FilterMatChipDateBegin";
import {FilterMatChipDateEnd} from "./pages/internal-components/search-filters/base/FilterMatChipDateEnd";
-import {FilterMatChipBanId} from "./pages/internal-components/search-filters/FilterMatChipBanId";
+import {FilterMatChipBanId} from "./pages/internal-components/search-filters/ban/FilterMatChipBanId";
import {BanViewDialog} from "./pages/internal-components/dialogs/BanViewDialog";
import {MatDialogModule} from "@angular/material/dialog";
import {MessageSearchTable} from "./pages/messages-page/message-search-table";
import {BanlistSearchTable} from "./pages/banlist-page/banlist-search-table";
+import {FilterMatChipActiveBan} from "./pages/internal-components/search-filters/ban/FilterMatChipActiveBan";
+import {FilterMatChipAdmins} from "./pages/internal-components/search-filters/ban/FilterMatChipAdmins";
registerLocaleData(localeRu, "ru")
@@ -76,6 +78,8 @@ registerLocaleData(localeRu, "ru")
FilterMatChipDateBegin,
FilterMatChipDateEnd,
FilterMatChipBanId,
+ FilterMatChipActiveBan,
+ FilterMatChipAdmins,
//dialogs
BanViewDialog
],
diff --git a/src/app/entities/search/BanSearchFilter.ts b/src/app/entities/search/BanSearchFilter.ts
index 6b8b1c4..5f1bc31 100644
--- a/src/app/entities/search/BanSearchFilter.ts
+++ b/src/app/entities/search/BanSearchFilter.ts
@@ -7,6 +7,12 @@ export class BanSearchFilter extends SearchFilter{
active: boolean|null = null;
admin_ids: string[]|null = null;
+ private active_statuses:{name:string, value:boolean|null}[] = [
+ {name: "Все баны", value: null},
+ {name: "В бане", value: true},
+ {name: "Уже не в бане", value: false}
+ ];
+
override createQuery(paginator:MatPaginator|undefined): { [p: string]: any } {
let q:{[param: string]: any} = super.createQuery(paginator);
q["ban_ids"] = this.ban_ids?this.ban_ids.join(","):null;
@@ -28,7 +34,32 @@ export class BanSearchFilter extends SearchFilter{
super.fromQuery(param, paginator);
}
+ //admin ids
+ changeAdminsToSearch(prev: string, name: any) {
+ //tak nado
+ if (this.admin_ids == null)
+ this.admin_ids = [];
+ this.admin_ids = this.admin_ids.filter(v => v !== prev);
+ if (this.admin_ids.indexOf(name.target.value) == -1)
+ this.admin_ids.push(name.target.value);
+ this.updated = true;
+ }
+
+ addAdminsToSearch(name: string) {
+ if (this.admin_ids == null)
+ this.admin_ids = [];
+ if (this.admin_ids.indexOf(name) == -1)
+ this.admin_ids.push(name);
+ this.updated = true;
+ }
+ removeAdminsFromSearch(name: string) {
+ if (this.admin_ids == null) return;
+ this.admin_ids = this.admin_ids.filter(v => v !== name);
+ this.updated = true;
+ }
+
+ //ban id
changeBanIdToSearch(prev: number, name: any) {
if (this.ban_ids == null)
this.ban_ids = [];
@@ -51,4 +82,20 @@ export class BanSearchFilter extends SearchFilter{
this.ban_ids = this.ban_ids.filter(v => v !== name);
this.updated = true;
}
+
+ //actuve ban
+ getActiveBanName(v: boolean|null):string {
+ try {
+ // @ts-ignore
+ return this.active_statuses.filter(a => a.value == v).pop().name;
+ } catch (e) {return "";}
+ }
+ changeActiveBan(s: boolean|null) {
+ this.active = s;
+ this.updated = true;
+ }
+
+ getBanActiveStatuses():{name:string, value:boolean|null}[] {
+ return this.active_statuses;
+ }
}
diff --git a/src/app/pages/banlist-page/banlist-search-table.ts b/src/app/pages/banlist-page/banlist-search-table.ts
index d9da744..dd9b4b7 100644
--- a/src/app/pages/banlist-page/banlist-search-table.ts
+++ b/src/app/pages/banlist-page/banlist-search-table.ts
@@ -18,8 +18,10 @@ import {BanViewDialog} from "../internal-components/dialogs/BanViewDialog";