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