From e7c0ebb7f5d58ec58366cbfd8a77eba2961891dc Mon Sep 17 00:00:00 2001 From: Marc Rufener Date: Wed, 1 Sep 2021 14:07:01 +0200 Subject: [PATCH 1/5] update operateurs --- back/infolica/routes.py | 2 - back/infolica/views/operateur.py | 46 --- front/.env | 1 - .../src/components/Operateurs/Operateurs.vue | 370 +++++++++++------- .../components/Operateurs/OperateursEdit.vue | 231 ----------- .../src/components/Operateurs/operateurs.html | 65 ++- .../components/Operateurs/operateursEdit.css | 15 - .../components/Operateurs/operateursEdit.html | 62 --- front/src/routes | 3 - 9 files changed, 298 insertions(+), 497 deletions(-) delete mode 100644 front/src/components/Operateurs/OperateursEdit.vue delete mode 100644 front/src/components/Operateurs/operateursEdit.css delete mode 100644 front/src/components/Operateurs/operateursEdit.html diff --git a/back/infolica/routes.py b/back/infolica/routes.py index 73a282f5..5d49ecb5 100644 --- a/back/infolica/routes.py +++ b/back/infolica/routes.py @@ -51,8 +51,6 @@ def includeme(config): config.add_route('operateur_by_id', '/infolica/api/operateurs/{id}') config.add_route('recherche_operateurs', '/infolica/api/recherche_operateurs') config.add_route('recherche_operateurs_s', '/infolica/api/recherche_operateurs/') - config.add_route('add_operateurs_ad', '/infolica/api/add_operateurs_ad') - config.add_route('add_operateurs_ad_s', '/infolica/api/add_operateurs_ad/') #Test (temp endpoint) config.add_route('test_client', '/infolica/api/test_client') #Controle_mutation diff --git a/back/infolica/views/operateur.py b/back/infolica/views/operateur.py index 6986f04e..0c85c44f 100644 --- a/back/infolica/views/operateur.py +++ b/back/infolica/views/operateur.py @@ -133,49 +133,3 @@ def operateurs_delete_view(request): model.sortie = datetime.utcnow() return Utils.get_data_save_response(Constant.SUCCESS_DELETE.format(Operateur.__tablename__)) - - -@view_config(route_name='add_operateurs_ad', request_method='GET', renderer='json') -@view_config(route_name='add_operateurs_ad_s', request_method='GET', renderer='json') -def add_operateurs_ad_view(request): - """ - Add nouveaux operateurs AD - """ - # Check authorization - if not Utils.has_permission(request, request.registry.settings['fonction_admin']): - raise exc.HTTPForbidden() - - settings = request.registry.settings - login_attr = settings['ldap_user_attribute_login'] - op_added = 0 - - # Operateurs from AD - op_ad = Utils.get_nouveaux_operateurs_ad(request) - - # Logins from DB - op_bd_logins = [] - op_bd_logins_query = request.dbsession.query(Operateur).distinct(Operateur.login).filter( - Operateur.login.isnot(None)).all() - for c in op_bd_logins_query: - op_bd_logins.append(c.login.upper()) - - for one_ad_op in op_ad: - one_ad_op_login = one_ad_op[login_attr] if login_attr in one_ad_op else None - - if one_ad_op_login and one_ad_op_login.upper() not in op_bd_logins: - - one_op_model = Operateur( - login=one_ad_op[settings['ldap_user_attribute_login']], - nom=one_ad_op[settings['ldap_user_attribute_lastname']], - prenom=one_ad_op[settings['ldap_user_attribute_firstname']], - entree=func.now()) - - request.dbsession.add(one_op_model) - op_added = op_added + 1 - - if op_added > 0: - save_response = Utils.get_data_save_response(Constant.SUCCESS_SAVE.format(Operateur.__tablename__)) - save_response['count'] = op_added - return save_response - else: - raise exc.HTTPNoContent diff --git a/front/.env b/front/.env index 38687ee9..f377ce53 100644 --- a/front/.env +++ b/front/.env @@ -21,7 +21,6 @@ VUE_APP_CLIENT_MORAL_PERSONNES_ENDPOINT = "/client_moral_personnes" #Operateurs VUE_APP_OPERATEURS_ENDPOINT = "/operateurs" VUE_APP_SEARCH_OPERATEURS_ENDPOINT = "/recherche_operateurs" -VUE_APP_ADD_OPERATEURS_AD_ENDPOINT = "/add_operateurs_ad" #Cadastres VUE_APP_CADASTRES_ENDPOINT = "/cadastres" diff --git a/front/src/components/Operateurs/Operateurs.vue b/front/src/components/Operateurs/Operateurs.vue index 3aceeccb..59457625 100644 --- a/front/src/components/Operateurs/Operateurs.vue +++ b/front/src/components/Operateurs/Operateurs.vue @@ -3,154 +3,260 @@ - diff --git a/front/src/components/Operateurs/operateurs.html b/front/src/components/Operateurs/operateurs.html index e4f8f226..0be5acd3 100644 --- a/front/src/components/Operateurs/operateurs.html +++ b/front/src/components/Operateurs/operateurs.html @@ -1,9 +1,61 @@

Opérateurs

- Importer opérateurs AD + Nouvel opérateur
+
+ + +
{{ divEditUser.title }}
+
+ +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ Responsable +
+
+ Chef·fe d'équipe +
+
+ Annuler + Enregistrer +
+
+
+
+
+ @@ -74,12 +126,15 @@

Opérateurs

{{ item.id }} {{ item.prenom }} {{ item.nom }} - {{ item.login }} - - {{ item.entree }} + {{ item.initiales }} + {{ item.login }} + {{ item.mail }} + {{ item.chef_equipe }} + {{ item.responsable }} + {{ item.entree }} + v-on:click="callEditOperateur(item)"> edit diff --git a/front/src/components/Operateurs/operateursEdit.css b/front/src/components/Operateurs/operateursEdit.css deleted file mode 100644 index 887faefd..00000000 --- a/front/src/components/Operateurs/operateursEdit.css +++ /dev/null @@ -1,15 +0,0 @@ -.operateursEdit { - width: 50%; - margin: auto; -} - -.operateursEdit .md-progress-bar { - position: absolute; - top: 0; - right: 0; - left: 0; -} - -.operateursEdit .md-checkbox { - margin-top: 30px; -} \ No newline at end of file diff --git a/front/src/components/Operateurs/operateursEdit.html b/front/src/components/Operateurs/operateursEdit.html deleted file mode 100644 index 9b81c637..00000000 --- a/front/src/components/Operateurs/operateursEdit.html +++ /dev/null @@ -1,62 +0,0 @@ -
- - -

Opérateur·rice

-
- - - - - -
-
- - - - Le nom est obligatoire - -
- -
- - - - Le prénom est obligatoire - -
-
- - -
-
- - - - -
- -
- Responsable - -
-
- - -
-
- - - -
-
- -
- - - - Annuler - Enregistrer - -
- -
\ No newline at end of file diff --git a/front/src/routes b/front/src/routes index 6ca85667..3005c93d 100644 --- a/front/src/routes +++ b/front/src/routes @@ -5,7 +5,6 @@ import NewAffaire from './components/Affaires/NewAffaire/NewAffaire.vue' import Clients from './components/Clients/Clients.vue' import ClientsEdit from './components/Clients/ClientsEdit.vue' import Operateurs from './components/Operateurs/Operateurs.vue' -import OperateursEdit from './components/Operateurs/OperateursEdit.vue' import Numeros from './components/Numeros/Numeros.vue' import NumerosHistory from './components/Numeros/NumerosHistory.vue' import About from './components/About/About.vue' @@ -21,8 +20,6 @@ const routes = [ { path: '/clients/new', component: ClientsEdit, name: 'ClientsNew' }, { path: '/clients/edit/:id', component: ClientsEdit, name: 'ClientsEdit' }, { path: '/operateurs', component: Operateurs, name: 'Operateurs' }, - { path: '/operateurs/new', component: OperateursEdit, name: 'OperateursNew' }, - { path: '/operateurs/edit/:id', component: OperateursEdit, name: 'OperateursEdit' }, { path: '/login', component: Login, name: 'Login' }, { path: '/numeros', component: Numeros, name: 'Numeros' }, { path: '/numeros/:id', component: NumerosHistory, name: 'NumerosHistory' }, From 41047577d691e60e470cb6eb00c4eec9e4618d8e Mon Sep 17 00:00:00 2001 From: Marc Rufener Date: Wed, 1 Sep 2021 15:12:42 +0200 Subject: [PATCH 2/5] fix emoluments for floating numbers --- back/infolica/models/models.py | 2 +- back/infolica/views/facture_emolument.py | 8 ++++---- .../Affaires/Facturation/Emoluments/Emoluments.vue | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/back/infolica/models/models.py b/back/infolica/models/models.py index a7173816..9e223ecf 100644 --- a/back/infolica/models/models.py +++ b/back/infolica/models/models.py @@ -260,7 +260,7 @@ class Emolument(Base): tableau_emolument_id = Column(BigInteger, primary_key=True) position = Column(Text, primary_key=True) prix_unitaire = Column(Float) - nombre = Column(Integer) + nombre = Column(Float) batiment = Column(Integer, primary_key=True) batiment_f = Column(Float) montant = Column(Float) diff --git a/back/infolica/views/facture_emolument.py b/back/infolica/views/facture_emolument.py index 48e08fc6..91ba49ae 100644 --- a/back/infolica/views/facture_emolument.py +++ b/back/infolica/views/facture_emolument.py @@ -158,7 +158,7 @@ def emolument_new_view(request): tableau_emolument_id=int(batiment_i[emolument_i]['tableau_emolument_id']), position=batiment_i[emolument_i]['nom'], prix_unitaire=float(batiment_i[emolument_i]['prix_unitaire']), - nombre=int(batiment_i[emolument_i]['nombre']), + nombre=float(batiment_i[emolument_i]['nombre']), batiment=int(batiment_i[emolument_i]['batiment']), batiment_f=float(batiment_i[emolument_i]['batiment_f']), montant=float(batiment_i[emolument_i]['montant']) @@ -252,14 +252,14 @@ def update_emolument_view(request): if (not float(record.montant) == float(batiment_i[emolument_i]['montant']) \ or not record.tableau_emolument_id == batiment_i[emolument_i]['tableau_emolument_id'] \ or not record.position == batiment_i[emolument_i]['nom'] \ - or not int(record.nombre) == int(batiment_i[emolument_i]['nombre']) \ + or not float(record.nombre) == float(batiment_i[emolument_i]['nombre']) \ or not float(record.batiment_f) == float(batiment_i[emolument_i]['batiment_f'])): # Mettre à jour les données si le nouveau montant n'est pas nul if float(batiment_i[emolument_i]['montant']) > 0: params = Utils._params( position=batiment_i[emolument_i]['nom'], - nombre=int(batiment_i[emolument_i]['nombre']), + nombre=float(batiment_i[emolument_i]['nombre']), batiment_f=float(batiment_i[emolument_i]['batiment_f']), montant=float(batiment_i[emolument_i]['montant']) ) @@ -276,7 +276,7 @@ def update_emolument_view(request): tableau_emolument_id=int(batiment_i[emolument_i]['tableau_emolument_id']), position=batiment_i[emolument_i]['nom'], prix_unitaire=float(batiment_i[emolument_i]['prix_unitaire']), - nombre=int(batiment_i[emolument_i]['nombre']), + nombre=float(batiment_i[emolument_i]['nombre']), batiment=int(batiment_i[emolument_i]['batiment']), batiment_f=float(batiment_i[emolument_i]['batiment_f']), montant=float(batiment_i[emolument_i]['montant']) diff --git a/front/src/components/Affaires/Facturation/Emoluments/Emoluments.vue b/front/src/components/Affaires/Facturation/Emoluments/Emoluments.vue index 7aa4b5ae..ed5b5d08 100644 --- a/front/src/components/Affaires/Facturation/Emoluments/Emoluments.vue +++ b/front/src/components/Affaires/Facturation/Emoluments/Emoluments.vue @@ -839,7 +839,7 @@ export default { }); } }).catch(err => { - handleException(err, this) + handleException(err, this); // hide progressbar this.showProgressBar = false; this.disabled = false; From e0b501b6451faab9eb57130224556e1981eaa752 Mon Sep 17 00:00:00 2001 From: Marc Rufener Date: Wed, 1 Sep 2021 17:25:21 +0200 Subject: [PATCH 3/5] update cockpit affaire loading and sorting --- front/src/components/Cockpit/Cockpit.vue | 31 +++++++++++++++++++++++ front/src/components/Cockpit/cockpit.html | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/front/src/components/Cockpit/Cockpit.vue b/front/src/components/Cockpit/Cockpit.vue index b2cc2f5f..43f6d7f9 100644 --- a/front/src/components/Cockpit/Cockpit.vue +++ b/front/src/components/Cockpit/Cockpit.vue @@ -25,6 +25,8 @@ export default { affaires_bk: [], affaireEtapes: [], affaireTypes: [], + current_sort: "id", + current_sort_order: "desc", loadingAffaires: true, newAffaireAllowed: false, operateurs: [], @@ -129,6 +131,9 @@ export default { } x.title = (x.no_access? 'Affaire ' + x.id + ' — ': '') + x.cadastre + ' — ' + x.description + " — Dans cette étape depuis " + elapsedTime; }); + + tmp = this.customSort(tmp); + this.affaires_bk = tmp; if (!this.affaires.length > 0) { this.affaires = tmp; @@ -257,6 +262,32 @@ export default { this.operateurs = tmp; } }).catch(err => handleException(err, this)); + }, + + /** + * custom sort + */ + customSort (value) { + return value.sort((a, b) => { + const sortBy = this.current_sort; + + let c = a[sortBy]; + let d = b[sortBy]; + + if (!c) { + return 1; + } + + if (!d) { + return -1; + } + + if (this.current_sort_order === 'asc') { + return String(c).localeCompare(String(d)); + } else { + return String(d).localeCompare(String(c)); + } + }); } }, diff --git a/front/src/components/Cockpit/cockpit.html b/front/src/components/Cockpit/cockpit.html index 06dfd5b4..9f8bffba 100644 --- a/front/src/components/Cockpit/cockpit.html +++ b/front/src/components/Cockpit/cockpit.html @@ -55,7 +55,7 @@

Cockpit

- + From 1a19bcfe016ca12ae9553f6a3337e4a35d52d368 Mon Sep 17 00:00:00 2001 From: Marc Rufener Date: Wed, 1 Sep 2021 17:37:54 +0200 Subject: [PATCH 4/5] add mention urgent into affaire mail --- back/infolica/views/affaire_etape.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/back/infolica/views/affaire_etape.py b/back/infolica/views/affaire_etape.py index 821899bd..cf712e2b 100644 --- a/back/infolica/views/affaire_etape.py +++ b/back/infolica/views/affaire_etape.py @@ -110,7 +110,7 @@ def etapes_new_view(request): ) for i in lastSteps]) affaire_nom = " (" + affaire.no_access + ")" if affaire.no_access is not None else "" - text = "L'affaire " + str(affaire.id) + affaire_nom + " est en attente pour l'étape "+ affaire_etape_index.nom +"." + text = "L'affaire " + str(affaire.id) + affaire_nom + "" + (" (avec mention urgente)" if affaire.urgent else "") + " est en attente pour l'étape "+ affaire_etape_index.nom +"." text += "

Cadastre: " + str(affaire.cadastre) text += "
Description: " + str(affaire.nom) text += ("


Historique de l'affaire

\ @@ -121,7 +121,7 @@ def etapes_new_view(request): Réalisée le\ Remarque\ " + lastSteps + "") if lastSteps != "" else "" - subject = "Infolica - affaire " + str(affaire.id) + subject = "Infolica - affaire " + str(affaire.id) + (" - URGENT" if affaire.urgent else "") send_mail(request, mail_list, "", subject, html=text) return Utils.get_data_save_response(Constant.SUCCESS_SAVE.format(AffaireEtape.__tablename__)) From 20bdf99e7057c40665c9c8a5500fc944e4dd986a Mon Sep 17 00:00:00 2001 From: Marc Rufener Date: Wed, 1 Sep 2021 18:10:55 +0200 Subject: [PATCH 5/5] highlight emoluments --- .../Facturation/Emoluments/emoluments.css | 6 +- .../Facturation/Emoluments/emoluments.html | 304 +++++++++--------- 2 files changed, 157 insertions(+), 153 deletions(-) diff --git a/front/src/components/Affaires/Facturation/Emoluments/emoluments.css b/front/src/components/Affaires/Facturation/Emoluments/emoluments.css index e7b2a54a..6ebcafdb 100644 --- a/front/src/components/Affaires/Facturation/Emoluments/emoluments.css +++ b/front/src/components/Affaires/Facturation/Emoluments/emoluments.css @@ -129,4 +129,8 @@ border-left: 0px !important; border-right: 0px !important; padding-bottom: 10px !important; -} \ No newline at end of file +} + +.highlightEmolument { + background-color: lightgreen; +} diff --git a/front/src/components/Affaires/Facturation/Emoluments/emoluments.html b/front/src/components/Affaires/Facturation/Emoluments/emoluments.html index 95628505..39cfd0fd 100644 --- a/front/src/components/Affaires/Facturation/Emoluments/emoluments.html +++ b/front/src/components/Affaires/Facturation/Emoluments/emoluments.html @@ -172,7 +172,7 @@

Bâtiments

{{ form_detail.mandat1.nom }} {{ form_detail.mandat1.unite }} {{ form_detail.mandat1.prix_unitaire }} CHF - + {{ form_detail.mandat1.montant }} CHF