1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

add chat to advanced search

This commit is contained in:
RaidMax
2023-08-26 22:56:37 -05:00
parent 8e1dd9d506
commit a169653e91
10 changed files with 288 additions and 146 deletions

View File

@ -0,0 +1,86 @@
@using WebfrontCore.QueryHelpers.Models
@using SharedLibraryCore.Interfaces
@using System.Globalization
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model string
@{
var existingChatFilter = ViewBag.Query as ChatResourceRequest;
var manager = ViewBag.Manager as IManager;
}
<div id="chatSearchWrapper@(Model)" data-has-data="@(existingChatFilter?.HasData ?? false)" >
<div class="form-group">
<label for="messageContains@(Model)">@ViewBag.Localization["WEBFRONT_ACTION_LABEL_MESSAGE"]</label>
<div class="d-flex">
<input type="text" class="form-control" name="messageContains" id="messageContains@(Model)}"
placeholder="Contains" value="@existingChatFilter?.MessageContains"/>
<div class="custom-control ml-10 align-self-center">
<div class="custom-switch">
@if (existingChatFilter?.IsExactMatch ?? false)
{
<input type="checkbox" id="isExactMatch@(Model)" name="isExactMatch" value="true"
checked="checked">
}
else
{
<input type="checkbox" id="isExactMatch@(Model)" name="isExactMatch" value="true">
}
<label for="isExactMatch@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_EXACT"]</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="serverId@(Model)" class="w-quarter">@ViewBag.Localization["WEBFRONT_BAN_MGMT_FORM_ID"]</label>
<label for="clientId@(Model)" class="">@ViewBag.Localization["WEBFRONT_CONTEXT_MENU_GLOBAL_SERVER"]</label>
<div class="d-flex">
<input type="text" class="form-control w-quarter" name="clientId" id="clientId@(Model)}"
placeholder="Id" value="@existingChatFilter?.ClientId"/>
<select class="form-control w-three-quarter ml-10" id="serverId@(Model)" name="serverId">
<option value="">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_SELECT_PERMISSIONS_ANY"]</option>
@foreach (var server in manager!.GetServers())
{
<option value="@server.Id" selected="@(server.Id == existingChatFilter?.ServerId)">
[@server.GameName.ToString()] @server.ServerName
</option>
}
</select>
</div>
</div>
<div class="form-group">
<label for="sentAfter@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_SENT_AFTER"]</label>
@{
var afterDate = existingChatFilter?.SentAfterDateTime ?? DateTime.UtcNow.AddHours(-1);
}
<div class="d-flex">
<input type="text" class="form-control date-picker-input w-half" name="sentAfter"
id="sentAfter@(Model)" data-date="@afterDate.ToString("s", CultureInfo.InvariantCulture)"
value="@afterDate.ToString("s", CultureInfo.InvariantCulture)"/>
<input type="time" class="form-control w-half ml-10" name="sentAfterTime"
id="sentAfterTime@(Model)"
value="@afterDate.ToString("HH:mm")"/>
</div>
</div>
<div class="form-group">
<label for="sentAfter@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_SENT_BEFORE"]</label>
@{
var beforeDate = existingChatFilter?.SentBeforeDateTime ?? DateTime.UtcNow;
}
<div class="d-flex">
<input type="text" class="form-control date-picker-input w-half" name="sentBefore"
id="sentBefore@(Model)" data-date="@beforeDate.ToString("s", CultureInfo.InvariantCulture)"
value="@beforeDate.ToString("s", CultureInfo.InvariantCulture)"/>
<input type="time" class="form-control w-half ml-10" name="sentBeforeTime"
id="sentBeforeTime@(Model)"
value="@beforeDate.ToString("HH:mm")"/>
</div>
</div>
<input type="submit" class="btn btn-primary" value="@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_BUTTON_SUBMIT"]"/>
</div>

View File

@ -0,0 +1,116 @@
@using WebfrontCore.QueryHelpers.Models
@using System.Globalization
@using Data.Models
@using Data.Models.Client
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using SharedLibraryCore.Dtos
@model string
@{
var existingClientFilter = ViewBag.ClientResourceRequest as ClientResourceRequest;
}
<div id="clientSearchWrapper@(Model)" data-has-data="@(existingClientFilter?.HasData ?? false)" >
<div class="form-group">
<label for="clientName@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_NAME"]</label>
<div class="d-flex">
<input type="text" class="form-control" name="clientName" id="clientName@(Model)"
placeholder="Unknown Soldier" value="@existingClientFilter?.ClientName"/>
<div class="custom-control ml-10 align-self-center">
<div class="custom-switch">
@if (existingClientFilter?.IsExactClientName ?? false)
{
<input type="checkbox" id="isExactClientName@(Model)" name="isExactClientName" value="true"
checked="checked">
}
else
{
<input type="checkbox" id="isExactClientName@(Model)" name="isExactClientName" value="true">
}
<label for="isExactClientName@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_EXACT"]</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="clientIP@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_IP"]</label>
<div class="d-flex">
<input type="text" class="form-control" name="clientIP" id="clientIP@(Model)" placeholder="1.1.1.1"
value="@existingClientFilter?.ClientIp">
<div class="custom-control ml-10 align-self-center">
<div class="custom-switch">
@if (existingClientFilter?.IsExactClientIp ?? false)
{
<input type="checkbox" id="isExactClientIP@(Model)" name="isExactClientIP" value="true"
checked="checked">
}
else
{
<input type="checkbox" id="isExactClientIP@(Model)" name="isExactClientIP" value="true">
}
<label for="isExactClientIP@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_EXACT"]</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="clientGuid@(Model)">GUID <span class="text-primary">&bull;</span> XUID <span class="text-primary">&bull;</span> NetworkID</label>
<input type="text" class="form-control" name="clientGuid" id="clientGuid@(Model)"
placeholder="110000100000001" value="@existingClientFilter?.ClientGuid"/>
</div>
<div class="form-group">
<label for="clientLevel@(Model)" class="w-half">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_PERMISSION"]</label>
<label for="clientGameName@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_GAME"]</label>
<div class="d-flex">
<select class="form-control w-half" id="clientLevel@(Model)" name="clientLevel">
<option value="">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_SELECT_PERMISSIONS_ANY"]</option>
@foreach (EFClient.Permission permission in Enum.GetValues(typeof(EFClient.Permission)))
{
<option value="@((int)permission)" selected="@(permission == existingClientFilter?.ClientLevel)">
@permission.ToLocalizedLevelName()
</option>
}
</select>
<select class="form-control w-half ml-10" id="clientGameName@(Model)" name="gameName">
<option value="">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_SELECT_PERMISSIONS_ANY"]</option>
@foreach (Reference.Game game in Enum.GetValues(typeof(Reference.Game)))
{
<option value="@((int)game)" selected="@(game == existingClientFilter?.GameName)">
@ViewBag.Localization["GAME_" + game]
</option>
}
</select>
</div>
</div>
<div class="form-group">
<label for="clientConnected@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_CONNECTED_SINCE"]</label>
<div class="d-flex">
@{ var presetDate = (existingClientFilter?.ClientConnected ?? DateTime.UtcNow.AddYears(-1)).ToString("s", CultureInfo.InvariantCulture); }
<input type="text" class="form-control date-picker-input w-half" name="clientConnected"
id="clientConnected@(Model)" data-date="@presetDate"
value="@presetDate"/>
<div class="custom-control ml-10 align-self-center">
<div class="custom-switch">
@if ((existingClientFilter?.Direction ?? SortDirection.Descending) is SortDirection.Descending)
{
<input type="checkbox" id="resultOrder@(Model)" name="direction"
value="@((int)SortDirection.Ascending)">
}
else
{
<input type="checkbox" id="resultOrder@(Model)" name="direction"
value="@((int)SortDirection.Ascending)" checked="checked">
}
<label for="resultOrder@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_OLDEST_FIRST"]</label>
</div>
</div>
</div>
</div>
<input type="submit" class="btn btn-primary" value="@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_BUTTON_SUBMIT"]"/>
</div>