Code: Select all
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core"
template="/WEB-INF/template.xhtml">
<ui:define name="head">
<script>
$(document).ready(function() {
$(".myFavBlock").hide();
$(".showHideFav button").click(function() {
$(".myFavBlock").slideToggle();
});
});
function handleDrop(event, ui) {
var selectedServices = ui.draggable;
selectedServices.fadeOut('fast');
}
</script>
</ui:define>
<ui:define name="title">Patient Registration</ui:define>
<ui:define name="implementation">
<div class="ui-fluid">
<div class="ui-g">
<div class="ui-g-12">
<h:form id="form" enctype="multipart/form-data">
<p:growl id="msgs" showDetail="true" showSummary="false"
sticky="false" />
<div class="card">
<h1>Patient Registration</h1>
</div>
<!-- Available Services Section -->
<div class="card">
<div align="right" class="showHideFav">
Your Favourite List is here
<p:commandButton icon="ui-icon ui-icon-star" style="width:30px;"></p:commandButton>
</div>
<p:fieldset legend="Service Selection / Drag and Drop" id="servicesDraggable">
<div class="favSideHeading">My Favourite Services</div>
<p:dataTable id="favourite"
reflow="true" value="#{registrationBean.favouriteServices}"
var="fav">
<p:column style="width:20px">
<h:outputText id="dragIcon"
styleClass="ui-icon ui-icon-arrow-4" />
<p:draggable for="dragIcon" revert="true" helper="clone"
cursor="move" />
</p:column>
<p:column headerText="Service name">
<p:outputLabel value="#{fav.serviceName}" />
</p:column>
<p:column headerText="Price">
<p:outputLabel value="#{fav.servicePrice}" />
</p:column>
<p:column style="width: 40px;">
<p:commandButton icon="ui-icon ui-icon-trash"
actionListener="#{registrationBean.deleteFavourite}"
process="@this" update="favourite :form:msgs">
<f:attribute name="favId" value="#{fav.id}" />
</p:commandButton>
</p:column>
</p:dataTable>
</p:fieldset>
<p:fieldset id="selecteServices">
<p:outputPanel id="dropArea">
<p:dataTable
reflow="true" value="#{registrationBean.selectedServices}"
var="service" rowIndexVar="rowIndex"
selection="#{registrationBean.selectedPatientServices}"
rowKey="#{service.serviceLabData.serviceHeaderData.serviceId}">
<p:ajax event="rowSelect" update="@parent" />
<p:ajax event="rowUnselect" update="@parent" />
<p:ajax event="rowSelectCheckbox" update="@parent" />
<p:ajax event="rowUnselectCheckbox" update="@parent" />
<p:ajax event="toggleSelect" update="@parent" />
<p:column selectionMode="multiple" style="width:15px;" />
<p:column headerText="#" style="width: 20px">
#{rowIndex+1}
</p:column>
<p:column headerText="Service Name">
<p:outputLabel
value="#{service.serviceLabData.serviceHeaderData.serviceName}" />
</p:column>
<p:column headerText="Fav" style="width: 40px;">
<p:commandButton icon="ui-icon ui-icon-star"
actionListener="#{registrationBean.addFavourite}"
process="@this" update=":form:favourite,:form:msgs">
<f:attribute name="service"
value="#{service.serviceLabData.serviceId}" />
</p:commandButton>
</p:column>
<p:column headerText="Stat"
style="width: 20px;; text-align: center;">
<p:outputLabel value="#{service.status}" />
</p:column>
<p:column headerText="Min Amt."
style="width: 15%; text-align: right">
<p:outputLabel
value="Rs. #{service.serviceLabData.serviceHeaderData.minAmount}" />
</p:column>
<p:column headerText="Price"
style="width: 15%; text-align: right">
<p:outputLabel
value="Rs. #{service.serviceLabData.serviceHeaderData.charge}" />
</p:column>
<p:columnGroup type="footer">
<p:row>
<p:column footerText="Total" colspan="4"
style="text-align:right;" />
<p:column colspan="2"
footerText="Rs. #{registrationBean.serviceMinCharge}"
style="text-align:right;" styleClass="finalPriceMin" />
<p:column colspan="1"
footerText="Rs. #{registrationBean.serviceFullAmount}"
style="text-align:right;" styleClass="finalPriceTotal" />
</p:row>
</p:columnGroup>
<f:facet name="footer">
<p:commandButton icon="ui-icon-trash" value="Delete"
styleClass="deleteServiceButton"
actionListener="#{registrationBean.deleteService}"
disabled="#{empty registrationBean.selectedPatientServices}"
onstart="PF('loaderDialog').show()"
onsuccess="PF('loaderDialog').hide()" process="@this"
update="@parent :form:paymentDT" />
</f:facet>
</p:dataTable>
</p:outputPanel>
</p:fieldset>
<p:droppable for="selecteServices" tolerance="touch"
activeStyleClass="ui-state-highlight" datasource="favourite"
onDrop="handleDrop" id="handleDrop">
<p:ajax listener="#{registrationBean.onSelectedServiceDrop}"
process="@form"
update="dropArea , favourite " />
</p:droppable>
</div>
<p:spacer height="20" />
<!--Payment Section -->
<!-- Action Section -->
<p:spacer height="10" />
</h:form>
</div>
</div>
</div>
</ui:define></ui:composition>