From bade0bab989524a2feda40861f9c328d08d276d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Sun, 7 Jun 2026 10:52:28 +0300 Subject: [PATCH] =?UTF-8?q?Workflow=20d=C3=BCzeltmeleri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ListForms/ListFormWorkflowAppService.cs | 45 ++++++++++--------- ui/src/views/list/useToolbar.tsx | 1 + 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/api/src/Sozsoft.Platform.Application/ListForms/ListFormWorkflowAppService.cs b/api/src/Sozsoft.Platform.Application/ListForms/ListFormWorkflowAppService.cs index 6c9d8be..8655dab 100644 --- a/api/src/Sozsoft.Platform.Application/ListForms/ListFormWorkflowAppService.cs +++ b/api/src/Sozsoft.Platform.Application/ListForms/ListFormWorkflowAppService.cs @@ -303,7 +303,13 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA var start = context.Criteria.FirstOrDefault(x => x.Kind == "Start") ?? throw new UserFriendlyException("Workflow başlangıç adımı bulunamadı."); - return await RunUntilWaitAsync(context, start); + var result = await RunUntilWaitAsync(context, start); + await InsertWorkflowNoteAsync( + context, + $"Workflow Started: {start.Title}", + BuildWorkflowNoteContent(context.WorkflowNoteRows)); + + return result; } [HttpPost("decision")] @@ -368,8 +374,14 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA } var next = FindNextCriteria(context.Criteria, input.Approved ? current.NextOnApprove : current.NextOnReject); - await LogWorkflowDecisionAsync(context, current, next, input.Approved, input.Note); - return await RunUntilWaitAsync(context, next); + AddWorkflowDecisionRows(context, current, next, input.Approved, input.Note ?? string.Empty); + var result = await RunUntilWaitAsync(context, next); + await InsertWorkflowNoteAsync( + context, + $"Workflow {(input.Approved ? "Approved" : "Rejected")}: {current.Title}", + BuildWorkflowNoteContent(context.WorkflowNoteRows)); + + return result; } private async Task RunForEachKeyAsync( @@ -522,7 +534,7 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA informedRecipient = await SendInformEmailAsync(context, node); } - await LogWorkflowNodeAsync(context, node, informedRecipient); + AddWorkflowNodeRows(context, node, informedRecipient ?? string.Empty); } private async Task SendInformEmailAsync(WorkflowRunContext context, ListFormWorkflow node) @@ -590,7 +602,7 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA """; } - private async Task LogWorkflowDecisionAsync( + private static void AddWorkflowDecisionRows( WorkflowRunContext context, ListFormWorkflow current, ListFormWorkflow next, @@ -598,16 +610,11 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA string description) { var action = approved ? "Approved" : "Rejected"; - var subject = $"Workflow {action}: {current.Title}"; - var rows = new List<(string Label, string Value)>(); - - rows.Add(("Description", description ?? string.Empty)); - rows.Add(("Next Step", FormatNode(next))); - - await InsertWorkflowNoteAsync(context, subject, BuildWorkflowNoteContent(rows)); + context.WorkflowNoteRows.Add(("Decision: ", $"{action}: {FormatNode(current)}")); + context.WorkflowNoteRows.Add(("Description: ", description ?? string.Empty)); } - private async Task LogWorkflowNodeAsync( + private static void AddWorkflowNodeRows( WorkflowRunContext context, ListFormWorkflow node, string informedRecipient) @@ -622,19 +629,12 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA _ => "Processed" }; - var subject = $"Workflow {action}: {node.Title}"; - var rows = new List<(string Label, string Value)>(); + context.WorkflowNoteRows.Add(($"{action}: ", $"{FormatNode(node)}")); if (!node.Approver.IsNullOrWhiteSpace()) { - rows.Add((node.Kind == "Inform" ? "Inform Target" : "Approver", node.Approver)); + context.WorkflowNoteRows.Add((node.Kind == "Inform" ? "Inform: " : "Approver: ", node.Approver)); } - if (!informedRecipient.IsNullOrWhiteSpace()) - { - rows.Add(("Informed Email", informedRecipient)); - } - - await InsertWorkflowNoteAsync(context, subject, BuildWorkflowNoteContent(rows)); } private async Task InsertWorkflowNoteAsync( @@ -1136,5 +1136,6 @@ public class ListFormWorkflowAppService : PlatformAppService, IListFormWorkflowA IDictionary Row) { public HashSet UserUpdatedFields { get; } = []; + public List<(string Label, string Value)> WorkflowNoteRows { get; } = []; } } diff --git a/ui/src/views/list/useToolbar.tsx b/ui/src/views/list/useToolbar.tsx index 9b08d79..a2506aa 100644 --- a/ui/src/views/list/useToolbar.tsx +++ b/ui/src/views/list/useToolbar.tsx @@ -654,6 +654,7 @@ function WorkflowApprovalDecisionDialog({ className="input input-textarea mb-4 min-h-[96px] w-full resize-y" rows={4} value={note} + autoFocus placeholder="Onay veya red aciklamasi" onChange={(event) => setNote(event.target.value)} />