diff --git a/scipost_django/production/templates/production/_hx_productionstream_details_contents.html b/scipost_django/production/templates/production/_hx_productionstream_details_contents.html index c4c392e01101a85f7b10d8629a6d46d417bab332..4832b4829521da96b08e8b5a5409955f8af65dd1 100644 --- a/scipost_django/production/templates/production/_hx_productionstream_details_contents.html +++ b/scipost_django/production/templates/production/_hx_productionstream_details_contents.html @@ -1,4 +1,5 @@ {% load guardian_tags %} +{% load bootstrap %} {% get_obj_perms request.user for productionstream as "sub_perms" %} @@ -8,49 +9,156 @@ <div class="row"> <div class="col-12 col-md-6"> - <h3>Actions</h3> - {% if "can_perform_supervisory_actions" in sub_perms %} - <div class="container"> - <details class="mb-3"> - <summary class="fs-6">Change stream property</summary> - <div class="border-primary border-start ps-2 pt-4"> - {% include "production/_hx_productionstream_change_status.html" with form=status_form stream=productionstream %} - {% include "production/_hx_productionstream_change_supervisor.html" with form=supervisor_form stream=productionstream %} - {% include "production/_hx_productionstream_change_prodofficer.html" with form=prod_officer_form stream=productionstream %} - {% include "production/_hx_productionstream_change_invofficer.html" with form=inv_officer_form stream=productionstream %} - </div> - </details> - </div> - {% endif %} - <ul> - <li>Worklog</li> + + <div class="accordion px-2" + id="productionstream-{{ productionstream.id }}-actions-accordion"> + <h3>Actions</h3> - {% if perms.scipost.can_publish_accepted_submission %} - <div class="row"> - <div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty"> - <div class="row m-0 d-none-empty"> - <button class="btn btn-sm btn-warning text-white" hx-get="{% url 'production:mark_as_completed' stream_id=productionstream.id %}" hx-confim="Are you sure you want to mark this stream as completed?" hx-target="#productionstream-{{ productionstream.id }}-details"> - Mark this stream as completed - </button> + {% if perms.scipost.can_take_decisions_related_to_proofs %} + <div class="accordion-item"> + <h2 class="accordion-header" + id="productionstream-{{ productionstream.id }}-change-stream-property-header"> + <button class="accordion-button fs-6 collapsed" + type="button" + data-bs-toggle="collapse" + data-bs-target="#productionstream-{{ productionstream.id }}-change-stream-property" + aria-expanded="true" + aria-controls="productionstream-{{ productionstream.id }}-change-stream-property"> + Change stream property + </button> + </h2> + <div id="productionstream-{{ productionstream.id }}-change-stream-property" + class="accordion-collapse collapse" + aria-labelledby="productionstream-{{ productionstream.id }}-change-stream-property-header" + data-bs-parent="#productionstream-{{ productionstream.id }}-actions-accordion"> + <div id="productionstream-{{ productionstream.id }}-change-stream-property-body" + class="accordion-body"> + {% include "production/_hx_productionstream_change_status.html" with form=status_form stream=productionstream %} + {% include "production/_hx_productionstream_change_supervisor.html" with form=supervisor_form stream=productionstream %} + {% include "production/_hx_productionstream_change_prodofficer.html" with form=prod_officer_form stream=productionstream %} + {% include "production/_hx_productionstream_change_invofficer.html" with form=inv_officer_form stream=productionstream %} </div> </div> </div> {% endif %} + + {% if "can_work_for_stream" in sub_perms %} + <div class="accordion-item"> + <h2 class="accordion-header" + id="productionstream-{{ productionstream.id }}-upload-proofs-header"> + <button class="accordion-button fs-6 collapsed" + type="button" + data-bs-toggle="collapse" + data-bs-target="#productionstream-{{ productionstream.id }}-upload-proofs" + aria-expanded="false" + aria-controls="productionstream-{{ productionstream.id }}-upload-proofs" + hx-get="{% url 'production:upload_proofs' stream_id=productionstream.id %}" + hx-trigger="click once" + hx-target="#productionstream-{{ productionstream.id }}-upload-proofs-body">Upload Proofs</button> + </h2> + <div id="productionstream-{{ productionstream.id }}-upload-proofs" + class="accordion-collapse collapse" + aria-labelledby="productionstream-{{ productionstream.id }}-upload-proofs-header" + data-bs-parent="#productionstream-{{ productionstream.id }}-actions-accordion"> + <div id="productionstream-{{ productionstream.id }}-upload-proofs-body" + class="accordion-body"></div> + </div> + </div> + {% endif %} + + <div class="accordion-item"> + <h2 class="accordion-header" + id="productionstream-{{ productionstream.id }}-work-log-header"> + <button class="accordion-button fs-6 collapsed" + type="button" + data-bs-toggle="collapse" + data-bs-target="#productionstream-{{ productionstream.id }}-work-log" + aria-expanded="false" + aria-controls="productionstream-{{ productionstream.id }}-work-log">Work Log</button> + </h2> + <div id="productionstream-{{ productionstream.id }}-work-log" + class="accordion-collapse collapse" + aria-labelledby="productionstream-{{ productionstream.id }}-work-log-header" + data-bs-parent="#productionstream-{{ productionstream.id }}-actions-accordion"> + <div id="productionstream-{{ productionstream.id }}-work-log-body" + class="accordion-body">Work log here</div> + </div> + </div> + + {% if perms.scipost.can_draft_publication or perms.scipost.can_publish_accepted_submission %} + <div class="accordion-item"> + <h2 class="accordion-header" + id="productionstream-{{ productionstream.id }}-advance-stream-header"> + <button class="accordion-button fs-6 collapsed" + type="button" + data-bs-toggle="collapse" + data-bs-target="#productionstream-{{ productionstream.id }}-advance-stream" + aria-expanded="false" + aria-controls="productionstream-{{ productionstream.id }}-advance-stream"> + Advance production stream + </button> + </h2> + <div id="productionstream-{{ productionstream.id }}-advance-stream" + class="accordion-collapse collapse" + aria-labelledby="productionstream-{{ productionstream.id }}-advance-stream-header" + data-bs-parent="#productionstream-{{ productionstream.id }}-actions-accordion"> + <div id="productionstream-{{ productionstream.id }}-advance-stream-body" + class="accordion-body"> + {% if perms.scipost.can_publish_accepted_submission %} + <div class="row"> + <div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty"> + <div class="row m-0 d-none-empty"> + <button class="btn btn-sm btn-warning text-white" + hx-get="{% url 'production:mark_as_completed' stream_id=productionstream.id %}" + hx-confim="Are you sure you want to mark this stream as completed?" + hx-target="#productionstream-{{ productionstream.id }}-details"> + Mark this stream as completed + </button> + </div> + </div> + </div> + {% endif %} - {% if perms.scipost.can_draft_publication and stream.status == 'accepted' %} - <div class="row"> - <div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty"> - <div class="row m-0 d-none-empty"> - <a class="btn btn-sm btn-primary text-white" href="{% url 'journals:create_publication' productionstream.submission.preprint.identifier_w_vn_nr %}"> - Draft publication - </a> + {% if perms.scipost.can_draft_publication and stream.status == 'accepted' %} + <div class="row"> + <div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty"> + <div class="row m-0 d-none-empty"> + <a class="btn btn-sm btn-primary text-white" + href="{% url 'journals:create_publication' productionstream.submission.preprint.identifier_w_vn_nr %}"> + Draft publication + </a> + </div> + </div> + </div> + {% endif %} </div> </div> </div> {% endif %} + + </div> + + {% comment %} <h3>Actions</h3> + <ul> + <li>Worklog</li> + + + + {% if "can_work_for_stream" in sub_perms %} + {% if perms.scipost.can_upload_proofs and upload_proofs_form %} + <div class="row"> + <div class="col-12 col-sm-auto col-md-12 col-lg-auto h-100 d-none-empty"> + <div class="row m-0 d-none-empty"> + <button class="btn btn-sm btn-primary text-white" hx-post="{% url 'production:upload_proofs' stream_id=productionstream.id %}" hx-target="#productionstream-{{ productionstream.id }}-details">Upload Proofs</button> + </div> + </div> + </div> + {% endif %} + {% endif %} + <li>Accessibility</li> <li>Send Proofs</li> - </ul> + </ul> {% endcomment %} </div> <div id="productionstream-{{ productionstream.id }}-event-container" diff --git a/scipost_django/production/templates/production/upload_proofs.html b/scipost_django/production/templates/production/upload_proofs.html index a4ac83767db90cb903e9bd181de1af2479f04c6a..7b20db78270cf4f7125c5a5be1fd297e423f64e8 100644 --- a/scipost_django/production/templates/production/upload_proofs.html +++ b/scipost_django/production/templates/production/upload_proofs.html @@ -1,29 +1,46 @@ -{% extends 'production/base.html' %} +{% load bootstrap %} -{% block breadcrumb_items %} - {{block.super}} - <span class="breadcrumb-item">Upload Proofs</span> -{% endblock %} -{% load bootstrap %} +<h3>Proofs</h3> +<ul> + {% for proofs in stream.proofs.all %} + <li class="py-1"> + <a href="{% url 'production:proofs' stream_id=stream.id version=proofs.version %}">Version {{ proofs.version }}</a> · <span class="label label-secondary label-sm">{{ proofs.get_status_display }}</span> + <br> + Uploaded by: {{ proofs.uploaded_by.user.first_name }} {{ proofs.uploaded_by.user.last_name }} + <br> + Accessible for authors: {{ proofs.accessible_for_authors|yesno:'<strong>Yes</strong>,No'|safe }} + <br> -{% block content %} + {% if perms.scipost.can_run_proofs_by_authors %} + {% if proofs.status == 'uploaded' %} + <strong><span class="text-danger">See details for open actions:</span></strong> + <ul> + <li> + <a href="{% url 'production:proofs' stream_id=stream.id version=proofs.version %}">Accept or decline proofs</a> + </li> + </ul> + {% elif proofs.status == 'accepted_sup' %} + <strong><span class="text-danger">See details for open actions:</span></strong> + <ul> + <li> + <a href="{% url 'production:proofs' stream_id=stream.id version=proofs.version %}">Send proofs to authors</a> + </li> + </ul> + {% endif %} + {% endif %} + </li> + {% empty %} + <li>No Proofs found.</li> + {% endfor %} +</ul> - <div class="row"> - <div class="col-12"> - <h1 class="highlight">Upload Proofs</h1> - {% include 'submissions/_submission_card_content.html' with submission=stream.submission %} - </div> +<div class="row"> + <div class="col-12"> + <form method="post" enctype="multipart/form-data"> + {% csrf_token %} + {{ form|bootstrap_purely_inline }} + <input type="submit" class="btn btn-primary" name="submit" value="Upload"> + </form> </div> - <div class="row"> - <div class="col-12"> - <form method="post" enctype="multipart/form-data"> - {% csrf_token %} - {{ form|bootstrap }} - <input type="submit" class="btn btn-outline-secondary" name="submit" value="Upload"> - </form> - </ul> - </div> - </div> - -{% endblock content %} +</div> diff --git a/scipost_django/production/views.py b/scipost_django/production/views.py index adbce711bdb4e9576ee10dffdd898eaa974a6778..78f85233ec4c968002aebd6d96b1e7364c87fc51 100644 --- a/scipost_django/production/views.py +++ b/scipost_django/production/views.py @@ -104,12 +104,15 @@ def _hx_productionstream_details_contents(request, productionstream_id): auto_id=f"productionstream_{productionstream.id}_id_%s", ) + upload_proofs_form = ProofsUploadForm() + context = { "" "productionstream": productionstream, "status_form": status_form, "supervisor_form": supervisor_form, "inv_officer_form": inv_officer_form, "prod_officer_form": prod_officer_form, + "upload_proofs_form": upload_proofs_form, } return render( request,