Bug 34571: Remove use of "onclick" for ExpandField in cataloguing editors
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / moveitem.tt
1 [% USE raw %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Attach an item to [% INCLUDE 'biblio-title-head.inc' %] &rsaquo; Cataloging &rsaquo; Koha</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 </head>
7 <body id="catalog_moveitem" class="catalog">
8 [% WRAPPER 'header.inc' %]
9     [% INCLUDE 'cat-search.inc' %]
10 [% END %]
11
12 [% WRAPPER 'sub-header.inc' %]
13     [% WRAPPER breadcrumbs %]
14         [% WRAPPER breadcrumb_item %]
15             <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
16         [% END %]
17         [% WRAPPER breadcrumb_item %]
18             [% INCLUDE 'biblio-title.inc' link = 1 %]
19         [% END %]
20         [% WRAPPER breadcrumb_item bc_active= 1 %]
21             <span>Attach an item</span>
22         [% END %]
23     [% END #/ WRAPPER breadcrumbs %]
24 [% END #/ WRAPPER sub-header.inc %]
25
26 <div class="main container-fluid">
27     <div class="row">
28         <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
29
30         <h1>Attach an item [% IF ( biblio.title ) %] to [% INCLUDE 'biblio-title.inc' %][% END %]</h1>
31 [% BLOCK actions %]
32                         [% IF Koha.Preference('IntranetBiblioDefaultView') == 'marc' %]
33                              <form action="/cgi-bin/koha/catalogue/MARCdetail.pl" method="post">
34                         [% ELSIF Koha.Preference('IntranetBiblioDefaultView') == 'labeled_marc' %]
35                              <form action="/cgi-bin/koha/catalogue/labeledMARCdetail.pl" method="post">
36                         [% ELSIF Koha.Preference('IntranetBiblioDefaultView') == 'isbd' %]
37                              <form action="/cgi-bin/koha/catalogue/ISBDdetail.pl" method="post">
38                         [% ELSE %]
39                              <form action="/cgi-bin/koha/catalogue/detail.pl" method="post">
40                         [% END %]
41 [% END %]
42
43 [% BLOCK fail %]
44         <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
45                                 <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
46                         </form>
47                                 <form method="get" action="/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblionumber | html %]">
48         <button type="submit" class="new"><i class="fa fa-fw fa-plus"></i> Try again with a different barcode</button>
49                                 <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
50                         </form>
51 [% END %]
52
53 [% IF ( error ) %]
54     <div class="dialog alert">
55
56                 [% IF ( errornonewitem ) %]ERROR: Unable to create the new item.<p>
57                         [% INCLUDE actions %]
58                         [% INCLUDE fail %]
59         </p>
60                 [% END %]
61
62                 [% IF ( errornoitem ) %]ERROR: Unable to get the item.<p>
63                         [% INCLUDE actions %]
64                         [% INCLUDE fail %]
65                 </p>
66         [% END %]
67     </div>
68
69         [% ELSE %]
70             [% IF ( success ) %]
71             [% IF from_biblio.items.count == 0 && CAN_user_editcatalogue_edit_catalogue %]
72                 <div class="dialog alert" id="del-bib-alert">
73                     <div id="del-bib-action">
74                         The record <em><a class="title" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% from_biblio.id | html %]">[% from_biblio.title | html %]</a></em> has [% from_biblio.items.count | html %] attached items.
75                         <p><button id="delete-biblio-btn" data-biblionumber="[% from_biblio.id | html %]"><i id="del-bib-spn" class="fa fa-spinner fa-pulse fa-fw" style="display:none"></i><i class="fa fa-fw fa-trash-can"></i> Delete record
76                         </button></p>
77                     </div>
78                     <p id="del-bib-result">
79                         <span id="del-bib-success" style="display:none"><i class="fa fa-check success"></i> Record deleted</span>
80                         <span id="del-bib-failure" style="display:none"><i class="fa-solid fa-triangle-exclamation"></i> Attempt to delete record failed.</span>
81                     </p>
82                 </div>
83             [% END %]
84
85             <div class="dialog message">The item has successfully been attached to [% INCLUDE 'biblio-title.inc' link = 1 %].
86                         <p>
87                         [% INCLUDE actions %]
88                     <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
89                                 <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
90                         </form>
91                                 <form method="get" action="/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblionumber | html %]"/>
92                     <button type="submit" class="new"><i class="fa fa-fw fa-plus"></i> Attach another item</button>
93                                 <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
94                         </form>
95                         </p>
96
97                         </div>
98     [% ELSE %]
99         [% IF ( missingparameter ) %]
100         <form method="post" action="/cgi-bin/koha/cataloguing/moveitem.pl">
101             [% IF ( missingbiblionumber ) %]
102             <fieldset id="biblionumber_fieldset">
103                 <label for="biblionumber">Select the biblionumber to attach the item to</label>
104                         <div class="hint">Enter biblionumber:</div>
105                     <input type="text" name="biblionumber" id="biblionumber" class="focus" size="14" />
106             </fieldset>
107         <fieldset class="action">
108             <input type="submit" class="btn btn-primary" value="Submit" />
109         </fieldset>
110             [% ELSE %]
111             <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
112             [% END %]
113
114                 [% IF ( missingbarcode ) %]
115             <fieldset id="barcode_fieldset">
116                 <label for="barcode">Enter the barcode of the item to attach:</label>
117                     <p class="hint">The item you select will be moved to the target record.</p>
118                     <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" />
119             </fieldset>
120         <fieldset class="action">
121             <input type="submit" class="btn btn-primary" value="Submit" />
122         </fieldset>
123             [% ELSE %]
124             <input type="hidden" name="barcode" id="barcode" value="[% barcode | html %]" />
125             [% END %]
126
127         </form>
128         [% END %]
129     [% END %]
130 [% END %]
131
132     </div>
133 </div>
134
135 [% MACRO jsinclude BLOCK %]
136     <script>
137         $("#delete-biblio-btn").on("click", function(){
138             if ( confirm(_("Are you sure you want to delete this record?")) ) {
139                 $("#del-bib-spn").show();
140                 let biblionumber = $(this).data('biblionumber');
141                 $.ajax({
142                     url: '/api/v1/biblios/' + biblionumber,
143                     type: 'DELETE',
144                     success: function(result) {
145                         $("#del-bib-action").hide();
146                         $('#del-bib-success').show();
147                         $("#del-bib-alert").attr("class","dialog message")
148                     },
149                     error: function(result) {
150                         $("#delete-biblio-btn").hide();
151                         $('#del-bib-failure').show();
152                     }
153                 });
154             }
155         });
156     </script>
157 [% END %]
158
159 [% INCLUDE 'intranet-bottom.inc' %]