Skip to content

Commit

Permalink
Merge pull request #8746 from hmislk/Isue#8674
Browse files Browse the repository at this point in the history
Isue#8674 Closes #8674
  • Loading branch information
Irani96 authored Nov 14, 2024
2 parents d6dd909 + 7808a44 commit 0424dbf
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public String navigateToManageDepartment() {
return "/admin/institutions/department_management?faces-redirect=true";
}

public String navigateToManageDepartmentAll() {
return "/admin/institutions/department_management_all?faces-redirect=true";
}

public String navigateToManageSite(){
institutionController.fillAllSites();
institutionController.prepareAddSite();
Expand Down
31 changes: 21 additions & 10 deletions src/main/webapp/admin/institutions/admin_institutions_index.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,35 @@
<p:commandButton
styleClass="linkButton"
ajax="false"
value="Manage Departments"
value="Manage Departments (Own)"
action="#{navigationController.navigateToManageDepartment()}"
actionListener="#{departmentController.fillSearchItems()}" icon="fas fa-building"/>


<p:commandButton
styleClass="linkButton"
ajax="false"
value="Manage Departments (All)"
action="#{navigationController.navigateToManageDepartmentAll()}"
actionListener="#{departmentController.fillSearchItems()}" icon="fas fa-building"/>


<p:commandButton
styleClass="linkButton"
ajax="false"
value="Manage Sites"
action="#{navigationController.navigateToManageSite()}"
actionListener="#{departmentController.fillSearchItems()}" icon="fas fa-building"/>
<p:commandButton styleClass="linkButton"
action="#{institutionController.toListInstitutions()}"
icon="bi bi-list" value="List Institutions">
actionListener="#{departmentController.fillSearchItems()}"
icon="fas fa-building"/>
<p:commandButton
styleClass="linkButton"
action="#{institutionController.toListInstitutions()}"
icon="bi bi-list" value="List Institutions">
</p:commandButton>
<p:commandButton styleClass="linkButton"
action="#{departmentController.toListDepartments()}"
icon="bi bi-list"
value="List Departments">
<p:commandButton
styleClass="linkButton"
action="#{departmentController.toListDepartments()}"
icon="bi bi-list"
value="List Departments">
</p:commandButton>
<p:commandButton styleClass="linkButton" icon="bi bi-building-fill" ajax="false" value="Institution Branch" action="#{navigationController.navigateToInstitutionBranch()}" />
<p:commandButton styleClass="linkButton" ajax="false" value="Collecting Centres" icon="fa-solid fa-warehouse" action="#{navigationController.navigateToCollectingCenter()}" />
Expand Down
206 changes: 206 additions & 0 deletions src/main/webapp/admin/institutions/department_management_all.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
template="/admin/institutions/admin_institutions_index.xhtml"
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="admin">

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

<p:panel header="Manage Departments">
<div class="row">
<div class="col-md-5">

<p:commandButton
id="btnAdd"
value="Add New"
action="#{departmentController.prepareAdd()}"
class="ui-button-success"
update="lstSelect gpDetail"
icon="fa fa-plus"
process="btnAdd">
</p:commandButton>

<p:commandButton id="btnDelete"
icon="fa fa-trash"
onclick="if (!confirm('Are you sure you want to delete this record?'))
return false;"
action="#{departmentController.delete()}"
value="Delete"
update="lstSelect gpDetail msg" process="btnDelete"
class=" m-1 ui-button-danger w-25"
>
</p:commandButton>

<!-- <p:inputText value="#{departmentController.selectText}" id="txtSearch" style="standardText" >
<f:ajax event="keyup" execute="@this" render="lstSelect" listener="#{departmentController.fillSearchItems()}" ></f:ajax>
</p:inputText>-->

<p:selectOneListbox id="lstSelect"
value="#{departmentController.current}"
style="w-100"
filter="true">
<f:selectItems value="#{departmentController.selectedItems}"
var="myItem"
itemValue="#{myItem}"
itemLabel="#{myItem.name}" ></f:selectItems>
<p:ajax update="gpDetail" process="lstSelect" >
</p:ajax>
</p:selectOneListbox>


</div>

<div class="col-md-7">
<p:panel class="w-100" id="gpDetail" >
<f:facet name="header" >
<h:outputLabel value="Details of the Department" class="mr-5"></h:outputLabel>
<p:spacer width="50" ></p:spacer>
<p:commandButton
id="btnSave"
value="Save"
action="#{departmentController.saveSelected()}"
process="btnSave gpDetail"
update="lstSelect msg"
class="ml-5 m-1 ui-button-warning float-right"
icon="fas fa-save">
</p:commandButton>

</f:facet>


<p:tabView class="w-100">
<p:tab title="Basic Details" class="w-100" >

<h:panelGrid id="gpDetailText" columns="2" class="w-100">
<h:outputText id="lblName" value="Name" ></h:outputText>
<p:inputText autocomplete="off"
id="txtName" value="#{departmentController.current.name}"
class="w-100"></p:inputText>
<h:outputText id="lblTName" value="Code" ></h:outputText>
<p:inputText autocomplete="off"
id="txtTName" value="#{departmentController.current.code}"
class="w-100">
</p:inputText>

<h:outputText value="Income Name" />
<p:inputText autocomplete="off"
class="w-100"
value="#{departmentController.current.departmentCode}" />


<h:outputText value="Department Code" />
<p:inputText autocomplete="off" class="w-100" value="#{departmentController.current.departmentCode}" />

<h:outputText id="lblDept" value="Department Type"></h:outputText>
<!-- <h:outputText id="lblDeptTem" value="Department Type" rendered="#{departmentController.current eq null}" ></h:outputText>-->
<p:selectOneMenu class="w-100" id="cmbDept" filter="true" filterMatchMode="contains" value="#{departmentController.current.departmentType}">
<f:selectItem itemLabel="Select the Department Type" />
<f:selectItems value="#{departmentController.departmentType}"/>
</p:selectOneMenu>

<h:outputText id="lblIns" value="Institution" ></h:outputText>
<p:autoComplete
id="acIns"
class="w-100"
inputStyleClass="w-100"
completeMethod="#{institutionController.completeIns}"
var="pta"
itemLabel="#{pta.name}"
itemValue="#{pta}"
forceSelection="true"
value="#{departmentController.current.institution}" >
<p:ajax process="acIns" update="cmbSupDept"/>
</p:autoComplete>



<h:outputText id="lblsupDept" value="Super Depatment" ></h:outputText>
<h:panelGroup id="cmbSupDept">
<p:selectOneMenu
rendered="#{departmentController.current.institution ne null}"
class="w-100"
value="#{departmentController.current.superDepartment}">
<f:selectItem itemLabel="Select the Department" />
<f:selectItems value="#{departmentController.getInstitutionDepatrments(departmentController.current.institution)}"/>
</p:selectOneMenu>
</h:panelGroup>

<h:outputText id="lblSite" value="Site" ></h:outputText>
<p:autoComplete
id="acSite"
class="w-100"
inputStyleClass="w-100"
completeMethod="#{institutionController.completeSite}"
var="site"
itemLabel="#{site.name}"
itemValue="#{site}"
forceSelection="true"
value="#{departmentController.current.site}" >
</p:autoComplete>


</h:panelGrid>

</p:tab>

<p:tab title="Contact Details" >
<h:panelGrid columns="2" class="w-100" >
<h:outputText value="Printing Name" ></h:outputText>
<p:inputText autocomplete="off" class="w-100"
value="#{departmentController.current.printingName}" ></p:inputText>
<h:outputText value="Address" ></h:outputText>
<p:inputTextarea class="w-100" value="#{departmentController.current.address}" ></p:inputTextarea>
<h:outputText value="Tel. No. 1" ></h:outputText>
<p:inputText class="w-100" autocomplete="off" value="#{departmentController.current.telephone1}" ></p:inputText>
<h:outputText value="Tel. No. 2" ></h:outputText>
<p:inputText class="w-100" autocomplete="off" value="#{departmentController.current.telephone2}" ></p:inputText>
<h:outputText value="Fax" ></h:outputText>
<p:inputText class="w-100" autocomplete="off" value="#{departmentController.current.fax}" ></p:inputText>
<h:outputText value="Email" ></h:outputText>
<p:inputText class="w-100" autocomplete="off" value="#{departmentController.current.email}" ></p:inputText>

</h:panelGrid>
</p:tab>

<p:tab title="Pricing Details" class="w-100">
<h:panelGrid columns="2" class="w-100">
<h:outputText value="OPD Margin Percenttage " />
<p:inputText class="w-100" autocomplete="off" value="#{departmentController.current.margin}" />
<h:outputText value="Pharmacy Margin Percentage " />
<p:inputText class="w-100" autocomplete="off" value="#{departmentController.current.pharmacyMarginFromPurchaseRate}" />

</h:panelGrid>
</p:tab>
<p:tab title="Editing Details" class="w-100" >
<h:panelGrid columns="2" class="w-100" >
<h:outputText id="lblcre" value="Creator" ></h:outputText>
<p:outputLabel class="w-100" value="#{institutionController.current.creater.webUserPerson.name}"/>

</h:panelGrid>
</p:tab>
</p:tabView>


</p:panel>
</div>
</div>
</p:panel>

</h:form>

</h:panelGroup>

</ui:define>

</ui:composition>

0 comments on commit 0424dbf

Please sign in to comment.