mirror of
https://github.com/hargata/lubelog.git
synced 2026-02-03 17:53:02 -06:00
141 lines
9.3 KiB
Plaintext
141 lines
9.3 KiB
Plaintext
@using CarCareTracker.Helper
|
|
@inject IConfigHelper config
|
|
@inject ITranslationHelper translator
|
|
@model InspectionRecordInput
|
|
@{
|
|
var userConfig = config.GetUserConfig(User);
|
|
var userLanguage = userConfig.UserLanguage;
|
|
}
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">@(translator.Translate(userLanguage, "Add New Inspection Record"))</h5>
|
|
<button type="button" class="btn-close" onclick="hideAddInspectionRecordModal(true)" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body" onkeydown="handleEnter(this)">
|
|
<form>
|
|
<div class="form-group">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
|
<label for="inspectionRecordDate">@translator.Translate(userLanguage, "Date")</label>
|
|
<div class="input-group">
|
|
<input type="text" id="inspectionRecordDate" class="form-control" placeholder="@translator.Translate(userLanguage, "Date inspection was performed")" value="@Model.Date">
|
|
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
|
</div>
|
|
<label for="inspectionRecordMileage">@translator.Translate(userLanguage, "Odometer")</label>
|
|
<div class="input-group">
|
|
<input type="number" inputmode="numeric" id="inspectionRecordMileage" class="form-control" placeholder="@translator.Translate(userLanguage, "Odometer reading when inspected")" value="">
|
|
<div class="input-group-text">
|
|
<button type="button" class="btn btn-sm btn-primary zero-y-padding" onclick="getLastOdometerReadingAndIncrement('inspectionRecordMileage')"><i class="bi bi-plus"></i></button>
|
|
</div>
|
|
</div>
|
|
<label for="inspectionRecordDescription">@translator.Translate(userLanguage, "Description")</label>
|
|
<input type="text" id="inspectionRecordDescription" class="form-control" placeholder="@translator.Translate(userLanguage, "Description of Inspection performed")" value="@Model.Description">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<a onclick="showRecurringReminderSelector('inspectionRecordDescription', 'inspectionRecordNotes')" class="btn btn-link">@translator.Translate(userLanguage, "Select Reminder")</a>
|
|
</div>
|
|
</div>
|
|
<label for="inspectionRecordCost">@translator.Translate(userLanguage, "Cost")</label>
|
|
<input type="text" inputmode="decimal" onkeydown="interceptDecimalKeys(event)" onkeyup="fixDecimalInput(this, 2)" id="inspectionRecordCost" class="form-control" placeholder="@translator.Translate(userLanguage, "Cost of the inspection")" value="">
|
|
@if (Model.Fields.Any())
|
|
{
|
|
<hr />
|
|
<div id="inspectionRecordFields">
|
|
@foreach (InspectionRecordTemplateField templateField in Model.Fields)
|
|
{
|
|
var templateFieldName = Guid.NewGuid().ToString();
|
|
<div data-type="field" data-fieldtype="@templateField.FieldType">
|
|
<label data-type="fieldDescription">@templateField.Description</label>
|
|
<div data-type="fieldOptions">
|
|
@if (templateField.FieldType == InspectionFieldType.Text)
|
|
{
|
|
<input type="text" class="form-control" data-type="fieldOption" placeholder="@templateField.Description">
|
|
}
|
|
else if (templateField.FieldType == InspectionFieldType.Check)
|
|
{
|
|
<div class="d-flex justify-content-between flex-wrap">
|
|
@foreach (InspectionRecordTemplateFieldOption fieldOption in templateField.Options)
|
|
{
|
|
<div class="form-check form-check-inline" data-type="fieldOptionContainer">
|
|
<input class="form-check-input" data-type="fieldOption" type="checkbox" role="switch" data-field="@(fieldOption.IsFail ? "fail" : "")">
|
|
<label class="form-check-label" data-type="fieldOptionText" onclick="stretchedLinkClick(this)">@fieldOption.Description</label>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
else if (templateField.FieldType == InspectionFieldType.Radio)
|
|
{
|
|
<div class="d-flex justify-content-between flex-wrap">
|
|
@foreach (InspectionRecordTemplateFieldOption fieldOption in templateField.Options)
|
|
{
|
|
<div class="form-check form-check-inline" data-type="fieldOptionContainer">
|
|
<input class="form-check-input" data-type="fieldOption" type="radio" role="switch" name="@templateFieldName" data-field="@(fieldOption.IsFail ? "fail" : "")">
|
|
<label class="form-check-label" data-type="fieldOptionText" onclick="stretchedLinkClick(this)">@fieldOption.Description</label>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
@if (templateField.HasNotes)
|
|
{
|
|
<div>
|
|
<label for="@($"{templateFieldName}Notes")">@translator.Translate(userLanguage, "Notes")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
|
<textarea id="@($"{templateFieldName}Notes")" data-type="fieldNotes" class="form-control" rows="5"></textarea>
|
|
</div>
|
|
}
|
|
@if (templateField.HasActionItem)
|
|
{
|
|
<div data-type="fieldActionItemContainer" style="display:none;">
|
|
<input type="text" data-type="fieldActionItemDescription" class="form-control" value="@templateField.ActionItemDescription">
|
|
<input type="text" data-type="fieldActionItemType" class="form-control" value="@templateField.ActionItemType">
|
|
<input type="text" data-type="fieldActionItemPriority" class="form-control" value="@templateField.ActionItemPriority">
|
|
</div>
|
|
}
|
|
<hr />
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" value="" id="addReminderCheck">
|
|
<label class="form-check-label" for="addReminderCheck">
|
|
@translator.Translate(userLanguage, "Add Reminder")
|
|
</label>
|
|
</div>
|
|
<label for="inspectionRecordTag">@translator.Translate(userLanguage, "Tags(optional)")</label>
|
|
<select multiple class="form-select" id="inspectionRecordTag">
|
|
@foreach (string tag in Model.Tags)
|
|
{
|
|
<!option value="@tag">@tag</!option>
|
|
}
|
|
</select>
|
|
<div>
|
|
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
|
@await Html.PartialAsync("_FileUploader", Model.Files.Any())
|
|
</div>
|
|
<div id="filesPendingUpload"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" onclick="hideAddInspectionRecordModal(true)">@translator.Translate(userLanguage, "Cancel")</button>
|
|
<button type="button" class="btn btn-primary" onclick="saveinspectionRecordToVehicle()">@translator.Translate(userLanguage, "Add New Inspection Record")</button>
|
|
</div>
|
|
<script>
|
|
var recurringReminderRecordId = [];
|
|
function getInspectionRecordModelData() {
|
|
return { id: @Model.Id}
|
|
}
|
|
@foreach(int reminderRecordId in Model.ReminderRecordId)
|
|
{
|
|
@:recurringReminderRecordId.push(@reminderRecordId);
|
|
}
|
|
</script>
|
|
@if (userConfig.EnableAutoFillOdometer)
|
|
{
|
|
<script>
|
|
setLastOdometer('inspectionRecordMileage');
|
|
</script>
|
|
} |