@osimatic/helpers-js 1.0.20 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{todos/form_date.js → form_date.js} +101 -98
- package/index.js +2 -1
- package/media.js +2 -4
- package/package.json +1 -1
- package/todos/graphiques.js +0 -281
- package/todos/jquery.js +0 -5
- package/todos/tree.js +0 -71
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// ---------- Choix période (new) ----------
|
|
4
|
-
|
|
5
|
-
// Formulaire de sélection de période
|
|
6
|
-
|
|
7
|
-
if ($('form select.periode').length > 0) {
|
|
8
|
-
$('form select.periode').change(function() {
|
|
9
|
-
majSelectPeriode($(this));
|
|
10
|
-
|
|
11
|
-
if ($(this).attr('id') == 'periode') {
|
|
12
|
-
majSelectCompare();
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function majSelectPeriode(select) {
|
|
1
|
+
class FormDate {
|
|
2
|
+
static majSelectPeriode(select) {
|
|
18
3
|
if (select.find(':selected').attr('value') == 'perso') {
|
|
19
4
|
select.parent().parent().next().removeClass('hide');
|
|
20
5
|
}
|
|
@@ -23,19 +8,19 @@ $(function() {
|
|
|
23
8
|
}
|
|
24
9
|
}
|
|
25
10
|
|
|
26
|
-
|
|
11
|
+
static majSelectCompare() {
|
|
27
12
|
if ($('form select#periodeCompare').length == 0) {
|
|
28
13
|
return;
|
|
29
14
|
}
|
|
30
|
-
|
|
15
|
+
|
|
31
16
|
var listValues = [];
|
|
32
17
|
periodeSelected = $('form select.periode :selected').attr('value');
|
|
33
18
|
selectCompare = $('form select#periodeCompare');
|
|
34
19
|
periodeCompareSelected = selectCompare.find(':selected').attr('value');
|
|
35
|
-
|
|
20
|
+
|
|
36
21
|
selectCompare.find('option').removeAttr('disabled');
|
|
37
|
-
|
|
38
|
-
$.each(listePeriodeCompare, function(idx, tabListPeriode) {
|
|
22
|
+
|
|
23
|
+
$.each(listePeriodeCompare, function (idx, tabListPeriode) {
|
|
39
24
|
if (idx != 0) {
|
|
40
25
|
listKeyPeriode = array_keys(tabListPeriode.list);
|
|
41
26
|
if (in_array(periodeSelected, listKeyPeriode)) {
|
|
@@ -43,22 +28,100 @@ $(function() {
|
|
|
43
28
|
valueDefault = listKeyPeriode[1];
|
|
44
29
|
}
|
|
45
30
|
else {
|
|
46
|
-
selectCompare.find('option[value="'+listKeyPeriode[0]+'"]').parent().children().attr('disabled', 'disabled');
|
|
31
|
+
selectCompare.find('option[value="' + listKeyPeriode[0] + '"]').parent().children().attr('disabled', 'disabled');
|
|
47
32
|
}
|
|
48
33
|
}
|
|
49
34
|
});
|
|
50
|
-
|
|
35
|
+
|
|
51
36
|
if (periodeSelected == 'perso') {
|
|
52
37
|
valueDefault = 'perso';
|
|
53
38
|
}
|
|
54
39
|
else if (periodeCompareSelected != 'perso' && in_array(periodeCompareSelected, listValues)) {
|
|
55
40
|
valueDefault = periodeCompareSelected;
|
|
56
41
|
}
|
|
57
|
-
selectCompare.find('option[value="'+valueDefault+'"]').attr('selected', 'selected');
|
|
58
|
-
|
|
42
|
+
selectCompare.find('option[value="' + valueDefault + '"]').attr('selected', 'selected');
|
|
43
|
+
|
|
59
44
|
majSelectPeriode(selectCompare);
|
|
60
45
|
}
|
|
61
46
|
|
|
47
|
+
static selectFormDateToday(lien) {
|
|
48
|
+
date = new Date();
|
|
49
|
+
selectFormDate(lien, date.getDate(), (date.getMonth() + 1), date.getFullYear());
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static selectFormDateDayMoinsNb(lien, nbJoursMoins) {
|
|
53
|
+
date = new Date();
|
|
54
|
+
date.setDate(date.getDate() - nbJoursMoins);
|
|
55
|
+
selectFormDate(lien, date.getDate(), (date.getMonth() + 1), date.getFullYear());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static selectFormDateCurrentMonth(lien) {
|
|
59
|
+
date = new Date();
|
|
60
|
+
selectFormDate(lien, -1, (date.getMonth() + 1), date.getFullYear());
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static selectFormDateMonthMoinsNb(lien, nbMoisMoins) {
|
|
64
|
+
date = new Date();
|
|
65
|
+
date.setDate(1);
|
|
66
|
+
date.setMonth(date.getMonth() - nbMoisMoins);
|
|
67
|
+
selectFormDate(lien, -1, (date.getMonth() + 1), date.getFullYear());
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static selectFormDateCurrentYear(lien) {
|
|
71
|
+
today = new Date();
|
|
72
|
+
selectFormDate(lien, -1, -1, today.getFullYear());
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static selectFormDateYearMoinsNb(lien, nbAnneesMoins) {
|
|
76
|
+
today = new Date();
|
|
77
|
+
selectFormDate(lien, -1, -1, today.getFullYear() - nbAnneesMoins);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static selectFormDateAddDayFromSelectedDay(lien, nbDaysAdded) {
|
|
81
|
+
date = getDateObjectSelected(lien);
|
|
82
|
+
date.setDate(date.getDate() + nbDaysAdded);
|
|
83
|
+
selectFormDate(lien, date.getDate(), (date.getMonth() + 1), date.getFullYear());
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static getDateObjectSelected(lien) {
|
|
87
|
+
selectorDay = '#' + (lien.parent().prev().prev().prev().prev().attr('id')) + ' option:selected';
|
|
88
|
+
selectorMonth = '#' + (lien.parent().prev().prev().prev().attr('id')) + ' option:selected';
|
|
89
|
+
selectorYear = '#' + (lien.parent().prev().prev().attr('id')) + ' option:selected';
|
|
90
|
+
if ($(selectorDay).length > 0 && $(selectorMonth).length > 0 && $(selectorYear).length > 0) {
|
|
91
|
+
return new Date($(selectorYear).attr('value'), $(selectorMonth).attr('value') - 1, $(selectorDay).attr('value'));
|
|
92
|
+
}
|
|
93
|
+
return new Date();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static selectFormDate(lien, day, month, year) {
|
|
97
|
+
selectorDay = '#' + (lien.parent().prev().prev().prev().prev().attr('id')) + ' option[value=' + day + ']';
|
|
98
|
+
selectorMonth = '#' + (lien.parent().prev().prev().prev().attr('id')) + ' option[value=' + month + ']';
|
|
99
|
+
selectorYear = '#' + (lien.parent().prev().prev().attr('id')) + ' option[value=' + year + ']';
|
|
100
|
+
if ($(selectorDay).length > 0) $(selectorDay).prop('selected', 'selected');
|
|
101
|
+
if ($(selectorMonth).length > 0) $(selectorMonth).prop('selected', 'selected');
|
|
102
|
+
if ($(selectorYear).length > 0) $(selectorYear).prop('selected', 'selected');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = { FormDate };
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
//A DEPLACER DANS LE PROJET MYTIME
|
|
110
|
+
/*$(function() {
|
|
111
|
+
// ---------- Choix période (new) ----------
|
|
112
|
+
|
|
113
|
+
// Formulaire de sélection de période
|
|
114
|
+
|
|
115
|
+
if ($('form select.periode').length > 0) {
|
|
116
|
+
$('form select.periode').change(function() {
|
|
117
|
+
majSelectPeriode($(this));
|
|
118
|
+
|
|
119
|
+
if ($(this).attr('id') == 'periode') {
|
|
120
|
+
majSelectCompare();
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
62
125
|
majSelectCompare();
|
|
63
126
|
// majSelectPeriode($('form select#periodeCompare'));
|
|
64
127
|
|
|
@@ -187,76 +250,16 @@ $(function() {
|
|
|
187
250
|
});
|
|
188
251
|
}
|
|
189
252
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
$('form select[name=select_date_fastly]').
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
*/
|
|
203
|
-
|
|
204
|
-
function selectFormDateToday(lien) {
|
|
205
|
-
date = new Date();
|
|
206
|
-
selectFormDate(lien, date.getDate(), (date.getMonth()+1), date.getFullYear());
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function selectFormDateDayMoinsNb(lien, nbJoursMoins) {
|
|
210
|
-
date = new Date();
|
|
211
|
-
date.setDate(date.getDate() - nbJoursMoins);
|
|
212
|
-
selectFormDate(lien, date.getDate(), (date.getMonth()+1), date.getFullYear());
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function selectFormDateCurrentMonth(lien) {
|
|
216
|
-
date = new Date();
|
|
217
|
-
selectFormDate(lien, -1, (date.getMonth()+1), date.getFullYear());
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function selectFormDateMonthMoinsNb(lien, nbMoisMoins) {
|
|
221
|
-
date = new Date();
|
|
222
|
-
date.setDate(1);
|
|
223
|
-
date.setMonth(date.getMonth() - nbMoisMoins);
|
|
224
|
-
selectFormDate(lien, -1, (date.getMonth()+1), date.getFullYear());
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function selectFormDateCurrentYear(lien) {
|
|
228
|
-
today = new Date();
|
|
229
|
-
selectFormDate(lien, -1, -1, today.getFullYear());
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function selectFormDateYearMoinsNb(lien, nbAnneesMoins) {
|
|
233
|
-
today = new Date();
|
|
234
|
-
selectFormDate(lien, -1, -1, today.getFullYear()-nbAnneesMoins);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function selectFormDateAddDayFromSelectedDay(lien, nbDaysAdded) {
|
|
238
|
-
date = getDateObjectSelected(lien);
|
|
239
|
-
date.setDate(date.getDate() + nbDaysAdded);
|
|
240
|
-
selectFormDate(lien, date.getDate(), (date.getMonth()+1), date.getFullYear());
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function getDateObjectSelected(lien) {
|
|
244
|
-
selectorDay = '#'+(lien.parent().prev().prev().prev().prev().attr('id'))+' option:selected';
|
|
245
|
-
selectorMonth = '#'+(lien.parent().prev().prev().prev().attr('id'))+' option:selected';
|
|
246
|
-
selectorYear = '#'+(lien.parent().prev().prev().attr('id'))+' option:selected';
|
|
247
|
-
if ($(selectorDay).length > 0 && $(selectorMonth).length > 0 && $(selectorYear).length > 0) {
|
|
248
|
-
return new Date($(selectorYear).attr('value'), $(selectorMonth).attr('value')-1, $(selectorDay).attr('value'));
|
|
249
|
-
}
|
|
250
|
-
return new Date();
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function selectFormDate(lien, day, month, year) {
|
|
254
|
-
selectorDay = '#'+(lien.parent().prev().prev().prev().prev().attr('id'))+' option[value='+day+']';
|
|
255
|
-
selectorMonth = '#'+(lien.parent().prev().prev().prev().attr('id'))+' option[value='+month+']';
|
|
256
|
-
selectorYear = '#'+(lien.parent().prev().prev().attr('id'))+' option[value='+year+']';
|
|
257
|
-
if ($(selectorDay).length > 0) $(selectorDay).prop('selected', 'selected');
|
|
258
|
-
if ($(selectorMonth).length > 0) $(selectorMonth).prop('selected', 'selected');
|
|
259
|
-
if ($(selectorYear).length > 0) $(selectorYear).prop('selected', 'selected');
|
|
260
|
-
}
|
|
253
|
+
//if ($('form select[name=select_date_fastly]').length > 0) {
|
|
254
|
+
// $('form select[name=select_date_fastly]').change(function() {
|
|
255
|
+
// valueOptionSelected = $('form select[name=select_date_fastly] option:selected').attr('value');
|
|
256
|
+
// if (valueOptionSelected == 'today') {
|
|
257
|
+
// selectFormDateToday();
|
|
258
|
+
// }
|
|
259
|
+
// else if (valueOptionSelected == 'current_month') {
|
|
260
|
+
// selectFormDateCurrentMonth();
|
|
261
|
+
// }
|
|
262
|
+
// });
|
|
263
|
+
//}
|
|
261
264
|
|
|
262
|
-
})
|
|
265
|
+
});*/
|
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ const { Country, PostalAddress, Location } = require('./location');
|
|
|
18
18
|
const { SocialNetwork } = require('./social_network');
|
|
19
19
|
const { sleep, refresh } = require('./util');
|
|
20
20
|
const { chr, ord, trim, empty } = require('./php.min');
|
|
21
|
+
const { FormDate } = require('./form_date');
|
|
21
22
|
|
|
22
23
|
// exports plugins "maison"
|
|
23
24
|
const { DataTable } = require('./data_table');
|
|
@@ -43,7 +44,7 @@ const { NumberValue } = require('./number');
|
|
|
43
44
|
|
|
44
45
|
module.exports = {
|
|
45
46
|
Array, Object, Number, String,
|
|
46
|
-
HTTPRequest, Cookie, UrlAndQueryString, IBAN, BankCard, AudioMedia, UserMedia, PersonName, Email, TelephoneNumber, DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime, InputPeriod, Duration, File, CSV, Img, FormHelper, Country, PostalAddress, Location, SocialNetwork, NumberValue,
|
|
47
|
+
HTTPRequest, Cookie, UrlAndQueryString, IBAN, BankCard, AudioMedia, UserMedia, PersonName, Email, TelephoneNumber, DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime, InputPeriod, Duration, File, CSV, Img, FormHelper, Country, PostalAddress, Location, SocialNetwork, NumberValue, FormDate,
|
|
47
48
|
DataTable, Pagination, Navigation, DetailsSubArray, SelectAll, MultipleActionInTable, ShoppingCart, FlashMessage, CountDown, ImportFromCsv, JwtToken, JwtSession, ListBox,
|
|
48
49
|
sleep, refresh, chr, ord, trim, empty,
|
|
49
50
|
GoogleCharts, GoogleRecaptcha, GoogleMap, OpenStreetMap
|
package/media.js
CHANGED
|
@@ -88,10 +88,8 @@ class UserMedia {
|
|
|
88
88
|
const browserName = browser.getBrowserName();
|
|
89
89
|
|
|
90
90
|
navigator.mediaDevices.getUserMedia(constraints !== 'undefined' ? constraints : { audio: true, video: true })
|
|
91
|
-
.then((stream) =>
|
|
92
|
-
|
|
93
|
-
resolve(stream);
|
|
94
|
-
}).catch((error) => {
|
|
91
|
+
.then((stream) => resolve(stream))
|
|
92
|
+
.catch((error) => {
|
|
95
93
|
const errName = error.name;
|
|
96
94
|
const errMessage = error.message;
|
|
97
95
|
let errorType = "Generic";
|
package/package.json
CHANGED
package/todos/graphiques.js
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// --------------------------------------------------------------------------------
|
|
3
|
-
// Graphiques (new)
|
|
4
|
-
// --------------------------------------------------------------------------------
|
|
5
|
-
|
|
6
|
-
google.load("visualization", "1", {packages:["corechart"]});
|
|
7
|
-
|
|
8
|
-
$(function() {
|
|
9
|
-
if (typeof(listeAllGraphiqueStats) != 'undefined' && listeAllGraphiqueStats.length > 0) {
|
|
10
|
-
loadListAllGraphStats(listeAllGraphiqueStats);
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
function loadListAllGraphStats(listeAllGraphiqueStats) {
|
|
15
|
-
$.each(listeAllGraphiqueStats, function(idx, listGraphStats) {
|
|
16
|
-
loadAllGraphStats(listGraphStats);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function loadAllGraphStats(listGraphStats) {
|
|
21
|
-
if (typeof(initWidth) == 'undefined' || initWidth) {
|
|
22
|
-
console.log('ok');
|
|
23
|
-
var width = 0;
|
|
24
|
-
$.each(listGraphStats, function(idx, tabGraph) {
|
|
25
|
-
if ($('#'+tabGraph.id).length) {
|
|
26
|
-
if ($('#'+tabGraph.id).width() > 0) {
|
|
27
|
-
width = $('#'+tabGraph.id).width();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
$.each(listGraphStats, function(idx, tabGraph) {
|
|
34
|
-
// console.log(width + ' ' + height);
|
|
35
|
-
drawGraphiqueStat(tabGraph.type_graph, tabGraph.id, tabGraph.title, tabGraph.libelle_abs, tabGraph.tab_data_abs, tabGraph.liste_libelle_ord, tabGraph.liste_tab_data_ord, tabGraph.list_color, tabGraph.format_ord, tabGraph.height, width);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function drawGraphiqueStat(typeGraph, idDiv, titre, libelleAbs, tabDataAbsParam, listeLibelleOrd, listeTabDataOrd, tabColor, formatData, height, width) {
|
|
40
|
-
if ($('#'+idDiv).length == 0) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
var afficherLibelleOrd = false;
|
|
45
|
-
|
|
46
|
-
isStacked = false;
|
|
47
|
-
if (typeGraph == 'stacked_bar_chart') {
|
|
48
|
-
typeGraph = 'bar_chart';
|
|
49
|
-
isStacked = true;
|
|
50
|
-
}
|
|
51
|
-
if (typeGraph == 'stacked_column_chart') {
|
|
52
|
-
typeGraph = 'column_chart';
|
|
53
|
-
isStacked = true;
|
|
54
|
-
}
|
|
55
|
-
if (typeGraph == 'stacked_combo_chart') {
|
|
56
|
-
typeGraph = 'combo_chart';
|
|
57
|
-
isStacked = true;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
isDualChart = false;
|
|
61
|
-
if (typeGraph == 'dual_column_chart') {
|
|
62
|
-
typeGraph = 'column_chart';
|
|
63
|
-
isDualChart = true;
|
|
64
|
-
}
|
|
65
|
-
if (typeGraph == 'dual_bar_chart') {
|
|
66
|
-
typeGraph = 'bar_chart';
|
|
67
|
-
isDualChart = true;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Déclaration du tableau de données
|
|
71
|
-
var data = new google.visualization.DataTable();
|
|
72
|
-
data.addColumn('string', libelleAbs);
|
|
73
|
-
$.each(listeLibelleOrd, function(idx, libelleOrd) {
|
|
74
|
-
data.addColumn('number', libelleOrd);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// Remplissage des données
|
|
78
|
-
var nbCells = 0;
|
|
79
|
-
var numRow = 0;
|
|
80
|
-
$.each(tabDataAbsParam, function(idx, dataAbs) {
|
|
81
|
-
// dataOrd = tabDataOrd[idx];
|
|
82
|
-
// data.addRow([dataAbs, dataOrd]);
|
|
83
|
-
data.addRows(1);
|
|
84
|
-
|
|
85
|
-
data.setCell(numRow, 0, dataAbs);
|
|
86
|
-
|
|
87
|
-
var numCell = 1;
|
|
88
|
-
$.each(listeTabDataOrd, function(idx2, tabDataOrd) {
|
|
89
|
-
data.setCell(numRow, numCell, tabDataOrd[idx]);
|
|
90
|
-
numCell++;
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
nbCells = numCell;
|
|
94
|
-
numRow++;
|
|
95
|
-
});
|
|
96
|
-
nbCells -= 2;
|
|
97
|
-
|
|
98
|
-
// console.log(data);
|
|
99
|
-
// console.log('drawGraph : '+idDiv+' ; type : '+typeGraph);
|
|
100
|
-
|
|
101
|
-
// Options générales
|
|
102
|
-
var options = {
|
|
103
|
-
colors: tabColor,
|
|
104
|
-
fontName: 'Trebuchet MS',
|
|
105
|
-
fontSize: 12,
|
|
106
|
-
hAxis: {maxAlternation: 1},
|
|
107
|
-
vAxis: {minValue: 0, textPosition: 'out'},
|
|
108
|
-
//gridlines: {color: '#333', count: 1}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
if (formatData != null) {
|
|
112
|
-
options.vAxis.format = formatData;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Options sur le titre du graphique
|
|
116
|
-
options.title = titre;
|
|
117
|
-
if (typeGraph == 'pie_chart') {
|
|
118
|
-
// options.titlePosition = 'none';
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
options.titlePosition = 'none';
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Options sur la taille du graphique
|
|
125
|
-
if (typeGraph == 'bar_chart') {
|
|
126
|
-
options.chartArea = {left:120, top:30};
|
|
127
|
-
options.chartArea.height = (height-60);
|
|
128
|
-
options.chartArea.width = "85%";
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
options.chartArea = {left:"auto", top:"auto"};
|
|
132
|
-
if (height != null) {
|
|
133
|
-
options.chartArea.height = height+"%";
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
options.chartArea.height = "80%";
|
|
137
|
-
}
|
|
138
|
-
options.chartArea.width = "85%";
|
|
139
|
-
}
|
|
140
|
-
// options.chartArea = {};
|
|
141
|
-
// options.chartArea.height = "100%";
|
|
142
|
-
// options.chartArea.width = "100%";
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
// console.log($('#'+idDiv).width());
|
|
146
|
-
// options.height = $('#'+idDiv).height();
|
|
147
|
-
// options.width = $('#'+idDiv).width();
|
|
148
|
-
// options.height = height;
|
|
149
|
-
// console.log(height);
|
|
150
|
-
options.width = width;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// Options sur la légende
|
|
155
|
-
options.legend = {};
|
|
156
|
-
if (typeGraph == 'pie_chart') {
|
|
157
|
-
options.legend.position = 'right';
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
options.legend.position = 'top';
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Options sur l'affichage des labels en absisse / ordonnée
|
|
164
|
-
if (typeGraph == 'bar_chart') {
|
|
165
|
-
// options.hAxis.title = libelleOrd;
|
|
166
|
-
options.vAxis.title = libelleAbs;
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
options.hAxis.title = libelleAbs;
|
|
170
|
-
// options.vAxis.title = libelleOrd;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Options sur les graphiques "dual bar chart / dual column chart"
|
|
174
|
-
if (isDualChart) {
|
|
175
|
-
options.series = {};
|
|
176
|
-
options.axes = {};
|
|
177
|
-
if (typeGraph == 'column_chart') {
|
|
178
|
-
options.axes.y = {};
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
options.axes.x = {};
|
|
182
|
-
}
|
|
183
|
-
$.each(listeLibelleOrd, function(idx, libelleOrd) {
|
|
184
|
-
console.log(idx);
|
|
185
|
-
if (idx <= 1) {
|
|
186
|
-
key = 'series_'+idx;
|
|
187
|
-
options.series[idx] = {axis: key};
|
|
188
|
-
if (typeGraph == 'column_chart') {
|
|
189
|
-
options.axes.y[key] = {label: libelleOrd};
|
|
190
|
-
if (idx == 1) {
|
|
191
|
-
options.axes.y[key].side = 'right';
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
options.axes.x[key] = {label: libelleOrd};
|
|
196
|
-
if (idx == 1) {
|
|
197
|
-
options.axes.x[key].side = 'top';
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
console.log(options.series);
|
|
203
|
-
console.log(options.axes.y);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// Options sur les graphiques "combo chart"
|
|
207
|
-
if (typeGraph == 'combo_chart') {
|
|
208
|
-
options.seriesType = "bars";
|
|
209
|
-
options.series = {};
|
|
210
|
-
options.series[nbCells] = {type: "line"};
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Options sur le style des lignes pour les "line chart"
|
|
214
|
-
if (typeGraph == 'line_chart') {
|
|
215
|
-
options.series = [{lineWidth: 3}, {lineWidth: 1.5}];
|
|
216
|
-
options.curveType = 'function';
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Options sur le style pour les "pie chart"
|
|
220
|
-
if (typeGraph == 'pie_chart') {
|
|
221
|
-
options.is3D = false;
|
|
222
|
-
options.pieResidueSliceLabel = 'Autre';
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (isStacked) {
|
|
226
|
-
options.isStacked = true;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// console.log(options);
|
|
230
|
-
|
|
231
|
-
// Création du graphique
|
|
232
|
-
var errorChart = false;
|
|
233
|
-
if (typeGraph == 'column_chart') {
|
|
234
|
-
var chart = new google.visualization.ColumnChart(document.getElementById(idDiv));
|
|
235
|
-
}
|
|
236
|
-
else if (typeGraph == 'bar_chart') {
|
|
237
|
-
var chart = new google.visualization.BarChart(document.getElementById(idDiv));
|
|
238
|
-
}
|
|
239
|
-
else if (typeGraph == 'line_chart') {
|
|
240
|
-
var chart = new google.visualization.LineChart(document.getElementById(idDiv));
|
|
241
|
-
}
|
|
242
|
-
else if (typeGraph == 'combo_chart') {
|
|
243
|
-
var chart = new google.visualization.ComboChart(document.getElementById(idDiv));
|
|
244
|
-
}
|
|
245
|
-
else if (typeGraph == 'pie_chart') {
|
|
246
|
-
var chart = new google.visualization.PieChart(document.getElementById(idDiv));
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
errorChart = true;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
$('#'+idDiv).removeClass('ajaxLoader');
|
|
253
|
-
$('#'+idDiv).removeClass('graphique_load');
|
|
254
|
-
|
|
255
|
-
if (errorChart) {
|
|
256
|
-
console.log('erreur graphique');
|
|
257
|
-
$('#'+idDiv).addClass('graphique_error');
|
|
258
|
-
document.getElementById(idDiv).innerHTML = 'Une erreur s\'est produite lors du chargement du graphique.';
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
$('#'+idDiv).addClass('graphique');
|
|
262
|
-
document.getElementById(idDiv).innerHTML = '';
|
|
263
|
-
|
|
264
|
-
// $('#'+idDiv).
|
|
265
|
-
// document.getElementById(idDiv).style.display = 'block';
|
|
266
|
-
var hasClassActive = $('#'+idDiv).hasClass('active');
|
|
267
|
-
if (!hasClassActive) {
|
|
268
|
-
$('#'+idDiv).addClass('active');
|
|
269
|
-
}
|
|
270
|
-
google.visualization.events.addListener(chart, 'ready', function () {
|
|
271
|
-
// document.getElementById(idDiv).style.display = 'none';
|
|
272
|
-
// $('#'+idDiv).hide();
|
|
273
|
-
if (!hasClassActive) {
|
|
274
|
-
$('#'+idDiv).removeClass('active');
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
// console.log($("ul li.ui-state-active").index()
|
|
278
|
-
|
|
279
|
-
chart.draw(data, options);
|
|
280
|
-
}
|
|
281
|
-
}
|
package/todos/jquery.js
DELETED
package/todos/tree.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/*
|
|
3
|
-
* SIDEBAR MENU
|
|
4
|
-
* ------------
|
|
5
|
-
* This is a custom plugin for the sidebar menu. It provides a tree view.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* $(".sidebar).tree();
|
|
9
|
-
*
|
|
10
|
-
* Note: This plugin does not accept any options. Instead, it only requires a class added to the element that contains a sub-menu.
|
|
11
|
-
*
|
|
12
|
-
* When used with the sidebar, for example, it would look something like this:
|
|
13
|
-
* <ul class='sidebar-menu'>
|
|
14
|
-
* <li class="treeview active">
|
|
15
|
-
* <a href="#>Menu</a>
|
|
16
|
-
* <ul class='treeview-menu'>
|
|
17
|
-
* <li class='active'><a href=#>Level 1</a></li>
|
|
18
|
-
* </ul>
|
|
19
|
-
* </li>
|
|
20
|
-
* </ul>
|
|
21
|
-
*
|
|
22
|
-
* Add .active class to <li> elements if you want the menu to be open automatically
|
|
23
|
-
* on page load. See above for an example.
|
|
24
|
-
*/
|
|
25
|
-
(function($) {
|
|
26
|
-
"use strict";
|
|
27
|
-
|
|
28
|
-
$.fn.tree = function() {
|
|
29
|
-
return this.each(function() {
|
|
30
|
-
var btn = $(this).children("a").first();
|
|
31
|
-
// var btn = $('a.sidebar-toggle');
|
|
32
|
-
var menu = $(this).children(".treeview-menu").first();
|
|
33
|
-
var isActive = $(this).hasClass('active');
|
|
34
|
-
// isActive = true;
|
|
35
|
-
|
|
36
|
-
//initialize already active menus
|
|
37
|
-
// if (isActive) {
|
|
38
|
-
menu.show();
|
|
39
|
-
btn.children(".fa-angle-left").first().removeClass("fa-angle-left").addClass("fa-angle-down");
|
|
40
|
-
// }
|
|
41
|
-
// else {
|
|
42
|
-
// menu.show();
|
|
43
|
-
// }
|
|
44
|
-
//Slide open or close the menu on link click
|
|
45
|
-
btn.click(function(e) {
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
if (isActive) {
|
|
48
|
-
// Slide up to close menu
|
|
49
|
-
menu.slideUp();
|
|
50
|
-
isActive = false;
|
|
51
|
-
btn.children(".fa-angle-down").first().removeClass("fa-angle-down").addClass("fa-angle-left");
|
|
52
|
-
btn.parent("li").removeClass("active");
|
|
53
|
-
} else {
|
|
54
|
-
// Slide down to open menu
|
|
55
|
-
menu.slideDown();
|
|
56
|
-
isActive = true;
|
|
57
|
-
btn.children(".fa-angle-left").first().removeClass("fa-angle-left").addClass("fa-angle-down");
|
|
58
|
-
btn.parent("li").addClass("active");
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
/* Add margins to submenu elements to give it a tree look */
|
|
63
|
-
menu.find("li > a").each(function() {
|
|
64
|
-
var pad = parseInt($(this).css("margin-left")) + 10;
|
|
65
|
-
|
|
66
|
-
$(this).css({"margin-left": pad + "px"});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
}(jQuery));
|