Commit 5a0faa8a by NGUYEN HOANG SON

fix show alert function

parent f77d8b43
...@@ -121,7 +121,7 @@ COMMON.showConfirmModal = function (data, confirmCallback) { ...@@ -121,7 +121,7 @@ COMMON.showConfirmModal = function (data, confirmCallback) {
* Show confirm modal with defaults: title, yes, no * Show confirm modal with defaults: title, yes, no
* @param {string} messageCode * @param {string} messageCode
* @param {callback} confirmCallback - The callback that handles the confirm button clicked * @param {callback} confirmCallback - The callback that handles the confirm button clicked
* @param {Object} options - Object with {title, message, confirmYes, confirmNo} * @param {Object} options - Object with {titleCode, message, confirmYesCode, confirmNoCode}
*/ */
COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) { COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) {
const defaultParams = { const defaultParams = {
...@@ -129,16 +129,28 @@ COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) { ...@@ -129,16 +129,28 @@ COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) {
confirmYesCode: 'confirmYes', confirmYesCode: 'confirmYes',
confirmNoCode: 'confirmNo' confirmNoCode: 'confirmNo'
} }
const params = Object.assign(options, defaultParams); const params = Object.assign(defaultParams, options);
let message = ''; let message = '';
if (messageCode) { if (messageCode) {
message = I18N.i18nText(messageCode); message = I18N.i18nText(messageCode);
if (typeof message === 'undefined') {
//lang of messageCode undefined, use message or messageCode
if (params.message) {
message = params.message;
} else {
message = messageCode;
}
}
} else if (params.message) { } else if (params.message) {
message = params.message; message = params.message;
} }
let title = I18N.i18nText(params.titleCode);
if (params.title) {
title = params.title;
}
COMMON.showConfirmModal({ COMMON.showConfirmModal({
message: message, message: message,
title: I18N.i18nText(params.titleCode), title: title,
confirmYes: I18N.i18nText(params.confirmYesCode), confirmYes: I18N.i18nText(params.confirmYesCode),
confirmNo: I18N.i18nText(params.confirmNoCode) confirmNo: I18N.i18nText(params.confirmNoCode)
}, confirmCallback); }, confirmCallback);
...@@ -153,23 +165,11 @@ COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) { ...@@ -153,23 +165,11 @@ COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) {
COMMON.showAlert = function (messageCode, titleCode = 'error', options = {}) { COMMON.showAlert = function (messageCode, titleCode = 'error', options = {}) {
const defaultParams = { const defaultParams = {
titleCode: titleCode ? titleCode : 'error', titleCode: titleCode ? titleCode : 'error',
confirmNoCode: 'close' confirmYesCode: null,
confirmNoCode: 'close',
} }
const params = Object.assign(options, defaultParams); const params = Object.assign(defaultParams, options);
let message = ''; COMMON.showConfirm(messageCode, null, params);
if (messageCode) {
message = I18N.i18nText(messageCode);
if (typeof message === 'undefined') {
message = messageCode;
}
} else if (params.message) {
message = params.message;
}
COMMON.showConfirmModal({
message: message,
title: I18N.i18nText(params.titleCode),
confirmNo: I18N.i18nText(params.confirmNoCode)
});
}; };
/** /**
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
"pdfPrint":"PDF Print", "pdfPrint":"PDF Print",
"msgOperationEmpty": "Operation data is Empty.", "msgOperationEmpty": "Operation data is Empty.",
"success": "Success", "success": "Success",
"dashboard":"Dashboard", "dashboard":"Dashboard",
"dashboardSettings":"Dashboard Settings", "dashboardSettings":"Dashboard Settings",
"pickup":"Pick up", "pickup":"Pick up",
...@@ -121,7 +120,6 @@ ...@@ -121,7 +120,6 @@
"error": "Error", "error": "Error",
"msgSendPushMessageConfirm": "Do you want to send message?", "msgSendPushMessageConfirm": "Do you want to send message?",
"close":"Close", "close":"Close",
"success":"Success",
"dateError": "Set the start date before the end date.", "dateError": "Set the start date before the end date.",
"onlyRfid":"RFID or barcode is set.\nPlease scan the code." "onlyRfid":"RFID or barcode is set.\nPlease scan the code."
} }
\ No newline at end of file
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
"pdfPrint":"PDF出力", "pdfPrint":"PDF出力",
"msgOperationEmpty": "作業データがありません。", "msgOperationEmpty": "作業データがありません。",
"success": "成功", "success": "成功",
"dashboard":"ダッシュボード", "dashboard":"ダッシュボード",
"dashboardSettings":"ダッシュボード設定", "dashboardSettings":"ダッシュボード設定",
"pickup":"ピックアップ", "pickup":"ピックアップ",
...@@ -119,7 +118,6 @@ ...@@ -119,7 +118,6 @@
"error": "エラー", "error": "エラー",
"msgSendPushMessageConfirm": "プッシュメッセージを送信しますか?", "msgSendPushMessageConfirm": "プッシュメッセージを送信しますか?",
"close":"閉じる", "close":"閉じる",
"success":"成功",
"dateError": "開始日は終了日の前に設定してください。", "dateError": "開始日は終了日の前に設定してください。",
"onlyRfid":"RFID又はバーコードが設定されています。\n該当コードを読み込んでください。" "onlyRfid":"RFID又はバーコードが設定されています。\n該当コードを読み込んでください。"
} }
\ No newline at end of file
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
"pdfPrint":"PDF 출력", "pdfPrint":"PDF 출력",
"msgOperationEmpty": "작업 데이터가 없습니다.", "msgOperationEmpty": "작업 데이터가 없습니다.",
"success": "성공", "success": "성공",
"dashboard":"대시보드", "dashboard":"대시보드",
"dashboardSettings":"대시보드 설정", "dashboardSettings":"대시보드 설정",
"pickup":"픽업", "pickup":"픽업",
...@@ -118,7 +117,6 @@ ...@@ -118,7 +117,6 @@
"error": "에러", "error": "에러",
"msgSendPushMessageConfirm": "Do you want to send message?", "msgSendPushMessageConfirm": "Do you want to send message?",
"close":"Close", "close":"Close",
"success":"Success",
"dateError": "시작일은 종료일 이전에 설정하십시오.", "dateError": "시작일은 종료일 이전에 설정하십시오.",
"onlyRfid":"RFID또는 바코드가 설정되어있습니다.\n해당코드를 스캔해주십시오." "onlyRfid":"RFID또는 바코드가 설정되어있습니다.\n해당코드를 스캔해주십시오."
} }
\ No newline at end of file
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