<p:dialog id="dialogconfirmarvenda" appendTo="@(body)" widgetVar="dcv" closable="true" width="1000" maximizable="true" binding="#{vendaMB.dialogconfirmarvenda}" minimizable="true" position="top">
<p:ajax event="close" listener="#{vendaMB.closeDialog()}" />
<f:facet name="header"><h:outputText value="CONFIRMAR VENDA" style="font-family: sans-serif"/></f:facet>
<h:form id="formfinalizarvenda">
<p:panelGrid id="panelgridconfirmarvenda">
<p:row>
<p:column rendered="#{vendaMB.clienteMB.clienteDAO.cliente != null}"><h:outputText value="Cliente" styleClass="text"/></p:column>
<p:column rendered="#{vendaMB.clienteMB.clienteDAO.cliente != null}"><h:outputText value="#{vendaMB.clienteMB.clienteDAO.cliente.nome}" styleClass="text"/></p:column>
<p:column><h:outputText value="Pagamento" styleClass="text"/></p:column>
<p:column><h:outputText value="#{vendaMB.meioPgtoMB.meioPgtoDAO.meiopgto.descricao}" styleClass="text"/></p:column>
<p:column><h:outputText value="Total da Venda" styleClass="text"/></p:column>
<p:column><h:outputText value="#{vendaMB.totalVenda}" styleClass="text"><f:convertNumber type="currency"/></h:outputText></p:column>
<p:column>
<p:commandButton actionListener="#{vendaMB.finalizarVenda()}" value="Finalizar" oncomplete="PF('dcv').hide()"/>
</p:column>
</p:row>
</p:panelGrid>
<p:spacer height="10" width="800"/>
<p:dataTable id="tableitensvenda" value="#{vendaMB.itemvendaAdds}" var="ivadd">
<p:column headerText="Código"><h:outputText value="#{ivadd.itemvenda.produto.codigo}"/></p:column>
<p:column headerText="Produto"><h:outputText value="#{ivadd.itemvenda.produto.descricao}"/></p:column>
<p:column headerText="Preço">
<h:outputText value="#{ivadd.itemvenda.valor}">
<f:convertNumber type="currency"/>
</h:outputText>
</p:column>
<p:column headerText="Qtd"><h:outputText value="#{ivadd.itemvenda.quantidade}"/></p:column>
<p:column headerText="Total"><h:outputText value="#{ivadd.total}"><f:convertNumber type="currency"/></h:outputText></p:column>
</p:dataTable>
</h:form>
</p:dialog>
This is the dialog for displaying the data for confirmation. The link that opens the dialog:
<p:commandLink value="venda" title="Confirmar Venda" oncomplete="PF('dcv').show()" actionListener="#{vendaMB.confirmarVenda}" />
public void confirmarVenda() {
for (Meiopgto meiopgto : meioPgtoMB.getMeiopgtos()) {
if (meiopgto.getIdmeiopgto().equals(idmeiopgto)) {
meioPgtoMB.getMeioPgtoDAO().setMeiopgto(meiopgto);
break;
}
}
RequestContext.getCurrentInstance().update(Arrays.asList("formvenda", "dialogconfirmarvenda"));
}