| Line 470... |
Line 470... |
| 470 |
isCrmUser = positionRepository.hasCategory(currentAuthUser.getId(), ProfitMandiConstants.TICKET_CATEGORY_CRM);
|
470 |
isCrmUser = positionRepository.hasCategory(currentAuthUser.getId(), ProfitMandiConstants.TICKET_CATEGORY_CRM);
|
| 471 |
}
|
471 |
}
|
| 472 |
|
472 |
|
| 473 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAllVisible(categoryId);
|
473 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAllVisible(categoryId);
|
| 474 |
|
474 |
|
| 475 |
// CRM users should not see Sales Escalation and RBM Escalation subcategories
|
475 |
// CRM users should not see invisible subcategories
|
| 476 |
if (isCrmUser) {
|
476 |
if (isCrmUser) {
|
| 477 |
ticketSubCategories = ticketSubCategories.stream()
|
477 |
ticketSubCategories = ticketSubCategories.stream()
|
| 478 |
.filter(tsc -> tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_SALES_ESCALATION
|
478 |
.filter(TicketSubCategory::isVisibility)
|
| 479 |
&& tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_RBM_ESCALATION)
|
- |
|
| 480 |
.collect(Collectors.toList());
|
479 |
.collect(Collectors.toList());
|
| 481 |
}
|
480 |
}
|
| 482 |
|
481 |
|
| 483 |
LOGGER.info(ticketSubCategories);
|
482 |
LOGGER.info(ticketSubCategories);
|
| 484 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
483 |
model.addAttribute("ticketSubCategories", ticketSubCategories);
|
| Line 561... |
Line 560... |
| 561 |
tickets = ticketRepository.selectAllTickets(Optional.empty(), sortOrder, ticketSearchType, searchTerm);
|
560 |
tickets = ticketRepository.selectAllTickets(Optional.empty(), sortOrder, ticketSearchType, searchTerm);
|
| 562 |
} else {
|
561 |
} else {
|
| 563 |
tickets = ticketRepository.selectAllTickets(Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), sortOrder, ticketSearchType, searchTerm);
|
562 |
tickets = ticketRepository.selectAllTickets(Optional.of(TicketStatus.CLOSED.equals(ticketStatus)), sortOrder, ticketSearchType, searchTerm);
|
| 564 |
}
|
563 |
}
|
| 565 |
|
564 |
|
| 566 |
// Filter out Sales Escalation and RBM Escalation subcategory tickets for CRM users
|
565 |
// Filter out invisible subcategory tickets for CRM users
|
| - |
|
566 |
Map<Integer, TicketSubCategory> subCategoryMap = ticketSubCategoryRepository.getTicketSubCategoryMap();
|
| 567 |
tickets = tickets.stream()
|
567 |
tickets = tickets.stream()
|
| - |
|
568 |
.filter(t -> {
|
| 568 |
.filter(t -> t.getSubCategoryId() != ProfitMandiConstants.TICKET_SUBCATEGORY_SALES_ESCALATION
|
569 |
TicketSubCategory subCategory = subCategoryMap.get(t.getSubCategoryId());
|
| 569 |
&& t.getSubCategoryId() != ProfitMandiConstants.TICKET_SUBCATEGORY_RBM_ESCALATION)
|
570 |
return subCategory != null && subCategory.isVisibility();
|
| - |
|
571 |
})
|
| 570 |
.collect(Collectors.toList());
|
572 |
.collect(Collectors.toList());
|
| 571 |
size = tickets.size();
|
573 |
size = tickets.size();
|
| 572 |
} else {
|
574 |
} else {
|
| 573 |
// Non-CRM admins see only tickets assigned to them
|
575 |
// Non-CRM admins see only tickets assigned to them
|
| 574 |
if (ticketSearchType == null) {
|
576 |
if (ticketSearchType == null) {
|
| Line 1087... |
Line 1089... |
| 1087 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
1089 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
| 1088 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
1090 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
| 1089 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(ticketSubCategory.getCategoryId());
|
1091 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(ticketSubCategory.getCategoryId());
|
| 1090 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
1092 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
| 1091 |
|
1093 |
|
| 1092 |
// CRM users should not see Sales/RBM categories and their Escalation subcategories
|
1094 |
// CRM users should not see invisible subcategories
|
| 1093 |
if (isCrmUser) {
|
1095 |
if (isCrmUser) {
|
| 1094 |
ticketCategories = ticketCategories.stream()
|
- |
|
| 1095 |
.filter(tc -> tc.getId() != ProfitMandiConstants.TICKET_CATEGORY_SALES
|
- |
|
| 1096 |
&& tc.getId() != ProfitMandiConstants.TICKET_CATEGORY_RBM)
|
- |
|
| 1097 |
.collect(Collectors.toList());
|
- |
|
| 1098 |
ticketSubCategories = ticketSubCategories.stream()
|
1096 |
ticketSubCategories = ticketSubCategories.stream()
|
| 1099 |
.filter(tsc -> tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_SALES_ESCALATION
|
1097 |
.filter(TicketSubCategory::isVisibility)
|
| 1100 |
&& tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_RBM_ESCALATION)
|
- |
|
| 1101 |
.collect(Collectors.toList());
|
1098 |
.collect(Collectors.toList());
|
| 1102 |
}
|
1099 |
}
|
| 1103 |
|
1100 |
|
| 1104 |
// Get partner name for modal title
|
1101 |
// Get partner name for modal title
|
| 1105 |
String partnerName = retailerService.getFofoRetailer(ticket.getFofoId()).getBusinessName();
|
1102 |
String partnerName = retailerService.getFofoRetailer(ticket.getFofoId()).getBusinessName();
|
| Line 1124... |
Line 1121... |
| 1124 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
1121 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
| 1125 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
1122 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
| 1126 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(ticketSubCategory.getCategoryId());
|
1123 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(ticketSubCategory.getCategoryId());
|
| 1127 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
1124 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
| 1128 |
|
1125 |
|
| 1129 |
// CRM users should not see Sales/RBM categories and their Escalation subcategories
|
1126 |
// CRM users should not see invisible subcategories
|
| 1130 |
if (isCrmUser) {
|
1127 |
if (isCrmUser) {
|
| 1131 |
ticketCategories = ticketCategories.stream()
|
- |
|
| 1132 |
.filter(tc -> tc.getId() != ProfitMandiConstants.TICKET_CATEGORY_SALES
|
- |
|
| 1133 |
&& tc.getId() != ProfitMandiConstants.TICKET_CATEGORY_RBM)
|
- |
|
| 1134 |
.collect(Collectors.toList());
|
- |
|
| 1135 |
ticketSubCategories = ticketSubCategories.stream()
|
1128 |
ticketSubCategories = ticketSubCategories.stream()
|
| 1136 |
.filter(tsc -> tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_SALES_ESCALATION
|
1129 |
.filter(TicketSubCategory::isVisibility)
|
| 1137 |
&& tsc.getId() != ProfitMandiConstants.TICKET_SUBCATEGORY_RBM_ESCALATION)
|
- |
|
| 1138 |
.collect(Collectors.toList());
|
1130 |
.collect(Collectors.toList());
|
| 1139 |
}
|
1131 |
}
|
| 1140 |
|
1132 |
|
| 1141 |
// Get partner name for modal title
|
1133 |
// Get partner name for modal title
|
| 1142 |
String partnerName = retailerService.getFofoRetailer(ticket.getFofoId()).getBusinessName();
|
1134 |
String partnerName = retailerService.getFofoRetailer(ticket.getFofoId()).getBusinessName();
|