';
// success
@@ -35,6 +59,14 @@ async function UIWindowQR (options) {
h += '
';
h += '
';
@@ -56,7 +88,7 @@ async function UIWindowQR (options) {
init_center: true,
allow_native_ctxmenu: false,
allow_user_select: false,
- width: 350,
+ width: 380,
height: 'auto',
dominant: true,
show_in_taskbar: false,
@@ -73,30 +105,129 @@ async function UIWindowQR (options) {
},
});
- $(el_window).find('.send-feedback-btn').on('click', function (e) {
- const message = $(el_window).find('.feedback-message').val();
- if ( message )
- {
- $(this).prop('disabled', true);
- }
- $.ajax({
- url: `${window.api_origin }/contactUs`,
- type: 'POST',
- async: true,
- contentType: 'application/json',
- headers: {
- 'Authorization': `Bearer ${window.auth_token}`,
- },
- data: JSON.stringify({
- message: message,
- }),
- success: async function (data) {
- $(el_window).find('.feedback-form').hide();
- $(el_window).find('.feedback-sent-success').show(100);
- },
+ const $error = $(el_window).find('.feedback-error');
+ // `.html()` rather than `.text()`: i18n() html-encodes what it returns,
+ // so text() would render the entities literally.
+ const showError = (key) => $error.html(i18n(key, ERROR_VALUES[key] ?? [])).show();
+ const clearError = () => $error.hide().empty();
+
+ // -- Attachments -------------------------------------------------
+
+ const renderAttachments = () => {
+ const $list = $(el_window).find('.feedback-attachment-list').empty();
+ attachments.forEach((file, index) => {
+ const removeLabel = i18n('contact_us_attachment_remove');
+ const $item = $(
+ '