diff --git a/modules/visa/Views/signatureBook.html b/modules/visa/Views/signatureBook.html index 36f3ddbd5df1addd88816e6708f11a48727fa74a..575a394bdd8e7aa2df27349499a935387d997ab8 100644 --- a/modules/visa/Views/signatureBook.html +++ b/modules/visa/Views/signatureBook.html @@ -52,13 +52,12 @@ </div> </div> </div> - </div> <div class="hideresListContent" ng-click="displayPanel('RESLEFT')" ng-if="signatureBook.showLeftPanel"> <i class="fa fa-chevron-left" aria-hidden="true" ng-if="signatureBook.showResLeftPanel"></i> <i class="fa fa-chevron-right" aria-hidden="true" ng-if="!signatureBook.showResLeftPanel"></i> </div> - <div class="contentLeft" ng-if="signatureBook.showLeftPanel" ng-class="{'showResLeftPanel': signatureBook.showResLeftPanel, 'hideResLeftPanel': !signatureBook.showResLeftPanel}"> + <div class="contentLeft" ng-if="signatureBook.showLeftPanel" > <div class="contentShow" ng-if="signatureBook.headerTab == 1"> <div class="pjDoc"> <div ng-click="displayPanel('TOPLEFT')" ng-if="!signatureBook.showTopLeftPanel" style="padding: 5px;cursor:pointer;"> @@ -121,7 +120,7 @@ <i class="fa fa-chevron-left" aria-hidden="true" ng-if="signatureBook.showLeftPanel"></i> <i class="fa fa-chevron-right" aria-hidden="true" ng-if="!signatureBook.showLeftPanel"></i> </div> - <div class="contentRight" ng-class="{'showLeftPanel': signatureBook.showLeftPanel, 'hideLeftPanel': !signatureBook.showLeftPanel}"> + <div class="contentRight"> <div class="contentShow" ng-if="!signatureBook.showAttachmentEditionPanel"> <div class="pjDetails"> <div class="infoPj" title="{{signatureBook.attachments[signatureBook.rightSelectedThumbnail].attachment_type}}"> @@ -237,18 +236,18 @@ </div> </div> - <div class="panelRight"> - <div class="item panelRightAddPj" ng-click="changeRightViewer(-1)" ng-class="{'panelSelectedThumbnail': signatureBook.rightSelectedThumbnail == -1}"> - <i class="fa fa-plus fa-2x"></i> - </div> - <div class="panelRightContent"> - <div class="item" ng-repeat="(index, attachment) in signatureBook.attachments" ng-click="changeRightViewer(index)" ng-class="{'panelSelectedThumbnail': index == signatureBook.rightSelectedThumbnail}"> - <span class="fa-stack fa-lg"> - <i class="fa fa-file-o fa-stack-2x"></i><i class="fa {{attachment.icon}} fa-stack-1x"></i> - </span> - </div> + <div class="panelRight"> + <div class="item panelRightAddPj" ng-click="changeRightViewer(-1)" ng-class="{'panelSelectedThumbnail': signatureBook.rightSelectedThumbnail == -1}"> + <i class="fa fa-plus fa-2x"></i> + </div> + <div class="panelRightContent"> + <div class="item" ng-repeat="(index, attachment) in signatureBook.attachments" ng-click="changeRightViewer(index)" ng-class="{'panelSelectedThumbnail': index == signatureBook.rightSelectedThumbnail}"> + <span class="fa-stack fa-lg"> + <i class="fa fa-file-o fa-stack-2x"></i><i class="fa {{attachment.icon}} fa-stack-1x"></i> + </span> </div> </div> + </div> </div> </div> diff --git a/modules/visa/css/module.css b/modules/visa/css/module.css index 795bad850cf46aaf0059d0887486d744f5ea2d4f..261a2bd50d52a6efc458fb41642a2ef018271b74 100644 --- a/modules/visa/css/module.css +++ b/modules/visa/css/module.css @@ -738,18 +738,18 @@ box-shadow: inset 0px 0px 5px 0px #656565; transition: height 0.5s; } -.showResLeftPanel.contentLeft,.showResLeftPanel.contentRight{ - width:39%; -} +/*.showResLeftPanel.contentLeft,.showResLeftPanel.contentRight{*/ + /*width:39%;*/ +/*}*/ -.hideResLeftPanel.contentLeft,.hideResLeftPanel.contentRight{ - width:46.5%; -} +/*.hideResLeftPanel.contentLeft,.hideResLeftPanel.contentRight{*/ + /*width:46.5%;*/ +/*}*/ -.hideLeftPanel.contentRight{ - width:93%; -} +/*.hideLeftPanel.contentRight{*/ + /*width:93%;*/ +/*}*/ -.showLeftPanel.contentRight{ - width:46.5%; -} \ No newline at end of file +/*.showLeftPanel.contentRight{*/ + /*width:46.5%;*/ +/*}*/ \ No newline at end of file diff --git a/modules/visa/js/aController.js b/modules/visa/js/aController.js index 3df21eb36943ddd89aafa68edfe7050e38e29634..d3a268ed519d5f4e8d1a54a03cd86b171890b3c1 100644 --- a/modules/visa/js/aController.js +++ b/modules/visa/js/aController.js @@ -1,206 +1,208 @@ "use strict"; mainApp.controller("visaCtrl", ["$scope", "$http", "$routeParams", "$interval", "NgTableParams", "$location", - function($scope, $http, $routeParams, $interval, NgTableParams, $location) { + function($scope, $http, $routeParams, $interval, NgTableParams, $location) { var vm = this; function prepareSignatureBook() { - if (typeof globalConfig == "undefined") { - InitializeJsGlobalConfig(); - } - - $j('#inner_content').remove(); - $j('#header').remove(); - $j('#viewBasketsTitle').remove(); - $j('#homePageWelcomeTitle').remove(); - $j('#footer').remove(); - $j('#container').width("98%"); + if (typeof globalConfig == "undefined") { + InitializeJsGlobalConfig(); + } + + $j('#inner_content').remove(); + $j('#header').remove(); + $j('#viewBasketsTitle').remove(); + $j('#homePageWelcomeTitle').remove(); + $j('#footer').remove(); + $j('#container').width("98%"); } function getDatas(basketId, resId) { - prepareSignatureBook(); - - $http({ - method : 'GET', - url : globalConfig.coreurl + 'rest/' + basketId + '/signatureBook/' + resId, - headers: {'Content-Type': 'application/x-www-form-urlencoded'} - }).then(function successCallback(response) { - - $scope.signatureBook = response.data; - $scope.signatureBook.rightSelectedThumbnail = 0; - $scope.signatureBook.leftSelectedThumbnail = 0; - if ($scope.signatureBook.attachments[0]) { - $scope.signatureBook.rightViewerLink = $scope.signatureBook.attachments[0].viewerLink; - } - if ($scope.signatureBook.documents[0]) { - $scope.signatureBook.leftViewerLink = $scope.signatureBook.documents[0].viewerLink; - } - $scope.signatureBook.headerTab = 1; - $scope.signatureBook.showTopRightPanel = false; - $scope.signatureBook.showTopLeftPanel = false; - $scope.signatureBook.showResLeftPanel = false; - $scope.signatureBook.showLeftPanel = true; - $scope.signatureBook.showAttachmentEditionPanel = false; - - $scope.historyTable = new NgTableParams({ - page: 1, - count: 20, - sorting: { - event_date: 'desc' - } - }, { - total: $scope.signatureBook.histories.length, - dataset: $scope.signatureBook.histories - }); - - $scope.notesTable = new NgTableParams({ - page: 1, - count: 20, - sorting: { - date_note: 'desc' - } - }, { - total: $scope.signatureBook.notes.length, - dataset: $scope.signatureBook.notes - }); - - }, function errorCallback(error) { - }); + prepareSignatureBook(); + + $http({ + method : 'GET', + url : globalConfig.coreurl + 'rest/' + basketId + '/signatureBook/' + resId, + headers: {'Content-Type': 'application/x-www-form-urlencoded'} + }).then(function successCallback(response) { + + $scope.signatureBook = response.data; + $scope.signatureBook.rightSelectedThumbnail = 0; + $scope.signatureBook.leftSelectedThumbnail = 0; + if ($scope.signatureBook.attachments[0]) { + $scope.signatureBook.rightViewerLink = $scope.signatureBook.attachments[0].viewerLink; + } + if ($scope.signatureBook.documents[0]) { + $scope.signatureBook.leftViewerLink = $scope.signatureBook.documents[0].viewerLink; + } + $scope.signatureBook.headerTab = 1; + $scope.signatureBook.showTopRightPanel = false; + $scope.signatureBook.showTopLeftPanel = false; + $scope.signatureBook.showResLeftPanel = false; + $scope.signatureBook.showLeftPanel = true; + $scope.signatureBook.showAttachmentEditionPanel = false; + + $scope.historyTable = new NgTableParams({ + page: 1, + count: 20, + sorting: { + event_date: 'desc' + } + }, { + total: $scope.signatureBook.histories.length, + dataset: $scope.signatureBook.histories + }); + + $scope.notesTable = new NgTableParams({ + page: 1, + count: 20, + sorting: { + date_note: 'desc' + } + }, { + total: $scope.signatureBook.notes.length, + dataset: $scope.signatureBook.notes + }); + + }, function errorCallback(error) { + }); } $scope.changeSignatureBookLeftContent = function(id) { - $scope.signatureBook.headerTab = id; - $scope.signatureBook.showTopLeftPanel = false; + $scope.signatureBook.headerTab = id; + $scope.signatureBook.showTopLeftPanel = false; }; $scope.changeRightViewer = function(index) { - if (index < 0) { - $scope.signatureBook.showAttachmentEditionPanel = true; - } else { - $scope.signatureBook.rightViewerLink = $scope.signatureBook.attachments[index].viewerLink; - $scope.signatureBook.showAttachmentEditionPanel = false; - } - $scope.signatureBook.rightSelectedThumbnail = index; + if (index < 0) { + $scope.signatureBook.showAttachmentEditionPanel = true; + } else { + $scope.signatureBook.rightViewerLink = $scope.signatureBook.attachments[index].viewerLink; + $scope.signatureBook.showAttachmentEditionPanel = false; + } + $scope.signatureBook.rightSelectedThumbnail = index; }; $scope.changeLeftViewer = function(index) { - $scope.signatureBook.leftViewerLink = $scope.signatureBook.documents[index].viewerLink; - $scope.signatureBook.leftSelectedThumbnail = index; + $scope.signatureBook.leftViewerLink = $scope.signatureBook.documents[index].viewerLink; + $scope.signatureBook.leftSelectedThumbnail = index; }; $scope.displayPanel = function(panel) { - if (panel == "TOPRIGHT") { - $scope.signatureBook.showTopRightPanel = !$scope.signatureBook.showTopRightPanel; - $scope.signatureBook.showTopRightPanel == true ? $j(".pjDetails").css("height", "100px") : $j(".pjDetails").css("height", "30px"); - $scope.signatureBook.showTopRightPanel == true ? $j("#rightPanelShowDocumentIframe").css("height", "69vh") : $j("#rightPanelShowDocumentIframe").css("height", "75vh"); - } else if (panel == "TOPLEFT") { - $scope.signatureBook.showTopLeftPanel = !$scope.signatureBook.showTopLeftPanel; - $scope.signatureBook.showTopLeftPanel == true ? $j(".pjDoc").css("height", "100px") : $j(".pjDoc").css("height", "30px"); - $scope.signatureBook.showTopLeftPanel == true ? $j("#leftPanelShowDocumentIframe").css("height", "69vh") : $j("#leftPanelShowDocumentIframe").css("height", "75vh"); - } else if (panel == "LEFT") { - $scope.signatureBook.showLeftPanel = !$scope.signatureBook.showLeftPanel; - $scope.signatureBook.showResLeftPanel = false; - } else if (panel == "RESLEFT") { - $scope.signatureBook.showResLeftPanel = !$scope.signatureBook.showResLeftPanel; - } - }; + if (panel == "TOPRIGHT") { + $scope.signatureBook.showTopRightPanel = !$scope.signatureBook.showTopRightPanel; + $scope.signatureBook.showTopRightPanel == true ? $j(".pjDetails").css("height", "100px") : $j(".pjDetails").css("height", "30px"); + $scope.signatureBook.showTopRightPanel == true ? $j("#rightPanelShowDocumentIframe").css("height", "69vh") : $j("#rightPanelShowDocumentIframe").css("height", "75vh"); + } else if (panel == "TOPLEFT") { + $scope.signatureBook.showTopLeftPanel = !$scope.signatureBook.showTopLeftPanel; + $scope.signatureBook.showTopLeftPanel == true ? $j(".pjDoc").css("height", "100px") : $j(".pjDoc").css("height", "30px"); + $scope.signatureBook.showTopLeftPanel == true ? $j("#leftPanelShowDocumentIframe").css("height", "69vh") : $j("#leftPanelShowDocumentIframe").css("height", "75vh"); + } else if (panel == "LEFT") { + $scope.signatureBook.showLeftPanel = !$scope.signatureBook.showLeftPanel; + $scope.signatureBook.showResLeftPanel = false; + } else if (panel == "RESLEFT") { + $scope.signatureBook.showResLeftPanel = !$scope.signatureBook.showResLeftPanel; + $scope.signatureBook.showTopLeftPanel == true ? $j(".pjDoc").css("height", "100px") : $j(".pjDoc").css("height", "30px"); + + } + }; vm.prepareSignFile = function(attachment) { - if (attachment.res_id == 0) { - signatureBookSignFile(attachment.res_id_version, 1); - } else if (attachment.res_id_version == 0) { - signatureBookSignFile(attachment.res_id, 0); - } + if (attachment.res_id == 0) { + signatureBookSignFile(attachment.res_id_version, 1); + } else if (attachment.res_id_version == 0) { + signatureBookSignFile(attachment.res_id, 0); + } }; function signatureBookSignFile(resId, type) { - var path = ''; - - if (type == 0) { - path = 'index.php?display=true&module=visa&page=sign_file&collId=letterbox_coll&resIdMaster=' + vm.resId + '&id=' + resId; - } else if (type == 1) { - path = 'index.php?display=true&module=visa&page=sign_file&collId=letterbox_coll&isVersion&resIdMaster=' + vm.resId + '&id=' + resId; - } else if (type == 2) { - path = 'index.php?display=true&module=visa&page=sign_file&collId=letterbox_coll&isOutgoing&resIdMaster=' + vm.resId + '&id=' + resId; - } - - $http({ - method : 'GET', - url : path, - headers: {'Content-Type': 'application/x-www-form-urlencoded'} - }).then(function successCallback(response) { - - if (response.data.status == 0) { - $scope.signatureBook.rightViewerLink = "index.php?display=true&module=visa&page=view_pdf_attachement&res_id_master=" + vm.resId + "&id=" + response.data.new_id; - $scope.signatureBook.attachments[$scope.signatureBook.rightSelectedThumbnail].viewerLink = $scope.signatureBook.rightViewerLink; - $scope.signatureBook.attachments[$scope.signatureBook.rightSelectedThumbnail].status = 'SIGN'; - } else { - alert(response.data.error); + var path = ''; + + if (type == 0) { + path = 'index.php?display=true&module=visa&page=sign_file&collId=letterbox_coll&resIdMaster=' + vm.resId + '&id=' + resId; + } else if (type == 1) { + path = 'index.php?display=true&module=visa&page=sign_file&collId=letterbox_coll&isVersion&resIdMaster=' + vm.resId + '&id=' + resId; + } else if (type == 2) { + path = 'index.php?display=true&module=visa&page=sign_file&collId=letterbox_coll&isOutgoing&resIdMaster=' + vm.resId + '&id=' + resId; } - }, function errorCallback(error) { - }); + $http({ + method : 'GET', + url : path, + headers: {'Content-Type': 'application/x-www-form-urlencoded'} + }).then(function successCallback(response) { + + if (response.data.status == 0) { + $scope.signatureBook.rightViewerLink = "index.php?display=true&module=visa&page=view_pdf_attachement&res_id_master=" + vm.resId + "&id=" + response.data.new_id; + $scope.signatureBook.attachments[$scope.signatureBook.rightSelectedThumbnail].viewerLink = $scope.signatureBook.rightViewerLink; + $scope.signatureBook.attachments[$scope.signatureBook.rightSelectedThumbnail].status = 'SIGN'; + } else { + alert(response.data.error); + } + + }, function errorCallback(error) { + }); } vm.unsignFile = function(attachment) { - var collId; - var resId; - if (attachment.res_id == 0) { - resId = attachment.res_id_version; - collId = "res_version_attachments"; - } else if (attachment.res_id_version == 0) { - resId = attachment.res_id; - collId = "res_attachments"; - } - - $http({ - method : 'PUT', - url : globalConfig.coreurl + 'rest/' + collId + '/' + resId + '/unsign', - headers: {'Content-Type': 'application/x-www-form-urlencoded'} - }).then(function successCallback(response) { - - if (response.data.status == "OK") { - $scope.signatureBook.rightViewerLink = "index.php?display=true&module=visa&page=view_pdf_attachement&res_id_master=" + vm.resId + "&id=" + resId; - $scope.signatureBook.attachments[$scope.signatureBook.rightSelectedThumbnail].viewerLink = $scope.signatureBook.rightViewerLink; - $scope.signatureBook.attachments[$scope.signatureBook.rightSelectedThumbnail].status = 'A_TRA'; - } else { - alert(response.data.error); + var collId; + var resId; + if (attachment.res_id == 0) { + resId = attachment.res_id_version; + collId = "res_version_attachments"; + } else if (attachment.res_id_version == 0) { + resId = attachment.res_id; + collId = "res_attachments"; } - }, function errorCallback(error) { - }); + $http({ + method : 'PUT', + url : globalConfig.coreurl + 'rest/' + collId + '/' + resId + '/unsign', + headers: {'Content-Type': 'application/x-www-form-urlencoded'} + }).then(function successCallback(response) { + + if (response.data.status == "OK") { + $scope.signatureBook.rightViewerLink = "index.php?display=true&module=visa&page=view_pdf_attachement&res_id_master=" + vm.resId + "&id=" + resId; + $scope.signatureBook.attachments[$scope.signatureBook.rightSelectedThumbnail].viewerLink = $scope.signatureBook.rightViewerLink; + $scope.signatureBook.attachments[$scope.signatureBook.rightSelectedThumbnail].status = 'A_TRA'; + } else { + alert(response.data.error); + } + + }, function errorCallback(error) { + }); }; $scope.backToBasket = function() { - location.hash = ""; - location.reload(); + location.hash = ""; + location.reload(); }; $scope.changeLocation = function(resId) { - $location.path(vm.basketId + "/signatureBook/" + resId); + $location.path(vm.basketId + "/signatureBook/" + resId); }; $scope.validForm = function() { - if ($j("#signatureBookActions option:selected")[0].value != "") { - //$interval.cancel(intervalPromise); - unlockDocument($routeParams.resId); - - valid_action_form( - 'empty', - 'index.php?display=true&page=manage_action&module=core', - $scope.signatureBook.currentAction.id, - $routeParams.resId, - 'res_letterbox', - 'null', - 'letterbox_coll', - 'page', - false, - [$j("#signatureBookActions option:selected")[0].value] - ); - } + if ($j("#signatureBookActions option:selected")[0].value != "") { + //$interval.cancel(intervalPromise); + unlockDocument($routeParams.resId); + + valid_action_form( + 'empty', + 'index.php?display=true&page=manage_action&module=core', + $scope.signatureBook.currentAction.id, + $routeParams.resId, + 'res_letterbox', + 'null', + 'letterbox_coll', + 'page', + false, + [$j("#signatureBookActions option:selected")[0].value] + ); + } }; @@ -211,7 +213,7 @@ mainApp.controller("visaCtrl", ["$scope", "$http", "$routeParams", "$interval", getDatas($routeParams.basketId, $routeParams.resId); lockDocument($routeParams.resId); $interval(function () { - lockDocument($routeParams.resId); + lockDocument($routeParams.resId); }, 50000); }]);