|
|
|
@@ -186,6 +186,7 @@ open class ProjectsService( |
|
|
|
if (request.taskTemplateId != null && request.taskTemplateId > 0) taskTemplateRepository.findById(request.taskTemplateId) |
|
|
|
.orElseThrow() else null |
|
|
|
val teamLead = staffRepository.findById(request.projectLeadId).orElseThrow() |
|
|
|
val subTeamLead = request.projectSubLeadId?.let { staffRepository.findById(it).orElseThrow() } |
|
|
|
val customer = customerService.findCustomer(request.clientId) |
|
|
|
val customerType = request.clientTypeId?.let { customerService.findCustomerType(it) } ?: customer.customerType |
|
|
|
val subsidiaryContact = |
|
|
|
@@ -261,6 +262,7 @@ open class ProjectsService( |
|
|
|
this.taskTemplate = taskTemplate |
|
|
|
|
|
|
|
this.teamLead = teamLead |
|
|
|
this.subTeamLead = subTeamLead |
|
|
|
this.customer = customer |
|
|
|
custLeadName = |
|
|
|
if (request.isSubsidiaryContact == null || !request.isSubsidiaryContact) clientContact?.name else subsidiaryContact?.name |
|
|
|
@@ -425,6 +427,7 @@ open class ProjectsService( |
|
|
|
projectCategoryId = it.projectCategory?.id, |
|
|
|
projectDescription = it.description, |
|
|
|
projectLeadId = it.teamLead?.id, |
|
|
|
projectSubLeadId = it.subTeamLead?.id, |
|
|
|
projectActualStart = it.actualStart, |
|
|
|
projectActualEnd = it.actualEnd, |
|
|
|
projectPlanStart = it.planStart, |
|
|
|
@@ -497,8 +500,9 @@ open class ProjectsService( |
|
|
|
open fun allBuildingTypes(): List<BuildingType> { |
|
|
|
val sortedBuildingType = buildingTypeRepository.findAll().sortedBy { it.name }.sortedWith { a, b -> |
|
|
|
when { |
|
|
|
a.contains("Hidden", ignoreCase = true) && !b.contains("Hidden", ignoreCase = true) -> 2 |
|
|
|
a.startsWith("Others") && !b.startsWith("Others") -> 1 // Move "Others" to the end |
|
|
|
!a.startsWith("Others") && b.startsWith("Others") -> -1 // Keep non-"Others" items above |
|
|
|
(!a.startsWith("Others") && b.startsWith("Others")) || (!a.contains("Hidden", ignoreCase = true) && b.contains("Hidden", ignoreCase = true)) -> -1 // Keep non-"Others" items above |
|
|
|
else -> 0 // Maintain relative order for other items |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -527,6 +531,7 @@ open class ProjectsService( |
|
|
|
projectCategoryId = project.projectCategory?.id, |
|
|
|
projectDescription = project.description, |
|
|
|
projectLeadId = project.teamLead?.id, |
|
|
|
projectSubLeadId = project.subTeamLead?.id, |
|
|
|
projectStatus = project.status, |
|
|
|
isClpProject = project.isClpProject, |
|
|
|
serviceTypeId = project.serviceType?.id, |
|
|
|
|