Skip to content

Commit

Permalink
Fixed #151 -- Accept/reject journal review invitation
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonmoura committed Jan 27, 2021
1 parent eaea59e commit ddac666
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ public function initCommitteeReviewAction($protocol_id)
}

// if form was to remove a member
if ( isset($post_data['reject-review']) and "yes" == $post_data['reject-review'] ) {
if ( isset($post_data['protocol-review-invitation']) and !empty($post_data['protocol-review-invitation']) ) {
if ( "committee" == $post_data['member-type'] ) {
$protocol_revision_repository = $protocol_committee_revision_repository;
} else {
Expand All @@ -1047,15 +1047,28 @@ public function initCommitteeReviewAction($protocol_id)

$revision = $protocol_revision_repository->findOneBy(array('member' => $user, "protocol" => $protocol));
if($revision) {
$revision->setRejected(true);
$revision->setRejectReason($post_data['reject-reason']);
if ( 'E' == $post_data['reject-reason'] and $post_data['other-reject-reason'] ) {
$revision->setOtherRejectReason($post_data['other-reject-reason']);
if ( 'yes' == $post_data['protocol-review-invitation'] ) {
$revision->setAccepted(true);
$em->persist($revision);
$em->flush();

$session->getFlashBag()->add('success', $translator->trans("Review has been accepted with success!"));
}
$em->persist($revision);
$em->flush();

$session->getFlashBag()->add('success', $translator->trans("Review has been rejected with success!"));
if ( 'no' == $post_data['protocol-review-invitation'] ) {
$revision->setRejected(true);
$revision->setRejectReason($post_data['reject-reason']);

if ( 'E' == $post_data['reject-reason'] and $post_data['other-reject-reason'] ) {
$revision->setOtherRejectReason($post_data['other-reject-reason']);
}

$em->persist($revision);
$em->flush();

$session->getFlashBag()->add('success', $translator->trans("Review has been rejected with success!"));
}

return $this->redirectToRoute('crud_committee_protocol_list', array('protocol_id' => $protocol->getId()), 301);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ div.reject-report {
margin-left: 23px;
}

div.select-reject-reason,
div.other-reject-reason {
display: none;
}
Expand All @@ -353,6 +354,14 @@ span.reject-label {
margin-top: 16px;
}

.protocol-review-invitation-radio {
text-align: center;
}

.protocol-review-invitation-radio .radio label {
padding: 0;
}

/*
DIV.multiple SELECT, INPUT[type="number"] {
width: 160px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,20 @@
{% if 'administrator' in app.user.getRolesSlug %}<span data-toggle="tooltip" data-placement="top" title="{% trans %}Delete this journal{% endtrans %}"><a href='{{ path("protocol_delete", {protocol_id: protocol.id} ) }}' class='btn btn-danger btn-xs' data-toggle='modal' data-target='#modalBaseAjax'><i class='glyphicon glyphicon-trash'></i></a></span>{% endif %}
{% if protocol.status in ["E","H"] and app.user in protocol.committeeRevisionUsers %}
{% if app.user not in protocol.committeeRejectedRevisions %}
<a href='{{ path("protocol_initial_committee_review_revisor", {protocol_id: protocol.id}) }}?member=committee' class='btn btn-default btn-xs' data-toggle="tooltip" data-placement="top" title="{% trans %}Send journal revision{% endtrans %}"><i class='glyphicon glyphicon-list-alt'></i></a>
{% if app.user not in protocol.committeeFinalRevisions %}<span data-toggle="tooltip" data-placement="top" title="{% trans %}Reject journal revision{% endtrans %}"><a href='#' id='reject-journal-review-{{ protocol.id }}' class='btn btn-danger btn-xs' data-member-type="committee" data-toggle='modal' data-target='#modal-reject-journal-review'><i class='glyphicon glyphicon-remove'></i></a></span>{% endif %}
{% if app.user in protocol.committeeAcceptedRevisions or app.user in protocol.committeeFinalRevisions %}
<a href='{{ path("protocol_initial_committee_review_revisor", {protocol_id: protocol.id}) }}?member=committee' class='btn btn-default btn-xs' data-toggle="tooltip" data-placement="top" title="{% trans %}Send journal revision{% endtrans %}"><i class='glyphicon glyphicon-list-alt'></i></a>
{% else %}
<span data-toggle="tooltip" data-placement="top" title="{% trans %}Journal review invitation{% endtrans %}"><a href='#' id='reject-journal-review-{{ protocol.id }}' class='btn btn-default btn-xs' data-member-type="committee" data-toggle='modal' data-target='#modal-reject-journal-review'><i class='glyphicon glyphicon-send'></i></a></span>
{% endif %}
{% endif %}
{% endif %}
{% if protocol.status in ["E","H"] and app.user in protocol.adhocRevisionUsers %}
{% if app.user not in protocol.adhocRejectedRevisions %}
<a href='{{ path("protocol_initial_committee_review_revisor", {protocol_id: protocol.id}) }}?member=adhoc' class='btn btn-default btn-xs' data-toggle="tooltip" data-placement="top" title="{% trans %}Send journal revision{% endtrans %}"><i class='glyphicon glyphicon-list-alt'></i></a>
{% if app.user not in protocol.adhocFinalRevisions %}<span data-toggle="tooltip" data-placement="top" title="{% trans %}Reject journal revision{% endtrans %}"><a href='#' id='reject-journal-review-{{ protocol.id }}' class='btn btn-danger btn-xs' data-member-type="adhoc" data-toggle='modal' data-target='#modal-reject-journal-review'><i class='glyphicon glyphicon-remove'></i></a></span>{% endif %}
{% if app.user in protocol.adhocAcceptedRevisions or app.user in protocol.adhocFinalRevisions %}
<a href='{{ path("protocol_initial_committee_review_revisor", {protocol_id: protocol.id}) }}?member=adhoc' class='btn btn-default btn-xs' data-toggle="tooltip" data-placement="top" title="{% trans %}Send journal revision{% endtrans %}"><i class='glyphicon glyphicon-list-alt'></i></a>
{% else %}
<span data-toggle="tooltip" data-placement="top" title="{% trans %}Journal review invitation{% endtrans %}"><a href='#' id='reject-journal-review-{{ protocol.id }}' class='btn btn-default btn-xs' data-member-type="adhoc" data-toggle='modal' data-target='#modal-reject-journal-review'><i class='glyphicon glyphicon-send'></i></a></span>
{% endif %}
{% endif %}
{% endif %}
</td>
Expand Down Expand Up @@ -249,35 +255,43 @@
</div>
</div>

<!-- Modal Reject Journal Review -->
<!-- Modal Invitation Journal Review -->
<div class="modal fade" id="modal-reject-journal-review" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<form id="form-reject-journal-review" class='form' method="POST" action="">
<input type="hidden" name="reject-review" value="yes">
<input type="hidden" name="member-type" value="">

<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">{% trans %}Are you sure that you want to reject this review?{% endtrans %}</h4>
<h4 class="modal-title" id="myModalLabel">{% trans %}Journal review invitation{% endtrans %}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<p>{% trans %}Please choose the reason{% endtrans %}</p>
<div class="form-group protocol-review-invitation-radio">
<label for="">{% trans %}Do you agree to review this journal{% endtrans %}?</label>
<div class="radio">
<label><input type="radio" name="protocol-review-invitation" id="protocol-review-invitation-yes" value="yes" required> {% trans %}Yes{% endtrans %}</label>
<label><input type="radio" name="protocol-review-invitation" id="protocol-review-invitation-no" value="no" required> {% trans %}No{% endtrans %}</label>
</div>
</div>

<div class="form-group select-reject-reason">
<p>{% trans %}Please choose the reason{% endtrans %}:</p>
<select class='form-control selectpicker' id="select-reject-reason" name="reject-reason" title="-">
{% for key, value in reject_reason %}
<option value="{{ key }}">{{ value }}</option>
{% endfor %}
</select>
</div>

<div class="form-group other-reject-reason">
<label for="input-other-reject-reason">{% trans %}Please inform the reason (not required){% endtrans %}:</label>
<input type="text" class="form-control" name='other-reject-reason' id='input-other-reject-reason' value="">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans %}Cancel{% endtrans %}</button>
<button type="submit" class="btn btn-danger">{% trans %}Reject{% endtrans %}</button>
<button type="submit" id="confirm-reject-button" class="btn btn-primary" disabled>{% trans %}Confirm{% endtrans %}</button>
</div>
</div>
</form>
Expand Down Expand Up @@ -329,16 +343,44 @@
$("input[name=member-type]").val(member_type);
$('#form-reject-journal-review').attr('action', action);
$("input:radio[id^=protocol-review-invitation-]").removeAttr('checked').iCheck('update');
$("#input-other-reject-reason").val('');
$(".other-reject-reason").hide();
$("#select-reject-reason option:selected").prop("selected", false);
$("#select-reject-reason").selectpicker('refresh');
$(".select-reject-reason").hide();
});
$("#select-reject-reason").change(function(){
var val = $(this).val();
if ( 'E' == val ) {
$(".other-reject-reason").show();
} else {
$(".other-reject-reason").hide();
}
});
$("input:radio[id^=protocol-review-invitation-]").on('ifClicked', function(){
var val = $(this).val(),
_val = $("#select-reject-reason").val();
$("#confirm-reject-button").prop("disabled", false);
if ( 'no' == val ) {
$(".select-reject-reason").show();
if ( 'E' == _val ) {
$(".other-reject-reason").show();
} else {
$(".other-reject-reason").hide();
}
} else {
$(".select-reject-reason").hide();
$(".other-reject-reason").hide();
}
});
});
</script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@
<span class='label label-primary'>{% trans %}Answered{% endtrans %}</span>
{% elseif revision.isFinalRevision %}
<span class='label label-success'>{% trans %}Final Revision{% endtrans %}</span>
{% elseif not revision.answered %}
{% elseif not revision.answered and revision.accepted %}
<span class='label label-info'>{% trans %}Accepted{% endtrans %}</span>
{% else %}
<span class='label label-default'>{% trans %}Assigned{% endtrans %}</span>
{% endif %}
</td>
Expand Down Expand Up @@ -188,7 +190,9 @@
<span class='label label-primary'>{% trans %}Answered{% endtrans %}</span>
{% elseif revision.isFinalRevision %}
<span class='label label-success'>{% trans %}Final Revision{% endtrans %}</span>
{% elseif not revision.answered %}
{% elseif not revision.answered and revision.accepted %}
<span class='label label-info'>{% trans %}Accepted{% endtrans %}</span>
{% else %}
<span class='label label-default'>{% trans %}Assigned{% endtrans %}</span>
{% endif %}
</td>
Expand Down
24 changes: 24 additions & 0 deletions symphony/src/Proethos2/ModelBundle/Entity/Protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,18 @@ public function getCommitteeRevisionUsers() {
return $users;
}

public function getCommitteeAcceptedRevisions() {
$users = array();

foreach($this->getCommitteeRevision() as $revision) {
if ( $revision->getAccepted() ) {
$users[] = $revision->getMember();
}
}

return $users;
}

public function getCommitteeRejectedRevisions() {
$users = array();

Expand Down Expand Up @@ -830,6 +842,18 @@ public function getAdhocRevisionUsers() {
return $users;
}

public function getAdhocAcceptedRevisions() {
$users = array();

foreach($this->getAdhocRevision() as $revision) {
if ( $revision->getAccepted() ) {
$users[] = $revision->getMember();
}
}

return $users;
}

public function getAdhocRejectedRevisions() {
$users = array();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class ProtocolAdhocRevision extends Base
*/
private $is_final_revision = false;

/**
* @ORM\Column(type="boolean")
*/
private $accepted = false;

/**
* @ORM\Column(type="boolean")
*/
Expand Down Expand Up @@ -1020,4 +1025,28 @@ public function getRevisedIn()
{
return $this->revised_in;
}

/**
* Set accepted
*
* @param boolean $accepted
*
* @return ProtocolAdhocRevision
*/
public function setAccepted($accepted)
{
$this->accepted = $accepted;

return $this;
}

/**
* Get accepted
*
* @return boolean
*/
public function getAccepted()
{
return $this->accepted;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class ProtocolCommitteeRevision extends Base
*/
private $is_final_revision = false;

/**
* @ORM\Column(type="boolean")
*/
private $accepted = false;

/**
* @ORM\Column(type="boolean")
*/
Expand Down Expand Up @@ -462,4 +467,28 @@ public function getRevisedIn()
{
return $this->revised_in;
}

/**
* Set accepted
*
* @param boolean $accepted
*
* @return ProtocolCommitteeRevision
*/
public function setAccepted($accepted)
{
$this->accepted = $accepted;

return $this;
}

/**
* Get accepted
*
* @return boolean
*/
public function getAccepted()
{
return $this->accepted;
}
}

0 comments on commit ddac666

Please sign in to comment.