|
|
@ -1,127 +1,14 @@
|
|
|
|
var urlPapers = "/api/1.0/papers";
|
|
|
|
function deletePaper() {
|
|
|
|
var urlPaperStatuses = "/api/1.0/papers/statuses";
|
|
|
|
|
|
|
|
var urlDeletePaper = "/api/1.0/papers/";
|
|
|
|
|
|
|
|
var urlFilterPaper = "/api/1.0/papers/filter"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function showPapers(papersElement, paperRowClass) {
|
|
|
|
|
|
|
|
getFromRest(urlPapers, function (paperList) {
|
|
|
|
|
|
|
|
paperList.forEach(function (paper, index) {
|
|
|
|
|
|
|
|
$(papersElement).parent().append("<div class='row text-left paper-row'>" +
|
|
|
|
|
|
|
|
" <div class='col'>" +
|
|
|
|
|
|
|
|
" <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>" + (index + 1) + ". " + paper.title + "</span></a>" +
|
|
|
|
|
|
|
|
"<span class='remove-paper d-none pull-right' 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 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) {
|
|
|
|
|
|
|
|
var id = $(idElement).parent().find('.id-class').val();
|
|
|
|
|
|
|
|
$("#remove-paper-modal").modal('show');
|
|
|
|
$("#remove-paper-modal").modal('show');
|
|
|
|
|
|
|
|
|
|
|
|
$("#modal-btn-yes").on("click", function () {
|
|
|
|
$("#modal-btn-yes").on("click", function () {
|
|
|
|
deleteFromRest(urlDeletePaper + id, function () {
|
|
|
|
return true;
|
|
|
|
showFeedbackMessage("Статья удалена");
|
|
|
|
|
|
|
|
$(paperRowClass).remove();
|
|
|
|
|
|
|
|
showPapers(papersElement, paperRowClass);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#remove-paper-modal").modal('hide');
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$("#modal-btn-no").on("click", function () {
|
|
|
|
$("#modal-btn-no").on("click", function () {
|
|
|
|
$("#remove-paper-modal").modal('hide');
|
|
|
|
$("#remove-paper-modal").modal('hide');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
function addPaper(title, status, datePublish, dateUpdate, deadline, comment, locked, tmpFileName, authors) {
|
|
|
|
|
|
|
|
var paperData = JSON.stringify({
|
|
|
|
|
|
|
|
"title": title,
|
|
|
|
|
|
|
|
"status": status,
|
|
|
|
|
|
|
|
"deadlineDate":deadline,
|
|
|
|
|
|
|
|
"comment": comment
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
postToRest(urlPapers, paperData, function (data) {
|
|
|
|
|
|
|
|
alert(data);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getPaperStatusClass(status) {
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
|
|
|
|
case 'DRAFT':
|
|
|
|
|
|
|
|
return "text-draft"
|
|
|
|
|
|
|
|
case 'ON_PREPARATION':
|
|
|
|
|
|
|
|
return "text-primary";
|
|
|
|
|
|
|
|
case 'ON_REVIEW':
|
|
|
|
|
|
|
|
return "text-primary";
|
|
|
|
|
|
|
|
case 'COMPLETED':
|
|
|
|
|
|
|
|
return "text-success";
|
|
|
|
|
|
|
|
case 'ATTENTION':
|
|
|
|
|
|
|
|
return "text-warning";
|
|
|
|
|
|
|
|
case 'FAILED':
|
|
|
|
|
|
|
|
return "text-failed";
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function showPaperDashboard(dashboardElement) {
|
|
|
|
function showPaperDashboard(dashboardElement) {
|
|
|
|