Skip to content

Commit

Permalink
Feat: Attempt to implement components to avaiableorganiszaiton
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianBalunan committed Apr 16, 2026
1 parent 213b4b5 commit 88f32a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
import javafx.scene.Parent;
import javafx.scene.control.TextField;
import javafx.scene.layout.FlowPane;
import ntnu.systemutvikling.team6.controller.components.BaseController;
import ntnu.systemutvikling.team6.controller.components.LoaderScene;
import ntnu.systemutvikling.team6.controller.components.NavbarFooterController;
import ntnu.systemutvikling.team6.controller.components.OrganizationCardController;
import ntnu.systemutvikling.team6.controller.components.*;
import ntnu.systemutvikling.team6.database.DatabaseConnection;
import ntnu.systemutvikling.team6.database.Readers.CharitySelect;
import ntnu.systemutvikling.team6.models.Charity;
Expand All @@ -26,14 +23,22 @@
* on the featured charity to see more details about it. The user can also switch to the charity
* page or donation page for the selected charity.
*/
public class AvailableOrganizationController extends BaseController implements NavbarFooterController {
public class AvailableOrganizationController extends BaseController {

@FXML private TextField searchField;
@FXML private FlowPane cardsContainer;
@FXML private NavbarController navbarController;
@FXML private FooterController footerController;

private Charity charity;
private List<Charity> allCharities;

@Override
protected void authTokenisSet(){
navbarController.setAuthToken(authToken);
footerController.setAuthToken(authToken);
}

/**
* This method is used to initialize the available organization page. It retrieves all charities
* from the database and sets up a listener on the search field to filter the charities based on
Expand Down Expand Up @@ -126,7 +131,7 @@ public void setInitialSearch(String query) {
* @param event action event from button click
*/
public void switchToCharityPage(ActionEvent event) {
LoaderScene.LoadScene("CharityPage", event, charity, null);
LoaderScene.LoadScene("CharityPage", event, charity, null, authToken);
}

/**
Expand All @@ -136,6 +141,6 @@ public void switchToCharityPage(ActionEvent event) {
*/
@FXML
public void switchToDonationPage(ActionEvent event) {
LoaderScene.LoadScene("DonationPage", event, charity, null);
LoaderScene.LoadScene("DonationPage", event, charity, null, authToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
style="-fx-background-color: #f4f4f4;"
xmlns="http://javafx.com/javafx/25"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="ntnu.systemutvikling.team6.controller.OrganizationOverviewController">
fx:controller="ntnu.systemutvikling.team6.controller.components.OrganizationOverviewController">

<!-- NAVBAR -->
<top>
Expand Down Expand Up @@ -945,95 +945,8 @@

<!-- FOOTER -->
<bottom>
<HBox alignment="BOTTOM_CENTER"
maxHeight="180.0"
minHeight="180.0"
prefHeight="180.0"
prefWidth="800.0"
style="-fx-background-color: #2f8f8b;">
<children>
<GridPane HBox.hgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="60.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<Rectangle fill="#2f8f8b" height="130.0" stroke="TRANSPARENT" strokeType="INSIDE" translateY="1.0" width="800.0" />
<Label text="Help" textFill="WHITE" translateX="80.0" StackPane.alignment="CENTER_LEFT">
<font>
<Font name="System Bold" size="26.0" />
</font>
</Label>
<Label text="Me" textFill="#c8e6c9" translateX="145.0" StackPane.alignment="CENTER_LEFT">
<font>
<Font name="System Bold" size="26.0" />
</font>
</Label>
<Label text="Help" textFill="WHITE" translateX="192.0" StackPane.alignment="CENTER_LEFT">
<font>
<Font name="System Bold" size="26.0" />
</font>
</Label>
<Rectangle fill="WHITE" height="90.0" stroke="TRANSPARENT" strokeType="INSIDE" translateX="-120.0" width="2.0" />
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" translateX="-40.0" StackPane.alignment="CENTER_LEFT">
<children>
<Label text="About us" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Label>
<Label text="Something else" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Label>
<Label text="Third link" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Label>
</children>
</VBox>
</children>
</StackPane>

<StackPane alignment="CENTER_RIGHT" prefHeight="150.0" prefWidth="200.0" GridPane.columnIndex="1">
<children>
<ImageView fitHeight="71.0" fitWidth="161.0" pickOnBounds="true" preserveRatio="true" translateX="-60.0" translateY="-30.0">
<image>
<Image url="@../images/img.png" />
</image>
</ImageView>
<Label maxWidth="200.0"
text="All data is consistently updated and reverified"
textAlignment="CENTER"
textFill="WHITE"
translateY="30.0"
wrapText="true">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
</children>
</StackPane>
</children>
</GridPane>
</children>
</HBox>
<!-- This pulls in the navbar with its own controller -->
<fx:include fx:id="footer" source="components/footer.fxml" />
</bottom>

</BorderPane>

0 comments on commit 88f32a7

Please sign in to comment.