Commit f18d8348c5d20354dd053be0db3443d904160638

Authored by Gedeson Wasley
1 parent 51f0da63
Exists in master and in 1 other branch 3.1

Paginação de software não utilizados

src/Cacic/CommonBundle/Controller/SoftwareController.php
... ... @@ -159,7 +159,7 @@ class SoftwareController extends Controller
159 159 * Tela de exclusão de Softwares não associados a nenhuma máquina
160 160 * @param Symfony\Component\HttpFoundation\Request $request
161 161 */
162   - public function naoUsadosAction( Request $request )
  162 + public function naoUsadosAction( Request $request, $page )
163 163 {
164 164 if ( $request->isMethod('POST') )
165 165 {
... ... @@ -191,7 +191,7 @@ class SoftwareController extends Controller
191 191 return $this->render(
192 192 'CacicCommonBundle:Software:naousados.html.twig',
193 193 array(
194   - 'softwares' => $this->getDoctrine()->getRepository( 'CacicCommonBundle:Software' )->listarNaoUsados()
  194 + 'softwares' => $this->getDoctrine()->getRepository( 'CacicCommonBundle:Software' )->listarNaoUsados( $this->get( 'knp_paginator' ), $page )
195 195 )
196 196 );
197 197 }
... ...
src/Cacic/CommonBundle/Entity/SoftwareRepository.php
... ... @@ -77,15 +77,20 @@ class SoftwareRepository extends EntityRepository
77 77 *
78 78 * Método de listagem dos Softwares cadastrados que não estão associados a nenhuma máquina
79 79 */
80   - public function listarNaoUsados()
  80 + public function listarNaoUsados( \Knp\Component\Pager\Paginator $paginator, $page = 1)
81 81 {
82   - $_dql = "SELECT s
83   - FROM CacicCommonBundle:Software s
84   - LEFT JOIN s.estacoes se
85   - WHERE se IS NULL
86   - ORDER BY s.nmSoftware ASC";
  82 + $qb = $this->createQueryBuilder('sw')
  83 + ->select('sw.nmSoftware, sw.idSoftware')
  84 + ->leftJoin( 'sw.estacoes ','se')
  85 + ->where('se is null')
  86 + ->groupBy('sw.nmSoftware,sw.idSoftware')
  87 + ->orderBy('sw.nmSoftware','ASC');
87 88  
88   - return $this->getEntityManager()->createQuery( $_dql )->getArrayResult();
  89 + return $paginator->paginate(
  90 + $qb->getQuery()->execute(),
  91 + $page,
  92 + 10
  93 + );
89 94 }
90 95  
91 96 /**
... ...
src/Cacic/CommonBundle/Form/Type/SoftwareEstacaoType.php
... ... @@ -4,6 +4,7 @@ namespace Cacic\CommonBundle\Form\Type;
4 4  
5 5 use Symfony\Component\Form\AbstractType;
6 6 use Symfony\Component\Form\FormBuilderInterface;
  7 +use Cacic\CommonBundle\Entity\SoftwareRepository;
7 8  
8 9 /**
9 10 *
... ... @@ -18,10 +19,20 @@ class SoftwareEstacaoType extends AbstractType
18 19 {
19 20 $builder->add(
20 21 'idSoftware',
21   - null,
  22 + 'entity',
22 23 array(
  24 + 'class' => 'CacicCommonBundle:Software',
  25 + 'query_builder' => function(SoftwareRepository $er) {
  26 + return $er->createQueryBuilder('sw')
  27 + ->select('sw')
  28 + ->innerJoin('CacicCommonBundle:PropriedadeSoftware', 'prop', 'WITH', 'sw.idSoftware = prop.software')
  29 + ->innerJoin('CacicCommonBundle:ClassProperty', 'class','WITH', 'prop.classProperty = class.idClassProperty')
  30 + ->groupBy('class.idClassProperty, class.nmPropertyName, sw')
  31 + ->orderBy('sw.nmSoftware');
  32 + },
23 33 'property' => 'nmSoftware',
24 34 'empty_value' => 'Selecione',
  35 + 'max_length'=>100,
25 36 'label'=>'Software' )
26 37 );
27 38  
... ...
src/Cacic/CommonBundle/Form/Type/UsbDeviceType.php
... ... @@ -39,7 +39,7 @@ class UsbDeviceType extends AbstractType
39 39 $builder->add('teObservacao', 'textarea',
40 40 array(
41 41 'label'=>'Observações',
42   - 'required' => false
  42 + 'required' => true
43 43 )
44 44 );
45 45 }
... ...
src/Cacic/CommonBundle/Resources/config/routing.yml
... ... @@ -233,8 +233,10 @@ cacic_software_naoclassificados:
233 233 page: \d+
234 234  
235 235 cacic_software_naousados:
236   - pattern: /software/naousados
237   - defaults: { _controller: CacicCommonBundle:Software:naoUsados}
  236 + pattern: /software/naousados/{page}
  237 + defaults: { _controller: CacicCommonBundle:Software:naoUsados, page:1}
  238 + requirements:
  239 + page: \d+
238 240  
239 241 cacic_configuracao_padrao:
240 242 pattern: /configuracao/padrao
... ...
src/Cacic/CommonBundle/Resources/views/Rede/index.html.twig
1 1 {% extends 'CacicCommonBundle::base.html.twig' %}
2 2  
3 3 {% block breadcrumb %}
4   - <li class="active">{{ "Subredes"|trans }}</li>
  4 + <li class="active">{{ "Sub-redes"|trans }}</li>
5 5 {% endblock %}
6 6  
7 7 {% block body %}
... ... @@ -10,19 +10,19 @@
10 10 <div class="span12">
11 11 <div class="box grad_colour_black">
12 12  
13   - <h2 class="box_head round_top"><i class="icon-sitemap"></i> {{ "Subredes"|trans }}</h2>
  13 + <h2 class="box_head round_top"><i class="icon-sitemap"></i> {{ "Sub-redes"|trans }}</h2>
14 14  
15 15 <div class="block box_content round_bottom padding_10">
16 16  
17   - <h3>{{ "Lista de Subredes cadastrados"|trans }}</h3>
18   - <p>{{ "Neste módulo deverão ser cadastrados as Subredes do sistema"|trans }}</p>
  17 + <h3>{{ "Lista de Sub-redes cadastrados"|trans }}</h3>
  18 + <p>{{ "Neste módulo deverão ser cadastrados as Sub-redes do sistema"|trans }}</p>
19 19 <br />
20 20  
21 21 <table class="table table-striped table-bordered">
22 22 <thead>
23 23 <tr>
24 24 <th width="10%">{{ "Endereço"|trans }}<br />{{ "Máscara"|trans }}</th>
25   - <th width="20%">{{ "Subrede"|trans }}</th>
  25 + <th width="20%">{{ "Sub-rede"|trans }}</th>
26 26 <th width="10%" style="text-align: center">{{ "Local"|trans }}</th>
27 27 <th width="5%" style="text-align: center">{{ "Máquinas"|trans }}</th>
28 28 <th width="10%" style="text-align: center">{{ "Autenticação"|trans }}</th>
... ...
src/Cacic/CommonBundle/Resources/views/Software/naousados.html.twig
... ... @@ -49,7 +49,11 @@
49 49  
50 50 </tbody>
51 51 </table>
52   -
  52 +
  53 + {# display navigation #}
  54 + <div class="navigation">
  55 + {{ knp_pagination_render(softwares) }}
  56 + </div>
53 57 <div class="control-group" align="right">
54 58 <div class="controls">
55 59 <button type="reset" class="btn">
... ...
src/Cacic/CommonBundle/Resources/views/UsbDevice/index.html.twig
... ... @@ -33,11 +33,11 @@
33 33  
34 34 {% for UsbDevice in UsbDevice %}
35 35  
36   - <tr id="item_{{ UsbDevice[0].idUsbDevice }}" class="{{ cycle(['row0', 'row1'], loop.index) }}">
37   - <td style="text-align: center" id="item_desc_{{ UsbDevice[0].idUsbDevice }}">{{ UsbDevice[0].idUsbDevice }}-{{ UsbDevice[0].nmUsbDevice }}</td>
38   - <td style="text-align: center" ">{{ UsbDevice.idUsbVendor }}-{{ UsbDevice.nmUsbVendor }}</td>
  36 + <tr id="item_{{ UsbDevice['idUsbDevice'] }}" class="{{ cycle(['row0', 'row1'], loop.index) }}">
  37 + <td style="text-align: center" id="item_desc_{{ UsbDevice['idUsbDevice'] }}">{{ UsbDevice['idUsbDevice'] }}-{{ UsbDevice['nmUsbDevice'] }}</td>
  38 + <td style="text-align: center" >{{ UsbDevice.idUsbVendor }}-{{ UsbDevice.nmUsbVendor }}</td>
39 39 <td style="text-align: center" class="td-actions">
40   - <a href="{{ path('cacic_usbdevice_editar', {'idUsbDevice': UsbDevice[0].idUsbDevice }) }}" class="btn btn-small" title="{{ "Editar Item"|trans }}">
  40 + <a href="{{ path('cacic_usbdevice_editar', {'idUsbDevice': UsbDevice['idUsbDevice'] }) }}" class="btn btn-small" title="{{ "Editar Item"|trans }}">
41 41 <i class="btn-icon-only icon-edit icon-large"></i>
42 42 </a>
43 43  
... ...
src/Cacic/CommonBundle/Resources/views/base.html.twig
... ... @@ -47,7 +47,7 @@
47 47 <ul>
48 48 <li><a href="{{ path('cacic_local_index') }}">{{ "Locais"|trans }}</a></li>
49 49 <li><a href="{{ path('cacic_servidorautenticacao_index') }}">{{ "Servidores Autenticação"|trans }}</a></li>
50   - <li><a href="{{ path('cacic_subrede_index') }}">{{ "Subredes"|trans }}</a></li>
  50 + <li><a href="{{ path('cacic_subrede_index') }}">{{ "Sub-redes"|trans }}</a></li>
51 51 <li><a href="{{ path('cacic_aplicativo_index') }}">{{ "Aplicativo"|trans }}</a></li>
52 52 <li><a href="{{ path('cacic_usuario_index') }}">{{ "Usuários"|trans }}</a></li>
53 53 <li><a href="{{ path('cacic_grupo_usuario_index') }}">{{ "Grupo de Usuários"|trans }}</a></li>
... ...
src/Cacic/RelatorioBundle/Resources/views/Faturamento/faturamentoResultado.html.twig
... ... @@ -24,9 +24,13 @@
24 24 <th width="20%" style="text-align: center">{{ "Endereço IP"|trans }}</th>
25 25 <th width="20%" style="text-align: center">{{ "Estações"|trans }}</th>
26 26 <th style="text-align: center">
27   - <a class="btn btn-success" href="{{ path('cacic_faturamento_listar_csv') }}/{{ logs[0]['idRede'] }}/{{data['dtAcaoInicio'] }}/{{ data['dtAcaoFim'] }}" title="{{ "Relatório de coletas do software"|trans }}" target="_blank">
  27 + {% if logs|length > 0 %}
  28 + {% cont++ %}
  29 + <a class="btn btn-success" href="{{ path('cacic_faturamento_listar_csv') }}/
  30 + {% for log in logs %}{{logs[{% cont %}]['idRede']}}/{{data['dtAcaoInicio'] }}/{{ data['dtAcaoFim'] }}{% endfor %}" title="{{ "Relatório de coletas do software"|trans }}" target="_blank">
28 31 <i class="icon-download-alt"></i>
29 32 </a>
  33 + {% endif %}
30 34 </th>
31 35 </tr>
32 36 </thead>
... ...