From cb415649177c1485d3d54c36da42bd3b319c19ed Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Fri, 16 Jun 2023 13:47:40 +0200
Subject: [PATCH] Bug 34030: non-table view

Sponsored-by: BULAC - http://www.bulac.fr/
---
 .../components/Preservation/TrainsShow.vue    | 35 ++++++++++++++-----
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue
index fe34e4c8452..455f14eadc6 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue
+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue
@@ -176,6 +176,12 @@
                         v-for="(item, counter) in train.items"
                         v-bind:key="counter"
                     >
+                        <input
+                            v-model="selected_items"
+                            type="checkbox"
+                            name="user_train_item_id"
+                            :value="item.train_item_id"
+                        />
                         <label
                             >{{ item.user_train_item_id }}
                             <span class="action_links">
@@ -502,17 +508,25 @@ export default {
         },
         clearAll() {
             this.selected_items = []
-            $("#" + this.table_id)
-                .find("input[name='user_train_item_id'][type='checkbox']")
-                .prop("checked", false)
+            if (this.item_table.display) {
+                $("#" + this.table_id)
+                    .find("input[name='user_train_item_id'][type='checkbox']")
+                    .prop("checked", false)
+            }
         },
         selectAll() {
-            $("#" + this.table_id)
-                .find("input[name='user_train_item_id'][type='checkbox']")
-                .each((i, input) => {
-                    this.selected_items.push($(input).val())
-                    $(input).prop("checked", true)
-                })
+            if (this.item_table.display) {
+                $("#" + this.table_id)
+                    .find("input[name='user_train_item_id'][type='checkbox']")
+                    .each((i, input) => {
+                        this.selected_items.push($(input).val())
+                        $(input).prop("checked", true)
+                    })
+            } else {
+                this.selected_items = this.train.items.map(
+                    item => item.train_item_id
+                )
+            }
         },
         printSelected() {
             window.open(
@@ -698,4 +712,7 @@ export default {
     box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
     transition: all 0.3s ease;
 }
+input[type="checkbox"] {
+    float: left;
+}
 </style>
-- 
2.25.1