Skip to content
Snippets Groups Projects
Commit 7725374d authored by Alex ORLUC's avatar Alex ORLUC
Browse files

add display notes table

parent 3b555bb2
No related branches found
No related tags found
No related merge requests found
<?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
<?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;
}
}
...@@ -11,6 +11,7 @@ require_once 'apps/maarch_entreprise/Models/HistoryModel.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/ContactsModel.php';
require_once 'apps/maarch_entreprise/Models/UsersModel.php'; require_once 'apps/maarch_entreprise/Models/UsersModel.php';
require_once 'modules/basket/Models/BasketsModel.php'; require_once 'modules/basket/Models/BasketsModel.php';
require_once 'modules/notes/Models/NotesModel.php';
class VisaController class VisaController
...@@ -160,6 +161,13 @@ class VisaController ...@@ -160,6 +161,13 @@ class VisaController
'select' => ['event_date', 'info', 'firstname', 'lastname'], 'select' => ['event_date', 'info', 'firstname', 'lastname'],
'orderBy' => ['event_date DESC'] 'orderBy' => ['event_date DESC']
]); ]);
$notes = \NotesModel::getByResId([
'resId' => $resId,
'select' => ['id','firstname','lastname','date_note', 'note_text'],
'orderBy' => ['date_note DESC']
]);
$resList = \BasketsModel::getResListById([ $resList = \BasketsModel::getResListById([
'basketId' => $basketId, 'basketId' => $basketId,
...@@ -203,6 +211,7 @@ class VisaController ...@@ -203,6 +211,7 @@ class VisaController
$datas['currentAction'] = $currentAction; $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['linkNotes'] = 'index.php?display=true&module=notes&page=notes&identifier=' .$resId. '&origin=document&coll_id=letterbox_coll&load&size=medium';
$datas['histories'] = $history; $datas['histories'] = $history;
$datas['notes'] = $notes;
$datas['resList'] = $resList; $datas['resList'] = $resList;
$datas['signature'] = \UsersModel::getSignatureForCurrentUser()['pathToSignatureOnTmp']; $datas['signature'] = \UsersModel::getSignatureForCurrentUser()['pathToSignatureOnTmp'];
$datas['consigne'] = \UsersModel::getConsigneForCurrentUserById(['resId' => $resId]); $datas['consigne'] = \UsersModel::getConsigneForCurrentUserById(['resId' => $resId]);
......
...@@ -38,7 +38,7 @@ ...@@ -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="resListContentFrame" ng-repeat="res in ::signatureBook.resList" ng-click="changeLocation(res.res_id)" ng-class="{'resListContentFrameSelected': vm.resId == res.res_id}">
<div class="resListContentInfo"> <div class="resListContentInfo">
<i class="fa fa-compass" title="Numéro chrono"></i> {{res.alt_identifier}} <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>&nbsp; <i ng-if="res.allSigned" class="fa fa-certificate" style="position: absolute;bottom: 35px;right: 50px;font-size: 40px;color: gold;"></i>&nbsp;
<i class="fa fa-circle" aria-hidden="true" style="color:{{res.priorityColor}};position: absolute;right: 0px;top: -10px;font-size: 25px;"></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>
<div class="resListContentInfo"> <div class="resListContentInfo">
...@@ -76,7 +76,27 @@ ...@@ -76,7 +76,27 @@
<iframe id="leftPanelShowDocumentIframe" ng-src="{{signatureBook.leftViewerLink}}"></iframe> <iframe id="leftPanelShowDocumentIframe" ng-src="{{signatureBook.leftViewerLink}}"></iframe>
</div> </div>
<div class="contentShow" ng-if="signatureBook.headerTab == 2"> <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>
<div class="contentShow" ng-if="signatureBook.headerTab == 3"> <div class="contentShow" ng-if="signatureBook.headerTab == 3">
<iframe id="leftPanelShow_iframe" ng-src="{{signatureBook.linkVisaCircuit}}"></iframe> <iframe id="leftPanelShow_iframe" ng-src="{{signatureBook.linkVisaCircuit}}"></iframe>
......
...@@ -697,19 +697,19 @@ box-shadow: inset 0px 0px 5px 0px #656565; ...@@ -697,19 +697,19 @@ box-shadow: inset 0px 0px 5px 0px #656565;
color: white; color: white;
} }
#historyTable.ng-table tr:nth-child(even) { .ng-table tr:nth-child(even) {
background-color: rgba(141,192,219,.25); background-color: rgba(141,192,219,.25);
} }
#historyTable.ng-table th:nth-child(1) { .ng-table th:nth-child(1) {
width:20%; width:20%;
} }
#historyTable.ng-table th:nth-child(2) { .ng-table th:nth-child(2) {
width:20%; width:20%;
} }
#historyTable.ng-table th:nth-child(3) { .ng-table th:nth-child(3) {
width:60%; width:60%;
} }
......
...@@ -53,6 +53,17 @@ mainApp.controller("visaCtrl", ["$scope", "$http", "$routeParams", "$interval", ...@@ -53,6 +53,17 @@ mainApp.controller("visaCtrl", ["$scope", "$http", "$routeParams", "$interval",
total: $scope.signatureBook.histories.length, total: $scope.signatureBook.histories.length,
dataset: $scope.signatureBook.histories 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) { }, function errorCallback(error) {
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment