diff --git a/Views/Vehicle/_GasModal.cshtml b/Views/Vehicle/_GasModal.cshtml
index 858f7db..dfe3c2a 100644
--- a/Views/Vehicle/_GasModal.cshtml
+++ b/Views/Vehicle/_GasModal.cshtml
@@ -44,14 +44,7 @@
@if (Model.GasRecord.Files.Any())
{
-
- @foreach (UploadedFiles filesUploaded in Model.GasRecord.Files)
- {
-
- }
+ @await Html.PartialAsync("_UploadedFiles", Model.GasRecord.Files)
diff --git a/Views/Vehicle/_ServiceRecordModal.cshtml b/Views/Vehicle/_ServiceRecordModal.cshtml
index 98d27e5..c37913a 100644
--- a/Views/Vehicle/_ServiceRecordModal.cshtml
+++ b/Views/Vehicle/_ServiceRecordModal.cshtml
@@ -30,14 +30,7 @@
@if (Model.Files.Any())
{
-
- @foreach (UploadedFiles filesUploaded in Model.Files)
- {
-
- }
+ @await Html.PartialAsync("_UploadedFiles", Model.Files)
diff --git a/Views/Vehicle/_ServiceRecords.cshtml b/Views/Vehicle/_ServiceRecords.cshtml
index db7ff24..447648d 100644
--- a/Views/Vehicle/_ServiceRecords.cshtml
+++ b/Views/Vehicle/_ServiceRecords.cshtml
@@ -1,6 +1,7 @@
@inject IConfiguration Configuration
@{
var enableCsvImports = bool.Parse(Configuration[nameof(UserConfig.EnableCsvImports)]);
+ var hideZero = bool.Parse(Configuration[nameof(UserConfig.HideZero)]);
}
@model List
@@ -48,7 +49,7 @@
@serviceRecord.Date.ToShortDateString() |
@serviceRecord.Mileage |
@serviceRecord.Description |
- @serviceRecord.Cost.ToString("C") |
+ @((hideZero && serviceRecord.Cost == default) ? "---" : serviceRecord.Cost.ToString("C")) |
@serviceRecord.Notes |
}
@@ -58,7 +59,7 @@
-
+
diff --git a/Views/Vehicle/_TaxRecordModal.cshtml b/Views/Vehicle/_TaxRecordModal.cshtml
index c3381c6..0c18eca 100644
--- a/Views/Vehicle/_TaxRecordModal.cshtml
+++ b/Views/Vehicle/_TaxRecordModal.cshtml
@@ -28,14 +28,7 @@
@if (Model.Files.Any())
{
-
- @foreach (UploadedFiles filesUploaded in Model.Files)
- {
-
- }
+ @await Html.PartialAsync("_UploadedFiles", Model.Files)
diff --git a/Views/Vehicle/_TaxRecords.cshtml b/Views/Vehicle/_TaxRecords.cshtml
index b76ced0..5c795b1 100644
--- a/Views/Vehicle/_TaxRecords.cshtml
+++ b/Views/Vehicle/_TaxRecords.cshtml
@@ -1,6 +1,7 @@
@inject IConfiguration Configuration
@{
var enableCsvImports = bool.Parse(Configuration[nameof(UserConfig.EnableCsvImports)]);
+ var hideZero = bool.Parse(Configuration[nameof(UserConfig.HideZero)]);
}
@model List
@@ -46,7 +47,7 @@
| @taxRecord.Date.ToShortDateString() |
@taxRecord.Description |
- @taxRecord.Cost.ToString("C") |
+ @((hideZero && taxRecord.Cost == default) ? "---" : taxRecord.Cost.ToString("C")) |
@taxRecord.Notes |
}
@@ -56,7 +57,7 @@
-
+
diff --git a/Views/Vehicle/_UploadedFiles.cshtml b/Views/Vehicle/_UploadedFiles.cshtml
new file mode 100644
index 0000000..3d70a6d
--- /dev/null
+++ b/Views/Vehicle/_UploadedFiles.cshtml
@@ -0,0 +1,16 @@
+@model List
+
+
+ @foreach (UploadedFiles filesUploaded in Model)
+ {
+ -
+
+
+ }
+
\ No newline at end of file
diff --git a/appsettings.json b/appsettings.json
index 6252e11..bf22a5e 100644
--- a/appsettings.json
+++ b/appsettings.json
@@ -11,6 +11,7 @@
"UseMPG": true,
"UseDescending": false,
"EnableAuth": false,
+ "HideZero": false,
"UserNameHash": "",
"UserPasswordHash": ""
}
diff --git a/wwwroot/js/collisionrecord.js b/wwwroot/js/collisionrecord.js
index 2cdcea2..4b2a024 100644
--- a/wwwroot/js/collisionrecord.js
+++ b/wwwroot/js/collisionrecord.js
@@ -121,8 +121,4 @@ function getAndValidateCollisionRecordValues() {
files: uploadedFiles,
addReminderRecord: addReminderRecord
}
-}
-function deleteCollisionRecordFile(fileLocation, event) {
- event.parentElement.remove();
- uploadedFiles = uploadedFiles.filter(x => x.location != fileLocation);
}
\ No newline at end of file
diff --git a/wwwroot/js/gasrecord.js b/wwwroot/js/gasrecord.js
index 406cf7f..9e61b87 100644
--- a/wwwroot/js/gasrecord.js
+++ b/wwwroot/js/gasrecord.js
@@ -116,8 +116,4 @@ function getAndValidateGasRecordValues() {
files: uploadedFiles,
isFillToFull: gasIsFillToFull
}
-}
-function deleteGasRecordFile(fileLocation, event) {
- event.parentElement.remove();
- uploadedFiles = uploadedFiles.filter(x => x.location != fileLocation);
}
\ No newline at end of file
diff --git a/wwwroot/js/servicerecord.js b/wwwroot/js/servicerecord.js
index 8c6993e..b538deb 100644
--- a/wwwroot/js/servicerecord.js
+++ b/wwwroot/js/servicerecord.js
@@ -121,8 +121,4 @@ function getAndValidateServiceRecordValues() {
files: uploadedFiles,
addReminderRecord: addReminderRecord
}
-}
-function deleteServiceRecordFile(fileLocation, event) {
- event.parentElement.remove();
- uploadedFiles = uploadedFiles.filter(x => x.location != fileLocation);
}
\ No newline at end of file
diff --git a/wwwroot/js/taxrecord.js b/wwwroot/js/taxrecord.js
index a5b6802..258ce4a 100644
--- a/wwwroot/js/taxrecord.js
+++ b/wwwroot/js/taxrecord.js
@@ -113,8 +113,4 @@ function getAndValidateTaxRecordValues() {
files: uploadedFiles,
addReminderRecord: addReminderRecord
}
-}
-function deleteTaxRecordFile(fileLocation, event) {
- event.parentElement.remove();
- uploadedFiles = uploadedFiles.filter(x => x.location != fileLocation);
}
\ No newline at end of file
diff --git a/wwwroot/js/vehicle.js b/wwwroot/js/vehicle.js
index a69a743..d413ec6 100644
--- a/wwwroot/js/vehicle.js
+++ b/wwwroot/js/vehicle.js
@@ -213,4 +213,33 @@ function getVehicleHaveImportantReminders(vehicleId) {
}
});
}, 500);
+}
+
+function deleteFileFromUploadedFiles(fileLocation, event) {
+ event.parentElement.parentElement.parentElement.remove();
+ uploadedFiles = uploadedFiles.filter(x => x.location != fileLocation);
+}
+function editFileName(fileLocation, event) {
+ Swal.fire({
+ title: 'Rename File',
+ html: `
+
+ `,
+ confirmButtonText: 'Rename',
+ focusConfirm: false,
+ preConfirm: () => {
+ const newFileName = $("#newFileName").val();
+ if (!newFileName) {
+ Swal.showValidationMessage(`Please enter a valid file name`)
+ }
+ return { newFileName }
+ },
+ }).then(function (result) {
+ if (result.isConfirmed) {
+ var linkDisplayObject = $(event.parentElement.parentElement).find('a')[0];
+ linkDisplayObject.text = result.value.newFileName;
+ var editFileIndex = uploadedFiles.findIndex(x => x.location == fileLocation);
+ uploadedFiles[editFileIndex].name = result.value.newFileName;
+ }
+ });
}
\ No newline at end of file