2020-08-13 14:40:27 +02:00
|
|
|
using Robust.Shared.Serialization;
|
2022-07-09 16:48:57 +03:00
|
|
|
using Content.Shared.Access.Components;
|
|
|
|
|
using System.Text;
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Cargo
|
2019-11-21 16:37:15 -08:00
|
|
|
{
|
|
|
|
|
[NetSerializable, Serializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class CargoOrderData
|
2019-11-21 16:37:15 -08:00
|
|
|
{
|
2023-01-15 01:49:00 +00:00
|
|
|
public int OrderIndex;
|
|
|
|
|
/// The human-readable number, when displaying this order
|
|
|
|
|
public int PrintableOrderNumber { get { return OrderIndex + 1; } }
|
2022-07-09 16:48:57 +03:00
|
|
|
public string ProductId;
|
|
|
|
|
public int Amount;
|
2019-11-21 16:37:15 -08:00
|
|
|
public string Requester;
|
|
|
|
|
// public String RequesterRank; // TODO Figure out how to get Character ID card data
|
|
|
|
|
// public int RequesterId;
|
|
|
|
|
public string Reason;
|
2022-07-09 16:48:57 +03:00
|
|
|
public bool Approved => Approver is not null;
|
|
|
|
|
public string? Approver;
|
2019-11-21 16:37:15 -08:00
|
|
|
|
2023-01-15 01:49:00 +00:00
|
|
|
public CargoOrderData(int orderIndex, string productId, int amount, string requester, string reason)
|
2019-11-21 16:37:15 -08:00
|
|
|
{
|
2023-01-15 01:49:00 +00:00
|
|
|
OrderIndex = orderIndex;
|
2019-11-21 16:37:15 -08:00
|
|
|
ProductId = productId;
|
|
|
|
|
Amount = amount;
|
2022-07-09 16:48:57 +03:00
|
|
|
Requester = requester;
|
|
|
|
|
Reason = reason;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetApproverData(IdCardComponent? idCard)
|
|
|
|
|
{
|
|
|
|
|
var sb = new StringBuilder();
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(idCard?.FullName))
|
|
|
|
|
{
|
|
|
|
|
sb.Append($"{idCard.FullName} ");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(idCard?.JobTitle))
|
|
|
|
|
{
|
|
|
|
|
sb.Append($"({idCard.JobTitle})");
|
|
|
|
|
}
|
2022-09-29 04:23:31 +02:00
|
|
|
Approver = sb.ToString();
|
2019-11-21 16:37:15 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|