Browse Source

Init the portal captive

Jean Sumara 5 years ago
parent
commit
03e007c127

+ 122 - 0
src/FTTHBundle/Admin/PortalCaptiveAdmin.php

@@ -0,0 +1,122 @@
+<?php
+
+namespace FTTHBundle\Admin;
+
+use Base\AdminBundle\Admin\BaseAdmin;
+use Sonata\AdminBundle\Datagrid\DatagridMapper;
+use Sonata\AdminBundle\Datagrid\ListMapper;
+use Sonata\AdminBundle\Form\FormMapper;
+use Sonata\AdminBundle\Show\ShowMapper;
+
+class PortalCaptiveAdmin extends BaseAdmin
+{
+
+    /**
+     * @param DatagridMapper $datagridMapper
+     */
+    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
+    {
+        $datagridMapper
+            ->add('profile')
+            ->add('model');
+    }
+
+    /**
+     * @param ListMapper $listMapper
+     */
+    protected function configureListFields(ListMapper $listMapper)
+    {
+        $listMapper
+            ->add('model')
+            ->add('profile')
+            ->add('vlan')
+            ->add('vlanProfile')
+            ->add('onuProfile')
+            ->add('vlans')
+            ->add('trafficProfileIn')
+            ->add('trafficProfileOut')
+            ->add('tcontprofile')
+            ->add('base')
+            ->add('created')
+            ->add('_action', null, array(
+                'actions' => array(
+                    'use' => array('template' => 'FTTHBundle:ONUTemplate:action_use.html.twig'),
+                    'edit' => array(),
+                    'delete' => array()),
+            ));
+    }
+
+    /**
+     * @param FormMapper $formMapper
+     */
+    protected function configureFormFields(FormMapper $formMapper)
+    {
+        $formMapper
+            ->tab('default')
+            ->with('')
+            ->add('model')
+            ->add('profile')
+            ->add('vlans', null, array(
+                'required' => false,
+                'multiple' => true,
+            ))
+            ->add('vlan')
+            ->add('vlanProfile')
+            ->add('onuProfile')
+            ->add('trafficProfileIn')
+            ->add('trafficProfileOut')
+            ->add('tcontprofile')
+            ->add('catv')
+            ->end()
+            ->with('Extra')
+            ->add('extraData')
+            ->end()
+            ->end();
+    }
+
+    /**
+     * @param ShowMapper $showMapper
+     */
+    protected function configureShowFields(ShowMapper $showMapper)
+    {
+        $showMapper
+            ->tab('default')
+            ->with('')
+            ->add('model')
+            ->add('profile')
+            ->add('vlans')
+            ->add('vlan')
+            ->add('vlanProfile')
+            ->add('onuProfile')
+            ->add('trafficProfileIn')
+            ->add('trafficProfileOut')
+            ->add('tcontprofile')
+            ->add('created')
+            ->end()
+            ->with('Extra')
+            ->add('extraData')
+            ->end()
+            ->end();
+    }
+
+    /**
+     * @param string $action
+     * @param Object $object
+     *
+     * @return array
+     */
+    public function configureActionButtons($action, $object = null)
+    {
+        $actions = parent::configureActionButtons($action, $object);
+        $actions['disable_base'] = array('template' => 'FTTHBundle:ONUTemplate:disable_base_button.html.twig');
+
+        return $actions;
+    }
+
+    public function configure()
+    {
+        $this->setTemplate('create', 'FTTHBundle:ONUTemplate:form.html.twig');
+        $this->setTemplate('edit', 'FTTHBundle:ONUTemplate:form.html.twig');
+    }
+
+}

+ 8 - 0
src/FTTHBundle/Resources/config/services.yml

@@ -16,6 +16,14 @@ services:
         calls:
             - [setTranslationDomain, [FTTHBundle]]
 
+    sonata.admin.portalcaptive:
+        class: FTTHBundle\Admin\PortalCaptiveAdmin
+        arguments: [~, FTTHBundle\Entity\ONUTemplate, BaseAdminBundle:CRUD]
+        tags:
+            - { name: sonata.admin, manager_type: orm, group: FTTH, label: PortalCaptive, label_catalogue: FTTHBundle, label_translator_strategy: sonata.admin.label.strategy.underscore }
+        calls:
+            - [setTranslationDomain, [FTTHBundle]]
+
     sonata.admin.olt:
         class: FTTHBundle\Admin\OLTAdmin
         arguments: [~, FTTHBundle\Entity\OLT, WorkflowBundle:CRUD]

+ 1 - 0
src/FTTHBundle/Resources/translations/FTTHBundle.es.yml

@@ -10,6 +10,7 @@ NAP: NAP
 Profile: Perfil
 olt_execute_time: Tiempo(min) entre consultas a OLT
 ONUTemplate: Plantilla ONU
+PortalCaptive: Portal Captive
 olt_discovery_configuration: Configuración Autodiscovery
 autodiscovery: Autodiscovery
 PreSale: Preventa