diff --git a/Controllers/VehicleController.cs b/Controllers/VehicleController.cs index 7e37373..dae6b74 100644 --- a/Controllers/VehicleController.cs +++ b/Controllers/VehicleController.cs @@ -1357,6 +1357,10 @@ namespace CarCareTracker.Controllers //move files from temp. planRecord.Files = planRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList(); var result = _planRecordDataAccess.SavePlanRecordToVehicle(planRecord.ToPlanRecord()); + if (result && planRecord.Supplies.Any()) + { + RequisitionSupplyRecordsByUsage(planRecord.Supplies); + } return Json(result); } [HttpGet] diff --git a/Models/PlanRecord/PlanRecordInput.cs b/Models/PlanRecord/PlanRecordInput.cs index 19772e2..ff713d9 100644 --- a/Models/PlanRecord/PlanRecordInput.cs +++ b/Models/PlanRecord/PlanRecordInput.cs @@ -9,6 +9,7 @@ public string Description { get; set; } public string Notes { get; set; } public List Files { get; set; } = new List(); + public List Supplies { get; set; } = new List(); public ImportMode ImportMode { get; set; } public PlanPriority Priority { get; set; } public PlanProgress Progress { get; set; } diff --git a/Views/Vehicle/_PlanRecordModal.cshtml b/Views/Vehicle/_PlanRecordModal.cshtml index 8b97877..637d003 100644 --- a/Views/Vehicle/_PlanRecordModal.cshtml +++ b/Views/Vehicle/_PlanRecordModal.cshtml @@ -16,6 +16,10 @@ + @if (isNew) + { + @await Html.PartialAsync("_SupplyStore", "PlanRecord") + }