fix report

This commit is contained in:
hydrant
2019-09-03 20:15:46 +02:00
parent 616516fa3a
commit bda4342076
2 changed files with 12 additions and 14 deletions

View File

@@ -96,21 +96,13 @@ export default function reportList(globalData: GlobalData) {
var types = ["Quick Report", "Ticket Report"];
reportMenu = new Menu("QuickReport/Ticket", "", new Point(50, 50), null, null);
reportMenu.AddItem(new UIMenuListItem("Typ", "", new ItemsCollection(types)));
var typesItem = new UIMenuListItem("Typ", "", new ItemsCollection(types));
reportMenu.AddItem(typesItem);
reportMenu.AddItem(sendItem);
reportMenu.AddItem(cancelItem);
reportMenu.Visible = true;
reportMenu.ListChange.on((item, index) => {
switch (item.Text) {
case "Absenden":
type = String(item.SelectedItem.DisplayText);
break;
}
});
reportMenu.ItemSelect.on((item) => {
if (item.Text === "Absenden") {
@@ -118,7 +110,12 @@ export default function reportList(globalData: GlobalData) {
ticketContentBox.show();
ticketContentBox.getValue(data => {
var content = data;
var type = typesItem.SelectedItem.DisplayText;
var content = JSON.stringify(data);
mp.gui.chat.push(content);
mp.gui.chat.push(type);
mp.events.callRemote("requestReport", type, content);
mp.events.call("SERVER:CloseReportMenu");

View File

@@ -165,6 +165,7 @@ namespace ReallifeGamemode.Server.Report
[RemoteEvent("requestReport")]
public void RequestReport(Client user, string type, string data)
{
string text = JsonConvert.DeserializeObject<string>(data);
if (type == "Ticket Report")
{
ReportManage temp = null;
@@ -184,12 +185,12 @@ namespace ReallifeGamemode.Server.Report
}
ChatService.SendMessage(user, "!{#addc8d}Dein Ticket wurde abgeschickt");
ChatService.SendMessage(user, "!{#addc8d}Momentan sind " + UserHelper.dutyAdmins.Count + " Admins verfügbar");
ChatService.BroadcastDutyAdmin("!{#008fff}[TICKET]!{#FFFFFF} Eingehendes Ticket von~y~ " + user.Name + ": " + data + " (Benutze /showtickets)");
ReportManage ticket = new ReportManage(user.Name, data);
ChatService.BroadcastDutyAdmin("!{#008fff}[TICKET]!{#FFFFFF} Eingehendes Ticket von~y~ " + user.Name + ": " + text + " (Benutze /showtickets)");
ReportManage ticket = new ReportManage(user.Name, text);
listReports.Add(ticket);
}
if (type == "Quick Report")
ChatService.BroadcastAdmin("!{#008fff}[QR] ~y~" + user.Name + "~w~: " + data, AdminLevel.SUPPORTER);
ChatService.BroadcastAdmin("!{#008fff}[QR] ~y~" + user.Name + "~w~: " + text, AdminLevel.SUPPORTER);
}
[RemoteEvent("deleteReport")]