diff --git a/Controllers/VehicleController.cs b/Controllers/VehicleController.cs
index 193d5cc..1e80098 100644
--- a/Controllers/VehicleController.cs
+++ b/Controllers/VehicleController.cs
@@ -1757,6 +1757,16 @@ namespace CarCareTracker.Controllers
return PartialView("_PlanRecordModal", new PlanRecordInput() { ExtraFields = _extraFieldDataAccess.GetExtraFieldsById((int)ImportMode.PlanRecord).ExtraFields });
}
[HttpPost]
+ public IActionResult GetAddPlanRecordPartialView(PlanRecordInput? planModel)
+ {
+ if (planModel is not null)
+ {
+ planModel.ExtraFields = _extraFieldDataAccess.GetExtraFieldsById((int)ImportMode.PlanRecord).ExtraFields;
+ return PartialView("_PlanRecordModal", planModel);
+ }
+ return PartialView("_PlanRecordModal", new PlanRecordInput() { ExtraFields = _extraFieldDataAccess.GetExtraFieldsById((int)ImportMode.PlanRecord).ExtraFields });
+ }
+ [HttpPost]
public IActionResult UpdatePlanRecordProgress(int planRecordId, PlanProgress planProgress, int odometer = 0)
{
var existingRecord = _planRecordDataAccess.GetPlanRecordById(planRecordId);
@@ -1825,6 +1835,24 @@ namespace CarCareTracker.Controllers
};
_upgradeRecordDataAccess.SaveUpgradeRecordToVehicle(newRecord);
}
+ //push back any reminders
+ if (existingRecord.ReminderRecordId != default)
+ {
+ var existingReminder = _reminderRecordDataAccess.GetReminderRecordById(existingRecord.ReminderRecordId);
+ if (existingReminder is not null && existingReminder.Id != default)
+ {
+ existingReminder = _reminderHelper.GetUpdatedRecurringReminderRecord(existingReminder);
+ //save to db.
+ var reminderUpdateResult = _reminderRecordDataAccess.SaveReminderRecordToVehicle(existingReminder);
+ if (!reminderUpdateResult)
+ {
+ _logger.LogError("Unable to update reminder");
+ }
+ } else
+ {
+ _logger.LogError("Unable to update reminder because it no longer exists.");
+ }
+ }
}
return Json(result);
}
@@ -1847,6 +1875,7 @@ namespace CarCareTracker.Controllers
VehicleId = result.VehicleId,
Files = result.Files,
RequisitionHistory = result.RequisitionHistory,
+ ReminderRecordId = result.ReminderRecordId,
ExtraFields = StaticHelper.AddExtraFields(result.ExtraFields, _extraFieldDataAccess.GetExtraFieldsById((int)ImportMode.PlanRecord).ExtraFields)
};
return PartialView("_PlanRecordModal", convertedResult);
diff --git a/Models/PlanRecord/PlanCostItem.cs b/Models/PlanRecord/PlanCostItem.cs
deleted file mode 100644
index 37bafa7..0000000
--- a/Models/PlanRecord/PlanCostItem.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace CarCareTracker.Models
-{
- public class PlanCostItem
- {
- public string CostName { get; set; }
- public decimal CostAmount { get; set; }
- }
-}
diff --git a/Models/PlanRecord/PlanRecord.cs b/Models/PlanRecord/PlanRecord.cs
index a5a72a5..83bad98 100644
--- a/Models/PlanRecord/PlanRecord.cs
+++ b/Models/PlanRecord/PlanRecord.cs
@@ -4,6 +4,7 @@
{
public int Id { get; set; }
public int VehicleId { get; set; }
+ public int ReminderRecordId { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateModified { get; set; }
public string Description { get; set; }
diff --git a/Models/PlanRecord/PlanRecordInput.cs b/Models/PlanRecord/PlanRecordInput.cs
index d18a707..801bd6f 100644
--- a/Models/PlanRecord/PlanRecordInput.cs
+++ b/Models/PlanRecord/PlanRecordInput.cs
@@ -4,6 +4,7 @@
{
public int Id { get; set; }
public int VehicleId { get; set; }
+ public int ReminderRecordId { get; set; }
public string DateCreated { get; set; } = DateTime.Now.ToShortDateString();
public string DateModified { get; set; } = DateTime.Now.ToShortDateString();
public string Description { get; set; }
@@ -19,6 +20,7 @@
public PlanRecord ToPlanRecord() { return new PlanRecord {
Id = Id,
VehicleId = VehicleId,
+ ReminderRecordId = ReminderRecordId,
DateCreated = DateTime.Parse(DateCreated),
DateModified = DateTime.Parse(DateModified),
Description = Description,
@@ -31,5 +33,9 @@
ExtraFields = ExtraFields,
RequisitionHistory = RequisitionHistory
}; }
+ ///