Skip to content

Commit

Permalink
Merge pull request #6795 from hmislk/Issue#6525
Browse files Browse the repository at this point in the history
Issue#6525 Closes #6525
  • Loading branch information
DeshaniPubudu authored Aug 7, 2024
2 parents 0c2427c + e251fc3 commit 3810e36
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 136 deletions.
12 changes: 11 additions & 1 deletion src/main/java/com/divudi/bean/store/StoreDealorController.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class StoreDealorController implements Serializable {
private InstitutionFacade ejbFacade;
private Institution current;
private List<Institution> items = null;
private int managaeInstitutionIndex = -1;

public List<Institution> completeDealor(String query) {
List<Institution> suggestions;
Expand All @@ -64,7 +65,7 @@ public void prepareAdd() {
current = new Institution();
current.setInstitutionType(InstitutionType.StoreDealor);
}

private void recreateModel() {
items = null;
}
Expand All @@ -81,6 +82,7 @@ public void saveSelected() {
JsfUtil.addSuccessMessage("Saved Successfully");
}
recreateModel();
current = null;
// getItems();
}

Expand Down Expand Up @@ -147,6 +149,14 @@ public List<Institution> getItems() {
return items;
}

public int getManagaeInstitutionIndex() {
return managaeInstitutionIndex;
}

public void setManagaeInstitutionIndex(int managaeInstitutionIndex) {
this.managaeInstitutionIndex = managaeInstitutionIndex;
}

/**
*
*/
Expand Down
21 changes: 8 additions & 13 deletions src/main/webapp/store/store_admin.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

<ui:define name="content">


<p:panel header="Store Administration" >
<div class="row">
<div class="col-3">

<p:accordionPanel>

<p:accordionPanel activeIndex="-1">
<p:ajax process="@this"></p:ajax>
<p:tab title="1) Store Item">
<h:form>
<div class="d-grid gap-2">
Expand Down Expand Up @@ -49,21 +49,18 @@
</h:form>
</p:tab>
<p:tab title="3) Institutions">
<h:form>
<h:form>
<div class="d-grid gap-2">

<p:commandButton styleClass="linkButton" ajax="false" value="1) Distributor" action="store_dealer" ></p:commandButton>
<p:commandButton styleClass="linkButton" ajax="false" value="2) Item Distributors" action="store_items_distributors" ></p:commandButton>

<p:commandButton styleClass="linkButton" ajax="false" value="1) Store Dealer" action="store_dealer?faces-redirect=true" ></p:commandButton>
<p:commandButton styleClass="linkButton" ajax="false" value="2) Item Distributors" action="store_items_distributors?faces-redirect=true" ></p:commandButton>
</div>
</h:form>
</p:tab>
<p:tab title="4) Other">
<h:form>
<div class="d-grid gap-2">
<p:commandButton styleClass="linkButton" ajax="false" value="1) Measurment Units" action="store_measurement_unit" ></p:commandButton>
<p:commandButton styleClass="linkButton" ajax="false" value="2) Frequencies" action="store_frequency_unit" ></p:commandButton>

<p:commandButton styleClass="linkButton" ajax="false" value="1) Measurment Units" action="store_measurement_unit?faces-redirect=true" ></p:commandButton>
<p:commandButton styleClass="linkButton" ajax="false" value="2) Frequencies" action="store_frequency_unit?faces-redirect=true" ></p:commandButton>
</div>
</h:form>
</p:tab>
Expand All @@ -87,8 +84,6 @@
</p:tab>
</p:accordionPanel>



</div>
<div class="col-9">
<ui:insert name="subcontent" >
Expand Down
191 changes: 69 additions & 122 deletions src/main/webapp/store/store_dealer.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,152 +5,99 @@
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns="http://www.w3.org/1999/xhtml"

xmlns:p="http://primefaces.org/ui">


<ui:define name="subcontent">

<h:panelGroup >
<h:form >
<p:growl />
<p:growl id="msg"/>
<p:focus id="selectFocus" context="gpSelect" />
<p:focus id="detailFocus" context="gpDetail" />



<p:panel header="Manage Store Distributor" >
<h:panelGrid id ="gpVeda" columns="2" >

<h:panelGrid id="gpSelect" columns="1" >
<p:panel >
<h:panelGrid id="gpSelectText" columns="1" >
<p:autoComplete id="lstSelect" value="#{storeDealorController.current}"
forceSelection="true"
completeMethod="#{storeDealorController.completeDealor}"
var="vt" itemLabel="#{vt.name}" itemValue="#{vt}" >
<f:ajax event="itemSelect" render="gpDetail gpDetailText smItems" execute="lstSelect" >
</f:ajax>
</p:autoComplete>
<p:selectOneMenu id="smItems" value="#{storeDealorController.current}" >
<f:selectItem itemLabel="Select Distributor" ></f:selectItem>
<f:selectItems value="#{storeDealorController.items}"
var="sd"
itemLabel="#{sd.name}"
itemValue="#{sd}"></f:selectItems>
<f:ajax render="gpDetail gpDetailText lstSelect" execute="smItems" >
</f:ajax>
</p:selectOneMenu>
</h:panelGrid>
<h:panelGrid id="gpSelectButtons" columns="3" >
<h:commandButton id="btnAdd" value="Add" action="#{storeDealorController.prepareAdd()}" styleClass="buttons" >
<f:ajax render="btnAdd btnDelete btnSave lstSelect gpDetail detailFocus gpDetailText" execute="" >
</f:ajax>
</h:commandButton>
<h:commandButton id="btnDelete" onclick="if (!confirm('Are you sure you want to delete this record?'))
return false;" action="#{storeDealorController.delete()}" value="Delete" >
</h:commandButton>
</h:panelGrid>
</p:panel>
</h:panelGrid >

<p:panel>
<h:panelGrid id="gpDetail" columns="1" >
<h:panelGrid id="gpDetailText" columns="2" >
<p:panel header="Manage Store Dealer" >
<div class="d-flex gap-3">
<div class="col-5">
<h:panelGroup id="gpSelect">
<div class="d-flex gap-2 mb-2">
<p:commandButton
id="btnAdd"
value="Add"
class="ui-button-success"
icon="fa fa-plus"
ajax="false"
action="#{storeDealorController.prepareAdd()}" >
</p:commandButton>
<p:commandButton
id="btnDelete"
class="ui-button-danger"
icon="fa fa-trash"
ajax="false"
onclick="if (!confirm('Are you sure you want to delete this record?'))
return false;" action="#{storeDealorController.delete()}"
value="Delete" >
</p:commandButton>
</div>
<p:selectOneListbox
id="smItems"
filter="true"
class="w-100"
value="#{storeDealorController.current}" >
<f:selectItems value="#{storeDealorController.items}"
var="sd"
itemLabel="#{sd.name}"
itemValue="#{sd}"></f:selectItems>
<f:ajax render="gpDetail gpDetailText lstSelect" execute="smItems" >
</f:ajax>
</p:selectOneListbox>
</h:panelGroup>
</div>
<div class="col-7">
<p:panel id="gpDetail" header="Details of the Dealor">
<h:panelGrid id="gpDetailText" columns="2" class="w-100" >
<h:outputText id="lblName" value="Name" ></h:outputText>
<h:inputText autocomplete="off" id="txtName" value="#{storeDealorController.current.name}" ></h:inputText>
<h:outputText id="lblNameC" value="Printing Name" ></h:outputText>
<h:inputText autocomplete="off" id="txtNameC" value="#{storeDealorController.current.chequePrintingName}" ></h:inputText>
<p:inputText autocomplete="off" class="w-100" id="txtName" value="#{storeDealorController.current.name}" ></p:inputText>
<h:outputText id="lblNameC" value="Printing Name" ></h:outputText>
<p:inputText autocomplete="off" class="w-100" id="txtNameC" value="#{storeDealorController.current.chequePrintingName}" ></p:inputText>
<h:outputText id="lblCode" value="Code" ></h:outputText>
<h:inputText autocomplete="off" id="txtCode" value="#{storeDealorController.current.institutionCode}" ></h:inputText>
<p:inputText autocomplete="off" id="txtCode" class="w-100" value="#{storeDealorController.current.institutionCode}" ></p:inputText>
<h:outputText value="Adress" ></h:outputText>
<h:inputText autocomplete="off" value="#{storeDealorController.current.address}" ></h:inputText>
<p:inputText autocomplete="off" class="w-100" value="#{storeDealorController.current.address}" ></p:inputText>
<h:outputText value="Phone" ></h:outputText>
<h:inputText autocomplete="off" value="#{storeDealorController.current.phone}" ></h:inputText>
<p:inputText autocomplete="off" class="w-100" value="#{storeDealorController.current.phone}" ></p:inputText>
<h:outputText value="Mobile" ></h:outputText>
<h:inputText autocomplete="off" value="#{storeDealorController.current.mobile}" ></h:inputText>
<p:inputText autocomplete="off" class="w-100" value="#{storeDealorController.current.mobile}" ></p:inputText>
<h:outputText value="Fax" ></h:outputText>
<h:inputText autocomplete="off" value="#{storeDealorController.current.fax}" ></h:inputText>
<p:inputText autocomplete="off" class="w-100" value="#{storeDealorController.current.fax}" ></p:inputText>
<h:outputText value="E-mail" ></h:outputText>
<h:inputText autocomplete="off" value="#{storeDealorController.current.email}" ></h:inputText>
<p:separator ></p:separator>
<p:separator ></p:separator>
<p:inputText autocomplete="off" class="w-100" value="#{storeDealorController.current.email}" ></p:inputText>

<h:outputText value="Contact Person Name" ></h:outputText>
<h:inputText autocomplete="off" value="#{storeDealorController.current.contactPerson.name}" ></h:inputText>
<p:inputText autocomplete="off" class="w-100" value="#{storeDealorController.current.contactPerson.name}" ></p:inputText>
<h:outputText value="Contact Person Tel" ></h:outputText>
<h:inputText autocomplete="off" value="#{storeDealorController.current.contactPerson.mobile}" ></h:inputText>
<p:inputText autocomplete="off" class="w-100" value="#{storeDealorController.current.contactPerson.mobile}" ></p:inputText>
<h:outputText value="Contact Person Email" ></h:outputText>
<h:inputText autocomplete="off" value="#{storeDealorController.current.contactPerson.email}" ></h:inputText>
<p:inputText autocomplete="off" class="w-100" value="#{storeDealorController.current.contactPerson.email}" ></p:inputText>
</h:panelGrid>
<h:panelGrid id="gpDetailButtons" columns="2">
<h:commandButton id="btnSave" value="Save" action="#{storeDealorController.saveSelected()}" styleClass="buttons">
<f:ajax render="btnAdd btnDelete btnSave lstSelect gpDetail selectFocus" execute="gpDetail" >
</f:ajax>
</h:commandButton>
<p:defaultCommand target="btnSave"/>
<p:commandButton
id="btnSave"
value="Save"
icon="fa fa-save"
style="width: 150px;"
ajax="false"
class="ui-button-warning"
action="#{storeDealorController.saveSelected()}">
</p:commandButton>
</h:panelGrid>
</h:panelGrid>
</p:panel>
</h:panelGrid>
</p:panel>
<p:panel header="Manage Store DistributorS List" id="panelPrint" styleClass="noBorder summeryBorder" >
<p:commandButton ajax="false" value="Print" styleClass="noPrintButton" >
<p:printer target="panelPrint" />
</p:commandButton>
<p:commandButton ajax="false" value="Excel" styleClass="noPrintButton" >
<p:dataExporter type="xlsx" target="tbl1" fileName="Store_Delors" />
</p:commandButton>
<p:dataTable id="tbl1" value="#{storeDealorController.items}" var="d" rowIndexVar="i">
<p:column>
<f:facet name="header" >
<p:outputLabel value="No" />
</f:facet>
<p:outputLabel value="#{i+1}" />
</p:column>
<p:column>
<f:facet name="header" >
<p:outputLabel value="Distributor" />
</f:facet>
<p:outputLabel value="#{d.name}" />
</p:column>
<p:column>
<f:facet name="header" >
<p:outputLabel value="Distributor Printing Name" />
</f:facet>
<p:outputLabel value="#{d.chequePrintingName}" />
</p:column>
<p:column>
<f:facet name="header" >
<p:outputLabel value="Code" />
</f:facet>
<p:outputLabel value="#{d.institutionCode}" />
</p:column>
<p:column>
<f:facet name="header" >
<p:outputLabel value="Address" />
</f:facet>
<p:outputLabel value="#{d.address}" />
</p:column>
<p:column>
<f:facet name="header" >
<p:outputLabel value="Phone" />
</f:facet>
<p:outputLabel value="#{d.phone}" />
</p:column>
<p:column>
<f:facet name="header" >
<p:outputLabel value="Mobile" />
</f:facet>
<p:outputLabel value="#{d.mobile}" />
</p:column>
<p:column>
<f:facet name="header" >
<p:outputLabel value="Email" />
</f:facet>
<p:outputLabel value="#{d.email}" />
</p:column>
</p:dataTable>
</p:panel>
</div>
</div>

</p:panel>

</h:form>

</h:panelGroup>
Expand Down

0 comments on commit 3810e36

Please sign in to comment.