Skip to content

Commit

Permalink
Added event log for iScored competition
Browse files Browse the repository at this point in the history
  • Loading branch information
syd711 committed Nov 16, 2024
1 parent f98563a commit c871f0d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
import de.mephisto.vpin.connectors.vps.model.VpsTableVersion;
import de.mephisto.vpin.restclient.competitions.CompetitionRepresentation;
import de.mephisto.vpin.restclient.competitions.CompetitionType;
import de.mephisto.vpin.restclient.games.GameRepresentation;
import de.mephisto.vpin.restclient.players.PlayerRepresentation;
import de.mephisto.vpin.ui.*;
import de.mephisto.vpin.ui.NavigationController;
import de.mephisto.vpin.ui.NavigationOptions;
import de.mephisto.vpin.ui.Studio;
import de.mephisto.vpin.ui.WaitOverlayController;
import de.mephisto.vpin.ui.competitions.dialogs.CompetitionSavingProgressModel;
import de.mephisto.vpin.ui.competitions.dialogs.GameRoomCellContainer;
import de.mephisto.vpin.ui.competitions.dialogs.IScoredGameCellContainer;
import de.mephisto.vpin.ui.competitions.validation.CompetitionValidationTexts;
import de.mephisto.vpin.ui.tables.TableDialogs;
import de.mephisto.vpin.ui.tournaments.VpsTableContainer;
import de.mephisto.vpin.ui.tournaments.VpsVersionContainer;
import de.mephisto.vpin.ui.util.LocalizedValidation;
Expand Down Expand Up @@ -71,6 +76,9 @@ public class IScoredSubscriptionsController extends BaseCompetitionController im
@FXML
private Button addBtn;

@FXML
private Button eventLogBtn;

@FXML
private Button reloadBtn;

Expand Down Expand Up @@ -127,6 +135,19 @@ private void onCompetitionCreate() {
}


@FXML
private void onEventLog() {
List<CompetitionRepresentation> selections = new ArrayList<>(tableView.getSelectionModel().getSelectedItems());
if (selections.isEmpty()) {
return;
}
CompetitionRepresentation competitionRepresentation = selections.get(0);
GameRepresentation game = client.getGameService().getGame(competitionRepresentation.getGameId());
if (game != null && game.isEventLogAvailable()) {
TableDialogs.openEventLogDialog(game);
}
}

@FXML
private void onDelete() {
List<CompetitionRepresentation> selections = new ArrayList<>(tableView.getSelectionModel().getSelectedItems());
Expand Down Expand Up @@ -374,13 +395,17 @@ private void refreshView(Optional<CompetitionRepresentation> competition) {
CompetitionRepresentation newSelection = null;
if (competition.isPresent()) {
newSelection = competition.get();

GameRepresentation game = client.getGameService().getGame(newSelection.getGameId());
eventLogBtn.setDisable(game == null || !game.isEventLogAvailable());
}

PlayerRepresentation defaultPlayer = client.getPlayerService().getDefaultPlayer();
deleteBtn.setDisable(defaultPlayer == null);
reloadBtn.setDisable(defaultPlayer == null);
addBtn.setDisable(defaultPlayer == null);


if (defaultPlayer == null) {
tableView.setPlaceholder(new Label(" No default player set!\n" +
"Go to the players section and set the default player for this cabinet!"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToolBar?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
Expand Down Expand Up @@ -70,6 +71,18 @@
<FontIcon iconColor="WHITE" iconLiteral="mdi2p-plus-circle-outline" iconSize="18" />
</graphic>
</Button>
<Separator layoutX="272.0" layoutY="10.0" orientation="VERTICAL" prefHeight="0.0" prefWidth="12.0" />
<Button fx:id="eventLogBtn" layoutX="288.0" layoutY="11.0" mnemonicParsing="false" onAction="#onEventLog" text="Event Log" textFill="WHITE">
<font>
<Font size="14.0" />
</font>
<graphic>
<FontIcon iconColor="WHITE" iconLiteral="mdi2c-clock-alert-outline" iconSize="18" />
</graphic>
<tooltip>
<Tooltip text="Shows the recorded events of the last play session." />
</tooltip>
</Button>
<Separator layoutX="364.0" layoutY="10.0" orientation="VERTICAL" prefHeight="0.0" prefWidth="12.0" />
<Button fx:id="deleteBtn" layoutX="464.0" layoutY="11.0" mnemonicParsing="false" onAction="#onDelete" text="Delete" textFill="#ff3333">
<font>
Expand Down

0 comments on commit c871f0d

Please sign in to comment.