Commit e783181f by NGUYEN HOANG SON

fix space of operationList js

parent 6e811ad3
......@@ -11,23 +11,23 @@
OL.operationGroupMaster; //category(operationGroupMaster) json data
OL.isOperationGroupMaster = 0; //0: category(operationGroupMaster) not exist 1: category(operationGroupMaster) exist
OL.sortIndex;
OL.operationGroupMasterId;
OL.sortIndex;
OL.operationGroupMasterId;
OL.REPORT_TYPE = {
OL.REPORT_TYPE = {
REPORTONLY: 0, //report only
INSPECT: 1, //rountine
WITHREPLY: 2, // report answer
WORKFLOW: 3 // continuous
}
}
/**
/**
* process on page load.
* 1.get all data.
* 2.show operationList.
* 3.show category(operationGroupMaster).
*/
OL.init = function () {
OL.init = function () {
console.log('OperationList start');
TEMPLATE.loadHearder("#includedHeader");
......@@ -43,9 +43,9 @@
//show category(operationGroupMaster)
OL.createCategory();
};
};
/**
/**
* get operation list all data
* 1.operation list
* 2.category(operationGroupMaster) list
......@@ -56,7 +56,7 @@
* @param {String} searchEndDate
* @param {Number} operationGroupMasterId
*/
OL.getAllDataWeb = function (searchKeyWord, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
OL.getAllDataWeb = function (searchKeyWord, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
let param = {};
param.sid = COMMON.getSid();
if (typeof searchKeyWord !== 'undefined') {
......@@ -84,9 +84,9 @@
OL.operationGroupMaster = json.operationGroupMasterList;
OL.isOperationGroupMaster = json.isOperationGroupMaster;
});
};
};
/**
/**
* Transfer search criteria to session.
* Keep value after page move.
*
......@@ -96,7 +96,7 @@
* @param {String} searchEndDate
* @param {String} operationGroupMasterId
*/
OL.saveSearchKeyWord = function (searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
OL.saveSearchKeyWord = function (searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
if (typeof searchKeyword !== 'undefined') {
sessionStorage.OL_searchKeyWord = searchKeyword;
}
......@@ -112,12 +112,12 @@
if (typeof operationGroupMasterId !== 'undefined') {
sessionStorage.OL_operationGroupMasterId = operationGroupMasterId;
}
};
};
/**
/**
* set search criteria when Initial display.
*/
OL.setSearchInfoWeb = function () {
OL.setSearchInfoWeb = function () {
if (sessionStorage.OL_sortIndex) {
OL.sortIndex = sessionStorage.OL_sortIndex;
}
......@@ -133,12 +133,12 @@
if (sessionStorage.OL_operationGroupMasterId) {
OL.operationGroupMasterId = sessionStorage.OL_operationGroupMasterId;
}
};
};
/**
/**
* create operation list
*/
OL.createOperationList = function (operationList) {
OL.createOperationList = function (operationList) {
//Initialization
OL.initActiveSortIndex();
$('#operationTable').empty();
......@@ -198,14 +198,14 @@
$('#operationTable').append(messageli);
}
};
};
/**
/**
* add color to any sorting type when sortIndex exsist
*
* @param {Number} sortIndex
*/
OL.initActiveSortIndex = function (sortIndex) {
OL.initActiveSortIndex = function (sortIndex) {
if (!sortIndex && !OL.sortIndex) {
OL.sortIndex = CONSTANT.SORT_TYPE.START_DATE_DESC;
}
......@@ -217,23 +217,23 @@
$(this).addClass('active');
}
});
};
};
/**
/**
* set date for OperationList
*
* @param {String} date
* @returns operationDate
*/
OL.setOperationDate = function (date) {
OL.setOperationDate = function (date) {
const operationDate = date.replace(/-/g, '/').substring(0, 10);
return operationDate;
};
};
/**
/**
* create category(operationGroupMaster).
*/
OL.createCategory = function () {
OL.createCategory = function () {
if (!OL.isOperationGroupMaster) {
return;
}
......@@ -242,12 +242,12 @@
OL.createBreadcrumbList();
OL.createCategoryList();
OL.acdMenu();
};
};
/**
/**
* Initial processing of category(operationGroupMaster).
*/
OL.initCategory = function () {
OL.initCategory = function () {
if (!OL.isOperationGroupMaster) {
return;
}
......@@ -257,22 +257,22 @@
$(window).resize(function () {
OL.setCategoryHeight();
});
};
};
/**
/**
* change height category(operationGroupMaster)
*/
OL.setCategoryHeight = function () {
OL.setCategoryHeight = function () {
const CATEGORY_HEIGHT = $('footer').offset().top - $('#category-menu').offset().top;
$('#category-menu').css('overflow', 'scroll');
$('#category-menu').height(CATEGORY_HEIGHT);
$('#overlayDiv').height(CATEGORY_HEIGHT);
};
};
/**
/**
* create Breadcrumb List
*/
OL.createBreadcrumbList = function () {
OL.createBreadcrumbList = function () {
if (!OL.isOperationGroupMaster) {
return;
}
......@@ -293,16 +293,16 @@
);
});
}
};
};
/**
/**
* create Breadcrumb tree List
*
* @param {list} treeList
* @param {string} operationGroupMasterId
* @returns
*/
OL.createBreadcrumbTree = function (treeList, operationGroupMasterId) {
OL.createBreadcrumbTree = function (treeList, operationGroupMasterId) {
if (operationGroupMasterId == 0) {
return treeList;
}
......@@ -311,12 +311,12 @@
OL.createBreadcrumbTree(treeList, groupMaster.parentOperationGroupMasterId);
treeList.push(groupMaster);
return treeList;
};
};
/**
/**
* create category(operationGroupMaster) structure
*/
OL.createCategoryList = function () {
OL.createCategoryList = function () {
if (!OL.isOperationGroupMaster) {
return;
}
......@@ -379,12 +379,12 @@
}
}
}
};
};
/**
/**
* Open/close category(operationGroupMaster) drawer menu
*/
OL.acdMenu = function () {
OL.acdMenu = function () {
//Hide accordion contents by default
$('.drawer-menu dd').css('display', 'none');
$('.drawer-menu2 ul').css('display', 'none');
......@@ -401,14 +401,14 @@
$('.sub-menu-ttl').not($(this)).not($(this).parents().siblings('p')).removeClass('openAcd').next().slideUp('fast');
$(this).toggleClass('openAcd').next().slideToggle('fast');
});
};
};
/**
/**
* Sort the operationList by screen operation
*
* @param {Object} sortType
*/
OL.changeSortType = function (sortType) {
OL.changeSortType = function (sortType) {
$('.sort-type').removeClass('active');
$(sortType).addClass('active');
OL.sortIndex = $(sortType).attr('data-sort');
......@@ -416,15 +416,15 @@
const sortNumber = parseFloat(sortStr);
OL.sortOperationList(sortNumber);
OL.createOperationList(OL.operationList);
};
};
/**
/**
* sort the operationList
*
* @param {Number} sortNumber
*/
OL.sortOperationList = function (sortNumber) {
OL.sortOperationList = function (sortNumber) {
if (!OL.operationList) {
return;
}
......@@ -473,12 +473,12 @@
});
break;
}
};
};
/**
/**
* search operarionList
*/
OL.search = function () {
OL.search = function () {
COMMON.showLoading();
const searchKeyword = $('#searchTaskName').val();
const searchStartDate = $('#searchStartDate').val();
......@@ -494,49 +494,49 @@
OL.createOperationList(OL.operationList);
OL.createCategory();
COMMON.closeLoading();
};
};
/**
/**
* change the operationList by select the category(OperationGroupMaster)
* @param {Number} operationGroupMasterId
*/
OL.changeOperationGroupMaster = function (operationGroupMasterId) {
OL.changeOperationGroupMaster = function (operationGroupMasterId) {
if ($('#category-menu').hasClass('open')) {
$('#category-toggle-button').click();
$('body').css('overflow', 'visible');
}
OL.operationGroupMasterId = operationGroupMasterId;
OL.search();
};
};
/**
/**
* open the category(OperationGroupMaster)
*/
OL.openCategory = function () {
OL.openCategory = function () {
window.scrollTo(0, 0);
if ($('#category-menu').hasClass('open')) {
$('body').css('overflow', 'visible');
} else {
$('body').css('overflow', 'hidden');
}
};
};
/**
/**
* reset search
*/
OL.resetSearch = function () {
OL.resetSearch = function () {
$('#searchTaskName').val('');
$('#searchStartDate').val('');
$('#searchEndDate').val('');
OL.changeSortType($('#defaultSort'));
};
};
/**
/**
* Transition to the report form or operation list screen
*
* @param {String} operationId
*/
OL.sendOperation = function (operationId, operationType, reportType, enableAddReport) {
OL.sendOperation = function (operationId, operationType, reportType, enableAddReport) {
//save operation logs. needed for sorting
OL.saveOperationReadingLog(operationId, operationType, reportType);
......@@ -547,16 +547,16 @@
params.returnUrl = CONSTANT.URL.WEB.BASE + CONSTANT.URL.WEB.OPERATION_LIST;
const url = OL.createUrlOfOperation(enableAddReport, reportType);
COMMON.postCommunication(url, params);
};
};
/**
/**
* save operation logs. needed for sorting
*
* @param {String} operationId
* @param {String} operationType
* @param {String} reportType
*/
OL.saveOperationReadingLog = function (operationId, operationType, reportType) {
OL.saveOperationReadingLog = function (operationId, operationType, reportType) {
let params = {};
params.sid = COMMON.getSid();
params.operationId = operationId;
......@@ -566,45 +566,45 @@
params.viewingStartDate = COMMON.currentTime();
const url = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.API.BASE + CONSTANT.URL.CMS.API.OPERATION_VIEW_LOG;
COMMON.cmsAjax(url, params, false);
};
};
/**
/**
* return url of cms Operation Scene
*
* @param {boolean} enableAddReport
* @param {Number} reportType
* @returns url
*/
OL.createUrlOfOperation = function (enableAddReport, reportType) {
OL.createUrlOfOperation = function (enableAddReport, reportType) {
let baseUrl = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.HTML.BASE;
if (reportType == CONSTANT.REPORT_TYPE.ROUTINE || enableAddReport == '1') {
return baseUrl + CONSTANT.URL.CMS.HTML.TASK_REPORT_LIST;
} else {
return baseUrl + CONSTANT.URL.CMS.HTML.LIST_REPORT_FORM;
}
};
};
/**
/**
* switch operation List to view
*/
OL.switchToViewList = function () {
OL.switchToViewList = function () {
$('.view-menu .view-list-btn').on("click", function() {
$('.view-block-btn').removeClass('active');
$('.view-list-btn').addClass('active');
$('.view-content').removeClass('view-block');
$('.view-content').addClass('view-list');
});
};
};
/**
/**
* switch operation List to grid
*/
OL.switchToGridList = function() {
OL.switchToGridList = function() {
$('.view-menu .view-block-btn').on("click", function() {
$('.view-list-btn').removeClass('active');
$('.view-block-btn').addClass('active');
$('.view-content').removeClass('view-list');
$('.view-content').addClass('view-block');
});
};
};
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