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

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<VBox minHeight="-Infinity" minWidth="-Infinity" prefHeight="720.0" prefWidth="920.0" spacing="22.0" style="-fx-font-size: 14px;" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.example.petshopdesktop.controllers.dialogcontrollers.RefundDialogController">
   <padding>
      <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
   </padding>
   <children>
      <HBox alignment="CENTER_LEFT" spacing="20.0" style="-fx-background-color: #FF6b6b; -fx-background-radius: 14;">
         <padding>
            <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
         </padding>
         <children>
            <VBox alignment="CENTER_LEFT">
               <children>
                  <Label text="Process Refund" textFill="WHITE">
                     <font>
                        <Font name="Comic Sans MS Bold" size="30.0" />
                     </font>
                  </Label>
               </children>
            </VBox>
            <Region HBox.hgrow="ALWAYS" />
            <Button fx:id="btnCancel" mnemonicParsing="false" onAction="#btnCancelClicked" style="-fx-background-color: #E74c3c; -fx-cursor: hand; -fx-background-radius: 8;" text="Cancel" textFill="WHITE">
               <font>
                  <Font name="System Bold" size="14.0" />
               </font>
               <padding>
                  <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
               </padding>
            </Button>
         </children>
      </HBox>

      <VBox spacing="15.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-color: #FF6b6b; -fx-border-radius: 14;">
         <padding>
            <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
         </padding>
         <children>
            <Label text="Load Sale" textFill="#2c3e50">
               <font>
                  <Font name="System Bold" size="18.0" />
               </font>
            </Label>
            <HBox alignment="CENTER_LEFT" spacing="10.0">
               <children>
                  <Label text="Transaction ID:" textFill="#2c3e50">
                     <font>
                        <Font name="System Bold" size="14.0" />
                     </font>
                  </Label>
                  <TextField fx:id="txtSaleId" prefWidth="150.0" promptText="Enter sale ID" style="-fx-border-color: #E8EBED; -fx-border-width: 2; -fx-border-radius: 10; -fx-background-radius: 10;">
                     <padding>
                        <Insets bottom="7.0" left="10.0" right="10.0" top="7.0" />
                     </padding>
                  </TextField>
                  <Button fx:id="btnLoadSale" mnemonicParsing="false" onAction="#btnLoadSaleClicked" style="-fx-background-color: #4ECDC4; -fx-cursor: hand; -fx-background-radius: 8;" text="Load Sale" textFill="WHITE">
                     <font>
                        <Font name="System Bold" size="13.0" />
                     </font>
                     <padding>
                        <Insets bottom="8.0" left="18.0" right="18.0" top="8.0" />
                     </padding>
                  </Button>
               </children>
            </HBox>
            <Label fx:id="lblSaleInfo" text="" textFill="#7f8c8d">
               <font>
                  <Font size="14.0" />
               </font>
            </Label>
         </children>
      </VBox>

       <VBox spacing="18.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-color: #FF6b6b; -fx-border-radius: 14;" VBox.vgrow="ALWAYS">
          <padding>
             <Insets bottom="18.0" left="18.0" right="18.0" top="18.0" />
          </padding>
          <children>
             <HBox alignment="CENTER_LEFT" spacing="14.0">
                <children>
                   <Label text="Original Items" textFill="#2c3e50">
                     <font>
                        <Font name="System Bold" size="16.0" />
                     </font>
                  </Label>
                  <Region HBox.hgrow="ALWAYS" />
                  <Button fx:id="btnAddToRefund" mnemonicParsing="false" onAction="#btnAddToRefundClicked" style="-fx-background-color: #FF6b6b; -fx-cursor: hand; -fx-background-radius: 8;" text="Add to Refund" textFill="WHITE">
                     <font>
                        <Font name="System Bold" size="13.0" />
                     </font>
                     <padding>
                        <Insets bottom="8.0" left="18.0" right="18.0" top="8.0" />
                     </padding>
                  </Button>
               </children>
            </HBox>
             <TableView fx:id="tvOriginalItems" prefHeight="190.0" style="-fx-background-color: white; -fx-background-radius: 10; -fx-border-color: #E8EBED; -fx-border-radius: 10;">
                <columns>
                   <TableColumn fx:id="colOriginalProduct" prefWidth="430.0" text="Product Name" />
                   <TableColumn fx:id="colOriginalQuantity" prefWidth="140.0" text="Quantity" />
                   <TableColumn fx:id="colOriginalUnitPrice" prefWidth="170.0" text="Unit Price" />
                   <TableColumn fx:id="colOriginalTotal" prefWidth="170.0" text="Total" />
                </columns>
             </TableView>

             <Separator />

             <HBox alignment="CENTER_LEFT" spacing="14.0">
                <children>
                   <Label text="Refund Items" textFill="#2c3e50">
                     <font>
                        <Font name="System Bold" size="16.0" />
                     </font>
                  </Label>
                  <Region HBox.hgrow="ALWAYS" />
                  <Button fx:id="btnRemoveFromRefund" mnemonicParsing="false" onAction="#btnRemoveFromRefundClicked" style="-fx-background-color: #34495E; -fx-cursor: hand; -fx-background-radius: 8;" text="Remove Selected" textFill="WHITE">
                     <font>
                        <Font name="System Bold" size="13.0" />
                     </font>
                     <padding>
                        <Insets bottom="8.0" left="18.0" right="18.0" top="8.0" />
                     </padding>
                  </Button>
               </children>
            </HBox>
             <TableView fx:id="tvRefundItems" prefHeight="190.0" style="-fx-background-color: white; -fx-background-radius: 10; -fx-border-color: #E8EBED; -fx-border-radius: 10;" VBox.vgrow="ALWAYS">
                <columns>
                   <TableColumn fx:id="colRefundProduct" prefWidth="430.0" text="Product Name" />
                   <TableColumn fx:id="colRefundQuantity" prefWidth="140.0" text="Quantity" />
                   <TableColumn fx:id="colRefundUnitPrice" prefWidth="170.0" text="Unit Price" />
                   <TableColumn fx:id="colRefundTotal" prefWidth="170.0" text="Total" />
                </columns>
             </TableView>
          </children>
       </VBox>

      <VBox spacing="12.0" style="-fx-background-color: white; -fx-background-radius: 14; -fx-border-width: 2; -fx-border-color: #FF6b6b; -fx-border-radius: 14;">
         <padding>
            <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
         </padding>
         <children>
            <HBox alignment="CENTER_LEFT" spacing="15.0">
               <children>
                  <Label text="Payment Method:" textFill="#2c3e50">
                     <font>
                        <Font name="System Bold" size="14.0" />
                     </font>
                  </Label>
                  <ComboBox fx:id="cbPaymentMethod" prefWidth="160.0" style="-fx-border-color: #E8EBED; -fx-border-width: 2; -fx-border-radius: 10; -fx-background-radius: 10; -fx-background-color: white;">
                     <padding>
                        <Insets bottom="3.0" left="10.0" right="10.0" top="3.0" />
                     </padding>
                  </ComboBox>
                  <Region HBox.hgrow="ALWAYS" />
                  <VBox spacing="2.0" alignment="CENTER_RIGHT">
                     <children>
                        <HBox spacing="8.0" alignment="CENTER_RIGHT">
                           <children>
                              <Label text="Items Subtotal:" textFill="#2c3e50"><font><Font size="12.0" /></font></Label>
                              <Label fx:id="lblRefundSubtotal" text="" textFill="#2c3e50"><font><Font size="12.0" /></font></Label>
                           </children>
                        </HBox>
                        <HBox fx:id="hbRefundCouponDiscount" spacing="8.0" alignment="CENTER_RIGHT" visible="false" managed="false">
                           <children>
                              <Label text="Coupon Discount:" textFill="#27ae60"><font><Font size="12.0" /></font></Label>
                              <Label fx:id="lblRefundCouponDiscount" text="" textFill="#27ae60"><font><Font size="12.0" /></font></Label>
                           </children>
                        </HBox>
                        <HBox fx:id="hbRefundLoyaltyDiscount" spacing="8.0" alignment="CENTER_RIGHT" visible="false" managed="false">
                           <children>
                              <Label text="Loyalty Discount:" textFill="#27ae60"><font><Font size="12.0" /></font></Label>
                              <Label fx:id="lblRefundLoyaltyDiscount" text="" textFill="#27ae60"><font><Font size="12.0" /></font></Label>
                           </children>
                        </HBox>
                        <HBox spacing="8.0" alignment="CENTER_RIGHT">
                           <children>
                              <Label text="Refund Total:" textFill="#2c3e50"><font><Font name="System Bold" size="14.0" /></font></Label>
                              <Label fx:id="lblRefundTotal" text="" textFill="#FF6b6b"><font><Font name="System Bold" size="18.0" /></font></Label>
                           </children>
                        </HBox>
                     </children>
                  </VBox>
                  <Region prefWidth="20.0" />
                  <Button fx:id="btnProcessRefund" mnemonicParsing="false" onAction="#btnProcessRefundClicked" style="-fx-background-color: #FF6b6b; -fx-cursor: hand; -fx-background-radius: 8;" text="Process Refund" textFill="WHITE">
                     <font>
                        <Font name="System Bold" size="14.0" />
                     </font>
                     <padding>
                        <Insets bottom="12.0" left="24.0" right="24.0" top="12.0" />
                     </padding>
                  </Button>
               </children>
            </HBox>
         </children>
      </VBox>
   </children>
</VBox>
