Adding PurchaseOrder(view only)

This commit is contained in:
Nikitha
2026-02-23 16:09:53 -07:00
parent 4fcaa7f2eb
commit 287995b22c
6 changed files with 168 additions and 0 deletions

View File

@@ -41,6 +41,9 @@ public class MainLayoutController {
@FXML
private Button btnSalesHistory;
@FXML
private Button btnPurchaseOrders;
@FXML
private Button btnServices;
@@ -98,6 +101,12 @@ public class MainLayoutController {
updateButtons(btnSalesHistory);
}
@FXML
void btnPurchaseOrdersClicked() {
loadView("purchase-order-view.fxml");
updateButtons(btnPurchaseOrders);
}
@FXML
void btnServicesClicked(ActionEvent event) {
loadView("service-view.fxml");
@@ -108,8 +117,11 @@ public class MainLayoutController {
void btnSuppliersClicked(ActionEvent event) {
loadView("supplier-view.fxml");
updateButtons(btnSuppliers);
}
@FXML
void btnLogoutClicked(ActionEvent event) {
// Logout clears session state before returning to the login view.

View File

@@ -0,0 +1,27 @@
package org.example.petshopdesktop.controllers;
import javafx.fxml.FXML;
import javafx.scene.control.*;
public class PurchaseOrderController {
@FXML private Button btnRefresh;
@FXML private TextField txtSearch;
@FXML private TableView<?> tvPurchaseOrders;
@FXML private TableColumn<?, ?> colOrderId;
@FXML private TableColumn<?, ?> colSupplier;
@FXML private TableColumn<?, ?> colOrderDate;
@FXML private TableColumn<?, ?> colStatus;
@FXML
public void initialize() {
// View-only page for now
}
@FXML
void btnRefresh() {
// Later: reload data
}
}

View File

@@ -0,0 +1,4 @@
package org.example.petshopdesktop.database;
public class PurchaseOrderDB {
}

View File

@@ -0,0 +1,39 @@
package org.example.petshopdesktop.models;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
public class PurchaseOrder {
private SimpleIntegerProperty orderId;
private SimpleStringProperty supplierName;
private SimpleStringProperty orderDate;
private SimpleStringProperty status;
public PurchaseOrder(int orderId,
String supplierName,
String orderDate,
String status) {
this.orderId = new SimpleIntegerProperty(orderId);
this.supplierName = new SimpleStringProperty(supplierName);
this.orderDate = new SimpleStringProperty(orderDate);
this.status = new SimpleStringProperty(status);
}
public int getOrderId() {
return orderId.get();
}
public String getSupplierName() {
return supplierName.get();
}
public String getOrderDate() {
return orderDate.get();
}
public String getStatus() {
return status.get();
}
}

View File

@@ -106,6 +106,21 @@
<Insets bottom="12.0" left="12.0" right="45.0" top="12.0" />
</padding>
</Button>
<Button fx:id="btnPurchaseOrders"
mnemonicParsing="false"
onAction="#btnPurchaseOrdersClicked"
prefWidth="250.0"
style="-fx-background-color: transparent; -fx-background-radius: 8; -fx-cursor: hand;"
text="🧾 Purchase Orders"
textFill="#cccccc">
<font>
<Font name="Comic Sans MS Bold" size="14.0" />
</font>
<padding>
<Insets bottom="12.0" left="12.0" right="40.0" top="12.0" />
</padding>
</Button>
<Button fx:id="btnLogout" mnemonicParsing="false" onAction="#btnLogoutClicked" prefWidth="250.0" style="-fx-background-color: #34495E; -fx-background-radius: 8; -fx-cursor: hand;" text="🚪 Logout" textFill="#cccccc">
<font>
<Font name="Comic Sans MS Bold" size="14.0" />

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?>
<VBox spacing="20.0"
style="-fx-font-size: 14px;"
xmlns="http://javafx.com/javafx/25"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.example.petshopdesktop.controllers.PurchaseOrderController">
<padding>
<Insets bottom="20" left="20" right="20" top="20"/>
</padding>
<!-- HEADER -->
<HBox spacing="20" alignment="CENTER_LEFT">
<Label text="Purchase Orders" textFill="#2c3e50">
<font>
<Font name="System Bold" size="30"/>
</font>
</Label>
<Label text="(View Only)" textFill="#7f8c8d">
<font>
<Font name="System Bold" size="16"/>
</font>
<padding>
<Insets top="10"/>
</padding>
</Label>
<Region HBox.hgrow="ALWAYS"/>
<Button fx:id="btnRefresh"
text="Refresh"
onAction="#btnRefresh"
style="-fx-background-color:#4ECDC4; -fx-background-radius:8;"
textFill="WHITE"/>
</HBox>
<!-- SEARCH -->
<HBox spacing="10"
style="-fx-background-color:white; -fx-background-radius:14; -fx-border-width:2; -fx-border-radius:14;">
<padding>
<Insets bottom="10" left="15" right="15" top="10"/>
</padding>
<TextField fx:id="txtSearch"
promptText="Search Purchase Orders..."
style="-fx-border-width:0; -fx-background-color:transparent;"
HBox.hgrow="ALWAYS"/>
</HBox>
<!-- TABLE -->
<TableView fx:id="tvPurchaseOrders"
style="-fx-background-color:white; -fx-background-radius:12;"
VBox.vgrow="ALWAYS">
<columns>
<TableColumn fx:id="colOrderId" text="Order ID" prefWidth="80"/>
<TableColumn fx:id="colSupplier" text="Supplier" prefWidth="200"/>
<TableColumn fx:id="colOrderDate" text="Order Date" prefWidth="150"/>
<TableColumn fx:id="colStatus" text="Status" prefWidth="120"/>
</columns>
</TableView>
</VBox>