Commit 3f504368 by Yujin Seo

Merge branch 'feature/1.4.0_miura' into feature/1.4.0_seo

parents a3bfa2ad c73738db
......@@ -57,4 +57,8 @@ CHK_iOS.searchOperationList = function (searchKeyword, searchStartDate, searchEn
})
);
};
CHK_iOS.getSortType = function () {
return parseInt(callNativeApp(NATIVE_KEY_IOS.getSortType, {}));
}
\ No newline at end of file
......@@ -173,7 +173,8 @@ const NATIVE_KEY_IOS = {
getOperationGroupMasterListJson: "getOperationGroupMasterListJson",
getOperationGroupMasterRelationListJson: "getOperationGroupMasterRelationListJson",
getPushMessageListJson: "getPushMessageListJson",
searchOperationList: "searchOperationList"
searchOperationList: "searchOperationList",
getSortType: "getSortType"
};
// レポートファイル保存タイプ
CHK.REPORT_SAVE_TYPE = {
......@@ -384,6 +385,7 @@ CHK.initReport = function(callback) {
*/
CHK.initReportApp = function (callback) {
CHK.isSearched = false;
CHK.operationGroupMasterId = 0;
// 作業一覧JSONデータ
CHK.loadJson(CHK.jsonPath.operationList, function (json) {
CHK.operation = json;
......@@ -2792,6 +2794,26 @@ CHK.createCategory = function(operationGroupMasterList) {
};
/**
* 保存したsortTypeから作業一覧を描画
*/
CHK.createOperationListBySavedSortType = function() {
let sortIndex = CHK_CONSTANT.SORT_TYPE.START_DATE_ASC;
if (CHK.isIOS) {
sortIndex = CHK_iOS.getSortType();
} else if (CHK.isAndroid) {
// TODO: 端末に保存したsortTypeを取得
}
let sortType = document.getElementsByClassName("sort-type")[sortIndex];
CHK.changeSortType(sortType);
}
CHK.changeSortType = function(sortType) {
$(".sort-type").removeClass("active");
$(sortType).addClass("active");
CHK.createOperationList(CHK.operation.operationList, true);
}
/**
* 作業一覧描画
*/
CHK.createOperationList = function(operationList, isSearched = false) {
......@@ -2801,6 +2823,13 @@ CHK.createOperationList = function(operationList, isSearched = false) {
}
if (operationList.length > 1) {
var sortType = $(".sort-type.active").data("sort");
if (isSearched) {
if (CHK.isIOS) {
webkit.messageHandlers.saveSortType.postMessage(sortType);
} else if (CHK.isAndroid) {
// TODO: sortTypeを端末に保存
}
}
switch(sortType) {
case CHK_CONSTANT.SORT_TYPE.NAME:
console.log(sortType);
......@@ -2870,18 +2899,27 @@ CHK.search = function() {
CHK.isSearched = true;
CHK.operation.searchOperationList = searchResult.operationList;
CHK.createOperationList(searchResult.operationList);
// TODO: カテゴリの保存
} else if (CHK.isIOS) {
searchResult = CHK_iOS.searchOperationList(searchKeyword, searchStartDate, searchEndDate, CHK.operationGroupMasterId);
CHK.isSearched = true;
CHK.operation.searchOperationList = searchResult.operationList;
CHK.createOperationList(searchResult.operationList);
webkit.messageHandlers.saveOperationGroupMaster.postMessage(CHK.operationGroupMasterId);
let searchButtonTaped = searchKeyword != "" || searchStartDate != "" || searchEndDate != "";
if (searchButtonTaped) {
webkit.messageHandlers.showSearchResultToast.postMessage(searchResult.operationList.length);
}
}
};
CHK.changeSortType = function(sortType) {
$(".sort-type").removeClass("active");
$(sortType).addClass("active");
CHK.createOperationList(CHK.operation.operationList, true);
/**
* 検索条件をセット
*/
CHK.setSearchInfo = function(taskName, startDate, endDate) {
$("#searchTaskName").val(taskName);
$("#searchStartDate").val(startDate);
$("#searchEndDate").val(endDate);
}
// カテゴリーのドロワーメニュー開閉
......
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