e-voting/src/main/resources/fxml/VoterView.fxml
2026-04-17 19:45:51 +02:00

116 lines
3.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<BorderPane prefHeight="500.0" prefWidth="800.0"
xmlns="http://javafx.com/javafx/23.0.1"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="dev.ksan.ui.VoterController"
style="-fx-background-color: #f4f6f8;">
<!-- TOP BAR -->
<top>
<HBox alignment="CENTER_LEFT" spacing="10"
style="-fx-background-color: #2c3e50; -fx-padding: 10;">
<children>
<Label fx:id="usernameLabel"
text="Username"
style="-fx-text-fill: white; -fx-font-size: 16px; -fx-font-weight: bold;"/>
</children>
</HBox>
</top>
<!-- SIDEBAR -->
<left>
<VBox prefWidth="260" spacing="10"
style="-fx-background-color: white; -fx-padding: 10;">
<Button fx:id="refreshButton"
text="🔄 Refresh"
style="-fx-background-color: #3498db; -fx-text-fill: white;"/>
<TitledPane fx:id="activeList" text="Active Polls" expanded="true">
<content>
<ListView fx:id="activePollsListView"/>
</content>
</TitledPane>
<TitledPane fx:id="inactiveList" text="Inactive Polls">
<content>
<ListView fx:id="inactivePollsListView"/>
</content>
</TitledPane>
</VBox>
</left>
<!-- MAIN CONTENT -->
<center>
<StackPane fx:id="centerPane" style="-fx-padding: 20;">
<children>
<VBox spacing="15" maxWidth="500"
style="-fx-background-color: white; -fx-padding: 20; -fx-background-radius: 10; -fx-border-radius: 10; -fx-border-color: #ddd;">
<!-- TITLE -->
<Label text="Poll Details"
style="-fx-font-size: 18px; -fx-font-weight: bold;"/>
<!-- TITLE FIELD -->
<HBox spacing="10">
<Label text="Title:" style="-fx-font-weight: bold;"/>
<Label fx:id="titleText"/>
</HBox>
<!-- DESCRIPTION -->
<HBox spacing="10">
<Label text="Description:" style="-fx-font-weight: bold;"/>
<Label fx:id="descriptionText" wrapText="true"/>
</HBox>
<!-- DATES -->
<HBox spacing="10">
<Label text="Duration:" style="-fx-font-weight: bold;"/>
<Label fx:id="startDateText"/>
<Label text="→"/>
<Label fx:id="endDateText"/>
</HBox>
<!-- OPTIONS -->
<VBox spacing="10">
<Label text="Options:" style="-fx-font-weight: bold;"/>
<ScrollPane fitToWidth="true" VBox.vgrow="ALWAYS">
<content>
<VBox fx:id="optionsContainer" spacing="8"/>
</content>
</ScrollPane>
</VBox>
<!-- STATUS -->
<Label fx:id="alreadyVotedLabel"
style="-fx-text-fill: green;"/>
<Label fx:id="errorLabel"
style="-fx-text-fill: red;"/>
<!-- ACTION -->
<Button fx:id="confirmButton"
text="Submit Vote"
style="-fx-background-color: #2ecc71; -fx-text-fill: white; -fx-font-weight: bold;"/>
</VBox>
</children>
</StackPane>
</center>
</BorderPane>