package com.ecep.contract.controller.vendor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.ecep.contract.controller.AbstEntityController;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.controller.tab.VendorBidTabSkinBase;
import com.ecep.contract.model.ContractBidVendor;
import com.ecep.contract.service.ContractBidVendorService;
import com.ecep.contract.vm.ContractBidVendorViewModel;

import javafx.scene.control.Button;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.stage.Window;
import javafx.stage.WindowEvent;

@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/contract/vendor-bid.fxml")
public class VendorBidWindowController extends AbstEntityController<ContractBidVendor, ContractBidVendorViewModel> {
    private static final Logger logger = LoggerFactory.getLogger(VendorBidWindowController.class);
    public TabPane tabPane;
    public Tab baseInfoTab;
    public TextField companyField;
    public Button relativeCompanyBtn;
    public TextField fileField;
    public TextArea descriptionField;
    public TextField createdField;
    public DatePicker developDateField;

    public static void show(ContractBidVendorViewModel viewModel, Window window) {
        show(VendorBidWindowController.class, viewModel, window);
    }

    @Override
    public void onShown(WindowEvent windowEvent) {
        super.onShown(windowEvent);
        getTitle().set("[" + viewModel.getId().get() + "] 供应商报价详情");
    }

    @Override
    protected void registerTabSkins() {
        registerTabSkin(baseInfoTab, tab -> new VendorBidTabSkinBase(this));
    }

    @Override
    public ContractBidVendorService getViewModelService() {
        return getCachedBean(ContractBidVendorService.class);
    }
}
