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