Skip to content

Commit

Permalink
Merge branch 'develop' into OP-1199-Main-Store-Inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
mwithi committed Nov 18, 2024
2 parents b5ed784 + f4b07db commit c0109a3
Show file tree
Hide file tree
Showing 20 changed files with 313 additions and 330 deletions.
8 changes: 7 additions & 1 deletion bundle/language_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ angal.common.days.txt
angal.common.delete = Delete
angal.common.delete.btn = Delete
angal.common.delete.btn.key = D
angal.common.deleted.col = Deleted
angal.common.deleted.label = Deleted
angal.common.denied.msg = This operation is not allowed.
angal.common.description.txt = Description
angal.common.discharge.txt = Discharge
angal.common.documenthasnopages.msg = The document has no pages.
Expand Down Expand Up @@ -634,6 +637,7 @@ angal.exatype.examtypebrowser.title
angal.exatype.newexamtype.title = New Exam Type
angal.genericreportbill.doyouwanttoprintreceipt.msg = Do you want to print a receipt?
angal.groupsbrowser.deletegroup.fmt.msg = Delete group: {0}?
angal.groupsbrowser.softdeletegroup.fmt.msg = Could not delete the group '{0}' because it is used somewhere. Do you want to mark it as deleted ?
angal.groupsbrowser.description.label = Description:
angal.groupsbrowser.editgroup.title = Edit Group
angal.groupsbrowser.groupmenu.btn = GroupMenu
Expand All @@ -643,6 +647,7 @@ angal.groupsbrowser.mainmenu.txt
angal.groupsbrowser.menuitembrowser.title = Menu Item Browser
angal.groupsbrowser.newgroup.title = New Group
angal.groupsbrowser.pleaseinsertavalidusergroupname.msg = Please insert a valid user group name.
angal.groupsbrowser.alreadysoftdeleted.msg = The group is already set as deleted.
angal.groupsbrowser.theadmingroupcannotbedeleted.msg = The "admin" group cannot be deleted.
angal.groupsbrowser.thegroupalreadyexists.fmt.msg = The group "{0}" already exists.
angal.groupsbrowser.thisgrouphasusersandcannotbedeleted.msg = This group has users and cannot be deleted.
Expand Down Expand Up @@ -1698,7 +1703,6 @@ angal.stat.weeklyepidemsurveilover5
angal.stat.weeklyepidemsurveilunder5 = HMIS 33b - Weekly epidem. surveil. under 5 y.o.
angal.stat.year = Year
angal.supplier.deleted = Deleted
angal.supplier.deleted.col = Deleted
angal.supplier.deletesupplier.fmt.msg = Delete supplier: {0}?
angal.supplier.editsupplier.title = Edit Supplier
angal.supplier.email = E-mail
Expand Down Expand Up @@ -1790,6 +1794,7 @@ angal.therapy.worksheet.btn
angal.therapy.worksheet.btn.key = W
angal.userbrowser.addnewuser.title = Add New User
angal.userbrowser.deleteuser.fmt.msg = Delete user: {0}?
angal.userbrowser.softdeleteuser.fmt.msg = Could not delete the user '{0}' because it is used somewhere. Do you want to mark it as deleted ?
angal.userbrowser.description.label = Description:
angal.userbrowser.edituser.title = Edit User
angal.userbrowser.group.label = Group:
Expand All @@ -1812,6 +1817,7 @@ angal.userbrowser.resetpassword.btn.key
angal.userbrowser.resetpassword.title = Reset Password
angal.userbrowser.retype.password.label = Retype Password:
angal.userbrowser.selectgroup.label = Select group:
angal.userbrowser.alreadysoftdeleted.msg = The user is already set as deleted.
angal.userbrowser.step1.pleaseinsertanew.password.msg = Please insert a new password.
angal.userbrowser.step1.pleaseinsertanew.password.fmt.msg = Please insert a new password (minimum of {0} characters).
angal.userbrowser.step2.pleaserepeatthenewpassword.label = Please repeat the new password.
Expand Down
19 changes: 6 additions & 13 deletions src/main/java/org/isf/accounting/gui/BillDataLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,12 @@ public BillDataLoader(List<Bill> billPeriod, List<Bill> billFromPayments, Patien
}

public List<Bill> loadBills(String status, String username) throws OHServiceException {
List<Bill> tableArray = new ArrayList<>();

switch (status) {
case "O":
tableArray = getPendingBills(status, username);
break;
case "ALL":
tableArray = getAllBills(username);
break;
case "C":
tableArray = getClosedBills(status, username);
break;
}
List<Bill> tableArray = switch (status) {
case "O" -> getPendingBills(status, username);
case "ALL" -> getAllBills(username);
case "C" -> getClosedBills(status, username);
default -> new ArrayList<>();
};

tableArray.sort(Collections.reverseOrder());
return tableArray;
Expand Down
14 changes: 5 additions & 9 deletions src/main/java/org/isf/admission/gui/AdmittedPatientBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -1206,15 +1206,11 @@ else if (patientClassBox.getSelectedItem().equals(patientClassItems[1])) {
}

// sex patient type
Character sex = null;
switch (patientSexBox.getSelectedIndex()) {
case 1:
sex = 'M';
break;
case 2:
sex = 'F';
break;
}
Character sex = switch (patientSexBox.getSelectedIndex()) {
case 1 -> 'M';
case 2 -> 'F';
default -> null;
};

if (sex != null && !sex.equals(ap.getPatient().getSex())) {
continue;
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/org/isf/admission/gui/PatientFolderBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -452,19 +452,16 @@ public void mouseClicked(MouseEvent mouseEvent) {
}
}

if (selectedObject instanceof Admission) {
if (selectedObject instanceof Admission ad) {

Admission ad = (Admission) selectedObject;
startDate = ad.getAdmDate();
endDate = ad.getDisDate();

} else if (selectedObject instanceof Opd) {
} else if (selectedObject instanceof Opd opd) {

Opd opd = (Opd) selectedObject;
startDate = opd.getDate();

} else if (selectedObject instanceof PatientExamination) {
PatientExamination exam = (PatientExamination) selectedObject;
} else if (selectedObject instanceof PatientExamination exam) {
startDate = exam.getPex_date();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public class MovStockMultipleCharging extends JDialog {
};
private JComboBox comboBoxUnits = new JComboBox(qtyOption);
private int optionSelected = UNITS;
private List<Lot> updateLots = new ArrayList<Lot>();
private List<Lot> updateLots = new ArrayList<>();
private final String[] lotSelectionColumnNames = {
MessageBundle.getMessage("angal.medicalstock.lotid").toUpperCase(),
MessageBundle.getMessage("angal.medicalstock.prepdate.col").toUpperCase(),
Expand Down
141 changes: 67 additions & 74 deletions src/main/java/org/isf/menu/gui/GroupEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.EventListener;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
Expand All @@ -45,23 +46,38 @@
public class GroupEdit extends JDialog {

private static final long serialVersionUID = 1L;
private EventListenerList groupListeners = new EventListenerList();
private final EventListenerList groupListeners = new EventListenerList();

private UserBrowsingManager userBrowsingManager = Context.getApplicationContext().getBean(UserBrowsingManager.class);

public interface GroupListener extends EventListener {
void groupUpdated(AWTEvent e);
void groupInserted(AWTEvent e);
}

public void addGroupListener(GroupListener l) {
groupListeners.add(GroupListener.class, l);
}

public void removeGroupListener(GroupListener listener) {
groupListeners.remove(GroupListener.class, listener);
}
private final UserBrowsingManager userBrowsingManager = Context.getApplicationContext().getBean(UserBrowsingManager.class);
private final UserGroup group;
private final boolean insert;
private JPanel jContentPane;
private JPanel dataPanel;
private JPanel buttonPanel;
private JButton cancelButton;
private JButton okButton;
private JTextField descriptionTextField;
private JTextField nameTextField;
private JCheckBox isDeletedCheck;

/**
* This is the default constructor; we pass the arraylist and the selectedrow because we need to update them
*/
public GroupEdit(UserGroupBrowsing parent, UserGroup old, boolean inserting) {
super(parent, inserting
? MessageBundle.getMessage("angal.groupsbrowser.newgroup.title")
: MessageBundle.getMessage("angal.groupsbrowser.editgroup.title"), true);
addGroupListener(parent);
insert = inserting;
group = old;
initialize();
}
public void addGroupListener(GroupListener l) {
groupListeners.add(GroupListener.class, l);
}
public void removeGroupListener(GroupListener listener) {
groupListeners.remove(GroupListener.class, listener);
}
private void fireGroupInserted(UserGroup aGroup) {
AWTEvent event = new AWTEvent(aGroup, AWTEvent.RESERVED_ID_MAX + 1) {

Expand All @@ -73,7 +89,6 @@ private void fireGroupInserted(UserGroup aGroup) {
((GroupListener) listener).groupInserted(event);
}
}

private void fireGroupUpdated() {
AWTEvent event = new AWTEvent(new Object(), AWTEvent.RESERVED_ID_MAX + 1) {

Expand All @@ -85,46 +100,17 @@ private void fireGroupUpdated() {
((GroupListener) listener).groupUpdated(event);
}
}

private JPanel jContentPane;
private JPanel dataPanel;
private JPanel buttonPanel;
private JButton cancelButton;
private JButton okButton;
private JTextField descriptionTextField;
private JTextField nameTextField;

private UserGroup group;
private boolean insert;

/**
* This is the default constructor; we pass the arraylist and the selectedrow
* because we need to update them
*/
public GroupEdit(UserGroupBrowsing parent, UserGroup old, boolean inserting) {
super(parent, inserting
? MessageBundle.getMessage("angal.groupsbrowser.newgroup.title")
: MessageBundle.getMessage("angal.groupsbrowser.editgroup.title"), true);
addGroupListener(parent);
insert = inserting;
group = old;
initialize();
}

/**
* This method initializes this
*/
private void initialize() {

this.setBounds(300, 300, 450, 150);
this.setContentPane(getJContentPane());

this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
pack();
setLocationRelativeTo(null);
setVisible(true);
}

/**
* This method initializes jContentPane
*
Expand All @@ -139,10 +125,9 @@ private JPanel getJContentPane() {
}
return jContentPane;
}

/**
* This method initializes dataPanel
*
*
* @return javax.swing.JPanel
*/
private JPanel getDataPanel() {
Expand All @@ -152,32 +137,36 @@ private JPanel getDataPanel() {
dataPanel = new JPanel(new SpringLayout());
dataPanel.add(nameLabel);
dataPanel.add(getNameTextField());

dataPanel.add(descLabel);
dataPanel.add(getDescriptionTextField());
SpringUtilities.makeCompactGrid(dataPanel, 2, 2, 5, 5, 5, 5);

dataPanel.add(new JLabel(MessageBundle.getMessage("angal.common.deleted.label")));
isDeletedCheck = new JCheckBox();
isDeletedCheck.setSelected(group.isDeleted());
dataPanel.add(isDeletedCheck);

SpringUtilities.makeCompactGrid(dataPanel, 3, 2, 5, 5, 5, 5);
}
return dataPanel;
}

/**
* This method initializes buttonPanel
*
* @return javax.swing.JPanel
* This method initializes buttonPanel
*
* @return javax.swing.JPanel
*/
private JPanel getButtonPanel() {
if (buttonPanel == null) {
buttonPanel = new JPanel();
buttonPanel.add(getOkButton(), null);
buttonPanel.add(getCancelButton(), null);
buttonPanel.add(getOkButton(), null);
buttonPanel.add(getCancelButton(), null);
}
return buttonPanel;
}

/**
* This method initializes cancelButton
*
* @return javax.swing.JButton
* This method initializes cancelButton
*
* @return javax.swing.JButton
*/
private JButton getCancelButton() {
if (cancelButton == null) {
Expand All @@ -187,11 +176,10 @@ private JButton getCancelButton() {
}
return cancelButton;
}

/**
* This method initializes okButton
*
* @return javax.swing.JButton
* This method initializes okButton
*
* @return javax.swing.JButton
*/
private JButton getOkButton() {
if (okButton == null) {
Expand All @@ -204,9 +192,10 @@ private JButton getOkButton() {
}

group.setCode(nameTextField.getText());

group.setDesc(descriptionTextField.getText());
if (insert) { // inserting
group.setDeleted(isDeletedCheck.isSelected());

if (insert) { // inserting
try {
userBrowsingManager.newUserGroup(group);
fireGroupInserted(group);
Expand All @@ -215,7 +204,7 @@ private JButton getOkButton() {
MessageDialog.error(null, "angal.common.datacouldnotbesaved.msg");
OHServiceExceptionUtil.showMessages(e1);
}
} else { // updating
} else { // updating
try {
userBrowsingManager.updateUserGroup(group);
fireGroupUpdated();
Expand All @@ -229,27 +218,25 @@ private JButton getOkButton() {
}
return okButton;
}

/**
* This method initializes descriptionTextField
*
* @return javax.swing.JTextField
* This method initializes descriptionTextField
*
* @return javax.swing.JTextField
*/
private JTextField getDescriptionTextField() {
if (descriptionTextField == null) {
if (insert) {
descriptionTextField = new JTextField();
descriptionTextField = new JTextField(15);
} else {
descriptionTextField = new JTextField(group.getDesc());
}
}
return descriptionTextField;
}

private JTextField getNameTextField() {
if (nameTextField == null) {
if (insert) {
nameTextField = new JTextField();
nameTextField = new JTextField(15);
} else {
nameTextField = new JTextField(group.getCode());
nameTextField.setEditable(false);
Expand All @@ -258,4 +245,10 @@ private JTextField getNameTextField() {
return nameTextField;
}

public interface GroupListener extends EventListener {

void groupUpdated(AWTEvent e);
void groupInserted(AWTEvent e);
}

}
Loading

0 comments on commit c0109a3

Please sign in to comment.