Commit c6de9971 by NGUYEN HOANG SON

upgrade showAlert function

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