1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| $(document).ready(function () {
function GetURLParameter(sParam) {
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split("&");
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split("=");
if (sParameterName[0] == sParam) {
return sParameterName[1];
}
}
}
if (borrowernumber) {
var pathname = window.location.pathname;
if (pathname.search(/opac-detail.pl/)) {
$("#item_holds").after("<th class='sorting-disable' rowspan='1' colspan='1'>Action</th>");
$("td.call_no > a").each(function (index) {
$(this).parent().first().nextAll().last().after("<td></td>");
var href = $(this).attr("href");
var regex = /itemnumber=([0-9]+)#holdings/;
var match = regex.exec(href);
var itemnumber = match[1];
var target_cell = $(this).parent().first().nextAll().last();
var id = "dialog-" + itemnumber;
var biblionumber = GetURLParameter("biblionumber");
$.getJSON("/api/v1/contrib/iwt/item/" + itemnumber + "/opac-info", function (iwantthis) {
var button = "";
if ("geturlopac" in iwantthis) {
var requestdialogid = "requestdialog" + itemnumber;
button = "<a class='btn btn-primary' href='" + iwantthis.geturlopac + "'><i class='fa fa-book'></i> Demander le document</a>";
}
button += "<button type='button' class='btn btn-secondary' data-dismiss='modal'>Fermer</button>";
var modaldialog = "<div class='modal fade' id='" + id + "' tabindex='-1' role='dialog' aria-labelledby='modal" + id + "' aria-hidden='true'>";
modaldialog += "<div class='modal-dialog' role='document'>";
modaldialog += "<div class='modal-content'>";
modaldialog += "<div class='modal-head'>";
modaldialog += "<h5 class='modal-title'>Comment obtenir ce document</h5>";
modaldialog += "</div>";
modaldialog += "<div class='modal-body'>";
modaldialog += "<p>" + iwantthis.message + "</p>";
modaldialog += button;
modaldialog += "</div></div></div></div>";
$(target_cell).append("<a class='btn btn-default btn-xs' data-toggle='modal' data-target='#" + id + "' title='Obtenir'><i class='fa fa-hand-o-left'></i> Obtenir</a>" + modaldialog);
if (myLocation.match("Magasin")) {
$(target_cell).append("<a class='btn btn-default btn-xs' id='mybtn' title='Plop'><i class='fa fa-hand-o-left'></i> Plop</a>" + modaldialog);
}
$("#mybtn").click(function () {
var biblionumber = GetURLParameter("biblionumber");
alert("requete envoyé: " + biblionumber);
$.getJSON("/api/v1//contrib/wrm/request?biblionumber=" + biblionumber + "&type=plop&itemnumber=" + itemnumber + "&branchcode=IEP", function (request) {});
});
});
});
} else if (pathname.search(/opac-stack-request.pl/)) {
$.getJSON("/api/v1/contrib/wrm/opac-request?biblionumber=[% biblionumber %]&itemnumber=[%itemnumber %]&branchcode=IEP", function (request) {
if (request.state == "success") {
$("modaltitle").append("Le document est bien réservé pour vous");
$("modalmessage").append("Vous pourrez aller le chercher bientôt à la banque");
} else {
$("modaltitle").append("Une erreur s'est produite :");
$("modalmessage").append("Erreur :" + request.error + "<br/>Vous pouvez vous adresser à la banque de la bibliothèque pour régler ce problème.");
}
$("#dialogresult").modal({ show: true });
});
}
} else {
var pathname = window.location.pathname;
if (pathname.search(/opac-detail.pl/)) {
if (biblionumber) {
$("#has-search-query").val("q=sn:" + biblionumber);
}
$("#item_holds").after("<th class='sorting-disable' rowspan='1' colspan='1'>Action</th>");
$("td.call_no > a").each(function (index) {
$(this).parent().first().nextAll().last().after("<td><a class='btn btn-default btn-xs' data-toggle='modal' data-target='#loginModal' title='Obtenir'><i class='fa fa-hand-o-left'></i> Obtenir</a></td>");
});
}
}
}); |
Partager