Lines 126-166
$(document).ready(function() {
Link Here
|
126 |
|
126 |
|
127 |
$("#populate-callnumbers-biblio") |
127 |
$("#populate-callnumbers-biblio") |
128 |
.on('click', function() { |
128 |
.on('click', function() { |
129 |
if ( confirm(__('Are you sure you want to populate callnumbers for all items without a callnumber on this record?')) ) { |
129 |
$.getJSON( `/api/v1/biblios/${biblionumber}/default_item_callnumber`, function( cn ) { |
130 |
const biblionumber = $(this).data('biblionumber'); |
130 |
const callnumber = cn.callnumber; |
131 |
$.post( `/api/v1/biblios/${biblionumber}/items/populate_empty_callnumbers`, function( data ) { |
131 |
if ( confirm(__(`Are you sure you want to populate callnumbers for all items without a callnumber on this record to the following value: ${callnumber}`)) ) { |
132 |
const items_updated = data.items_updated; |
132 |
const biblionumber = $(this).data('biblionumber'); |
133 |
const callnumber = data.callnumber; |
133 |
$.post( `/api/v1/biblios/${biblionumber}/items/populate_empty_callnumbers`, function( data ) { |
134 |
let msg = __('Items populated with the callnumber "%s": %s').format(callnumber, items_updated); |
134 |
const items_updated = data.items_updated; |
135 |
|
135 |
const callnumber = data.callnumber; |
136 |
if ( items_updated ) { |
136 |
let msg = __('Items populated with the callnumber "%s": %s').format(callnumber, items_updated); |
137 |
msg += __('\nReload the page?'); |
137 |
|
138 |
if( confirm(msg) ) { |
138 |
if ( items_updated ) { |
139 |
location.reload(true); |
139 |
msg += " " + __('Reload the page?'); |
|
|
140 |
if( confirm(msg) ) { |
141 |
location.reload(true); |
142 |
} |
143 |
} else { |
144 |
alert(msg); |
140 |
} |
145 |
} |
141 |
} else { |
146 |
}); |
142 |
alert(msg); |
147 |
} |
143 |
} |
148 |
}); |
144 |
}); |
|
|
145 |
} |
146 |
}).tooltip(); |
149 |
}).tooltip(); |
147 |
|
150 |
|
148 |
$(".populate-callnumber-item") |
151 |
$(".populate-callnumber-item") |
149 |
.on('click', function() { |
152 |
.on('click', function() { |
150 |
if ( confirm(__('Are you sure you want to populate the callnumber for this item?')) ) { |
153 |
$.getJSON( `/api/v1/biblios/${biblionumber}/default_item_callnumber`, function( cn ) { |
151 |
const biblionumber = $(this).data('biblionumber'); |
154 |
const callnumber = cn.callnumber; |
152 |
const itemnumber = $(this).data('itemnumber'); |
155 |
if ( confirm(__(`Are you sure you want to populate the callnumber for this item to the following value: ${callnumber}`)) ) { |
153 |
const button = $(this); |
156 |
const biblionumber = $(this).data('biblionumber'); |
154 |
$.post( `/api/v1/biblios/${biblionumber}/items/${itemnumber}/populate_empty_callnumbers`, function( data ) { |
157 |
const itemnumber = $(this).data('itemnumber'); |
155 |
const callnumber = data.callnumber; |
158 |
const button = $(this); |
156 |
let msg = __('Item populated with the callnumber "%s"\nReload the page?').format(callnumber); |
159 |
$.post( `/api/v1/biblios/${biblionumber}/items/${itemnumber}/populate_empty_callnumbers`, function( data ) { |
157 |
if( confirm(msg) ) { |
160 |
const callnumber = data.callnumber; |
158 |
location.reload(true); |
161 |
let msg = __('Item populated with the callnumber "%s"').format(callnumber); |
159 |
} else { |
162 |
msg += " " + __('Reload the page?'); |
160 |
button.hide(); |
163 |
if( confirm(msg) ) { |
161 |
} |
164 |
location.reload(true); |
162 |
}); |
165 |
} else { |
163 |
} |
166 |
button.hide(); |
|
|
167 |
} |
168 |
}); |
169 |
} |
170 |
}); |
164 |
}).tooltip(); |
171 |
}).tooltip(); |
165 |
|
172 |
|
166 |
$(".addtolist").on("click", function (e) { |
173 |
$(".addtolist").on("click", function (e) { |