diff --git a/Controllers/VehicleController.cs b/Controllers/VehicleController.cs index 79592b2..27b1762 100644 --- a/Controllers/VehicleController.cs +++ b/Controllers/VehicleController.cs @@ -1256,6 +1256,47 @@ namespace CarCareTracker.Controllers existingRecord.Progress = planProgress; existingRecord.DateModified = DateTime.Now; var result = _planRecordDataAccess.SavePlanRecordToVehicle(existingRecord); + if (planProgress == PlanProgress.Done) + { + //convert plan record to service/upgrade/repair record. + if (existingRecord.ImportMode == ImportMode.ServiceRecord) + { + var newRecord = new ServiceRecord() + { + VehicleId = existingRecord.VehicleId, + Date = DateTime.Now, + Mileage = 0, + Description = existingRecord.Description, + Cost = existingRecord.Cost, + Notes = existingRecord.Notes + }; + _serviceRecordDataAccess.SaveServiceRecordToVehicle(newRecord); + } else if (existingRecord.ImportMode == ImportMode.RepairRecord) + { + var newRecord = new CollisionRecord() + { + VehicleId = existingRecord.VehicleId, + Date = DateTime.Now, + Mileage = 0, + Description = existingRecord.Description, + Cost = existingRecord.Cost, + Notes = existingRecord.Notes + }; + _collisionRecordDataAccess.SaveCollisionRecordToVehicle(newRecord); + } else if (existingRecord.ImportMode == ImportMode.UpgradeRecord) + { + var newRecord = new UpgradeRecord() + { + VehicleId = existingRecord.VehicleId, + Date = DateTime.Now, + Mileage = 0, + Description = existingRecord.Description, + Cost = existingRecord.Cost, + Notes = existingRecord.Notes + }; + _upgradeRecordDataAccess.SaveUpgradeRecordToVehicle(newRecord); + } + } return Json(result); } [HttpGet] diff --git a/Views/Vehicle/_PlanRecordItem.cshtml b/Views/Vehicle/_PlanRecordItem.cshtml index 9315cc9..59cd73d 100644 --- a/Views/Vehicle/_PlanRecordItem.cshtml +++ b/Views/Vehicle/_PlanRecordItem.cshtml @@ -1,9 +1,15 @@ @model PlanRecord -
+
-
- @Model.Description +
+ @if (Model.Progress == PlanProgress.Done) + { + @Model.Description + } else + { + @Model.Description + }
@Model.Cost.ToString("C2") diff --git a/Views/Vehicle/_PlanRecordModal.cshtml b/Views/Vehicle/_PlanRecordModal.cshtml index f155ebe..2a51dbf 100644 --- a/Views/Vehicle/_PlanRecordModal.cshtml +++ b/Views/Vehicle/_PlanRecordModal.cshtml @@ -33,7 +33,6 @@ Planned Doing Testing - Done @if (!isNew) { diff --git a/wwwroot/css/site.css b/wwwroot/css/site.css index d257562..b1c7b46 100644 --- a/wwwroot/css/site.css +++ b/wwwroot/css/site.css @@ -280,6 +280,9 @@ input[type="file"] { transition: .3s transform cubic-bezier(.155,1.105,.295,1.12),.3s box-shadow,.3s -webkit-transform cubic-bezier(.155,1.105,.295,1.12); cursor: pointer; } +.taskCard.nodrag{ + cursor:not-allowed; +} .taskCard-title{ font-size:1.5rem; font-weight:300;