-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdispositif_ajout.sql
48 lines (40 loc) · 1.32 KB
/
dispositif_ajout.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
SELECT 'redirect' AS component,
'signin.sql?error' AS link
WHERE NOT EXISTS (SELECT 1 FROM login_session WHERE id=sqlpage.cookie('session'));
SET group_id = (SELECT user_info.groupe FROM login_session join user_info on user_info.username=login_session.username WHERE id = sqlpage.cookie('session'));
-- Enregistrer le dispositif dans la base
INSERT INTO dispositif(dispo, coordo, accomp)
SELECT :dispo as dispo,
coalesce(:coordo,0) as coordo,
coalesce(:accomp,0) as accomp
WHERE :dispo IS NOT NULL;
--Menu
SELECT 'dynamic' AS component, sqlpage.read_file_as_text('menu.json') AS properties;
-- Sous Menu
select 'dynamic' as component, sqlpage.run_sql('menu_parametres.sql') as properties;
-- Sous Menu Ajout/suppression dispositif
select
'button' as component,
'sm' as size,
'pill' as shape;
/*select
'Ajouter' as title,
'dispositif_ajout.sql' as link,
'square-rounded-plus' as icon,
$group_id<3 as disabled,
'green' as outline;
*/
select
'Supprimer' as title,
'dispositif_delete.sql' as link,
'trash' as icon,
$group_id<3 as disabled,
'red' as outline;
-- Liste et ajout
select
'card' as component,
2 as columns;
select
'/dispositif/liste.sql?_sqlpage_embed' as embed;
select
'/dispositif/form.sql?_sqlpage_embed' as embed;