Commit e7e82d3a authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

- Fix : les champs non-utilisés sont cachés

 - Les selecteur de date sont de retour
 - Fix erreur de merge
parent 83a55888
Loading
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ use Oscar\Entity\TVA;
use Oscar\Exception\OscarException;
use Oscar\Formatter\OscarFormatterConst;
use Oscar\Provider\Privileges;
use Oscar\Service\administration\AdminActivityFormAPIService;
use Oscar\Service\administration\AdminDisciplineAPIService;
use Oscar\Service\administration\AdministrationConfigService;
use Oscar\Service\administration\AdminRolePrivilegeServiceAPIService;
@@ -2063,17 +2064,6 @@ class AdministrationController extends AbstractOscarController implements
        ];
    }

    public function disciplineAction()
    {
        $this->getOscarUserContextService()->check(Privileges::MAINTENANCE_DISCIPLINE_MANAGE);
        $disciplineConfigApi = new AdminDisciplineAPIService();
        $disciplineConfigApi->setServiceContainer($this->getServiceLocator());
        if ($this->isAjax() || $this->getRequest()->getQuery('f') === 'json') {
            return $disciplineConfigApi->entrypoint($this->getRequest());
        }
        return [];
    }

    public function activityFormAction()
    {
        $this->getOscarUserContextService()->check(Privileges::MAINTENANCE_PARAMETERS_MANAGE);
+6 −1
Original line number Diff line number Diff line
@@ -178,14 +178,19 @@ class ProjectGrantForm extends Form implements InputFilterProviderInterface, Use

            if ($fieldConfig['type'] === 'Select') {
                $options['value_options'] = $this->getOptionsValues($fieldConfig['name']);
            }

            $type = $fieldConfig['type'];
            if( $type === 'Date' ){
                $type = 'Text';
                $attributes['class'] .= " input-date";
            }

            $this->add([
                'name' => $fieldName,
                'help' => "Some helping message",
                'required' => $fieldConfig['use'] === true,
                'type' => $fieldConfig['type'],
                'type' => $type,
                'attributes' => $attributes,
                'options' => $options,
            ]);
+5 −5
Original line number Diff line number Diff line
@@ -1086,7 +1086,7 @@ class OscarConfigurationService implements ServiceLocatorAwareInterface
            ],
            [
                "name" => "dateStart",
                "type" => 'Text',
                "type" => 'Date',
                "label" => "Date de début",
                "help" => "TOTO",
                "allow_use" => false,
@@ -1096,7 +1096,7 @@ class OscarConfigurationService implements ServiceLocatorAwareInterface
            ],
            [
                "name" => "dateEnd",
                "type" => 'Text',
                "type" => 'Date',
                "label" => "Date de fin",
                "help" => "",
                "allow_use" => false,
@@ -1106,7 +1106,7 @@ class OscarConfigurationService implements ServiceLocatorAwareInterface
            ],
            [
                "name" => "dateSigned",
                "type" => 'Text',
                "type" => 'Date',
                "label" => "Date de signature",
                "help" => "",
                "allow_use" => false,
@@ -1116,7 +1116,7 @@ class OscarConfigurationService implements ServiceLocatorAwareInterface
            ],
            [
                "name" => "dateOpened",
                "type" => 'Text',
                "type" => 'Date',
                "label" => "Date d'ouverture financier",
                "help" => "",
                "allow_use" => false,
@@ -1126,7 +1126,7 @@ class OscarConfigurationService implements ServiceLocatorAwareInterface
            ],
            [
                "name" => "dateNegociation",
                "type" => 'Text',
                "type" => 'Date',
                "label" => "Date négociation",
                "help" => "",
                "allow_use" => true,
+12 −1
Original line number Diff line number Diff line
@@ -539,8 +539,9 @@ class ProjectGrantApiService implements
            $numeros[$key] = $value;
        }

        $config = $this->getOscarConfigurationService()->getActivityFormConfigKeying();

        return [
        $out = [
            'id' => $activity->getId(),
            'label' => $activity->getLabel(),
            'numOscar' => $activity->getOscarNum(),
@@ -569,6 +570,16 @@ class ProjectGrantApiService implements
                'pcru'           => $urlPlugin->fromRoute('contract/pcru-informations', ['id' => $activity->getId()])
            ]
        ];

        foreach ($config as $configKey => $configField) {
            if ($configField['use'] === false) {
                unset($out[$configKey]);
            }
        }

        return $out;


    }

    /**
+16 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@
</div>
<script>
    Initer.ready(function () {
        console.log("INIT");
        require(['select2'], function () {
            $('.select2,select[multiple]').select2();
        });
@@ -183,5 +184,20 @@
        require(['Keyvalue'], function (KeyValue) {
            console.log(KeyValue);
        });

        var $dater = $('.input-date');
        console.log("DATERS", $dater);
        if( $dater.length ){
            require(['datepicker'], function(){
                $dater.datepicker({
                    format: "yyyy-mm-dd",
                    todayBtn: "linked",
                    clearBtn: true,
                    language: "fr",
                    autoclose: true,
                    toggleActive: true
                });
            });
        }
    })
</script>
 No newline at end of file
Loading