Share Mark Complete modal as partial view; hide install button after PWA install

- Extract _CompleteJobModal.cshtml partial; Details.cshtml uses PartialAsync
- Job board COMPLETED drop fetches partial via AJAX and shows modal in-place
- Add GET Jobs/CompleteJobModal action to load job data for the board modal
- install-app.js: persist installed state in localStorage; clears automatically when browser re-fires beforeinstallprompt after uninstall

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 19:55:37 -04:00
parent bbedaedeaa
commit 2cfe093780
5 changed files with 207 additions and 159 deletions
@@ -0,0 +1,146 @@
@model PowderCoating.Application.DTOs.Job.JobDto
@{
var emailDefault = ViewBag.EmailDefaultOnComplete == true;
}
<div class="modal fade" id="completeJobModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<form asp-action="CompleteJob" method="post">
@Html.AntiForgeryToken()
<input type="hidden" name="JobId" value="@Model.Id" />
<div class="modal-header bg-success bg-opacity-10">
<h5 class="modal-title">
<i class="bi bi-check-circle me-2 text-success"></i>Complete Job: @Model.JobNumber
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="mb-4">
<label for="actualTimeSpent" class="form-label fw-semibold">
<i class="bi bi-clock me-1 text-primary"></i>Actual Time Spent (hours)
</label>
<input type="number" class="form-control" id="actualTimeSpent" name="ActualTimeSpentHours"
step="0.25" min="0" placeholder="Enter total hours spent on this job">
<div class="form-text">Enter the total time in hours (e.g., 2.5 for 2 hours 30 minutes)</div>
</div>
@if (Model.Items != null && Model.Items.Any())
{
<div class="mb-3">
<h6 class="fw-semibold mb-3">
<i class="bi bi-palette me-1 text-primary"></i>Actual Powder Usage
</h6>
<div class="table-responsive">
<table class="table table-sm table-hover">
<thead class="table-light">
<tr>
<th>Item</th>
<th>Coat</th>
<th>Color</th>
<th class="text-end">Estimated (lbs)</th>
<th>Actual (lbs)</th>
</tr>
</thead>
<tbody>
@{
var coatIndex = 0;
}
@foreach (var item in Model.Items)
{
if (item.Coats != null && item.Coats.Any())
{
foreach (var coat in item.Coats.OrderBy(c => c.Sequence))
{
<tr>
<td>
<small>@item.Description</small>
@if (item.Quantity > 1)
{
<span class="badge bg-secondary ms-1">&times;@item.Quantity</span>
}
</td>
<td><span class="badge bg-secondary">@coat.CoatName</span></td>
<td>
@if (!string.IsNullOrEmpty(coat.ColorName))
{
<small>
@coat.ColorName
@if (!string.IsNullOrEmpty(coat.ColorCode))
{
<span class="text-muted">(@coat.ColorCode)</span>
}
</small>
}
</td>
<td class="text-end">
<small class="text-muted">@((coat.PowderToOrder ?? 0).ToString("0.##"))</small>
</td>
<td>
<input type="hidden" name="CoatUsages[@coatIndex].JobItemCoatId" value="@coat.Id" />
<input type="number"
class="form-control form-control-sm"
name="CoatUsages[@coatIndex].ActualPowderUsedLbs"
step="0.01" min="0" placeholder="0.00"
style="max-width: 120px;">
</td>
</tr>
coatIndex++;
}
}
else
{
<tr class="table-secondary">
<td colspan="5">
<small class="text-muted fst-italic">
<i class="bi bi-info-circle me-1"></i>
@item.Description — No coat information available (legacy job item)
</small>
</td>
</tr>
}
}
</tbody>
</table>
</div>
<div class="alert alert-info mb-0">
<i class="bi bi-info-circle me-2"></i>
<small>Enter the actual amount of powder used for each coat. Leave blank if not tracked.</small>
</div>
</div>
}
</div>
<div class="modal-footer justify-content-between">
<div class="d-flex align-items-center gap-2 flex-wrap">
@if (!string.IsNullOrWhiteSpace(Model.CustomerEmail))
{
<div class="form-check form-switch mb-0">
<input class="form-check-input" type="checkbox" role="switch"
id="completeJobSendEmail" name="SendEmailToCustomer" value="true"
@(emailDefault ? "checked" : "") />
<label class="form-check-label small" for="completeJobSendEmail">
<i class="bi bi-envelope me-1"></i>Notify customer via email
</label>
</div>
}
@if (Model.CustomerNotifyBySms && !string.IsNullOrWhiteSpace(Model.CustomerMobilePhone))
{
<span class="badge bg-info text-white">
<i class="bi bi-phone me-1"></i>SMS notification will be sent
</span>
}
else if (!string.IsNullOrWhiteSpace(Model.CustomerMobilePhone) && !Model.CustomerNotifyBySms)
{
<span class="text-muted small"><i class="bi bi-phone-slash me-1"></i>SMS consent required</span>
}
</div>
<div>
<button type="button" class="btn btn-secondary me-2" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-success">
<i class="bi bi-check-circle me-1"></i>Mark as Completed
</button>
</div>
</div>
</form>
</div>
</div>
</div>