Commit a4f21958 by NGO THI HONG

implement pickup js

parent 2488c6d9
......@@ -53,6 +53,9 @@
"distanceSupportTitle":"DistanceSupport",
"chatTitle":"Chat",
"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 @@
"distanceSupportTitle":"遠隔支援",
"chatTitle":"チャット",
"makeDashboardAsHome":"ダッシュボードをホーム画面にする",
"btnKeep":"保存"
"btnKeep":"保存",
"addNew":"新規追加",
"display":" 件表示",
"displayPattern":"件表示パターン"
}
\ No newline at end of file
......@@ -53,5 +53,8 @@
"distanceSupportTitle":"DistanceSupport",
"chatTitle":"Chat",
"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 @@
<!-- vender 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 -->
<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>
</head>
<body onload="PICKUP.init();">
<!-- header -->
<?php include('common/header.html');?>
<!-- <?php include('common/header.html');?> -->
<div id="includedHeader"></div>
<!-- pickup -->
<main>
<div class="container">
<!-- breadcrumb -->
<nav aria-label="breadcrumb">
<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 active" aria-current="page"><span>ピックアップ</span></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 lang" lang="pickup" aria-current="page"><span></span></li>
</ol>
</nav>
<!-- 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 -->
<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">
<div class="text-center">新規追加</div>
<div class="text-center lang" lang="addNew"></div>
</a>
</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">
<div class="text-center">工程作業</div>
<div class="text-center lang" lang="processWorkTitle"></div>
</a>
</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">
<div class="text-center">警告を含む報告</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>
<div class="text-center lang" lang="reportWarningTitle"></div>
</a>
</li>
</ul>
......@@ -66,9 +74,9 @@
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="tab1" role="tabpanel" aria-labelledby="1-tab">
<!-- 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="fs-9">20<span>件表示</span></div>
<div class="fs-9" id="count-NewReport"></div>
<div class="view">
<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="リスト表示">
......@@ -80,17 +88,8 @@
</div>
</nav>
<!-- task list -->
<ul class="p-0 mt-3 card-list task-list view-content view-block">
<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 class="p-0 mt-3 card-list task-list view-content view-block" id="newReport-list">
</ul>
</div>
<!-- proccess -->
......@@ -261,11 +260,12 @@
</main>
<!-- 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/common.js"></script>
<script type="text/javascript" src="../common/js/common.js"></script> -->
</body>
</html>
\ No newline at end of file
......@@ -14,56 +14,112 @@ PICKUP.initCommon = function() {
PICKUP.countNewReportList = 0;
PICKUP.countContinousWorkReport = 0;
PICKUP.countReportWithWarning = 0;
PICKUP.newReportList = {list_0: []};
PICKUP.continousWorkReport = {list_0: []};
PICKUP.reportWithWarning = {list_0: []};
}
PICKUP.defaultPickupList = {
operationList:[]
}
PICKUP.init = function() {
console.log("PICKUP.init");
CHK.initCommon();
$("#footer").load("main-footer.html", function() {
CHK_Footer.activeDashboardBottomNav();
PICKUP.baseApiUrl = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.API.BASE + 'pickup/';
PICKUP.getNewReportListApiUrl = PICKUP.baseApiUrl + 'newReportList';
PICKUP.getContinuousWorkListApiUrl = PICKUP.baseApiUrl + 'continuousWorkList';
PICKUP.getReportWithWarningsListApiUrl = PICKUP.baseApiUrl + 'reportWithWarnings';
/**
* 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')
{
CHK.loadJson(CHK.jsonPath.operationList, function (json) {
CHK.operation = json;
PICKUP.initOperationList(CHK.operation.operationList);
};
/**
* Call get Continuous Work list api get data
* @param {*} callback
*/
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.initSettingActivePickup();
}
PICKUP.initOperationList = function(operationList) {
PICKUP.createNewReportList(operationList);
PICKUP.createContinousWorkList(operationList);
PICKUP.createReportWithWarning(operationList);
PICKUP.setCountElementInPickup();
}
/**
* Setting pickup data
*/
PICKUP.settingPickup = function() {
CHK.loadDashboardSetting(function() {
if(!CHK.dashboardSetting.newReport)
DashboardSetting.getSettingData(function (settings) {
if(!settings.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) {
PICKUP.changeActivePickup = function(liPickupTab) {
PICKUP.settingActivePickup($(liPickupTab).attr("data-active"));
}
PICKUP.goBack = function() {
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 );
if($("#count-NewReport"))
{
$("#count-NewReport")[0].innerHTML = PICKUP.countNewReportList;
}
if($("#count-ContinousWork"))
{
$("#count-ContinousWork")[0].innerHTML = PICKUP.countContinousWorkReport;
}
if($("#count-ReportWithWarning"))
{
$("#count-ReportWithWarning")[0].innerHTML = PICKUP.countReportWithWarning;
}
/**
* Initialization view pickup menu html
* @param {*} elementId
* @param {*} count
*/
PICKUP.showCountDisplayPickupItem = function(elementId, count) {
let span = $('<span>' + I18N.i18nText('display') +'</span>');
$(elementId).append(count);
$(elementId).append(span);
}
/**
* Initialization new report list html
*/
PICKUP.initNewReportTab = function() {
PICKUP.getNewreportListData(function (json) {
PICKUP.createNewReportList(json.operationList);
});
}
PICKUP.sortNewReportList = function(operationList) {
operationList = operationList.sort(function(a,b) {
......@@ -134,22 +211,23 @@ PICKUP.sortNewReportList = function(operationList) {
});
return operationList;
}
PICKUP.createNewReportList = function(operationListOld, isSearched = false) {
PICKUP.createNewReportList = function(operationListOld) {
var operationList = PICKUP.sortNewReportList(operationListOld);
$('#viewMenuNewReport').removeClass('d-none');
$("#newReport-list").empty();
PICKUP.countNewReportList = 0;
if (typeof operationList === 'undefined' || operationList.length < 1) {
$('#notFoundNewReport').removeClass('d-none');
PICKUP.showNotFoundPickupItem("#newReport-list");
$('#viewMenuNewReport').addClass('d-none');
return;
}
$('#notFoundNewReport').addClass('d-none');
$('#newReport-list').addClass('task-list view-content view-block');
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
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 ;
if (operationList[i].permitCodeRequiredFlg == 1)
{
......@@ -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>");
}
var divTitle = $("<div class='title'>" + operationList[i].operationName + "</div>");
var iIcon = $("<i class='fas fa-chevron-right fs-12'></i>");
var divText = $("<div class='fs-12 text-truncate'>" + operationList[i].operationName + "</div>");
ahrefRequiredFlg.append(divTitle);
ahrefRequiredFlg.append(iIcon);
ahrefRequiredFlg.append(divText);
messageli.append(ahrefRequiredFlg);
$("#newReport-list").append(messageli);
......@@ -172,12 +248,13 @@ PICKUP.createNewReportList = function(operationListOld, isSearched = false) {
}
// show not found if
if (PICKUP.countNewReportList == 0) {
$('#notFoundNewReport').removeClass('d-none');
}
if(CHK.isAndroid) {
android.hideLoading();
PICKUP.showNotFoundPickupItem("#newReport-list");
$('#viewMenuNewReport').addClass('d-none');
return;
}
};
PICKUP.showCountDisplayPickupItem("#count-NewReport", PICKUP.countNewReportList )
}
PICKUP.sortContinousWorkList = function(operationList) {
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