ultimate report system

This commit is contained in:
2019-09-02 20:46:05 +02:00
parent f29bd12757
commit 6dc9e5961c
7 changed files with 90 additions and 51 deletions

View File

@@ -113,24 +113,19 @@ export default function reportList(globalData: GlobalData) {
reportMenu.ItemSelect.on((item) => {
if (item.Text === "Annehmen") {
var tickcont;
mp.events.callRemote("requestReport", "tescht");
var ticketContentBox = new InputHelper("Worin besteht dein Anliegen?", globalData);
ticketContentBox.show();
ticketContentBox.getValue(data => {
var content = data;
mp.events.callRemote("requestReport", "lold");
mp.events.callRemote("requestReport", content, type);
mp.events.call("SERVER:CloseReportMenu");
reportMenu.Close();
});
var lold = ticketContentBox.test;
mp.events.callRemote("requestReport", lold);
globalData.InMenu = false;
} else if (item.Text === "Abbrechen") {

View File

@@ -4,12 +4,10 @@
private created: boolean;
private browser: BrowserMp;
private data: GlobalData;
public test: string;
constructor(title: string, globalData: GlobalData) {
this.title = title;
this.data = globalData;
this.test = "";
this.cefTitleCall = this.cefTitleCall.bind(this);
mp.events.add('cef_request_title', this.cefTitleCall);
@@ -17,10 +15,6 @@
this.cefCallback = this.cefCallback.bind(this);
mp.events.add('cef_inputhelper_sendvalue', this.cefCallback);
mp.events.add('submitText', (tmp) => {
this.test = tmp;
});
this.finish = this.finish.bind(this);
this.show = this.show.bind(this);
this.valueGetter = this.valueGetter.bind(this);

View File

@@ -151,7 +151,7 @@
"dev": true
},
"@types/ragemp-c": {
"version": "github:CocaColaBear/types-ragemp-c#d10b6da467784395af86038b85c076afa18dbb9b",
"version": "github:CocaColaBear/types-ragemp-c#6a118e6399b77a347ac67e07f6b15f842109b0ff",
"from": "github:CocaColaBear/types-ragemp-c#master",
"dev": true
},
@@ -1647,7 +1647,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@@ -1668,12 +1669,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -1688,17 +1691,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -1815,7 +1821,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@@ -1827,6 +1834,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -1841,6 +1849,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -1848,12 +1857,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -1872,6 +1883,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -1952,7 +1964,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -1964,6 +1977,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@@ -2049,7 +2063,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -2085,6 +2100,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -2104,6 +2120,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -2147,12 +2164,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},

View File

@@ -7,7 +7,6 @@ using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Util;
using System;
using System.Linq;
using System;
namespace ReallifeGamemode.Server.Commands
{

View File

@@ -178,15 +178,6 @@ namespace ReallifeGamemode.Server.Finance
}
}
private static int GetRentalFees(Client client)
{
using (var dbContext = new DatabaseContext())
{
User user = client.GetUser();
return dbContext.HouseRentals.Where(h => h.UserId == user.Id).Include(h => h.House).Sum(h => h.House.RentalFee);
}
}
public static void ReleasePayDay(Client client, Paycheck paycheck)
{
using (var dbContext = new DatabaseContext())

View File

@@ -18,14 +18,13 @@ namespace ReallifeGamemode.Server.Report
public static List<ReportManage> listReports = new List<ReportManage>();
[Command("report", "~m~Benutzung: ~s~/report")]
public void CmdUserReport(Client client, String message)
public void CmdUserReport(Client client)
{
User user = client.GetUser();
client.TriggerEvent("showReportType");
//ChatService.BroadcastAdmin("Eingehendes Ticket von " + client.Name + ": " + message + " (Benutze /showtickets)", AdminLevel.ADMIN);
ReportManage ticket = new ReportManage(client.Name, message);
listReports.Add(ticket);
}
[Command("showtickets", "~m~Benutzung: ~s~/showtickets")]
@@ -65,7 +64,7 @@ namespace ReallifeGamemode.Server.Report
if (player == null)
return;
ChatService.SendMessage(player, "Admin " + admin.Name + " hat dein Ticket angenommen!");
ChatService.SendMessage(player, "Admin " + admin.Name + " hat dein Ticket angenommen! (Benutze /rc)");
ChatService.BroadcastAdmin(admin.Name + " hat das Ticket von " + player.Name + " angenommen", AdminLevel.ADMIN);
for (int a = 0; a < listReports.Count; a++)
@@ -74,27 +73,65 @@ namespace ReallifeGamemode.Server.Report
if (temp.getUser().Equals(player.Name))
{
listReports[a].setAdmin(admin.Name);
break;
}
}
}
[RemoteEvent("requestReport")]
public void RequestReport(Client user, dynamic data)
[Command("rc", "~m~Benutzung: ~s~/rc text")]
public void CmdUserRc(Client client, String text)
{
ChatService.BroadcastAdmin("JA MAN!" + ", " + data, AdminLevel.ADMIN);
bool cont = false;
String username = client.Name;
String adminname = "N/A";
ReportManage temp = null;
for (int a = 0; a < listReports.Count; a++)
{
temp = listReports[a];
if (temp.getUser().Equals(client.Name))
{
cont = true;
adminname = listReports[a].getAdmin();
break;
}
}
if (!cont)
{
return;
}
Client admin = ClientService.GetClientByNameOrId(adminname);
if (client.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
if (text.Equals("quit"))
{
ChatService.SendMessage(client, "~y~(REPORT) Chat vom Admin beendet");
ChatService.SendMessage(admin, "~y~(REPORT) Chat beendet");
listReports.Remove(temp);
return;
}
}
ChatService.SendMessage(client, "~y~" + username + " (REPORT): " + text);
ChatService.SendMessage(admin, "~y~" + username + " (REPORT): " + text);
}
[RemoteEvent("sendReport")]
public void SendReport(Client user, string type)
[RemoteEvent("requestReport")]
public void RequestReport(Client user, dynamic data, string type)
{
if (type.Equals("Quick Report"))
if (type == "Ticket Report")
{
ChatService.BroadcastAdmin("Quick Report von " + user.Name, AdminLevel.ADMIN);
} else if (type.Equals("Ticket Report"))
{
ChatService.BroadcastAdmin("Ticket Report von " + user.Name, AdminLevel.ADMIN);
user.TriggerEvent("textbox");
ChatService.BroadcastAdmin("Eingehendes Ticket von " + user.Name + ": " + data + " (Benutze /showtickets)", AdminLevel.ADMIN);
ReportManage ticket = new ReportManage(user.Name, user.Name);
listReports.Add(ticket);
}
if (type == "Quick Report")
ChatService.BroadcastAdmin("QR von " + user.Name + ": " + data, AdminLevel.ADMIN);
}
[RemoteEvent("deleteReport")]

View File

@@ -21,6 +21,10 @@ namespace ReallifeGamemode.Server.Report
{
this.admin = nAdmin;
}
public String getAdmin()
{
return this.admin;
}
public String getUser()
{