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

(-)a/api/v1/swagger/definitions/edifact_file.yaml (-1 / +3 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
additionalProperties: false
58
  errors:
59
    type: array
60
additionalProperties: false
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt (-18 / +71 lines)
Lines 34-59 Link Here
34
    <h1>EDIFACT messages</h1>
34
    <h1>EDIFACT messages</h1>
35
    <div id="acqui_edifactmsgs" class="page-section">
35
    <div id="acqui_edifactmsgs" class="page-section">
36
        <table id="edi_msgs"></table>
36
        <table id="edi_msgs"></table>
37
    </div>
38
    <!-- /#acqui_edifactmsgs -->
37
39
38
        <!-- Modal to display EDIFACT messages -->
40
    <!-- Modal to display EDIFACT messages -->
39
        <div class="modal" id="EDI_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_modal_label" aria-hidden="true">
41
    <div class="modal" id="EDI_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_modal_label" aria-hidden="true">
40
            <div class="modal-dialog modal-lg">
42
        <div class="modal-dialog modal-lg">
41
                <div class="modal-content">
43
            <div class="modal-content">
42
                    <div class="modal-header">
44
                <div class="modal-header">
43
                        <h1 class="modal-title" id="EDI_modal_label">EDIFACT message</h1>
45
                    <h1 class="modal-title" id="EDI_modal_label">EDIFACT message</h1>
44
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
46
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
45
                    </div>
47
                </div>
46
                    <div class="modal-body">
48
                <div class="modal-body"> </div>
47
                        <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
49
                <div class="modal-footer">
48
                    </div>
50
                    <button class="btn btn-default" data-bs-dismiss="modal">Close</button>
49
                    <div class="modal-footer">
51
                </div>
50
                        <button class="btn btn-default" data-bs-dismiss="modal">Close</button>
52
            </div>
51
                    </div>
53
        </div>
54
    </div>
55
56
    <!-- Modal to display EDIFACT errors -->
57
    <div class="modal" id="EDI_errors_modal" tabindex="-1" role="dialog" aria-labelledby="EDI_errors_modal_label" aria-hidden="true">
58
        <div class="modal-dialog modal-lg">
59
            <div class="modal-content">
60
                <div class="modal-header">
61
                    <h1 class="modal-title" id="EDI_errors_modal_label">EDIFACT processing errors for <span id="EDI_errors_filename"></span></h1>
62
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
63
                </div>
64
                <div class="modal-body">
65
                    <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
66
                </div>
67
                <div class="modal-footer">
68
                    <button class="btn btn-default" data-bs-dismiss="modal">Close</button>
52
                </div>
69
                </div>
53
            </div>
70
            </div>
54
        </div>
71
        </div>
55
    </div>
72
    </div>
56
    <!-- /#acqui_edifactmsgs -->
57
[% END %]
73
[% END %]
58
74
59
[% MACRO jsinclude BLOCK %]
75
[% MACRO jsinclude BLOCK %]
Lines 69-75 Link Here
69
                },
85
                },
70
                "embed": [
86
                "embed": [
71
                    "vendor",
87
                    "vendor",
72
                    "basket"
88
                    "basket",
89
                    "errors"
73
                ],
90
                ],
74
                "order": [[ 1, "desc" ]],
91
                "order": [[ 1, "desc" ]],
75
                "columns": [
92
                "columns": [
Lines 92-98 Link Here
92
                        "data": "status",
109
                        "data": "status",
93
                        "title": _("Status"),
110
                        "title": _("Status"),
94
                        "searchable": true,
111
                        "searchable": true,
95
                        "orderable": true
112
                        "orderable": true,
113
                        "render": function(daya, type, row, meta) {
114
                            let rendered = '';
115
                            if ( row.errors.length > 0 ) {
116
                                let errorsList = '<ul>';
117
                                row.errors.forEach(error => {
118
                                    if (error.details) {
119
                                        errorsList += '<li>' + error.details + '</li>';
120
                                    }
121
                                });
122
                                errorsList += '</ul>';
123
                                rendered = row.status + ' (<a href="#" data-bs-toggle="modal" data-bs-target="#EDI_errors_modal" data-bs-errors="'+ errorsList + '" data-bs-filename="' + row.filename + '">' + _("with errors") + '</a>)';
124
                            } else {
125
                                rendered = row.status;
126
                            }
127
                            return rendered;
128
                        }
96
                    },
129
                    },
97
                    {
130
                    {
98
                        "data": "vendor.name",
131
                        "data": "vendor.name",
Lines 167-172 Link Here
167
            EDIModal.on("hidden.bs.modal", function(){
200
            EDIModal.on("hidden.bs.modal", function(){
168
                EDIModalBody.html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
201
                EDIModalBody.html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
169
            });
202
            });
203
204
            const errorsModal = document.getElementById('EDI_errors_modal')
205
            if (errorsModal) {
206
              errorsModal.addEventListener('show.bs.modal', event => {
207
                // Link that triggered the modal
208
                const link = event.relatedTarget
209
210
                // Extract info from data-bs-* attributes
211
                const filename = link.getAttribute('data-bs-filename')
212
                const errors = link.getAttribute('data-bs-errors')
213
214
                // Update the modal's title.
215
                const modalTitleSpan = errorsModal.querySelector('.modal-title #EDI_errors_filename')
216
                modalTitleSpan.textContent = filename;
217
218
                // Update the modal's content.
219
                const modalBody = errorsModal.querySelector('.modal-body')
220
                modalBody.innerHTML = errors;
221
              })
222
            }
223
170
            $("body").on("click", ".delete_msg" ,function(){
224
            $("body").on("click", ".delete_msg" ,function(){
171
                return confirm(_("Are you sure you want to delete this message?"));
225
                return confirm(_("Are you sure you want to delete this message?"));
172
            });
226
            });
173
- 

Return to bug 38689