package parking.implementation.gui.stages;

import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import javafx.stage.Window;
import parking.api.business.invoices.Invoice;
import parking.api.business.parkingspot.ParkingSpot;
import parking.implementation.business.Client;

/**
 * Created by loic on 18/01/15.
 *
 * This class groups the functions required to create bills
 */
public class InvoiceStage extends Stage {
    private ParkingSpot parkingSpot;
    private Invoice invoice;
    
    private Label title;
    private Label price;
    private Label invoiceNumber;
    private Label info;
    private Button ok;

    public InvoiceStage(Window owner, ParkingSpot parkingSpot, Invoice invoice) {
        this.initOwner(owner);
        this.parkingSpot = parkingSpot;
        this.invoice = invoice;

        init();

        BorderPane borderPane = new BorderPane();
        FlowPane flowPane = new FlowPane();

        //add Nodes to FlowPane
        flowPane.getChildren().addAll(
                title,
                invoiceNumber,
                price,
                info,
                ok
        );

        flowPane.setMaxSize(200, 400);

        //add FlowPane
        flowPane.alignmentProperty().setValue(Pos.CENTER);
        borderPane.setCenter(flowPane);

        //create scene
        Scene scene = new Scene(borderPane, 300, 200);

        this.setResizable(false);
        this.setScene(scene);
        this.setTitle("Invoice");
    }
    
    private void init(){
        createTitle();
        createInvoice();
        createInfos();
        createButtonOK();
    }

    private void createTitle() {
        title = new Label("Invoice");
        title.setFont(Font.font("Arial", 50));
        title.setTextFill(Color.BLACK);
        title.alignmentProperty().setValue(Pos.CENTER);
    }
    
    private void createInvoice(){
        price = new Label();
        invoiceNumber = new Label();

        invoiceNumber.setText("Invoice Number : " + invoice.getInvoiceNumber() + '\n');
        price.setText(" - Price : " + invoice.getInvoicePrice() + '\n');
        
        price.alignmentProperty().setValue(Pos.CENTER);
        invoiceNumber.alignmentProperty().setValue(Pos.CENTER);
    }
    
    private void createInfos(){
        info = new Label();
        
        if(parkingSpot.getVehicle() == null)
            info.setText("Information : " + " non disponible " + '\n');
        else
            info.setText("Information : " + parkingSpot.getVehicle() + '\n');

        info.alignmentProperty().setValue(Pos.CENTER);
    }

    private void createButtonOK() {
        ok = new Button();
        ok.setText("Payer");

        //add action
        ok.setOnAction(event -> close());

        //style
        ok.setStyle("-fx-background-color: green");
        ok.setTextFill(Color.WHITE);
    }
    
}

@@ -124,49 +124,9 @@
 rol.
-Button;%0Aimport javafx.scene.control.Label
+*
 ;%0Aim
@@ -812,16 +812,186 @@
 on ok;%0A%0A
+    private RadioButton radioButtonTypeChoiceHTML;%0A    private RadioButton radioButtonTypeChoiceMarkdown;%0A    private CheckBox uploadCheckBox;%0A    private Label choice;%0A%0A
     publ
@@ -1450,16 +1450,162 @@
   info,%0A
+                choice,%0A                radioButtonTypeChoiceHTML,%0A                radioButtonTypeChoiceMarkdown,%0A                uploadCheckBox,%0A
         
@@ -2070,24 +2070,54 @@
 ateInfos();%0A
+        createExportChoice();%0A
         crea
@@ -3096,32 +3096,671 @@
 CENTER);%0A    %7D%0A%0A
+    private void createExportChoice() %7B%0A%0A        choice = new Label();%0A%0A        choice.setText(%22Selectionner le type d'export%22);%0A%0A        ToggleGroup typeChoiceGroup = new ToggleGroup();%0A%0A        radioButtonTypeChoiceHTML = new RadioButton(%22HTML%22);%0A        radioButtonTypeChoiceHTML.setToggleGroup(typeChoiceGroup);%0A        radioButtonTypeChoiceHTML.setSelected(true);%0A%0A%0A        radioButtonTypeChoiceMarkdown = new RadioButton(%22Markdown%22);%0A        radioButtonTypeChoiceMarkdown.setToggleGroup(typeChoiceGroup);%0A%0A        uploadCheckBox = new CheckBox(%22Envoyer sur Internet%22);%0A%0A        choice.alignmentProperty().setValue(Pos.CENTER);%0A    %7D%0A
     private void
@@ -4011,15 +4011,12 @@
 ;%0A    %7D%0A
-    
+%0A
 %0A%7D%0A

Add export selection