<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.control.Spinner?>
<?import javafx.scene.control.ToggleButton?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.control.Separator?>
<?import tornadofx.control.DateTimePicker?>
<?import tornadofx.control.Form?>
<?import tornadofx.control.Fieldset?>
<?import tornadofx.control.Field?>
<?import org.controlsfx.control.SegmentedButton?>
<?import com.sparrowwallet.sparrow.control.CopyableLabel?>
<?import com.sparrowwallet.sparrow.control.IdLabel?>
<?import com.sparrowwallet.sparrow.control.CoinLabel?>
<?import javafx.scene.control.Button?>
<?import org.controlsfx.glyphfont.Glyph?>

<GridPane hgap="10.0" vgap="10.0" styleClass="tx-pane" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.HeadersController" stylesheets="@headers.css, @transaction.css, @../general.css">
   <padding>
      <Insets left="25.0" right="25.0" top="25.0" />
   </padding>
    <columnConstraints>
        <ColumnConstraints percentWidth="50" />
        <ColumnConstraints percentWidth="50" />
    </columnConstraints>
   <rowConstraints>
      <RowConstraints />
   </rowConstraints>
    <Form GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2">
        <Fieldset text="Transaction" inputGrow="SOMETIMES" wrapWidth="620">
            <Field text="Txid:" styleClass="label-button">
                <IdLabel fx:id="id"/>
                <Button maxWidth="25" minWidth="-Infinity" prefWidth="30" text="Cy" onAction="#copyId">
                    <graphic>
                        <Glyph fontFamily="FontAwesome" icon="COPY" prefWidth="15" />
                    </graphic>
                </Button>
            </Field>
        </Fieldset>
    </Form>

    <Separator GridPane.columnIndex="0" GridPane.rowIndex="1" GridPane.columnSpan="2" styleClass="form-separator"/>

    <Form GridPane.columnIndex="0" GridPane.rowIndex="2">
        <Fieldset text="Headers" inputGrow="SOMETIMES">
            <Field text="Version:">
                <Spinner fx:id="version" prefWidth="60" editable="true" />
            </Field>
            <Field text="Type:">
                <CopyableLabel fx:id="segwit" />
            </Field>
        </Fieldset>
    </Form>

    <Form GridPane.columnIndex="1" GridPane.rowIndex="2">
        <Fieldset fx:id="locktimeFieldset" text="Absolute Locktime" inputGrow="SOMETIMES">
            <Field text="Type:">
                <SegmentedButton>
                    <toggleGroup>
                        <ToggleGroup fx:id="locktimeToggleGroup" />
                    </toggleGroup>
                    <buttons>
                        <ToggleButton fx:id="locktimeNoneType" text="Disabled" userData="none" toggleGroup="$locktimeToggleGroup" />
                        <ToggleButton fx:id="locktimeBlockType" text="Block" userData="block" toggleGroup="$locktimeToggleGroup" />
                        <ToggleButton fx:id="locktimeDateType" text="Date" userData="date" toggleGroup="$locktimeToggleGroup" />
                    </buttons>
                </SegmentedButton>
            </Field>
            <Field fx:id="locktimeNoneField" text="Block:">
                <Spinner fx:id="locktimeNone" disable="true" prefWidth="120"/>
            </Field>
            <Field fx:id="locktimeBlockField" text="Block:">
                <Spinner fx:id="locktimeBlock" editable="true" prefWidth="120"/>
            </Field>
            <Field fx:id="locktimeDateField" text="Date:">
                <DateTimePicker fx:id="locktimeDate" prefWidth="180"/>
            </Field>
        </Fieldset>
    </Form>

    <Separator GridPane.columnIndex="0" GridPane.rowIndex="3" GridPane.columnSpan="2" styleClass="form-separator"/>

    <Form GridPane.columnIndex="0" GridPane.rowIndex="4">
        <Fieldset text="Size" inputGrow="SOMETIMES">
            <Field text="Bytes:">
                <CopyableLabel fx:id="size" />
            </Field>
            <Field text="vBytes:">
                <CopyableLabel fx:id="virtualSize" />
            </Field>
        </Fieldset>
    </Form>

    <Form GridPane.columnIndex="1" GridPane.rowIndex="4">
        <Fieldset text="Fee" inputGrow="SOMETIMES">
            <Field text="Amount:">
                <CoinLabel fx:id="fee" />
            </Field>
            <Field text="Rate:">
                <CopyableLabel fx:id="feeRate" />
            </Field>
        </Fieldset>
    </Form>

    <Separator GridPane.columnIndex="0" GridPane.rowIndex="5" GridPane.columnSpan="2" styleClass="form-separator"/>

    <Form fx:id="blockchainForm" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="6">
        <Fieldset text="Blockchain" inputGrow="SOMETIMES">
            <Field text="Status:">
                <CopyableLabel fx:id="blockStatus" />
            </Field>
            <Field text="Block Height:">
                <CopyableLabel fx:id="blockHeight" />
            </Field>
            <Field text="Timestamp:">
                <CopyableLabel fx:id="blockTimestamp" />
            </Field>
            <Field text="Block Hash:">
                <IdLabel fx:id="blockHash" />
            </Field>
        </Fieldset>
    </Form>

</GridPane>
