creation rdv avec saisie chantier en autocompletion

This commit is contained in:
2020-03-14 11:45:26 +01:00
parent cdff87d001
commit 59778cf3e9
7 changed files with 130 additions and 77 deletions

View File

@@ -26,6 +26,9 @@ import json
from ..models.default import *
from ..models.agenda import *
from ..models.dossier import (
get_chantiers_byName
)
def to_decimal(x):
import decimal
@@ -277,4 +280,19 @@ def ajax_codepostal(request):
return Response(json.dumps(liste))
@view_config(route_name='ajax_lookup')
def ajax_lookup(request):
recherche = request.GET['recherche']
societe = recherche[:2] # 1er car.
name = recherche[2:]
# lire les chantiers
chantiers = get_chantiers_byName(request, societe, name)
liste=[]
for row in chantiers:
d = "%s | %s-%s"% (row.chantier, societe, row.numero)
liste.append(d)
return Response(json.dumps(liste))