diff --git a/scipost_django/edadmin/templates/edadmin/edadmin.html b/scipost_django/edadmin/templates/edadmin/edadmin.html index 75ccdabd39b26e822a844d55b1f7443f6ad5abac..3abf35a9ae0dc711587f6231f4fabb487c54db77 100644 --- a/scipost_django/edadmin/templates/edadmin/edadmin.html +++ b/scipost_django/edadmin/templates/edadmin/edadmin.html @@ -20,8 +20,22 @@ {% for submission in prescreening %} <details> <summary>{{ submission }}</summary> - {{ submission }} + <button class="m-2 btn btn-primary workflowDiagram" + id="submission-{{ submission.preprint.identifier_w_vn_nr }}-workflow-diagram" + hx-get="{% url 'submissions:_hx_submission_workflow_diagram' identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}" + hx-swap="outerHTML" + >Load Submission processing workflow graphs</button> </details> {% endfor %} {% endblock content %} + +{% block footer_script %} + <script type="module" nonce="{{ request.csp_nonce }}"> + import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs'; + mermaid.initialize({ startOnLoad: false }); + document.body.addEventListener("htmx:afterSettle", function(evt) { + mermaid.init(".workflowDiagram"); + }); + </script> +{% endblock footer_script %} diff --git a/scipost_django/submissions/templates/submissions/_hx_submission_workflow_diagram.html b/scipost_django/submissions/templates/submissions/_hx_submission_workflow_diagram.html new file mode 100644 index 0000000000000000000000000000000000000000..a46c4c961eed629d7bdba4ae9bc25276463dce1a --- /dev/null +++ b/scipost_django/submissions/templates/submissions/_hx_submission_workflow_diagram.html @@ -0,0 +1,84 @@ +<div class="border m-2 p-2"> + <strong class="m-2">Workflow graphs{% if submission %} for <a href="{{ submission.get_absolute_url }}">{{ submission }}</a>{% else %}: Submission processing{% endif %}</strong> +<div class="m-4"> + <strong class="mt-2">Pre-screening</strong> + <pre class="mermaid"> +flowchart LR + Sub([Submission{% if submission %}<br>{{ submission.submission_date }}<br>{{ submission.submission_date|timesince }} ago{% endif %}]) + subgraph Pre-screening + Admiss(Admissibility<br>and plagiarism<br>checks) --pass--> PreTop(Topics<br>specification) + PreTop --> PreCOI(Conflict<br>of interest<br>checks) + PreCOI --> PrePa(Pre-assignments) + end + Admiss --fail--> PreFailed([Pre-screening<br>failed]) + Sub --> Admiss + PrePa --> PrePass([Pre-screening<br>passed]) --> Screening[[Goto:<br>Screening]] +</pre> +</div> +<div class="m-4"> +<strong class="mt-2">Screening</strong> +<pre class="mermaid"> +flowchart LR + subgraph Screening + ScrInv([Fellows invited<br>to take charge]) --> ScrDecl(Fellows decline) + ScrInv --> ScrNoAns(Fellows unresponsive) + ScrInv --> ScrAcc(A Fellow accepts) + ScrAcc --> ScrEiC(Editor-in-charge<br>appointed) + ScrVol(A Fellow<br>volunteers) --> ScrEiC + end + Resub([Resubmission or<br>restart refereeing]) --> ScrEiC + ScrEiC --> ChooseCycle{% verbatim %}{{Choose<br>cycle}}{% endverbatim %} + ChooseCycle --"open a<br>refereeing<br>round"--> Refereeing[[Goto:<br>Refereeing]] + ChooseCycle --direct<br>recommendation--> DirectRec[[Goto:<br>Editorial Recommendation]] + ScrDecl --> DeskRej([Screening failed]) + ScrNoAns --> DeskRej +</pre> +</div> +<div class="m-4"> +<strong class="mt-2">Refereeing</strong> +<pre class="mermaid"> +flowchart LR + subgraph Ref [Refereeing] + RefOpen([Refereeing<br>round open]) --> RefInv(Referees<br>invited) + RefInv--> RepSub(Reports<br>submitted) + RefCont(Contributed<br>Reports) --> RepSub + RepSub --vetting--> RepPub(Reports<br>published) + RepPub --> AuthResp(Author<br>response) + ContCom(Contributed<br>Comments) --vetting--> ComPub(Comments<br>published) + ComPub --> AuthResp + AuthResp --> RefClosed(Refereeing round<br>closed) + end + RefClosed --> EiCRec[[Goto:<br>Editorial recommendation]] +</pre> +</div> +<div class="m-4"> + <strong>Recommendation, voting and decision</strong> + <pre class="mermaid"> +flowchart LR + subgraph EiCRec [Editorial recommendation] + RefClosed([Refereeing round<br>closed]) --> EiCRecForm{% verbatim %}{{EiC Rec<br>Formulation}}{% endverbatim %} + DirectRec([Direct<br>Recommendation]) --> EiCRecForm + end + subgraph EdColVote [Editorial College vote] + VotePrep(Voting<br>preparation) --> VotingInv(Fellows<br>invited to vote) + VotingInv --> Voting(Fellows voting) + end + EiCRecForm --minor/major revision--> Resub(Resubmission) + EiCRecForm --accept/reject--> EdColVote + Resub --> Refereeing[[Goto: Screening:<br>Resubmission or restart refereeing]] + subgraph EdDec [Editorial decision] + AcceptTarget(Accept<br>in target<br>Journal) + AcceptAlt(Accept<br>in alternative<br>Journal) + Reject + RestartRef(Restart<br>refereeing) + end + EdColVote --> EdDec + AcceptTarget --> Production([Production]) + AcceptAlt --> PubOffer(Publication<br>offer) + PubOffer --accept--> Production + PubOffer --decline--> Close([Processing<br>closed]) + RestartRef(Restart<br>refereeing) --> Refereeing + Reject --> Close + </pre> +</div> +</div> diff --git a/scipost_django/submissions/templates/submissions/refereeing_procedure.html b/scipost_django/submissions/templates/submissions/refereeing_procedure.html index 5b3b1ccd704a4a3bad1599ed89cf67cc3da3d6b8..a388be0de19a1d9f1328cbd9f06bf1cf5a0a395e 100644 --- a/scipost_django/submissions/templates/submissions/refereeing_procedure.html +++ b/scipost_django/submissions/templates/submissions/refereeing_procedure.html @@ -67,5 +67,22 @@ </div> </div> + <button class="m-2 btn btn-primary workflowDiagram" + id="submission-workflow-diagram" + hx-get="{% url 'submissions:_hx_submission_workflow_diagram' %}" + hx-swap="outerHTML" + hx-trigger="revealed" + >Submission processing workflow graphs</button> + {% endblock content %} + +{% block footer_script %} + <script type="module" nonce="{{ request.csp_nonce }}"> + import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs'; + mermaid.initialize({ startOnLoad: false }); + document.body.addEventListener("htmx:afterSettle", function(evt) { + mermaid.init(".workflowDiagram"); + }); + </script> +{% endblock footer_script %} diff --git a/scipost_django/submissions/urls.py b/scipost_django/submissions/urls.py index 7e6c93078cdf6199155c38ccd3febaead3e08472..00d8caaa8dd64068c17b68cf814a147e692dbd4b 100644 --- a/scipost_django/submissions/urls.py +++ b/scipost_django/submissions/urls.py @@ -43,6 +43,16 @@ urlpatterns = [ path( "<identifier:identifier_w_vn_nr>/", views.submission_detail, name="submission" ), + path( + "workflow_diagram", + views._hx_submission_workflow_diagram, + name="_hx_submission_workflow_diagram" + ), + path( + "<identifier:identifier_w_vn_nr>/workflow_diagram", + views._hx_submission_workflow_diagram, + name="_hx_submission_workflow_diagram" + ), path( "<identifier:identifier_w_vn_nr>/reports/<int:report_nr>/pdf", views.report_detail_pdf, diff --git a/scipost_django/submissions/views.py b/scipost_django/submissions/views.py index dfdd4b1977bee34ad5f633d9904dc0752e9c8529..3e4f1c208dc92687b662d9e6770aec51a01bc349 100644 --- a/scipost_django/submissions/views.py +++ b/scipost_django/submissions/views.py @@ -699,6 +699,17 @@ def submission_detail(request, identifier_w_vn_nr): return render(request, "submissions/submission_detail.html", context) +def _hx_submission_workflow_diagram(request, identifier_w_vn_nr=None): + """Mermaid workflow diagram of Submission.""" + context = {} + if identifier_w_vn_nr: + submission = get_object_or_404( + Submission, preprint__identifier_w_vn_nr=identifier_w_vn_nr + ) + context["submission"]= submission + return render(request, "submissions/_hx_submission_workflow_diagram.html", context) + + def report_attachment(request, identifier_w_vn_nr, report_nr): """Download the attachment of a Report if available.""" report = get_object_or_404(