added button to show supply requisition history.
This commit is contained in:
@@ -82,7 +82,7 @@
|
||||
{
|
||||
@if (Model.UsageHistory.Any())
|
||||
{
|
||||
<button type="button" class="btn btn-warning" onclick="showSupplyUsageHistory()"><i class="bi bi-clock-history"></i></button>
|
||||
<button type="button" class="btn btn-warning" onclick="toggleSupplyUsageHistory()"><i class="bi bi-clock-history"></i></button>
|
||||
}
|
||||
<button type="button" class="btn btn-danger" onclick="deleteSupplyRecord(@Model.Id)" style="margin-right:auto;">@translator.Translate(userLanguage,"Delete")</button>
|
||||
}
|
||||
@@ -96,9 +96,53 @@
|
||||
<button type="button" class="btn btn-primary" onclick="saveSupplyRecordToVehicle(true)">@translator.Translate(userLanguage,"Edit Supply Record")</button>
|
||||
}
|
||||
</div>
|
||||
<div id="supplyUsageHistoryModalContainer" class="d-none">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">@translator.Translate(userLanguage, "Supply Requisition History")</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@if (Model.UsageHistory.Any())
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12" style="max-height:50vh; overflow-y:auto;">
|
||||
<table class="table table-hover">
|
||||
<thead class="sticky-top">
|
||||
<tr class="d-flex">
|
||||
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Date")</th>
|
||||
<th scope="col" class="col-6">@translator.Translate(userLanguage, "Description")</th>
|
||||
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Quantity")</th>
|
||||
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Cost")</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (SupplyUsageHistory usageHistory in Model.UsageHistory)
|
||||
{
|
||||
<tr class="d-flex">
|
||||
<td class="col-2">@StaticHelper.TruncateStrings(usageHistory.Date.ToShortDateString())</td>
|
||||
<td class="col-6 text-truncate">@StaticHelper.TruncateStrings(usageHistory.Description, 50)</td>
|
||||
<td class="col-2">@usageHistory.Quantity.ToString("F")</td>
|
||||
<td class="col-2">@usageHistory.Cost.ToString("C2")</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="text-center">
|
||||
<h4>@translator.Translate(userLanguage, "No supply requisitions in history")</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var uploadedFiles = [];
|
||||
var supplyUsageHistory = [];
|
||||
getUploadedFilesFromModel();
|
||||
function getUploadedFilesFromModel() {
|
||||
@foreach (UploadedFiles filesUploaded in Model.Files)
|
||||
@@ -106,9 +150,10 @@
|
||||
@:uploadedFiles.push({ name: "@filesUploaded.Name", location: "@filesUploaded.Location" });
|
||||
}
|
||||
}
|
||||
var supplyUsageHistory = [];
|
||||
@foreach(SupplyUsageHistory usageHistory in Model.UsageHistory)
|
||||
{
|
||||
@:supplyUsageHistory.push({date: decodeHTMLEntities("@usageHistory.Date.ToShortDateString()"), description: decodeHTMLEntities("@usageHistory.Description"), quantity: decodeHTMLEntities("@usageHistory.Quantity.ToString("F")"), cost: decodeHTMLEntities("@usageHistory.Cost.ToString("C2")")})
|
||||
@:supplyUsageHistory.push({date: decodeHTMLEntities("@usageHistory.Date.ToShortDateString()"), description: decodeHTMLEntities("@usageHistory.Description"), quantity: decodeHTMLEntities("@usageHistory.Quantity.ToString("F")"), cost: decodeHTMLEntities("@usageHistory.Cost.ToString("F")")})
|
||||
}
|
||||
function getSupplyRecordModelData() {
|
||||
return { id: @Model.Id}
|
||||
|
||||
@@ -327,4 +327,12 @@ function moveRecord(recordId, source, dest) {
|
||||
$("#workAroundInput").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
function toggleSupplyUsageHistory() {
|
||||
var container = $("#supplyUsageHistoryModalContainer");
|
||||
if (container.hasClass("d-none")) {
|
||||
container.removeClass("d-none");
|
||||
} else {
|
||||
container.addClass("d-none");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user