|
Lines 625-648
$(document).ready(function() {
Link Here
|
| 625 |
var description = form.description.value; |
625 |
var description = form.description.value; |
| 626 |
var opac_description = form.opac_description.value; |
626 |
var opac_description = form.opac_description.value; |
| 627 |
|
627 |
|
| 628 |
var data = "category="+encodeURIComponent(category) |
628 |
const client = APIClient.authorised_value; |
| 629 |
+"&value="+encodeURIComponent(value) |
629 |
client.values.post({category, value, description, opac_description}).then( |
| 630 |
+"&description="+encodeURIComponent(description) |
630 |
success => { |
| 631 |
+"&opac_description="+encodeURIComponent(opac_description); |
|
|
| 632 |
$.ajax({ |
| 633 |
type: "POST", |
| 634 |
url: "/cgi-bin/koha/svc/authorised_values", |
| 635 |
data: data, |
| 636 |
success: function(response) { |
| 637 |
$('#avCreate').modal('hide'); |
631 |
$('#avCreate').modal('hide'); |
| 638 |
|
632 |
|
| 639 |
$(current_select2).append('<option selected value="'+response.value+'">'+response.description+'</option>'); |
633 |
$(current_select2).append('<option selected value="'+success.value+'">'+success.description+'</option>'); |
| 640 |
$("#avCreate").modal("hide"); |
634 |
$("#avCreate").modal("hide"); |
| 641 |
}, |
635 |
}, |
| 642 |
error: function() { |
636 |
error => { |
| 643 |
$(".avCreate_error").html(__("Something went wrong. Maybe the value already exists?")).show(); |
637 |
$(".avCreate_error").html(__("Something went wrong. Maybe the value already exists?")).show(); |
| 644 |
} |
638 |
} |
| 645 |
}); |
639 |
); |
| 646 |
return false; |
640 |
return false; |
| 647 |
} |
641 |
} |
| 648 |
}); |
642 |
}); |