Révision 488e8418
Ajouté par Serghei Mihai (congés, retour 15/05) il y a environ 10 ans
calebasse/agenda/templates/agenda/ajax-ressource-disponibility-column.html | ||
---|---|---|
1 |
<tr><td class="ressource-{{ ressource_id }} agenda" data-id="{{ ressource_id }}">{{ initials }}</td></tr> |
|
2 |
{% for start_time, quarters in disponibility.items %} |
|
3 |
<tr> |
|
1 |
<li class='ressource-{{ ressource_id }}'> |
|
2 |
<ul> |
|
3 |
<li class="initials" data-id="{{ ressource_id }}"> |
|
4 |
{{ initials }} |
|
5 |
</li> |
|
6 |
{% for start_time, quarters in disponibility.items %} |
|
7 |
<li class="hour-mark"> |
|
8 |
<ul> |
|
4 | 9 |
{% for quarter in quarters %} |
5 |
{% for value in quarter %} |
|
6 |
<td class="ressource-{{ value.id }} agenda {{ value.dispo }}" data-id="{{ value.id }}"></td> |
|
7 |
{% endfor %} |
|
10 |
{% for value in quarter %} |
|
11 |
<li class="ressource-{{ value.id }} agenda {{ value.dispo }}" data-id="{{ value.id }}"></li> |
|
8 | 12 |
{% endfor %} |
9 |
</tr> |
|
10 |
{% endfor %} |
|
13 |
{% endfor %} |
|
14 |
</ul> |
|
15 |
</li> |
|
16 |
{% endfor %} |
|
17 |
</ul> |
|
18 |
</li> |
calebasse/agenda/templates/agenda/index.html | ||
---|---|---|
65 | 65 |
<tbody> |
66 | 66 |
<tr> |
67 | 67 |
<td id="dispos"> |
68 |
<button id="close-all-worker-agendas" style="display: none">Fermer tous les agendas</button> |
|
69 |
Disponibilités |
|
70 |
<table> |
|
71 |
<tr class="initials"><td></td></tr> |
|
72 |
{% for start_time in disponibility_start_times %} |
|
73 |
<tr class="hour-mark"> |
|
74 |
<td rowspan="4">{{ start_time }}:00</td> |
|
75 |
</tr> |
|
76 |
<tr></tr> |
|
77 |
<tr></tr> |
|
78 |
<tr></tr> |
|
79 |
{% endfor %} |
|
80 |
</table> |
|
68 |
<button id="close-all-agendas" style="display: none">Fermer tous les agendas</button> |
|
69 |
<h5>Disponibilités</h5> |
|
70 |
<ul id="availability"> |
|
71 |
<li id='time'> |
|
72 |
<ul> |
|
73 |
<li class="initials"> </li> |
|
74 |
{% for start_time in disponibility_start_times %} |
|
75 |
<li class="hour-mark"> |
|
76 |
{{ start_time|stringformat:"02d" }}:00 |
|
77 |
</li> |
|
78 |
{% endfor %} |
|
79 |
</ul> |
|
80 |
</li> |
|
81 |
</ul> |
|
81 | 82 |
</td> |
82 | 83 |
|
83 | 84 |
<td id="agendas"> |
calebasse/static/css/agenda.css | ||
---|---|---|
94 | 94 |
.search input { |
95 | 95 |
border: 0 !important; |
96 | 96 |
width: 75%; |
97 |
} |
|
98 |
|
|
99 |
button#close-all-agendas { |
|
100 |
margin-left: auto; |
|
101 |
margin-right: auto; |
|
102 |
} |
|
103 |
|
|
104 |
#availability { |
|
105 |
white-space: nowrap; |
|
106 |
} |
|
107 |
|
|
108 |
#dispos > ul, #availability > ul { |
|
109 |
margin: 0 .1em; |
|
110 |
padding: 0; |
|
111 |
float: left; |
|
112 |
} |
|
113 |
|
|
114 |
#dispos li { |
|
115 |
list-style-type: none; |
|
116 |
} |
|
117 |
|
|
118 |
#availability li ul { |
|
119 |
margin: 0; |
|
120 |
padding: 0; |
|
121 |
} |
|
122 |
|
|
123 |
#availability > li { |
|
124 |
display: inline-table; |
|
125 |
} |
|
126 |
|
|
127 |
#dispos li.initials { |
|
128 |
height: 15px; |
|
129 |
margin-bottom: 2px; |
|
130 |
} |
|
131 |
|
|
132 |
#availability li.agenda { |
|
133 |
width: 15px; |
|
134 |
height: 5px; |
|
135 |
margin: 3px 0px; |
|
136 |
} |
|
137 |
|
|
138 |
li.hour-mark { |
|
139 |
height: 30px; |
|
140 |
margin-bottom: 5px; |
|
141 |
} |
|
142 |
|
|
143 |
li.free { |
|
144 |
background: green; |
|
145 |
} |
|
146 |
|
|
147 |
li.busy { |
|
148 |
background: #f00; |
|
149 |
} |
|
150 |
|
|
151 |
li.away { |
|
152 |
background: #ccc; |
|
97 | 153 |
} |
calebasse/static/css/style.css | ||
---|---|---|
452 | 452 |
top: -6px; |
453 | 453 |
} |
454 | 454 |
|
455 |
td#dispos { |
|
456 |
padding-top: 55px; |
|
457 |
vertical-align: top; |
|
458 |
position: relative; |
|
459 |
} |
|
460 |
|
|
461 |
td#dispos tr.initials { |
|
462 |
font-size: 80%; |
|
463 |
font-family: monospace; |
|
464 |
} |
|
465 |
|
|
466 | 455 |
td#dispos td { |
467 | 456 |
height: 4px; |
468 | 457 |
width: 15px; |
469 | 458 |
vertical-align: top; |
470 | 459 |
} |
471 | 460 |
|
472 |
button#close-all-agendas { |
|
473 |
position: absolute; |
|
474 |
top: 0px; |
|
475 |
margin-left: auto; |
|
476 |
margin-right: auto; |
|
477 |
} |
|
478 |
|
|
479 |
td.away { |
|
480 |
background: #ccc; |
|
481 |
} |
|
482 |
|
|
483 |
td.free { |
|
484 |
background: green; |
|
485 |
} |
|
486 |
|
|
487 |
td.busy { |
|
488 |
background: red; |
|
461 |
td#dispos h5 { |
|
462 |
margin: 5px auto; |
|
489 | 463 |
} |
490 | 464 |
|
491 | 465 |
span.absent{ |
calebasse/static/js/calebasse.agenda.js | ||
---|---|---|
237 | 237 |
}); |
238 | 238 |
} |
239 | 239 |
|
240 |
function reorder_disponibility_columns() { |
|
241 |
/* make sure column are ordered like tabs */ |
|
242 |
var table_indexes = new Array(); |
|
243 |
$('a.tab').each(function(a, b) { |
|
244 |
table_indexes.push($(b).data('id')); |
|
245 |
}); |
|
246 |
|
|
247 |
rows = $('td#dispos table tr'); |
|
248 |
for (var i=0; i<rows.length; i++) { |
|
249 |
tr = $(rows[i]); |
|
250 |
t = $.map(table_indexes, |
|
251 |
function(v, i) { return $('.ressource-' + v, tr)[0]; }).filter( |
|
252 |
function(a) { if (a) return true; return false; }); |
|
253 |
$('.agenda', tr).detach(); |
|
254 |
$(tr).append(t); |
|
255 |
}; |
|
256 |
} |
|
257 |
|
|
258 | 240 |
function toggle_ressource(ressource_selector, ressource) { |
259 | 241 |
|
260 | 242 |
var ressource_id = $(ressource_selector).data(ressource + '-id'); |
... | ... | |
285 | 267 |
} |
286 | 268 |
var target = $($(ressource_selector).data('target')); |
287 | 269 |
target.toggle(); |
288 |
$('#close-all-' + ressource + '-agendas').toggle($('li.agenda:visible').length != 0);
|
|
270 |
$('#close-all-agendas').toggle($('li.agenda:visible').length != 0); |
|
289 | 271 |
|
290 | 272 |
var tab = $('#link-tab-' + ressource + '-' + ressource_id).parent().get(0); |
291 | 273 |
var tab_list = $(tab).parent().get(0); |
... | ... | |
305 | 287 |
$.get(url + 'ajax-' + ressource + '-disponibility-column/' + ressource_id, |
306 | 288 |
function(data) { |
307 | 289 |
if ($(tab_selector).hasClass('active')) { |
308 |
var dispo_table_rows = $('td#dispos table tr'); |
|
309 |
all_td = $(data).find('td'); |
|
310 |
$(data).find('td').each(function(a, b) { |
|
311 |
$(dispo_table_rows[a]).append(b); |
|
312 |
}); |
|
290 |
var availability_block = $('ul#availability'); |
|
291 |
availability_block.append($(data)); |
|
313 | 292 |
} |
314 | 293 |
} |
315 | 294 |
); |
316 | 295 |
} else { |
317 | 296 |
// remove hidden ressource availability |
318 |
$('td#dispos table tr td.ressource-' + ressource_id + '.agenda').remove();
|
|
297 |
$('ul#availability li.ressource-'+ressource_id).remove();
|
|
319 | 298 |
} |
320 |
|
|
321 |
reorder_disponibility_columns(); |
|
322 | 299 |
return target.find('a.tab'); |
323 | 300 |
} |
324 | 301 |
|
... | ... | |
339 | 316 |
collapsible: true, |
340 | 317 |
}); |
341 | 318 |
|
342 |
$('#tabs').ajaxStop(function() { reorder_disponibility_columns(); }); |
|
343 |
|
|
344 | 319 |
if ($('.worker-item').length) { |
345 | 320 |
$('.worker-item').on('click', function() { |
346 | 321 |
var target = toggle_ressource(this, 'worker'); |
... | ... | |
470 | 445 |
'rooms': {'button': 'ressource', 'element': 'ressource'} |
471 | 446 |
}, |
472 | 447 |
function(key, value) { |
473 |
$('#close-all-' + value.button + '-agendas').click(function() { |
|
448 |
$('#close-all-agendas').click(function() { |
|
449 |
console.log(value); |
|
474 | 450 |
$.cookie('active-' + value.element + '-agenda', '', {path: COOKIE_PATH}); |
475 | 451 |
$('.' + value.element + '-item.active').each(function (i, v) { |
476 | 452 |
toggle_ressource(v, value.element); |
Formats disponibles : Unified diff
availabilities bar refactored using lists
closes #4384