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