-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Achille/dev 0.0.23 #25
Conversation
…achille/dev-0.0.22
css/style.css
Outdated
@@ -24,6 +23,7 @@ | |||
|
|||
#app { | |||
width: 100%; | |||
display: flex; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ce qui précède concerne les modifs visuelles avec la MaJ vers Nextcloud 25.
} | ||
|
||
/**********************/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cette partie sert pour la table ByLocation.
Avec l'ajout de la demie journée, il a fallu revoir la mise en forme des cases. Elles contiennent maintenant une Div (.cell-main) qui elle-même contient une ou deux autres div (.cell-base-alone/.cell-base-two).
if (!in_array($e->place, $toExclude)) { | ||
array_push($events, $e); | ||
} | ||
array_push($events, $e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La vérification si le lieu est autorisé est faite plus tard, dans MyEvent.parseListEvent
.
@@ -98,16 +97,14 @@ public function getLastSeen(String $dtStart, String $dtEnd) | |||
|
|||
//Récupération de la liste des événements sur la période | |||
foreach ($this->search($dtStart, $dtEnd) as $c) { | |||
$e = new MyEvent($c, $this->myDb); | |||
$e = new MyEvent($c, $this->myDb, $this->logger); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pas forcément utile en prod mais relou à ajouter et enlever à chaque fois pour débugger. Ne pose aucun problème.
@@ -118,7 +115,7 @@ public function getLastSeen(String $dtStart, String $dtEnd) | |||
$listSeen[$user] = []; | |||
} | |||
|
|||
$listSeen[$user] = $e->parseListEvents($events, $listSeen[$user]); | |||
$listSeen[$user] = $e->parseListEvents($events, $listSeen[$user], $toExclude); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Voir com précédent
// It looks like search does not include the upper bound | ||
$to->modify('+1 day'); | ||
// It looks like search does not include the upper bound (end of day at 00H00) | ||
$to->modify('+1 minute'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 minute est suffisante
$cls = explode(",", $cls)[0]; | ||
$cls = trim($cls); | ||
|
||
$cls = trim(strtolower($e->{$classement})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code dupliqué avec MyEvent.extractData
, modification en conséquence. Le classement par lieu demande maintenant "place"
au lieu de "summary"
, c'est aussi plus facile à comprendre côté front
$events[$e->place2] = []; | ||
} | ||
array_push($events[$e->place2], $e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Duplication" de l'event pour l'aprem, la distinction est faite en front.
|
||
preg_match_all("/D[0-9]{5}/", $this->summary, $this->quote); | ||
} | ||
|
||
public function toString() | ||
{ | ||
return "Event at " . $this->place . " by " . $this->nextcloud_users . " From " . $this->dtStart . " to " . $this->dtStart; | ||
return "Event at " . $this->place . '/' . $this->place2 . " by " . $this->nextcloud_users . " From " . $this->dtStart . " to " . $this->dtStart; | ||
} | ||
|
||
public function getNameCalendar($calendarsUid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prise en compte de la demie journée.
this->place2
est laissé vide si event sur la journée plutot que mis égal à this->place
, plus pratique pour la suite.
$cls = [$matches[0][1]]; | ||
if (count($matches[0]) >= 4) { | ||
array_push($cls, $matches[0][3]); | ||
} | ||
return $cls; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utilisation d'une regexp, fonctionne parfaitement dans tous les cas que j'ai testé (0,1,2 @xxxx, avec ou sans commentaire sur la tache).
$dateStart = new Datetime($event->dtStart); | ||
} | ||
$inter = $dateEnd->modify('+1 minute')->diff($dateStart->modify('-1 minute'))->days; | ||
return $inter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pour lastSeen.
Correction liée au event sur plusieurs jours, ils ne comptaient que pour 1 avant, d'où le calcul de la durée maintenant.
} | ||
return ''; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prise en compte de la demie journée.
{ | ||
foreach ($events as $e) { | ||
$user = strtolower($e->nextcloud_users); | ||
$thisUser = strtolower($this->nextcloud_users); | ||
|
||
$inter = $this->eventCross($e); | ||
$commonPlace = $this->getPlaceCommon($e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calcul de la largeur de l'intervalle des deux event, si 0 (équivalent à false), events pas croisés.
Calcul du lieu commun, si vide, pas croisé non plus.
import { TagsInput, initEventsBase } from '../module/tagsInput'; | ||
import { IconsToPerson } from '../module/iconsToPerson'; | ||
import { TagsInput, initEventsBase } from '../class/tagsInput'; | ||
import { IconsToPerson } from '../class/iconsToPerson'; | ||
import { getAllIcons } from '../module/xhr'; | ||
import { groupBy } from 'lodash/collection'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Déplacement des deux fichiers
res += e.place2 + '<br/>' | ||
title += filter.includes(',') ? filter.split(',')[2] + '\n' : '' | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On afficher les deux events des deux demies journées l'un en dessous de l'autre. (matin au dessus évidemment)
title2 += e.nextcloud_users + '\n' | ||
res2 += 1 | ||
found2 = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ajouts de variables pour la séparation entre le matin et l'aprem
|
||
return myDiv | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remplissage de la case suivant les valeurs trouvées
myCell.classList.add('td-location') | ||
return myCell | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'aurais voulu faire dessus/dessous mais j'ai pas réussi: problème avec la hauteur des autres cases quand matin=aprem
C'est donc côte à côte.
|
||
myCell.innerText = res | ||
myCell.style = 'text-align: center; ' | ||
myCell.title = title |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comptage pour remplir les cases de la nouvelle table.
alert("Assurez vous d'entrer le quadrigramme de la personne"); | ||
tags.input.value = str; | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test pour s'assurer que c'est bien le quadrigramme (ou tétragramme ?) qui a été entré
function setDateUsual() { | ||
const toDay = new Date() | ||
if (document.getElementById('seen') !== null) { | ||
if (document.getElementById('HRsummary') != null || document.getElementById('seen') != null) { | ||
document.getElementById('dtStart').valueAsDate = toDay | ||
toDay.setDate(toDay.getDate() + 14) | ||
document.getElementById('dtEnd').valueAsDate = toDay | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fonction pour remettre les dates aux valeurs par défaut quand on vient des tables lastSeen ou HRSummary
toDay.setDate(toDay.getDate()) | ||
document.getElementById('dtEnd').valueAsDate = toDay | ||
toDay.setDate(toDay.getDate() - 35) | ||
document.getElementById('dtStart').valueAsDate = toDay | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fonctions pour mettre des dates par défaut quand on arrive sur les tables en question pour la première fois.
@@ -83,7 +82,8 @@ window.addEventListener('DOMContentLoaded', function () { | |||
document.getElementById('myapp').appendChild(getLoader()) | |||
getData(document.getElementById('dtStart').value, | |||
document.getElementById('dtEnd').value, | |||
'nextcloud_users' | |||
'nextcloud_users', | |||
'byEmployee' | |||
) | |||
}) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Le bouton pour changer les dates est commun à chaque table, d'où les conditions en plus pour savoir quelle table charger.
newCell.style = "background-color: red;" | ||
newCell.title = "Not seend in the last " + periodLength + " days" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On peut maintenant choisir la période pour lastSeen, d'ou les modifs pour savoir quand afficher en rouge ou orange
} | ||
}) | ||
|
||
if (tablename === 'summary') { | ||
if (tablename === 'byLocation') { | ||
tfoot.appendChild(getTotal(tbody)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ajout d'un nom plus distinct à chaque table, il faudrait peut-être mettre ça en constante dans un fichier commun, ce serait plus propre.
Autre modif : remplir la table se fait sur la valeur du header, on donne le header et l'indice de la premiere valeur à prendre en compte.
console.log(text) | ||
} | ||
} | ||
line.appendChild(newCell('td', text, 'text-align: center;')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encore une fois, prise en compte de la demie journée pour le total par jour dans byLocation
@@ -225,7 +246,8 @@ function newCell(type, data, style = '') { | |||
*/ | |||
function getHeader(from, to, tablePersonne = false) { | |||
const line = document.createElement('tr') | |||
line.appendChild(newCell('th', 'Date')) | |||
let titre = (tablePersonne) ? 'Personne' : 'Lieu' | |||
line.appendChild(newCell('th', titre)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modif du nom de la première colonne pour byEmployee et byLocation, plus logique
}) | ||
return line | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fonction de création du header avec des valeurs customs, utile pour la table HRsummary mais probablement plus tard aussi, sur de tables futures
line.appendChild(userListEvents.eventsAtDayCount(value, icons, placeIsExcluded)) | ||
} else if (type === 'HRsummary') { | ||
line.appendChild(userListEvents.countTypeForUser(value)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modification pour savoir quelle valeur prendre pour la colonne actuelle à partir du header.
document.getElementById('myapp').innerHTML = '' | ||
document.getElementById('myapp').appendChild(table) | ||
new DataTable('#' + tableName, optionDatatable) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fonction de création de la nouvelle table HRsummary
console.log(JSON.parse(this.response)) | ||
|
||
newTablePersonne(this.response, dtStart, dtEnd, tableName) | ||
let dt = new DataTable('#' + tableName, optionDatatable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ajout d'un nom de table différent du classement comme c'était le cas avant
} | ||
oReq.send(JSON.stringify(data)) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fonction pour récupérer les données sans forcément créer de table, callback
est une fonction prenant en argument les données envoyées (data
) et la réponse du contrôleur.
</div> | ||
<div class="crumb svg crumbhome"> | ||
<span><?php p($l->t('Employees')); ?></span> | ||
<span id="finalPath"><?php p($l->t('Employees')); ?></span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commun à chaque onglet donc modification à la volée
@@ -5,7 +5,7 @@ | |||
<hr /> | |||
<p><b><?php p($l->t('This application summarizes the workplaces of employees/persons from the calendar.')); ?></b></p> | |||
<br /> | |||
<p><?php p($l->t('Just put in the calendar a day event with @ at the beginning followed by your workplaces. You can add a comment to your workplaces with ",". Example "@ PARIS, meet customer !"')); ?></p> | |||
<p><?php p($l->t('Just put in the calendar a day event with @ at the beginning followed by your workplaces. Expliciting "@Paris, @Remote" will define you are at Paris for the mornin and in remote for the afternoon. Not specifying the second part but just "@Paris" will show you are at Paris the full day. You can add a comment to your workplaces with ",". Example "@ PARIS, meet customer !"')); ?></p> | |||
<!--<p><img src="<?php //print_unescaped(image_path('whereami', 'example.png')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commentaire sur l'utilisation avec la demie journée
* Minor adjustements to lastSeen * Working HRsummary, no handling of half-days * work in progress * better style for nav bar * Finalised version for HR summary and handling of half-days * moved buttons to nav bar * added icons + rebuild with minimization on * pushed version to 0.0.23 * fixed lastSeen with half days event * Changed help description * Rectified version * removed logging stuff * fixed issue when clicking on key in byEmployee * Changed href to buttons to make UI more responsive * Removed unused routes * fixed issue when clicking on key in byEmployee (2) * 2 fixes after reviewing PR + 2 coms Co-authored-by: Achille Bailly <a.bailly-stagiaire@adacis.net> Co-authored-by: Benjamin <benjamin@cybercorp.fr> Co-authored-by: AchilleBailly <78507255+AchilleBailly@users.noreply.github.com> Co-authored-by: Achille Bailly <a.bailly-stagiaire@adacis.net>
Ajout d'une table pour répertoriant les jours de RTT, congés, astreinte.
Avec ça, ajout de la prise en compte de la demie-jounée (nécessaire pour les feuilles PAI) : @Cenon -> toute la journée, @Cenon, @rtt -> Cenon le matin et RTT l'aprem. Modifications en conséquence dans les autres tables et dans l'aide.