mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-16 22:08:44 +02:00
N°7063 - Forms SDK - Add Symfony forms component
error forms issue
This commit is contained in:
@@ -5,8 +5,7 @@
|
||||
.custom-container{
|
||||
position: relative;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
/*margin-top: 25px;*/
|
||||
padding: 40px 20px 0px;
|
||||
}
|
||||
|
||||
.custom-container:before{
|
||||
@@ -50,31 +49,28 @@
|
||||
.container-flower .col-form-label{
|
||||
color: #8d63b7;
|
||||
}
|
||||
.container-flower .form-layout-fieldset{
|
||||
.container-flower .form-compound-fieldset{
|
||||
border: 1px solid #8d63b7;
|
||||
}
|
||||
|
||||
.container-color{
|
||||
position: relative;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
background-color: #faf7ff;
|
||||
}
|
||||
|
||||
.container-color .form-object-row{
|
||||
.container-color .form-compound-fieldset{
|
||||
background-color: #ebe4f6;
|
||||
border: none;
|
||||
}
|
||||
|
||||
|
||||
.container-color2{
|
||||
position: relative;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
background-color: #f7f9ff;
|
||||
}
|
||||
|
||||
.container-color2 .form-object-row{
|
||||
background-color: #a7b4d9;
|
||||
.container-color2 .form-compound-fieldset{
|
||||
background-color: #e8edf9;
|
||||
border: none;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ const iTopFormWidgetFactory = new function(){
|
||||
* @constructor
|
||||
*/
|
||||
const AutoInstall = function() {
|
||||
console.log('AutoInstall');
|
||||
console.log('iTopFormWidgetFactory AutoInstall');
|
||||
|
||||
// widgets catalog
|
||||
const WIDGETS = {
|
||||
|
||||
@@ -263,7 +263,7 @@ class FormHelper
|
||||
|
||||
// file - file download
|
||||
$oFormFactory->AddFileField('file', [
|
||||
'label' => 'Download a file',
|
||||
'label' => 'Download a file...',
|
||||
'required' => false
|
||||
]);
|
||||
|
||||
@@ -275,27 +275,29 @@ class FormHelper
|
||||
|
||||
'row__1' => [
|
||||
'column__1' => [
|
||||
'css_classes' => 'custom-container container-flower layout-grow',
|
||||
'fieldset__1' => [ 'birthday', 'city', 'tel'],
|
||||
'__css_classes' => 'custom-container container-flower layout-grow',
|
||||
'fieldset__1' => ['__label' => 'Informations Utilisateur' , 'birthday', 'city', 'tel'],
|
||||
],
|
||||
'column__2' => [
|
||||
'css_classes' => 'custom-container container-color mb-3',
|
||||
'__css_classes' => 'custom-container container-color mb-3',
|
||||
'fieldset__1' => ['mode', 'interval'],
|
||||
],
|
||||
|
||||
],
|
||||
'row__2' => [
|
||||
'css_classes' => 'custom-container container-color2 mb-3',
|
||||
'fieldset__2' => ['file'],
|
||||
'__css_classes' => 'custom-container container-color2 mb-3',
|
||||
'column__2' => [
|
||||
'fieldset__1' => ['file'],
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
if(self::$MODES_DEFINITIONS[$iMode]['group']){
|
||||
$aDescription['row__1']['column__2']['fieldset__2'][] = 'Person_2';
|
||||
$aDescription['row__2']['fieldset__1'] = [ 'Person_1', 'Person_3'];
|
||||
$aDescription['row__2']['column__1']['fieldset__1'] = [ 'Person_1', 'Person_3'];
|
||||
}
|
||||
else{
|
||||
$aDescription['row__2']['fieldset__1'] = [ 'Person_1_name'];
|
||||
$aDescription['row__2']['column__1']['fieldset__1'] = [ 'Person_1_name'];
|
||||
}
|
||||
|
||||
// layout description
|
||||
@@ -314,7 +316,8 @@ class FormHelper
|
||||
|
||||
'row__1' => [
|
||||
'column__1' => [
|
||||
'css_classes' => 'custom-container container-flower layout-grow',
|
||||
'__css_classes' => 'custom-container container-flower layout-grow',
|
||||
'__label' => 'custom-container container-flower layout-grow',
|
||||
'fieldset__1' => [ 'birthday', 'city', 'tel'],
|
||||
],
|
||||
'column__2' => [
|
||||
@@ -375,8 +378,6 @@ class FormHelper
|
||||
|
||||
],
|
||||
|
||||
|
||||
|
||||
'column__1' => [
|
||||
'css_classes' => 'custom-container container-flower layout-grow',
|
||||
'fieldset__1' => [ 'birthday', 'city', 'tel'],
|
||||
|
||||
@@ -217,7 +217,6 @@ class SymfonyBridge
|
||||
if($aSymfonyTypeDeclaration['type'] === FieldsetType::class && isset($aSymfonyTypeDeclaration['options']['layout'])){
|
||||
['types' => $aItems] = $this->CreateLayoutTypes($aSymfonyTypeDeclaration['options']['layout'], $oFormBuilder, $aSymfonyTypeDeclaration['options']['fields']);
|
||||
$aSymfonyTypeDeclaration['options']['fields'] = array_merge($aItems, $aSymfonyTypeDeclaration['options']['fields']);
|
||||
$aTest = 'test';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,13 +265,17 @@ class SymfonyBridge
|
||||
// variables
|
||||
$aResult = [];
|
||||
$sClasses = '';
|
||||
$sLabel = null;
|
||||
|
||||
// scan layout...
|
||||
foreach ($aLayout as $sKey => $oLayoutElement)
|
||||
{
|
||||
if($sKey === 'css_classes'){
|
||||
if($sKey === '__css_classes'){
|
||||
$sClasses = $oLayoutElement;
|
||||
}
|
||||
else if($sKey === '__label'){
|
||||
$sLabel = $oLayoutElement;
|
||||
}
|
||||
else if(str_starts_with($sKey, 'row__')){
|
||||
$aResult[$sKey] = $this->CreateLayoutContainerType($oLayoutElement, $oFormBuilder, $sKey, RowType::class, $aDescriptions);
|
||||
}
|
||||
@@ -292,6 +295,7 @@ class SymfonyBridge
|
||||
|
||||
return [
|
||||
'types' => $aResult,
|
||||
'label' => $sLabel,
|
||||
'css_classes' => $sClasses
|
||||
];
|
||||
}
|
||||
@@ -309,12 +313,13 @@ class SymfonyBridge
|
||||
*/
|
||||
private function CreateLayoutContainerType(array $aLayout, FormBuilderInterface $oFormBuilder, string $sKey, string $sTypeClassName, array &$aDescriptions) : array
|
||||
{
|
||||
['types' => $aItems, 'css_classes' => $sCssClasses] = $this->CreateLayoutTypes($aLayout, $oFormBuilder, $aDescriptions);
|
||||
['types' => $aItems, 'label' => $sLabel, 'css_classes' => $sCssClasses] = $this->CreateLayoutTypes($aLayout, $oFormBuilder, $aDescriptions);
|
||||
|
||||
return [
|
||||
'name' => $sKey,
|
||||
'type' => $sTypeClassName,
|
||||
'options' => [
|
||||
'label' => $sLabel !== null ? $sLabel : false,
|
||||
'fields' => $aItems,
|
||||
'attr' => [
|
||||
'class' => $sCssClasses
|
||||
|
||||
Reference in New Issue
Block a user