From 40249a74aa94d48a925776412e7bb99ed8c98f1a Mon Sep 17 00:00:00 2001 From: Andre Goncalves Date: Thu, 22 Jan 2026 10:44:29 -0800 Subject: [PATCH] AB#31641 - remove dead code --- .../IGrantApplicationAppService.cs | 51 +++--- .../GrantApplicationAppService.cs | 160 +++++------------- .../Components/ApplicantInfo/Default.js | 33 ---- 3 files changed, 69 insertions(+), 175 deletions(-) diff --git a/applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/GrantApplications/IGrantApplicationAppService.cs b/applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/GrantApplications/IGrantApplicationAppService.cs index 0b37151e8..d02254aad 100644 --- a/applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/GrantApplications/IGrantApplicationAppService.cs +++ b/applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/GrantApplications/IGrantApplicationAppService.cs @@ -1,27 +1,26 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Unity.Modules.Shared; -using Volo.Abp.Application.Dtos; - -namespace Unity.GrantManager.GrantApplications -{ - public interface IGrantApplicationAppService - { - Task GetApplicationStatusAsync(Guid id); - Task> GetActions(Guid applicationId, bool includeInternal = false); - Task UpdateProjectInfoAsync(Guid id, CreateUpdateProjectInfoDto input); - Task UpdatePartialProjectInfoAsync(Guid id, PartialUpdateDto input); - Task UpdateProjectApplicantInfoAsync(Guid id, CreateUpdateApplicantInfoDto input); - Task UpdateAssessmentResultsAsync(Guid id, CreateUpdateAssessmentResultsDto input); - Task UpdateSupplierNumberAsync(Guid applicationId, string supplierNumber); - Task> GetAllApplicationsAsync(); - Task> GetApplicationDetailsListAsync(List applicationIds); - Task GetAsync(Guid id); - Task TriggerAction(Guid applicationId, GrantApplicationAction triggerAction); - Task GetAccountCodingIdFromFormIdAsync(Guid formId); - Task DismissAIIssueAsync(Guid applicationId, string issueId); - Task RestoreAIIssueAsync(Guid applicationId, string issueId); - Task> GetListAsync(GrantApplicationListInputDto input); - } +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Unity.Modules.Shared; +using Volo.Abp.Application.Dtos; + +namespace Unity.GrantManager.GrantApplications +{ + public interface IGrantApplicationAppService + { + Task GetApplicationStatusAsync(Guid id); + Task> GetActions(Guid applicationId, bool includeInternal = false); + Task UpdateProjectInfoAsync(Guid id, CreateUpdateProjectInfoDto input); + Task UpdatePartialProjectInfoAsync(Guid id, PartialUpdateDto input); + Task UpdateAssessmentResultsAsync(Guid id, CreateUpdateAssessmentResultsDto input); + Task UpdateSupplierNumberAsync(Guid applicationId, string supplierNumber); + Task> GetAllApplicationsAsync(); + Task> GetApplicationDetailsListAsync(List applicationIds); + Task GetAsync(Guid id); + Task TriggerAction(Guid applicationId, GrantApplicationAction triggerAction); + Task GetAccountCodingIdFromFormIdAsync(Guid formId); + Task DismissAIIssueAsync(Guid applicationId, string issueId); + Task RestoreAIIssueAsync(Guid applicationId, string issueId); + Task> GetListAsync(GrantApplicationListInputDto input); + } } diff --git a/applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantApplications/GrantApplicationAppService.cs b/applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantApplications/GrantApplicationAppService.cs index 7a9e03ef8..741af8be1 100644 --- a/applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantApplications/GrantApplicationAppService.cs +++ b/applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantApplications/GrantApplicationAppService.cs @@ -1,52 +1,52 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Authorization.Infrastructure; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text.Json; -using System.Threading.Tasks; -using Unity.Flex.WorksheetInstances; -using Unity.Flex.Worksheets; -using Unity.GrantManager.Applicants; -using Unity.GrantManager.ApplicationForms; -using Unity.GrantManager.Applications; -using Unity.GrantManager.Events; -using Unity.GrantManager.Flex; -using Unity.GrantManager.Identity; -using Unity.GrantManager.Payments; -using Unity.Modules.Shared; -using Unity.Modules.Shared.Correlation; -using Unity.Payments.Enums; -using Unity.Payments.PaymentRequests; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Authorization; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization.Infrastructure; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text.Json; +using System.Threading.Tasks; +using Unity.Flex.WorksheetInstances; +using Unity.Flex.Worksheets; +using Unity.GrantManager.Applicants; +using Unity.GrantManager.ApplicationForms; +using Unity.GrantManager.Applications; +using Unity.GrantManager.Events; +using Unity.GrantManager.Flex; +using Unity.GrantManager.Identity; +using Unity.GrantManager.Payments; +using Unity.Modules.Shared; +using Unity.Modules.Shared.Correlation; +using Unity.Payments.Enums; +using Unity.Payments.PaymentRequests; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Authorization; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; namespace Unity.GrantManager.GrantApplications; -[Authorize] -[Dependency(ReplaceServices = true)] -[ExposeServices(typeof(GrantApplicationAppService), typeof(IGrantApplicationAppService))] -public class GrantApplicationAppService( - IApplicationManager applicationManager, - IApplicationRepository applicationRepository, - IApplicationStatusRepository applicationStatusRepository, - IApplicationFormSubmissionRepository applicationFormSubmissionRepository, +[Authorize] +[Dependency(ReplaceServices = true)] +[ExposeServices(typeof(GrantApplicationAppService), typeof(IGrantApplicationAppService))] +public class GrantApplicationAppService( + IApplicationManager applicationManager, + IApplicationRepository applicationRepository, + IApplicationStatusRepository applicationStatusRepository, + IApplicationFormSubmissionRepository applicationFormSubmissionRepository, IApplicantRepository applicantRepository, - IApplicationFormRepository applicationFormRepository, - IApplicantAgentRepository applicantAgentRepository, + IApplicationFormRepository applicationFormRepository, + IApplicantAgentRepository applicantAgentRepository, IApplicantAddressRepository applicantAddressRepository, - IApplicantSupplierAppService applicantSupplierService, + IApplicantSupplierAppService applicantSupplierService, IPaymentRequestAppService paymentRequestService) : GrantManagerAppService, IGrantApplicationAppService { @@ -671,79 +671,7 @@ public async Task UpdateSupplierNumberAsync(Guid applicationId, string? supplier } return await applicantAgentRepository.UpdateAsync(applicantAgent); - } - - [Obsolete("Use ApplicationApplicantAppService.UpdatePartialApplicantInfoAsync instead.")] - [Authorize(UnitySelector.Applicant.UpdatePolicy)] - public async Task UpdateProjectApplicantInfoAsync(Guid id, CreateUpdateApplicantInfoDto input) - { - var application = await applicationRepository.GetAsync(id); - - var applicant = await applicantRepository - .FirstOrDefaultAsync(a => a.Id == application.ApplicantId) ?? throw new EntityNotFoundException(); - - applicant.OrganizationType = input.OrganizationType ?? ""; - applicant.OrgName = input.OrgName ?? ""; - applicant.OrgNumber = input.OrgNumber ?? ""; - applicant.OrgStatus = input.OrgStatus ?? ""; - applicant.OrganizationSize = input.OrganizationSize ?? ""; - applicant.Sector = input.Sector ?? ""; - applicant.SubSector = input.SubSector ?? ""; - applicant.SectorSubSectorIndustryDesc = input.SectorSubSectorIndustryDesc ?? ""; - applicant.IndigenousOrgInd = input.IndigenousOrgInd ?? ""; - applicant.UnityApplicantId = input.UnityApplicantId ?? ""; - applicant.FiscalDay = input.FiscalDay; - applicant.FiscalMonth = input.FiscalMonth ?? ""; - applicant.NonRegOrgName = input.NonRegOrgName ?? ""; - - _ = await applicantRepository.UpdateAsync(applicant); - - var applicantAgent = await applicantAgentRepository.FirstOrDefaultAsync(agent => agent.ApplicantId == application.ApplicantId); - if (applicantAgent == null) - { - applicantAgent = await applicantAgentRepository.InsertAsync(new ApplicantAgent - { - ApplicantId = application.ApplicantId, - ApplicationId = application.Id, - Name = input.ContactFullName ?? "", - Phone = input.ContactBusinessPhone ?? "", - Phone2 = input.ContactCellPhone ?? "", - Email = input.ContactEmail ?? "", - Title = input.ContactTitle ?? "" - }); - } - else - { - applicantAgent.Name = input.ContactFullName ?? ""; - applicantAgent.Phone = input.ContactBusinessPhone ?? ""; - applicantAgent.Phone2 = input.ContactCellPhone ?? ""; - applicantAgent.Email = input.ContactEmail ?? ""; - applicantAgent.Title = input.ContactTitle ?? ""; - applicantAgent = await applicantAgentRepository.UpdateAsync(applicantAgent); - } - - await UpdateApplicantAddresses(application.Id, input); - - application.SigningAuthorityFullName = input.SigningAuthorityFullName ?? ""; - application.SigningAuthorityTitle = input.SigningAuthorityTitle ?? ""; - application.SigningAuthorityEmail = input.SigningAuthorityEmail ?? ""; - application.SigningAuthorityBusinessPhone = input.SigningAuthorityBusinessPhone ?? ""; - application.SigningAuthorityCellPhone = input.SigningAuthorityCellPhone ?? ""; - - await PublishCustomFieldUpdatesAsync(application.Id, FlexConsts.ApplicantInfoUiAnchor, input); - - await applicationRepository.UpdateAsync(application); - - var appDto = ObjectMapper.Map(application); - - appDto.ContactFullName = applicantAgent.Name; - appDto.ContactEmail = applicantAgent.Email; - appDto.ContactTitle = applicantAgent.Title; - appDto.ContactBusinessPhone = applicantAgent.Phone; - appDto.ContactCellPhone = applicantAgent.Phone2; - - return appDto; - } + } [Authorize(UnitySelector.Applicant.UpdatePolicy)] public async Task UpdateMergedApplicantAsync(Guid applicationId, CreateUpdateApplicantInfoDto input) diff --git a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ApplicantInfo/Default.js b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ApplicantInfo/Default.js index 8b47a93e9..70f8fee38 100644 --- a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ApplicantInfo/Default.js +++ b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ApplicantInfo/Default.js @@ -751,26 +751,6 @@ async function generateUnityApplicantIdBtn() { } }; -async function checkUnityApplicantIdExist(unityAppId, appId, appInfoObj) { - try { - let existingApplicant = await unity.grantManager.applicants.applicant.getExistingApplicant(unityAppId); - - if (existingApplicant) { - Swal.fire({ - icon: "error", - text: "Applicatn ID already exists. Please enter a unique ID.", - confirmButtonText: 'Ok', - customClass: { confirmButton: 'btn btn-primary' } - }); - } else { - updateApplicantInfo(appId, appInfoObj); - } - } - catch (error) { - console.log(error); - } -} - function enableApplicantInfoSaveBtn(inputText) { if (!$("#ApplicantInfoForm").valid() || !abp.auth.isGranted('Unity.GrantManager.ApplicationManagement.Applicant') // Note: Will replace after worksheet permissions added @@ -785,19 +765,6 @@ function enableApplicantInfoSaveBtn(inputText) { $('#saveApplicantInfoBtn').prop('disabled', false); } -function updateApplicantInfo(appId, appInfoObj) { - return unity.grantManager.grantApplications.grantApplication - .updateProjectApplicantInfo(appId, appInfoObj) - .done(function () { - abp.notify.success( - 'The Applicant info has been updated.' - ); - $('#saveApplicantInfoBtn').prop('disabled', true); - PubSub.publish("refresh_detail_panel_summary"); - PubSub.publish('applicant_info_updated', appInfoObj); - }); -} - function setApplicantDuplicatedStatus(principalApplicantId, nonPrincipalApplicantId) { return $.ajax({ url: '/api/app/applicant/set-duplicated',