package Controllers.Caisse;

import Models.Caisse.CaisseEntreListe;
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 CaisseEntrePrintController implements Initializable {
    
    @FXML private Text TextDate; 
    @FXML private Text TextLocal;
    @FXML private Text TextMontant;
    @FXML private Text TextPaiement;
    @FXML private Text TextPage;
    @FXML private Text TextType;
    
    @FXML public TableView<CaisseEntreListe> TableViewCaisseCltEnter ;
    
    @FXML private TableColumn<CaisseEntreListe ,String> TabColIdCaisse;
    @FXML private TableColumn<CaisseEntreListe ,String> TabColType;
    @FXML private TableColumn<CaisseEntreListe ,String> TabColDate;
    @FXML private TableColumn<CaisseEntreListe ,String> TabColMontant;
    @FXML private TableColumn<CaisseEntreListe ,String> TabColChequeClt;
    @FXML private TableColumn<CaisseEntreListe ,String> TabColEspece;
    @FXML private TableColumn<CaisseEntreListe ,String> TabColCateBancaire;
    
    /**
     * Initializes the controller class.
     */
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        
        TabColIdCaisse.setStyle( "-fx-alignment: CENTER;");TabColIdCaisse.getStyleClass().add("Center");
        TabColIdCaisse.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("IdCaisseClt"));
        
        TabColType.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("Type"));
        
        TabColDate.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("Date"));
        
        TabColMontant.setStyle( "-fx-alignment: CENTER;");TabColMontant.getStyleClass().add("Center");
        TabColMontant.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("Montant"));
        
        TabColChequeClt.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("Cheque"));
        
        TabColEspece.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("Espece"));
        
        TabColCateBancaire.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("CateBancaire"));
    }    
    
    
    public void setCaisseEntrePrint(String Date, 
                                String Local, 
                                String Montant, 
                                String Paiement, 
                                String Page, 
                                String Type,
                                ObservableList<CaisseEntreListe> obsListCaisseCltEnter )
    {
        TextDate.setText(Date);
        TextLocal.setText(Local);
        TextMontant.setText(Montant);
        TextPaiement.setText(Paiement);
        TextPage.setText(Page);
        TextType.setText(Type);
        
        TableViewCaisseCltEnter.setItems(obsListCaisseCltEnter);
    }
}
