package com.ecep.contract.controller.vendor.approved_list;

import java.time.LocalDate;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.ecep.contract.controller.AbstManagerWindowController;
import com.ecep.contract.service.VendorApprovedService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vo.VendorApprovedVo;
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;

import javafx.event.ActionEvent;
import javafx.scene.control.TableColumn;
import javafx.stage.WindowEvent;

/**
 *
 */
@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/company/vendor/vendor_approved_list_manager.fxml")
public class VendorApprovedListManagerWindowController
        extends AbstManagerWindowController<VendorApprovedVo, CompanyVendorApprovedListViewModel, VendorApprovedListManagerSkin> {

    public TableColumn<CompanyVendorApprovedListViewModel, Number> idColumn;
    public TableColumn<CompanyVendorApprovedListViewModel, String> titleColumn;
    public TableColumn<CompanyVendorApprovedListViewModel, LocalDate> publishDateColumn;
    public TableColumn<CompanyVendorApprovedListViewModel, String> descriptionColumn;

    @Autowired
    private VendorApprovedService service;

    @Override
    protected VendorApprovedListManagerSkin createDefaultSkin() {
        VendorApprovedListManagerSkin skin = new VendorApprovedListManagerSkin(this);
        skin.setService(service);
        return skin;
    }

    @Override
    public void onShown(WindowEvent windowEvent) {
        super.onShown(windowEvent);
        getTitle().set("供应商名录管理");
    }

    @Override
    public VendorApprovedService getViewModelService() {
        return service;
    }


    public void onCreateNewAction(ActionEvent event) {
        getSkin().onTableCreateNewAction(event);
    }
}
