Merge branch 'master' into dist/eole/2.7.2/master

This commit is contained in:
2021-03-05 10:24:51 +01:00
5 changed files with 72 additions and 63 deletions

View File

@@ -262,6 +262,10 @@ app_task_activeproject:
path: /master/task/activeproject path: /master/task/activeproject
defaults: { _controller: App\Controller\TaskController:activeproject } defaults: { _controller: App\Controller\TaskController:activeproject }
app_task_activetask:
path: /master/task/activetask
defaults: { _controller: App\Controller\TaskController:activetask }
#== Event ==================================================================================================== #== Event ====================================================================================================
app_event: app_event:
path: /user/event path: /user/event

View File

@@ -31,13 +31,13 @@ class TaskController extends AbstractController
"services" => $services, "services" => $services,
"useheader" => true, "useheader" => true,
"usesidebar" => true, "usesidebar" => true,
"fgprint" => true, "fgprint" => true,
]); ]);
return new PdfResponse( return new PdfResponse(
$this->knpSnappy->getOutputFromHtml($render,["orientation"=>"Landscape"]), $this->knpSnappy->getOutputFromHtml($render,["orientation"=>"Landscape"]),
'taches.pdf' 'taches.pdf'
); );
} }
else { else {
return $this->render($this->render.'list.html.twig',[ return $this->render($this->render.'list.html.twig',[
@@ -61,30 +61,30 @@ class TaskController extends AbstractController
// Récupération des data du formulaire // Récupération des data du formulaire
$form->handleRequest($request); $form->handleRequest($request);
// Sur erreur // Sur erreur
$this->getErrorForm(null,$form,$request,$data,"submit"); $this->getErrorForm(null,$form,$request,$data,"submit");
// Sur validation // Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData(); $data = $form->getData();
$em->persist($data); $em->persist($data);
$em->flush(); $em->flush();
// Retour à la liste // Retour à la liste
return $this->redirectToRoute($this->route); return $this->redirectToRoute($this->route);
} }
// Affichage du formulaire // Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [ return $this->render($this->render.'edit.html.twig', [
'useheader' => true, 'useheader' => true,
'usesidebar' => true, 'usesidebar' => true,
$this->data => $data, $this->data => $data,
'mode' => 'submit', 'mode' => 'submit',
'form' => $form->createView() 'form' => $form->createView()
]); ]);
} }
public function update($id,Request $request) public function update($id,Request $request)
{ {
// Initialisation de l'enregistrement // Initialisation de l'enregistrement
@@ -99,43 +99,43 @@ class TaskController extends AbstractController
// Sur erreur // Sur erreur
$this->getErrorForm(null,$form,$request,$data,"update"); $this->getErrorForm(null,$form,$request,$data,"update");
// Sur validation // Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData(); $data = $form->getData();
$em->persist($data); $em->persist($data);
$em->flush(); $em->flush();
// Retour à la liste // Retour à la liste
return $this->redirectToRoute($this->route); return $this->redirectToRoute($this->route);
} }
// Affichage du formulaire // Affichage du formulaire
if($request->query->get('fgprint')) { if($request->query->get('fgprint')) {
$render = $this->renderView($this->render.'edit.html.twig', [ $render = $this->renderView($this->render.'edit.html.twig', [
'useheader' => true, 'useheader' => true,
'usesidebar' => true, 'usesidebar' => true,
$this->data => $data, $this->data => $data,
'mode' => 'update', 'mode' => 'update',
'form' => $form->createView(), 'form' => $form->createView(),
"fgprint" => true, "fgprint" => true,
]); ]);
return new PdfResponse( return new PdfResponse(
$this->knpSnappy->getOutputFromHtml($render), $this->knpSnappy->getOutputFromHtml($render),
'tache.pdf' 'tache.pdf'
); );
} }
else { else {
return $this->render($this->render.'edit.html.twig', [ return $this->render($this->render.'edit.html.twig', [
'useheader' => true, 'useheader' => true,
'usesidebar' => true, 'usesidebar' => true,
$this->data => $data, $this->data => $data,
'mode' => 'update', 'mode' => 'update',
'form' => $form->createView() 'form' => $form->createView()
]); ]);
} }
} }
public function delete($id,Request $request) public function delete($id,Request $request)
{ {
@@ -161,13 +161,18 @@ class TaskController extends AbstractController
// Retour à la liste // Retour à la liste
return $this->redirectToRoute($this->route); return $this->redirectToRoute($this->route);
} }
} }
public function activeproject() { public function activeproject() {
$this->get('session')->set('activeproject',!$this->get('session')->get('activeproject')); $this->get('session')->set('activeproject',!$this->get('session')->get('activeproject'));
return $this->redirectToRoute($this->route); return $this->redirectToRoute($this->route);
} }
public function activetask() {
$this->get('session')->set('activetask',!$this->get('session')->get('activetask'));
return $this->redirectToRoute($this->route);
}
public function activeoffer() { public function activeoffer() {
$this->get('session')->set('activeoffer',!$this->get('session')->get('activeoffer')); $this->get('session')->set('activeoffer',!$this->get('session')->get('activeoffer'));
return $this->redirectToRoute($this->route); return $this->redirectToRoute($this->route);
@@ -189,5 +194,5 @@ class TaskController extends AbstractController
$request->getSession()->getFlashBag()->add("error", $error->getMessage()); $request->getSession()->getFlashBag()->add("error", $error->getMessage());
} }
} }
} }
} }

View File

@@ -33,7 +33,7 @@ class sessionListener {
$haverole=true; $haverole=true;
} }
} }
return $haverole; return $haverole;
} }
@@ -67,11 +67,12 @@ class sessionListener {
// Initialisation de la session // Initialisation de la session
if($regen) { if($regen) {
$session->set('activeproject',true); $session->set('activeproject',true);
$session->set('activetask',true);
$session->set('activeoffer',true); $session->set('activeoffer',true);
$session->set('activeholiday',true); $session->set('activeholiday',true);
$session->set('activetimer',true); $session->set('activetimer',true);
$session->set('nbmonth',3); $session->set('nbmonth',3);
if($curentuser!="anon.") { if($curentuser!="anon.") {
if(in_array("ROLE_USER",$roles)) if(in_array("ROLE_USER",$roles))
$session->set('iduser',$curentuser->getId()); $session->set('iduser',$curentuser->getId());
@@ -86,7 +87,7 @@ class sessionListener {
$session->set('idproject',"all"); $session->set('idproject',"all");
$session->set('idservice',"all"); $session->set('idservice',"all");
} }
$tbusers=[]; $tbusers=[];
$users=$this->em->getRepository('App:User')->findAll(); $users=$this->em->getRepository('App:User')->findAll();
foreach($users as $user) { foreach($users as $user) {
@@ -99,7 +100,7 @@ class sessionListener {
} }
} }
$session->set('users',$tbusers); $session->set('users',$tbusers);
$tbprojects=[]; $tbprojects=[];
$projects=$this->em->getRepository('App:Project')->findBy(["active"=>true]); $projects=$this->em->getRepository('App:Project')->findBy(["active"=>true]);
foreach($projects as $project) { foreach($projects as $project) {
@@ -110,7 +111,7 @@ class sessionListener {
array_push($tbprojects,$tmp); array_push($tbprojects,$tmp);
} }
$session->set('projects',$tbprojects); $session->set('projects',$tbprojects);
$tbservices=[]; $tbservices=[];
$services=$this->em->getRepository('App:Service')->findAll(); $services=$this->em->getRepository('App:Service')->findAll();
foreach($services as $service) { foreach($services as $service) {
@@ -120,8 +121,8 @@ class sessionListener {
]; ];
array_push($tbservices,$tmp); array_push($tbservices,$tmp);
} }
$session->set('services',$tbservices); $session->set('services',$tbservices);
} }
} }
} }

View File

@@ -59,7 +59,7 @@
} }
.astreinte { .astreinte {
height: 12px; height: 12px;
font-size: 10px; font-size: 10px;
} }
{% if fgprint is defined and fgprint %} {% if fgprint is defined and fgprint %}
@@ -68,7 +68,7 @@
float:none !important; float:none !important;
margin:0px; margin:0px;
} }
table { width:100%; font-size:10px;} table { width:100%; font-size:10px;}
.card-header .synthese { .card-header .synthese {
@@ -83,14 +83,13 @@
.small { font-size:10px;} .small { font-size:10px;}
h4 { h4 {
padding-top: 20px; padding-top: 20px;
} }
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block body %} {% block body %}
{% if fgprint is defined and fgprint %}<h1>Planning</h1>{%endif%} {% if fgprint is defined and fgprint %}<h1>Planning</h1>{%endif%}
{% if access=="customer" and not app.user %} {% if access=="customer" and not app.user %}
@@ -104,7 +103,7 @@
{% for i in 1..48 %} {% for i in 1..48 %}
{% set selected="" %} {% set selected="" %}
{%if i==app.session.get('nbmonth') %} {%if i==app.session.get('nbmonth') %}
{% set selected="selected" %} {% set selected="selected" %}
{% endif %} {% endif %}
<option value="{{i}}" {{selected}}>{{i}}</option> <option value="{{i}}" {{selected}}>{{i}}</option>
{% endfor %} {% endfor %}
@@ -126,8 +125,6 @@
<div class="card-body"> <div class="card-body">
<h3>RAPPORT</h3> <h3>RAPPORT</h3>
<div class="small"> <div class="small">
<div class="new-page">&nbsp;</div>
{% for month in project.months %} {% for month in project.months %}
<h3 class="month">{{ month.monthlabel }}</h3> <h3 class="month">{{ month.monthlabel }}</h3>
@@ -179,21 +176,15 @@
<td class="text-right">{{ month.totala|number_format(2, '.', ' ') }}</td> <td class="text-right">{{ month.totala|number_format(2, '.', ' ') }}</td>
</tr> </tr>
{% endif %} {% endif %}
<tfoot> <tfoot>
<tr> <tr>
<td style="min-width:200px">TOTAL</td> <td style="min-width:200px">TOTAL</td>
<td class="text-right" style="min-width:100px">{{ (month.total + month.totala)|number_format(2, '.', ' ') }}</td> <td class="text-right" style="min-width:100px">{{ (month.total + month.totala)|number_format(2, '.', ' ') }}</td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<h4>CUMUL HEBDOMADAIRE</h4> <h4>CUMUL HEBDOMADAIRE</h4>
<table> <table>
{% for year, weeks in project.weeks %} {% for year, weeks in project.weeks %}
@@ -204,22 +195,21 @@
{% for week in weeks %} {% for week in weeks %}
<th class="text-center"> <th class="text-center">
S{{ week.weeknumber}} S{{ week.weeknumber}}
</th> </th>
{% endfor %} {% endfor %}
</thead> </thead>
<tr class="text-center"> <tr class="text-center">
<td class="text-center"> <td class="text-center">
</td> </td>
{% for week in weeks %} {% for week in weeks %}
<td class="text-center"> <td class="text-center">
{{ week.cumul}} {{ week.cumul}}
</td> </td>
{% endfor %} {% endfor %}
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
<div class="new-page">&nbsp;</div>
{% if not project.offers is empty %} {% if not project.offers is empty %}
<h4>COMMANDES</h4> <h4>COMMANDES</h4>
{% set count=(project.offers|length)-8 %} {% set count=(project.offers|length)-8 %}
@@ -236,15 +226,15 @@
</thead> </thead>
{% set tot=0 %} {% set tot=0 %}
{% for offer in project.offers %} {% for offer in project.offers %}
{% if loop.index<count %} {% if loop.index<count %}
{% set totbefore10=totbefore10+offer.quantity %} {% set totbefore10=totbefore10+offer.quantity %}
{% if loop.index+1==count %} {% if loop.index+1==count %}
<tr> <tr>
<td colspan="2">Précédente</td> <td colspan="2">Précédente</td>
<td class="text-right">{{ totbefore10|number_format(2, '.', ' ') }}</td> <td class="text-right">{{ totbefore10|number_format(2, '.', ' ') }}</td>
<td class="text-right"> <td class="text-right">
{% if decovalidate >= totbefore10 %} {% if decovalidate >= totbefore10 %}
{{ totbefore10|number_format(2, '.', ' ') }} {{ totbefore10|number_format(2, '.', ' ') }}
{% set todel=totbefore10 %} {% set todel=totbefore10 %}
{% else %} {% else %}
@@ -272,9 +262,9 @@
<td>{{ offer.name }}</td> <td>{{ offer.name }}</td>
<td>{{ offer.ref }}</td> <td>{{ offer.ref }}</td>
<td class="text-right">{{ offer.quantity|number_format(2, '.', ' ') }}</td> <td class="text-right">{{ offer.quantity|number_format(2, '.', ' ') }}</td>
<td class="text-right"> <td class="text-right">
{% if decovalidate >= offer.quantity %} {% if decovalidate >= offer.quantity %}
{{ offer.quantity|number_format(2, '.', ' ') }} {{ offer.quantity|number_format(2, '.', ' ') }}
{% set todel=offer.quantity %} {% set todel=offer.quantity %}
{% else %} {% else %}
@@ -299,9 +289,9 @@
<td>{{ offer.name }}</td> <td>{{ offer.name }}</td>
<td>{{ offer.ref }}</td> <td>{{ offer.ref }}</td>
<td class="text-right">{{ offer.quantity|number_format(2, '.', ' ') }}</td> <td class="text-right">{{ offer.quantity|number_format(2, '.', ' ') }}</td>
<td class="text-right"> <td class="text-right">
{% if decovalidate >= 0 %} {% if decovalidate >= 0 %}
{{ decovalidate|number_format(2, '.', ' ') }} {{ decovalidate|number_format(2, '.', ' ') }}
{% set todel=decovalidate %} {% set todel=decovalidate %}
{% else %} {% else %}
@@ -316,7 +306,7 @@
{% set decoproposed=decoproposed-totbefore10 %} {% set decoproposed=decoproposed-totbefore10 %}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<tfoot> <tfoot>
@@ -326,8 +316,6 @@
<td class="text-right">{{ (project.proposed - project.validate)|number_format(2, '.', ' ') }}</td> <td class="text-right">{{ (project.proposed - project.validate)|number_format(2, '.', ' ') }}</td>
</tfoot> </tfoot>
</table> </table>
<div class="new-page">&nbsp;</div>
{% endif %} {% endif %}
<h4>CONSOMMATION PASSEE</h4> <h4>CONSOMMATION PASSEE</h4>
{% if project.hors!=0 %} {% if project.hors!=0 %}
@@ -358,7 +346,6 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if not project.beforeastreinte is empty %} {% if not project.beforeastreinte is empty %}
<h4>ASTREINTES PASSEES</h4> <h4>ASTREINTES PASSEES</h4>
@@ -389,6 +376,8 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div>
<div class="new-page">&nbsp;</div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<br> <br>

View File

@@ -13,7 +13,7 @@
thead { thead {
display: table-header-group; display: table-header-group;
} }
tr { page-break-inside: avoid; } tr { page-break-inside: avoid; }
{%endif%} {%endif%}
{% endblock %} {% endblock %}
@@ -30,6 +30,11 @@
<label class="custom-control-label" for="switchactive">Projet Actif</label> <label class="custom-control-label" for="switchactive">Projet Actif</label>
</div> </div>
<div class="custom-control custom-switch float-right" style="margin-right:20px">
<input type="checkbox" class="custom-control-input" id="switchactivetask" {% if app.session.get('activetask') %} checked {% endif %}>
<label class="custom-control-label" for="switchactivetask">Tâche Active</label>
</div>
<p></p> <p></p>
{%for service in services %} {%for service in services %}
@@ -44,7 +49,7 @@
{% endif %} {% endif %}
{% set haveproject=true %} {% set haveproject=true %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if haveproject and havetask %} {% if haveproject and havetask %}
@@ -75,6 +80,7 @@
{% for project in service.projects %} {% for project in service.projects %}
{% if app.session.get('activeproject')==project.active and (app.session.get('idproject')=="all" or app.session.get('idproject')==project.id) %} {% if app.session.get('activeproject')==project.active and (app.session.get('idproject')=="all" or app.session.get('idproject')==project.id) %}
{% for task in project.tasks %} {% for task in project.tasks %}
{% if app.session.get('activetask')==task.active %}
{% set totvalidate=task.validate %} {% set totvalidate=task.validate %}
{% set totplanified=task.validate %} {% set totplanified=task.validate %}
{% for event in task.events %} {% for event in task.events %}
@@ -107,6 +113,7 @@
<td class="text-right">{{(task.quantity-totplanified)|number_format(2, '.', ' ')}}</td> <td class="text-right">{{(task.quantity-totplanified)|number_format(2, '.', ' ')}}</td>
<td class="text-center" style="background-color:{{task.color}}; color:#ffffff">{{task.color}}</td> <td class="text-center" style="background-color:{{task.color}}; color:#ffffff">{{task.color}}</td>
</tr> </tr>
{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@@ -131,17 +138,20 @@
order: [[ 1, "asc" ]] order: [[ 1, "asc" ]]
}); });
{%else%} {%else%}
$('#dataTables').removeClass("table table-striped table-bordered table-hover small dataTable no-footer"); $('#dataTables').removeClass("table table-striped table-bordered table-hover small dataTable no-footer");
{% endif %} {% endif %}
}); });
$('#switchactive').change(function() { $('#switchactive').change(function() {
window.location="{{ path('app_task_activeproject' )}}"; window.location="{{ path('app_task_activeproject' )}}";
}); });
$('#switchactivetask').change(function() {
window.location="{{ path('app_task_activetask' )}}";
});
function myprint() { function myprint() {
href=document.location.href; href=document.location.href;
document.location.href=href+"?fgprint=true"; document.location.href=href+"?fgprint=true";
} }
{% endblock %} {% endblock %}