Add one-click Demo Company reset for tutorial recording prep
New ResetDemoCompany POST action wipes all seeded data (customers, jobs, quotes, invoices, inventory, equipment, catalog, pricing tiers, operating costs) from the DEMO company and immediately re-seeds with fresh records dated relative to today. Seed data already used relative dates so every reset produces a realistic, current-looking dataset. View adds a red "Reset Demo Company" card at the top of the Seed Data page, visible only when the DEMO company exists. Single button with confirm dialog; shows exactly what will be wiped and what will be preserved (user accounts, company settings, lookup tables). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,44 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Demo Reset Card — only shown when the DEMO company exists -->
|
||||
@{
|
||||
var demoCompany = Model?.FirstOrDefault(c => c.CompanyCode == "DEMO");
|
||||
}
|
||||
@if (demoCompany != null)
|
||||
{
|
||||
<div class="card mb-4 border-danger">
|
||||
<div class="card-header bg-danger text-white d-flex align-items-center gap-2">
|
||||
<i class="bi bi-arrow-repeat fs-5"></i>
|
||||
<h5 class="mb-0">Reset Demo Company</h5>
|
||||
<span class="badge bg-white text-danger ms-auto">Tutorial Prep</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text">
|
||||
Wipes <strong>all seeded data</strong> from the Demo Company and immediately re-seeds it with
|
||||
fresh records dated relative to <strong>today</strong>. Use this before every recording session
|
||||
so jobs, quotes, invoices, and AR aging always look current.
|
||||
</p>
|
||||
<ul class="mb-3 small">
|
||||
<li>Removes: customers, jobs, quotes, invoices, inventory, equipment, catalog, pricing tiers, operating costs</li>
|
||||
<li>Re-seeds: 100 customers, 50 jobs across all statuses, quotes, invoices, inventory transactions, vendor bills, appointments — all dated from today</li>
|
||||
<li>Preserves: user accounts, company settings, lookup tables (job statuses, priorities, etc.)</li>
|
||||
</ul>
|
||||
<div class="alert alert-warning alert-permanent mb-3">
|
||||
<i class="bi bi-exclamation-triangle-fill me-2"></i>
|
||||
<strong>This permanently deletes and recreates all demo data.</strong> Any manual edits made to the demo company will be lost.
|
||||
</div>
|
||||
<form asp-action="ResetDemoCompany" method="post"
|
||||
onsubmit="return confirm('Reset the Demo Company?\n\nThis will DELETE all seeded data and re-seed it with fresh records dated today.\n\nAny manual edits to the demo company will be lost.');">
|
||||
@Html.AntiForgeryToken()
|
||||
<button type="submit" class="btn btn-danger">
|
||||
<i class="bi bi-arrow-repeat me-2"></i>Reset Demo Company Now
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- System Data Card -->
|
||||
<div class="card mb-4 border-primary">
|
||||
<div class="card-header bg-primary text-white">
|
||||
|
||||
Reference in New Issue
Block a user