package Controllers.ChequeClt;

import Models.ChequeClt.ChequeCltGestionListe;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.text.Text;

/**
 * FXML Controller class
 * @author Maher Ben Tili
 */
public class ChequeCltProvisionPrintController implements Initializable {
    
    @FXML private Text TextNbr ;
    @FXML private Text TextPage ;
    
    @FXML private TableView<ChequeCltGestionListe> TableViewChequeCltProvision ;
    
    @FXML private TableColumn<ChequeCltGestionListe ,String> TabColNumeroCheque;
    @FXML private TableColumn<ChequeCltGestionListe ,String> TabColBanque;
    @FXML private TableColumn<ChequeCltGestionListe ,String> TabColDateCheque;
    @FXML private TableColumn<ChequeCltGestionListe ,String> TabColMontant;
    @FXML private TableColumn<ChequeCltGestionListe ,String> TabColNomClt;
    @FXML private TableColumn<ChequeCltGestionListe ,String> TabColPrenomClt;
    @FXML private TableColumn<ChequeCltGestionListe ,String> TabColLocal;
    
    /**
     * Initializes the controller class.
     */
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        
        TabColNumeroCheque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("NumeroCheque"));
        TabColNumeroCheque.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
        TabColNumeroCheque.getStyleClass().add("Center");
        
        TabColBanque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Banque"));
        TabColBanque.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
        TabColBanque.getStyleClass().add("Center");
        
        TabColDateCheque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("DateCheque"));
        TabColDateCheque.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
        TabColDateCheque.getStyleClass().add("Center");
        
        TabColMontant.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Montant"));
        TabColMontant.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
        TabColMontant.getStyleClass().add("Center");
        
        TabColNomClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("NomClt"));
        TabColNomClt.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
        TabColNomClt.getStyleClass().add("Center");
        
        TabColPrenomClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("PrenomClt"));
        TabColPrenomClt.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
        TabColPrenomClt.getStyleClass().add("Center");
        
        TabColLocal.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("etat"));
        TabColLocal.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
        TabColLocal.getStyleClass().add("Center");
    }    
    
    public void setChequeCltProvision(
            String Nbr, 
            String Page, 
            ObservableList<ChequeCltGestionListe> obsListChequeCltListe)
    {
        TextNbr.setText(Nbr);
        TextPage.setText(Page);
        TableViewChequeCltProvision.setItems(obsListChequeCltListe);
    }
}
