Menambahkan DialogTambahNotaController, membuat fungsi menampilkan dialog tambah nota(Tunai, Bon, Bawa, Retur), dan ambil dari checkout
parent
9f637ee9b7
commit
02931488a6
@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package id.amigogroup.posterminal.transaksi;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.control.ButtonType;
|
||||||
|
import javafx.scene.control.ComboBox;
|
||||||
|
import javafx.scene.control.Dialog;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.control.ToggleGroup;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Josua
|
||||||
|
*/
|
||||||
|
public class DialogTambahNotaController extends Dialog<String> implements Initializable {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private AnchorPane apTambahNota;
|
||||||
|
@FXML
|
||||||
|
private ToggleGroup tgTipe;
|
||||||
|
@FXML
|
||||||
|
private ComboBox cbxPilihNota;
|
||||||
|
@FXML
|
||||||
|
private TextField txtFieldAmbilDariCheckout;
|
||||||
|
|
||||||
|
public static final ButtonType btnLanjutkan = new ButtonType("Lanjutkan");
|
||||||
|
public static final ButtonType btnBatal = new ButtonType("Batal");
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
|
cbxPilihNota.getItems().setAll(
|
||||||
|
"Tunai",
|
||||||
|
"Bon",
|
||||||
|
"Bawa Dulu",
|
||||||
|
"Retur"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogTambahNotaController() {
|
||||||
|
try {
|
||||||
|
Window window = getDialogPane().getScene().getWindow();
|
||||||
|
window.setOnCloseRequest(event -> this.close());
|
||||||
|
|
||||||
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/DialogTambahNota.fxml"));
|
||||||
|
loader.setController(this);
|
||||||
|
// DialogCariBarangController controller = loader.<DialogCariBarangController>getController();
|
||||||
|
|
||||||
|
Parent root = loader.load();
|
||||||
|
getDialogPane().setContent(root);
|
||||||
|
|
||||||
|
getDialogPane().getButtonTypes().add(btnBatal);
|
||||||
|
getDialogPane().getButtonTypes().add(btnLanjutkan);
|
||||||
|
setResultConverter(buttonType -> {
|
||||||
|
if (buttonType == btnLanjutkan) {
|
||||||
|
//radio button mana yang dipilih
|
||||||
|
//baru, balikin tipe yang dipilih
|
||||||
|
//dari checkout, balikin isi nomor nota (hanya jika nota ditemukan)
|
||||||
|
return "Tambah";
|
||||||
|
}
|
||||||
|
return "Batal";
|
||||||
|
|
||||||
|
});
|
||||||
|
setTitle("Tambah Nota");
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Logger.getLogger(DialogKonfirmasiReturController.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
void rbNotaBaruOnAction(ActionEvent event) {
|
||||||
|
cbxPilihNota.setDisable(false);
|
||||||
|
txtFieldAmbilDariCheckout.setDisable(true);
|
||||||
|
|
||||||
|
// Button buttonBaru FormConstanta= generateButtonNota("10-0220-0000X",
|
||||||
|
// FormConstanta.TRANSAKSI_TUNAI,
|
||||||
|
// Fucout.TIPE_NOTA_TUNAI);
|
||||||
|
// navigasi.add(buttonBaru);
|
||||||
|
// vbNavigasi.getChildren().add(buttonBaru);
|
||||||
|
// jumlahNota++;
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
void rbAmbilDariCheckoutOnAction(ActionEvent event) {
|
||||||
|
cbxPilihNota.setDisable(true);
|
||||||
|
txtFieldAmbilDariCheckout.setDisable(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,25 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.ComboBox?>
|
<?import javafx.scene.control.ComboBox?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.control.RadioButton?>
|
<?import javafx.scene.control.RadioButton?>
|
||||||
<?import javafx.scene.control.TextField?>
|
<?import javafx.scene.control.TextField?>
|
||||||
|
<?import javafx.scene.control.ToggleGroup?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<AnchorPane id="AnchorPane" prefHeight="250.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
<AnchorPane id="AnchorPane" fx:id="apTambahNota" prefHeight="189.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<children>
|
<children>
|
||||||
<Label layoutX="14.0" layoutY="14.0" text="Tambah" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="4.0">
|
<Label layoutX="14.0" layoutY="14.0" text="Tambah Nota" AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="4.0">
|
||||||
<font>
|
<font>
|
||||||
<Font size="16.0" />
|
<Font size="16.0" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<RadioButton layoutX="33.0" layoutY="45.0" mnemonicParsing="false" onAction="#rbTambahNotaBaru" text="Baru" AnchorPane.leftAnchor="32.0" AnchorPane.topAnchor="46.0" />
|
<RadioButton layoutX="33.0" layoutY="45.0" mnemonicParsing="false" onAction="#rbNotaBaruOnAction" selected="true" text="Baru" AnchorPane.leftAnchor="32.0" AnchorPane.topAnchor="46.0">
|
||||||
<RadioButton layoutX="33.0" layoutY="121.0" mnemonicParsing="false" text="Ambil dari checkout" AnchorPane.leftAnchor="32.0" AnchorPane.topAnchor="122.0" />
|
<toggleGroup>
|
||||||
<ComboBox layoutX="61.0" layoutY="79.0" prefWidth="150.0" promptText="Pilih salah satu" AnchorPane.leftAnchor="62.0" AnchorPane.topAnchor="70.0" />
|
<ToggleGroup fx:id="tgTipe" />
|
||||||
<TextField layoutX="63.0" layoutY="150.0" AnchorPane.leftAnchor="62.0" AnchorPane.topAnchor="146.0" />
|
</toggleGroup></RadioButton>
|
||||||
<Button layoutX="250.0" layoutY="200.0" mnemonicParsing="false" onAction="#btnBatal" text="Batal" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="90.0" />
|
<RadioButton layoutX="33.0" layoutY="121.0" mnemonicParsing="false" onAction="#rbAmbilDariCheckoutOnAction" text="Ambil dari checkout" toggleGroup="$tgTipe" AnchorPane.leftAnchor="32.0" AnchorPane.topAnchor="122.0" />
|
||||||
<Button layoutX="318.0" layoutY="200.0" mnemonicParsing="false" onAction="#btnLanjutkan" text="Lanjutkan" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0" />
|
<ComboBox fx:id="cbxPilihNota" layoutX="61.0" layoutY="79.0" prefWidth="150.0" promptText="Pilih nota" AnchorPane.leftAnchor="62.0" AnchorPane.topAnchor="70.0" />
|
||||||
|
<TextField fx:id="txtFieldAmbilDariCheckout" disable="true" layoutX="63.0" layoutY="150.0" AnchorPane.leftAnchor="62.0" AnchorPane.topAnchor="146.0" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|||||||
Loading…
Reference in New Issue