diff --git a/Content.Client/StationRecords/GeneralStationRecordConsoleBoundUserInterface.cs b/Content.Client/StationRecords/GeneralStationRecordConsoleBoundUserInterface.cs index e7bab71e38..a506a49177 100644 --- a/Content.Client/StationRecords/GeneralStationRecordConsoleBoundUserInterface.cs +++ b/Content.Client/StationRecords/GeneralStationRecordConsoleBoundUserInterface.cs @@ -1,3 +1,4 @@ +using Content.Shared._Sunrise.StationRecords; using Content.Shared.StationRecords; using Robust.Client.UserInterface; @@ -22,6 +23,11 @@ public sealed class GeneralStationRecordConsoleBoundUserInterface : BoundUserInt _window.OnFiltersChanged += (type, filterValue) => SendMessage(new SetStationRecordFilter(type, filterValue)); _window.OnDeleted += id => SendMessage(new DeleteStationRecord(id)); + + // Sunrise added start + _window.OnSaved += (record, id) => SendMessage(new SaveStationRecord(record, id)); + _window.OnPrinted += id => SendMessage(new PrintStationRecord(id)); + // Sunrise added end } protected override void UpdateState(BoundUserInterfaceState state) diff --git a/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml b/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml index 3615eb8e00..d5201a0781 100644 --- a/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml +++ b/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml @@ -17,9 +17,9 @@ - + diff --git a/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs b/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs index 272e6c3b25..616aecf1e9 100644 --- a/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs +++ b/Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs @@ -1,7 +1,12 @@ +using Content.Client._Sunrise.StationRecords; +using Content.Client.Lobby; +using Content.Client.Roles; using Content.Shared.StationRecords; using Robust.Client.AutoGenerated; +using Robust.Client.UserInterface; using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; +using Robust.Shared.Prototypes; namespace Content.Client.StationRecords; @@ -17,10 +22,30 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow private StationRecordFilterType _currentFilterType; + // Sunrise added start + public Action? OnSaved; + public Action? OnPrinted; + + private readonly IEntityManager _entity; + private readonly IPrototypeManager _prototype; + private readonly ILocalizationManager _loc; + private readonly JobSystem _job; + private readonly LobbyUIController _controller; + // Sunrise added end + public GeneralStationRecordConsoleWindow() { RobustXamlLoader.Load(this); + // Sunrise added start + _entity = IoCManager.Resolve(); + _prototype = IoCManager.Resolve(); + _loc = IoCManager.Resolve(); + var interfaceManager = IoCManager.Resolve(); + _job = _entity.System(); + _controller = interfaceManager.GetUIController(); + // Sunrise added end + _currentFilterType = StationRecordFilterType.Name; foreach (var item in Enum.GetValues()) @@ -111,7 +136,8 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow RecordContainerStatus.Text = state.SelectedKey == null ? Loc.GetString("general-station-record-console-no-record-found") : Loc.GetString("general-station-record-console-select-record-info"); - PopulateRecordContainer(state.Record, state.CanDeleteEntries, state.SelectedKey); + // Sunrise edit + PopulateRecordContainer(state.Record, state.CanDeleteEntries, state.CanRedactSensitiveData, state.HasAccess, state.SelectedKey); } else { @@ -136,11 +162,17 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow RecordListing.SortItemsByText(); } - private void PopulateRecordContainer(GeneralStationRecord record, bool enableDelete, uint? id) + // Sunrise edit + private void PopulateRecordContainer(GeneralStationRecord record, bool enableDelete, bool canRedactSensitiveData, bool hasAccess, uint? id) { RecordContainer.RemoveAllChildren(); - var newRecord = new GeneralRecord(record, enableDelete, id); + // Sunrise edit start + var newRecord = + new SunriseGeneralRecord(record, enableDelete, canRedactSensitiveData, hasAccess, id, in _entity, in _prototype, in _loc, in _job, in _controller); + // Sunrise edit end newRecord.OnDeletePressed = OnDeleted; + newRecord.OnPrintPressed = OnPrinted; + newRecord.OnSaveButtonPressed = OnSaved; RecordContainer.AddChild(newRecord); } diff --git a/Content.Client/_Sunrise/StationRecords/SunriseGeneralRecord.xaml b/Content.Client/_Sunrise/StationRecords/SunriseGeneralRecord.xaml new file mode 100644 index 0000000000..13f6698e10 --- /dev/null +++ b/Content.Client/_Sunrise/StationRecords/SunriseGeneralRecord.xaml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +