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