diff --git a/README.md b/README.md
index 9e138e5..8918332 100644
--- a/README.md
+++ b/README.md
@@ -17,20 +17,21 @@ Choisir entre la version minifiée de vuejs (sans le debug) ou la version de dev
3. Pour utliser **les actions** :
1. dans `json_gamutable.json.html`
```html
- "statut" : [(#INCLURE{fond=inclure/statut,id_de_mon_objet}|json_encode)],
- ```
-
- 2. dans `inclure/statut.html`, bien ajouter au lien : `class="url_action"`
- ```html
-
+ [(#SET{statut,
#SET{args,#ID_SOUSCRIPTION|concat{-}|concat{#STATUT}}
-
- #STATUT
+
+ [(#STATUT|!={publie}|oui)
+
+ ]
+ [(#STATUT|=={publie}|oui)
+
+ ]
-
+ })]
+ "statut" : [(#GET{statut}|json_encode)],
```
+ > il faut ajouter data-id="" si on veut recharger que cette ligne
+
4. Pour utiliser **les crayons**, il faut utiliser le pipeline `crayons_vue_affichage_final`
```php
/**
diff --git a/js/gamutable.es6.js b/js/gamutable.es6.js
index 4b76d88..7e06599 100644
--- a/js/gamutable.es6.js
+++ b/js/gamutable.es6.js
@@ -6,12 +6,17 @@ jQuery(function() {
$('td').css('cursor', 'wait');
$('a').css('cursor', 'wait');
let url = $(this).attr('href');
+ let id = $(this).data('id');
console.time('Chargement de VueJs APRES Ajax');
$.ajax({
url: url,
async: true
}).done(function() {
- app.rechargerJson();
+ if (parseInt(id) > 0) {
+ app.rechargerJson(id);
+ } else {
+ app.rechargerJson();
+ }
});
});
@@ -132,14 +137,23 @@ let monTableau = {
}
},
methods: {
- chargerJson() {
- fetch(this.apiuri)
+ chargerJson(id) {
+ let url = this.apiuri;
+ if (parseInt(id) > 0) {
+ url += '&id=' + id;
+ }
+ fetch(url)
.then(response => response.json())
.then(data => {
let config = data.shift();
this.header = config.header;
this.crayons = config.crayons;
- this.table = data;
+ if (parseInt(id) > 0) {
+ let i = this.table.findIndex(ligne => ligne.id === parseInt(id));
+ Vue.set(this.table, i, data[0]);
+ } else {
+ this.table = data;
+ }
Vue.nextTick(function() {
$('html').css('cursor', 'auto');
$('td').css('cursor', 'auto');
@@ -243,8 +257,8 @@ let app = new Vue({
el: '#app',
components: { monTableau },
methods: {
- rechargerJson() {
- this.$refs.montableau.chargerJson();
+ rechargerJson(id) {
+ this.$refs.montableau.chargerJson(id);
}
}
});
diff --git a/js/gamutable.js b/js/gamutable.js
index 9c66a8b..58ebf0e 100644
--- a/js/gamutable.js
+++ b/js/gamutable.js
@@ -16,12 +16,17 @@ jQuery(function () {
$('td').css('cursor', 'wait');
$('a').css('cursor', 'wait');
var url = $(this).attr('href');
+ var id = $(this).data('id');
console.time('Chargement de VueJs APRES Ajax');
$.ajax({
url: url,
async: true
}).done(function () {
- app.rechargerJson();
+ if (parseInt(id) > 0) {
+ app.rechargerJson(id);
+ } else {
+ app.rechargerJson();
+ }
});
});
$('#app').on('click', '.modalbox', function (e) {
@@ -153,16 +158,32 @@ var monTableau = {
}
},
methods: {
- chargerJson: function chargerJson() {
+ chargerJson: function chargerJson(id) {
var _this2 = this;
- fetch(this.apiuri).then(function (response) {
+ var url = this.apiuri;
+
+ if (parseInt(id) > 0) {
+ url += '&id=' + id;
+ }
+
+ fetch(url).then(function (response) {
return response.json();
}).then(function (data) {
var config = data.shift();
_this2.header = config.header;
_this2.crayons = config.crayons;
- _this2.table = data;
+
+ if (parseInt(id) > 0) {
+ var i = _this2.table.findIndex(function (ligne) {
+ return ligne.id === parseInt(id);
+ });
+
+ Vue.set(_this2.table, i, data[0]);
+ } else {
+ _this2.table = data;
+ }
+
Vue.nextTick(function () {
$('html').css('cursor', 'auto');
$('td').css('cursor', 'auto');
@@ -228,8 +249,8 @@ var app = new Vue({
monTableau: monTableau
},
methods: {
- rechargerJson: function rechargerJson() {
- this.$refs.montableau.chargerJson();
+ rechargerJson: function rechargerJson(id) {
+ this.$refs.montableau.chargerJson(id);
}
}
});
\ No newline at end of file
diff --git a/json_gamutable.json.html b/json_gamutable.json.html
index 1870a30..de2f3d2 100644
--- a/json_gamutable.json.html
+++ b/json_gamutable.json.html
@@ -1,4 +1,5 @@
#HTTP_HEADER{Content-Type: application/json; charset=#CHARSET}
+[(#ENV{id}|setenv{id_souscription})]
[{
"header":{
"id": "_",
@@ -21,22 +22,35 @@
"prenom" : "souscription"
}
},
-
+
+[(#SET{statut,
+ #SET{args,#ID_SOUSCRIPTION|concat{-}|concat{#STATUT}}
+
+ [(#STATUT|!={publie}|oui)
+
+ ]
+ [(#STATUT|=={publie}|oui)
+
+ ]
+
+})]
{
"id": #ID_SOUSCRIPTION,
-"titre" : [(#TITRE|json_encode)],
+"modif" : [(#VAL{}|json_encode)],
"date" : [(#DATE|affdate{d/m/Y}|json_encode)],
-"statut" : [(#INCLURE{fond=js/statut,statut,id_souscription}|json_encode)],
+"statut" : [(#GET{statut}|json_encode)],
"genre" : [(#GENRE|json_encode)],
"nom_souscripteur" : [(#NOM_SOUSCRIPTEUR|json_encode)],
"prenom" : [(#PRENOM|json_encode)],
-"date_naissance" : [(#DATE_NAISSANCE|affdate{d/m/Y}|json_encode)],
-"lieu_naissance" : [(#LIEU_NAISSANCE|json_encode)],
-"representant_legal" : [(#REPRESENTANT_LEGAL|json_encode)],
+"qui": [(#VAL{}|json_encode)],
+"nbr" : [(#NOMBRE)],
+"montant_part" : [(#MONTANT_PART)],
+"montant" : [(#MONTANT)],
+"prix": [(#VAL{}|json_encode)],
"type" : [(#TYPE|json_encode)],
"email" : [(#VAL{#EMAIL}|json_encode)],
"telephone" : [(#TELEPHONE|json_encode)],
-"adresse" : [(#ADRESSE|json_encode)]
+"ou": [(#VAL{}|json_encode)]
}
]