From 482fd4ab5163a6626d91bd8781034043b327c349 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Tue, 16 Jul 2024 14:02:36 +0300
Subject: [PATCH] add referee indication table to submission pool

---
 .../_hx_referee_indication_table.html         |  7 ++-
 .../pool/_submission_refereeing.html          | 58 ++++++++++++-------
 2 files changed, 44 insertions(+), 21 deletions(-)

diff --git a/scipost_django/submissions/templates/submissions/_hx_referee_indication_table.html b/scipost_django/submissions/templates/submissions/_hx_referee_indication_table.html
index cbc028c2e..88b4979a6 100644
--- a/scipost_django/submissions/templates/submissions/_hx_referee_indication_table.html
+++ b/scipost_django/submissions/templates/submissions/_hx_referee_indication_table.html
@@ -76,7 +76,12 @@
 
     </tr>
 
-  {% endfor %}
+  {% empty %}
+ 
+    <tr>
+      <td colspan="6" class="text-center">No referee indications created yet.</td>
+    </tr>
 
+  {% endfor %}
 
 </table>
diff --git a/scipost_django/submissions/templates/submissions/pool/_submission_refereeing.html b/scipost_django/submissions/templates/submissions/pool/_submission_refereeing.html
index 0621793c2..f8aa914e2 100644
--- a/scipost_django/submissions/templates/submissions/pool/_submission_refereeing.html
+++ b/scipost_django/submissions/templates/submissions/pool/_submission_refereeing.html
@@ -5,32 +5,50 @@
 {% load user_groups %}
 {% is_ed_admin request.user as is_ed_admin %}
 
-{% if submission.thread_full.first.publication and submission.thread_full.first.publication.is_published %}
-  <h4 class="my-4">
-    <span class="border border-2 border-success p-2">
-      Published as
-      <a href="{{ submission.thread_full.first.publication.get_absolute_url }}">
-        {{ submission.thread_full.first.publication.citation }}
-      </a>
-    </span>
-  </h4>
-{% endif %}
-
 <div class="row">
-  <div class="col-12 col-md-6">
+
+  {% if submission.thread_full.first.publication and submission.thread_full.first.publication.is_published %}
+    <div class="col-12">
+      <h4 class="my-4">
+        <span class="border border-2 border-success p-2">
+          Published as
+          <a href="{{ submission.thread_full.first.publication.get_absolute_url }}">
+            {{ submission.thread_full.first.publication.citation }}
+          </a>
+        </span>
+      </h4>
+    </div>
+  {% endif %}
+
+  {% if submission.referee_indications.all %}
+    <div class="col-12">
+      <h4>Refereeing indications</h4>
+      <div hx-get="{% url "submissions:_hx_referee_indication_table" identifier_w_vn_nr=submission.preprint.identifier_w_vn_nr %}"
+           hx-trigger="load once, referee-indications-updated from:body delay:1s"></div>
+    </div>
+  {% endif %}
+
+  <div class="col-12 col-md-6 d-flex flex-column gap-2">
     <div>{% include "submissions/pool/_submission_recommendation_card.html" %}</div>
-    <div class="mt-4">{% include "submissions/pool/_submission_refereeing_history_card.html" %}</div>
+    <div>{% include "submissions/pool/_submission_refereeing_history_card.html" %}</div>
   </div>
 
   <div class="col-12 col-md d-flex flex-column">
 
-    {% if is_ed_admin and submission.editor_in_charge %}
-      <h4>Editor in Charge potential conflicts of interest</h4>
-      <div class="overflow-scroll" style="max-height: 50vh">
-        {% with submission.editor_in_charge.conflict_of_interests.non_deprecated|filter_for_submission:submission as conflicts %}
-          {% include 'submissions/admin/_conflicts.html' with conflicts=conflicts %}
-        {% endwith %}
-      </div>
+    <h4>EIC conflicts of interest</h4>
+
+    {% if is_ed_admin %}
+
+      {% if submission.editor_in_charge %}
+        <div class="overflow-scroll" style="max-height: 50vh">
+          {% with submission.editor_in_charge.conflict_of_interests.non_deprecated|filter_for_submission:submission as conflicts %}
+            {% include 'submissions/admin/_conflicts.html' with conflicts=conflicts %}
+          {% endwith %}
+        </div>
+      {% else %}
+        <p>No editor in charge assigned yet.</p>
+      {% endif %}
+
     {% endif %}
 
     <a class="mt-auto"
-- 
GitLab