Skip to content

Commit 8975412

Browse files
committed
monthly and weekly filter
1 parent de07181 commit 8975412

14 files changed

+114
-53
lines changed
659 Bytes
Binary file not shown.
62 Bytes
Binary file not shown.
259 Bytes
Binary file not shown.
1.27 KB
Binary file not shown.
579 Bytes
Binary file not shown.

out/production/scheduling-desktop-application/view/Login.fxml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3+
<?import javafx.geometry.Insets?>
34
<?import javafx.scene.control.Button?>
45
<?import javafx.scene.control.Label?>
56
<?import javafx.scene.control.PasswordField?>
@@ -16,24 +17,30 @@
1617
<Font size="30.0" />
1718
</font>
1819
</Label>
19-
<VBox alignment="CENTER" layoutX="76.0" layoutY="127.0" prefHeight="146.0" prefWidth="450.0">
20+
<VBox alignment="CENTER_RIGHT" layoutX="174.0" layoutY="127.0" prefHeight="146.0" prefWidth="256.0">
2021
<children>
21-
<HBox alignment="CENTER" prefHeight="41.0" prefWidth="450.0">
22+
<HBox alignment="CENTER_RIGHT" prefHeight="41.0" prefWidth="450.0">
2223
<children>
2324
<Label fx:id="usernameLabel" text="Username: " />
2425
<TextField fx:id="usernameText" />
2526
</children>
2627
</HBox>
27-
<HBox alignment="CENTER" prefHeight="41.0" prefWidth="450.0">
28+
<HBox alignment="CENTER_RIGHT" prefHeight="41.0" prefWidth="450.0">
2829
<children>
2930
<Label fx:id="passwordLabel" text="Password: " />
3031
<PasswordField fx:id="passwordText" />
3132
</children>
3233
</HBox>
3334
<HBox alignment="CENTER" prefHeight="41.0" prefWidth="450.0">
3435
<children>
35-
<Button fx:id="resetButton" mnemonicParsing="false" onAction="#onActionResetButton" text="Reset" textFill="RED" />
36-
<Button fx:id="loginButton" mnemonicParsing="false" onAction="#onActionLoginButton" text="Login" textFill="GREEN" />
36+
<Button fx:id="resetButton" mnemonicParsing="false" onAction="#onActionResetButton" text="Reset" textFill="RED">
37+
<HBox.margin>
38+
<Insets left="10.0" right="10.0" />
39+
</HBox.margin></Button>
40+
<Button fx:id="loginButton" mnemonicParsing="false" onAction="#onActionLoginButton" text="Login" textFill="GREEN">
41+
<HBox.margin>
42+
<Insets left="10.0" right="10.0" />
43+
</HBox.margin></Button>
3744
</children>
3845
</HBox>
3946
<Label fx:id="messageText" alignment="CENTER" contentDisplay="CENTER" textAlignment="CENTER" />

out/production/scheduling-desktop-application/view/MainMenu.fxml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<Font size="25.0" />
6363
</font>
6464
</Label>
65-
<RadioButton fx:id="viewWeekButton" mnemonicParsing="false" text="View Week">
65+
<RadioButton fx:id="viewWeekButton" mnemonicParsing="false" onAction="#onActionDatePicker" text="View Week">
6666
<opaqueInsets>
6767
<Insets />
6868
</opaqueInsets>
@@ -73,23 +73,23 @@
7373
<ToggleGroup fx:id="viewToggle" />
7474
</toggleGroup>
7575
</RadioButton>
76-
<RadioButton fx:id="viewMonthButton" mnemonicParsing="false" text="View Month" toggleGroup="$viewToggle">
76+
<RadioButton fx:id="viewMonthButton" mnemonicParsing="false" onAction="#onActionDatePicker" text="View Month" toggleGroup="$viewToggle">
7777
<opaqueInsets>
7878
<Insets />
7979
</opaqueInsets>
8080
<padding>
8181
<Insets left="10.0" right="10.0" />
8282
</padding>
8383
</RadioButton>
84-
<RadioButton fx:id="viewAllButton" mnemonicParsing="false" selected="true" text="View All" toggleGroup="$viewToggle">
84+
<RadioButton fx:id="viewAllButton" mnemonicParsing="false" onAction="#onActionDatePicker" selected="true" text="View All" toggleGroup="$viewToggle">
8585
<opaqueInsets>
8686
<Insets />
8787
</opaqueInsets>
8888
<padding>
8989
<Insets left="10.0" right="10.0" />
9090
</padding>
9191
</RadioButton>
92-
<DatePicker fx:id="datePicker">
92+
<DatePicker fx:id="datePicker" onAction="#onActionDatePicker">
9393
<opaqueInsets>
9494
<Insets />
9595
</opaqueInsets>
@@ -101,15 +101,15 @@
101101
</HBox>
102102
<TableView fx:id="calendarTableView" layoutX="1.0" layoutY="166.0" prefHeight="300.0" prefWidth="900.0">
103103
<columns>
104-
<TableColumn fx:id="appIdCol" prefWidth="63.0" text="App ID" />
105-
<TableColumn fx:id="titleCol" prefWidth="114.0" text="Title" />
106-
<TableColumn fx:id="descriptionCol" prefWidth="137.0" text="Description" />
107-
<TableColumn fx:id="locationCol" minWidth="0.0" prefWidth="118.0" text="Location" />
108-
<TableColumn fx:id="contactCol" prefWidth="124.0" text="Contact" />
109-
<TableColumn fx:id="typeCol" minWidth="0.0" prefWidth="82.0" text="Type" />
110-
<TableColumn fx:id="startCol" minWidth="2.0" prefWidth="71.0" text="Start" />
111-
<TableColumn fx:id="endCol" prefWidth="88.0" text="End" />
112-
<TableColumn fx:id="appCustomerIdCol" prefWidth="102.0" text="Customer ID" />
104+
<TableColumn fx:id="appIdCol" prefWidth="57.0" text="App ID" />
105+
<TableColumn fx:id="titleCol" prefWidth="86.0" text="Title" />
106+
<TableColumn fx:id="descriptionCol" prefWidth="90.0" text="Description" />
107+
<TableColumn fx:id="locationCol" minWidth="0.0" prefWidth="99.0" text="Location" />
108+
<TableColumn fx:id="contactCol" text="Contact" />
109+
<TableColumn fx:id="typeCol" minWidth="0.0" prefWidth="78.0" text="Type" />
110+
<TableColumn fx:id="startCol" minWidth="2.0" prefWidth="179.0" text="Start" />
111+
<TableColumn fx:id="endCol" prefWidth="175.0" text="End" />
112+
<TableColumn fx:id="appCustomerIdCol" prefWidth="55.0" text="Customer ID" />
113113
</columns>
114114
</TableView>
115115
<Label layoutX="383.0" layoutY="477.0" text="Customers">

src/controller/MainMenuController.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,22 @@
2525
public class MainMenuController implements Initializable {
2626
private static Appointment selectedAppointment;
2727
private static Customer selectedCustomer;
28+
private static LocalDate selectedDate = LocalDate.now();
2829

2930
Stage stage;
3031
Parent scene;
3132

3233
@Override
3334
public void initialize(URL url, ResourceBundle rb) {
3435
/**
35-
* Set default value of DatePicker to Today
36+
* Set default value of DatePicker
3637
*/
37-
datePicker.setValue(LocalDate.now());
38+
datePicker.setValue(selectedDate);
3839

3940
/**
4041
* Add properties from Appointment model
4142
*/
42-
calendarTableView.setItems(AppointmentDao.getAppointmentList());
43+
calendarTableView.setItems(AppointmentDao.getAppointmentList("View All"));
4344
appIdCol.setCellValueFactory(new PropertyValueFactory<>("id"));
4445
titleCol.setCellValueFactory(new PropertyValueFactory<>("title"));
4546
descriptionCol.setCellValueFactory(new PropertyValueFactory<>("description"));
@@ -210,11 +211,23 @@ void onActionReportsButton(ActionEvent event) {
210211

211212
}
212213

214+
@FXML
215+
void onActionDatePicker(ActionEvent event) {
216+
selectedDate = datePicker.getValue();
217+
String selectedFilter = ((RadioButton)viewToggle.getSelectedToggle()).getText();
218+
calendarTableView.setItems(AppointmentDao.getAppointmentList(selectedFilter));
219+
}
220+
213221
public static Appointment getSelectedAppointment() {
214222
return selectedAppointment;
215223
}
216224

217225
public static Customer getSelectedCustomer() {
218226
return selectedCustomer;
219227
}
228+
229+
public static LocalDate getSelectedDate() {
230+
return selectedDate;
231+
}
232+
220233
}

src/controller/ModifyAppointmentController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ void onActionCancelButton(ActionEvent event) throws IOException {
107107
void onActionDeleteButton(ActionEvent event) throws IOException {
108108
int id = Integer.parseInt(idText.getText());
109109
AppointmentDao.deleteAppointment(id);
110+
Warning.generateMessage("Appointment Deleted", Alert.AlertType.CONFIRMATION);
110111
stage = (Stage) ((Button) event.getSource()).getScene().getWindow();
111112
scene = FXMLLoader.load(getClass().getResource("/view/MainMenu.fxml"));
112113
stage.setScene(new Scene(scene));

src/controller/ModifyCustomerController.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
import java.io.IOException;
2222
import java.net.URL;
23+
import java.sql.SQLException;
24+
import java.sql.SQLIntegrityConstraintViolationException;
2325
import java.util.ResourceBundle;
2426

2527
public class ModifyCustomerController implements Initializable {
@@ -82,7 +84,14 @@ void onActionCancelButton(ActionEvent event) throws IOException {
8284
@FXML
8385
void onActionDeleteButton(ActionEvent event) throws IOException {
8486
int id = Integer.parseInt(idText.getText());
85-
CustomerDao.deleteCustomer(id);
87+
88+
try {
89+
CustomerDao.deleteCustomer(id);
90+
Warning.generateMessage("Customer Deleted", Alert.AlertType.CONFIRMATION);
91+
} catch (SQLException e) {
92+
Warning.generateMessage("Customers assigned to Appointments cannot be deleted.", Alert.AlertType.WARNING);
93+
}
94+
8695
stage = (Stage) ((Button) event.getSource()).getScene().getWindow();
8796
scene = FXMLLoader.load(getClass().getResource("/view/MainMenu.fxml"));
8897
stage.setScene(new Scene(scene));

0 commit comments

Comments
 (0)