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

(-)a/api/v1/swagger/definitions/edifact_file.yaml (+2 lines)
Lines 55-58 properties: Link Here
55
      - string
55
      - string
56
      - "null"
56
      - "null"
57
    description: EDIFACT file name
57
    description: EDIFACT file name
58
  errors:
59
    type: array
58
additionalProperties: false
60
additionalProperties: false
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt (-13 / +62 lines)
Lines 40-45 Link Here
40
40
41
<table id="edi_msgs"></table>
41
<table id="edi_msgs"></table>
42
42
43
</div> <!-- /#acqui_edifactmsgs -->
44
</main>
45
</div> <!-- /.col-md-10.order-md-2 -->
46
47
    <div class="col-md-2 order-sm-2 order-md-1">
48
        <aside>
49
            [% INCLUDE 'acquisitions-menu.inc' %]
50
        </aside>
51
    </div>
52
</div> <!-- /.row -->
53
43
<!-- Modal to display EDIFACT messages -->
54
<!-- Modal to display EDIFACT messages -->
44
<div class="modal" id="EDI_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_modal_label" aria-hidden="true">
55
<div class="modal" id="EDI_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_modal_label" aria-hidden="true">
45
    <div class="modal-dialog modal-lg">
56
    <div class="modal-dialog modal-lg">
Lines 49-55 Link Here
49
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
60
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
50
            </div>
61
            </div>
51
            <div class="modal-body">
62
            <div class="modal-body">
52
                <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
53
            </div>
63
            </div>
54
            <div class="modal-footer">
64
            <div class="modal-footer">
55
                <button class="btn btn-default" data-bs-dismiss="modal">Close</button>
65
                <button class="btn btn-default" data-bs-dismiss="modal">Close</button>
Lines 58-73 Link Here
58
    </div>
68
    </div>
59
</div>
69
</div>
60
70
61
</div> <!-- /#acqui_edifactmsgs -->
71
<!-- Modal to display EDIFACT errors -->
62
</main>
72
<div class="modal" id="EDI_errors_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_errors_modal_label" aria-hidden="true">
63
</div> <!-- /.col-md-10.order-md-2 -->
73
    <div class="modal-dialog modal-lg">
64
74
        <div class="modal-content">
65
    <div class="col-md-2 order-sm-2 order-md-1">
75
            <div class="modal-header">
66
        <aside>
76
                <h1 class="modal-title" id="EDI_errors_modal_label">EDIFACT message</h1>
67
            [% INCLUDE 'acquisitions-menu.inc' %]
77
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
68
        </aside>
78
            </div>
79
            <div class="modal-body">
80
                <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
81
            </div>
82
            <div class="modal-footer">
83
                <button class="btn btn-default" data-bs-dismiss="modal">Close</button>
84
            </div>
85
        </div>
69
    </div>
86
    </div>
70
</div> <!-- /.row -->
87
</div>
71
88
72
[% MACRO jsinclude BLOCK %]
89
[% MACRO jsinclude BLOCK %]
73
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
90
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
Lines 82-88 Link Here
82
                },
99
                },
83
                "embed": [
100
                "embed": [
84
                    "vendor",
101
                    "vendor",
85
                    "basket"
102
                    "basket",
103
                    "errors"
86
                ],
104
                ],
87
                "columns": [
105
                "columns": [
88
                    {
106
                    {
Lines 104-110 Link Here
104
                        "data": "status",
122
                        "data": "status",
105
                        "title": _("Status"),
123
                        "title": _("Status"),
106
                        "searchable": true,
124
                        "searchable": true,
107
                        "orderable": true
125
                        "orderable": true,
126
                        "render": function(daya, type, row, meta) {
127
                            let rendered = '';
128
                            if ( row.errors.length > 0 ) {
129
                                let errorsList = '<ul>';
130
                                row.errors.forEach(error => {
131
                                    if (error.details) {
132
                                        errorsList += '<li>' + error.details + '</li>';
133
                                    }
134
                                });
135
                                errorsList += '</ul>';
136
                                rendered = row.status + ' (<a href="#" data-bs-toggle="modal" data-bs-target="#EDI_errors_modal" data-bs-errors="'+ errorsList + '">' + _("with errors") + '</a>)';
137
                            } else {
138
                                rendered = row.status;
139
                            }
140
                            return rendered;
141
                        }
108
                    },
142
                    },
109
                    {
143
                    {
110
                        "data": "vendor.name",
144
                        "data": "vendor.name",
Lines 179-184 Link Here
179
            EDIModal.on("hidden.bs.modal", function(){
213
            EDIModal.on("hidden.bs.modal", function(){
180
                EDIModalBody.html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
214
                EDIModalBody.html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
181
            });
215
            });
216
217
            const errorsModal = document.getElementById('EDI_errors_modal')
218
            if (errorsModal) {
219
              errorsModal.addEventListener('show.bs.modal', event => {
220
                // Link that triggered the modal
221
                const link = event.relatedTarget
222
223
                // Extract info from data-bs-* attributes
224
                const errors = link.getAttribute('data-bs-errors')
225
226
                // Update the modal's content.
227
                const modalBody = errorsModal.querySelector('.modal-body')
228
                modalBody.innerHTML = errors;
229
              })
230
            }
231
182
            $("body").on("click", ".delete_msg" ,function(){
232
            $("body").on("click", ".delete_msg" ,function(){
183
                return confirm(_("Are you sure you want to delete this message?"));
233
                return confirm(_("Are you sure you want to delete this message?"));
184
            });
234
            });
185
- 

Return to bug 38689