2020-08-13 14:40:27 +02:00
|
|
|
using Robust.Shared.Serialization;
|
2022-07-09 16:48:57 +03:00
|
|
|
using System.Text;
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Cargo
|
2019-11-21 16:37:15 -08:00
|
|
|
{
|
2024-04-23 08:07:12 -04:00
|
|
|
[DataDefinition, NetSerializable, Serializable]
|
|
|
|
|
public sealed partial class CargoOrderData
|
2019-11-21 16:37:15 -08:00
|
|
|
{
|
2023-06-16 05:19:02 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Price when the order was added.
|
|
|
|
|
/// </summary>
|
2024-04-23 08:07:12 -04:00
|
|
|
[DataField]
|
2023-06-16 05:19:02 +00:00
|
|
|
public int Price;
|
|
|
|
|
|
2023-03-05 04:27:30 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// A unique (arbitrary) ID which identifies this order.
|
|
|
|
|
/// </summary>
|
2024-04-23 08:07:12 -04:00
|
|
|
[DataField]
|
|
|
|
|
public int OrderId { get; private set; }
|
2023-03-05 04:27:30 +00:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-06-16 05:19:02 +00:00
|
|
|
/// Prototype Id for the item to be created
|
2023-03-05 04:27:30 +00:00
|
|
|
/// </summary>
|
2024-04-23 08:07:12 -04:00
|
|
|
[DataField]
|
|
|
|
|
public string ProductId { get; private set; }
|
2023-03-05 04:27:30 +00:00
|
|
|
|
2024-04-18 03:32:21 +03:00
|
|
|
/// <summary>
|
|
|
|
|
/// Prototype Name
|
|
|
|
|
/// </summary>
|
2024-04-23 08:07:12 -04:00
|
|
|
[DataField]
|
|
|
|
|
public string ProductName { get; private set; }
|
2024-04-18 03:32:21 +03:00
|
|
|
|
2023-03-05 04:27:30 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// The number of items in the order. Not readonly, as it might change
|
|
|
|
|
/// due to caps on the amount of orders that can be placed.
|
|
|
|
|
/// </summary>
|
2024-04-23 08:07:12 -04:00
|
|
|
[DataField]
|
2023-03-05 04:27:30 +00:00
|
|
|
public int OrderQuantity;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How many instances of this order that we've already dispatched
|
2023-06-16 05:19:02 +00:00
|
|
|
/// </summary>
|
2024-04-23 08:07:12 -04:00
|
|
|
[DataField]
|
2023-03-05 04:27:30 +00:00
|
|
|
public int NumDispatched = 0;
|
|
|
|
|
|
2024-04-23 08:07:12 -04:00
|
|
|
[DataField]
|
|
|
|
|
public string Requester { get; private set; }
|
2019-11-21 16:37:15 -08:00
|
|
|
// public String RequesterRank; // TODO Figure out how to get Character ID card data
|
|
|
|
|
// public int RequesterId;
|
2024-04-23 08:07:12 -04:00
|
|
|
[DataField]
|
|
|
|
|
public string Reason { get; private set; }
|
2024-07-29 08:19:43 +02:00
|
|
|
public bool Approved;
|
2024-04-23 08:07:12 -04:00
|
|
|
[DataField]
|
2022-07-09 16:48:57 +03:00
|
|
|
public string? Approver;
|
2019-11-21 16:37:15 -08:00
|
|
|
|
2024-04-18 03:32:21 +03:00
|
|
|
public CargoOrderData(int orderId, string productId, string productName, int price, int amount, string requester, string reason)
|
2019-11-21 16:37:15 -08:00
|
|
|
{
|
2023-03-05 04:27:30 +00:00
|
|
|
OrderId = orderId;
|
2019-11-21 16:37:15 -08:00
|
|
|
ProductId = productId;
|
2024-04-18 03:32:21 +03:00
|
|
|
ProductName = productName;
|
2023-06-16 05:19:02 +00:00
|
|
|
Price = price;
|
2023-03-05 04:27:30 +00:00
|
|
|
OrderQuantity = amount;
|
2022-07-09 16:48:57 +03:00
|
|
|
Requester = requester;
|
|
|
|
|
Reason = reason;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-03 16:01:38 +03:00
|
|
|
public void SetApproverData(string? approver)
|
|
|
|
|
{
|
|
|
|
|
Approver = approver;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-16 05:19:02 +00:00
|
|
|
public void SetApproverData(string? fullName, string? jobTitle)
|
2022-07-09 16:48:57 +03:00
|
|
|
{
|
|
|
|
|
var sb = new StringBuilder();
|
2023-06-16 05:19:02 +00:00
|
|
|
if (!string.IsNullOrWhiteSpace(fullName))
|
2022-07-09 16:48:57 +03:00
|
|
|
{
|
2023-06-16 05:19:02 +00:00
|
|
|
sb.Append($"{fullName} ");
|
2022-07-09 16:48:57 +03:00
|
|
|
}
|
2023-06-16 05:19:02 +00:00
|
|
|
if (!string.IsNullOrWhiteSpace(jobTitle))
|
2022-07-09 16:48:57 +03:00
|
|
|
{
|
2023-06-16 05:19:02 +00:00
|
|
|
sb.Append($"({jobTitle})");
|
2022-07-09 16:48:57 +03:00
|
|
|
}
|
2022-09-29 04:23:31 +02:00
|
|
|
Approver = sb.ToString();
|
2019-11-21 16:37:15 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|