|
Lines 72-138
Link Here
|
| 72 |
OPACTableColExpandedByDefault: [% Koha.Preference('OPACTableColExpandedByDefault') ? 1 : 0 | html %], |
72 |
OPACTableColExpandedByDefault: [% Koha.Preference('OPACTableColExpandedByDefault') ? 1 : 0 | html %], |
| 73 |
}); |
73 |
}); |
| 74 |
</script> |
74 |
</script> |
| 75 |
|
|
|
| 76 |
<script> |
75 |
<script> |
| 77 |
function loadEnrollmentForm( id ) { |
76 |
function loadEnrollmentForm(id) { |
| 78 |
$("body").css("cursor", "progress"); |
77 |
$("body").css("cursor", "progress"); |
| 79 |
$('#opac-user-clubs_panel').load('/cgi-bin/koha/clubs/enroll.pl?borrowernumber=' + patron_id + '&id=' + id, function() { |
78 |
$("#opac-user-clubs_panel").load("/cgi-bin/koha/clubs/enroll.pl?borrowernumber=" + patron_id + "&id=" + id, function () { |
| 80 |
$("body").css("cursor", "default"); |
79 |
$("body").css("cursor", "default"); |
| 81 |
}); |
80 |
}); |
| 82 |
|
81 |
|
| 83 |
return false; |
82 |
return false; |
| 84 |
} |
83 |
} |
| 85 |
|
84 |
|
| 86 |
function cancelEnrollment( id ) { |
85 |
function cancelEnrollment(id) { |
| 87 |
$("body").css("cursor", "progress"); |
86 |
$("body").css("cursor", "progress"); |
| 88 |
$.ajax({ |
87 |
$.ajax({ |
| 89 |
type: "POST", |
88 |
type: "POST", |
| 90 |
url: '/cgi-bin/koha/svc/club/cancel_enrollment', |
89 |
url: "/cgi-bin/koha/svc/club/cancel_enrollment", |
| 91 |
data: { id: id, csrf_token: $('meta[name="csrf-token"]').attr('content'), }, |
90 |
data: { id: id, csrf_token: $('meta[name="csrf-token"]').attr("content") }, |
| 92 |
success: function( data ) { |
91 |
success: function (data) { |
| 93 |
if ( data.success ) { |
92 |
if (data.success) { |
| 94 |
$('#opac-user-clubs_panel').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=' + patron_id, function() { |
93 |
$("#opac-user-clubs_panel").load("/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=" + patron_id, function () { |
| 95 |
$("body").css("cursor", "default"); |
94 |
$("body").css("cursor", "default"); |
| 96 |
}); |
95 |
}); |
| 97 |
} else { |
96 |
} else { |
| 98 |
alert(_("Unable to cancel enrollment!")); |
97 |
alert(_("Unable to cancel enrollment!")); |
| 99 |
} |
98 |
} |
| 100 |
}, |
99 |
}, |
| 101 |
dataType: 'json' |
100 |
dataType: "json", |
| 102 |
}); |
101 |
}); |
| 103 |
return false; |
102 |
return false; |
| 104 |
} |
103 |
} |
| 105 |
|
104 |
|
| 106 |
var responsive_display = prefs.OPACTableColExpandedByDefault ? DataTable.Responsive.display.childRowImmediate : DataTable.Responsive.display.childRow; |
105 |
var responsive_display = prefs.OPACTableColExpandedByDefault ? DataTable.Responsive.display.childRowImmediate : DataTable.Responsive.display.childRow; |
| 107 |
|
106 |
|
| 108 |
var Tables = $("#clubs-table-enrolled,#clubs-table-unenrolled"); |
107 |
var Tables = $("#clubs-table-enrolled,#clubs-table-unenrolled"); |
| 109 |
Tables.each(function(){ |
108 |
Tables.each(function () { |
| 110 |
$(this).kohaTable({ |
109 |
$(this).kohaTable({ |
| 111 |
searching: false, |
110 |
searching: false, |
| 112 |
paging: false, |
111 |
paging: false, |
| 113 |
info: false, |
112 |
info: false, |
| 114 |
responsive: { |
113 |
responsive: { |
| 115 |
details: { |
114 |
details: { |
| 116 |
display: responsive_display, |
115 |
display: responsive_display, |
| 117 |
type: "column", |
116 |
type: "column", |
| 118 |
target: -1 |
117 |
target: -1, |
| 119 |
}, |
|
|
| 120 |
}, |
118 |
}, |
| 121 |
columnDefs: [ |
119 |
}, |
| 122 |
{ className: "dtr-control", orderable: false, targets: -1 }, |
120 |
columnDefs: [{ className: "dtr-control", orderable: false, targets: -1 }], |
| 123 |
], |
|
|
| 124 |
}); |
| 125 |
}); |
121 |
}); |
|
|
122 |
}); |
| 126 |
|
123 |
|
| 127 |
$(".cancel_enrollment").on("click", function(e){ |
124 |
$(".cancel_enrollment").on("click", function (e) { |
| 128 |
e.preventDefault(); |
125 |
e.preventDefault(); |
| 129 |
let clubid = $(this).data("id"); |
126 |
let clubid = $(this).data("id"); |
| 130 |
cancelEnrollment( clubid ); |
127 |
cancelEnrollment(clubid); |
| 131 |
}); |
128 |
}); |
| 132 |
|
129 |
|
| 133 |
$(".load_enrollment").on("click", function(e){ |
130 |
$(".load_enrollment").on("click", function (e) { |
| 134 |
e.preventDefault(); |
131 |
e.preventDefault(); |
| 135 |
let clubid = $(this).data("id"); |
132 |
let clubid = $(this).data("id"); |
| 136 |
loadEnrollmentForm( clubid ); |
133 |
loadEnrollmentForm(clubid); |
| 137 |
}); |
134 |
}); |
| 138 |
</script> |
135 |
</script> |
| 139 |
- |
|
|