diff --git a/.github/workflows/auto-pr.yml b/.github/workflows/auto-pr.yml index 4bb498d..b6f230a 100644 --- a/.github/workflows/auto-pr.yml +++ b/.github/workflows/auto-pr.yml @@ -12,19 +12,27 @@ jobs: pull-requests: write contents: read steps: - - uses: actions/checkout@v4 - - name: Create Pull Request if not exists - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - EXISTING=$(gh pr list --base main --head dev --json number --jq '.[0].number') - if [ -z "$EXISTING" ]; then - gh pr create \ - --base main \ - --head dev \ - --title "Sprint 5: Price, Expiry, and Supplier Tracking" \ - --body "## Changes\n- Added price field with total inventory value on dashboard\n- Added expiration date tracking with expiring-soon alerts\n- Added supplier tracking\n- Added 'Add Expiring Soon Items' button in Receive Delivery\n- Updated seed data with real-world supplier names" - else - echo "PR #$EXISTING already exists, skipping." - fi + uses: actions/github-script@v7 + with: + script: | + const { data: pulls } = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + base: 'main', + head: 'dev', + state: 'open' + }); + if (pulls.length === 0) { + await github.rest.pulls.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: 'Sprint 5: Price, Expiry, and Supplier Tracking', + head: 'dev', + base: 'main', + body: '## Changes\n- Added price field with total inventory value on dashboard\n- Added expiration date tracking with expiring-soon alerts\n- Added supplier tracking\n- Added \'Add Expiring Soon Items\' button in Receive Delivery\n- Updated seed data with real-world supplier names' + }); + console.log('Pull request created successfully.'); + } else { + console.log(`PR #${pulls[0].number} already exists, skipping.`); + } diff --git a/src/main/java/com/inventorypro/ui/Scenes.java b/src/main/java/com/inventorypro/ui/Scenes.java index b083d74..217dd44 100644 --- a/src/main/java/com/inventorypro/ui/Scenes.java +++ b/src/main/java/com/inventorypro/ui/Scenes.java @@ -241,6 +241,7 @@ protected void updateItem(Void v, boolean empty) { }); table.getColumns().addAll(colName, colCategory, colLocation, colQty, colPrice, colExpiry, colAdj); + VBox.setVgrow(table, Priority.ALWAYS); Button goAdd = new Button("Add Item"); goAdd.setOnAction(e -> stage.getScene().setRoot(createAddItem(stage))); @@ -441,12 +442,7 @@ public static Parent createAddItem(Stage stage) { service.addItem(newItem); items.add(newItem); - Alert success = new Alert(Alert.AlertType.INFORMATION); - success.setHeaderText("Item Added"); - success.setContentText("The item was added successfully."); - success.showAndWait(); - - stage.getScene().setRoot(createDashboard(stage)); + javafx.application.Platform.runLater(() -> stage.getScene().setRoot(createDashboard(stage))); }); Button back = new Button("Back to Dashboard"); @@ -586,12 +582,7 @@ public static Parent createEditItem(Stage stage, Item item) { items.set(idx, updated); } - Alert success = new Alert(Alert.AlertType.INFORMATION); - success.setHeaderText("Item Updated"); - success.setContentText("The item was updated successfully."); - success.showAndWait(); - - stage.getScene().setRoot(createDashboard(stage)); + javafx.application.Platform.runLater(() -> stage.getScene().setRoot(createDashboard(stage))); }); Button back = new Button("Cancel"); @@ -761,11 +752,7 @@ protected void updateItem(Item item, boolean empty) { } items.setAll(service.listItems()); - Alert ok = new Alert(Alert.AlertType.INFORMATION); - ok.setHeaderText("Delivery Processed"); - ok.setContentText("Received stock for " + count + " item(s)."); - ok.showAndWait(); - stage.getScene().setRoot(createDashboard(stage)); + javafx.application.Platform.runLater(() -> stage.getScene().setRoot(createDashboard(stage))); }); Button clearManifest = new Button("Clear Order"); @@ -817,6 +804,7 @@ protected void updateItem(Item item, boolean empty) { HBox buttons = new HBox(10, processDelivery, clearManifest, addExpiringSoon, back); buttons.setPadding(new Insets(10, 0, 0, 0)); + VBox.setVgrow(manifestTable, Priority.ALWAYS); VBox root = new VBox(10, title, instructions, pickerRow, currentStockLabel, addStatus, manifestCount, manifestTable, buttons); root.setPadding(new Insets(18)); @@ -869,6 +857,7 @@ public static Parent createTransactionHistory(Stage stage, Item item) { }); table.setItems(filteredTransactions); + VBox.setVgrow(table, Priority.ALWAYS); if (historyList.isEmpty()) { table.setPlaceholder(new Label("No transaction history found for this item."));