Subversion Repositories SmartDukaan

Rev

Rev 35587 | Rev 36008 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35587 Rev 35629
Line 459... Line 459...
459
        return cm;
459
        return cm;
460
    }
460
    }
461
 
461
 
462
    public String adminPanel(int fofoId, String email, Model model) throws Exception {
462
    public String adminPanel(int fofoId, String email, Model model) throws Exception {
463
        List<Menu> menus = null;
463
        List<Menu> menus = null;
-
 
464
        boolean isAboveL1 = false;
464
        try {
465
        try {
465
            AuthUser authUser = authRepository.selectByEmailOrMobile(email);
466
            AuthUser authUser = authRepository.selectByEmailOrMobile(email);
466
            List<Position> positions = positionRepository.selectAllByAuthUserId(authUser.getId());
467
            List<Position> positions = positionRepository.selectAllByAuthUserId(authUser.getId());
467
            LOGGER.info("positionslist - {}", positions);
468
            LOGGER.info("positionslist - {}", positions);
468
            Map<Integer, PartnerDetailModel> warehousePartnerDetailMap = null;
469
            Map<Integer, PartnerDetailModel> warehousePartnerDetailMap = null;
Line 489... Line 490...
489
            long stockValue = 0;
490
            long stockValue = 0;
490
            long stockQty = 0;
491
            long stockQty = 0;
491
            long pendingIndent = 0;
492
            long pendingIndent = 0;
492
            long tertiary = 0;
493
            long tertiary = 0;
493
 
494
 
494
            boolean isAboveL1 = positions.stream().anyMatch(pos -> pos.getEscalationType() != EscalationType.L1);
495
            isAboveL1 = positions.stream().anyMatch(pos -> pos.getEscalationType() != EscalationType.L1);
495
            boolean isRBM = positions.stream().anyMatch(pos -> pos.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_RBM);
496
            boolean isRBM = positions.stream().anyMatch(pos -> pos.getCategoryId() == ProfitMandiConstants.TICKET_CATEGORY_RBM);
496
 
497
 
497
            Set<Integer> fofoIds = new HashSet<>();
498
            Set<Integer> fofoIds = new HashSet<>();
498
            if (isAboveL1 && isRBM) {
499
            if (isAboveL1 && isRBM) {
499
                fofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId()).collect(Collectors.toSet());
500
                fofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId()).collect(Collectors.toSet());
Line 612... Line 613...
612
 
613
 
613
            model.addAttribute("date", curDate.withDayOfMonth(1).minusMonths(6).toLocalDate());
614
            model.addAttribute("date", curDate.withDayOfMonth(1).minusMonths(6).toLocalDate());
614
 
615
 
615
        } catch (ProfitMandiBusinessException e) {
616
        } catch (ProfitMandiBusinessException e) {
616
        }
617
        }
-
 
618
        // Filter out "Manager Ticket" menu item for L1-only users (must be at least L2 in any position)
-
 
619
        if (menus != null && !isAboveL1) {
-
 
620
            menus = menus.stream()
-
 
621
                    .filter(m -> !"manager-ticket".equals(m.getActionClass()))
-
 
622
                    .collect(Collectors.toList());
-
 
623
        }
617
        List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
624
        List<Menu> menuList = (menus != null) ? this.prepareMenu(menus) : new ArrayList<>();
618
        //LOGGER.info("menu" + menuList);
625
        //LOGGER.info("menu" + menuList);
619
        model.addAttribute("menu", menuList);
626
        model.addAttribute("menu", menuList);
620
        return "admin";
627
        return "admin";
621
    }
628
    }