mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°7063 - Forms SDK - Add Symfony forms component
error forms issue
This commit is contained in:
79
css/form-sdk/test.css
Normal file
79
css/form-sdk/test.css
Normal file
@@ -0,0 +1,79 @@
|
||||
.layout-grow{
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.custom-container{
|
||||
position: relative;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
/*margin-top: 25px;*/
|
||||
}
|
||||
|
||||
.custom-container:before{
|
||||
content: 'Custom Layout CSS';
|
||||
font-weight: 500;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: -10px;
|
||||
transform: translateX(-50%);
|
||||
/*border: 1px solid #9c21af;*/
|
||||
background-color: white;
|
||||
padding: 5px 15px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.container-flower{
|
||||
background-color: #f3deff;
|
||||
background-size: 500px;
|
||||
background-repeat: no-repeat;
|
||||
background-position-x: right;
|
||||
background-position-y: bottom;
|
||||
background: linear-gradient( to right bottom, rgb(248 242 251) 50%, rgb(241 187 255) );
|
||||
}
|
||||
.container-flower fieldset{
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
.container-flower:after{
|
||||
content: '';
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
background-image: url('../../sources/FormImplementation/Resources/6662396.png');
|
||||
background-size: 300px;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.container-flower .col-form-label{
|
||||
color: #8d63b7;
|
||||
}
|
||||
.container-flower .form-layout-fieldset{
|
||||
border: 1px solid #8d63b7;
|
||||
}
|
||||
|
||||
.container-color{
|
||||
position: relative;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
background-color: #faf7ff;
|
||||
}
|
||||
|
||||
.container-color .form-object-row{
|
||||
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;
|
||||
border: none;
|
||||
}
|
||||
@@ -413,6 +413,9 @@ return array(
|
||||
'Combodo\\iTop\\FormSDK\\Service\\FormManager' => $baseDir . '/sources/FormSDK/Service/FormManager.php',
|
||||
'Combodo\\iTop\\FormSDK\\Symfony\\SymfonyBridge' => $baseDir . '/sources/FormSDK/Symfony/SymfonyBridge.php',
|
||||
'Combodo\\iTop\\FormSDK\\Symfony\\Type\\Compound\\FormObjectType' => $baseDir . '/sources/FormSDK/Symfony/Type/Compound/FormObjectType.php',
|
||||
'Combodo\\iTop\\FormSDK\\Symfony\\Type\\Layout\\ColumnType' => $baseDir . '/sources/FormSDK/Symfony/Type/Layout/ColumnType.php',
|
||||
'Combodo\\iTop\\FormSDK\\Symfony\\Type\\Layout\\FieldsetType' => $baseDir . '/sources/FormSDK/Symfony/Type/Layout/FieldsetType.php',
|
||||
'Combodo\\iTop\\FormSDK\\Symfony\\Type\\Layout\\RowType' => $baseDir . '/sources/FormSDK/Symfony/Type/Layout/RowType.php',
|
||||
'Combodo\\iTop\\Form\\Field\\AbstractSimpleField' => $baseDir . '/sources/Form/Field/AbstractSimpleField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\BlobField' => $baseDir . '/sources/Form/Field/BlobField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\CaseLogField' => $baseDir . '/sources/Form/Field/CaseLogField.php',
|
||||
|
||||
@@ -822,6 +822,9 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
|
||||
'Combodo\\iTop\\FormSDK\\Service\\FormManager' => __DIR__ . '/../..' . '/sources/FormSDK/Service/FormManager.php',
|
||||
'Combodo\\iTop\\FormSDK\\Symfony\\SymfonyBridge' => __DIR__ . '/../..' . '/sources/FormSDK/Symfony/SymfonyBridge.php',
|
||||
'Combodo\\iTop\\FormSDK\\Symfony\\Type\\Compound\\FormObjectType' => __DIR__ . '/../..' . '/sources/FormSDK/Symfony/Type/Compound/FormObjectType.php',
|
||||
'Combodo\\iTop\\FormSDK\\Symfony\\Type\\Layout\\ColumnType' => __DIR__ . '/../..' . '/sources/FormSDK/Symfony/Type/Layout/ColumnType.php',
|
||||
'Combodo\\iTop\\FormSDK\\Symfony\\Type\\Layout\\FieldsetType' => __DIR__ . '/../..' . '/sources/FormSDK/Symfony/Type/Layout/FieldsetType.php',
|
||||
'Combodo\\iTop\\FormSDK\\Symfony\\Type\\Layout\\RowType' => __DIR__ . '/../..' . '/sources/FormSDK/Symfony/Type/Layout/RowType.php',
|
||||
'Combodo\\iTop\\Form\\Field\\AbstractSimpleField' => __DIR__ . '/../..' . '/sources/Form/Field/AbstractSimpleField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\BlobField' => __DIR__ . '/../..' . '/sources/Form/Field/BlobField.php',
|
||||
'Combodo\\iTop\\Form\\Field\\CaseLogField' => __DIR__ . '/../..' . '/sources/Form/Field/CaseLogField.php',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
'name' => 'combodo/itop',
|
||||
'pretty_version' => 'dev-develop',
|
||||
'version' => 'dev-develop',
|
||||
'reference' => '2bcc4d99896aab3e70ed0d7aa5f43d661b5bbeb5',
|
||||
'reference' => '75fde4c9a3fb4b46ae8765e961d0f590bdad199b',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
@@ -22,7 +22,7 @@
|
||||
'combodo/itop' => array(
|
||||
'pretty_version' => 'dev-develop',
|
||||
'version' => 'dev-develop',
|
||||
'reference' => '2bcc4d99896aab3e70ed0d7aa5f43d661b5bbeb5',
|
||||
'reference' => '75fde4c9a3fb4b46ae8765e961d0f590bdad199b',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
||||
@@ -13,6 +13,8 @@ use Symfony\Component\Validator\Constraints\Regex;
|
||||
|
||||
class FormHelper
|
||||
{
|
||||
static private int $PERSON_COUNT = 5;
|
||||
|
||||
/**
|
||||
* Create a sample form factory for demo purpose.
|
||||
*
|
||||
@@ -29,7 +31,7 @@ class FormHelper
|
||||
$oFormFactory = $oFormManager->CreateFactory();
|
||||
|
||||
// add X person forms...
|
||||
for($i = 0 ; $i < 5 ; $i++){
|
||||
for($i = 0 ; $i < self::$PERSON_COUNT ; $i++){
|
||||
|
||||
// retrieve person
|
||||
$oPerson = MetaModel::GetObject('Person', $i+1);
|
||||
@@ -52,7 +54,7 @@ class FormHelper
|
||||
'label' => 'Tel',
|
||||
'constraints' => new Regex(['pattern' => '/\+33\(\d\) \d\d \d\d \d\d \d\d/'], null, '+{33}(0) 00 00 00 00'),
|
||||
'required' => false
|
||||
], null);
|
||||
], '+33(6) 35 57 48 77');
|
||||
|
||||
// birthday - date
|
||||
$oFormFactory->AddDateField('birthday', [
|
||||
@@ -147,6 +149,27 @@ class FormHelper
|
||||
]
|
||||
], ['0', '2','4']);
|
||||
|
||||
// layout description
|
||||
$oFormFactory->SetLayoutDescription([
|
||||
|
||||
'row__1' => [
|
||||
'column__1' => [
|
||||
'css_classes' => 'custom-container container-flower layout-grow',
|
||||
'fieldset__1' => [ 'birthday', 'city', 'tel'],
|
||||
],
|
||||
'column__2' => [
|
||||
'css_classes' => 'custom-container container-color',
|
||||
'fieldset__2' => ['mode', 'interval', 'Person_2'],
|
||||
],
|
||||
|
||||
],
|
||||
'row__2' => [
|
||||
'css_classes' => 'custom-container container-color2',
|
||||
'fieldset__1' => [ 'Person_1', 'Person_3'],
|
||||
'fieldset__2' => [ 'Person_1_name'],
|
||||
]
|
||||
]);
|
||||
|
||||
return $oFormFactory;
|
||||
}
|
||||
|
||||
|
||||
BIN
sources/FormImplementation/Resources/6662396.jpg
Normal file
BIN
sources/FormImplementation/Resources/6662396.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 684 KiB |
BIN
sources/FormImplementation/Resources/6662396.png
Normal file
BIN
sources/FormImplementation/Resources/6662396.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 MiB |
@@ -136,7 +136,21 @@ final class FormFactoryObjectAdapter implements FormFactoryAdapterInterface
|
||||
*/
|
||||
private function GetAttributeName(string $sAttributeCode) : string
|
||||
{
|
||||
return $this->bGroup ? $sAttributeCode : $this->GetIdentifier() . '-' . $sAttributeCode;
|
||||
return $this->bGroup ? $sAttributeCode : $this->GetIdentifier() . '_' . $sAttributeCode;
|
||||
}
|
||||
|
||||
public function GetLayoutDescription()
|
||||
{
|
||||
return [
|
||||
'row__1' => [
|
||||
'column__1' => [
|
||||
'fieldset__1' => [ 'name'],
|
||||
],
|
||||
'column__2' => [
|
||||
'fieldset__2' => ['mobile_phone'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
|
||||
@@ -56,6 +56,7 @@ trait FormFactoryBuilderTrait
|
||||
*/
|
||||
public function AddNumberField(string $sKey, array $aOptions, mixed $oData = null) : FormFactory
|
||||
{
|
||||
// $aOptions['property_path'] = $sKey;
|
||||
|
||||
$this->aFieldsDescriptions[$sKey] = new FormFieldDescription($sKey, FormFieldTypeEnumeration::NUMBER, $aOptions);
|
||||
$this->aFieldsData[$sKey] = $oData;
|
||||
@@ -104,7 +105,6 @@ trait FormFactoryBuilderTrait
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add duration field.
|
||||
*
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
|
||||
|
||||
###> symfony/framework-bundle ###
|
||||
#APP_ENV=dev
|
||||
APP_ENV=dev
|
||||
#APP_SECRET=extracted from iTop general configuration in ./symfony/packages/itop_configuration_bridge.php
|
||||
###< symfony/framework-bundle ###
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<link rel="stylesheet" href="{{ asset_node('tom-select/dist/css/tom-select.bootstrap5.css') }}">
|
||||
{# internal #}
|
||||
<link rel="stylesheet" href="{{ asset_css('form-sdk/form.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset_css('form-sdk/test.css') }}">
|
||||
{% block stylesheets %}
|
||||
{% endblock %}
|
||||
{# lib #}
|
||||
|
||||
Reference in New Issue
Block a user