From d86298f502ddccba2b86d725ef25d32b8d84e1f6 Mon Sep 17 00:00:00 2001 From: "DESKTOP-T0O5CDB\\DESK-555BD" Date: Tue, 23 Jan 2024 21:10:59 -0700 Subject: [PATCH] make tax recurring. --- Enum/ReminderMonthInterval.cs | 1 + Models/TaxRecord/TaxRecord.cs | 2 ++ Models/TaxRecord/TaxRecordInput.cs | 13 ++++++++++++- Views/Vehicle/_TaxRecordModal.cshtml | 14 ++++++++++++++ wwwroot/js/taxrecord.js | 10 ++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Enum/ReminderMonthInterval.cs b/Enum/ReminderMonthInterval.cs index 675949f..dd1d472 100644 --- a/Enum/ReminderMonthInterval.cs +++ b/Enum/ReminderMonthInterval.cs @@ -2,6 +2,7 @@ { public enum ReminderMonthInterval { + OneMonth = 1, ThreeMonths = 3, SixMonths = 6, OneYear = 12, diff --git a/Models/TaxRecord/TaxRecord.cs b/Models/TaxRecord/TaxRecord.cs index 073695f..5a2f1c7 100644 --- a/Models/TaxRecord/TaxRecord.cs +++ b/Models/TaxRecord/TaxRecord.cs @@ -8,6 +8,8 @@ public string Description { get; set; } public decimal Cost { get; set; } public string Notes { get; set; } + public bool IsRecurring { get; set; } = false; + public ReminderMonthInterval RecurringInterval { get; set; } = ReminderMonthInterval.OneYear; public List Files { get; set; } = new List(); } } diff --git a/Models/TaxRecord/TaxRecordInput.cs b/Models/TaxRecord/TaxRecordInput.cs index cbe33c5..764007d 100644 --- a/Models/TaxRecord/TaxRecordInput.cs +++ b/Models/TaxRecord/TaxRecordInput.cs @@ -8,7 +8,18 @@ public string Description { get; set; } public decimal Cost { get; set; } public string Notes { get; set; } + public bool IsRecurring { get; set; } = false; + public ReminderMonthInterval RecurringInterval { get; set; } = ReminderMonthInterval.ThreeMonths; public List Files { get; set; } = new List(); - public TaxRecord ToTaxRecord() { return new TaxRecord { Id = Id, VehicleId = VehicleId, Date = DateTime.Parse(Date), Cost = Cost, Description = Description, Notes = Notes, Files = Files }; } + public TaxRecord ToTaxRecord() { return new TaxRecord { + Id = Id, + VehicleId = VehicleId, + Date = DateTime.Parse(Date), + Cost = Cost, + Description = Description, + Notes = Notes, + IsRecurring = IsRecurring, + RecurringInterval = RecurringInterval, + Files = Files }; } } } diff --git a/Views/Vehicle/_TaxRecordModal.cshtml b/Views/Vehicle/_TaxRecordModal.cshtml index 61abe78..ac1eeec 100644 --- a/Views/Vehicle/_TaxRecordModal.cshtml +++ b/Views/Vehicle/_TaxRecordModal.cshtml @@ -25,6 +25,20 @@
+
+ + +
+ + @if (Model.Files.Any()) {
diff --git a/wwwroot/js/taxrecord.js b/wwwroot/js/taxrecord.js index 1c40232..958940c 100644 --- a/wwwroot/js/taxrecord.js +++ b/wwwroot/js/taxrecord.js @@ -18,6 +18,14 @@ function showEditTaxRecordModal(taxRecordId) { } }); } +function enableTaxRecurring() { + var taxIsRecurring = $("#taxIsRecurring").is(":checked"); + if (taxIsRecurring) { + $("#taxRecurringMonth").attr('disabled', false); + } else { + $("#taxRecurringMonth").attr('disabled', true); + } +} function hideAddTaxRecordModal() { $('#taxRecordModal').modal('hide'); } @@ -76,6 +84,8 @@ function getAndValidateTaxRecordValues() { var taxNotes = $("#taxRecordNotes").val(); var vehicleId = GetVehicleId().vehicleId; var taxRecordId = getTaxRecordModelData().id; + var taxIsRecurring = $("#taxIsRecurring").is(":checked"); + var taxRecurringMonth = $("#taxRecurringMonth").val(); var addReminderRecord = $("#addReminderCheck").is(":checked"); //validation var hasError = false;