View | Details | Raw Unified | Return to bug 36084
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (+4 lines)
Lines 29-34 Link Here
29
[% Asset.css("css/print.css", { media = "print" }) | $raw %]
29
[% Asset.css("css/print.css", { media = "print" }) | $raw %]
30
[% INCLUDE intranetstylesheet.inc %]
30
[% INCLUDE intranetstylesheet.inc %]
31
[% IF ( bidi ) %][% Asset.css("css/right-to-left.css") | $raw %][% END %]
31
[% IF ( bidi ) %][% Asset.css("css/right-to-left.css") | $raw %][% END %]
32
<script type="module">
33
    import { APIClient } from '/intranet-tmpl/prog/js/fetch/api-client.js';
34
    window.APIClient = APIClient;
35
</script>
32
36
33
<script>
37
<script>
34
var Koha = {};
38
var Koha = {};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt (-5 lines)
Lines 689-699 Link Here
689
            HandleMulti(Cancel, $(this).data('ar-id'), $(this));
689
            HandleMulti(Cancel, $(this).data('ar-id'), $(this));
690
        });
690
        });
691
691
692
    </script>
693
694
    <script async type="module">
695
        import { APIClient } from '/intranet-tmpl/prog/js/fetch/api-client.js';
696
697
        async function Process( id, a ) {
692
        async function Process( id, a ) {
698
            var table_row = a.closest('tr');
693
            var table_row = a.closest('tr');
699
            var table = a.closest('table');
694
            var table = a.closest('table');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt (-3 lines)
Lines 415-424 Link Here
415
                $('#format option[value="'+first_format+'"]').attr('selected', true);
415
                $('#format option[value="'+first_format+'"]').attr('selected', true);
416
            }
416
            }
417
        });
417
        });
418
    </script>
419
418
420
    <script async type="module">
421
        import { APIClient } from '/intranet-tmpl/prog/js/fetch/api-client.js';
422
        $(".ar-update-branchcode").on('change', async function(e){
419
        $(".ar-update-branchcode").on('change', async function(e){
423
            var branchcode = this.value;
420
            var branchcode = this.value;
424
            var c = confirm(_("Are you sure you want to change the pickup library from %s to %s for this request?").format( previous_branchcode, branchcode ));
421
            var c = confirm(_("Are you sure you want to change the pickup library from %s to %s for this request?").format( previous_branchcode, branchcode ));
(-)a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js (-12 / +6 lines)
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
    });
(-)a/koha-tmpl/intranet-tmpl/prog/js/fetch/api-client.js (-1 / +2 lines)
Lines 1-5 Link Here
1
import ArticleRequestAPIClient from "./article-request-api-client.js";
1
import ArticleRequestAPIClient from "./article-request-api-client.js";
2
import AVAPIClient from "./authorised-value-api-client.js";
2
3
3
export const APIClient = {
4
export const APIClient = {
4
    article_request: new ArticleRequestAPIClient(),
5
    article_request: new ArticleRequestAPIClient(),
6
    authorised_value: new AVAPIClient(),
5
};
7
};
6
- 

Return to bug 36084