make tax recurring.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
{
|
||||
public enum ReminderMonthInterval
|
||||
{
|
||||
OneMonth = 1,
|
||||
ThreeMonths = 3,
|
||||
SixMonths = 6,
|
||||
OneYear = 12,
|
||||
|
||||
@@ -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<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||
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 }; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,20 @@
|
||||
<div class="col-md-6 col-12">
|
||||
<label for="taxRecordNotes">Notes(optional)</label>
|
||||
<textarea id="taxRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" onChange="enableTaxRecurring()" role="switch" id="taxIsRecurring" checked="@Model.IsRecurring">
|
||||
<label class="form-check-label" for="taxIsRecurring">Is Recurring</label>
|
||||
</div>
|
||||
<label for="taxRecurringMonth">Month</label>
|
||||
<select class="form-select" id="taxRecurringMonth" @(Model.IsRecurring ? "" : "disabled")>
|
||||
<!option value="OneMonth" @(Model.RecurringInterval == ReminderMonthInterval.OneMonth ? "selected" : "")>1 Month</!option>
|
||||
<!option value="ThreeMonths" @(Model.RecurringInterval == ReminderMonthInterval.ThreeMonths || isNew ? "selected" : "")>3 Months</!option>
|
||||
<!option value="SixMonths" @(Model.RecurringInterval == ReminderMonthInterval.SixMonths ? "selected" : "")>6 Months</!option>
|
||||
<!option value="OneYear" @(Model.RecurringInterval == ReminderMonthInterval.OneYear ? "selected" : "")>1 Year</!option>
|
||||
<!option value="TwoYears" @(Model.RecurringInterval == ReminderMonthInterval.TwoYears ? "selected" : "")>2 Years</!option>
|
||||
<!option value="ThreeYears" @(Model.RecurringInterval == ReminderMonthInterval.ThreeYears ? "selected" : "")>3 Years</!option>
|
||||
<!option value="FiveYears" @(Model.RecurringInterval == ReminderMonthInterval.FiveYears ? "selected" : "")>5 Years</!option>
|
||||
</select>
|
||||
@if (Model.Files.Any())
|
||||
{
|
||||
<div>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user