package com.ecep.contract.controller.contract;

import org.springframework.stereotype.Component;

import com.ecep.contract.controller.AbstEntityController;
import com.ecep.contract.controller.tab.ContractInvoiceTabSkinBase;
import com.ecep.contract.service.ContractInvoiceService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.ContractInvoiceViewModel;
import com.ecep.contract.vo.ContractInvoiceVo;

import javafx.collections.ObservableList;
import javafx.scene.control.Button;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.stage.Window;

@FxmlPath("/ui/contract/contract-invoice.fxml")
@Component
public class ContractInvoiceWindowController
        extends AbstEntityController<ContractInvoiceVo, ContractInvoiceViewModel> {

    public static void show(ContractInvoiceViewModel viewModel, Window owner) {
        show(ContractInvoiceWindowController.class, viewModel, owner);
    }

    public Tab baseInfoTab;
    public TextField codeField;
    public TextField nameField;
    public TextField invoiceField;
    public TextField amountField;
    public TextArea remarkField;
    public Button saveBtn;
    public Button cancelBtn;

    @Override
    public ContractInvoiceService getViewModelService() {
        return getBean(ContractInvoiceService.class);
    }

    @Override
    protected void registerTabSkins() {
        TabPane tabPane = baseInfoTab.getTabPane();
        ObservableList<Tab> tabs = tabPane.getTabs();
        registerTabSkin(baseInfoTab, tab -> new ContractInvoiceTabSkinBase(this));
    }

}