Commit 5175b176 by Takumi Imai

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

# Conflicts:
#	abvw/common/js/appCommon/constant.js
parent 7284ccb8
......@@ -203,10 +203,9 @@ CHK_Common.getUrlParameter = function () {
* @returns sid
*/
CHK_Common.getSid = function () {
return ClientData.userInfo_sid();
return ClientData.userInfo_sid();
};
/**
* cms communication
*
......@@ -216,29 +215,32 @@ CHK_Common.getSid = function () {
* @param {Object} callback
* @param {Object} errorCallback
*/
CHK_Common.cmsAjax = function (url, param, async = true, type, dataType, callback, errorCallback) {
CHK_Common.cmsAjax = function (url, param, async = true, callback, errorCallback) {
var sysSettings = AVWEB.avwSysSetting();
if (url) {
$.ajax({
type: type,
type: 'post',
url: url,
data: param,
dataType: dataType,
dataType: 'json',
cache: false,
async: async,
crossDomain: true,
beforeSend: function(xhr) {
beforeSend: function (xhr) {
xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
},
success: function (result) {
if (result.status == '200') {
if (result.httpStatus == '200') {
if (callback) callback(result);
} else if (result.status == '401') {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
} else if (errorCallback) {
errorCallback();
} else if (result.httpStatus == '401') {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
} else if (result.httpStatus == '403') {
CHK_Common.closeLoading();
CHK_Common.displayAlert('errorOccurred');
} else {
CHK_Common.closeLoading();
CHK_Common.displayAlert(result.message);
......@@ -299,7 +301,7 @@ CHK_Common.checkAuth = function (async = true) {
params.sid = CHK_Common.getSid;
var urlPath = ClientData.userInfo_accountPath();
const url = CHK_CONSTANT.URL.BASE_CMS + urlPath + CHK_CONSTANT.URL.BASE_CHECKAPI + CHK_CONSTANT.URL.AUTH_SESSION;
CHK_Common.cmsAjax(url, params, async, CONSTANT.API_TYPE.GET, CONSTANT.DATA_TYPE.TEXT, function () {
CHK_Common.cmsAjax(url, params, async, null, function () {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
});
};
......@@ -54,16 +54,6 @@ CHK_CONSTANT.URL = {
AUTH_SESSION: 'getSession/checkAuthUser',
};
CONSTANT.API_TYPE = {
POST: 'post',
GET: 'get'
}
CONSTANT.DATA_TYPE = {
TEXT: 'text',
JSON: 'json',
}
CHK_CONSTANT.LANG = {
SAVE_NAME: 'lang',
JAPAN: 'ja',
......
......@@ -48,20 +48,19 @@ CHK_OL.init = function () {
CHK_OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
let param = {};
param.sid = CHK_Common.getSid();
param.operationGroupMasterId = searchKeyword;
param.operationName = searchKeyword;
param.sort = sortIndex;
param.startDate = searchStartDate;
param.endDate = searchEndDate;
param.operationGroupMasterId = operationGroupMasterId;
const url = CHK_CONSTANT.URL.BASE_CMS + ClientData.userInfo_accountPath() + CHK_CONSTANT.URL.BASE_CHECKAPI + CHK_CONSTANT.URL.ALL_OPERATION_LIST;
CHK_Common.cmsAjax(url, param, false, CONSTANT.API_TYPE.GET, CONSTANT.DATA_TYPE.JSON,function (json) {
CHK_Common.cmsAjax(url, param, false, function (json) {
CHK_OL.operationList = json.operationList;
CHK_OL.operationGroupMaster = json.operationGroupMasterList;
CHK_OL.isOperationGroupMaster = json.isOperationGroupMaster;
CHK_OL.operationSearchCriteria = json.operationSearchCriteria;
CHK_OL.setSearchInfoWeb();
console.log('json.operationList', JSON.stringify(json.operationList));
});
};
......@@ -173,6 +172,7 @@ CHK_OL.initCategory = function () {
}
$('#operationGroupMasterButton').removeClass('d-none');
CHK_OL.setCategoryHeight();
$(window).resize(function () {
CHK_OL.setCategoryHeight();
});
......@@ -201,15 +201,14 @@ CHK_OL.createBreadcrumbList = function () {
if (typeof CHK_OL.operationGroupMasterId == 'undefined' || CHK_OL.operationGroupMasterId == 0) {
$('#groupMasterPath').append('<li class="breadcrumb-item"><a href="#" class="text-decoration-none text-dark">' + CHK_Common.getMsg('all') + '</a></li>');
} else {
const groupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == CHK_OL.operationGroupMasterId)[0];
const groupMasterPathIdlist = groupMaster.treePath.split('/');
groupMasterPathIdlist.forEach(function (parentId) {
const pathOperationGroupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == parentId)[0];
let treeList = [];
CHK_OL.createBreadcrumbTree(treeList, CHK_OL.operationGroupMasterId);
treeList.forEach(function (operationGroupMaster) {
$('#groupMasterPath').append(
'<li class="breadcrumb-item"><a onclick="CHK_OL.changeOperationGroupMaster(' +
pathOperationGroupMaster.operationGroupMasterId +
operationGroupMaster.operationGroupMasterId +
');" class="text-decoration-none text-dark">' +
pathOperationGroupMaster.operationGroupMasterName +
operationGroupMaster.operationGroupMasterName +
'</a></li>',
);
});
......@@ -217,6 +216,24 @@ CHK_OL.createBreadcrumbList = function () {
};
/**
* create Breadcrumb tree List
*
* @param {list} treeList
* @param {string} operationGroupMasterId
* @returns
*/
CHK_OL.createBreadcrumbTree = function (treeList, operationGroupMasterId) {
if (operationGroupMasterId == 0) {
return treeList;
}
const groupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == operationGroupMasterId)[0];
CHK_OL.createBreadcrumbTree(treeList, groupMaster.parentOperationGroupMasterId);
treeList.push(groupMaster);
return treeList;
};
/**
* create category(operationGroupMaster) structure
*/
CHK_OL.createCategoryList = function () {
......@@ -233,9 +250,7 @@ CHK_OL.createCategoryList = function () {
});
//common
const noCategory = $(
"<dl id='groupMasterId_0' class='group-category-list'><dt><a onclick='CHK_OL.changeOperationGroupMaster(0);'>" + CHK_Common.getMsg(CHK_CONSTANT.MSG_MAP.all) + '</a></dt></dl>',
);
const noCategory = $("<dl id='groupMasterId_0' class='group-category-list'><dt><a onclick='CHK_OL.changeOperationGroupMaster(0);'>" + CHK_Common.getMsg('all') + '</a></dt></dl>');
$('#category-menu').append(noCategory);
//create category(operationGroupMaster) structure
......@@ -316,17 +331,19 @@ CHK_OL.changeSortType = function (sortType) {
$('.sort-type').removeClass('active');
$(sortType).addClass('active');
CHK_OL.sortIndex = $(sortType).attr('data-sort');
CHK_OL.sortOperationList(sortType);
const sortStr = sortType.dataset.sort;
const sortNumber = parseFloat(sortStr);
CHK_OL.sortOperationList(sortNumber);
CHK_OL.createOperationList(CHK_OL.operationList);
};
/**
* sort the operationList
*
* @param {Number} sortType
* @param {Number} sortNumber
*/
CHK_OL.sortOperationList = function (sortType) {
switch (sortType) {
CHK_OL.sortOperationList = function (sortNumber) {
switch (sortNumber) {
case CHK_CONSTANT.SORT_TYPE.NAME:
CHK_OL.operationList.sort(function (a, b) {
if (a.operationName > b.operationName) return 1;
......@@ -336,15 +353,15 @@ CHK_OL.sortOperationList = function (sortType) {
break;
case CHK_CONSTANT.SORT_TYPE.START_DATE_DESC:
CHK_OL.operationList.sort(function (a, b) {
if (setOperationDate(a.operationStartDate) < setOperationDate(b.operationStartDate)) return 1;
if (setOperationDate(a.operationStartDate) > setOperationDate(b.operationStartDate)) return -1;
if (CHK_OL.setOperationDate(a.operationStartDate) < CHK_OL.setOperationDate(b.operationStartDate)) return 1;
if (CHK_OL.setOperationDate(a.operationStartDate) > CHK_OL.setOperationDate(b.operationStartDate)) return -1;
return 0;
});
break;
case CHK_CONSTANT.SORT_TYPE.START_DATE_ASC:
CHK_OL.operationList.sort(function (a, b) {
if (setOperationDate(a.operationStartDate) > setOperationDate(b.operationStartDate)) return 1;
if (setOperationDate(a.operationStartDate) < setOperationDate(b.operationStartDate)) return -1;
if (CHK_OL.setOperationDate(a.operationStartDate) > CHK_OL.setOperationDate(b.operationStartDate)) return 1;
if (CHK_OL.setOperationDate(a.operationStartDate) < CHK_OL.setOperationDate(b.operationStartDate)) return -1;
return 0;
});
break;
......@@ -389,6 +406,7 @@ CHK_OL.search = function () {
CHK_OL.getAllDataWeb(searchKeyword, CHK_OL.sortIndex, searchStartDate, searchEndDate, CHK_OL.operationGroupMasterId);
CHK_OL.createOperationList(CHK_OL.operationList);
CHK_OL.createCategory();
CHK_Common.closeLoading();
};
......
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