package com.dh.hrmanager.util;

import java.util.Scanner;

public class Menu {

Scanner input=new Scanner(System.in);

public void showLoginMenu(){

System.out.println("\n\n\t\t\t欢迎进入人力资源管理系统");

System.out.println("***********************************************************\n");

System.out.println("\t\t\t 1.登录系统\n");

System.out.println("\t\t\t 2.注册用户\n");

System.out.println("\t\t\t 3.退出系统\n"); System.out.println("***********************************************************\n");

System.out.println("请输入菜单选项数字:");

}

public void showStaffMenu(){

System.out.println("人力资源管理系统=>普通员工");

System.out.println("***********************************************************\n");

System.out.println("\t\t\t 1.汇报工作\n");

System.out.println("\t\t\t 2.查看个人信息\n");

System.out.println("\t\t\t 3.修改密码\n");

System.out.println("\t\t\t 4.查看评测\n");

System.out.println("\t\t\t 5.工资范畴\n");

System.out.println("\t\t\t 6.今日工作\n");

System.out.println("\t\t\t 7.在线工作交流\n"); System.out.println("***********************************************************\n");

System.out.println("请输入菜单选项数字或者输入R/r返回上一菜单:");

        boolean flag=true;

        do {

         String num=input.next();

         switch(num) {

         case "1":

         Data.staff.addReport();

         showStaffMenu();

         flag=false;

         break;

         case "2":

         Data.staff.displayInfo();

         showStaffMenu();

         flag=false;

         break;

         case "3":

                System.out.println("请输入新密码:");

                String newPasswd=input.next();

                Data.staff.modifyPassword(newPasswd);

                showStaffMenu();

                flag=false;

         break;

         case "4":

        break;

         case "5":

         //查看工资范畴

         Data.staff.displaySalaryRange();

         showStaffMenu();

                flag=false;

         break;

         case "6":

         Data.staff.doWork();

         showStaffMenu();

                flag=false;

         break;

         case "7":

         break;

         case "r":

         case "R":

         flag=false;

         showLoginMenu();

         break;

         default:

         System.out.println("您的输入有误!");

         }

        } while (flag);

}

public void showManagerMenu(){

System.out.println("人力资源管理系统=>部门经理"); System.out.println("***********************************************************\n");

System.out.println("\t\t\t 1.查看工作汇报\n");

System.out.println("\t\t\t 2.考评员工 \n");

System.out.println("\t\t\t 3.查看个人信息\n");

System.out.println("\t\t\t 4.修改密码\n");

System.out.println("\t\t\t 5.工资范畴\n");

System.out.println("\t\t\t 6.今日工作\n");

System.out.println("\t\t\t 7.在线工作交流\n"); System.out.println("***********************************************************\n");

System.out.println("请输入菜单选项数字或者输入R/r返回上一菜单:");

boolean flag=true;

        do {

         String num=input.next();

         switch(num) {

         case "1":

         Data.manager.displayReports();;

         showManagerMenu();

         flag=false;

         break;

         case "2":

         flag=false;

         break;

         case "3":

                Data.manager.displayInfo();

                showManagerMenu();

                flag=false;

         break;

         case "4":

         System.out.println("请输入新密码:");

                String newPasswd=input.next();

                Data.manager.modifyPassword(newPasswd);

                showManagerMenu();

                flag=false;

         break;

         case "5":

         Data.manager.displaySalaryRange();

         showManagerMenu();

                flag=false;

         break;

         case "6":

         Data.manager.doWork();

         showManagerMenu();

                flag=false;

         break;

         case "7":

         break;

         case "r":

         case "R":

         flag=false;

         showLoginMenu();

         break;

         default:

         System.out.println("您的输入有误!");

         }

        } while (flag);

}

public void showAdminMenu(){

System.out.println("人力资源管理系统=>管理员");

System.out.println("***********************************************************\n");

System.out.println("\t\t\t 1.查看员工信息\n");

System.out.println("\t\t\t 2.修改员工角色\n");

System.out.println("\t\t\t 3.查看个人信息\n");

System.out.println("\t\t\t 4.修改密码\n");

System.out.println("\t\t\t 5.工资范畴\n");

System.out.println("\t\t\t 6.今日工作\n");

System.out.println("***********************************************************\n");

System.out.println("请输入菜单选项数字或者输入R/r返回上一菜单:");

boolean flag=true;

        do {

         String num=input.next();

         switch(num) {

         case "1":

         //查看员工信息

         System.out.println("普通员工信息如下:");

         System.out.println("------------------------");

         Data.staff.displayInfo();

         System.out.println("经理信息如下:");

         System.out.println("------------------------");

         Data.manager.displayInfo();

         System.out.println("管理员信息如下:");

         System.out.println("------------------------");

         Data.admin.displayInfo();    

         showAdminMenu();

         flag=false;

         break;

         case "2":

         System.out.println("请输入员工编号:");

         String empNo=input.next();

         System.out.println("请输入员工角色:");

         String roleName=input.next();

         Data.admin.modifyEmployeeRole(empNo, roleName);

         showAdminMenu();

         flag=false;

         break;

         case "3":

                Data.admin.displayInfo();

                showAdminMenu();

                flag=false;

         break;

         case "4":

         System.out.println("请输入新密码:");

                String newPasswd=input.next();

                Data.admin.modifyPassword(newPasswd);

                showAdminMenu();

                flag=false;

         break;

         case "5":

         Data.admin.displaySalaryRange();

         showAdminMenu();

                flag=false;

         break;

         case "6":

         Data.admin.doWork();

         showAdminMenu();

                flag=false;

         break;

         case "7":

         break;

         case "r":

         case "R":

         flag=false;

         showLoginMenu();

         break;

         default:

         System.out.println("您的输入有误!");

         }

        } while (flag);

}

private void returnLoginMenu(Scanner input) {

// TODO Auto-generated method stub

boolean flag=true;

do {

String num=input.next();

if (num.toUpperCase().equals("R")) {

flag=false;

showLoginMenu();

break;

}

} while (flag);

}

}