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 256-275 $(document).ready(function() { Link Here
256
                        "data": function( oObj ) {
256
                        "data": function( oObj ) {
257
                            holds[oObj.reserve_id] = oObj; //Store holds for later use
257
                            holds[oObj.reserve_id] = oObj; //Store holds for later use
258
258
259
                            if ( oObj.found ) {
259
                                if (oObj.found) {
260
                                return "";
260
                                    return "";
261
                            } else if ( oObj.suspend == 1 ) {
261
                                } else if (oObj.suspend == 1) {
262
                                return "<a class='hold-resume btn btn-default btn-xs' data-hold-id='" + oObj.reserve_id + "'>"
262
                                    return (
263
                                     +"<i class='fa fa-play'></i> " + __("Resume") + "</a>";
263
                                        "<a class='hold-resume btn btn-default btn-xs' data-hold-id='" +
264
                            } else {
264
                                        oObj.reserve_id +
265
                                return "<a class='hold-suspend btn btn-default btn-xs' data-hold-id='" + oObj.reserve_id + "' data-hold-title='"+ oObj.title +"'>"
265
                                        "'>" +
266
                                     +"<i class='fa fa-pause'></i> " + __("Suspend") + "</a>";
266
                                        "<i class='fa fa-play'></i> " +
267
                            }
267
                                        __("Resume") +
268
                        }
268
                                        "</a>"
269
                    },
269
                                    );
270
                    {
270
                                } else {
271
                        "data": function( oObj ) {
271
                                    const link = Object.assign(
272
                            var data = "";
272
                                        document.createElement("a"),
273
                                        {
274
                                            className:
275
                                                "hold-suspend btn btn-default btn-xs",
276
                                            textContent: " " + __("Suspend"),
277
                                        }
278
                                    );
279
                                    link.setAttribute(
280
                                        "data-hold-id",
281
                                        oObj.reserve_id
282
                                    );
283
                                    link.setAttribute(
284
                                        "data-hold-title",
285
                                        oObj.title
286
                                    );
287
                                    const icon = Object.assign(
288
                                        document.createElement("i"),
289
                                        {
290
                                            className: "fa fa-pause",
291
                                        }
292
                                    );
293
                                    link.prepend(icon);
294
                                    return link.outerHTML;
295
                                }
296
                            },
297
                        },
298
                        {
299
                            data: function (oObj) {
300
                                var data = "";
273
301
274
                            if ( oObj.suspend == 1 ) {
302
                            if ( oObj.suspend == 1 ) {
275
                                data += "<p>" + __("Hold is <strong>suspended</strong>");
303
                                data += "<p>" + __("Hold is <strong>suspended</strong>");
Lines 330-342 $(document).ready(function() { Link Here
330
                },
358
                },
331
            }, table_settings_holds_table );
359
            }, table_settings_holds_table );
332
360
333
            $('#holds-table').on( 'draw.dt', function () {
361
            $("#holds-table").on("draw.dt", function () {
334
                $(".hold-suspend").on( "click", function() {
362
                $(".hold-suspend").on("click", function () {
335
                    var hold_id    = $(this).data('hold-id');
363
                    var hold_id = $(this).data("hold-id");
336
                    var hold_title = $(this).data('hold-title');
364
                    var hold_title = $(this).data("hold-title");
337
                    $("#suspend-modal-title").html( hold_title );
365
                    $("#suspend-modal-title").text(hold_title);
338
                    $("#suspend-modal-submit").data( 'hold-id', hold_id );
366
                    $("#suspend-modal-submit").data("hold-id", hold_id);
339
                    $('#suspend-modal').modal('show');
367
                    $("#suspend-modal").modal("show");
340
                });
368
                });
341
369
342
                $(".hold-resume").on("click", function () {
370
                $(".hold-resume").on("click", function () {
343
- 

Return to bug 40538