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