Commit 6b6540e2 by Kang Donghun

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

parents 08c8c9c9 8e848331
<button type="button" id="showConfirmModalButton" class="btn btn-sm btn-tertiary d-none" data-toggle="modal" data-target="#confirm-modal"></button>
<div class="modal fade" id="confirm-modal" tabindex="-1" role="dialog"> <div class="modal fade" id="confirm-modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content"> <div class="modal-content">
......
...@@ -71,6 +71,97 @@ COMMON.closeLoading = function () { ...@@ -71,6 +71,97 @@ COMMON.closeLoading = function () {
}; };
/** /**
* show confirm modal with yes, no buttons
* @param {Object} data - Object with {title, message, confirmYes, confirmNo}
* @param {callback} confirmCallback - The callback that handles the confirm button clicked
*/
COMMON.showConfirmModal = function (data, confirmCallback) {
if (data) {
let title = '';
if (data.title) {
title = data.title;
}
$('#confirm-modal .modal-title').text(title);
let message = '';
if (data.message) {
message = data.message;
}
$('#confirm-modal #msgModel').text(message);
if (data.confirmYes) {
$('#confirm-modal #confirmYes').text(data.confirmYes);
$('#confirm-modal #confirmYes').removeClass('d-none');
$('#confirm-modal #confirmYes').off('click');//remove all old click handlers
$('#confirm-modal #confirmYes').click(function() {
$('#confirm-modal .close').click();
if (confirmCallback) {
confirmCallback();
}
});
} else {
$('#confirm-modal #confirmYes').addClass('d-none');
}
if (data.confirmNo) {
$('#confirm-modal #confirmNo').text(data.confirmNo);
$('#confirm-modal #confirmNo').removeClass('d-none');
} else {
$('#confirm-modal #confirmNo').addClass('d-none');
}
}
$('#showConfirmModalButton').click();
};
/**
* 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}
*/
COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) {
const defaultParams = {
titleCode: 'confirmation',
confirmYesCode: 'confirmYes',
confirmNoCode: 'confirmNo'
}
const params = Object.assign(options, defaultParams);
let message = '';
if (messageCode) {
message = I18N.i18nText(messageCode);
} else if (params.message) {
message = params.message;
}
COMMON.showConfirmModal({
message: message,
title: I18N.i18nText(params.titleCode),
confirmYes: I18N.i18nText(params.confirmYesCode),
confirmNo: I18N.i18nText(params.confirmNoCode)
}, confirmCallback);
};
/**
* show alert message by confirm modal html
* @param {String} messageCode
* @param {Object} options - Data Options {message, titleCode, confirmNoCode}
*/
COMMON.showAlert = function (messageCode, options = {}) {
const defaultParams = {
titleCode: 'error',
confirmNoCode: 'close'
}
const params = Object.assign(options, defaultParams);
let message = '';
if (messageCode) {
message = I18N.i18nText(messageCode);
} else if (params.message) {
message = params.message;
}
COMMON.showConfirmModal({
message: message,
title: I18N.i18nText(params.titleCode),
confirmNo: I18N.i18nText(params.confirmNoCode)
});
};
/**
* show alert * show alert
* *
* @param {String} msgCode * @param {String} msgCode
......
...@@ -117,5 +117,7 @@ ...@@ -117,5 +117,7 @@
"reportForm": "Report", "reportForm": "Report",
"periodicInspectionPeriod": "Periodic Inspection Period", "periodicInspectionPeriod": "Periodic Inspection Period",
"msgSendPushMessageSuccess":"we sent a push message", "msgSendPushMessageSuccess":"we sent a push message",
"error": "Error" "error": "Error",
"msgSendPushMessageConfirm": "Do you want to send message?",
"close":"Close"
} }
\ No newline at end of file
...@@ -87,10 +87,10 @@ ...@@ -87,10 +87,10 @@
"txtMessageContent":"メッセージ", "txtMessageContent":"メッセージ",
"buttonTemplateSelection":"テンプレート選択", "buttonTemplateSelection":"テンプレート選択",
"buttonSend":"送信", "buttonSend":"送信",
"msgContentRequired":"Content is required", "msgContentRequired":"メッセージを入力してください。",
"msgContentInvalidLength":"The content length exceeds the maximum of {0} characters", "msgContentInvalidLength":"メッセージの長さが最大文字数({0})を超えています。",
"msgOperationRequired":"Operation is required", "msgOperationRequired":"作業を選択してください。",
"msgSendTypeRequired":"Send type is required", "msgSendTypeRequired":"送信先を選択してください。",
"operationSelection":"作業選択", "operationSelection":"作業選択",
"selection":"選択", "selection":"選択",
"templateSelection":"テンプレート選択", "templateSelection":"テンプレート選択",
...@@ -115,5 +115,7 @@ ...@@ -115,5 +115,7 @@
"reportForm": "報告", "reportForm": "報告",
"periodicInspectionPeriod": "定期点検期間", "periodicInspectionPeriod": "定期点検期間",
"msgSendPushMessageSuccess":"プッシュメッセージ送信しました。", "msgSendPushMessageSuccess":"プッシュメッセージ送信しました。",
"error": "エラー" "error": "エラー",
"msgSendPushMessageConfirm": "プッシュメッセージを送信しますか?",
"close":"閉じる"
} }
\ No newline at end of file
...@@ -114,5 +114,7 @@ ...@@ -114,5 +114,7 @@
"reportForm": "보고서", "reportForm": "보고서",
"periodicInspectionPeriod": "정기점검기간", "periodicInspectionPeriod": "정기점검기간",
"msgSendPushMessageSuccess":"푸시메시지를 보냈습니다.", "msgSendPushMessageSuccess":"푸시메시지를 보냈습니다.",
"error": "에러" "error": "에러",
"msgSendPushMessageConfirm": "Do you want to send message?",
"close":"Close"
} }
\ No newline at end of file
...@@ -33,9 +33,13 @@ ...@@ -33,9 +33,13 @@
<!-- header --> <!-- header -->
<div id="includedHeader"></div> <div id="includedHeader"></div>
<!-- report list -->
<div id="includedMainTitle"></div> <div id="includedMainTitle"></div>
<div class="quickReportBtn" id="quickReportBtn" onclick="submitForm();">
<img src="../common/img/icon_pdf.svg" alt="pdf出力" class="p-1 w-40px" data-toggle="tooltip" data-placement="bottom"
title="pdfPrint">
</div>
<!-- report list -->
<div class="mb-5" id="report-form"></div> <div class="mb-5" id="report-form"></div>
<!-- confirm --> <!-- confirm -->
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
<!-- select template modal --> <!-- select template modal -->
<div id="includeTemplateModal"></div> <div id="includeTemplateModal"></div>
<div id="includeConfirmModal"></div>
<script type="text/javascript" src="../common/js/app.js"></script> <script type="text/javascript" src="../common/js/app.js"></script>
<script src="../common/js/event.js?__UPDATEID__"></script> <script src="../common/js/event.js?__UPDATEID__"></script>
</body> </body>
......
...@@ -301,18 +301,18 @@ OL.createCategoryList = function () { ...@@ -301,18 +301,18 @@ OL.createCategoryList = function () {
//Create a side menu category structure //Create a side menu category structure
var categoryListElement = $('#categoryListMenu'); var categoryListElement = $('#categoryListMenu');
categoryListElement.empty(); categoryListElement.empty();
//sort group master list by level low to hight
OL.operationGroupMaster.sort(function (a, b) { OL.operationGroupMaster.sort(function (a, b) {
if (a.operationGroupMasterLevel < b.operationGroupMasterLevel) return -1; if (a.operationGroupMasterLevel < b.operationGroupMasterLevel) return -1;
if (a.operationGroupMasterLevel > b.operationGroupMasterLevel) return 1; if (a.operationGroupMasterLevel > b.operationGroupMasterLevel) return 1;
return 1; return 1;
}); });
let allChecked = ''; let allChecked = '';
if (typeof OL.operationGroupMasterId === 'undefined' || OL.operationGroupMasterId == 0) { if (typeof OL.operationGroupMasterId === 'undefined' || OL.operationGroupMasterId == 0) {
allChecked = ' checked'; allChecked = ' checked';
} }
const allCategory = $( const allCategory = $(
'<ul><li><label><input type="radio" name="category" value="0"' + allChecked + '><span class="lang" lang="categoryAll">' + I18N.i18nText('categoryAll') + '</span></label></li></ul>', '<ul><li><label><input type="radio" name="category" value="0"' + allChecked + '> <span>' + I18N.i18nText('categoryAll') + '</span></label></li></ul>',
); );
categoryListElement.append(allCategory); categoryListElement.append(allCategory);
//create category(operationGroupMaster) structure //create category(operationGroupMaster) structure
...@@ -327,12 +327,22 @@ OL.createCategoryList = function () { ...@@ -327,12 +327,22 @@ OL.createCategoryList = function () {
} }
let groupSpan = $('<span>' + item.operationGroupMasterName + '</span>'); let groupSpan = $('<span>' + item.operationGroupMasterName + '</span>');
inputLabel.append(inputRadio); inputLabel.append(inputRadio);
inputLabel.append(' ');
inputLabel.append(groupSpan); inputLabel.append(groupSpan);
if (item.operationGroupMasterLevel == 0) { const isParent = OL.operationGroupMaster.find(function(child) {
return item.operationGroupMasterId == child.parentOperationGroupMasterId;
});
let parentElement = categoryListElement;
if (item.parentOperationGroupMasterId != 0) {
parentElement = $('#collapse' + item.parentOperationGroupMasterId + ' > ul');
}
if (isParent) {
//accordion
const accordionId = 'accordion' + item.operationGroupMasterId; const accordionId = 'accordion' + item.operationGroupMasterId;
const headingId = 'heading' + item.operationGroupMasterId; const headingId = 'heading' + item.operationGroupMasterId;
const collapseId = 'collapse' + item.operationGroupMasterId; const collapseId = 'collapse' + item.operationGroupMasterId;
let categoryParentElm = $('<li class="accordion" id="' + accordionId + '" />'); let accordionElm = $('<li class="accordion" id="' + accordionId + '" />');
//heading
let headingDiv = $('<div id="' + headingId + '" />'); let headingDiv = $('<div id="' + headingId + '" />');
let linkA = $('<a class="list-menu-link" />'); let linkA = $('<a class="list-menu-link" />');
let collapseButton = $('<button type="button" class="collapsed" data-toggle="collapse" aria-expanded="true" />'); let collapseButton = $('<button type="button" class="collapsed" data-toggle="collapse" aria-expanded="true" />');
...@@ -342,26 +352,19 @@ OL.createCategoryList = function () { ...@@ -342,26 +352,19 @@ OL.createCategoryList = function () {
linkA.append(collapseButton); linkA.append(collapseButton);
linkA.append(inputLabel); linkA.append(inputLabel);
headingDiv.append(linkA); headingDiv.append(linkA);
categoryParentElm.append(headingDiv); //collapse
categoryListElement.append(categoryParentElm); let collapseElm = $('<div id="' + collapseId + '" class="collapse">');
collapseElm.attr('data-parent', '#' + accordionId);
collapseElm.attr('aria-labelledby', headingId);
let ul = $('<ul>');
collapseElm.append(ul);
accordionElm.append(headingDiv);
accordionElm.append(collapseElm);
parentElement.append(accordionElm);
} else { } else {
let li = $('<li>'); let li = $('<li>');
li.append(inputLabel); li.append(inputLabel);
let parentElm = $('#collapse' + item.parentOperationGroupMasterId + ' > ul'); parentElement.append(li);
if (typeof parentElm === 'undefined' || !parentElm || parentElm.length < 1) {
const accordionParentId = 'accordion' + item.parentOperationGroupMasterId;
const headingParentId = 'heading' + item.parentOperationGroupMasterId;
const collapseParentId = 'collapse' + item.parentOperationGroupMasterId;
parentElm = $('<div id="' + collapseParentId + '" class="collapse">');
parentElm.attr('data-parent', '#' + accordionParentId);
parentElm.attr('aria-labelledby', headingParentId);
let ul = $('<ul>');
ul.append(li);
parentElm.append(ul);
$('#' + accordionParentId).append(parentElm);
} else {
parentElm.append(li);
}
} }
} }
}; };
......
...@@ -18,7 +18,7 @@ PushMessageList.init = function () { ...@@ -18,7 +18,7 @@ PushMessageList.init = function () {
href: 'dashboard.html', href: 'dashboard.html',
}, },
{ {
titleLang: 'messageListTitle', titleLang: 'pushMessageList',
}, },
]; ];
TEMPLATE.loadMainNavsTitle('#includedMainTitle', 'pushMessageList', navs, null); TEMPLATE.loadMainNavsTitle('#includedMainTitle', 'pushMessageList', navs, null);
...@@ -71,6 +71,12 @@ PushMessageList.generateMessageListHtml = function (messageList) { ...@@ -71,6 +71,12 @@ PushMessageList.generateMessageListHtml = function (messageList) {
$('#messageList .not-found').removeClass('d-none'); $('#messageList .not-found').removeClass('d-none');
return; return;
} }
//sort message list by send date
messageList.sort(function (a, b) {
if (a.pushSendDate > b.pushSendDate) return -1;
if (a.pushSendDate < b.pushSendDate) return 1;
return 0;
});
$('#messageList .not-found').addClass('d-none'); $('#messageList .not-found').addClass('d-none');
for (var i = 0; i < messageList.length; i++) { for (var i = 0; i < messageList.length; i++) {
let message = messageList[i]; let message = messageList[i];
......
...@@ -132,7 +132,7 @@ RF.initFormView = function () { ...@@ -132,7 +132,7 @@ RF.initFormView = function () {
if (replyNo) params.replyNo = replyNo; if (replyNo) params.replyNo = replyNo;
if (processKey) params.processKey = processKey; if (processKey) params.processKey = processKey;
if (phaseNo) params.phaseNo = phaseNo; if (phaseNo) params.phaseNo = phaseNo;
if (reportStartDate) prarams.reportStartDate = reportStartDate; if (reportStartDate) params.reportStartDate = reportStartDate;
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.HTML.BASE + CONSTANT.URL.CMS.HTML.LIST_REPORT_FORM; const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.HTML.BASE + CONSTANT.URL.CMS.HTML.LIST_REPORT_FORM;
$('#report-form').load(url, params, function () { $('#report-form').load(url, params, function () {
......
...@@ -39,21 +39,21 @@ SendMessage.getCurrentSendType = function () { ...@@ -39,21 +39,21 @@ SendMessage.getCurrentSendType = function () {
SendMessage.checkValidation = function () { SendMessage.checkValidation = function () {
const message = SendMessage.getCurrentMessageContent(); const message = SendMessage.getCurrentMessageContent();
if (!ValidationUtil.CheckRequiredForText(message)) { if (!ValidationUtil.CheckRequiredForText(message)) {
alert(I18N.i18nText('msgContentRequired')); COMMON.showAlert('msgContentRequired');
return false; return false;
} }
if (!ValidationUtil.CheckMaxLengthForByte(message, SendMessage.contentMaxLength)) { if (!ValidationUtil.CheckMaxLengthForByte(message, SendMessage.contentMaxLength)) {
alert(COMMON.format(I18N.i18nText('msgContentInvalidLength'), SendMessage.contentMaxLength)); COMMON.showAlert(null, {message: COMMON.format(I18N.i18nText('msgContentInvalidLength'), SendMessage.contentMaxLength)});
return false; return false;
} }
const operationId = SendMessage.getCurrentOperationId(); const operationId = SendMessage.getCurrentOperationId();
if (!ValidationUtil.IsNumber(operationId)) { if (!ValidationUtil.IsNumber(operationId)) {
alert(I18N.i18nText('msgOperationRequired')); COMMON.showAlert('msgOperationRequired');
return false; return false;
} }
const sendType = SendMessage.getCurrentSendType(); const sendType = SendMessage.getCurrentSendType();
if (!ValidationUtil.IsNumber(sendType)) { if (!ValidationUtil.IsNumber(sendType)) {
alert(I18N.i18nText('msgSendTypeRequired')); COMMON.showAlert('msgSendTypeRequired');
return false; return false;
} }
return true; return true;
...@@ -69,7 +69,9 @@ SendMessage.onClickSend = function () { ...@@ -69,7 +69,9 @@ SendMessage.onClickSend = function () {
const message = SendMessage.getCurrentMessageContent(); const message = SendMessage.getCurrentMessageContent();
const operationId = SendMessage.getCurrentOperationId(); const operationId = SendMessage.getCurrentOperationId();
const sendType = SendMessage.getCurrentSendType(); const sendType = SendMessage.getCurrentSendType();
SendMessage.postMessage(message, operationId, sendType); COMMON.showConfirm('msgSendPushMessageConfirm', function() {
SendMessage.postMessage(message, operationId, sendType);
});
}; };
/** /**
...@@ -92,7 +94,7 @@ SendMessage.postMessage = function (message, operationId, sendType) { ...@@ -92,7 +94,7 @@ SendMessage.postMessage = function (message, operationId, sendType) {
false, false,
function (json) { function (json) {
COMMON.closeLoading(); COMMON.closeLoading();
alert(I18N.i18nText('msgSendPushMessageSuccess')); COMMON.showAlert('msgSendPushMessageSuccess');
}, },
function () { function () {
console.log('SendMessage.postMessage error'); console.log('SendMessage.postMessage error');
...@@ -126,13 +128,14 @@ SendMessage.init = function () { ...@@ -126,13 +128,14 @@ SendMessage.init = function () {
//Check if user is logged in //Check if user is logged in
COMMON.checkAuth(false); COMMON.checkAuth(false);
TEMPLATE.loadHeader('#includedHeader'); TEMPLATE.loadHeader('#includedHeader');
TEMPLATE.loadConfirmModal('#includeConfirmModal');
const navs = [ const navs = [
{ {
titleLang: 'dashboard', titleLang: 'dashboard',
href: 'dashboard.html', href: 'dashboard.html',
}, },
{ {
titleLang: 'sendMessageTitle', titleLang: 'sendMessage',
}, },
]; ];
TEMPLATE.loadMainNavsTitle('#includedMainTitle', 'sendMessage', navs, null); TEMPLATE.loadMainNavsTitle('#includedMainTitle', 'sendMessage', navs, null);
......
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