Display a dialog for the reading of a cv2.

This commit is contained in:
Mikaël Ates 2015-01-13 16:14:01 +01:00
parent 6f6221a2cd
commit fce3e1e61d
4 changed files with 31 additions and 4 deletions

View File

@ -49,4 +49,6 @@ urlpatterns = patterns('calebasse.dossiers.views',
url(r'^(?P<patientrecord_id>\d+)/prescription-transport$', 'prescription_transport'),
url(r'^(?P<patientrecord_id>\d+)/protection/new$', 'new_protection'),
url(r'^(?P<patientrecord_id>\d+)/protection/(?P<pk>\d+)/update$', 'update_protection'),
url(r'^(?P<patientrecord_id>\d+)/protection/(?P<pk>\d+)/del$', 'delete_protection'),)
url(r'^(?P<patientrecord_id>\d+)/protection/(?P<pk>\d+)/del$', 'delete_protection'),
url(r'^(?P<patientrecord_id>\d+)/read-cv2$', 'read_cv2'),
)

View File

@ -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'

View File

@ -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;
}

View File

@ -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) {