|
|
@ -2,17 +2,11 @@ define([
|
|
|
|
'jquery',
|
|
|
|
'jquery',
|
|
|
|
'/api/config',
|
|
|
|
'/api/config',
|
|
|
|
'/common/hyperscript.js',
|
|
|
|
'/common/hyperscript.js',
|
|
|
|
|
|
|
|
'/common/common-interface.js',
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/customize/messages.js',
|
|
|
|
'/customize/messages.js',
|
|
|
|
], function ($, ApiConfig, h, Hash, Util, Messages) {
|
|
|
|
], function ($, ApiConfig, h, UI, Hash, Util, Messages) {
|
|
|
|
|
|
|
|
|
|
|
|
var showError = function (form, msg) {
|
|
|
|
|
|
|
|
if (!msg) {
|
|
|
|
|
|
|
|
return void $(form).find('.cp-support-form-error').text('').hide();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$(form).find('.cp-support-form-error').text(msg).show();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var send = function (common, id, type, data, dest) {
|
|
|
|
var send = function (common, id, type, data, dest) {
|
|
|
|
var supportKey = ApiConfig.supportMailbox;
|
|
|
|
var supportKey = ApiConfig.supportMailbox;
|
|
|
@ -49,14 +43,12 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var title = $title.val();
|
|
|
|
var title = $title.val();
|
|
|
|
if (!title) {
|
|
|
|
if (!title) {
|
|
|
|
return void showError(form, Messages.support_formTitleError);
|
|
|
|
return void UI.alert(Messages.support_formTitleError);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var content = $content.val();
|
|
|
|
var content = $content.val();
|
|
|
|
if (!content) {
|
|
|
|
if (!content) {
|
|
|
|
return void showError(form, Messages.support_formContentError);
|
|
|
|
return void UI.alert(form, Messages.support_formContentError);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Success: hide any error
|
|
|
|
|
|
|
|
showError(form, null);
|
|
|
|
|
|
|
|
$content.val('');
|
|
|
|
$content.val('');
|
|
|
|
$title.val('');
|
|
|
|
$title.val('');
|
|
|
|
|
|
|
|
|
|
|
@ -80,14 +72,15 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var content = [
|
|
|
|
var content = [
|
|
|
|
h('hr'),
|
|
|
|
h('hr'),
|
|
|
|
h('div.cp-support-form-error'),
|
|
|
|
|
|
|
|
h('label' + (title ? '.cp-hidden' : ''), Messages.support_formTitle),
|
|
|
|
|
|
|
|
h('input.cp-support-form-title' + (title ? '.cp-hidden' : ''), {
|
|
|
|
h('input.cp-support-form-title' + (title ? '.cp-hidden' : ''), {
|
|
|
|
|
|
|
|
placeholder: Messages.support_formTitle,
|
|
|
|
|
|
|
|
type: 'text',
|
|
|
|
value: title || ''
|
|
|
|
value: title || ''
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
cb ? undefined : h('br'),
|
|
|
|
cb ? undefined : h('br'),
|
|
|
|
h('label', Messages.support_formMessage),
|
|
|
|
h('textarea.cp-support-form-msg', {
|
|
|
|
h('textarea.cp-support-form-msg', { }),
|
|
|
|
placeholder: Messages.support_formMessage
|
|
|
|
|
|
|
|
}),
|
|
|
|
h('hr'),
|
|
|
|
h('hr'),
|
|
|
|
button,
|
|
|
|
button,
|
|
|
|
cancel
|
|
|
|
cancel
|
|
|
@ -104,7 +97,7 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var makeTicket = function ($div, common, content, onHide) {
|
|
|
|
var makeTicket = function ($div, common, content, onHide) {
|
|
|
|
var ticketTitle = content.id + ' - ' + content.title;
|
|
|
|
var ticketTitle = content.title + ' (#' + content.id + ')';
|
|
|
|
var answer = h('button.btn.btn-primary.cp-support-answer', Messages.support_answer);
|
|
|
|
var answer = h('button.btn.btn-primary.cp-support-answer', Messages.support_answer);
|
|
|
|
var close = h('button.btn.btn-danger.cp-support-close', Messages.support_close);
|
|
|
|
var close = h('button.btn.btn-danger.cp-support-close', Messages.support_close);
|
|
|
|
var hide = h('button.btn.btn-danger.cp-support-hide', Messages.support_remove);
|
|
|
|
var hide = h('button.btn.btn-danger.cp-support-hide', Messages.support_remove);
|
|
|
|