package com.gitrekt.resort.controller;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.StackedBarChart;
import javafx.scene.chart.XYChart;
import javafx.scene.chart.XYChart.Data;
import javafx.scene.control.Button;
import javafx.scene.control.Label;

/**
 * FXML Controller class for the management bookings report screen.
 */
public class BookingsReportScreenController implements Initializable {

    @FXML
    private StackedBarChart barChart;
    
    @FXML
    private Label monthYearLabel;
    
    @FXML
    private Button nextMonthButton;
    
    @FXML
    private Button previousMonthButton;
    
    @FXML
    private Button pickMonthButton;
    
    @FXML
    private Button backButton;

    private XYChart.Series<String, Number> roomCategoriesDataSeries;
    
    private ObservableList<Data<String, Number>> roomCategoriesList;
    
    /**
     * Initializes the controller class.
     */
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        // TODO: Test using test data, then implement with real logic.
        Data<String,Number> testData = new Data<String,Number>();
        roomCategoriesList = FXCollections.observableArrayList();
        roomCategoriesDataSeries = new XYChart.Series<>();
        roomCategoriesDataSeries.setData(roomCategoriesList);
    }    
    
    public void onPickMonthButtonClicked() {
        // TODO
    }
    
    public void onNextMonthButtonClicked() {
        // TODO
    }
    
    public void onPreviousMonthButtonClicked() {
        // TODO
    }
    
    public void onBackButtonClicked() {
        ScreenManager.getInstance().switchToScreen(
            "/fxml/ReportsHomeScreen.fxml"
        );
    }
    
    public void onSelectMonthButtonClicked() {
        // TODO
    }
    
}

@@ -54,16 +54,153 @@
 et.URL;%0A
+import java.time.LocalDateTime;%0Aimport java.time.format.TextStyle;%0Aimport java.time.temporal.TemporalAdjusters;%0Aimport java.util.Locale;%0A
 import j
@@ -1149,24 +1149,70 @@
 sList;%0A    %0A
+    private LocalDateTime selectedMonth;%0A    %0A
     /**%0A    
@@ -1323,24 +1323,134 @@
 undle rb) %7B%0A
+        // Default month is the current month.%0A        selectedMonth = LocalDateTime.now().withDayOfMonth(1);%0A
         // T
@@ -1772,38 +1772,49 @@
  %7D    %0A    %0A    
-public
+@FXML%0A    private
  void onPickMont
@@ -1855,38 +1855,49 @@
 %0A    %7D%0A    %0A    
-public
+@FXML%0A    private
  void onNextMont
@@ -1927,322 +1927,998 @@
     
-// TODO%0A    %7D%0A    %0A    public void onPreviousMonthButtonClicked() %7B%0A        // TODO%0A    %7D%0A    %0A    public void onBackButtonClicked() %7B%0A        ScreenManager.getInstance().switchToScreen(%0A            %22/fxml/ReportsHomeScreen.fxml%22%0A        );%0A    %7D%0A    %0A    public void onSelectMonthButtonClicked() %7B%0A        // TODO
+selectedMonth = selectedMonth.with(%0A            TemporalAdjusters.firstDayOfNextMonth()%0A        );%0A        monthYearLabel.setText(getCurrentMonthYearString());%0A    %7D%0A    %0A    @FXML%0A    private void onPreviousMonthButtonClicked() %7B%0A        selectedMonth = selectedMonth.minusMonths(1);%0A        selectedMonth = selectedMonth.withDayOfMonth(1);%0A        monthYearLabel.setText(getCurrentMonthYearString());%0A    %7D%0A    %0A    @FXML%0A    private void onBackButtonClicked() %7B%0A        ScreenManager.getInstance().switchToScreen(%0A            %22/fxml/ReportsHomeScreen.fxml%22%0A        );%0A    %7D%0A    %0A    public void onSelectMonthButtonClicked() %7B%0A        // TODO%0A        monthYearLabel.setText(getCurrentMonthYearString());%0A    %7D%0A    %0A    private void populateData() %7B%0A        // TODO%0A    %7D%0A    %0A    private String getCurrentMonthYearString() %7B%0A        return selectedMonth.getMonth()%0A                .getDisplayName(TextStyle.FULL, Locale.US)%0A                + %22 %22%0A                + selectedMonth.getYear();
 %0A   

Implement prev and next month buttons on bookings report