Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-DPO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libriciel
web-DPO
Commits
a5a3f3a2
Commit
a5a3f3a2
authored
Sep 14, 2020
by
Théo GUILLON
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correction : condition sur les champs avec plusieurs valeurs
parent
ab1e45ec
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
275 additions
and
174 deletions
+275
-174
app/Config/Schema/CreationBase/data-dev/1.2.0.sql
app/Config/Schema/CreationBase/data-dev/1.2.0.sql
+22
-22
app/View/Elements/Fiches/tabs/formulaire.ctp
app/View/Elements/Fiches/tabs/formulaire.ctp
+153
-107
app/View/Elements/Formulaires/champDuFormulaire.ctp
app/View/Elements/Formulaires/champDuFormulaire.ctp
+1
-1
app/View/Elements/Formulaires/modal/modalAddCondition.ctp
app/View/Elements/Formulaires/modal/modalAddCondition.ctp
+65
-27
app/View/Fiches/add.ctp
app/View/Fiches/add.ctp
+5
-2
app/webroot/js/FormulaireGenerator/createFormulaire.js
app/webroot/js/FormulaireGenerator/createFormulaire.js
+29
-15
No files found.
app/Config/Schema/CreationBase/data-dev/1.2.0.sql
View file @
a5a3f3a2
...
...
@@ -112,28 +112,28 @@ INSERT INTO public.formulaires (id, organisations_id, libelle, active, descripti
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1
,
1
,
'input'
,
1
,
1
,
'{"name":"nom","placeholder":"nom","label":"Nom","obligatoire":false}'
,
'2020-03-02 15:21:06'
,
'2020-03-02 15:21:06'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
2
,
1
,
'textarea'
,
1
,
2
,
'{"name":"prenom","placeholder":"prenom","label":"prenom","obligatoire":false}'
,
'2020-03-02 15:21:06'
,
'2020-03-02 15:21:06'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
3
,
2
,
'input'
,
1
,
1
,
'{"name":"raison_sociale","placeholder":"","label":"Raison social","obligatoire":false}'
,
'2020-03-02 15:21:45'
,
'2020-03-02 15:21:45'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1377
,
82
,
'input'
,
1
,
1
,
'{"name":"aaa","placeholder":"AAA","label":"AAA","default":"","obligatoire":true,"
repeat":false,"
conditions":"{
\"
bc6e-d1a3
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
aaa
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1378
,
82
,
'textarea'
,
3
,
1
,
'{"name":"bbb","placeholder":"BBB","label":"BBB","default":"","obligatoire":false,"
repeat":false,"
conditions":"{
\"
b545-2b0e
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
bbb
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1379
,
82
,
'date'
,
8
,
1
,
'{"name":"ccc","placeholder":"jj
\/
mm
\/
aaaa","label":"CCC","default":"","obligatoire":false,"
repeat":false,"
conditions":"{
\"
61f4-ddaa
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
ccc
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1380
,
82
,
'checkboxes'
,
10
,
1
,
'{"name":"ddd","label":"DDD","options":["1","2","3"],"default":["0"],"obligatoire":false,"
repeat":false,"
conditions":"{
\"
5931-65c3
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
ddd
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1381
,
82
,
'radios'
,
14
,
1
,
'{"name":"eee","label":"EEE","default":"6","options":["4","5","6"],"obligatoire":true,"
repeat":false,"
conditions":"{
\"
b206-f94f
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
eee
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1382
,
82
,
'deroulant'
,
18
,
1
,
'{"name":"fff","label":"FFF","options":["7","8","9"],"default":"2","obligatoire":false,"
repeat":false,"
conditions":"{
\"
a6d1-c647
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
fff
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1383
,
82
,
'multi-select'
,
21
,
1
,
'{"name":"ggg","label":"GGG","options":["10","11","12"],"default":["1"],"obligatoire":false,"
repeat":false,"
conditions":"{
\"
3adf-6ac5
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
ggg
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1384
,
82
,
'checkboxes'
,
27
,
1
,
'{"name":"hhh","label":"HHH","options":["A","B","C"],"default":["0"],"obligatoire":false
,"repeat":false
}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1385
,
82
,
'radios'
,
30
,
1
,
'{"name":"iii","label":"III","default":"E","options":["D","E","F"],"obligatoire":true
,"repeat":false
}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1386
,
82
,
'deroulant'
,
34
,
1
,
'{"name":"jjj","label":"JJJ","options":["G","H","I"],"default":"1","obligatoire":false
,"repeat":false
}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1387
,
82
,
'multi-select'
,
36
,
1
,
'{"name":"kkk","label":"KKK","options":["J","K","L"],"default":["1"],"obligatoire":false
,"repeat":false
}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1388
,
82
,
'checkboxes'
,
42
,
1
,
'{"name":"zaza","label":"zaza","options":["Riri","Fifi","Loulou"],"default":[],"obligatoire":false
,"repeat":false
}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1389
,
82
,
'input'
,
11
,
2
,
'{"name":"condition_ddd","placeholder":"Condition DDD","label":"Condition DDD","default":"","obligatoire":true,"
repeat":false,"conditions":"{
\"
6363-2e57
\"
:{
\"
ifTheField
\"
:
\"
ddd
\"
,
\"
hasValue
\"
:
\"
ddd0
\"
,
\"
thenTheField
\"
:
\"
condition_ddd
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1390
,
82
,
'input'
,
15
,
2
,
'{"name":"condition_eee","placeholder":"Condition EEE","label":"Condition EEE","default":"","obligatoire":false,"
repeat":false,"
conditions":"{
\"
a3c1-8727
\"
:{
\"
ifTheField
\"
:
\"
eee
\"
,
\"
hasValue
\"
:
\"
6
\"
,
\"
thenTheField
\"
:
\"
condition_eee
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1391
,
82
,
'input'
,
18
,
2
,
'{"name":"condition_fff","placeholder":"Condition FFF","label":"Condition FFF","default":"","obligatoire":false,"
repeat":false,"
conditions":"{
\"
d9c1-7447
\"
:{
\"
ifTheField
\"
:
\"
fff
\"
,
\"
hasValue
\"
:
\"
2
\"
,
\"
thenTheField
\"
:
\"
condition_fff
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1392
,
82
,
'input'
,
21
,
2
,
'{"name":"condition_ggg","placeholder":"condition GGG","label":"Condition GGG","default":"","obligatoire":false,"
repeat":false,"conditions":"{
\"
c605-23a7
\"
:{
\"
ifTheField
\"
:
\"
ggg
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
condition_ggg
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1393
,
82
,
'input'
,
28
,
2
,
'{"name":"condition_hhh","placeholder":"Condition HHH","label":"Condition HHH","default":"","obligatoire":true,"
repeat":false,"conditions":"{
\"
f33a-933b
\"
:{
\"
ifTheField
\"
:
\"
hhh
\"
,
\"
hasValue
\"
:
\"
hhh0
\"
,
\"
thenTheField
\"
:
\"
condition_hhh
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1394
,
82
,
'input'
,
31
,
2
,
'{"name":"condition_iii","placeholder":"Condition III","label":"Condition III","default":"","obligatoire":false,"
repeat":false,"
conditions":"{
\"
94c5-f47f
\"
:{
\"
ifTheField
\"
:
\"
iii
\"
,
\"
hasValue
\"
:
\"
E
\"
,
\"
thenTheField
\"
:
\"
condition_iii
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1395
,
82
,
'input'
,
34
,
2
,
'{"name":"condition_jjj","placeholder":"Aide
\u
00e0 la saisie","label":"Condition JJJ","default":"","obligatoire":false,"
repeat":false,"
conditions":"{
\"
98ec-d35a
\"
:{
\"
ifTheField
\"
:
\"
jjj
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
condition_jjj
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1396
,
82
,
'input'
,
36
,
2
,
'{"name":"condition_kkk","placeholder":"Condition KKK","label":"Condition KKK","default":"","obligatoire":false,"
repeat":false,"conditions":"{
\"
2735-96f1
\"
:{
\"
ifTheField
\"
:
\"
kkk
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
condition_kkk
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1397
,
82
,
'textarea'
,
41
,
2
,
'{"name":"condition_zaza","placeholder":"Condition ZAZA","label":"Condition ZAZA","default":"","obligatoire":false,"
repeat":false,"conditions":"{
\"
38a7-4b06
\"
:{
\"
ifTheField
\"
:
\"
zaza
\"
,
\"
hasValue
\"
:
\"
zaza2
\"
,
\"
thenTheField
\"
:
\"
condition_zaza
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1398
,
82
,
'textarea'
,
46
,
1
,
'{"name":"toto","placeholder":"Aide
\u
00e0 la saisie","label":"TOTO","default":"","obligatoire":false,"
repeat":false,"
conditions":"{
\"
cde1-35bf
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
toto
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1377
,
82
,
'input'
,
1
,
1
,
'{"name":"aaa","placeholder":"AAA","label":"AAA","default":"","obligatoire":true,"conditions":"{
\"
bc6e-d1a3
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
aaa
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1378
,
82
,
'textarea'
,
3
,
1
,
'{"name":"bbb","placeholder":"BBB","label":"BBB","default":"","obligatoire":false,"conditions":"{
\"
b545-2b0e
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
bbb
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1379
,
82
,
'date'
,
8
,
1
,
'{"name":"ccc","placeholder":"jj
\/
mm
\/
aaaa","label":"CCC","default":"","obligatoire":false,"conditions":"{
\"
61f4-ddaa
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
ccc
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1380
,
82
,
'checkboxes'
,
10
,
1
,
'{"name":"ddd","label":"DDD","options":["1","2","3"],"default":["0"],"obligatoire":false,"conditions":"{
\"
5931-65c3
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
ddd
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1381
,
82
,
'radios'
,
14
,
1
,
'{"name":"eee","label":"EEE","default":"6","options":["4","5","6"],"obligatoire":true,"conditions":"{
\"
b206-f94f
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
eee
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1382
,
82
,
'deroulant'
,
18
,
1
,
'{"name":"fff","label":"FFF","options":["7","8","9"],"default":"2","obligatoire":false,"conditions":"{
\"
a6d1-c647
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
fff
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1383
,
82
,
'multi-select'
,
21
,
1
,
'{"name":"ggg","label":"GGG","options":["10","11","12"],"default":["1"],"obligatoire":false,"conditions":"{
\"
3adf-6ac5
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
ggg
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1384
,
82
,
'checkboxes'
,
27
,
1
,
'{"name":"hhh","label":"HHH","options":["A","B","C"],"default":["0"],"obligatoire":false}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1385
,
82
,
'radios'
,
30
,
1
,
'{"name":"iii","label":"III","default":"E","options":["D","E","F"],"obligatoire":true}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1386
,
82
,
'deroulant'
,
34
,
1
,
'{"name":"jjj","label":"JJJ","options":["G","H","I"],"default":"1","obligatoire":false}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1387
,
82
,
'multi-select'
,
36
,
1
,
'{"name":"kkk","label":"KKK","options":["J","K","L"],"default":["1"],"obligatoire":false}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1388
,
82
,
'checkboxes'
,
42
,
1
,
'{"name":"zaza","label":"zaza","options":["Riri","Fifi","Loulou"],"default":[],"obligatoire":false}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1389
,
82
,
'input'
,
11
,
2
,
'{"name":"condition_ddd","placeholder":"Condition DDD","label":"Condition DDD","default":"","obligatoire":true,"
conditions":"{
\"
1e6d-1e68
\"
:{
\"
ifTheField
\"
:
\"
ddd
\"
,
\"
hasValue
\"
:{
\"
0
\"
:
\"
ddd0
\"
}
,
\"
thenTheField
\"
:
\"
condition_ddd
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1390
,
82
,
'input'
,
15
,
2
,
'{"name":"condition_eee","placeholder":"Condition EEE","label":"Condition EEE","default":"","obligatoire":false,"conditions":"{
\"
a3c1-8727
\"
:{
\"
ifTheField
\"
:
\"
eee
\"
,
\"
hasValue
\"
:
\"
6
\"
,
\"
thenTheField
\"
:
\"
condition_eee
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1391
,
82
,
'input'
,
18
,
2
,
'{"name":"condition_fff","placeholder":"Condition FFF","label":"Condition FFF","default":"","obligatoire":false,"conditions":"{
\"
d9c1-7447
\"
:{
\"
ifTheField
\"
:
\"
fff
\"
,
\"
hasValue
\"
:
\"
2
\"
,
\"
thenTheField
\"
:
\"
condition_fff
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1392
,
82
,
'input'
,
21
,
2
,
'{"name":"condition_ggg","placeholder":"condition GGG","label":"Condition GGG","default":"","obligatoire":false,"
conditions":"{
\"
9d2b-fb95
\"
:{
\"
ifTheField
\"
:
\"
ggg
\"
,
\"
hasValue
\"
:{
\"
0
\"
:
\"
1
\"
}
,
\"
thenTheField
\"
:
\"
condition_ggg
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1393
,
82
,
'input'
,
28
,
2
,
'{"name":"condition_hhh","placeholder":"Condition HHH","label":"Condition HHH","default":"","obligatoire":true,"
conditions":"{
\"
ba35-394d
\"
:{
\"
ifTheField
\"
:
\"
hhh
\"
,
\"
hasValue
\"
:{
\"
0
\"
:
\"
hhh0
\"
}
,
\"
thenTheField
\"
:
\"
condition_hhh
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1394
,
82
,
'input'
,
31
,
2
,
'{"name":"condition_iii","placeholder":"Condition III","label":"Condition III","default":"","obligatoire":false,"conditions":"{
\"
94c5-f47f
\"
:{
\"
ifTheField
\"
:
\"
iii
\"
,
\"
hasValue
\"
:
\"
E
\"
,
\"
thenTheField
\"
:
\"
condition_iii
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1395
,
82
,
'input'
,
34
,
2
,
'{"name":"condition_jjj","placeholder":"Aide
\u
00e0 la saisie","label":"Condition JJJ","default":"","obligatoire":false,"conditions":"{
\"
98ec-d35a
\"
:{
\"
ifTheField
\"
:
\"
jjj
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
condition_jjj
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1396
,
82
,
'input'
,
36
,
2
,
'{"name":"condition_kkk","placeholder":"Condition KKK","label":"Condition KKK","default":"","obligatoire":false,"
conditions":"{
\"
948f-0ff2
\"
:{
\"
ifTheField
\"
:
\"
kkk
\"
,
\"
hasValue
\"
:{
\"
0
\"
:
\"
1
\"
}
,
\"
thenTheField
\"
:
\"
condition_kkk
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1397
,
82
,
'textarea'
,
41
,
2
,
'{"name":"condition_zaza","placeholder":"Condition ZAZA","label":"Condition ZAZA","default":"","obligatoire":false,"
conditions":"{
\"
d686-0489
\"
:{
\"
ifTheField
\"
:
\"
zaza
\"
,
\"
hasValue
\"
:{
\"
0
\"
:
\"
zaza0
\"
,
\"
1
\"
:
\"
zaza2
\"
}
,
\"
thenTheField
\"
:
\"
condition_zaza
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
INSERT
INTO
public
.
champs
(
id
,
formulaire_id
,
type
,
ligne
,
colonne
,
details
,
created
,
modified
,
champ_coresponsable
,
champ_soustraitant
)
VALUES
(
1398
,
82
,
'textarea'
,
46
,
1
,
'{"name":"toto","placeholder":"Aide
\u
00e0 la saisie","label":"TOTO","default":"","obligatoire":false,"conditions":"{
\"
cde1-35bf
\"
:{
\"
ifTheField
\"
:
\"
transfert_hors_ue
\"
,
\"
hasValue
\"
:
\"
1
\"
,
\"
thenTheField
\"
:
\"
toto
\"
,
\"
mustBe
\"
:
\"
shown
\"
,
\"
ifNot
\"
:
\"
hidden
\"
}}"}'
,
'2020-04-16 09:37:12'
,
'2020-04-16 09:37:12'
,
false
,
false
);
--
...
...
app/View/Elements/Fiches/tabs/formulaire.ctp
View file @
a5a3f3a2
...
...
@@ -134,6 +134,7 @@ $line = 1;
case
'checkboxes'
:
echo
$this
->
WebcilForm
->
input
(
'WebdpoFiche.'
.
$options
[
'name'
],
[
'id'
=>
$options
[
'name'
],
'name'
=>
$options
[
'name'
],
'label'
=>
[
'text'
=>
$options
[
'label'
],
'class'
=>
'col-md-4'
,
...
...
@@ -290,149 +291,194 @@ $line = 1;
// Mise en place des conditions
let
conditions
=
<?php
echo
json_encode
(
$conditions
);
?>
;
$
.
each
(
conditions
,
function
(
key
,
value
)
{
// On cache le champ par défault
// shownHideField(value['ifNot'], value['thenTheField']);
let
valueIfTheField
=
$
(
'
#
'
+
value
[
'
ifTheField
'
]);
// Si le champ a comme balise "select" (deroulant et multi-select)
if
(
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
is
(
'
select
'
))
{
if
(
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
hasClass
(
'
multiSelect
'
)
==
true
)
{
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
parent
().
on
(
'
show
'
,
function
()
{
if
(
jQuery
.
inArray
(
value
[
'
hasValue
'
],
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
val
())
!==
-
1
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
});
if
(
$
(
valueIfTheField
).
is
(
'
select
'
))
{
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
parent
().
on
(
'
hide
'
,
function
()
{
// if (jQuery.inArray(value['hasValue'], $('#'+value['ifTheField']).val()) !== -1) {
// shownHideField(value['mustBe'], value['thenTheField'])
// } else {
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
// }
});
if
(
$
(
valueIfTheField
).
hasClass
(
'
multiSelect
'
)
===
true
)
{
// Champ multi-select
if
(
jQuery
.
inArray
(
value
[
'
hasValue
'
],
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
val
())
!==
-
1
&&
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
parent
().
css
(
'
display
'
)
!=
'
none
'
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
}
else
{
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
parent
().
on
(
'
show
'
,
function
()
{
if
(
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
val
()
==
value
[
'
hasValue
'
])
{
// Si le champ multi-select est visible
$
(
valueIfTheField
).
parent
().
parent
().
on
(
'
show
'
,
function
()
{
let
showCondition
=
false
;
if
(
$
(
valueIfTheField
).
val
())
{
$
.
each
(
$
(
valueIfTheField
).
val
(),
function
(
k
,
v
)
{
if
(
jQuery
.
inArray
(
v
,
value
[
'
hasValue
'
])
!==
-
1
)
{
showCondition
=
true
;
}
});
}
if
(
showCondition
===
true
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
});
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
parent
().
on
(
'
hide
'
,
function
()
{
// if ($('#'+value['ifTheField']).val() == value['hasValue']) {
// shownHideField(value['mustBe'], value['thenTheField'])
// } else {
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
// }
});
if
(
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
val
()
==
value
[
'
hasValue
'
]
&&
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
parent
().
css
(
'
display
'
)
!=
'
none
'
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
// Si le champ multi-select n'est pas visible
$
(
valueIfTheField
).
parent
().
parent
().
on
(
'
hide
'
,
function
()
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
}
});
// Quand le champ deroulant ou multi-select change de valeur
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
change
(
function
()
{
if
(
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
hasClass
(
'
multiSelect
'
)
==
true
)
{
if
(
jQuery
.
inArray
(
value
[
'
hasValue
'
],
$
(
this
).
val
())
!==
-
1
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
}
else
{
if
(
$
(
this
).
val
()
==
value
[
'
hasValue
'
])
{
$
.
each
(
$
(
valueIfTheField
).
val
(),
function
(
k
,
v
)
{
if
(
jQuery
.
inArray
(
v
,
value
[
'
hasValue
'
])
!==
-
1
&&
$
(
valueIfTheField
).
parent
().
parent
().
css
(
'
display
'
)
!==
'
none
'
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
}
});
}
});
// Si le champ a comme balise "input"
if
(
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
is
(
'
input
'
))
{
}
else
{
// Champ deroulant
// Si le champ est de type "checkbox"
if
(
$
(
'
#
'
+
value
[
'
hasValue
'
]).
attr
(
'
type
'
)
==
"
checkbox
"
)
{
$
(
'
#
'
+
value
[
'
hasValue
'
]).
parent
().
parent
().
parent
().
on
(
'
show
'
,
function
()
{
if
(
$
(
'
#
'
+
value
[
'
hasValue
'
]).
prop
(
"
checked
"
)
==
true
)
{
// Si le champ déroulant est visible
$
(
valueIfTheField
).
parent
().
parent
().
on
(
'
show
'
,
function
()
{
if
(
$
(
valueIfTheField
).
val
()
===
value
[
'
hasValue
'
])
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
});
$
(
'
#
'
+
value
[
'
hasValue
'
]).
parent
().
parent
().
parent
().
on
(
'
hide
'
,
function
()
{
// Si le champ déroulant n'est pas visible
$
(
valueIfTheField
).
parent
().
parent
().
on
(
'
hide
'
,
function
()
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
});
if
(
$
(
'
#
'
+
value
[
'
hasValue
'
]).
prop
(
"
checked
"
)
===
true
&&
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
parent
().
css
(
'
display
'
)
!=
'
none
'
)
{
if
(
$
(
valueIfTheField
).
val
()
===
value
[
'
hasValue
'
]
&&
$
(
valueIfTheField
).
parent
().
parent
().
css
(
'
display
'
)
!==
'
none
'
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
}
// Quand le champ deroulant ou multi-select change de valeur
$
(
valueIfTheField
).
change
(
function
()
{
if
(
$
(
valueIfTheField
).
hasClass
(
'
multiSelect
'
)
===
true
)
{
if
(
Array
.
isArray
(
value
[
'
hasValue
'
])
===
true
)
{
let
showCondition
=
false
;
if
(
$
(
this
).
val
())
{
$
.
each
(
$
(
this
).
val
(),
function
(
k
,
v
)
{
if
(
jQuery
.
inArray
(
v
,
value
[
'
hasValue
'
])
!==
-
1
)
{
showCondition
=
true
;
}
});
}
// Quand la valeur de la condition change
$
(
'
#
'
+
value
[
'
hasValue
'
]).
on
(
'
change
'
,
function
()
{
if
(
$
(
this
).
prop
(
"
checked
"
)
==
true
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
});
}
// Si le champ est de type "radio"
// if ($('#'+value['hasValue']).attr('type') == "radio") {
if
(
$
(
'
input[type="radio"][value="
'
+
value
[
'
hasValue
'
]
+
'
"]
'
).
length
==
1
)
{
// Quand le changer est affiché
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
parent
().
on
(
'
show
'
,
function
()
{
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
find
(
'
input[type=radio]:checked
'
).
each
(
function
()
{
if
(
$
(
this
).
val
()
==
value
[
'
hasValue
'
])
{
if
(
showCondition
===
true
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
});
});
// Quand le champ est caché
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
parent
().
on
(
'
hide
'
,
function
()
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
});
if
(
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
parent
().
css
(
'
display
'
)
!=
'
none
'
)
{
if
(
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
find
(
'
input[type=radio]:checked
'
).
val
()
==
value
[
'
hasValue
'
])
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
// Quand le champ radio change de valeur
$
(
'
#
'
+
value
[
'
ifTheField
'
]).
parent
().
find
(
'
input[type=radio]
'
).
on
(
'
change
'
,
function
()
{
if
(
$
(
this
).
val
()
==
value
[
'
hasValue
'
])
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
});
}
}
}
}
else
{
if
(
$
(
this
).
val
()
===
value
[
'
hasValue
'
])
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
}
});
}
// Si le champ a comme balise "input"
if
(
$
(
valueIfTheField
).
is
(
'
input
'
))
{
// Si le champ est de type "checkbox"
if
(
$
(
'
#
'
+
value
[
'
hasValue
'
]).
attr
(
'
type
'
)
===
"
checkbox
"
)
{
$
(
'
#
'
+
value
[
'
hasValue
'
]).
parent
().
parent
().
parent
().
on
(
'
show
'
,
function
()
{
if
(
$
(
'
#
'
+
value
[
'
hasValue
'
]).
prop
(
"
checked
"
)
==
true
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
});
$
(
'
#
'
+
value
[
'
hasValue
'
]).
parent
().
parent
().
parent
().
on
(
'
hide
'
,
function
()
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
});
if
(
$
(
'
#
'
+
value
[
'
hasValue
'
]).
prop
(
"
checked
"
)
===
true
&&
$
(
valueIfTheField
).
parent
().
parent
().
css
(
'
display
'
)
!=
'
none
'
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
$
(
'
input[name ="
'
+
value
[
'
ifTheField
'
]
+
'
[]"]
'
).
change
(
function
()
{
let
valueSelected
=
[];
$
.
each
(
$
(
'
input[name ="
'
+
value
[
'
ifTheField
'
]
+
'
[]"]:checked
'
),
function
(){
valueSelected
.
push
(
$
(
this
).
attr
(
'
id
'
));
});
if
(
Array
.
isArray
(
valueSelected
)
===
true
)
{
let
showCondition
=
false
;
if
(
valueSelected
)
{
$
.
each
(
valueSelected
,
function
(
k
,
v
)
{
if
(
jQuery
.
inArray
(
v
,
value
[
'
hasValue
'
])
!==
-
1
)
{
showCondition
=
true
;
}
});
}
if
(
showCondition
===
true
)
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
}
});
}
// Si le champ est de type "radio"
// if ($('#'+value['hasValue']).attr('type') == "radio") {
if
(
$
(
'
input[type="radio"][value="
'
+
value
[
'
hasValue
'
]
+
'
"]
'
).
length
===
1
)
{
// Quand le changer est affiché
$
(
valueIfTheField
).
parent
().
parent
().
on
(
'
show
'
,
function
()
{
$
(
valueIfTheField
).
parent
().
find
(
'
input[type=radio]:checked
'
).
each
(
function
()
{
if
(
$
(
this
).
val
()
===
value
[
'
hasValue
'
])
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
});
});
// Quand le champ est caché
$
(
valueIfTheField
).
parent
().
parent
().
on
(
'
hide
'
,
function
()
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
});
if
(
$
(
valueIfTheField
).
parent
().
parent
().
css
(
'
display
'
)
!==
'
none
'
)
{
if
(
$
(
valueIfTheField
).
parent
().
find
(
'
input[type=radio]:checked
'
).
val
()
===
value
[
'
hasValue
'
])
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
// Quand le champ radio change de valeur
$
(
valueIfTheField
).
parent
().
find
(
'
input[type=radio]
'
).
on
(
'
change
'
,
function
()
{
if
(
$
(
this
).
val
()
===
value
[
'
hasValue
'
])
{
shownHideField
(
value
[
'
mustBe
'
],
value
[
'
thenTheField
'
])
}
else
{
shownHideField
(
value
[
'
ifNot
'
],
value
[
'
thenTheField
'
]);
}
});
}
}
});
function
shownHideField
(
condition
,
thenTheField
)
...
...
app/View/Elements/Formulaires/champDuFormulaire.ctp
View file @
a5a3f3a2
...
...
@@ -257,7 +257,7 @@ foreach ($champs as $key => $value) {
width
:
'
100%
'
});
var
champsDate
=
<?php
echo
json_encode
(
$calendrier
)
?>
;
let
champsDate
=
<?php
echo
json_encode
(
$calendrier
)
?>
;
jQuery
.
each
(
champsDate
,
function
(
key
,
val
){
$
(
'
#
'
+
val
).
datetimepicker
({
viewMode
:
'
year
'
,
...
...
app/View/Elements/Formulaires/modal/modalAddCondition.ctp
View file @
a5a3f3a2
...
...
@@ -54,6 +54,19 @@
'text' => __d('formulaire', 'formulaire.champHasValue')
],
]);
echo $this->WebcilForm->input('Fiche.hasValueMulti', [
'id' => 'hasValueMulti',
'options' => [],
'empty' => true,
'class' => 'form-control usersDeroulant',
'placeholder' => false,
'required' => true,
'data-placeholder' => ' ',
'label' => [
'text' => __d('formulaire', 'formulaire.champHasValue')
],
'multiple' => true,
]);
?>
</div>
...
...
@@ -142,15 +155,13 @@
<script type="text/javascript">
$(document).ready(function () {
let idContainer = null
;
let
idFieldConditionCreated = null;
let idContainer = null
,
idFieldConditionCreated = null;
// $('#btn-condition').click(function () {
$('#btn-condition-formulaire, #btn-condition-coresponsable, #btn-condition-soustraitant').click(function () {
hideAllFields();
$('#ifTheField option').slice(3).remove();
// idContainer = '#' + $('.form-container').attr('id');
idContainer = '#' + $(this).parent().parent().nextAll('.form-container').attr('id');
if (!idContainer) {
return false;
...
...
@@ -165,8 +176,8 @@
}
$(idContainer).find('.draggable').filter('.checkboxes, .radios, .deroulant, .multi-select').each(function (key, field) {
let name = $(field).find('input, option').attr('name')
;
let
label = $(field).find('.labeler').html();
let name = $(field).find('input, option').attr('name')
,
label = $(field).find('.labeler').html();
if (name && label) {
$('#ifTheField').append('<option value="' + name + '">' + label + '</option>');
...
...
@@ -179,14 +190,16 @@
idFieldConditionCreated = $(this).val();
let showHasValueMulti = false;
if (!idFieldConditionCreated) {
hideAllFields();
} else {
if (jQuery.inArray(idFieldConditionCreated, ['transfert_hors_ue', 'donnees_sensibles']) !== -1){
if (jQuery.inArray(idFieldConditionCreated, ['transfert_hors_ue', 'donnees_sensibles']) !== -1)
{
// On recupere les "options" du champ "selected" sur lequel nous allons faire la condition
$('#'+idFieldConditionCreated).find('option').each(function () {
let option = $(this).attr('value')
;
let
label = $(this).text();
let option = $(this).attr('value')
,
label = $(this).text();
if (option && label) {
$('#hasValue').append('<option value="' + option + '">' + label + '</option>');
...
...
@@ -195,20 +208,28 @@
} else {
// On recupere les "options" du champ "selected" sur lequel nous allons faire la condition
if ($('#'+idFieldConditionCreated).is("select")) {
// Champs "Menu multi-select" ou "Menu déroulant"
$(idContainer).find('input[name ="'+idFieldConditionCreated+'"],option[name ="'+idFieldConditionCreated+'"]').each(function () {
let value = $(this).attr('value')
;
let
labelValue = $(this).text();
let value = $(this).attr('value')
,
labelValue = $(this).text();
if (value && labelValue) {
$('#hasValue').append('<option value="' + value + '">' + labelValue + '</option>');
if ($(this).attr('type')) {
$('#hasValue').append('<option value="' + value + '">' + labelValue + '</option>');
} else {
let newOption = new Option(labelValue, value, false, false);
$('#hasValueMulti').append(newOption).trigger('change');
}
}
});
} else {
// Champs "Case à cocher" ou "Choix unique"
$(idContainer).find('input[name ="'+idFieldConditionCreated+'"], option[name ="'+idFieldConditionCreated+'"]').each(function () {
let option = null
;
let
id = null;
let option = null
,
id = null;
if ($(this).attr('type') == 'checkbox') {
showHasValueMulti = true;
option = $(this).next('label').text();
} else {
option = $(this).attr('value');
...
...
@@ -221,17 +242,29 @@
}
if (option && id) {
$('#hasValue').append('<option value="' + id + '">' + option + '</option>');
if (showHasValueMulti === true) {
let newOption = new Option(option, id, false, false);
$('#hasValueMulti').append(newOption).trigger('change');
} else {
$('#hasValue').append('<option value="' + id + '">' + option + '</option>');
}
}
});
}
}
$('#hasValue').parent().parent().show();
if ($('#'+idFieldConditionCreated).hasClass('multiSelect') === true ||
showHasValueMulti === true
) {
$('#hasValueMulti').parent().parent().show();
} else {
$('#hasValue').parent().parent().show();
}
}
});
$('#hasValue').change(function () {
$('#hasValue
, #hasValueMulti
').change(function () {
let valueSelected = $(this).val();
$('#thenTheField').parent().parent().hide();
...
...
@@ -250,8 +283,8 @@
}
$.each(fieldsContainer, function (key, field) {
let name = $(field).find('input, textarea, option').attr('name')
;
let
label = $(field).find('.labeler').html();
let name = $(field).find('input, textarea, option').attr('name')
,
label = $(field).find('.labeler').html();
if (name && label) {
if (name != idFieldConditionCreated) {
...
...
@@ -300,12 +333,12 @@
$('#saveCondition').click(function () {
$('div.error-message').remove();
let ifTheField = $('#ifTheField').val()
;
let hasValue = $('#hasValue').val();
let thenTheField = $('#thenTheField').val();
let mustBe = $('#mustBe').val();
let ifNot = $('#ifNot').val();
let
success = true;
let ifTheField = $('#ifTheField').val()
,
hasValue = $('#hasValue').val(),
thenTheField = $('#thenTheField').val(),
mustBe = $('#mustBe').val(),
ifNot = $('#ifNot').val(),
success = true;
if (!ifTheField) {
$('#ifTheField').parent().parent().append('<div class="error-message">Champ obligatoire</div>');
...
...
@@ -313,8 +346,11 @@
}
if (!hasValue) {