80 lines
4.0 KiB
Plaintext
80 lines
4.0 KiB
Plaintext
@model OdometerRecordInput
|
|
@{
|
|
var isNew = Model.Id == 0;
|
|
}
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">@(isNew ? "Add New Odometer Record" : "Edit Odometer Record")</h5>
|
|
<button type="button" class="btn-close" onclick="hideAddOdometerRecordModal()" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form>
|
|
<div class="form-group">
|
|
<div class="row">
|
|
<div class="col-md-6 col-12">
|
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
|
<label for="odometerRecordDate">Date</label>
|
|
<div class="input-group">
|
|
<input type="text" id="odometerRecordDate" class="form-control" placeholder="Date recorded" value="@Model.Date">
|
|
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
|
</div>
|
|
<label for="odometerRecordMileage">Odometer</label>
|
|
<input type="number" id="odometerRecordMileage" class="form-control" placeholder="Odometer reading" value="@(isNew ? "" : Model.Mileage)">
|
|
<label for="odometerRecordTag">Tags(optional)</label>
|
|
<select multiple class="form-select" id="odometerRecordTag">
|
|
@foreach (string tag in Model.Tags)
|
|
{
|
|
<!option value="@tag">@tag</!option>
|
|
}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6 col-12">
|
|
<label for="odometerRecordNotes">Notes(optional)<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
|
<textarea id="odometerRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
|
@if (Model.Files.Any())
|
|
{
|
|
<div>
|
|
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
|
<label for="odometerRecordFiles">Upload more documents</label>
|
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="odometerRecordFiles">
|
|
<br /><small class="text-body-secondary">Max File Size: 28.6MB</small>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<label for="odometerRecordFiles">Upload documents(optional)</label>
|
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="odometerRecordFiles">
|
|
<br /><small class="text-body-secondary">Max File Size: 28.6MB</small>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
@if (!isNew)
|
|
{
|
|
<button type="button" class="btn btn-danger" onclick="deleteOdometerRecord(@Model.Id)" style="margin-right:auto;">Delete</button>
|
|
}
|
|
<button type="button" class="btn btn-secondary" onclick="hideAddOdometerRecordModal()">Cancel</button>
|
|
@if (isNew)
|
|
{
|
|
<button type="button" class="btn btn-primary" onclick="saveOdometerRecordToVehicle()">Add New Odometer Record</button>
|
|
}
|
|
else if (!isNew)
|
|
{
|
|
<button type="button" class="btn btn-primary" onclick="saveOdometerRecordToVehicle(true)">Edit Odometer Record</button>
|
|
}
|
|
</div>
|
|
<script>
|
|
var uploadedFiles = [];
|
|
getUploadedFilesFromModel();
|
|
function getUploadedFilesFromModel() {
|
|
@foreach (UploadedFiles filesUploaded in Model.Files)
|
|
{
|
|
@:uploadedFiles.push({ name: "@filesUploaded.Name", location: "@filesUploaded.Location" });
|
|
}
|
|
}
|
|
function getOdometerRecordModelData() {
|
|
return { id: @Model.Id}
|
|
}
|
|
</script> |