Commit a4f21958 by NGO THI HONG

implement pickup js

parent 2488c6d9
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
"distanceSupportTitle":"DistanceSupport", "distanceSupportTitle":"DistanceSupport",
"chatTitle":"Chat", "chatTitle":"Chat",
"makeDashboardAsHome":"Make dashboard your home screen", "makeDashboardAsHome":"Make dashboard your home screen",
"btnKeep":"Keep" "btnKeep":"Keep",
"addNew":"Add New",
"display":" display",
"displayPattern":"Display Pattern"
} }
\ No newline at end of file
...@@ -53,5 +53,8 @@ ...@@ -53,5 +53,8 @@
"distanceSupportTitle":"遠隔支援", "distanceSupportTitle":"遠隔支援",
"chatTitle":"チャット", "chatTitle":"チャット",
"makeDashboardAsHome":"ダッシュボードをホーム画面にする", "makeDashboardAsHome":"ダッシュボードをホーム画面にする",
"btnKeep":"保存" "btnKeep":"保存",
"addNew":"新規追加",
"display":" 件表示",
"displayPattern":"件表示パターン"
} }
\ No newline at end of file
...@@ -53,5 +53,8 @@ ...@@ -53,5 +53,8 @@
"distanceSupportTitle":"DistanceSupport", "distanceSupportTitle":"DistanceSupport",
"chatTitle":"Chat", "chatTitle":"Chat",
"makeDashboardAsHome":"Make dashboard your home screen", "makeDashboardAsHome":"Make dashboard your home screen",
"btnKeep":"Keep" "btnKeep":"Keep",
"addNew":"Add New",
"display":" display",
"displayPattern":"Display Pattern"
} }
\ No newline at end of file
...@@ -15,49 +15,57 @@ ...@@ -15,49 +15,57 @@
<!-- vender css --> <!-- vender css -->
<link rel="stylesheet" type="text/css" href="../common/css/newdash/fontawesome_relative_path.css"> <link rel="stylesheet" type="text/css" href="../common/css/newdash/fontawesome_relative_path.css">
<script type="text/javascript" src="/abvw/common/js/jquery/jquery-3.6.0.min.js?__UPDATEID__"></script>
<script type="text/javascript" src="/abvw/common/js/jquery/jquery-ui.min.js?__UPDATEID__"></script>
<script type="text/javascript" src="/abvw/common/js/web/i18n.js?__UPDATEID__"></script>
<script type="text/javascript" src="../common/js/newdash/app.js"></script>
<script type="text/javascript" src="../common/js/newdash/common.js"></script>
<script src="../common/js/constant.js?__UPDATEID__"></script>
<script src="../common/js/common.js?__UPDATEID__"></script>
<!-- main js --> <!-- main js -->
<script type="text/javascript" src="../js/dashboardSetting/dashboard-setting.js"></script>
<script type="text/javascript" src="../js/dashboard/dashboard.js"></script>
<script type="text/javascript" src="../js/template/template.js"></script>
<script type="text/javascript" src="../js/pickup/pickup.js"></script> <script type="text/javascript" src="../js/pickup/pickup.js"></script>
</head> </head>
<body onload="PICKUP.init();"> <body onload="PICKUP.init();">
<!-- header --> <!-- header -->
<?php include('common/header.html');?> <!-- <?php include('common/header.html');?> -->
<div id="includedHeader"></div>
<!-- pickup --> <!-- pickup -->
<main> <main>
<div class="container"> <div class="container">
<!-- breadcrumb --> <!-- breadcrumb -->
<nav aria-label="breadcrumb"> <nav aria-label="breadcrumb">
<ol class="breadcrumb px-0 mb-0"> <ol class="breadcrumb px-0 mb-0">
<li class="breadcrumb-item"><a href="dashboard.html" class="text-decoration-none text-underline">ダッシュボード</a></li> <li class="breadcrumb-item"><a href="dashboard.html" class="text-decoration-none text-underline lang" lang="dashboard"></a></li>
<li class="breadcrumb-item active" aria-current="page"><span>ピックアップ</span></li> <li class="breadcrumb-item active lang" lang="pickup" aria-current="page"><span></span></li>
</ol> </ol>
</nav> </nav>
<!-- title --> <!-- title -->
<h1 class="fs-14 font-weight-bold pt-sm-4 pt-2 pb-3 mb-0">ピックアップ</h1> <h1 class="fs-14 font-weight-bold pt-sm-4 pt-2 pb-3 mb-0 lang" lang="pickup"></h1>
<!-- tab --> <!-- tab -->
<ul class="nav nav-tabs line" id="myTab" role="tablist"> <ul class="nav nav-tabs line" id="myTab" role="tablist">
<li class="nav-item"> <li class="nav-item" id="liTabNewReport">
<a class="nav-link active" data-toggle="tab" href="#tab1" role="tab" aria-controls="tab1" aria-expanded="true"> <a class="nav-link active" data-toggle="tab" href="#tab1" role="tab" aria-controls="tab1" aria-expanded="true">
<div class="text-center">新規追加</div> <div class="text-center lang" lang="addNew"></div>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item" id="liTabContinousWork">
<a class="nav-link" data-toggle="tab" href="#tab2" role="tab" aria-controls="tab2"> <a class="nav-link" data-toggle="tab" href="#tab2" role="tab" aria-controls="tab2">
<div class="text-center">工程作業</div> <div class="text-center lang" lang="processWorkTitle"></div>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item" id="liTabReportWithWarning">
<a class="nav-link" data-toggle="tab" href="#tab3" role="tab" aria-controls="tab3"> <a class="nav-link" data-toggle="tab" href="#tab3" role="tab" aria-controls="tab3">
<div class="text-center">警告を含む報告</div> <div class="text-center lang" lang="reportWarningTitle"></div>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#tab4" role="tab" aria-controls="tab4">
<div class="text-center">0件表示パターン</div>
</a> </a>
</li> </li>
</ul> </ul>
...@@ -66,9 +74,9 @@ ...@@ -66,9 +74,9 @@
<div class="tab-content" id="myTabContent"> <div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="tab1" role="tabpanel" aria-labelledby="1-tab"> <div class="tab-pane fade show active" id="tab1" role="tabpanel" aria-labelledby="1-tab">
<!-- view menu --> <!-- view menu -->
<nav aria-label="view" class="view-menu mt-2"> <nav aria-label="view" class="view-menu mt-2" id="viewMenuNewReport">
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div class="fs-9">20<span>件表示</span></div> <div class="fs-9" id="count-NewReport"></div>
<div class="view"> <div class="view">
<a href="#" class="text-decoration-none view-btn view-list-btn"> <a href="#" class="text-decoration-none view-btn view-list-btn">
<img src="../common/img/icon_view_list.svg" alt="リスト表示" class="list-block-icon mx-1" data-toggle="tooltip" data-placement="bottom" title="リスト表示"> <img src="../common/img/icon_view_list.svg" alt="リスト表示" class="list-block-icon mx-1" data-toggle="tooltip" data-placement="bottom" title="リスト表示">
...@@ -80,17 +88,8 @@ ...@@ -80,17 +88,8 @@
</div> </div>
</nav> </nav>
<!-- task list --> <!-- task list -->
<ul class="p-0 mt-3 card-list task-list view-content view-block"> <ul class="p-0 mt-3 card-list task-list view-content view-block" id="newReport-list">
<li class="card mb-2">
<a href="#" class="d-block px-3 py-3 text-decoration-none text-dark">
<div class="fs-12 text-truncate">作業名が入ります。</div>
</a>
</li>
<li class="card mb-2">
<a href="#" class="d-block px-3 py-3 text-decoration-none text-dark">
<div class="fs-12 text-truncate">作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。</div>
</a>
</li>
</ul> </ul>
</div> </div>
<!-- proccess --> <!-- proccess -->
...@@ -261,11 +260,12 @@ ...@@ -261,11 +260,12 @@
</main> </main>
<!-- confirm --> <!-- confirm -->
<?php include('common/confirm-modal.html');?> <!-- <?php include('common/confirm-modal.html');?> -->
<div id="includedConfirmModal"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript" src="../common/js/app.js"></script> <script type="text/javascript" src="../common/js/app.js"></script>
<script type="text/javascript" src="../common/js/common.js"></script> <script type="text/javascript" src="../common/js/common.js"></script> -->
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -14,56 +14,112 @@ PICKUP.initCommon = function() { ...@@ -14,56 +14,112 @@ PICKUP.initCommon = function() {
PICKUP.countNewReportList = 0; PICKUP.countNewReportList = 0;
PICKUP.countContinousWorkReport = 0; PICKUP.countContinousWorkReport = 0;
PICKUP.countReportWithWarning = 0; PICKUP.countReportWithWarning = 0;
PICKUP.newReportList = {list_0: []}; }
PICKUP.continousWorkReport = {list_0: []};
PICKUP.reportWithWarning = {list_0: []};
PICKUP.defaultPickupList = {
operationList:[]
} }
PICKUP.init = function() { PICKUP.baseApiUrl = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.API.BASE + 'pickup/';
console.log("PICKUP.init"); PICKUP.getNewReportListApiUrl = PICKUP.baseApiUrl + 'newReportList';
CHK.initCommon(); PICKUP.getContinuousWorkListApiUrl = PICKUP.baseApiUrl + 'continuousWorkList';
$("#footer").load("main-footer.html", function() { PICKUP.getReportWithWarningsListApiUrl = PICKUP.baseApiUrl + 'reportWithWarnings';
CHK_Footer.activeDashboardBottomNav();
/**
* Call get new report list api get data
*/
PICKUP.getNewreportListData = function (callback) {
let param = {
sid: COMMON.getSid(),
};
COMMON.cmsAjax(PICKUP.getNewReportListApiUrl, param, false, function (json) {
if (callback) {
callback(json);
}
}, function() {
console.log('DASHBOARD.getNewreportListData error');
if (callback) {
callback(PICKUP.defaultPickupList);
}
}); });
};
if(CHK.operation == null || typeof CHK.operation === 'undefined') /**
{ * Call get Continuous Work list api get data
CHK.loadJson(CHK.jsonPath.operationList, function (json) { * @param {*} callback
CHK.operation = json; */
PICKUP.initOperationList(CHK.operation.operationList); PICKUP.getContinuousWorkListData = function (callback) {
let param = {
sid: COMMON.getSid(),
};
COMMON.cmsAjax(PICKUP.getContinuousWorkListApiUrl, param, false, function (json) {
if (callback) {
callback(json);
}
}, function() {
console.log('DASHBOARD.getContinuousWorkListData error');
if (callback) {
callback(PICKUP.defaultPickupList);
}
}); });
PICKUP.settingPickup(); };
PICKUP.initSettingActivePickup();
return; /**
* Call get Report With Warnings list api get data
* @param {*} callback
*/
PICKUP.getReportWithWarningsListData = function (callback) {
let param = {
sid: COMMON.getSid(),
};
COMMON.cmsAjax(PICKUP.getReportWithWarningsListApiUrl, param, false, function (json) {
if (callback) {
callback(json);
} }
PICKUP.initOperationList(CHK.operation.operationList); }, function() {
console.log('DASHBOARD.getReportWithWarningListData error');
if (callback) {
callback(PICKUP.defaultPickupList);
}
});
};
/**
* Initialization pickup html
*/
PICKUP.init = function() {
console.log("PICKUP.init");
TEMPLATE.loadHearder();
TEMPLATE.loadConfirmModal();
PICKUP.settingPickup(); PICKUP.settingPickup();
PICKUP.initSettingActivePickup();
} }
/**
PICKUP.initOperationList = function(operationList) { * Setting pickup data
PICKUP.createNewReportList(operationList); */
PICKUP.createContinousWorkList(operationList);
PICKUP.createReportWithWarning(operationList);
PICKUP.setCountElementInPickup();
}
PICKUP.settingPickup = function() { PICKUP.settingPickup = function() {
DashboardSetting.getSettingData(function (settings) {
CHK.loadDashboardSetting(function() { if(!settings.newReport)
if(!CHK.dashboardSetting.newReport)
{ {
$("#liTabNewReport").css("display","none"); $("#liTabNewReport").addClass('d-none');
} }
if(!CHK.dashboardSetting.continousWork) else
{ {
$("#liTabContinousWork").css("display","none"); $("#liTabNewReport").removeClass('d-none');
PICKUP.initNewReportTab();
} }
if(!CHK.dashboardSetting.reportWarning) if(!settings.continousWork)
{ {
$("#liTabReportWithWarning").css("display","none"); $("#liTabContinousWork").addClass('d-none');
}
else
{
$("#liTabContinousWork").removeClass('d-none');
}
if(!settings.reportWarning)
{
$("#liTabReportWithWarning").addClass('d-none');
}
else
{
$("#liTabReportWithWarning").removeClass('d-none');
} }
}); });
} }
...@@ -107,24 +163,45 @@ PICKUP.settingActivePickup = function(pickupActive) { ...@@ -107,24 +163,45 @@ PICKUP.settingActivePickup = function(pickupActive) {
PICKUP.changeActivePickup = function(liPickupTab) { PICKUP.changeActivePickup = function(liPickupTab) {
PICKUP.settingActivePickup($(liPickupTab).attr("data-active")); PICKUP.settingActivePickup($(liPickupTab).attr("data-active"));
} }
PICKUP.goBack = function() { PICKUP.goBack = function() {
history.back(); history.back();
} }
/**
* Initialization show not found pickup item html
* @param {*} elementId
*/
PICKUP.showNotFoundPickupItem = function(elementId) {
$(elementId).removeClass();
$(elementId).addClass('p-0 mt-3 card-list');
let li = $("<li class='card mb-2 not-found'></li>");
let div = $("<div class='text-dark mb-1 px-3 py-5 text-center m-auto'></div>");
let imgdiv = $("<img src=\"../common/img/icon_not_found.svg\" alt='該当する作業がありません。' class='not-found-img mb-2'>");
let childDiv = $("<div class='fs-9 text-secondary font-weight-bold'>該当する作業がありません。</div>");
div.append(imgdiv);
div.append(childDiv);
li.append(div);
$(elementId).append(li);
}
PICKUP.setCountElementInPickup = function() { /**
console.log("setCountElementInPickup" , PICKUP.countNewReportList, PICKUP.countContinousWorkReport, PICKUP.countReportWithWarning ); * Initialization view pickup menu html
if($("#count-NewReport")) * @param {*} elementId
{ * @param {*} count
$("#count-NewReport")[0].innerHTML = PICKUP.countNewReportList; */
} PICKUP.showCountDisplayPickupItem = function(elementId, count) {
if($("#count-ContinousWork")) let span = $('<span>' + I18N.i18nText('display') +'</span>');
{ $(elementId).append(count);
$("#count-ContinousWork")[0].innerHTML = PICKUP.countContinousWorkReport; $(elementId).append(span);
} }
if($("#count-ReportWithWarning"))
{ /**
$("#count-ReportWithWarning")[0].innerHTML = PICKUP.countReportWithWarning; * Initialization new report list html
} */
PICKUP.initNewReportTab = function() {
PICKUP.getNewreportListData(function (json) {
PICKUP.createNewReportList(json.operationList);
});
} }
PICKUP.sortNewReportList = function(operationList) { PICKUP.sortNewReportList = function(operationList) {
operationList = operationList.sort(function(a,b) { operationList = operationList.sort(function(a,b) {
...@@ -134,22 +211,23 @@ PICKUP.sortNewReportList = function(operationList) { ...@@ -134,22 +211,23 @@ PICKUP.sortNewReportList = function(operationList) {
}); });
return operationList; return operationList;
} }
PICKUP.createNewReportList = function(operationListOld, isSearched = false) {
PICKUP.createNewReportList = function(operationListOld) {
var operationList = PICKUP.sortNewReportList(operationListOld); var operationList = PICKUP.sortNewReportList(operationListOld);
$('#viewMenuNewReport').removeClass('d-none');
$("#newReport-list").empty(); $("#newReport-list").empty();
PICKUP.countNewReportList = 0; PICKUP.countNewReportList = 0;
if (typeof operationList === 'undefined' || operationList.length < 1) { if (typeof operationList === 'undefined' || operationList.length < 1) {
$('#notFoundNewReport').removeClass('d-none'); PICKUP.showNotFoundPickupItem("#newReport-list");
$('#viewMenuNewReport').addClass('d-none');
return; return;
} }
$('#notFoundNewReport').addClass('d-none'); $('#newReport-list').addClass('task-list view-content view-block');
for (var i = 0; i < operationList.length; i++) { for (var i = 0; i < operationList.length; i++) {
//if(operationList[i].enableAddReport != 1 || ((operationList[i].reportType == CHK.REPORT_TYPE.WORKFLOW || operationList[i].reportType == CHK.REPORT_TYPE.WITHREPLY) && operationList[i].newReportFlg == 0) ) continue;
if (!CHK.isNewReport(operationList[i])) continue;
//TODO aタグlist.html 転移処理operationList[i].reportType == 2 && operationList[i].enableReportEdit == 0 //TODO aタグlist.html 転移処理operationList[i].reportType == 2 && operationList[i].enableReportEdit == 0
var messageli = $("<li class='item list-unstyled rounded border mb-2'name = 'operationId_" + operationList[i].operationId + "' ></li>"); var messageli = $("<li class='card mb-2' name = 'operationId_" + operationList[i].operationId + "' ></li>");
var ahrefRequiredFlg ; var ahrefRequiredFlg ;
if (operationList[i].permitCodeRequiredFlg == 1) if (operationList[i].permitCodeRequiredFlg == 1)
{ {
...@@ -159,11 +237,9 @@ PICKUP.createNewReportList = function(operationListOld, isSearched = false) { ...@@ -159,11 +237,9 @@ PICKUP.createNewReportList = function(operationListOld, isSearched = false) {
{ {
ahrefRequiredFlg = $("<a href=\"javascript:CHK_L.sendAppCommand('goOperation', '" + operationList[i].operationId + "', '" + operationList[i].contentId + " ', null ,'NEW_FORM_INPUT' ,'REPORT_LIST',null);\" class='d-block px-3 py-3 text-decoration-none text-dark'></a>"); ahrefRequiredFlg = $("<a href=\"javascript:CHK_L.sendAppCommand('goOperation', '" + operationList[i].operationId + "', '" + operationList[i].contentId + " ', null ,'NEW_FORM_INPUT' ,'REPORT_LIST',null);\" class='d-block px-3 py-3 text-decoration-none text-dark'></a>");
} }
var divTitle = $("<div class='title'>" + operationList[i].operationName + "</div>"); var divText = $("<div class='fs-12 text-truncate'>" + operationList[i].operationName + "</div>");
var iIcon = $("<i class='fas fa-chevron-right fs-12'></i>");
ahrefRequiredFlg.append(divTitle); ahrefRequiredFlg.append(divText);
ahrefRequiredFlg.append(iIcon);
messageli.append(ahrefRequiredFlg); messageli.append(ahrefRequiredFlg);
$("#newReport-list").append(messageli); $("#newReport-list").append(messageli);
...@@ -172,12 +248,13 @@ PICKUP.createNewReportList = function(operationListOld, isSearched = false) { ...@@ -172,12 +248,13 @@ PICKUP.createNewReportList = function(operationListOld, isSearched = false) {
} }
// show not found if // show not found if
if (PICKUP.countNewReportList == 0) { if (PICKUP.countNewReportList == 0) {
$('#notFoundNewReport').removeClass('d-none'); PICKUP.showNotFoundPickupItem("#newReport-list");
} $('#viewMenuNewReport').addClass('d-none');
if(CHK.isAndroid) { return;
android.hideLoading();
} }
}; PICKUP.showCountDisplayPickupItem("#count-NewReport", PICKUP.countNewReportList )
}
PICKUP.sortContinousWorkList = function(operationList) { PICKUP.sortContinousWorkList = function(operationList) {
var newOperationList = []; var newOperationList = [];
......
/**
* Header js
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var TEMPLATE = {};
/** load common data */
TEMPLATE.loadCommon = function() {
$("#includedHeader").load("../common/header.html" , function() {
I18N.initi18n();
});
$("#includedDashboardSetting").load("dashboard-setting.html", function() {
DashboardSetting.init();
I18N.initi18n();
});
$("#includedConfirmModal").load("../common/confirm-modal.html", function() {
I18N.initi18n();
});
}
TEMPLATE.loadHearder = function() {
$("#includedHeader").load("../common/header.html" , function() {
I18N.initi18n();
});
}
TEMPLATE.loadDashboardSetting = function() {
$("#includedDashboardSetting").load("dashboard-setting.html", function() {
DashboardSetting.init();
I18N.initi18n();
});
}
TEMPLATE.loadConfirmModal = function() {
$("#includedConfirmModal").load("../common/confirm-modal.html", function() {
I18N.initi18n();
});
}
\ No newline at end of file
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