Commit 8edcb9d5 by Takumi Imai

Merge branch 'feature/1.0_check_web_dev_son' into 'feature/1.0_check_web_dev'

fix show alert function

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