Revision a5a20700
Added by Benjamin Dauvergne over 12 years ago
calebasse/agenda/templates/agenda/act-validation.html | ||
---|---|---|
1 |
{% extends "calebasse/base.html" %}
|
|
1 |
{% extends "agenda/base.html" %}
|
|
2 | 2 |
{% load url from future %} |
3 |
{% block extrascripts %} |
|
4 |
<script src="{{ STATIC_URL }}js/calebasse.agenda.js"></script> |
|
5 |
{% endblock %} |
|
6 |
|
|
7 |
{% block title %}{{ block.super }} - Agenda {% endblock %} |
|
8 |
|
|
9 |
{% block header %} |
|
10 |
{{ block.super }} |
|
11 |
<span>Agenda - {{ service_name }}</spam> |
|
12 |
{% endblock %} |
|
13 | 3 |
|
14 | 4 |
{% block appbar %} |
15 | 5 |
<h2>Validation des actes - {{ date|date:"DATE_FORMAT" }}</h2> |
... | ... | |
17 | 7 |
{% if day_locked %}<button id="unlock-all" data-url="{% url 'unlock-all' service=service date=date %}">Tout déverrouiller</button> {% endif %}<button id="validation-all" data-url="{% url 'validation-all' service=service date=date %}">Validation automatique</button> |
18 | 8 |
{% endblock %} |
19 | 9 |
|
20 |
{% block content %} |
|
21 |
<div class="content"> |
|
22 |
<div id="datesel"> |
|
23 |
<a href="../../{{ previous_month|date:"SHORT_DATE_FORMAT"}}/activite-du-service">««</a> |
|
24 |
<a href="../../{{ previous_day|date:"SHORT_DATE_FORMAT"}}/activite-du-service">«</a> |
|
25 |
<input id="agenda-date" value="{{ date|date:"DATE_FORMAT" }}"/> |
|
26 |
<a href="../../{{ next_day|date:"SHORT_DATE_FORMAT"}}/activite-du-service">»</a> |
|
27 |
<a href="../../{{ next_month|date:"SHORT_DATE_FORMAT"}}/activite-du-service">»»</a> |
|
28 |
</div> |
|
29 |
|
|
10 |
{% block agenda-content %} |
|
30 | 11 |
{% if validation_msg %} |
31 | 12 |
<ul> |
32 | 13 |
{% for message in validation_msg %} |
... | ... | |
39 | 20 |
{% if actes %} |
40 | 21 |
<div id="actes"> |
41 | 22 |
{% for acte, last_status in actes %} |
42 |
<div class="frame acte"> |
|
43 |
<h3>{{ acte.date }} - <strong>{{ acte.patient.last_name }} {{ acte.patient.first_name }}</strong>{% if acte.patient.paper_id %} ({{ acte.patient.paper_id }}){% endif %}{% if acte.doctors %}{% for doctor in acte.doctors.all %} - {{ doctor.last_name }} {{ doctor.first_name }}{% endfor %}{% endif %} - <strong>{{ acte.act_type }}</strong>{% if acte.description %} <img title="Un commentaire existe" src="{{ STATIC_URL }}images/emblem-documents.png">{% endif%}<!-- <button class="acte-btn">✍</button>--></h3> |
|
44 |
<p>{% if last_status %}<strong>{{ last_status.state_name }}</strong>, le {{ last_status.created }} par {{ last_status.author }}{% if last_status.auto %}(par validation automatique){% endif %}.{% else %}Non pointé.{% endif %} {% if acte.validation_locked %}{% if authorized_lock %}<button>Déverrouiller</button>{% endif %}{% else %}<select name="acte_state" id="acte_state">{% for state_name, display_state_name in validation_states.items %}<option value="{{ state_name }}">{{ display_state_name }}</option>{% endfor %}</select> <button>Modifier</button>{% if authorized_lock %}{% if last_status %} <button>Verrouiller</button>{% endif %}{% endif %}{% endif %}</p> |
|
23 |
<div class="frame acte" id="acte-frame-{{ acte.id }}"> |
|
24 |
<h3>{{ acte.date }} - <strong>{{ acte.patient.last_name }} {{ acte.patient.first_name }}</strong> |
|
25 |
{% if acte.patient.paper_id %} ({{ acte.patient.paper_id }}){% endif %} |
|
26 |
{% if acte.doctors %}{% for doctor in acte.doctors.all %} - {{ doctor.last_name }} {{ doctor.first_name }}{% endfor %}{% endif %} - |
|
27 |
<strong>{{ acte.act_type }}</strong> |
|
28 |
{% if acte.description %} <img title="Un commentaire existe" src="{{ STATIC_URL }}images/emblem-documents.png">{% endif%} |
|
29 |
</h3> |
|
30 |
<p>{% if last_status %}<strong>{{ last_status.state_name }}</strong>, le {{ last_status.created }} par {{ last_status.author }} |
|
31 |
{% if last_status.auto %}(par validation automatique){% endif %}. |
|
32 |
{% else %} |
|
33 |
Non pointé. |
|
34 |
{% endif %} |
|
35 |
{% if acte.validation_locked %} |
|
36 |
{% if authorized_lock %}<button>Déverrouiller</button>{% endif %} |
|
37 |
{% else %} |
|
38 |
<select name="acte_state" id="acte_state"> |
|
39 |
{% for state_name, display_state_name in validation_states.items %} |
|
40 |
<option value="{{ state_name }}">{{ display_state_name }}</option> |
|
41 |
{% endfor %} |
|
42 |
</select> |
|
43 |
<button>Modifier</button> |
|
44 |
{% if authorized_lock %} |
|
45 |
{% if last_status %}<button>Verrouiller</button>{% endif %} |
|
46 |
{% endif %} |
|
47 |
{% endif %} |
|
48 |
</p> |
|
45 | 49 |
</div> |
46 | 50 |
{% endfor %} |
47 | 51 |
</div> |
48 | 52 |
{% else %} |
49 | 53 |
<p><strong>Il n'y a pas d'acte à valider le {{ date|date:"DATE_FORMAT" }}.</strong></p> |
50 | 54 |
{% endif %} |
51 |
|
|
52 |
</div> |
|
53 | 55 |
{% endblock %} |
calebasse/agenda/templates/agenda/base.html | ||
---|---|---|
1 |
{% extends "calebasse/base.html" %} |
|
2 |
{% load url from future %} |
|
3 |
|
|
4 |
{% block extrascripts %} |
|
5 |
<script src="{{ STATIC_URL }}js/calebasse.agenda.js"></script> |
|
6 |
{% endblock %} |
|
7 |
|
|
8 |
{% block title %}{{ block.super }} - Agenda {% endblock %} |
|
9 |
|
|
10 |
{% block header %} |
|
11 |
{{ block.super }} |
|
12 |
<span>Agenda - {{ service_name }}</spam> |
|
13 |
{% endblock %} |
|
14 |
|
|
15 |
{% block content %} |
|
16 |
<div class="content"> |
|
17 |
<div id="datesel"> |
|
18 |
<a href="{% url url_name date=previous_month service=service %}">««</a> |
|
19 |
<a href="{% url url_name date=previous_day service=service %}">«</a> |
|
20 |
<input data-url="{% url url_name date=date service=service %}" id="agenda-date" value="{{ date|date:"DATE_FORMAT" }}"/> |
|
21 |
<a href="{% url url_name date=next_day service=service %}">»</a> |
|
22 |
<a href="{% url url_name date=next_month service=service %}">»»</a> |
|
23 |
</div> |
|
24 |
{% block agenda-content %} |
|
25 |
{% endblock %} |
|
26 |
</div> |
|
27 |
{% endblock %} |
calebasse/agenda/templates/agenda/index.html | ||
---|---|---|
1 |
{% extends "calebasse/base.html" %}
|
|
1 |
{% extends "agenda/base.html" %}
|
|
2 | 2 |
{% load url from future %} |
3 |
{% block extrascripts %} |
|
4 |
<script src="{{ STATIC_URL }}js/calebasse.agenda.js"></script> |
|
5 |
<style> |
|
6 |
uveau rendez-vous patient |
|
7 |
.person-item span { display: none; } |
|
8 |
.person-item.active span { display: inline; } |
|
9 |
#agenda-date { width: 20em; } |
|
10 |
</style> |
|
11 |
{% endblock %} |
|
12 |
|
|
13 |
{% block title %}{{ block.super }} - Agenda {% endblock %} |
|
14 |
|
|
15 |
{% block header %} |
|
16 |
{{ block.super }} |
|
17 |
<span>Agenda - {{ service_name }}</spam> |
|
18 |
{% endblock %} |
|
19 | 3 |
|
20 | 4 |
{% block appbar %} |
21 | 5 |
<h2>Agenda</h2> |
... | ... | |
51 | 35 |
</div> |
52 | 36 |
{% endblock %} |
53 | 37 |
|
54 |
{% block content %} |
|
55 |
<div class="content"> |
|
56 |
<div id="datesel"> |
|
57 |
<a href="../{{ previous_month|date:"SHORT_DATE_FORMAT"}}">««</a> |
|
58 |
<a href="../{{ previous_day|date:"SHORT_DATE_FORMAT"}}">«</a> |
|
59 |
<input id="agenda-date" value="{{ date|date:"DATE_FORMAT" }}"/> |
|
60 |
<a href="../{{ next_day|date:"SHORT_DATE_FORMAT"}}">»</a> |
|
61 |
<a href="../{{ next_month|date:"SHORT_DATE_FORMAT"}}">»»</a> |
|
62 |
</div> |
|
63 |
|
|
38 |
{% block agenda-content %} |
|
64 | 39 |
<table> |
65 | 40 |
<tbody> |
66 | 41 |
<tr> |
... | ... | |
153 | 128 |
</tr> |
154 | 129 |
</tbody> |
155 | 130 |
</table> |
156 |
</div> |
|
157 |
|
|
158 |
|
|
159 | 131 |
{% endblock %} |
160 | 132 |
|
161 | 133 |
{% block dialogs %} |
calebasse/agenda/templates/agenda/service-activity.html | ||
---|---|---|
1 |
{% extends "calebasse/base.html" %} |
|
2 |
{% block extrascripts %} |
|
3 |
|
|
4 |
<script> |
|
5 |
$(function() { |
|
6 |
$('#agenda-date').datepicker({ |
|
7 |
dateFormat: "DD d MM yy", |
|
8 |
onClose: function(dateText, inst) { |
|
9 |
console.log('close'); |
|
10 |
} |
|
11 |
}); |
|
12 |
$('#agenda-date').on('change', function () { |
|
13 |
var date = $(this).datepicker('getDate') |
|
14 |
var year = date.getFullYear(); |
|
15 |
var month = date.getMonth() + 1; |
|
16 |
var day = date.getDate(); |
|
17 |
window.location.href='../../' + year + '-' + month + '-' + day + '/activite-du-service'; |
|
18 |
}); |
|
19 |
}); |
|
20 |
</script> |
|
21 |
{% endblock %} |
|
22 |
|
|
23 |
{% block title %}{{ block.super }} - Agenda {% endblock %} |
|
24 |
|
|
25 |
{% block header %} |
|
26 |
{{ block.super }} |
|
27 |
<span>Agenda - {{ service_name }}</spam> |
|
28 |
{% endblock %} |
|
1 |
{% extends "agenda/base.html" %} |
|
29 | 2 |
|
30 | 3 |
{% block appbar %} |
31 | 4 |
<h2>Activité du service - {{ date|date:"DATE_FORMAT" }}</h2> |
32 | 5 |
<a href="..">Retourner à l'agenda</a> |
33 |
<button>Imprimer</button> |
|
6 |
<button id='print-button'>Imprimer</button>
|
|
34 | 7 |
{% endblock %} |
35 | 8 |
|
36 |
{% block content %} |
|
37 |
<div id="datesel"> |
|
38 |
<a href="../../{{ previous_month|date:"SHORT_DATE_FORMAT"}}/activite-du-service">««</a> |
|
39 |
<a href="../../{{ previous_day|date:"SHORT_DATE_FORMAT"}}/activite-du-service">«</a> |
|
40 |
<input id="agenda-date" value="{{ date|date:"DATE_FORMAT" }}"/> |
|
41 |
<a href="../../{{ next_day|date:"SHORT_DATE_FORMAT"}}/activite-du-service">»</a> |
|
42 |
<a href="../../{{ next_month|date:"SHORT_DATE_FORMAT"}}/activite-du-service">»»</a> |
|
43 |
</div> |
|
44 |
|
|
9 |
{% block agenda-content %} |
|
45 | 10 |
<table class="main" id="activity"> |
46 | 11 |
<thead> |
47 | 12 |
<tr> <th>Heure</th> <th>Durée</th> <th>Patient</th> <th>Thérapeute(s)</th> <th>Acte</th> </tr> |
calebasse/cbv.py | ||
---|---|---|
5 | 5 |
# from django.views.generic.edit import # CreateView, DeleteView, UpdateView |
6 | 6 |
from django.shortcuts import get_object_or_404 |
7 | 7 |
from django.http import Http404 |
8 |
from django.core.urlresolvers import resolve |
|
8 | 9 |
|
9 | 10 |
from calebasse.ressources.models import Service |
10 | 11 |
|
... | ... | |
27 | 28 |
|
28 | 29 |
def get_context_data(self, **kwargs): |
29 | 30 |
context = super(ServiceViewMixin, self).get_context_data(**kwargs) |
31 |
context['url_name'] = resolve(self.request.path).url_name |
|
30 | 32 |
context['popup'] = self.popup |
31 | 33 |
if self.service is not None: |
32 | 34 |
context['service'] = self.service.slug |
calebasse/static/css/style.css | ||
---|---|---|
507 | 507 |
border: 0; |
508 | 508 |
text-align: center; |
509 | 509 |
color: #8c8c73; |
510 |
width: 13em; |
|
510 | 511 |
} |
511 | 512 |
|
512 | 513 |
table.main { |
... | ... | |
930 | 931 |
#rdv table td { |
931 | 932 |
width: 30%; |
932 | 933 |
} |
934 |
|
|
935 |
.person-item span { display: none; } |
|
936 |
|
|
937 |
.person-item.active span { display: inline; } |
calebasse/static/js/calebasse.agenda.js | ||
---|---|---|
34 | 34 |
} |
35 | 35 |
} |
36 | 36 |
|
37 |
$(function() { |
|
38 |
$('#tabs').tabs(); |
|
37 |
(function($) { |
|
38 |
$(function() { |
|
39 |
$('#tabs').tabs(); |
|
39 | 40 |
|
40 |
$('div.agenda > div').accordion({active: false, autoHeight: false}); |
|
41 |
$('div.agenda > div').accordion({active: false, autoHeight: false});
|
|
41 | 42 |
|
42 |
$('.person-item').on('click', function() { |
|
43 |
$('#filtre input').val('') |
|
44 |
$('#users li').each(function() { |
|
45 |
$(this).show(); |
|
46 |
}); |
|
47 |
toggle_worker(this); |
|
48 |
}); |
|
49 |
// select all anchors |
|
50 |
$.each(extract_anchor(), function (i, anchor) { |
|
51 |
$('#'+anchor.substr(1)).each(function (i, worker_selector) { toggle_worker(worker_selector); }); |
|
52 |
}); |
|
43 |
$('.person-item').on('click', function() {
|
|
44 |
$('#filtre input').val('')
|
|
45 |
$('#users li').each(function() {
|
|
46 |
$(this).show();
|
|
47 |
});
|
|
48 |
toggle_worker(this);
|
|
49 |
});
|
|
50 |
// select all anchors
|
|
51 |
$.each(extract_anchor(), function (i, anchor) {
|
|
52 |
$('#'+anchor.substr(1)).each(function (i, worker_selector) { toggle_worker(worker_selector); });
|
|
53 |
});
|
|
53 | 54 |
|
54 |
$('.textedit').on('keydown', function() { |
|
55 |
$('button', this).removeAttr("disabled"); |
|
56 |
}); |
|
57 |
$('.textedit button').on('click', function() { |
|
58 |
var textarea = $(this).prev(); |
|
59 |
var span = textarea.prev() |
|
60 |
var btn = $(this) |
|
61 |
$.ajax({ |
|
62 |
url: '/api/event/' + $(this).data("event-id") + '/?format=json', |
|
63 |
type: 'PATCH', |
|
64 |
contentType: 'application/json', |
|
65 |
data: '{"description": "' + textarea.val() + '"}', |
|
66 |
success: function(data) { |
|
67 |
btn.attr('disabled', 'disabled'); |
|
68 |
span.html('Commentaire modifiée avec succès'); |
|
69 |
} |
|
70 |
}); |
|
71 |
}); |
|
72 |
$('.appointment').on('click', function() { |
|
73 |
$('.textedit span', this).html(''); |
|
74 |
}); |
|
75 |
|
|
76 |
$('.remove-appointment').on('click', function() { |
|
77 |
var r = confirm("Etes-vous sûr de vouloir supprimer le rendez-vous " + $(this).data('rdv') + " ?"); |
|
78 |
if (r == true) |
|
79 |
{ |
|
80 |
$.ajax({ |
|
81 |
url: '/api/occurrence/' + $(this).data('occurrence-id') + '/', |
|
82 |
type: 'DELETE', |
|
83 |
success: function(data) { |
|
84 |
window.location.reload(true); |
|
85 |
return false; |
|
86 |
} |
|
87 |
}); |
|
88 |
} |
|
89 |
return false; |
|
90 |
}); |
|
55 |
$('.textedit').on('keydown', function() { |
|
56 |
$('button', this).removeAttr("disabled"); |
|
57 |
}); |
|
58 |
$('.textedit button').on('click', function() { |
|
59 |
var textarea = $(this).prev(); |
|
60 |
var span = textarea.prev() |
|
61 |
var btn = $(this) |
|
62 |
$.ajax({ |
|
63 |
url: '/api/event/' + $(this).data("event-id") + '/?format=json', |
|
64 |
type: 'PATCH', |
|
65 |
contentType: 'application/json', |
|
66 |
data: '{"description": "' + textarea.val() + '"}', |
|
67 |
success: function(data) { |
|
68 |
btn.attr('disabled', 'disabled'); |
|
69 |
span.html('Commentaire modifiée avec succès'); |
|
70 |
} |
|
71 |
}); |
|
72 |
}); |
|
73 |
$('.appointment').on('click', function() { |
|
74 |
$('.textedit span', this).html(''); |
|
75 |
}); |
|
91 | 76 |
|
92 |
/* Gestion du filtre sur les utilisateurs */ |
|
93 |
$('#filtre input').keyup(function() { |
|
94 |
var filtre = $(this).val(); |
|
95 |
if (filtre) { |
|
96 |
$('#users li').each(function() { |
|
97 |
if ($(this).text().match(new RegExp(filtre, "i"))) { |
|
98 |
$(this).show(); |
|
99 |
} else { |
|
100 |
$(this).hide(); |
|
101 |
} |
|
102 |
}); |
|
103 |
} else { |
|
104 |
$('#users li').show(); |
|
105 |
} |
|
77 |
$('.remove-appointment').on('click', function() { |
|
78 |
var r = confirm("Etes-vous sûr de vouloir supprimer le rendez-vous " + $(this).data('rdv') + " ?"); |
|
79 |
if (r == true) |
|
80 |
{ |
|
81 |
$.ajax({ |
|
82 |
url: '/api/occurrence/' + $(this).data('occurrence-id') + '/', |
|
83 |
type: 'DELETE', |
|
84 |
success: function(data) { |
|
85 |
window.location.reload(true); |
|
86 |
return false; |
|
87 |
} |
|
88 |
}); |
|
89 |
} |
|
90 |
return false; |
|
91 |
}); |
|
106 | 92 |
|
107 |
}); |
|
108 |
$('#agenda-date').datepicker({ |
|
109 |
dateFormat: "DD d MM yy", |
|
110 |
onClose: function(dateText, inst) { |
|
111 |
console.log('close'); |
|
112 |
} |
|
113 |
}); |
|
114 |
$('#agenda-date').on('change', function () { |
|
115 |
var date = $(this).datepicker('getDate') |
|
116 |
var year = date.getFullYear(); |
|
117 |
var month = date.getMonth() + 1; |
|
118 |
var day = date.getDate(); |
|
119 |
window.location.href=replace_anchor('../' + year + '-' + month + '-' + day, make_anchor()); |
|
120 |
}); |
|
121 |
$('.date').datepicker({showOn: 'button'}); |
|
122 |
$('#add-intervenant-btn').click(function() { |
|
123 |
var text = $(this).prev().val(); |
|
124 |
$('#intervenants ul').append('<li><input type="checkbox" value="' + text + '" checked="checked">' + text + '</input></li>'); |
|
125 |
$(this).prev().val('').focus(); |
|
126 |
return false; |
|
127 |
}); |
|
128 |
$('.newrdv').click(function() { |
|
129 |
var participants = $('.person-item.active').map(function (i, v) { return $(v).data('worker-id'); }); |
|
130 |
var qs = $.param({participants: $.makeArray(participants), time: $(this).data('hour') }, true); |
|
131 |
var new_appointment_url = $(this).data('url') + "?" + qs; |
|
132 |
$('#rdv').load(new_appointment_url, |
|
133 |
function () { |
|
134 |
function onsuccess(response, status, xhr, form) { |
|
135 |
var parse = $(response); |
|
136 |
if ($('.errorlist', parse).length != 0) { |
|
137 |
$('#rdv').html(response); |
|
138 |
$('#rdv form').ajaxForm({ |
|
139 |
success: onsuccess, |
|
140 |
}); |
|
141 |
$('#rdv .datepicker-date').datepicker({dateFormat: 'yy-m-d', showOn: 'button'}); |
|
142 |
console.log('error'); |
|
143 |
} else { |
|
144 |
console.log('success'); |
|
145 |
window.location.reload(true); |
|
146 |
} |
|
147 |
} |
|
148 |
$('#rdv .datepicker-date').datepicker({dateFormat: 'yy-m-d', showOn: 'button'}); |
|
149 |
$('form', this).ajaxForm({ |
|
150 |
success: onsuccess |
|
151 |
}); |
|
152 |
$(this).dialog({title: 'Nouveau rendez-vous', |
|
153 |
width: '820px', |
|
154 |
buttons: [ { text: "Fermer", |
|
155 |
click: function() { $(this).dialog("close"); } }, |
|
156 |
{ text: "Ajouter", |
|
157 |
click: function() { $("#rdv form").submit(); } }]}); |
|
158 |
}); |
|
159 |
}); |
|
160 |
$('.newevent').click(function() { |
|
161 |
var participants = $('.person-item.active').map(function (i, v) { return $(v).data('worker-id'); }); |
|
162 |
var qs = $.param({participants: $.makeArray(participants), time: $(this).data('hour') }, true); |
|
163 |
var new_appointment_url = $(this).data('url') + "?" + qs; |
|
164 |
$('#rdv').load(new_appointment_url, |
|
165 |
function () { |
|
166 |
function onsuccess(response, status, xhr, form) { |
|
167 |
var parse = $(response); |
|
168 |
if ($('.errorlist', parse).length != 0) { |
|
169 |
$('#rdv').html(response); |
|
170 |
$('#rdv form').ajaxForm({ |
|
171 |
success: onsuccess, |
|
172 |
}); |
|
173 |
$('#rdv .datepicker-date').datepicker({dateFormat: 'yy-m-d', showOn: 'button'}); |
|
174 |
console.log('error'); |
|
175 |
} else { |
|
176 |
console.log('success'); |
|
177 |
window.location.reload(true); |
|
178 |
} |
|
179 |
} |
|
180 |
$('#rdv .datepicker-date').datepicker({dateFormat: 'yy-m-d', showOn: 'button'}); |
|
181 |
$('#id_description').attr('rows', '3'); |
|
182 |
$('#id_description').attr('cols', '30'); |
|
183 |
$('form', this).ajaxForm({ |
|
184 |
success: onsuccess |
|
185 |
}); |
|
186 |
$(this).dialog({title: 'Nouvelle événement', |
|
187 |
width: '850px', |
|
188 |
buttons: [ { text: "Fermer", |
|
189 |
click: function() { $(this).dialog("close"); } }, |
|
190 |
{ text: "Ajouter", |
|
191 |
click: function() { $("#rdv form").submit(); } }]}); |
|
192 |
}); |
|
193 |
}); |
|
194 |
}); |
|
93 |
/* Gestion du filtre sur les utilisateurs */ |
|
94 |
$('#filtre input').keyup(function() { |
|
95 |
var filtre = $(this).val(); |
|
96 |
if (filtre) { |
|
97 |
$('#users li').each(function() { |
|
98 |
if ($(this).text().match(new RegExp(filtre, "i"))) { |
|
99 |
$(this).show(); |
|
100 |
} else { |
|
101 |
$(this).hide(); |
|
102 |
} |
|
103 |
}); |
|
104 |
} else { |
|
105 |
$('#users li').show(); |
|
106 |
} |
|
195 | 107 |
|
108 |
}); |
|
109 |
$('#agenda-date').datepicker({ |
|
110 |
dateFormat: "DD d MM yy", |
|
111 |
onClose: function(dateText, inst) { |
|
112 |
console.log('close'); |
|
113 |
} |
|
114 |
}); |
|
115 |
$('#agenda-date').on('change', function () { |
|
116 |
var date = $(this).datepicker('getDate') |
|
117 |
var year = date.getFullYear(); |
|
118 |
var month = date.getMonth() + 1; |
|
119 |
var day = date.getDate(); |
|
120 |
var url_tpl = $(this).data('url'); |
|
121 |
var new_date = year + '-' + month + '-' + day; |
|
122 |
var url = url_tpl.replace(/[0-9]{4}-[0-9]{2}-[0-9]{2}/, new_date); |
|
123 |
window.location.href = url; |
|
124 |
}); |
|
125 |
$('.date').datepicker({showOn: 'button'}); |
|
126 |
$('#add-intervenant-btn').click(function() { |
|
127 |
var text = $(this).prev().val(); |
|
128 |
$('#intervenants ul').append('<li><input type="checkbox" value="' + text + '" checked="checked">' + text + '</input></li>'); |
|
129 |
$(this).prev().val('').focus(); |
|
130 |
return false; |
|
131 |
}); |
|
132 |
$('.newrdv').click(function() { |
|
133 |
var participants = $('.person-item.active').map(function (i, v) { return $(v).data('worker-id'); }); |
|
134 |
var qs = $.param({participants: $.makeArray(participants), time: $(this).data('hour') }, true); |
|
135 |
var new_appointment_url = $(this).data('url') + "?" + qs; |
|
136 |
$('#rdv').load(new_appointment_url, |
|
137 |
function () { |
|
138 |
function onsuccess(response, status, xhr, form) { |
|
139 |
var parse = $(response); |
|
140 |
if ($('.errorlist', parse).length != 0) { |
|
141 |
$('#rdv').html(response); |
|
142 |
$('#rdv form').ajaxForm({ |
|
143 |
success: onsuccess, |
|
144 |
}); |
|
145 |
$('#rdv .datepicker-date').datepicker({dateFormat: 'yy-m-d', showOn: 'button'}); |
|
146 |
console.log('error'); |
|
147 |
} else { |
|
148 |
console.log('success'); |
|
149 |
window.location.reload(true); |
|
150 |
} |
|
151 |
} |
|
152 |
$('#rdv .datepicker-date').datepicker({dateFormat: 'yy-m-d', showOn: 'button'}); |
|
153 |
$('form', this).ajaxForm({ |
|
154 |
success: onsuccess |
|
155 |
}); |
|
156 |
$(this).dialog({title: 'Nouveau rendez-vous', |
|
157 |
width: '820px', |
|
158 |
buttons: [ { text: "Fermer", |
|
159 |
click: function() { $(this).dialog("close"); } }, |
|
160 |
{ text: "Ajouter", |
|
161 |
click: function() { $("#rdv form").submit(); } }]}); |
|
162 |
}); |
|
163 |
}); |
|
164 |
$('.newrdv').click(function() { |
|
165 |
var participants = $('.person-item.active').map(function (i, v) { return $(v).data('worker-id'); }); |
|
166 |
var qs = $.param({participants: $.makeArray(participants), time: $(this).data('hour') }, true); |
|
167 |
var new_appointment_url = $(this).data('url') + "?" + qs; |
|
168 |
$('#rdv').load(new_appointment_url, |
|
169 |
function () { |
|
170 |
function onsuccess(response, status, xhr, form) { |
|
171 |
var parse = $(response); |
|
172 |
if ($('.errorlist', parse).length != 0) { |
|
173 |
$('#rdv').html(response); |
|
174 |
$('#rdv form').ajaxForm({ |
|
175 |
success: onsuccess, |
|
176 |
}); |
|
177 |
$('#rdv .datepicker-date').datepicker({dateFormat: 'yy-m-d', showOn: 'button'}); |
|
178 |
console.log('error'); |
|
179 |
} else { |
|
180 |
console.log('success'); |
|
181 |
window.location.reload(true); |
|
182 |
} |
|
183 |
} |
|
184 |
$('#rdv .datepicker-date').datepicker({dateFormat: 'yy-m-d', showOn: 'button'}); |
|
185 |
$('#id_description').attr('rows', '3'); |
|
186 |
$('#id_description').attr('cols', '30'); |
|
187 |
$('form', this).ajaxForm({ |
|
188 |
success: onsuccess |
|
189 |
}); |
|
190 |
$(this).dialog({title: 'Nouvelle événement', |
|
191 |
width: '850px', |
|
192 |
buttons: [ { text: "Fermer", |
|
193 |
click: function() { $(this).dialog("close"); } }, |
|
194 |
{ text: "Ajouter", |
|
195 |
click: function() { $("#rdv form").submit(); } }]}); |
|
196 |
}); |
|
197 |
}); |
|
198 |
}) |
|
199 |
})(window.jQuery) |
Also available in: Unified diff
factorize all agenda navigation code in an agenda/base.html template