View | Details | Raw Unified | Return to bug 40538
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/holds.js (-22 / +49 lines)
Lines 251-270 $(document).ready(function() { Link Here
251
                        "mDataProp": function( oObj ) {
251
                        "mDataProp": function( oObj ) {
252
                            holds[oObj.reserve_id] = oObj; //Store holds for later use
252
                            holds[oObj.reserve_id] = oObj; //Store holds for later use
253
253
254
                            if ( oObj.found ) {
254
                                if (oObj.found) {
255
                                return "";
255
                                    return "";
256
                            } else if ( oObj.suspend == 1 ) {
256
                                } else if (oObj.suspend == 1) {
257
                                return "<a class='hold-resume btn btn-default btn-xs' data-hold-id='" + oObj.reserve_id + "'>"
257
                                    return (
258
                                     +"<i class='fa fa-play'></i> " + __("Resume") + "</a>";
258
                                        "<a class='hold-resume btn btn-default btn-xs' data-hold-id='" +
259
                            } else {
259
                                        oObj.reserve_id +
260
                                return "<a class='hold-suspend btn btn-default btn-xs' data-hold-id='" + oObj.reserve_id + "' data-hold-title='"+ oObj.title +"'>"
260
                                        "'>" +
261
                                     +"<i class='fa fa-pause'></i> " + __("Suspend") + "</a>";
261
                                        "<i class='fa fa-play'></i> " +
262
                            }
262
                                        __("Resume") +
263
                        }
263
                                        "</a>"
264
                    },
264
                                    );
265
                    {
265
                                } else {
266
                        "mDataProp": function( oObj ) {
266
                                    const link = Object.assign(
267
                            var data = "";
267
                                        document.createElement("a"),
268
                                        {
269
                                            className:
270
                                                "hold-suspend btn btn-default btn-xs",
271
                                            textContent: " " + __("Suspend"),
272
                                        }
273
                                    );
274
                                    link.setAttribute(
275
                                        "data-hold-id",
276
                                        oObj.reserve_id
277
                                    );
278
                                    link.setAttribute(
279
                                        "data-hold-title",
280
                                        oObj.title
281
                                    );
282
                                    const icon = Object.assign(
283
                                        document.createElement("i"),
284
                                        {
285
                                            className: "fa fa-pause",
286
                                        }
287
                                    );
288
                                    link.prepend(icon);
289
                                    return link.outerHTML;
290
                                }
291
                            },
292
                        },
293
                        {
294
                            data: function (oObj) {
295
                                var data = "";
268
296
269
                            if ( oObj.suspend == 1 ) {
297
                            if ( oObj.suspend == 1 ) {
270
                                data += "<p>" + __("Hold is <strong>suspended</strong>");
298
                                data += "<p>" + __("Hold is <strong>suspended</strong>");
Lines 322-334 $(document).ready(function() { Link Here
322
                },
350
                },
323
            }));
351
            }));
324
352
325
            $('#holds-table').on( 'draw.dt', function () {
353
            $("#holds-table").on("draw.dt", function () {
326
                $(".hold-suspend").on( "click", function() {
354
                $(".hold-suspend").on("click", function () {
327
                    var hold_id    = $(this).data('hold-id');
355
                    var hold_id = $(this).data("hold-id");
328
                    var hold_title = $(this).data('hold-title');
356
                    var hold_title = $(this).data("hold-title");
329
                    $("#suspend-modal-title").html( hold_title );
357
                    $("#suspend-modal-title").text(hold_title);
330
                    $("#suspend-modal-submit").data( 'hold-id', hold_id );
358
                    $("#suspend-modal-submit").data("hold-id", hold_id);
331
                    $('#suspend-modal').modal('show');
359
                    $("#suspend-modal").modal("show");
332
                });
360
                });
333
361
334
                $(".hold-resume").on("click", function () {
362
                $(".hold-resume").on("click", function () {
335
- 

Return to bug 40538