80 lines
4.1 KiB
Plaintext
80 lines
4.1 KiB
Plaintext
@using CarCareTracker.Helper
|
|
@inject IConfigHelper config
|
|
@{
|
|
var enableCsvImports = config.GetUserConfig(User).EnableCsvImports;
|
|
var hideZero = config.GetUserConfig(User).HideZero;
|
|
}
|
|
@model List<SupplyRecord>
|
|
<div class="row">
|
|
<div class="d-flex justify-content-between">
|
|
<div class="d-flex align-items-center flex-wrap">
|
|
<span class="ms-2 badge bg-success">@($"# of Supply Records: {Model.Count()}")</span>
|
|
<span class="ms-2 badge bg-primary">@($"Total: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
|
</div>
|
|
<div>
|
|
@if (enableCsvImports)
|
|
{
|
|
<div class="btn-group">
|
|
<button onclick="showAddSupplyRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Supply Record</button>
|
|
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<span class="visually-hidden">Toggle Dropdown</span>
|
|
</button>
|
|
<ul class="dropdown-menu">
|
|
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('SupplyRecord')">Import via CSV</a></li>
|
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('SupplyRecord')">Export to CSV</a></li>
|
|
<li><hr class="dropdown-divider"></li>
|
|
<li><a class="dropdown-item" href="#" onclick="printTab()">Print</a></li>
|
|
</ul>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<button onclick="showAddSupplyRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Supply Record</button>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row vehicleDetailTabContainer">
|
|
<div class="col-12">
|
|
<div class="row mt-2 showOnPrint">
|
|
<div class="d-flex">
|
|
<img src="/defaults/lubelogger_logo.png" />
|
|
</div>
|
|
</div>
|
|
<table class="table table-hover">
|
|
<thead class="sticky-top">
|
|
<tr class="d-flex">
|
|
<th scope="col" class="col-2 col-xl-1">Date</th>
|
|
<th scope="col" class="col-2">Part #</th>
|
|
<th scope="col" class="col-2">Supplier</th>
|
|
<th scope="col" class="col-2 col-xl-3">Description</th>
|
|
<th scope="col" class="col-1" onclick="toggleSort('supply-tab-pane', this)" style="cursor:pointer;">Quantity</th>
|
|
<th scope="col" class="col-1" onclick="toggleSort('supply-tab-pane', this)" style="cursor:pointer;">Cost</th>
|
|
<th scope="col" class="col-2">Notes</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (SupplyRecord supplyRecord in Model)
|
|
{
|
|
<tr class="d-flex" style="cursor:pointer;" onclick="showEditSupplyRecordModal(@supplyRecord.Id)">
|
|
<td class="col-2 col-xl-1">@supplyRecord.Date.ToShortDateString()</td>
|
|
<td class="col-2">@supplyRecord.PartNumber</td>
|
|
<td class="col-2">@supplyRecord.PartSupplier</td>
|
|
<td class="col-2 col-xl-3">@supplyRecord.Description</td>
|
|
<td class="col-1">@supplyRecord.Quantity</td>
|
|
<td class="col-1">@((hideZero && supplyRecord.Cost == default) ? "---" : supplyRecord.Cost.ToString("C"))</td>
|
|
<td class="col-2 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(supplyRecord.Notes)</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="modal fade" data-bs-focus="false" id="supplyRecordModal" tabindex="-1" role="dialog" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg" role="document">
|
|
<div class="modal-content" id="supplyRecordModalContent">
|
|
</div>
|
|
</div>
|
|
</div> |