mirror of
https://github.com/hargata/lubelog.git
synced 2025-12-10 17:20:15 -06:00
Custom Widgets
This commit is contained in:
parent
82634e9e1b
commit
d6b6600ce9
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ config/userConfig.json
|
|||||||
CarCareTracker.csproj.user
|
CarCareTracker.csproj.user
|
||||||
Properties/launchSettings.json
|
Properties/launchSettings.json
|
||||||
data/cartracker-log.db
|
data/cartracker-log.db
|
||||||
|
data/widgets.html
|
||||||
|
|||||||
@ -22,6 +22,8 @@ namespace CarCareTracker.Controllers
|
|||||||
var odometerRecords = _odometerRecordDataAccess.GetOdometerRecordsByVehicleId(vehicleId);
|
var odometerRecords = _odometerRecordDataAccess.GetOdometerRecordsByVehicleId(vehicleId);
|
||||||
var userConfig = _config.GetUserConfig(User);
|
var userConfig = _config.GetUserConfig(User);
|
||||||
var viewModel = new ReportViewModel();
|
var viewModel = new ReportViewModel();
|
||||||
|
//check if custom widgets are configured
|
||||||
|
viewModel.CustomWidgetsConfigured = _fileHelper.WidgetsExist();
|
||||||
//get totalCostMakeUp
|
//get totalCostMakeUp
|
||||||
viewModel.CostMakeUpForVehicle = new CostMakeUpForVehicle
|
viewModel.CostMakeUpForVehicle = new CostMakeUpForVehicle
|
||||||
{
|
{
|
||||||
@ -528,5 +530,11 @@ namespace CarCareTracker.Controllers
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
return PartialView("_GasCostByMonthReport", groupedRecord);
|
return PartialView("_GasCostByMonthReport", groupedRecord);
|
||||||
}
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult GetAdditionalWidgets()
|
||||||
|
{
|
||||||
|
var widgets = _fileHelper.GetWidgets();
|
||||||
|
return PartialView("_ReportWidgets", widgets);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,8 @@ namespace CarCareTracker.Helper
|
|||||||
int ClearTempFolder();
|
int ClearTempFolder();
|
||||||
int ClearUnlinkedThumbnails(List<string> linkedImages);
|
int ClearUnlinkedThumbnails(List<string> linkedImages);
|
||||||
int ClearUnlinkedDocuments(List<string> linkedDocuments);
|
int ClearUnlinkedDocuments(List<string> linkedDocuments);
|
||||||
|
string GetWidgets();
|
||||||
|
bool WidgetsExist();
|
||||||
}
|
}
|
||||||
public class FileHelper : IFileHelper
|
public class FileHelper : IFileHelper
|
||||||
{
|
{
|
||||||
@ -368,5 +370,27 @@ namespace CarCareTracker.Helper
|
|||||||
}
|
}
|
||||||
return filesDeleted;
|
return filesDeleted;
|
||||||
}
|
}
|
||||||
|
public string GetWidgets()
|
||||||
|
{
|
||||||
|
if (File.Exists(StaticHelper.AdditionalWidgetsPath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//read file
|
||||||
|
var widgets = File.ReadAllText(StaticHelper.AdditionalWidgetsPath);
|
||||||
|
return widgets;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex.Message);
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
public bool WidgetsExist()
|
||||||
|
{
|
||||||
|
return File.Exists(StaticHelper.AdditionalWidgetsPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ namespace CarCareTracker.Helper
|
|||||||
public static string VersionNumber = "1.4.0";
|
public static string VersionNumber = "1.4.0";
|
||||||
public static string DbName = "data/cartracker.db";
|
public static string DbName = "data/cartracker.db";
|
||||||
public static string UserConfigPath = "config/userConfig.json";
|
public static string UserConfigPath = "config/userConfig.json";
|
||||||
|
public static string AdditionalWidgetsPath = "data/widgets.html";
|
||||||
public static string GenericErrorMessage = "An error occurred, please try again later";
|
public static string GenericErrorMessage = "An error occurred, please try again later";
|
||||||
public static string ReminderEmailTemplate = "defaults/reminderemailtemplate.txt";
|
public static string ReminderEmailTemplate = "defaults/reminderemailtemplate.txt";
|
||||||
public static string DefaultAllowedFileExtensions = ".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx";
|
public static string DefaultAllowedFileExtensions = ".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx";
|
||||||
|
|||||||
@ -8,5 +8,6 @@
|
|||||||
public ReminderMakeUpForVehicle ReminderMakeUpForVehicle { get; set; } = new ReminderMakeUpForVehicle();
|
public ReminderMakeUpForVehicle ReminderMakeUpForVehicle { get; set; } = new ReminderMakeUpForVehicle();
|
||||||
public List<int> Years { get; set; } = new List<int>();
|
public List<int> Years { get; set; } = new List<int>();
|
||||||
public List<UserCollaborator> Collaborators { get; set; } = new List<UserCollaborator>();
|
public List<UserCollaborator> Collaborators { get; set; } = new List<UserCollaborator>();
|
||||||
|
public bool CustomWidgetsConfigured { get; set; } = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,6 +126,12 @@
|
|||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button onclick="exportAttachments()" class="btn btn-secondary btn-md mt-1 mb-1">@translator.Translate(userLanguage, "Export Attachments")<i class="bi ms-2 bi-box-arrow-in-up-right"></i></button>
|
<button onclick="exportAttachments()" class="btn btn-secondary btn-md mt-1 mb-1">@translator.Translate(userLanguage, "Export Attachments")<i class="bi ms-2 bi-box-arrow-in-up-right"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
@if (Model.CustomWidgetsConfigured)
|
||||||
|
{
|
||||||
|
<div class="d-grid">
|
||||||
|
<button onclick="loadCustomWidgets()" class="btn btn-secondary btn-md mt-1 mb-1">@translator.Translate(userLanguage, "Additional Widgets")<i class="bi ms-2 bi-box-arrow-in-up-right"></i></button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -153,6 +159,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@if (Model.CustomWidgetsConfigured)
|
||||||
|
{
|
||||||
|
<div class="modal fade" data-bs-focus="false" id="vehicleCustomWidgetsModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content" id="vehicleCustomWidgetsModalContent">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<div id="vehicleHistoryReport" class="showOnPrint"></div>
|
<div id="vehicleHistoryReport" class="showOnPrint"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
2
Views/Vehicle/_ReportWidgets.cshtml
Normal file
2
Views/Vehicle/_ReportWidgets.cshtml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
@model string
|
||||||
|
@Html.Raw(Model)
|
||||||
File diff suppressed because one or more lines are too long
@ -265,3 +265,12 @@ function loadGlobalSearchResult(recordId, recordType) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function loadCustomWidgets() {
|
||||||
|
$.get('/Vehicle/GetAdditionalWidgets', function (data) {
|
||||||
|
$("#vehicleCustomWidgetsModalContent").html(data);
|
||||||
|
$("#vehicleCustomWidgetsModal").modal('show');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function hideCustomWidgetsModal() {
|
||||||
|
$("#vehicleCustomWidgetsModal").modal('hide');
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user