Commit e783181f by NGUYEN HOANG SON

fix space of operationList js

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