Skip to content

Commit

Permalink
Merge pull request #4675 from hmislk/issue#4674
Browse files Browse the repository at this point in the history
Signed-off-by: Thiwanka Madushan <[email protected]> Closes #4674
  • Loading branch information
DeshaniPubudu authored Apr 22, 2024
2 parents 57d1e9d + 0789a9a commit f921578
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.ejb.EJB;
Expand Down Expand Up @@ -80,30 +81,26 @@ public class UserNotificationController implements Serializable {
@Inject
SmsManagerEjb smsManager;


public String navigateToRecivedNotification() {
return "/Notification/user_notifications";
}

public String navigateToSentNotification() {
return "/Notification/sent_notifications";
}

public void clearCanceledRequestsNotification(){
fillLoggedUserNotifications();
if (items==null) {
return;

public void clearCanceledRequestsNotification() {
if (items == null) {
return ;
}

for (UserNotification item : items) {
if (item.getNotification()==null) {
return;
}
if (item.getNotification().getBill().isCancelled()) {
items.remove(item);
for(UserNotification un : items){
if (un.getNotification().getBill().isCancelled()) {
un.setRetired(true);
un.setRetiredAt(new Date());
getFacade().edit(un);
}
}

fillLoggedUserNotifications();
}

public void save(UserNotification userNotification) {
Expand Down Expand Up @@ -170,17 +167,19 @@ public List<UserNotification> fillLoggedUserNotifications() {
+ " from UserNotification un "
+ " where un.seen=:seen "
+ " and un.webUser=:wu "
+ " and un.notification.completed=:com";
+ " and un.notification.completed=:com"
+ " and un.retired=:ret";
Map m = new HashMap();
m.put("seen", false);
m.put("com", false);
m.put("ret", false);
m.put("wu", sessionController.getLoggedUser());
items = getFacade().findByJpql(jpql, m);
return items;
}

public String navigateToCurrentNotificationRequest(UserNotification un) {
Department toDepartmentFromNotification=un.getNotification().getBill().getToDepartment();
Department toDepartmentFromNotification = un.getNotification().getBill().getToDepartment();
if (!toDepartmentFromNotification.equals(sessionController.getLoggedUser().getDepartment())) {
JsfUtil.addErrorMessage("You can't Access On Current Department !");
return "";
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/divudi/bean/pharmacy/PharmacyBillSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ public class PharmacyBillSearch implements Serializable {
InwardBeanController inwardBean;
@Inject
PharmacySaleController pharmacySaleController;

public String cancelInwardPharmacyRequestBill(){
if (bill==null) {
JsfUtil.addErrorMessage("Not Bill Found !");
return "";
}
CancelledBill cb=pharmacyCreateCancelBill();
cb.setBillItems(getBill().getBillItems());
bill.setCancelled(true);
bill.setCancelledBill(cb);
billFacade.edit(bill);
return "/ward/ward_pharmacy_bht_issue_request_bill_search?faces-redirect=true";
}

public void markAsChecked() {
if (bill == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/Notification/user_notifications.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
action="#{userNotificationController.clearCanceledRequestsNotification()}"/>
</div>
<p:repeat value="#{userNotificationController.items}" var="un">
<div class="row mt-2 shadow-lg" style="#{un.notification.bill.cancelled ? 'background-color: red;' : ''}">
<div class="row mt-2 shadow-lg" style="#{un.notification.bill.cancelled ? 'background-color: #e35656;' : ''}">
<h:panelGroup rendered="#{un.notification.bill.billTypeAtomic eq 'PHARMACY_ORDER'}">
<div class="col-4 bg-success p-2 ">
<div class="d-flex align-items-center justify-content-between">
Expand Down
31 changes: 27 additions & 4 deletions src/main/webapp/ward/ward_pharmacy_reprint_bht_issue_request.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,36 @@
<f:facet name="header" >
<h:outputLabel value="Inward Pharmacy Request Reprint" ></h:outputLabel>
<p:commandButton class="ui-button-secondary mx-2" style="float: right;" icon="fas fa-arrow-left" ajax="false" action="ward_pharmacy_bht_issue_request_bill_search" actionListener="#{pharmacySaleBhtController.makeNullWithFill()}" value="Back"/>

<!--<p:commandButton ajax="false" action="/ward/ward_pharmacy_bht_issue_request_bill_search" value="Requested List"/>-->
<p:commandButton class="ui-button-info" style="float: right;" icon="fas fa-print" value="Reprint" ajax="false" >
<p:printer target="gpBillPreview" ></p:printer>
</p:commandButton>

</f:facet>

<p:commandButton
class="ui-button-warning mx-1"
style="float: right;"
icon="fas fa-pen"
value="Edit Request"
ajax="false">
</p:commandButton>
<p:commandButton
class="ui-button-danger mx-1"
style="float: right;"
icon="fas fa-cancel"
value="Cancel Request"
onclick="PF('confirmationDialog').show();"
>
</p:commandButton>

<p:dialog header="Confirmation" widgetVar="confirmationDialog" modal="true" resizable="false">
<p>Are you sure you want to cancel the request?</p>
<p:inputText value="#{pharmacyBillSearch.comment}" placeholder="Comment"/>
<p:commandButton class="mx-2 ui-button-warning" ajax="false" value="Yes" action="#{pharmacyBillSearch.cancelInwardPharmacyRequestBill()}" onclick="PF('confirmationDialog').hide();" />
<p:commandButton value="No" onclick="PF('confirmationDialog').hide();" />
</p:dialog>

</f:facet>
<p:panel>
<div class="row">
<div class="col-4">
Expand Down Expand Up @@ -59,7 +82,7 @@
</p:selectOneMenu>
<p:commandButton ajax="false" icon="fa fa-sync-alt" class="ui-button " title="Redraw Bill"></p:commandButton>
</div>

<h:panelGroup id="gpBillPreview">
<h:panelGroup id="groupPrint" >
<h:panelGroup rendered="#{sessionController.departmentPreference.inwardServiceBillPaperType eq 'PosPaper'}" >
Expand Down

0 comments on commit f921578

Please sign in to comment.