108 lines
3.0 KiB
Plaintext
108 lines
3.0 KiB
Plaintext
@model IEnumerable<Fab2ApprovalSystem.Models.TrainingDocAck>
|
|
<table class="table" id="fileTable">
|
|
<tr>
|
|
<th>
|
|
@Html.DisplayNameFor(model => model.FileName)
|
|
</th>
|
|
<th>
|
|
@Html.DisplayNameFor(model => model.Reviewed)
|
|
</th>
|
|
<th>
|
|
|
|
</th>
|
|
<th></th>
|
|
</tr>
|
|
|
|
@foreach (var item in Model)
|
|
{
|
|
int i = 0;
|
|
<tr>
|
|
<td class="FileName">
|
|
<a href="@item.FileName.ToString()" target="_blank" onclick="MarkAsReviewed(@item.TrainingAssignmentID, @item.ID)">@item.FileName</a>
|
|
@Html.ActionLink(item.FileName,"DownloadFile", item.AttachmentID)
|
|
|
|
|
|
</td>
|
|
@if (item.Reviewed == true)
|
|
{
|
|
<td>Complete</td>
|
|
}
|
|
else
|
|
{
|
|
<td>Incomplete</td>
|
|
}
|
|
|
|
|
|
</tr>
|
|
}
|
|
|
|
</table>
|
|
<script type="text/javascript">
|
|
//$('.FileName').on('click', '.FileName', function (event) {
|
|
// var item = $(event.target).parent()
|
|
// alert(item)
|
|
// var isItemCompleted = item.hasClass('completed')
|
|
// var itemId = item.attr('attachment-id')
|
|
// alert('clicked item ' + itemId + ', which has completed currently set to ' + isItemCompleted)
|
|
//})
|
|
function MarkAsReviewed(AssignmentID, ID) {
|
|
console.log("Starting Review Timer");
|
|
//sleep(10000);
|
|
//alert(AttachmentId)
|
|
|
|
var sendInfo = {
|
|
trainingAssignmentID: AssignmentID,
|
|
trainingDocAckID: ID
|
|
|
|
};
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/Training/AcknowledgeDocument",
|
|
contentType: "application/json; charset=utf-8",
|
|
data: JSON.stringify(sendInfo),
|
|
dataType: "json",
|
|
success: function (r) {
|
|
//var json = $.parseJSON(r);
|
|
//alert('Success');
|
|
RefreshDocs();
|
|
//RefreshDocs();
|
|
//RefreshData();
|
|
},
|
|
error: function (req, status, error) {
|
|
alert(error);
|
|
}
|
|
});
|
|
|
|
console.log("Review Timer Finished");
|
|
}
|
|
function sleep(milliseconds) {
|
|
const date = Date.now();
|
|
let currentDate = null;
|
|
do {
|
|
currentDate = Date.now();
|
|
} while (currentDate - date < milliseconds);
|
|
}
|
|
function RefreshDocs() {
|
|
var trainingAssignmentID = @ViewBag.trainingAssignmentId;
|
|
//alert(SelectedGroup);
|
|
var sendInfo = {
|
|
trainingAssignmentId: trainingAssignmentID
|
|
};
|
|
|
|
$.ajax({
|
|
url: '@Url.Action("ViewTrainingDocsPartial", "Training")',
|
|
contentType: "application/json; charset=utf-8",
|
|
type: 'POST',
|
|
data: JSON.stringify(sendInfo),
|
|
//dataType: "json",
|
|
success: function(data) {
|
|
|
|
//alert('add success');
|
|
$("#docsDisplay").html(data);
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
</script>
|