Add Formula Library ratings, Job Profitability report, and Quote Revision History improvements

- Formula Library ratings: thumbs up/down per company per formula; toggle on/off; sorts by net score; own formulas not rateable; FormulaLibraryRating entity + migration AddFormulaLibraryRatings
- Job Profitability report: actual labor cost (logged hours x StandardLaborRate) vs powder cost vs billed price per job; gross margin % color-coded; time-tracked-only filter; totals footer
- Quote Revision History: track Total price changes on every save; log Sent/Resent events with recipient email; replace flat table with grouped timeline UI (icons per event type, total-change badge on header)
- Setup Wizard: cap CompletedCount at TotalSteps so old 10-step data no longer shows 10/5
- Formula Library card: fix badge overflow on long titles; add Rate: label to make voting buttons discoverable
- Help docs and AI knowledge base updated for all three features

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 09:02:07 -04:00
parent 81119035c7
commit ed35362c7a
24 changed files with 12273 additions and 75 deletions
@@ -26,6 +26,15 @@ public class FormulaLibraryCardDto
/// <summary>True when this formula was shared by the current browsing company.</summary>
public bool IsOwnFormula { get; set; }
/// <summary>Total thumbs-up votes across all companies.</summary>
public int ThumbsUp { get; set; }
/// <summary>Total thumbs-down votes across all companies.</summary>
public int ThumbsDown { get; set; }
/// <summary>The current browsing company's vote: true = up, false = down, null = no vote.</summary>
public bool? MyVote { get; set; }
}
// ── Full detail (import preview modal) ────────────────────────────────────
@@ -18,7 +18,8 @@ public class WizardProgressDto
public bool IsStepSkipped(int step) => SkippedSteps.Contains(step);
public bool IsStepTouched(int step) => IsStepDone(step) || IsStepSkipped(step);
public int CompletedCount => DoneSteps.Count + SkippedSteps.Count;
// Capped at TotalSteps so old step data from a larger wizard doesn't overflow the display.
public int CompletedCount => Math.Min(DoneSteps.Count + SkippedSteps.Count, TotalSteps);
public int ProgressPercent => TotalSteps == 0 ? 0 : (int)Math.Round((double)CompletedCount / TotalSteps * 100);
}
@@ -48,4 +48,14 @@ public interface IFormulaLibraryService
/// when a diagram is deleted or replaced.
/// </summary>
Task CascadeRemoveDiagramAsync(int sourceCustomItemTemplateId);
/// <summary>
/// Records or toggles a thumbs-up/down vote from the given company.
/// If the same vote already exists it is removed (toggle off).
/// If the opposite vote exists it is replaced.
/// Companies cannot rate their own formulas.
/// Returns the updated counts for the library entry.
/// </summary>
Task<(int ThumbsUp, int ThumbsDown, bool? MyVote)> RateAsync(
int libraryItemId, int companyId, bool isPositive);
}