Commit c6de9971 by NGUYEN HOANG SON

upgrade showAlert function

parent 5a8177d7
......@@ -146,17 +146,21 @@ COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) {
/**
* show alert message by confirm modal html
* @param {String} messageCode
* @param {string} titleCode
* @param {Object} options - Data Options {message, titleCode, confirmNoCode}
*/
COMMON.showAlert = function (messageCode, options = {}) {
COMMON.showAlert = function (messageCode, titleCode = 'error', options = {}) {
const defaultParams = {
titleCode: 'error',
titleCode: titleCode ? titleCode : 'error',
confirmNoCode: 'close'
}
const params = Object.assign(options, defaultParams);
let message = '';
if (messageCode) {
message = I18N.i18nText(messageCode);
if (typeof message === 'undefined') {
message = messageCode;
}
} else if (params.message) {
message = params.message;
}
......
......@@ -119,5 +119,6 @@
"msgSendPushMessageSuccess":"we sent a push message",
"error": "Error",
"msgSendPushMessageConfirm": "Do you want to send message?",
"close":"Close"
"close":"Close",
"success":"Success"
}
\ No newline at end of file
......@@ -117,5 +117,6 @@
"msgSendPushMessageSuccess":"プッシュメッセージ送信しました。",
"error": "エラー",
"msgSendPushMessageConfirm": "プッシュメッセージを送信しますか?",
"close":"閉じる"
"close":"閉じる",
"success":"成功"
}
\ No newline at end of file
......@@ -116,5 +116,6 @@
"msgSendPushMessageSuccess":"푸시메시지를 보냈습니다.",
"error": "에러",
"msgSendPushMessageConfirm": "Do you want to send message?",
"close":"Close"
"close":"Close",
"success":"Success"
}
\ No newline at end of file
......@@ -94,7 +94,7 @@ SendMessage.postMessage = function (message, operationId, sendType) {
false,
function (json) {
COMMON.closeLoading();
COMMON.showAlert('msgSendPushMessageSuccess');
COMMON.showAlert('msgSendPushMessageSuccess', 'success');
},
function () {
console.log('SendMessage.postMessage error');
......
......@@ -28,7 +28,7 @@ SETTINGS.getToken = function () {
if (data.token) {
$('#getToken').val(data.token);
} else {
COMMON.showAlert("token error..", true);
COMMON.showAlert("token error..");
}
},
function(data) {
......@@ -134,7 +134,7 @@ SETTINGS.avwCmsApi_passwordChange_success = function (data) {
$('#txtPwdNew').val('');
$('#txtPwdNewRe').val('');
/* show messages */
COMMON.showAlert('msgPwdChangeOK');
COMMON.showAlert('msgPwdChangeOK', 'success');
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment