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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-157 / +152 lines)
Lines 1-7 Link Here
1
[% USE Asset %]
1
[% USE Asset %]
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% SET footerjs = 1 %]
5
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Koha &rsaquo; Acquisitions &rsaquo; Order staged MARC records
5
<title>Koha &rsaquo; Acquisitions &rsaquo; Order staged MARC records
7
[% IF ( batch_details ) %]
6
[% IF ( batch_details ) %]
Lines 11-18 Link Here
11
[% END %]
10
[% END %]
12
</title>
11
</title>
13
[% Asset.css("css/datatables.css") %]
12
[% Asset.css("css/datatables.css") %]
14
<style type="text/css">#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
13
<style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
15
[% INCLUDE 'doc-head-close.inc' %]
14
[% INCLUDE 'doc-head-close.inc' %]
15
[% Asset.js("js/acquisitions-menu.js") %]
16
[% INCLUDE 'datatables.inc' %]
17
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
18
[% Asset.js("js/acq.js") %]
19
<script>
20
    $(document).ready(function() {
21
        $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
22
            "aoColumnDefs": [
23
                { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
24
                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
25
                { "sType": "title-string", "aTargets" : [ "title-string" ] }
26
            ],
27
            "sPaginationType": "four_button",
28
            "aaSorting": []
29
        } ) );
30
31
        // keep copy of the inactive budgets
32
        disabledBudgetsCopy = $("select[name='all_budget_id']").html();
33
        $("select[name='all_budget_id'] .b_inactive").remove();
34
        $("select[name='budget_id'] .b_inactive").remove();
35
36
        $("#showallbudgets").click(function() {
37
            if ($(this).is(":checked")) {
38
                $("select[name='budget_id']").html(disabledBudgetsCopy)
39
            }
40
            else {
41
                $("select[name='budget_id'] .b_inactive").remove();
42
            }
43
        });
44
45
        $("#all_showallbudgets").click(function() {
46
            if ($(this).is(":checked")) {
47
                $("select[name='all_budget_id']").html(disabledBudgetsCopy);
48
            }
49
            else {
50
                $("select[name='all_budget_id'] .b_inactive").remove();
51
            }
52
        });
53
54
        $("select[name='budget_id']").change(function(){
55
            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
56
            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
57
            var destination_sort1 = $(this).parents('fieldset').find('li.sort1').find('input[name="sort1"]');
58
            var sort1 = $(destination_sort1).val() || "";
59
            if ( destination_sort1.length < 1 ) {
60
                destination_sort1 = $(this).parents('fieldset').find('li.sort1 > select[name="sort1"]');
61
            }
62
            var destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('input[name="sort2"]');
63
            var sort2 = $(destination_sort2).val() || "";
64
            if ( destination_sort2.length < 1 ) {
65
                destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('select[name="sort2"]');
66
            }
67
            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
68
69
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
70
        } );
71
72
        $("select[name='budget_id']").change();
73
74
        $("select[name='all_budget_id']").change(function(){
75
            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
76
            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
77
            var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
78
            if ( destination_sort1.length < 1 ) {
79
                destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
80
            }
81
            var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
82
            if ( destination_sort2.length < 1 ) {
83
                destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
84
            }
85
            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
86
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
87
            $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
88
            $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
89
            $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
90
            $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
91
        } );
92
93
        $("select[name='all_budget_id']").change();
94
95
        $("#records_to_import fieldset.rows div").hide();
96
        $('input:checkbox[name="import_record_id"]').change(function(){
97
            var container = $(this).parents("fieldset");
98
            if ( $(this).is(':checked') ) {
99
                $(container).addClass("selected");
100
                $(container).removeClass("unselected");
101
                $(container).find("div").toggle(true);
102
            } else {
103
                $(container).addClass("unselected");
104
                $(container).removeClass("selected");
105
                $(container).find("div").toggle(false);
106
            }
107
        } );
108
109
        $("input:checkbox").prop("checked", false);
110
        $("div.biblio.unselected select").prop('disabled', false);
111
        $("div.biblio.unselected input").prop('disabled', false);
112
113
        $("#checkAll").click(function(){
114
            $("#Aform").checkCheckboxes();
115
            $("input:checkbox[name='import_record_id']").change();
116
            return false;
117
        });
118
        $("#unCheckAll").click(function(){
119
            $("#Aform").unCheckCheckboxes();
120
            $("input:checkbox[name='import_record_id']").change();
121
            return false;
122
        });
123
124
        $("#Aform").on("submit", function(){
125
            if ( $("input:checkbox[name='import_record_id']:checked").length < 1 ) {
126
                alert(_("There is no record selected"));
127
                return false;
128
            }
129
130
            var error = 0;
131
            $("input:checkbox[name='import_record_id']:checked").parents('fieldset').find('input[name="quantity"]').each(function(){
132
                if ( $(this).val().length < 1 || isNaN( $(this).val() ) ) {
133
                    error++;
134
                }
135
            });
136
            if ( error > 0 ) {
137
                alert(error + " " + _("quantity values are not filled in or are not numbers"));
138
                return false;
139
140
            }
141
142
            return disableUnchecked($(this));
143
        });
144
        $('#tabs').tabs();
145
        $(".previewData").on("click", function(e){
146
            e.preventDefault();
147
            var ltitle = $(this).text();
148
            var page = $(this).attr("href");
149
            $("#dataPreviewLabel").text(ltitle);
150
            $("#dataPreview .modal-body").load(page + " div");
151
            $('#dataPreview').modal({show:true});
152
        });
153
        $("#dataPreview").on("hidden.bs.modal", function(){
154
            $("#dataPreviewLabel").html("");
155
            $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
156
        });
157
    });
158
159
    function disableUnchecked(form){
160
        $("fieldset.biblio.unselected").each(function(){
161
            $(this).remove();
162
        });
163
        return 1;
164
    }
165
</script>
16
</head>
166
</head>
17
167
18
<body id="acq_addorderiso2709" class="acq">
168
<body id="acq_addorderiso2709" class="acq">
Lines 425-582 Link Here
425
   </div>
575
   </div>
426
</div>
576
</div>
427
577
428
[% MACRO jsinclude BLOCK %]
429
    [% Asset.js("js/acquisitions-menu.js") %]
430
[% INCLUDE 'datatables.inc' %]
431
    [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
432
    [% Asset.js("js/acq.js") %]
433
    <script type="text/JavaScript">
434
        $(document).ready(function() {
435
            $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
436
                "aoColumnDefs": [
437
                    { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
438
                    { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
439
                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
440
                ],
441
                "sPaginationType": "four_button",
442
                "aaSorting": []
443
            } ) );
444
445
            // keep copy of the inactive budgets
446
            disabledBudgetsCopy = $("select[name='all_budget_id']").html();
447
            $("select[name='all_budget_id'] .b_inactive").remove();
448
            $("select[name='budget_id'] .b_inactive").remove();
449
450
            $("#showallbudgets").click(function() {
451
                if ($(this).is(":checked")) {
452
                    $("select[name='budget_id']").html(disabledBudgetsCopy)
453
                }
454
                else {
455
                    $("select[name='budget_id'] .b_inactive").remove();
456
                }
457
            });
458
459
            $("#all_showallbudgets").click(function() {
460
                if ($(this).is(":checked")) {
461
                    $("select[name='all_budget_id']").html(disabledBudgetsCopy);
462
                }
463
                else {
464
                    $("select[name='all_budget_id'] .b_inactive").remove();
465
                }
466
            });
467
468
            $("select[name='budget_id']").change(function(){
469
                var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
470
                var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
471
                var destination_sort1 = $(this).parents('fieldset').find('li.sort1').find('input[name="sort1"]');
472
                var sort1 = $(destination_sort1).val() || "";
473
                if ( destination_sort1.length < 1 ) {
474
                    destination_sort1 = $(this).parents('fieldset').find('li.sort1 > select[name="sort1"]');
475
                }
476
                var destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('input[name="sort2"]');
477
                var sort2 = $(destination_sort2).val() || "";
478
                if ( destination_sort2.length < 1 ) {
479
                    destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('select[name="sort2"]');
480
                }
481
                getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
482
483
                getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
484
            } );
485
486
            $("select[name='budget_id']").change();
487
488
            $("select[name='all_budget_id']").change(function(){
489
                var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
490
                var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
491
                var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
492
                if ( destination_sort1.length < 1 ) {
493
                    destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
494
                }
495
                var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
496
                if ( destination_sort2.length < 1 ) {
497
                    destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
498
                }
499
                getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
500
                getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
501
                $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
502
                $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
503
                $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
504
                $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
505
            } );
506
507
            $("select[name='all_budget_id']").change();
508
509
            $("#records_to_import fieldset.rows div").hide();
510
            $('input:checkbox[name="import_record_id"]').change(function(){
511
                var container = $(this).parents("fieldset");
512
                if ( $(this).is(':checked') ) {
513
                    $(container).addClass("selected");
514
                    $(container).removeClass("unselected");
515
                    $(container).find("div").toggle(true);
516
                } else {
517
                    $(container).addClass("unselected");
518
                    $(container).removeClass("selected");
519
                    $(container).find("div").toggle(false);
520
                }
521
            } );
522
523
            $("input:checkbox").prop("checked", false);
524
            $("div.biblio.unselected select").prop('disabled', false);
525
            $("div.biblio.unselected input").prop('disabled', false);
526
527
            $("#checkAll").click(function(){
528
                $("#Aform").checkCheckboxes();
529
                $("input:checkbox[name='import_record_id']").change();
530
                return false;
531
            });
532
            $("#unCheckAll").click(function(){
533
                $("#Aform").unCheckCheckboxes();
534
                $("input:checkbox[name='import_record_id']").change();
535
                return false;
536
            });
537
538
            $("#Aform").on("submit", function(){
539
                if ( $("input:checkbox[name='import_record_id']:checked").length < 1 ) {
540
                    alert(_("There is no record selected"));
541
                    return false;
542
                }
543
544
                var error = 0;
545
                $("input:checkbox[name='import_record_id']:checked").parents('fieldset').find('input[name="quantity"]').each(function(){
546
                    if ( $(this).val().length < 1 || isNaN( $(this).val() ) ) {
547
                        error++;
548
                    }
549
                });
550
                if ( error > 0 ) {
551
                    alert(error + " " + _("quantity values are not filled in or are not numbers"));
552
                    return false;
553
554
                }
555
556
                return disableUnchecked($(this));
557
            });
558
            $('#tabs').tabs();
559
            $(".previewData").on("click", function(e){
560
                e.preventDefault();
561
                var ltitle = $(this).text();
562
                var page = $(this).attr("href");
563
                $("#dataPreviewLabel").text(ltitle);
564
                $("#dataPreview .modal-body").load(page + " div");
565
                $('#dataPreview').modal({show:true});
566
            });
567
            $("#dataPreview").on("hidden.bs.modal", function(){
568
                $("#dataPreviewLabel").html("");
569
                $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
570
            });
571
        });
572
573
        function disableUnchecked(form){
574
            $("fieldset.biblio.unselected").each(function(){
575
                $(this).remove();
576
            });
577
            return 1;
578
        }
579
    </script>
580
[% END %]
581
582
[% INCLUDE 'intranet-bottom.inc' %]
578
[% INCLUDE 'intranet-bottom.inc' %]
583
- 

Return to bug 21989