package Controllers.Stock;

import Models.Stock.ListeMouvement;
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 PrintMouvementProduitController implements Initializable {
   
    @FXML private Text TextLocale;
    @FXML private Text TextDateDebut;
    @FXML private Text TextReference ;
    @FXML private Text TextDesignation ;
    @FXML private Text TextPagination;
    
    @FXML private TableView<ListeMouvement> TableViewMouvement ;
    @FXML private TableColumn<ListeMouvement, String> TabColCode;
    @FXML private TableColumn<ListeMouvement, String> TabColType;
    @FXML private TableColumn<ListeMouvement, String> TabColMouvement;
    @FXML private TableColumn<ListeMouvement, String> TabColQuantite;
    @FXML private TableColumn<ListeMouvement, String> TabColDate;
    
    /**
     * Initializes the controller class.
     */
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        
        TabColCode.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
        TabColCode.getStyleClass().add("Center");
        TabColCode.setCellValueFactory(new PropertyValueFactory<ListeMouvement, String>("Code"));
        
        TabColType.setCellValueFactory(new PropertyValueFactory<ListeMouvement, String>("Type"));
        
        TabColMouvement.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
        TabColMouvement.getStyleClass().add("Center");
        TabColMouvement.setCellValueFactory(new PropertyValueFactory<ListeMouvement, String>("Mouvement"));
        
        TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
        TabColQuantite.getStyleClass().add("Center");
        TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeMouvement, String>("Quantite"));
        
        TabColDate.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
        TabColDate.getStyleClass().add("Center");
        TabColDate.setCellValueFactory(new PropertyValueFactory<ListeMouvement, String>("Date"));
        
    } 
    
    public void setMouvements(ObservableList<ListeMouvement> listMouvements, String Local, String DateDebut, String Reference, String Designation, String Pagination){
        
        TableViewMouvement.setItems(null);
        TableViewMouvement.setItems(listMouvements);
        
        TextLocale.setText(Local);
        TextDateDebut.setText(DateDebut);
        TextReference.setText(Reference);
        TextDesignation.setText(Designation);
        TextPagination.setText(Pagination);
        
    }
  
    
}
