diff --git a/calebasse/dossiers/urls.py b/calebasse/dossiers/urls.py index 2b303df1..e2d91e27 100644 --- a/calebasse/dossiers/urls.py +++ b/calebasse/dossiers/urls.py @@ -49,4 +49,6 @@ urlpatterns = patterns('calebasse.dossiers.views', url(r'^(?P\d+)/prescription-transport$', 'prescription_transport'), url(r'^(?P\d+)/protection/new$', 'new_protection'), url(r'^(?P\d+)/protection/(?P\d+)/update$', 'update_protection'), - url(r'^(?P\d+)/protection/(?P\d+)/del$', 'delete_protection'),) + url(r'^(?P\d+)/protection/(?P\d+)/del$', 'delete_protection'), + url(r'^(?P\d+)/read-cv2$', 'read_cv2'), + ) diff --git a/calebasse/dossiers/views.py b/calebasse/dossiers/views.py index 41591782..90b8b9bf 100644 --- a/calebasse/dossiers/views.py +++ b/calebasse/dossiers/views.py @@ -36,7 +36,7 @@ from calebasse.facturation.invoice_header import render_to_pdf_file from calebasse.decorators import validator_only -from ..utils import get_service_setting, is_validator +from ..utils import get_service_setting, is_validator, get_last_file class NewPatientRecordView(cbv.FormView, cbv.ServiceViewMixin): form_class = forms.NewPatientRecordForm @@ -353,6 +353,28 @@ class PatientRecordAddrView(cbv.ServiceViewMixin, cbv.NotificationDisplayView, c tab3_addresses = PatientRecordAddrView.as_view() +class ReadCV2View(cbv.FormView): + template_name = 'dossiers/cv2.html' + form_class = Form + success_url = './view#tab=2' + + def get_context_data(self, **kwargs): + ctx = super(ReadCV2View, self).get_context_data(**kwargs) + cv_files_path = get_service_setting('cv_files_path') + if not cv_files_path or not os.path.isdir(cv_files_path): + return ctx + reader_identifier = None + try: + reader_identifier = self.request.user.userworker.worker.cv2_reader_name + except: + pass + filename = get_last_file(cv_files_path, + prefix=reader_identifier, suffix='.xml') + ctx['carte_vitale'] = filename + return ctx + +read_cv2 = validator_only(ReadCV2View.as_view()) + class PatientRecordNotifsView(cbv.DetailView): model = PatientRecord template_name = 'dossiers/patientrecord_tab4_notifs.html' diff --git a/calebasse/static/css/dossiers.css b/calebasse/static/css/dossiers.css index ed9e06ff..4cdc6aac 100644 --- a/calebasse/static/css/dossiers.css +++ b/calebasse/static/css/dossiers.css @@ -90,7 +90,7 @@ div#tabs-4 div div.buttons { clear: both; } -#new-address-btn, #new-contact-btn { +#new-address-btn, #new-contact-btn #read-cv2{ font-size: 1.1em; } diff --git a/calebasse/static/js/calebasse.dossiers.js b/calebasse/static/js/calebasse.dossiers.js index 4b277a12..4d68e7a7 100644 --- a/calebasse/static/js/calebasse.dossiers.js +++ b/calebasse/static/js/calebasse.dossiers.js @@ -227,7 +227,10 @@ function load_tab3_addresses() { generic_ajaxform_dialog('address/' + $(this).data('id') + '/del', 'Supprimer une addresse', '#ajax-dlg', '500px', 'Supprimer'); }); - + $('#read-cv2').click(function() { + generic_ajaxform_dialog('read-cv2', 'Lecture de la Carte Vitale', + '#ajax-dlg', '600px', 'Ok'); + }); $('.place_of_life').click(function() { if ((this.checked) == true) {