diff --git a/atlas/atlasRoutes.py b/atlas/atlasRoutes.py index 21b95163d..621a7c51e 100644 --- a/atlas/atlasRoutes.py +++ b/atlas/atlasRoutes.py @@ -31,6 +31,7 @@ vmMedias, vmCorTaxonAttribut, vmTaxonsMostView, + vmStatutBdcRepository, ) diff --git a/atlas/configuration/config.py.example b/atlas/configuration/config.py.example index 88c2e0c29..d2a938ba2 100644 --- a/atlas/configuration/config.py.example +++ b/atlas/configuration/config.py.example @@ -268,6 +268,15 @@ STATIC_PAGES = { 'presentation': {'title': "Présentation de l'atlas", 'picto': 'fa-question-circle', 'order': 0, 'template': 'static/custom/templates/presentation.html'} } +########################### +########################### +######### STATUTS ######### +########################### +########################### + +LIST_STATUS = ['LRE', 'LRN', 'LRR'] +GEO_STATUS = ['France', 'France métropolitaine'] + ########################### ########################### #### Security Config ##### diff --git a/atlas/configuration/config.py.sample b/atlas/configuration/config.py.sample index f09b77084..82e8eb4f5 100644 --- a/atlas/configuration/config.py.sample +++ b/atlas/configuration/config.py.sample @@ -96,6 +96,15 @@ MAP = { 'ENABLE_SLIDER': True } +########################### +########################### +######### STATUTS ######### +########################### +########################### + +LIST_STATUS = ['LRE', 'LRN', 'LRR'] +GEO_STATUS = ['France', 'France métropolitaine'] + ########################### ########################### #### Security Config ##### diff --git a/atlas/configuration/config_schema.py b/atlas/configuration/config_schema.py index 068944a7a..7e0170298 100644 --- a/atlas/configuration/config_schema.py +++ b/atlas/configuration/config_schema.py @@ -204,6 +204,7 @@ class Meta: SPLIT_NOM_VERN = fields.Boolean(load_default=True) INTERACTIVE_MAP_LIST = fields.Boolean(load_default=True) AVAILABLE_LANGUAGES = fields.Dict(load_default=LANGUAGES) + STATUS_BDC_ENABLE = fields.Boolean(load_default=True) # Flask parameter enabling auto reload of templates # (no need to restart the atlas service when updating templates) # Defaults to False to have the best performance in production diff --git a/atlas/modeles/entities/vmStatutBdc.py b/atlas/modeles/entities/vmStatutBdc.py new file mode 100644 index 000000000..5e4167cab --- /dev/null +++ b/atlas/modeles/entities/vmStatutBdc.py @@ -0,0 +1,20 @@ +# -*- coding:utf-8 -*- + +from sqlalchemy import Column, Integer, MetaData, String, Table, Float +from sqlalchemy.ext.declarative import declarative_base + +from atlas.utils import engine + +Base = declarative_base() +metadata = MetaData() + +class VmStatutBdc(Base): + __table__ = Table( + 'vm_taxons', metadata, + Column('cd_ref', Integer), + Column('code_statut', String(50)), + Column('label_statut', String(250)), + Column('cd_type_statut', String(50)), + Column('lb_type_statut', String(250)), + schema='atlas', autoload=True, autoload_with=engine + ) diff --git a/atlas/modeles/repositories/vmStatutBdcRepository.py b/atlas/modeles/repositories/vmStatutBdcRepository.py new file mode 100644 index 000000000..f0530b086 --- /dev/null +++ b/atlas/modeles/repositories/vmStatutBdcRepository.py @@ -0,0 +1,24 @@ +from flask import current_app +from sqlalchemy.sql import text + +from atlas.modeles import utils + +def fctSortDict(value): + return value['cd_type_statut'] + +def getTaxonsStatutBdc(connection, cd_ref): + sql="SELECT * FROM atlas.vm_statut_bdc WHERE cd_ref = :thiscdref" + req = connection.execute(text(sql), thiscdref=cd_ref) + tsb = list() + for r in req: + temp = { + 'code_statut':r.code_statut, + 'label_statut':r.label_statut, + 'cd_type_statut':r.cd_type_statut, + 'lb_type_statut':r.lb_type_statut, + 'lb_adm_tr':r.lb_adm_tr + } + tsb.append(temp) + taxonStatutBdc = sorted(tsb, key=fctSortDict) + + return taxonStatutBdc diff --git a/atlas/static/css/ficheEspece.css b/atlas/static/css/ficheEspece.css index 554cf640d..13370665f 100644 --- a/atlas/static/css/ficheEspece.css +++ b/atlas/static/css/ficheEspece.css @@ -284,3 +284,78 @@ text { .carousel-indicators { bottom: 0px; } + +#statut-bdc { + margin-top: 15px; + padding-top : 10px; + padding-bottom : 10px; +} + +div#statut-bdc span.NT { + color: white; + background-color: #cce226 ; +} + +div#statut-bdc span.LC { + color: white; + background-color: #60c659 ; +} + +div#statut-bdc span.EN { + color: white; + background-color: #fc7f3f ; +} + +div#statut-bdc span.VU { + background-color: #f9e814 ; +} + +div#statut-bdc span.CR { + color: white; + background-color: #d81e05 ; +} + +div#statut-bdc span.RE { + color: white; + background-color: #5b1064 ; +} + +div#statut-bdc span.NA { + color: white; + background-color: #929392 ; +} + +div#statut-bdc span.NE { + background-color: white ; +} + +div#statut-bdc span.DD { + background-color: #d1d1c6 ; +} + +div#statut-bdc span.DHFF { + color: white; + background-color: #afdde9 ; +} + +div#statut-bdc span.PN { + color: white; + background-color: #ffccaa ; +} + +div#statut-bdc span.bloc-statut-bdc { + /*border: 1px solid grey; + padding: 5px;*/ + padding-left: 5px; + padding-right: 5px; + border-radius: 25%; + +} + +div#statut-bdc span { + border-radius: 10%; +} + +div#statut-bdc span.bloc-sbdc-new { + margin-left: 15px; +} diff --git a/atlas/templates/speciesSheet/identityCard.html b/atlas/templates/speciesSheet/identityCard.html index 9d7c4d273..efa923db0 100644 --- a/atlas/templates/speciesSheet/identityCard.html +++ b/atlas/templates/speciesSheet/identityCard.html @@ -91,6 +91,43 @@