This commit is contained in:
afornerot 2022-02-14 13:41:30 +01:00
parent 67d4e4ce96
commit 8b0c3e95b4
8 changed files with 530 additions and 59 deletions

View File

@ -233,6 +233,10 @@ app_tallyday_masterdevalidate:
path: /master/devalidate/{{userid}}/{{weekday}} path: /master/devalidate/{{userid}}/{{weekday}}
defaults: { _controller: App\Controller\TallydayController:masterdevalidate } defaults: { _controller: App\Controller\TallydayController:masterdevalidate }
app_tallyday_mastermonth:
path: /master/month/{monthof}
defaults: { _controller: App\Controller\TallydayController:mastermonth }
app_tallyday_masterexport: app_tallyday_masterexport:
path: /master/export path: /master/export
defaults: { _controller: App\Controller\TallydayController:masterexport } defaults: { _controller: App\Controller\TallydayController:masterexport }

View File

@ -95,8 +95,8 @@ class BreakdayCommand extends Command
while($start<=$end) { while($start<=$end) {
$havebreakday=false; $havebreakday=false;
foreach($response->body->events as $event) { foreach($response->body->events as $event) {
$manip=clone $start;
if($event->eventallday) { if($event->eventallday) {
$manip=clone $start;
$manip->setTime(8,0); $manip->setTime(8,0);
if(new \Datetime($event->eventstart)<=$manip && $manip < new \Datetime($event->eventend) ) { if(new \Datetime($event->eventstart)<=$manip && $manip < new \Datetime($event->eventend) ) {
$this->writeln($start->format("d/m/Y")." >> tallybreakday full day"); $this->writeln($start->format("d/m/Y")." >> tallybreakday full day");
@ -113,7 +113,7 @@ class BreakdayCommand extends Command
// Les breakday am sont supprimés // Les breakday am sont supprimés
$manip=clone $start; $manip=clone $start;
$manip->setTime(9,0); $manip->setTime(8,30);
$tallydays=$this->em->getRepository("App:Tallyday")->findBy(["user"=>$user,"dateof"=>$start,"datestart"=>$manip,"isbreakday"=>true]); $tallydays=$this->em->getRepository("App:Tallyday")->findBy(["user"=>$user,"dateof"=>$start,"datestart"=>$manip,"isbreakday"=>true]);
foreach($tallydays as $tallyday) { foreach($tallydays as $tallyday) {
$this->em->remove($tallyday); $this->em->remove($tallyday);
@ -154,7 +154,102 @@ class BreakdayCommand extends Command
} }
} }
else { else {
$manip=clone $start;
$manip->setTime(10,0);
if(new \Datetime($event->eventstart)<=$manip && $manip < new \Datetime($event->eventend) ) {
$this->writeln($start->format("d/m/Y")." >> tallybreakday AM");
// On s'assure que la journée n'a pas été validé master
$tallyday=$this->em->getRepository("App:Tallyday")->findOneBy(["user"=>$user,"dateof"=>$start,"validatemaster"=>true]);
if(!$tallyday) {
// Les pointages du matin qui ne sont des congès sont supprimés
$tallydays=$this->em->getRepository("App:Tallyday")->findAM($user,$start,false);
foreach($tallydays as $tallyday) {
$this->em->remove($tallyday);
$this->em->flush();
}
// Les breakday fullday sont supprimés
$manip=clone $start;
$manip->setTime(10,0);
$tallydays=$this->em->getRepository("App:Tallyday")->findBy(["user"=>$user,"dateof"=>$start,"datestart"=>$manip,"isbreakday"=>true]);
foreach($tallydays as $tallyday) {
$this->em->remove($tallyday);
$this->em->flush();
}
// Le breakday est généré s'il n'existe pas
$manip=clone $start;
$manip->setTime(8,30);
$tallyday=$this->em->getRepository("App:Tallyday")->findOneBy(["user"=>$user,"dateof"=>$start,"datestart"=>$manip,"isbreakday"=>true]);
if(!$tallyday) {
$data = new Tallyday();
$data->setDateof($start);
$data->setUser($user);
$data->setValidateuser(false);
$data->setValidatemaster(false);
$data->setIsbreakday(true);
$data->setName("AM = ".$event->taskname);
$data->setDatestart(clone $manip);
$manip->add(new \DateInterval("PT3H"));
$manip->add(new \DateInterval("PT30M"));
$data->setDateend(clone $manip);
$this->em->persist($data);
$this->em->flush();
}
$havebreakday=true;
}
}
else {
$manip=clone $start;
$manip->setTime(15,0);
if(new \Datetime($event->eventstart)<=$manip && $manip < new \Datetime($event->eventend) ) {
$this->writeln($start->format("d/m/Y")." >> tallybreakday PM");
// On s'assure que la journée n'a pas été validé master
$tallyday=$this->em->getRepository("App:Tallyday")->findOneBy(["user"=>$user,"dateof"=>$start,"validatemaster"=>true]);
if(!$tallyday) {
// Les pointages de l'aprés midi qui ne sont des congès sont supprimés
$tallydays=$this->em->getRepository("App:Tallyday")->findPM($user,$start,false);
foreach($tallydays as $tallyday) {
$this->em->remove($tallyday);
$this->em->flush();
}
// Les breakday fullday sont supprimés
$manip=clone $start;
$manip->setTime(10,0);
$tallydays=$this->em->getRepository("App:Tallyday")->findBy(["user"=>$user,"dateof"=>$start,"datestart"=>$manip,"isbreakday"=>true]);
foreach($tallydays as $tallyday) {
$this->em->remove($tallyday);
$this->em->flush();
}
// Le breakday est généré s'il n'existe pas
$manip=clone $start;
$manip->setTime(13,30);
$tallyday=$this->em->getRepository("App:Tallyday")->findOneBy(["user"=>$user,"dateof"=>$start,"datestart"=>$manip,"isbreakday"=>true]);
if(!$tallyday) {
$data = new Tallyday();
$data->setDateof($start);
$data->setUser($user);
$data->setValidateuser(false);
$data->setValidatemaster(false);
$data->setIsbreakday(true);
$data->setName("PM = ".$event->taskname);
$data->setDatestart(clone $manip);
$manip->add(new \DateInterval("PT3H"));
$manip->add(new \DateInterval("PT30M"));
$data->setDateend(clone $manip);
$this->em->persist($data);
$this->em->flush();
}
$havebreakday=true;
}
}
}
} }
} }

View File

@ -78,6 +78,24 @@ class CronInitCommand extends Command
$this->em->persist($entity); $this->em->persist($entity);
} }
// Job Breakday
// Toute les heures
$entity = $this->em->getRepository('App:Cron')->findOneBy(["command"=>"app:Breakday"]);
if(!$entity) {
$entity = new Cron;
$nextdate=$entity->getSubmitdate();
$nextdate->setTime($nextdate->format("H"),0);
$entity->setCommand("app:Breakday");
$entity->setDescription("Récupération des Breakdays de Schedule");
$entity->setStatut(2);
$entity->setRepeatcall(0);
$entity->setRepeatexec(0);
$entity->setRepeatinterval(3600);
$entity->setNextexecdate($entity->getSubmitdate());
$this->em->persist($entity);
}
// Job de purge des fichiers obsolète // Job de purge des fichiers obsolète
// Toute les 24h à 3h00 // Toute les 24h à 3h00
$entity = $this->em->getRepository('App:Cron')->findOneBy(["command"=>"app:purgeFile"]); $entity = $this->em->getRepository('App:Cron')->findOneBy(["command"=>"app:purgeFile"]);
@ -85,6 +103,7 @@ class CronInitCommand extends Command
$entity = new Cron; $entity = new Cron;
$nextdate=$entity->getSubmitdate(); $nextdate=$entity->getSubmitdate();
$nextdate->setTime(3,0); $nextdate->setTime(3,0);
$entity->setCommand("app:purgeFile"); $entity->setCommand("app:purgeFile");
$entity->setDescription("Suppression des fichiers obsolètes"); $entity->setDescription("Suppression des fichiers obsolètes");
$entity->setStatut(2); $entity->setStatut(2);

View File

@ -7,6 +7,11 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use App\Entity\Tallyday as Entity; use App\Entity\Tallyday as Entity;
use App\Form\TallydayType as Form; use App\Form\TallydayType as Form;
@ -17,6 +22,15 @@ class TallydayController extends AbstractController
private $render = "Tallyday/"; private $render = "Tallyday/";
private $entity = "App:Tallyday"; private $entity = "App:Tallyday";
private $appKernel;
private $knpSnappy;
public function __construct(KernelInterface $appKernel,\Knp\Snappy\Pdf $knpSnappy)
{
$this->appKernel = $appKernel;
$this->knpSnappy = $knpSnappy;
}
public function tallyday(Request $request) public function tallyday(Request $request)
{ {
$datenow=new \DateTime(); $datenow=new \DateTime();
@ -40,7 +54,7 @@ class TallydayController extends AbstractController
"maxwidth" => true, "maxwidth" => true,
$this->data."s" => $datas, $this->data."s" => $datas,
"timeday" => $timeday, "timeday" => $timeday,
"capitaltime" => $em->getRepository("App:Tallyday")->getCapitaltime(["user"=>$this->getUser()]), "capitaltime" => $em->getRepository("App:Tallyday")->getCapitaltime($this->getUser()),
"message" => $request->get("message"), "message" => $request->get("message"),
]); ]);
} }
@ -110,7 +124,7 @@ class TallydayController extends AbstractController
"weekprev" => $weekprev, "weekprev" => $weekprev,
"timeweek" => $timeweek, "timeweek" => $timeweek,
"firstvalidate" => $firstvalidate, "firstvalidate" => $firstvalidate,
"capitaltime" => $em->getRepository("App:Tallyday")->getCapitaltime(["user"=>$this->getUser()]), "capitaltime" => $em->getRepository("App:Tallyday")->getCapitaltime($this->getUser()),
"message" => $request->get("message"), "message" => $request->get("message"),
]); ]);
} }
@ -127,7 +141,7 @@ class TallydayController extends AbstractController
"id"=>$user->getId(), "id"=>$user->getId(),
"avatar"=>$user->getAvatar(), "avatar"=>$user->getAvatar(),
"displayname"=>$user->getDisplayname(), "displayname"=>$user->getDisplayname(),
"capitaltime"=>$em->getRepository("App:Tallyday")->getCapitaltime(["user"=>$user]), "capitaltime"=>$em->getRepository("App:Tallyday")->getCapitaltime($user),
"validates"=>[], "validates"=>[],
"notvalidates"=>[], "notvalidates"=>[],
]; ];
@ -544,7 +558,7 @@ class TallydayController extends AbstractController
// Si aucun enregistrement on initialise le pointage sur la journée à vide // Si aucun enregistrement on initialise le pointage sur la journée à vide
if(!$datas) { if(!$datas) {
$data = new Entity(); $data = new Entity();
$data->setUser($this->getUser()); $data->setUser($user);
$data->setDateof($datenow); $data->setDateof($datenow);
$data->setValidateuser(false); $data->setValidateuser(false);
@ -665,6 +679,147 @@ class TallydayController extends AbstractController
return $this->redirectToRoute("app_tallyday_masterlist"); return $this->redirectToRoute("app_tallyday_masterlist");
} }
public function mastermonth($monthof, Request $request) {
// Pour l'ensemble des utlisateurs
$em = $this->getDoctrine()->getManager();
$users = $em->getRepository("App:User")->findBy([],["firstname"=>"ASC","lastname"=>"ASC"]);
$dates=[];
foreach($users as $user) {
if($user->hasRole("ROLE_USER")) {
$dates[$user->getId()] = [
"id"=>$user->getId(),
"avatar"=>$user->getAvatar(),
"displayname"=>$user->getDisplayname(),
"timemonth"=>"00:00",
"validates"=>[],
];
$datenow=new \DateTime($monthof."01");
$dateend=clone $datenow;
$dateend->modify("last day of this month");
$nextmonth=clone $datenow;
$nextmonth->modify("first day of next month");
$prevmonth=clone $datenow;
$prevmonth->modify("first day of previous month");
$emonth = new \DateTime('00:00');
$fmonth = clone $emonth;
while($datenow<=$dateend) {
$eday = new \DateTime('00:00');
$fday = clone $eday;
$datas = $em->getRepository($this->entity)->findTallyday($user,$datenow);
foreach($datas as $data) {
$emonth->add($data->getTimeday());
$eday->add($data->getTimeday());
}
$interval = $fday->diff($eday);
$timeday = (($interval->days*24) + $interval->h).":".sprintf("%02s",$interval->i);
array_push($dates[$user->getId()]["validates"],[
"dateof"=>clone $datenow,
"timeday"=>$timeday,
"tallydays"=>$datas
]);
$datenow->add(new \DateInterval('P1D'));
}
$interval = $fmonth->diff($emonth);
$timeweek = (($interval->days*24) + $interval->h).":".sprintf("%02s",$interval->i);
$dates[$user->getId()]["timemonth"]=$timeweek;
}
}
if($request->get('type')=="pdf") {
$rootdir = $this->appKernel->getProjectDir()."/uploads";
$filename="Rapport-".$dateend->format("Ym").".pdf";
$fileloc=$rootdir."/".$filename;
$fs = new Filesystem();
$fs->remove(array($fileloc));
$render = $this->renderView('Tallyday/month.html.twig',[
"useheader" => false,
"usesidebar" => false,
"usemonocolor" => false,
"maxwidth" => false,
"monthof" => $dateend,
"nextmonth" => $nextmonth->format("Ym"),
"prevmonth" => $prevmonth->format("Ym"),
"dates" => $dates,
"fgprint" => true,
"message" => $request->get("message"),
]);
$appWeburl=$this->getParameter("appWeburl");
$appAlias=$this->getParameter("appAlias");
$render=str_replace("/$appAlias/","https://$appWeburl/$appAlias/",$render);
//dump($render);
$this->knpSnappy->generateFromHtml($render,$fileloc);
return $this->file($fileloc);
}
else {
return $this->render('Tallyday/month.html.twig',[
"useheader" => true,
"usesidebar" => false,
"usemonocolor" => false,
"maxwidth" => false,
"monthof" => $dateend,
"nextmonth" => $nextmonth->format("Ym"),
"prevmonth" => $prevmonth->format("Ym"),
"dates" => $dates,
"fgprint" => false,
"message" => $request->get("message"),
]);
}
}
public function masterexport() {
$em = $this->getDoctrine()->getManager();
$rootdir = $this->appKernel->getProjectDir()."/uploads";
$dateof=new \DateTime();
$filename="Export-".$dateof->format("Ymd").".csv";
$fs = new Filesystem();
$fs->mkdir($rootdir);
$csvh = fopen($rootdir."/".$filename, 'w');
$d = ';'; // this is the default but i like to be explicit
$e = '"'; // this is the default but i like to be explicit
$csvh = fopen($rootdir."/".$filename, 'w');
$csv=["Utilisateur",utf8_decode("Début"),"Fin","Temps",utf8_decode("Libellé")];
fputcsv($csvh, $csv, $d, $e);
$datas = $em->getRepository($this->entity)->findBy([],["user"=>"ASC","dateof"=>"ASC"]);
foreach($datas as $data) {
if($data->getDatestart() || $data->getDateend()) {
$csv=[
utf8_decode($data->getUser()->getDisplayname()),
$data->getDatestart()->format("d/m/Y H:i"),
($data->getDateend()?$data->getDateend()->format("d/m/Y H:i"):""),
$data->getTimedayformatted(),
utf8_decode(($data->getName()?$data->getName():""))
];
fputcsv($csvh, $csv, $d, $e);
}
}
$response = new BinaryFileResponse($rootdir."/".$filename);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
return $response;
}
public function start() { public function start() {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -723,37 +878,7 @@ class TallydayController extends AbstractController
return $this->redirectToRoute("app_tallyday"); return $this->redirectToRoute("app_tallyday");
} }
public function startpm() {
$em = $this->getDoctrine()->getManager();
$data = $em->getRepository($this->entity)->findTallyday($this->getUser(),new \DateTime("now"));
// Pas normal
if(!$data)
return $this->redirectToRoute("app_tallyday");
$datenow=new \DateTime("now");
$datenow->setTime ( $datenow->format("H"), $datenow->format("i"), 0 );
$data->setDatestartpm($datenow);
$em->persist($data);
$em->flush();
return $this->redirectToRoute("app_tallyday");
}
public function endpm() {
$em = $this->getDoctrine()->getManager();
$data = $em->getRepository($this->entity)->findTallyday($this->getUser(),new \DateTime("now"));
// Pas normal
if(!$data)
return $this->redirectToRoute("app_tallyday");
$datenow=new \DateTime("now");
$datenow->setTime ( $datenow->format("H"), $datenow->format("i"), 0 );
$data->setDateendpm($datenow);
$em->persist($data);
$em->flush();
return $this->redirectToRoute("app_tallyday");
}
protected function getErrorForm($id,$form,$request,$data,$mode) { protected function getErrorForm($id,$form,$request,$data,$mode) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();

View File

@ -51,30 +51,31 @@ class TallydayRepository extends ServiceEntityRepository
return $datas; return $datas;
} }
public function getCapitaltime($user) { public function getCapitaltime($user,$monthof=null) {
$datenow=new \DateTime('00:00'); $datenow=new \DateTime('00:00');
$datas = $this->_em->getRepository('App:Tallyday')->findBy(["user"=>$user],["datestart"=>"DESC"]); $datas = $this->_em->getRepository('App:Tallyday')->findBy(["user"=>$user],["datestart"=>"DESC"]);
$tbweek=[]; $tbweek=[];
$ework = new \DateTime('00:00'); $ework = new \DateTime('00:00');
$idweeknow=$datenow->format("Y").$datenow->format("W");
$lastdayvalidate=false; $lastdayvalidate=false;
foreach($datas as $data) { foreach($datas as $data) {
if($data->getDateof()<$datenow) { if($data->getDateof()<$datenow) {
$idweek=strval($data->getDateof()->format("Y"))."-".strval($data->getDateof()->format("W")); $idweek=$data->getDateof()->format("Y").$data->getDateof()->format("W");
if(!in_array($idweek,$tbweek)) array_push($tbweek,$idweek); if(!in_array($idweek,$tbweek)&&$idweek!=$idweeknow) array_push($tbweek,$idweek);
$ework->add($data->getTimeday()); $ework->add($data->getTimeday());
} }
if($data->getDateof()==$datenow&&($data->getValidateuser()||$data->getValidatemaster())) { if($data->getDateof()==$datenow&&($data->getValidateuser()||$data->getValidatemaster())) {
$lastdayvalidate=true; $lastdayvalidate=true;
$idweek=strval($data->getDateof()->format("Y"))."-".strval($data->getDateof()->format("W")); $idweek=$data->getDateof()->format("Y").$data->getDateof()->format("W");
if(!in_array($idweek,$tbweek)) array_push($tbweek,$idweek); if(!in_array($idweek,$tbweek)&&$idweek!=$idweeknow) array_push($tbweek,$idweek);
$ework->add($data->getTimeday()); $ework->add($data->getTimeday());
} }
} }
// Nbday worked // Nbday worked
$nbdaywork=(count($tbweek)-1)*5; $nbdaywork=count($tbweek)*5;
if($datenow->format("w")==6||$datenow->format("w")==7) if($datenow->format("w")==6||$datenow->format("w")==7)
$nbdaywork+=5; $nbdaywork+=5;
else { else {
@ -162,4 +163,47 @@ class TallydayRepository extends ServiceEntityRepository
return true; return true;
} }
public function findAM($user,$dateof,$isbreakday) {
$start=clone $dateof;
$start->setTime(8,30);
$end=clone $dateof;
$end->setTime(12,00);
$datas = $this->createQueryBuilder('tallydate')
->Where('tallydate.user=:user')
->andWhere('tallydate.dateof=:day')
->andWhere('(tallydate.datestart<=:start AND :start<=tallydate.dateend)OR(tallydate.datestart>=:start AND tallydate.datestart<=:end) OR (tallydate.dateend>=:start AND tallydate.dateend<=:end)')
->andWhere('tallydate.isbreakday=:isbreakday')
->setParameter('user',$user)
->setParameter('isbreakday',$isbreakday)
->setParameter('day',$dateof->format("Y-m-d H:i:s"))
->setParameter('start',$start->format("Y-m-d H:i:s"))
->setParameter('end',$end->format("Y-m-d H:i:s"))
->getQuery()->getResult();
return $datas;
}
public function findPM($user,$dateof,$isbreakday) {
$start=clone $dateof;
$start->setTime(13,30);
$end=clone $dateof;
$end->setTime(17,00);
$datas = $this->createQueryBuilder('tallydate')
->Where('tallydate.user=:user')
->andWhere('tallydate.dateof=:day')
->andWhere('(tallydate.datestart<=:start AND :start<=tallydate.dateend)OR(tallydate.datestart>=:start AND tallydate.datestart<=:end) OR (tallydate.dateend>=:start AND tallydate.dateend<=:end)')
->andWhere('tallydate.isbreakday=:isbreakday')
->setParameter('user',$user)
->setParameter('isbreakday',$isbreakday)
->setParameter('day',$dateof->format("Y-m-d H:i:s"))
->setParameter('start',$start->format("Y-m-d H:i:s"))
->setParameter('end',$end->format("Y-m-d H:i:s"))
->getQuery()->getResult();
return $datas;
}
} }

View File

@ -6,14 +6,14 @@ th, td {
color: #ffffff; color: #ffffff;
background-color: #37474F; background-color: #37474F;
text-align: center; text-align: center;
width: 85px; width: 100px;
} }
td { td {
background-color: #e8ecf1; background-color: #e8ecf1;
height: 44px; height: 44px;
vertical-align: top; vertical-align: top;
font-size: 9px; font-size: 12px;
color: var(--colorftbodylight); color: var(--colorftbodylight);
} }
@ -35,6 +35,7 @@ td {
<a class="btn btn-secondary" href={{ path('app_tallyday') }}>Retour</a> <a class="btn btn-secondary" href={{ path('app_tallyday') }}>Retour</a>
<a class="btn btn-secondary float-right" href={{ path('app_tallyday_masterexport') }}>Export CSV</a> <a class="btn btn-secondary float-right" href={{ path('app_tallyday_masterexport') }}>Export CSV</a>
<a class="btn btn-secondary float-right mr-2" href={{ path('app_tallyday_mastermonth',{monthof:"now"|date("Ym")}) }}>Rapport Mensuel</a>
{% if message is defined and not message is empty %} {% if message is defined and not message is empty %}
<div class='alert alert-danger' style='margin: 5px 0px'> <div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br> <strong>Erreur</strong><br>
@ -42,7 +43,7 @@ td {
</div> </div>
{% endif %} {% endif %}
<div class="mt-3" style="margin:auto"> <div class="mt-3" style="margin:auto; max-width:1800px;">
{% for date in dates %} {% for date in dates %}
{% if date.validates or date.notvalidates %} {% if date.validates or date.notvalidates %}
<div class="card mr-1 mb-1 float-left"> <div class="card mr-1 mb-1 float-left">
@ -56,7 +57,7 @@ td {
<thead> <thead>
<tr> <tr>
<th class="no-print"></th> <th class="no-print"></th>
<th style="width:40px !important">s</th> <th style="width:50px !important">s</th>
<th>L</th> <th>L</th>
<th>M</th> <th>M</th>
<th>M</th> <th>M</th>
@ -83,8 +84,15 @@ td {
<div class="date">{{validate.dateof|date("d/m")}}</div> <div class="date">{{validate.dateof|date("d/m")}}</div>
<div style="min-height:28px"> <div style="min-height:28px">
{% for tallyday in validate.tallydays %} {% for tallyday in validate.tallydays %}
{%if tallyday.datestart %} de {{tallyday.datestart|date("H:i") }} {% endif %} {% if tallyday.isbreakday %}
{%if tallyday.dateend %} à {{tallyday.dateend|date("H:i") }} {% endif %} {% if tallyday.datestart|date("H")==10 %}
{% set breakdayall=true %}
{% endif %}
{{tallyday.name}}
{% else %}
{%if tallyday.datestart %} de {{tallyday.datestart|date("H:i") }} {% endif %}
{%if tallyday.dateend %} à {{tallyday.dateend|date("H:i") }} {% endif %}
{%endif%}
<br> <br>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -0,0 +1,170 @@
{% extends "base.html.twig" %}
{% block localstyle %}
th, td {
border: 1px solid #37474F;
color: #ffffff;
background-color: #37474F;
text-align: center;
width: 100px;
padding: 0px;
}
td {
background-color: #e8ecf1;
height: 44px;
vertical-align: top;
font-size: 12px;
color: var(--colorftbodylight);
{% if fgprint %}color:#000000 !important;{%endif%}
}
{% if fgprint %}
.card {float: none !important; }
.card, .card-header {border: none;}
.breakpage {
page-break-after: always;
}
{% endif %}
.date {
color: #ffffff;
background-color: #37474F;
}
.nounderline:hover {
text-decoration:none;
}
{% endblock %}
{% block body %}
<h1 class="page-header">
RAPPORT MENSUEL = {{ monthof|date("m/Y") }}
</h1>
{% if not fgprint %}
<a class="btn btn-secondary mr-2" href={{ path('app_tallyday') }}>Retour</a>
<a class="btn btn-secondary mr-2" href={{ path('app_tallyday_mastermonth',{monthof:prevmonth}) }}>Mois Précédent</a>
<a class="btn btn-secondary mr-2" href={{ path('app_tallyday_mastermonth',{monthof:nextmonth}) }}>Mois Suivant</a>
<a class="btn btn-secondary mr-2" href={{ path('app_tallyday_mastermonth',{monthof:monthof|date("Ym"),type:"pdf"}) }}>Export PDF</a>
<a class="btn btn-secondary float-right" href={{ path('app_tallyday_masterexport') }}>Export CSV</a>
<a class="btn btn-secondary float-right mr-2" href={{ path('app_tallyday_masterlist') }}>Gestion des Pointages</a>
{% if message is defined and not message is empty %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{{ message|raw }}<br>
</div>
{% endif %}
{% endif %}
<div class="mt-3" style="margin:auto; max-width:1800px;">
{% set nbusers=0 %}
{% for date in dates %}
{% if date.validates %}
{% set nbusers=nbusers+1 %}
<div class="card mr-1 mb-1 float-left {% if nbusers==2 %}breakpage{% endif %} ">
<div class="card-header">
<img src="{{date.avatar|urlavatar}}" class="avatar"> {{ date.displayname }}
</div>
<div class="card-body">
<table>
<thead>
<tr>
<th style="width:50px !important">s</th>
<th>L</th>
<th>M</th>
<th>M</th>
<th>J</th>
<th>V</th>
<th>S</th>
<th>D</th>
</tr>
</thead>
<tbody>
{% for validate in date.validates %}
{% if loop.first or validate.dateof|date("l")=="Monday" %}
<tr>
{% if loop.first %}
{% set style = "" %}
{% else %}
{% set style = "display:none;" %}
{% endif %}
<td style="width:50px !important; vertical-align:middle;">
{{validate.dateof|date("W")}}
</td>
{% if loop.first %}
{% for i in 2..(validate.dateof|date("N")) %}
<td></td>
{% endfor %}
{%endif %}
{% endif %}
<td style="align:top">
<div class="date">{{validate.dateof|date("d/m")}}</div>
<div style="min-height:28px">
{% for tallyday in validate.tallydays %}
{% if tallyday.isbreakday %}
{% if tallyday.datestart|date("H")==10 %}
{% set breakdayall=true %}
{% endif %}
{{tallyday.name}}
{% else %}
{%if tallyday.datestart %} de {{tallyday.datestart|date("H:i") }} {% endif %}
{%if tallyday.dateend %} à {{tallyday.dateend|date("H:i") }} {% endif %}
{%endif%}
<br>
{% endfor %}
</div>
<div>
= {{validate.timeday}}
</div>
</td>
{% if loop.last or validate.dateof|date("l")=="Sunday"%}
<tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
{% if nbusers==2 %}
{% set nbusers=0 %}
{% endif %}
{% endif %}
{% endfor %}
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$('#dataTables').DataTable({
columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ],
responsive: true,
iDisplayLength: 100,
paging: false,
ordering: false,
info: false,
searching: false,
});
maxheight=0;
$( ".card" ).each(function( index ) {
if($(this).height()>maxheight)
maxheight=$(this).height();
});
$( ".card" ).height(maxheight);
});
{% endblock %}

View File

@ -63,8 +63,9 @@
{% if not isvalideuser and not isvalidemaster %} {% if not isvalideuser and not isvalidemaster %}
<a href="{{path("app_tallyday_start")}}" class="btn btn-success" style="font-size:150%; width:250px;">Début Pointage</a> <a href="{{path("app_tallyday_start")}}" class="btn btn-success" style="font-size:150%; width:250px;">Début Pointage</a>
{% endif %} {% endif %}
{% else %} {% elseif not isvalideuser and not isvalidemaster %}
<a href="{{path("app_tallyday_end")}}" class="btn btn-success" style="font-size:150%; width:250px;">Fin Pointage</a> <a href="{{path("app_tallyday_end")}}" class="btn btn-success" style="font-size:150%; width:250px;">Fin Pointage</a>
{% endif %} {% endif %}
<div class="tallydaydetail"> <div class="tallydaydetail">
@ -84,12 +85,17 @@
{% for tallyday in tallydays %} {% for tallyday in tallydays %}
{% set isvalideuser=tallyday.validateuser %} {% set isvalideuser=tallyday.validateuser %}
{% set isvalidemaster=tallyday.validatemaster %} {% set isvalidemaster=tallyday.validatemaster %}
{% if tallyday.datestart %}
<tr> <tr>
<td>{{tallyday.datestart|date("H:i")}}</td> {% if tallyday.isbreakday %}
<td>{% if tallyday.dateend %} {{tallyday.dateend|date("H:i")}} {%endif%}</td> <td colspan=2>{{tallyday.name}}</td>
<td>{{tallyday.timedayformatted}}</td> {% else %}
</tr> <td>{{tallyday.datestart|date("H:i")}}</td>
<td>{% if tallyday.dateend %} {{tallyday.dateend|date("H:i")}} {%endif%}</td>
{% endif %}
<td>{{tallyday.timedayformatted}}</td>
</tr>
{% endif %}
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>