/*
 * Arrebol Consultancy copyright.
 * 
 * This code belongs to Arrebol Consultancy
 * its use, redistribution or modification are prohibited 
 * without written authorization from Arrebol Consultancy.
 */
package com.arrebol.apc.web.beans.admin;

import com.arrebol.apc.controller.admin.ClosingDayController;
import com.arrebol.apc.model.admin.ClosingDay;
import com.arrebol.apc.model.admin.ClosingDayDetail;
import com.arrebol.apc.web.beans.Datatable;
import com.arrebol.apc.web.beans.GenericBean;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import org.primefaces.event.ReorderEvent;
import org.primefaces.event.RowEditEvent;

/**
 *
 * @author Oscar Armando Vargas Cardenas <oscar.vargas@arrebol.com.mx>
 */
@Named("closingDayDetailManager")
@ViewScoped
public class ClosingDayDetailBean extends GenericBean implements Serializable, Datatable{

    @Override
    public void editRow(RowEditEvent event) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void onRowCancel(RowEditEvent event) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void onRowReorder(ReorderEvent event) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void addRow() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void deleteRow() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public ClosingDayController getClosingDayCtrl() {
        return closingDayCtrl;
    }

    public void setClosingDayCtrl(ClosingDayController closingDayCtrl) {
        this.closingDayCtrl = closingDayCtrl;
    }

    public String getClosingDayId() {
        return closingDayId;
    }

    public void setClosingDayId(String closingDayId) {
        this.closingDayId = closingDayId;
    }

    public ClosingDay getClosingDay() {
        return closingDay;
    }

    public void setClosingDay(ClosingDay closingDay) {
        this.closingDay = closingDay;
    }

    public List<ClosingDayDetail> getClosingDayDetail() {
        return closingDayDetail;
    }

    public void setClosingDayDetail(List<ClosingDayDetail> closingDayDetail) {
        this.closingDayDetail = closingDayDetail;
    }
    
    private ClosingDayController closingDayCtrl;
    private String closingDayId;
    private ClosingDay closingDay;
    private List<ClosingDayDetail> closingDayDetail;
    
    @PostConstruct
    public void init() {
        closingDayCtrl = new ClosingDayController();
        setClosingDayId(externalContext().getRequestParameterMap().get("form:dtClosingDay_selection"));
        setClosingDay(closingDayCtrl.getClosingDayById(closingDayId));
        setClosingDayDetail(closingDayCtrl.getClosingDayDetailByIdClosingDay(getClosingDayId()));
    }
}
