Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Notekunn committed Jan 13, 2021
1 parent 042ee26 commit d55d7b0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/main/java/controllers/admin/EmployeeManagerController.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.YES_OPTION;
import models.Employee;
import utils.EmployeePermission;
import views.popup.EmployeePopupView;

/**
Expand Down Expand Up @@ -36,14 +37,20 @@ public void actionEdit() {
int selectedId = view.getSelectedId();
if (selectedId < 0) {
throw new Exception("Chọn nhân viên cần edit");
} else {
Employee e = employeeDao.get(selectedId);
if (e == null) {
throw new Exception("Nhân viên bạn chọn không hợp lệ");
}
Employee e = employeeDao.get(selectedId);
if (e == null) {
throw new Exception("Nhân viên bạn chọn không hợp lệ");
}
if (e.getPermission() == EmployeePermission.MANAGER) {
int value = JOptionPane.showConfirmDialog(null, "Bạn có chắc muốn chỉnh sửa admin?");
if (value != YES_OPTION) {
return;
}
// popupController.edit(this, new EmployeePopupView(), e);
popupController.edit(new EmployeePopupView(), e, this::updateData, view::showError);
}
// popupController.edit(this, new EmployeePopupView(), e);
popupController.edit(new EmployeePopupView(), e, this::updateData, view::showError);

} catch (Exception e) {
view.showError(e);
}
Expand Down

0 comments on commit d55d7b0

Please sign in to comment.