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
defaults: { _controller: App\Controller\TaskController:activeproject }
app_task_activetask:
path: /master/task/activetask
defaults: { _controller: App\Controller\TaskController:activetask }
#== Event ====================================================================================================
app_event:
path: /user/event

View File

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

View File

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

View File

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

View File

@@ -13,7 +13,7 @@
thead {
display: table-header-group;
}
tr { page-break-inside: avoid; }
tr { page-break-inside: avoid; }
{%endif%}
{% endblock %}
@@ -30,6 +30,11 @@
<label class="custom-control-label" for="switchactive">Projet Actif</label>
</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>
{%for service in services %}
@@ -44,7 +49,7 @@
{% endif %}
{% set haveproject=true %}
{% endif %}
{% endif %}
{% endfor %}
{% if haveproject and havetask %}
@@ -75,6 +80,7 @@
{% 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) %}
{% for task in project.tasks %}
{% if app.session.get('activetask')==task.active %}
{% set totvalidate=task.validate %}
{% set totplanified=task.validate %}
{% for event in task.events %}
@@ -107,6 +113,7 @@
<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>
</tr>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
@@ -131,17 +138,20 @@
order: [[ 1, "asc" ]]
});
{%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 %}
});
$('#switchactive').change(function() {
window.location="{{ path('app_task_activeproject' )}}";
});
$('#switchactivetask').change(function() {
window.location="{{ path('app_task_activetask' )}}";
});
function myprint() {
href=document.location.href;
document.location.href=href+"?fgprint=true";
}
{% endblock %}
}
{% endblock %}