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
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,92 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PowderCoating.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddFormulaLibraryRatings : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "FormulaLibraryRatings",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FormulaLibraryItemId = table.Column<int>(type: "int", nullable: false),
CompanyId = table.Column<int>(type: "int", nullable: false),
IsPositive = table.Column<bool>(type: "bit", nullable: false),
RatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FormulaLibraryRatings", x => x.Id);
table.ForeignKey(
name: "FK_FormulaLibraryRatings_FormulaLibraryItems_FormulaLibraryItemId",
column: x => x.FormulaLibraryItemId,
principalTable: "FormulaLibraryItems",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 6, 1, 12, 29, 35, 841, DateTimeKind.Utc).AddTicks(9377));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 6, 1, 12, 29, 35, 841, DateTimeKind.Utc).AddTicks(9381));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 6, 1, 12, 29, 35, 841, DateTimeKind.Utc).AddTicks(9382));
migrationBuilder.CreateIndex(
name: "IX_FormulaLibraryRatings_Item_Company",
table: "FormulaLibraryRatings",
columns: new[] { "FormulaLibraryItemId", "CompanyId" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "FormulaLibraryRatings");
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 5, 28, 1, 1, 15, 582, DateTimeKind.Utc).AddTicks(3849));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 5, 28, 1, 1, 15, 582, DateTimeKind.Utc).AddTicks(3855));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 5, 28, 1, 1, 15, 582, DateTimeKind.Utc).AddTicks(3856));
}
}
}
@@ -3593,6 +3593,35 @@ namespace PowderCoating.Infrastructure.Migrations
b.ToTable("FormulaLibraryItems");
});
modelBuilder.Entity("PowderCoating.Core.Entities.FormulaLibraryRating", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<int>("FormulaLibraryItemId")
.HasColumnType("int");
b.Property<bool>("IsPositive")
.HasColumnType("bit");
b.Property<DateTime>("RatedAt")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("FormulaLibraryItemId", "CompanyId")
.IsUnique()
.HasDatabaseName("IX_FormulaLibraryRatings_Item_Company");
b.ToTable("FormulaLibraryRatings");
});
modelBuilder.Entity("PowderCoating.Core.Entities.GiftCertificate", b =>
{
b.Property<int>("Id")
@@ -7024,7 +7053,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 1,
CompanyId = 0,
CreatedAt = new DateTime(2026, 5, 28, 1, 1, 15, 582, DateTimeKind.Utc).AddTicks(3849),
CreatedAt = new DateTime(2026, 6, 1, 12, 29, 35, 841, DateTimeKind.Utc).AddTicks(9377),
Description = "Standard pricing for regular customers",
DiscountPercent = 0m,
IsActive = true,
@@ -7035,7 +7064,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 2,
CompanyId = 0,
CreatedAt = new DateTime(2026, 5, 28, 1, 1, 15, 582, DateTimeKind.Utc).AddTicks(3855),
CreatedAt = new DateTime(2026, 6, 1, 12, 29, 35, 841, DateTimeKind.Utc).AddTicks(9381),
Description = "5% discount for preferred customers",
DiscountPercent = 5m,
IsActive = true,
@@ -7046,7 +7075,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 3,
CompanyId = 0,
CreatedAt = new DateTime(2026, 5, 28, 1, 1, 15, 582, DateTimeKind.Utc).AddTicks(3856),
CreatedAt = new DateTime(2026, 6, 1, 12, 29, 35, 841, DateTimeKind.Utc).AddTicks(9382),
Description = "10% discount for premium customers",
DiscountPercent = 10m,
IsActive = true,
@@ -9614,6 +9643,17 @@ namespace PowderCoating.Infrastructure.Migrations
b.Navigation("InspiredBy");
});
modelBuilder.Entity("PowderCoating.Core.Entities.FormulaLibraryRating", b =>
{
b.HasOne("PowderCoating.Core.Entities.FormulaLibraryItem", "FormulaLibraryItem")
.WithMany()
.HasForeignKey("FormulaLibraryItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("FormulaLibraryItem");
});
modelBuilder.Entity("PowderCoating.Core.Entities.GiftCertificate", b =>
{
b.HasOne("PowderCoating.Core.Entities.ApplicationUser", "IssuedBy")