Bug 41569: clubs - auto tidy
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
940d1eea6d
commit
aac1aaacc9
|
|
@ -61,7 +61,6 @@
|
|||
<script>
|
||||
const borrowernumber = "[% borrowernumber | html %]";
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var clubs_dt_params = {
|
||||
paging: true,
|
||||
|
|
@ -69,37 +68,36 @@
|
|||
$("#table_clubnoenrollmemnts").kohaTable(clubs_dt_params);
|
||||
$("#table_clubenrollments").kohaTable(clubs_dt_params);
|
||||
</script>
|
||||
|
||||
[% IF CAN_user_clubs_enroll %]
|
||||
<script>
|
||||
function loadEnrollmentForm( id, enrollent_id = 0 ) {
|
||||
$("body").css("cursor", "progress");
|
||||
$('#clubs_panel').load('/cgi-bin/koha/clubs/patron-enroll.pl?borrowernumber=" + borrowernumber + " &id=' + id +'&enrollent_id='+ enrollent_id, function() {
|
||||
$("body").css("cursor", "default");
|
||||
});
|
||||
<script>
|
||||
function loadEnrollmentForm(id, enrollent_id = 0) {
|
||||
$("body").css("cursor", "progress");
|
||||
$("#clubs_panel").load('/cgi-bin/koha/clubs/patron-enroll.pl?borrowernumber=" + borrowernumber + " &id=' + id + "&enrollent_id=" + enrollent_id, function () {
|
||||
$("body").css("cursor", "default");
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function cancelEnrollment( id ) {
|
||||
$("body").css("cursor", "progress");
|
||||
const client = APIClient.club;
|
||||
client.enrollments.cancel(id).then(
|
||||
success => {
|
||||
if ( success.success ) {
|
||||
$('#clubs_panel').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=" + borrowernumber + "', function() {
|
||||
$("body").css("cursor", "default");
|
||||
});
|
||||
} else {
|
||||
function cancelEnrollment(id) {
|
||||
$("body").css("cursor", "progress");
|
||||
const client = APIClient.club;
|
||||
client.enrollments.cancel(id).then(
|
||||
success => {
|
||||
if (success.success) {
|
||||
$("#clubs_panel").load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=" + borrowernumber + "', function () {
|
||||
$("body").css("cursor", "default");
|
||||
});
|
||||
} else {
|
||||
alert(_("Unable to cancel enrollment!"));
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.warn("Something wrong happened: %s".format(error));
|
||||
alert(_("Unable to cancel enrollment!"));
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.warn("Something wrong happened: %s".format(error));
|
||||
alert(_("Unable to cancel enrollment!"));
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -72,67 +72,64 @@
|
|||
OPACTableColExpandedByDefault: [% Koha.Preference('OPACTableColExpandedByDefault') ? 1 : 0 | html %],
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function loadEnrollmentForm( id ) {
|
||||
function loadEnrollmentForm(id) {
|
||||
$("body").css("cursor", "progress");
|
||||
$('#opac-user-clubs_panel').load('/cgi-bin/koha/clubs/enroll.pl?borrowernumber=' + patron_id + '&id=' + id, function() {
|
||||
$("#opac-user-clubs_panel").load("/cgi-bin/koha/clubs/enroll.pl?borrowernumber=" + patron_id + "&id=" + id, function () {
|
||||
$("body").css("cursor", "default");
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function cancelEnrollment( id ) {
|
||||
function cancelEnrollment(id) {
|
||||
$("body").css("cursor", "progress");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/cgi-bin/koha/svc/club/cancel_enrollment',
|
||||
data: { id: id, csrf_token: $('meta[name="csrf-token"]').attr('content'), },
|
||||
success: function( data ) {
|
||||
if ( data.success ) {
|
||||
$('#opac-user-clubs_panel').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=' + patron_id, function() {
|
||||
url: "/cgi-bin/koha/svc/club/cancel_enrollment",
|
||||
data: { id: id, csrf_token: $('meta[name="csrf-token"]').attr("content") },
|
||||
success: function (data) {
|
||||
if (data.success) {
|
||||
$("#opac-user-clubs_panel").load("/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=" + patron_id, function () {
|
||||
$("body").css("cursor", "default");
|
||||
});
|
||||
} else {
|
||||
alert(_("Unable to cancel enrollment!"));
|
||||
}
|
||||
},
|
||||
dataType: 'json'
|
||||
dataType: "json",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
var responsive_display = prefs.OPACTableColExpandedByDefault ? DataTable.Responsive.display.childRowImmediate : DataTable.Responsive.display.childRow;
|
||||
|
||||
var Tables = $("#clubs-table-enrolled,#clubs-table-unenrolled");
|
||||
Tables.each(function(){
|
||||
$(this).kohaTable({
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
responsive: {
|
||||
details: {
|
||||
display: responsive_display,
|
||||
type: "column",
|
||||
target: -1
|
||||
},
|
||||
var Tables = $("#clubs-table-enrolled,#clubs-table-unenrolled");
|
||||
Tables.each(function () {
|
||||
$(this).kohaTable({
|
||||
searching: false,
|
||||
paging: false,
|
||||
info: false,
|
||||
responsive: {
|
||||
details: {
|
||||
display: responsive_display,
|
||||
type: "column",
|
||||
target: -1,
|
||||
},
|
||||
columnDefs: [
|
||||
{ className: "dtr-control", orderable: false, targets: -1 },
|
||||
],
|
||||
});
|
||||
},
|
||||
columnDefs: [{ className: "dtr-control", orderable: false, targets: -1 }],
|
||||
});
|
||||
});
|
||||
|
||||
$(".cancel_enrollment").on("click", function(e){
|
||||
e.preventDefault();
|
||||
let clubid = $(this).data("id");
|
||||
cancelEnrollment( clubid );
|
||||
});
|
||||
$(".cancel_enrollment").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
let clubid = $(this).data("id");
|
||||
cancelEnrollment(clubid);
|
||||
});
|
||||
|
||||
$(".load_enrollment").on("click", function(e){
|
||||
e.preventDefault();
|
||||
let clubid = $(this).data("id");
|
||||
loadEnrollmentForm( clubid );
|
||||
});
|
||||
$(".load_enrollment").on("click", function (e) {
|
||||
e.preventDefault();
|
||||
let clubid = $(this).data("id");
|
||||
loadEnrollmentForm(clubid);
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue