diff --git a/modules/notes/Models/NotesModel.php b/modules/notes/Models/NotesModel.php new file mode 100644 index 0000000000000000000000000000000000000000..35eda9611608b2cf13526a0f4ddd927ed4d99b4a --- /dev/null +++ b/modules/notes/Models/NotesModel.php @@ -0,0 +1,27 @@ +<?php + +/* +* Copyright 2015 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +require_once 'modules/notes/Models/NotesModelAbstract.php'; + +class NotesModel extends NotesModelAbstract +{ + // Do your stuff in this class +} \ No newline at end of file diff --git a/modules/notes/Models/NotesModelAbstract.php b/modules/notes/Models/NotesModelAbstract.php new file mode 100644 index 0000000000000000000000000000000000000000..6c73dd1647358821047d2e3b708967f163625950 --- /dev/null +++ b/modules/notes/Models/NotesModelAbstract.php @@ -0,0 +1,72 @@ +<?php + +/* + * Copyright 2015 Maarch + * + * This file is part of Maarch Framework. + * + * Maarch Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Maarch Framework is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. + */ + +require_once 'apps/maarch_entreprise/services/Table.php'; + +class NotesModelAbstract extends Apps_Table_Service +{ + + public static function getByResId(array $aArgs = []) + { + static::checkRequired($aArgs, ['resId']); + static::checkRequired($aArgs, ['resId']); + + //get notes + $aReturn = static::select([ + 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], + 'table' => ['notes', 'users'], + 'left_join' => ['notes.user_id = users.user_id'], + 'where' => ['notes.identifier = ?'], + 'data' => [$aArgs['resId']], + 'order_by' => empty($aArgs['orderBy']) ? ['date_note'] : $aArgs['orderBy'] + ]); + + $tmpNoteId = []; + foreach ($aReturn as $value) { + $tmpNoteId[] = $value['id']; + } + //get entities + + if (!empty($tmpNoteId)) { + $tmpEntitiesRestriction = []; + $entities = static::select([ + 'select' => ['note_id', 'item_id'], + 'table' => ['note_entities'], + 'where' => ['note_id in (?)'], + 'data' => [$tmpNoteId], + 'order_by' => ['item_id'] + ]); + + foreach ($entities as $key => $value) { + $tmpEntitiesRestriction[$value['note_id']][] = $value['item_id']; + } + } + + foreach ($aReturn as $key => $value) { + if (!empty($tmpEntitiesRestriction[$value['id']])) { + $aReturn[$key]['entities_restriction'] = implode(", ", $tmpEntitiesRestriction[$value['id']]); + } + } + + return $aReturn; + } + +} diff --git a/modules/visa/Controllers/VisaController.php b/modules/visa/Controllers/VisaController.php index 7b81608a6a5653493ef70806c6fad8c5164c95a7..b1a6cc8eae4d8c6ff8bef78651715df4d4e7d625 100644 --- a/modules/visa/Controllers/VisaController.php +++ b/modules/visa/Controllers/VisaController.php @@ -11,6 +11,7 @@ require_once 'apps/maarch_entreprise/Models/HistoryModel.php'; require_once 'apps/maarch_entreprise/Models/ContactsModel.php'; require_once 'apps/maarch_entreprise/Models/UsersModel.php'; require_once 'modules/basket/Models/BasketsModel.php'; +require_once 'modules/notes/Models/NotesModel.php'; class VisaController @@ -160,6 +161,13 @@ class VisaController 'select' => ['event_date', 'info', 'firstname', 'lastname'], 'orderBy' => ['event_date DESC'] ]); + + $notes = \NotesModel::getByResId([ + 'resId' => $resId, + 'select' => ['id','firstname','lastname','date_note', 'note_text'], + 'orderBy' => ['date_note DESC'] + ]); + $resList = \BasketsModel::getResListById([ 'basketId' => $basketId, @@ -203,6 +211,7 @@ class VisaController $datas['currentAction'] = $currentAction; $datas['linkNotes'] = 'index.php?display=true&module=notes&page=notes&identifier=' .$resId. '&origin=document&coll_id=letterbox_coll&load&size=medium'; $datas['histories'] = $history; + $datas['notes'] = $notes; $datas['resList'] = $resList; $datas['signature'] = \UsersModel::getSignatureForCurrentUser()['pathToSignatureOnTmp']; $datas['consigne'] = \UsersModel::getConsigneForCurrentUserById(['resId' => $resId]); diff --git a/modules/visa/Views/signatureBook.html b/modules/visa/Views/signatureBook.html index 82ca4f13c7da1334c6527ab44821d7636e573bb8..36f3ddbd5df1addd88816e6708f11a48727fa74a 100644 --- a/modules/visa/Views/signatureBook.html +++ b/modules/visa/Views/signatureBook.html @@ -38,7 +38,7 @@ <div class="resListContentFrame" ng-repeat="res in ::signatureBook.resList" ng-click="changeLocation(res.res_id)" ng-class="{'resListContentFrameSelected': vm.resId == res.res_id}"> <div class="resListContentInfo"> <i class="fa fa-compass" title="Numéro chrono"></i> {{res.alt_identifier}} - <i ng-if="res.allSigned" class="fa fa-certificate" style="position: absolute;bottom: 35px;right: 50px;font-size: 40px;color: green;opacity: 0.2;"></i> + <i ng-if="res.allSigned" class="fa fa-certificate" style="position: absolute;bottom: 35px;right: 50px;font-size: 40px;color: gold;"></i> <i class="fa fa-circle" aria-hidden="true" style="color:{{res.priorityColor}};position: absolute;right: 0px;top: -10px;font-size: 25px;"></i> </div> <div class="resListContentInfo"> @@ -76,7 +76,27 @@ <iframe id="leftPanelShowDocumentIframe" ng-src="{{signatureBook.leftViewerLink}}"></iframe> </div> <div class="contentShow" ng-if="signatureBook.headerTab == 2"> - <iframe id="leftPanelShow_iframe" ng-src="{{signatureBook.linkNotes}}"></iframe> + <!--<iframe id="leftPanelShow_iframe" ng-src="{{signatureBook.linkNotes}}"></iframe>--> + <table ng-table="notesTable" class="table" id="notesTable"> + <tr ng-repeat="note in $data"> + <td title="'Date'" sortable="'date_note'" style="width:5%;"> + {{note.date_note | datetimeFormat}} + </td> + <td title="'Note'" sortable="'note_text'" filter="{ note_text: 'text'}" style="width:60%;"> + {{note.note_text}} + </td> + <td title="'Créateur'" sortable="'lastname'" filter="{ lastname: 'text'}" style="width:10%;"> + {{note.firstname + " " + note.lastname}} + </td> + <td title="'Visibilité'" style="width:20%;"> + {{note.entities_restriction}} + </td> + <td title="''" style="width:5%;"> + <i class="fa fa-pencil" style="cursor:pointer;color:#009DC5;" aria-hidden="true" title="Modifier" ></i> + <i class="fa fa-times" style="cursor:pointer;color:red;" aria-hidden="true" title="Supprimer"></i> + </td> + </tr> + </table> </div> <div class="contentShow" ng-if="signatureBook.headerTab == 3"> <iframe id="leftPanelShow_iframe" ng-src="{{signatureBook.linkVisaCircuit}}"></iframe> diff --git a/modules/visa/css/module.css b/modules/visa/css/module.css index 7dc27ae09bc5134b73f92efb79da86a28b2d9930..795bad850cf46aaf0059d0887486d744f5ea2d4f 100644 --- a/modules/visa/css/module.css +++ b/modules/visa/css/module.css @@ -697,19 +697,19 @@ box-shadow: inset 0px 0px 5px 0px #656565; color: white; } -#historyTable.ng-table tr:nth-child(even) { +.ng-table tr:nth-child(even) { background-color: rgba(141,192,219,.25); } -#historyTable.ng-table th:nth-child(1) { +.ng-table th:nth-child(1) { width:20%; } -#historyTable.ng-table th:nth-child(2) { +.ng-table th:nth-child(2) { width:20%; } -#historyTable.ng-table th:nth-child(3) { +.ng-table th:nth-child(3) { width:60%; } diff --git a/modules/visa/js/aController.js b/modules/visa/js/aController.js index efab1ecea7146d702679ada691d32a60e0ebd37e..3df21eb36943ddd89aafa68edfe7050e38e29634 100644 --- a/modules/visa/js/aController.js +++ b/modules/visa/js/aController.js @@ -53,6 +53,17 @@ mainApp.controller("visaCtrl", ["$scope", "$http", "$routeParams", "$interval", 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) { });