|
|
@ -1,21 +1,23 @@
|
|
|
|
var urlPapers = "/api/1.0/papers";
|
|
|
|
var urlPapers = "/api/1.0/papers";
|
|
|
|
var urlPaperStatuses = "/api/1.0/papers/statuses";
|
|
|
|
var urlPaperStatuses = "/api/1.0/papers/statuses";
|
|
|
|
var urlDeletePaper = "/api/1.0/papers/";
|
|
|
|
var urlDeletePaper = "/api/1.0/papers/";
|
|
|
|
|
|
|
|
var urlFilterPaper = "/api/1.0/papers/filter"
|
|
|
|
|
|
|
|
|
|
|
|
function showPapers(papersElement, paperRowClass) {
|
|
|
|
function showPapers(papersElement, paperRowClass) {
|
|
|
|
getFromRest(urlPapers, function (paperList) {
|
|
|
|
getFromRest(urlPapers, function (paperList) {
|
|
|
|
paperList.forEach(function (paper, index) {
|
|
|
|
paperList.forEach(function (paper, index) {
|
|
|
|
$(papersElement).parent().append("<div class='row text-left paper-row'>" +
|
|
|
|
$(papersElement).parent().append("<div class='row text-left paper-row'>" +
|
|
|
|
" <div class='col'>" +
|
|
|
|
" <div class='col-md-11'>" +
|
|
|
|
" <span class='fa-stack fa-1x'>\n" +
|
|
|
|
" <span class='fa-stack fa-1x'>\n" +
|
|
|
|
" <i class='fa fa-circle fa-stack-2x " + getPaperStatusClass(paper.status) + "'></i>" +
|
|
|
|
" <i class='fa fa-circle fa-stack-2x " + getPaperStatusClass(paper.status) + "'></i>" +
|
|
|
|
" <i class='fa fa-file-text-o fa-stack-1x fa-inverse'></i>" +
|
|
|
|
" <i class='fa fa-file-text-o fa-stack-1x fa-inverse'></i>" +
|
|
|
|
" </span>" +
|
|
|
|
" </span>" +
|
|
|
|
" <a href='paper?id=" + paper.id + "" +
|
|
|
|
" <a href='paper?id=" + paper.id + "" +
|
|
|
|
"'><span>" + (index + 1) + ". " + paper.title + "</span></a>" +
|
|
|
|
"'><span>" + paper.title + "</span></a></div>" +
|
|
|
|
"<span class='remove-paper d-none pull-right' onclick=\"deletePaper(" + paper.id + ",'" + papersElement + "', '" + paperRowClass + "')\">" +
|
|
|
|
"<div class='col-md-1'>" +
|
|
|
|
|
|
|
|
"<span class='remove-paper d-none' onclick=\"deletePaper(" + paper.id + ",'" + papersElement + "', '" + paperRowClass + "')\">" +
|
|
|
|
"<i class=\"fa fa-trash\" aria-hidden=\"true\"></i></span>" +
|
|
|
|
"<i class=\"fa fa-trash\" aria-hidden=\"true\"></i></span>" +
|
|
|
|
"</div></div>");
|
|
|
|
" </div></div>");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$(paperRowClass).mouseenter(function (event) {
|
|
|
|
$(paperRowClass).mouseenter(function (event) {
|
|
|
@ -32,6 +34,47 @@ function showPapers(papersElement, paperRowClass) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function filterPapers(papersElement, paperRowClass, authorId, year) {
|
|
|
|
|
|
|
|
var paperData = JSON.stringify({
|
|
|
|
|
|
|
|
"authorId": authorId,
|
|
|
|
|
|
|
|
"year": year
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
postToRest(urlFilterPaper, paperData, function (data) {
|
|
|
|
|
|
|
|
$(paperRowClass).remove();
|
|
|
|
|
|
|
|
if(data.length > 0){
|
|
|
|
|
|
|
|
data.forEach(function (paper, index) {
|
|
|
|
|
|
|
|
$(papersElement).parent().append("<div class='row text-left paper-row'>" +
|
|
|
|
|
|
|
|
" <div class='col-md-11'>" +
|
|
|
|
|
|
|
|
" <span class='fa-stack fa-1x'>\n" +
|
|
|
|
|
|
|
|
" <i class='fa fa-circle fa-stack-2x " + getPaperStatusClass(paper.status) + "'></i>" +
|
|
|
|
|
|
|
|
" <i class='fa fa-file-text-o fa-stack-1x fa-inverse'></i>" +
|
|
|
|
|
|
|
|
" </span>" +
|
|
|
|
|
|
|
|
" <a href='paper?id=" + paper.id + "" +
|
|
|
|
|
|
|
|
"'><span>" + paper.title + "</span></a></div>" +
|
|
|
|
|
|
|
|
"<div class='col-md-1'>" +
|
|
|
|
|
|
|
|
"<span class='remove-paper d-none' onclick=\"deletePaper(" + paper.id + ",'" + papersElement + "', '" + paperRowClass + "')\">" +
|
|
|
|
|
|
|
|
"<i class=\"fa fa-trash\" aria-hidden=\"true\"></i></span>" +
|
|
|
|
|
|
|
|
" </div></div>");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(paperRowClass).mouseenter(function (event) {
|
|
|
|
|
|
|
|
var paperRow = $(event.target).closest(paperRowClass);
|
|
|
|
|
|
|
|
$(paperRow).css("background-color", "#f8f9fa");
|
|
|
|
|
|
|
|
$(paperRow).find(".remove-paper").removeClass("d-none");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$(paperRowClass).mouseleave(function (event) {
|
|
|
|
|
|
|
|
var paperRow = $(event.target).closest(paperRowClass);
|
|
|
|
|
|
|
|
$(paperRow).css("background-color", "white");
|
|
|
|
|
|
|
|
$(paperRow).closest(paperRowClass).find(".remove-paper").addClass("d-none");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function deletePaper(id, papersElement, paperRowClass) {
|
|
|
|
function deletePaper(id, papersElement, paperRowClass) {
|
|
|
|
$("#remove-paper-modal").modal('show');
|
|
|
|
$("#remove-paper-modal").modal('show');
|
|
|
|
|
|
|
|
|
|
|
@ -61,52 +104,17 @@ function addPaper(title, status, comment, locked) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function filterPaper(authorId, year) {
|
|
|
|
|
|
|
|
var paperData = JSON.stringify({
|
|
|
|
|
|
|
|
"authors": title,
|
|
|
|
|
|
|
|
"": status
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
postToRest(urlPapers, paperData, function (data) {
|
|
|
|
|
|
|
|
alert(data);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getPaperStatusClass(status) {
|
|
|
|
function getPaperStatusClass(status) {
|
|
|
|
switch (status) {
|
|
|
|
switch (status) {
|
|
|
|
case 'DRAFT':
|
|
|
|
case 'DRAFT':
|
|
|
|
return "text-draft"
|
|
|
|
return "text-draft"
|
|
|
|
case 'ON_PREPARATION':
|
|
|
|
case 'ON_PREPARATION':
|
|
|
|
return "text-primary";
|
|
|
|
return "text-primary";
|
|
|
|
case 'ON_REVIEW':
|
|
|
|
|
|
|
|
return "text-primary";
|
|
|
|
|
|
|
|
case 'COMPLETED':
|
|
|
|
case 'COMPLETED':
|
|
|
|
return "text-success";
|
|
|
|
return "text-success";
|
|
|
|
case 'ATTENTION':
|
|
|
|
case 'ATTENTION':
|
|
|
|
return "text-warning";
|
|
|
|
return "text-warning";
|
|
|
|
case 'FAILED':
|
|
|
|
|
|
|
|
return "text-failed";
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function showPaperDashboard(dashboardElement) {
|
|
|
|
|
|
|
|
getFromRest(urlPapers, function (paperList) {
|
|
|
|
|
|
|
|
paperList.forEach(function (paper, index) {
|
|
|
|
|
|
|
|
$(dashboardElement).append("<div class=\"col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card\">" +
|
|
|
|
|
|
|
|
"<div class=\"row\">" +
|
|
|
|
|
|
|
|
"<div class=\"col-2\">" +
|
|
|
|
|
|
|
|
"<span class=\"fa-stack fa-1x\">" +
|
|
|
|
|
|
|
|
"<i class=\"fa fa-circle fa-stack-2x " + getPaperStatusClass(paper.status) + "\"></i>" +
|
|
|
|
|
|
|
|
"<i class=\"fa fa-file-text-o fa-stack-1x fa-inverse\"></i>" +
|
|
|
|
|
|
|
|
"</span>" +
|
|
|
|
|
|
|
|
"</div>" +
|
|
|
|
|
|
|
|
"<div class=\"col col-10 text-right\">" +
|
|
|
|
|
|
|
|
"<h7 class=\"service-heading\">" + paper.title + "</h7>" +
|
|
|
|
|
|
|
|
"<p class=\"text-muted\">" + paper.authorsString + "</p>" +
|
|
|
|
|
|
|
|
"</div>" +
|
|
|
|
|
|
|
|
"</div>" +
|
|
|
|
|
|
|
|
"</div>");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|