Skip to content
Merged

Test #1608

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
43de04d
AB#28858: Multiple worksheets for AssessmentInfo
aurelio-aot Aug 1, 2025
3bb3241
AB#28858: Multiple worksheets for Project Info
aurelio-aot Aug 2, 2025
bff07eb
AB#28858: Multiple worksheets for ApplicantInfo
aurelio-aot Aug 2, 2025
b9058ab
AB#28858: Muptiple worksheets for PaymentInfo
aurelio-aot Aug 2, 2025
14952bf
AB#28858: Multiple worksheets for Funding Agreeement
aurelio-aot Aug 2, 2025
f661aff
AB#28858: Refactor codes. Remove duplications.
aurelio-aot Aug 2, 2025
9de552f
AB#28858: Fit components into the height
aurelio-aot Aug 2, 2025
08809a8
AB#29719 initial commit for electoral district backfill endpoint
AndreGAot Aug 6, 2025
9049fcf
AB#28858: Allow multiple worksheets per tab
aurelio-aot Aug 7, 2025
8115c6b
AB#29251 Update data-restore-configmap crunchy-postgres templates
DarylTodosichuk Aug 7, 2025
ecd7ccb
AB#28858: Update widget controllers
aurelio-aot Aug 7, 2025
415b12a
AB#28858: Fix bug for single worksheet scenario
aurelio-aot Aug 8, 2025
a115d87
AB#29617 - Remove log generating authorization policies
plavoie-BC Aug 8, 2025
031ba48
Merge branch 'dev' into feature/AB#28858-add-multiple-worksheet
aurelio-aot Aug 8, 2025
6684b82
AB#28858: Fix bugs and runtime errors
aurelio-aot Aug 8, 2025
c5f7849
AB#28858: Undo change to appsettings.json
aurelio-aot Aug 8, 2025
34f86e7
AB#29194 - Update Tag Delete Confirmation Message
plavoie-BC Aug 11, 2025
67c9cc6
AB#29688 - Update Global CSS for Disabled Fields
plavoie-BC Aug 11, 2025
01ef871
AB#29688 - Update Global CSS for Disabled Fields - Bugfix
plavoie-BC Aug 11, 2025
910a3ac
feature/AB#25072 Basic Group Functionality Working
cyrusparsons Aug 11, 2025
dce7e1f
Merge branch 'dev' into feature/AB#29719-update-electoral-retro
AndreGAot Aug 12, 2025
ebc1185
AB#29617 - Add Authorization to Dashboard Razor Page
plavoie-BC Aug 12, 2025
f90f89c
AB#29617 - Switch Dashboard query parameters from GET URI to POST req…
plavoie-BC Aug 12, 2025
ba9901e
Merge remote-tracking branch 'origin/dev' into bugfix/AB#29617-dashbo…
plavoie-BC Aug 12, 2025
1f8539b
AB#29719 SQ and codeQL cleanup
AndreGAot Aug 12, 2025
c5150af
AB#29719 last SQ cleanup
AndreGAot Aug 12, 2025
4021985
Merge pull request #1590 from bcgov/bugfix/AB#29617-dashboard-url-exc…
JamesPasta Aug 12, 2025
5eda023
Merge pull request #1589 from bcgov/feature/AB#29719-update-electoral…
JamesPasta Aug 12, 2025
b03e921
Merge pull request #1588 from bcgov/feature/AB#29194-tag-delete-message
JamesPasta Aug 12, 2025
d169c1b
Merge pull request #1583 from bcgov/bugfix/AB#29251-Error-data-restor…
JamesPasta Aug 12, 2025
5e5c9f1
AB#29512 - History Service - Support rendering of deleted users
plavoie-BC Aug 12, 2025
6646761
Merge remote-tracking branch 'origin/dev' into bugfix/AB#29512-histor…
plavoie-BC Aug 12, 2025
e718415
feature/AB#25072 Notification group frontend almost done
cyrusparsons Aug 12, 2025
b5bbeb7
Merge pull request #1593 from bcgov/bugfix/AB#29512-history-widget-us…
JamesPasta Aug 13, 2025
02b0eb8
feature/AB#25072 Groups fully functional need to clean up
cyrusparsons Aug 13, 2025
b6d7966
Merge branch 'dev' into feature/AB#28858-add-multiple-worksheet
aurelio-aot Aug 13, 2025
5e69da3
Merge pull request #1594 from bcgov/dev
JamesPasta Aug 13, 2025
d33ca35
AB#28858: Improve Link Worksheets UI
aurelio-aot Aug 14, 2025
782d956
feature/AB#25072 About to start SonarQube Fixes
cyrusparsons Aug 14, 2025
01af828
AB#28858: Fix worksheets ordering
aurelio-aot Aug 14, 2025
50ccdbf
Add border to display-input labels shown in Details tab
plavoie-BC Aug 14, 2025
fb5a37e
feature/AB#25072 Sonarqube Fixes
cyrusparsons Aug 14, 2025
b47d40d
AB#28858: Fix bug on saving Project Info single worksheets
aurelio-aot Aug 14, 2025
d028456
AB#28858: Fix bugs on saving CheckboxGroupWidget
aurelio-aot Aug 14, 2025
fa4883e
Merge pull request #1596 from bcgov/feature/AB#25072-frontend-interna…
JamesPasta Aug 15, 2025
f8ab649
Merge pull request #1595 from bcgov/bugfix/AB#29688-border-display-in…
JamesPasta Aug 15, 2025
389e8b4
bugfix/AB#29764-DropAccountCodingColumnsFromConfig
JamesPasta Aug 15, 2025
ed3aebc
Merge pull request #1597 from bcgov/bugfix/AB#29764-DropColumnsFromPa…
JamesPasta Aug 15, 2025
e0e44d4
fixsonarQube
JamesPasta Aug 15, 2025
d76e28c
Merge pull request #1599 from bcgov/bugfix/AB#29688-FixSonarQube
JamesPasta Aug 15, 2025
a1cd3e4
Merge pull request #1598 from bcgov/dev
JamesPasta Aug 15, 2025
ec4e4b7
AB#28858: Fix bug, Applicant Info worksheet widgets not saving
aurelio-aot Aug 15, 2025
89c7260
Update applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.F…
aurelio-aot Aug 15, 2025
3492085
bugfix/AB#27987-PreventPaymentL3
JamesPasta Aug 15, 2025
4280837
Merge pull request #1600 from bcgov/feature/AB#27987-PreventPaymentOnL3
JamesPasta Aug 15, 2025
1abb17d
Merge pull request #1601 from bcgov/dev
JamesPasta Aug 15, 2025
8660506
Merge pull request #1586 from bcgov/feature/AB#28858-add-multiple-wor…
JamesPasta Aug 18, 2025
b4fc1ab
AB#28858: Fix sonarqube issues
aurelio-aot Aug 18, 2025
8b5c038
Merge pull request #1602 from bcgov/feature/AB#28858-add-multiple-wor…
JamesPasta Aug 18, 2025
4489fb3
Merge pull request #1603 from bcgov/dev
JamesPasta Aug 18, 2025
bd11a96
bugfix/AB#29882-OnlyChangeTypeJsonFields
JamesPasta Aug 18, 2025
dcbdef7
Merge pull request #1604 from bcgov/bugfix/AB#29882-MappingFormIOJson…
JamesPasta Aug 19, 2025
13adf0a
Merge pull request #1605 from bcgov/dev
JamesPasta Aug 19, 2025
83c3bf0
AB#29758 - Refactor Tag Renaming and Remove Legacy CSV Based Tag Names
plavoie-BC Aug 19, 2025
a0fe7d6
AB#28768 - Refactor Breadcrumb Form Metadata Retrieval
plavoie-BC Aug 19, 2025
fe508c6
Merge pull request #1606 from bcgov/bugfix/AB#29758-refactor-tag-rename
JamesPasta Aug 19, 2025
13730dd
Merge pull request #1607 from bcgov/dev
JamesPasta Aug 19, 2025
02a1ac4
AB#28768 - Add Form Version Details to Breadcrumb
plavoie-BC Aug 19, 2025
4c64f37
Merge remote-tracking branch 'origin/dev' into feature/AB#28768-form-…
plavoie-BC Aug 19, 2025
88e58b3
AB#28768 - Form Version Breadcrumb Code Quality Fix
plavoie-BC Aug 19, 2025
ec307ba
AB#29710 - Notification Template - Add Requested Amount
plavoie-BC Aug 19, 2025
7466480
AB#29710 - Fix typo in TemplatesServices.cs
plavoie-BC Aug 19, 2025
3a90807
AB#29710 - Update TemplatesService.cs
plavoie-BC Aug 19, 2025
254178f
Merge pull request #1609 from bcgov/feature/AB#28768-form-version-bre…
JamesPasta Aug 19, 2025
3b59a1b
Merge pull request #1610 from bcgov/feature/AB#29710-notification-tem…
JamesPasta Aug 19, 2025
5149177
Merge pull request #1612 from bcgov/dev
JamesPasta Aug 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Unity.Flex.WorksheetInstances
{
public interface IWorksheetInstanceAppService : IApplicationService
{
Task<WorksheetInstanceDto> GetByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, Guid? worksheetId, string uiAnchor);
Task<WorksheetInstanceDto> GetByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, Guid worksheetId, string uiAnchor);
Task<WorksheetInstanceDto> CreateAsync(CreateWorksheetInstanceDto dto);
Task UpdateAsync(PersistWorksheetIntanceValuesDto dto);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;

namespace Unity.Flex.Worksheets
{
public class CustomDataFieldDto
{
public dynamic? CustomFields { get; set; }
public Guid CorrelationId { get; set; }
public Guid WorksheetId { get; set; }
public Guid WorksheetId { get; set; } // Keep for backward compatibility
public List<Guid> WorksheetIds { get; set; } = new List<Guid>(); // NEW - multiple worksheets support
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface IWorksheetAppService : IApplicationService
Task<WorksheetDto> GetAsync(Guid id);
Task<List<WorksheetDto>> GetListAsync();
Task<List<WorksheetDto>> GetListByCorrelationAsync(Guid correlationId, string correlationProvider);
Task<WorksheetDto?> GetByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, string uiAnchor);
Task<List<WorksheetDto>> GetListByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, string uiAnchor);
Task<WorksheetDto> CreateAsync(CreateWorksheetDto dto);
Task<WorksheetSectionDto> CreateSectionAsync(Guid id, CreateSectionDto dto);
Task<WorksheetDto> EditAsync(Guid id, EditWorksheetDto dto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ public async Task PersistWorksheetData(PersistWorksheetIntanceValuesEto eventDat
Worksheet? worksheet;
if (string.IsNullOrEmpty(eventData.FormDataName))
{
worksheet = await worksheetRepository.GetByCorrelationAnchorAsync(eventData.SheetCorrelationId, eventData.SheetCorrelationProvider, eventData.UiAnchor, true);
if (eventData.WorksheetId == Guid.Empty)
{
// WorksheetId is not set; cannot proceed.
return;
}
worksheet = await worksheetRepository.GetAsync(eventData.WorksheetId, true);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace Unity.Flex.Domain.WorksheetInstances
public interface IWorksheetInstanceRepository : IBasicRepository<WorksheetInstance, Guid>
{
Task<WorksheetInstance?> GetByCorrelationAnchorWorksheetAsync(Guid correlationId, string correlationProvider, Guid worksheetId, string uiAnchor, bool includeDetails);
Task<WorksheetInstance?> GetByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, string uiAnchor, bool includeDetails);
Task<List<WorksheetInstance>> GetByWorksheetCorrelationAsync(Guid worksheetId, string uiAnchor, Guid worksheetCorrelationId, string worksheetCorrelationProvider);
Task<WorksheetInstance?> GetWithValuesAsync(Guid worksheetInstanceId);
Task<bool> ExistsAsync(Guid worksheetId, Guid instanceCorrelationId, string instanceCorrelationProvider, Guid sheetCorrelationId, string sheetCorrelationProvider, string? uiAnchor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface IWorksheetRepository : IBasicRepository<Worksheet, Guid>
{
Task<Worksheet> GetAsync(Guid id, bool includeDetails = true);
Task<List<Worksheet>> GetListAsync(bool includeDetails = false);
Task<Worksheet?> GetByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, string uiAnchor, bool includeDetails = false);
Task<List<Worksheet>> GetListByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, string uiAnchor, bool includeDetails = false);
Task<Worksheet?> GetByCorrelationByNameAsync(Guid correlationId, string correlationProvider, string name, bool includeDetails = false);
Task<Worksheet?> GetByNameAsync(string name, bool includeDetails = false);
Task<Worksheet?> GetBySectionAsync(Guid id, bool includeDetails = false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,6 @@ public class WorksheetInstanceRepository(IDbContextProvider<FlexDbContext> dbCon
&& s.UiAnchor == uiAnchor);
}

public async Task<WorksheetInstance?> GetByCorrelationAnchorAsync(Guid correlationId,
string correlationProvider,
string uiAnchor,
bool includeDetails)
{
var dbSet = await GetDbSetAsync();

return await dbSet.IncludeDetails(includeDetails)
.FirstOrDefaultAsync(s => s.CorrelationId == correlationId
&& s.CorrelationProvider == correlationProvider
&& s.UiAnchor == uiAnchor);
}

public async Task<List<WorksheetInstance>> GetByWorksheetCorrelationAsync(Guid worksheetId,
string uiAnchor,
Guid worksheetCorrelationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,28 @@ namespace Unity.Flex.EntityFrameworkCore.Repositories
{
public class WorksheetRepository(IDbContextProvider<FlexDbContext> dbContextProvider) : EfCoreRepository<FlexDbContext, Worksheet, Guid>(dbContextProvider), IWorksheetRepository
{
public async Task<Worksheet?> GetByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, string uiAnchor, bool includeDetails = false)
public async Task<List<Worksheet>> GetListByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, string uiAnchor, bool includeDetails = false)
{
var dbSet = await GetDbSetAsync();

return await dbSet
.IncludeDetails(includeDetails)
.FirstOrDefaultAsync(s => s.Links.Any(s => s.CorrelationId == correlationId && s.CorrelationProvider == correlationProvider && s.UiAnchor == uiAnchor));
// First, get the worksheet IDs with their order from Links
var worksheetIdsWithOrder = await dbSet
.SelectMany(w => w.Links)
.Where(l => l.CorrelationId == correlationId && l.CorrelationProvider == correlationProvider && l.UiAnchor == uiAnchor)
.Select(l => new { l.WorksheetId, l.Order })
.ToListAsync();

var worksheetIds = worksheetIdsWithOrder.Select(w => w.WorksheetId).ToList();

// Then get the full worksheets
var worksheets = await dbSet
.IncludeDetails(includeDetails)
.Where(w => worksheetIds.Contains(w.Id))
.ToListAsync();

// Finally, order them in memory using the order we retrieved
var orderLookup = worksheetIdsWithOrder.ToDictionary(w => w.WorksheetId, w => w.Order ?? 0);
return worksheets.OrderBy(w => orderLookup[w.Id]).ToList();
}

public async Task<Worksheet?> GetByCorrelationByNameAsync(Guid correlationId, string correlationProvider, string name, bool includeDetails = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public static IQueryable<Worksheet> IncludeDetails(this IQueryable<Worksheet> qu
{
return !include ? queryable : queryable
.Include(s => s.Sections.OrderBy(s => s.Order))
.ThenInclude(s => s.Fields.OrderBy(s => s.Order));
.ThenInclude(s => s.Fields.OrderBy(s => s.Order))
.Include(s => s.Links);
}

public static IQueryable<WorksheetInstance> IncludeDetails(this IQueryable<WorksheetInstance> queryable, bool include = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ public virtual async Task<List<WorksheetDto>> GetListByCorrelationAsync(Guid cor
return ObjectMapper.Map<List<Worksheet>, List<WorksheetDto>>(worksheets);
}

public virtual async Task<WorksheetDto?> GetByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, string uiAnchor)
public virtual async Task<List<WorksheetDto>> GetListByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, string uiAnchor)
{
var worksheet = await worksheetRepository.GetByCorrelationAnchorAsync(correlationId, correlationProvider, uiAnchor, true);
var worksheets = await worksheetRepository.GetListByCorrelationAnchorAsync(correlationId, correlationProvider, uiAnchor, true);

if (worksheet == null) return null;

return ObjectMapper.Map<Worksheet, WorksheetDto>(worksheet);
return ObjectMapper.Map<List<Worksheet>, List<WorksheetDto>>(worksheets);
}

public virtual async Task<WorksheetDto> CreateAsync(CreateWorksheetDto dto)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ namespace Unity.Flex.WorksheetInstances
[Authorize]
public class WorksheetInstanceAppService(IWorksheetInstanceRepository worksheetInstanceRepository, WorksheetsManager worksheetsManager) : FlexAppService, IWorksheetInstanceAppService
{
public virtual async Task<WorksheetInstanceDto> GetByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, Guid? worksheetId, string uiAnchor)
public virtual async Task<WorksheetInstanceDto> GetByCorrelationAnchorAsync(Guid correlationId, string correlationProvider, Guid worksheetId, string uiAnchor)
{
if (worksheetId == null)
return ObjectMapper.Map<WorksheetInstance?, WorksheetInstanceDto>(await worksheetInstanceRepository.GetByCorrelationAnchorAsync(correlationId, correlationProvider, uiAnchor, true));
else
return ObjectMapper.Map<WorksheetInstance?, WorksheetInstanceDto>(await worksheetInstanceRepository.GetByCorrelationAnchorWorksheetAsync(correlationId, correlationProvider, worksheetId.Value, uiAnchor, true));
return ObjectMapper.Map<WorksheetInstance?, WorksheetInstanceDto>(await worksheetInstanceRepository.GetByCorrelationAnchorWorksheetAsync(correlationId, correlationProvider, worksheetId, uiAnchor, true));
}

public virtual async Task<WorksheetInstanceDto> CreateAsync(CreateWorksheetInstanceDto dto)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ private static async Task AddAndUnorphanLinksAsync(IWorksheetLinkRepository work
List<WorksheetLinkDto> refreshedLinks)
{
// Add new
foreach (var (worksheetId, anchor, _) in dto.WorksheetAnchors)
foreach (var (worksheetId, anchor, order) in dto.WorksheetAnchors)
{
if (worksheetLinks.Find(s => s.CorrelationId == dto.CorrelationId
&& s.CorrelationProvider == dto.CorrelationProvider
&& s.WorksheetId == worksheetId) == null)
{
var newLink = new WorksheetLink(Guid.NewGuid(), worksheetId, dto.CorrelationId, dto.CorrelationProvider, anchor);
var newLink = new WorksheetLink(Guid.NewGuid(), worksheetId, dto.CorrelationId, dto.CorrelationProvider, anchor, order);

var worksheetInstances = await worksheetInstanceRepository
.GetByWorksheetCorrelationAsync(worksheetId, ORPHANED, dto.CorrelationId, dto.CorrelationProvider);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Unity.Flex.Web.Views.Shared.Components.WorksheetInstanceWidget.ViewModels;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
Expand All @@ -16,12 +17,13 @@ namespace Unity.Flex.Web.Views.Shared.Components.BCAddressWidget
AutoInitialize = true)]
public class BCAddressWidget : AbpViewComponent
{
public async Task<IViewComponentResult> InvokeAsync(WorksheetFieldViewModel? fieldModel, string modelName)
public async Task<IViewComponentResult> InvokeAsync(WorksheetFieldViewModel? fieldModel, string modelName, Guid? worksheetId = null)
{
return View(await Task.FromResult(new BCAddressViewModel()
{
Field = fieldModel,
Name = modelName
Name = modelName,
WorksheetId = worksheetId
}));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using Unity.Flex.Web.Views.Shared.Components.WorksheetInstanceWidget.ViewModels;
using Unity.Modules.Shared.Utils;
using Volo.Abp.AspNetCore.Mvc;
Expand All @@ -12,14 +13,14 @@ public class BCAddressWidgetController : AbpController
{
[HttpGet]
[Route("Refresh")]
public IActionResult Refresh(WorksheetFieldViewModel? fieldModel, string modelName)
public IActionResult Refresh(WorksheetFieldViewModel? fieldModel, string modelName, Guid? worksheetId = null)
{
if (!ModelState.IsValid)
{
Logger.LogWarning("Invalid model state for Refresh: {ModelName}, {FieldModel}", modelName.SanitizeField(), fieldModel?.Id.ToString());
return ViewComponent(typeof(BCAddressWidget));
}
return ViewComponent(typeof(BCAddressWidget), new { fieldModel, modelName });
return ViewComponent(typeof(BCAddressWidget), new { fieldModel, modelName, worksheetId });
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Unity.Flex.Web.Views.Shared.Components.WorksheetInstanceWidget.ViewModels;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
Expand All @@ -16,9 +17,9 @@ namespace Unity.Flex.Web.Views.Shared.Components.CheckboxGroupWidget
AutoInitialize = true)]
public class CheckboxGroupWidget : AbpViewComponent
{
public async Task<IViewComponentResult> InvokeAsync(WorksheetFieldViewModel? fieldModel, string modelName)
public async Task<IViewComponentResult> InvokeAsync(WorksheetFieldViewModel? fieldModel, string modelName, Guid? worksheetId = null)
{
return View(await Task.FromResult(new CheckboxGroupViewModel() { Field = fieldModel, Name = modelName }));
return View(await Task.FromResult(new CheckboxGroupViewModel() { Field = fieldModel, Name = modelName, WorksheetId = worksheetId }));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using System;
using Unity.Flex.Web.Views.Shared.Components.WorksheetInstanceWidget.ViewModels;
using Volo.Abp.AspNetCore.Mvc;

Expand All @@ -10,12 +11,12 @@ public class CheckboxGroupWidgetController : AbpController
{
[HttpGet]
[Route("Refresh")]
public IActionResult Refresh(WorksheetFieldViewModel? fieldModel, string modelName)
public IActionResult Refresh(WorksheetFieldViewModel? fieldModel, string modelName, Guid? worksheetId = null)
{

if (ModelState.IsValid)
{
return ViewComponent(typeof(CheckboxGroupWidget), new { fieldModel, modelName });
return ViewComponent(typeof(CheckboxGroupWidget), new { fieldModel, modelName, worksheetId });

}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,34 @@

@if (Model.Field != null)
{

<fieldset>
<legend></legend>
@{
var checkedValues = Model.Field?.CurrentValue?.GetCheckedOptions() ?? [];
foreach (var option in ((CheckboxGroupDefinition?)Model.Field?.Definition?.ConvertDefinition(Model.Field.Type))?.Options ?? [])
{
{
var optionId = Model.WorksheetId.HasValue
? $"{Model.Field?.Name}.{Model.Name}.{Model.Field?.Id}.{option.Key}.{Model.WorksheetId}"
: $"{Model.Field?.Name}.{Model.Name}.{Model.Field?.Id}.{option.Key}";

<div class="custom-fields-checkbox-wrapper">
@if (checkedValues.Contains(option.Key))
{
<input type="@Model.Field?.Type.ConvertInputType()"
id="@($"{Model.Field?.Name}.{Model.Name}.{Model.Field?.Id}.{option.Key}")"
name="@($"{Model.Field?.Name}.{Model.Name}.{Model.Field?.Id}.{option.Key}")"
id="@optionId"
name="@optionId"
onchange="@($"notifyFieldChange('{Model.Name}', '{Model.Field?.UiAnchor}', this)")"
checked />
}
else
{
<input type="@Model.Field?.Type.ConvertInputType()"
id="@($"{Model.Field?.Name}.{Model.Name}.{Model.Field?.Id}.{option.Key}")"
name="@($"{Model.Field?.Name}.{Model.Name}.{Model.Field?.Id}.{option.Key}")"
id="@optionId"
name="@optionId"
onchange="@($"notifyFieldChange('{Model.Name}','{Model.Field?.UiAnchor}', this)")" />
}
<label for="@($"{Model.Field?.Name}.{Model.Name}.{Model.Field?.Id}")">@($"{option.Label}")</label>
<label for="@optionId">@($"{option.Label}")</label>
</div>
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Unity.Flex.Web.Views.Shared.Components.WorksheetInstanceWidget.ViewModels;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
Expand All @@ -16,9 +17,9 @@ namespace Unity.Flex.Web.Views.Shared.Components.CheckboxWidget
AutoInitialize = true)]
public class CheckboxWidget : AbpViewComponent
{
public async Task<IViewComponentResult> InvokeAsync(WorksheetFieldViewModel? fieldModel, string modelName)
public async Task<IViewComponentResult> InvokeAsync(WorksheetFieldViewModel? fieldModel, string modelName, Guid? worksheetId = null)
{
return View(await Task.FromResult(new CheckboxViewModel() { Field = fieldModel, Name = modelName }));
return View(await Task.FromResult(new CheckboxViewModel() { Field = fieldModel, Name = modelName, WorksheetId = worksheetId }));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using Unity.Flex.Web.Views.Shared.Components.WorksheetInstanceWidget.ViewModels;
using Unity.Modules.Shared.Utils;
using Volo.Abp.AspNetCore.Mvc;
Expand All @@ -12,15 +13,15 @@ public class CheckboxWidgetController : AbpController
{
[HttpGet]
[Route("Refresh")]
public IActionResult Refresh(WorksheetFieldViewModel? fieldModel, string modelName)
public IActionResult Refresh(WorksheetFieldViewModel? fieldModel, string modelName, Guid? worksheetId = null)
{
if (!ModelState.IsValid)
{
Logger.LogWarning("Invalid model state for Refresh: {ModelName}", modelName.SanitizeField());
return ViewComponent(typeof(CheckboxWidget));
}

return ViewComponent(typeof(CheckboxWidget), new { fieldModel, modelName });
return ViewComponent(typeof(CheckboxWidget), new { fieldModel, modelName, worksheetId });
}
}
}
Loading