diff --git a/.gitignore b/.gitignore index b24d71e..99d8e6c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,50 +1,6 @@ -# These are some examples of commonly ignored file patterns. -# You should customize this list as applicable to your project. -# Learn more about .gitignore: -# https://www.atlassian.com/git/tutorials/saving-changes/gitignore - -# Node artifact files -node_modules/ -dist/ - -# Compiled Java class files -*.class - -# Compiled Python bytecode -*.py[cod] - -# Log files +# Fichiers temporaires # +######################## +*~ +*.pyc +*.pid *.log - -# Package files -*.jar - -# Maven -target/ -dist/ - -# JetBrains IDE -.idea/ - -# Unit test reports -TEST*.xml - -# Generated by MacOS -.DS_Store - -# Generated by Windows -Thumbs.db - -# Applications -*.app -*.exe -*.war - -# Large media files -*.mp4 -*.tiff -*.avi -*.flv -*.mov -*.wmv - diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..14de6fb --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,22 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python : application Pyramid", + "type": "python", + "request": "launch", + "python": "C:/pyramid/Scripts/python.exe", + "program": "/pyramid/Scripts/pserve.exe", + "args": [ + "-v", + "development.ini", + "--reload" + ], + "pyramid": true, + "chameleon": true + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ee31d6a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "html.validate.scripts": false, + "editor.minimap.enabled": false, + "python.pythonPath": "C:\\pyramid10\\Scripts\\python.exe" +} \ No newline at end of file diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..35a34f3 --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1,4 @@ +0.0 +--- + +- Initial version diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..1e226e9 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include *.txt *.ini *.cfg *.rst +recursive-include monaem *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml diff --git a/README.md b/README.md new file mode 100644 index 0000000..0f75129 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# README # + +Cette application web permet aux collaborateurs de l'auto-école Marietton : + + - de consulter et de gérer les planning des élèves depuis leur tablette + - de consulter les fiches élèves + - de consulter les examens + - de gérer les prospects et les devis pro + +Elle est développée avec les composants open source suivants : + +## Backend + +- [Python](https://www.python.org/downloads/) 3.7 +- [Pyramid web framework](https://trypyramid.com/) 1.10 +- [MySQL server](https://mysql.com/) 5.7 sur Windows Server 2008 R2 Entreprise +- [Apache web server](https://apache.org/) 2.4 sur Debian GNU/Linux 9 (stretch) + +## Frontend + +- [Bootstrap framework](https://getbootstrap.com/) for CSS 3.3.7 +- [Jquery](https://jquery.com/download/) for JavaScript 3.4.1 +- Chameleon templates +- [FormValidation](https://formvalidation.io/) form validator 0.7.0 + +## Jquery Plugins + +- [DataTables](https://datatables.net/) 1.10.20 +- [Fullcalendar](https://fullcalendar.io/) 3.9.0 +- [Fullcalendar Scheduler](https://fullcalendar.io/) 1.9.4 +- [Jquery-ui et jquery-ui-themes](https://jqueryui.com/) 1.12.1 +- [less.js](http://lesscss.org/) 3.11.1 +- [moment.js](https://momentjs.com/) with-locales.min.js + + +[Learn Markdown](https://bitbucket.org/tutorials/markdowndemo) + diff --git a/aem_gestion.egg-info/PKG-INFO b/aem_gestion.egg-info/PKG-INFO new file mode 100644 index 0000000..5744678 --- /dev/null +++ b/aem_gestion.egg-info/PKG-INFO @@ -0,0 +1,58 @@ +Metadata-Version: 1.1 +Name: aem-gestion +Version: 1.0 +Summary: aem_gestion +Home-page: UNKNOWN +Author: UNKNOWN +Author-email: UNKNOWN +License: UNKNOWN +Description: # README # + + Cette application web permet aux collaborateurs de l'auto-école Marietton : + + - de consulter et de gérer les planning des élèves depuis leur tablette + - de consulter les fiches élèves + - de consulter les examens + - de gérer les prospects et les devis pro + + Elle est développée avec les composants open source suivants : + + ## Backend + + - [Python](https://www.python.org/downloads/) 3.7 + - [Pyramid web framework](https://trypyramid.com/) 1.10 + - [MySQL server](https://mysql.com/) 5.7 sur Windows Server 2008 R2 Entreprise + - [Apache web server](https://apache.org/) 2.4 sur Debian GNU/Linux 9 (stretch) + + ## Frontend + + - [Bootstrap framework](https://getbootstrap.com/) for CSS 3.3.7 + - [Jquery](https://jquery.com/download/) for JavaScript 3.4.1 + - Chameleon templates + - [FormValidation](https://formvalidation.io/) form validator 0.7.0 + + ## Jquery Plugins + + - [DataTables](https://datatables.net/) 1.10.20 + - [Fullcalendar](https://fullcalendar.io/) 3.9.0 + - [Fullcalendar Scheduler](https://fullcalendar.io/) 1.9.4 + - [Jquery-ui et jquery-ui-themes](https://jqueryui.com/) 1.12.1 + - [less.js](http://lesscss.org/) 3.11.1 + - [moment.js](https://momentjs.com/) with-locales.min.js + + + [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo) + + + + 0.0 + --- + + - Initial version + +Keywords: web wsgi bfg pylons pyramid +Platform: UNKNOWN +Classifier: Programming Language :: Python +Classifier: Framework :: Pyramid +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application diff --git a/aem_gestion.egg-info/SOURCES.txt b/aem_gestion.egg-info/SOURCES.txt new file mode 100644 index 0000000..8f27bf8 --- /dev/null +++ b/aem_gestion.egg-info/SOURCES.txt @@ -0,0 +1,34 @@ +CHANGES.txt +MANIFEST.in +README.md +development.ini +production.ini +setup.py +aem_gestion/__init__.py +aem_gestion/layout.py +aem_gestion/panels.py +aem_gestion/routes.py +aem_gestion/security.py +aem_gestion.egg-info/PKG-INFO +aem_gestion.egg-info/SOURCES.txt +aem_gestion.egg-info/dependency_links.txt +aem_gestion.egg-info/entry_points.txt +aem_gestion.egg-info/not-zip-safe +aem_gestion.egg-info/requires.txt +aem_gestion.egg-info/top_level.txt +aem_gestion/models/__init__.py +aem_gestion/models/crm.py +aem_gestion/models/default.py +aem_gestion/models/eleves.py +aem_gestion/models/examens.py +aem_gestion/models/parametres.py +aem_gestion/models/planning.py +aem_gestion/scripts/__init__.py +aem_gestion/views/__init__.py +aem_gestion/views/crm.py +aem_gestion/views/default.py +aem_gestion/views/eleves.py +aem_gestion/views/examens.py +aem_gestion/views/notfound.py +aem_gestion/views/parametres.py +aem_gestion/views/planning.py \ No newline at end of file diff --git a/aem_gestion.egg-info/dependency_links.txt b/aem_gestion.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/aem_gestion.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/aem_gestion.egg-info/entry_points.txt b/aem_gestion.egg-info/entry_points.txt new file mode 100644 index 0000000..ace53f1 --- /dev/null +++ b/aem_gestion.egg-info/entry_points.txt @@ -0,0 +1,4 @@ + [paste.app_factory] + main = aem_gestion:main + [console_scripts] + \ No newline at end of file diff --git a/aem_gestion.egg-info/not-zip-safe b/aem_gestion.egg-info/not-zip-safe new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/aem_gestion.egg-info/not-zip-safe @@ -0,0 +1 @@ + diff --git a/aem_gestion.egg-info/requires.txt b/aem_gestion.egg-info/requires.txt new file mode 100644 index 0000000..605dc4d --- /dev/null +++ b/aem_gestion.egg-info/requires.txt @@ -0,0 +1,16 @@ +pyramid +SQLAlchemy==1.2.19 +transaction +pyramid_chameleon +pyramid_debugtoolbar +pyramid_layout +pyramid_mailer +pyramid_tm +zope.sqlalchemy +waitress +docutils +jours_feries_france +mysqlclient +python-dateutil +zeep +user-agents diff --git a/aem_gestion.egg-info/top_level.txt b/aem_gestion.egg-info/top_level.txt new file mode 100644 index 0000000..582cd85 --- /dev/null +++ b/aem_gestion.egg-info/top_level.txt @@ -0,0 +1 @@ +aem_gestion diff --git a/aem_gestion/__init__.py b/aem_gestion/__init__.py new file mode 100644 index 0000000..00de0b8 --- /dev/null +++ b/aem_gestion/__init__.py @@ -0,0 +1,29 @@ +from pyramid.authentication import AuthTktAuthenticationPolicy +from pyramid.authorization import ACLAuthorizationPolicy +from pyramid.config import Configurator +from pyramid_mailer import mailer_factory_from_settings +from pyramid.session import SignedCookieSessionFactory + +from .security import groupfinder + +def main(global_config, **settings): + """ This function returns a Pyramid WSGI application. + """ + # declartions + session_factory = SignedCookieSessionFactory('eprXAQtL9e') + authn_policy = AuthTktAuthenticationPolicy('HZYwDrIF3M', callback=groupfinder, hashalg='sha512', timeout=36000) + authz_policy = ACLAuthorizationPolicy() + + config = Configurator(settings=settings, + root_factory='aem_gestion.models.RootFactory') + config.include('.models') + config.include('.routes') + + # configurations + config.set_session_factory(session_factory) + config.set_authentication_policy(authn_policy) + config.set_authorization_policy(authz_policy) + + config.scan() + return config.make_wsgi_app() + diff --git a/aem_gestion/layout.py b/aem_gestion/layout.py new file mode 100644 index 0000000..51fefad --- /dev/null +++ b/aem_gestion/layout.py @@ -0,0 +1,52 @@ +# -*- coding: utf8 -*- +from pyramid_layout.layout import layout_config +from .security import groupfinder +from .views.default import ( + to_euro, + to_euroz, + to_percent, + ) + +@layout_config(template='aem_gestion:templates/global_layout.pt') +class GlobalLayout(object): + page_title = "Mon espace MARIETTON" + + def __init__(self, context, request): + self.context = context + self.request = request + self.home_url = request.application_url + + def date2dmy(self, ddate): + if ddate: + # si date, convertir en dd-mm-yyyy + madate = ddate.strftime('%d-%m-%Y') + else: + madate = '' + return madate + + def to_euro(self, x): + return to_euro(x) + + def to_euroz(self, x): + return to_euroz(x) + + def to_percent(self, x): + return to_percent(x) + + def get_nextPayment(self, dossier): + return get_nextPayment(dossier) + + def isAnonymous(self): + user = self.request.authenticated_userid + return user is None + + def isAdmin(self): + logged_in = self.request.authenticated_userid + is_admin = False + if logged_in is not None: + groups = groupfinder(logged_in, self.request) + if 'group:administrators' in groups: + is_admin = True + + return is_admin + diff --git a/aem_gestion/models/__init__.py b/aem_gestion/models/__init__.py new file mode 100644 index 0000000..34408d9 --- /dev/null +++ b/aem_gestion/models/__init__.py @@ -0,0 +1,82 @@ +from sqlalchemy import engine_from_config +from sqlalchemy.orm import sessionmaker +from sqlalchemy.orm import configure_mappers +import zope.sqlalchemy + +from pyramid.security import ( + Allow, + Authenticated, + DENY_ALL, + ) + +# run configure_mappers after defining all of the models to ensure +# all relationships can be setup +configure_mappers() + +class RootFactory(object): + """Defines an ACL for groups/permissions mapping""" + __acl__ = [ (Allow, Authenticated, 'view'), + (Allow, 'group:administrators', 'manage'), + DENY_ALL, + ] + def __init__(self, request): + pass + + +def get_engine(settings, prefix='sqlalchemy.'): + return engine_from_config(settings, prefix) + +def get_session_factory(engine): + factory = sessionmaker() + factory.configure(bind=engine) + return factory + +def get_tm_session(session_factory, transaction_manager): + """ + Get a ``sqlalchemy.orm.Session`` instance backed by a transaction. + + This function will hook the session to the transaction manager which + will take care of committing any changes. + + - When using pyramid_tm it will automatically be committed or aborted + depending on whether an exception is raised. + + - When using scripts you should wrap the session in a manager yourself. + For example:: + + import transaction + + engine = get_engine(settings) + session_factory = get_session_factory(engine) + with transaction.manager: + dbsession = get_tm_session(session_factory, transaction.manager) + + """ + dbsession = session_factory() + zope.sqlalchemy.register( + dbsession, transaction_manager=transaction_manager) + return dbsession + + +def includeme(config): + """ + Initialize the model for a Pyramid app. + + Activate this setup using ``config.include('td_members.models')``. + + """ + settings = config.get_settings() + + # use pyramid_tm to hook the transaction lifecycle to the request + config.include('pyramid_tm') + + session_factory = get_session_factory(get_engine(settings)) + config.registry['dbsession_factory'] = session_factory + + # make request.dbsession available for use in Pyramid + config.add_request_method( + # r.tm is the transaction manager used by pyramid_tm + lambda r: get_tm_session(session_factory, r.tm), + 'dbsession', + reify=True + ) diff --git a/aem_gestion/models/compta.py b/aem_gestion/models/compta.py new file mode 100644 index 0000000..fa97816 --- /dev/null +++ b/aem_gestion/models/compta.py @@ -0,0 +1,360 @@ +# -*- coding: utf8 -*- +from .default import ( + execute_query, +) + +def generer_brouillard(request, logged_in, date_fin): + """ Générer le brouillard jusqu'à la date de fin + + PHASE 1 : + - Lire les comptes clients valorisés dans la période + - Cumuler les écritures de réglement et de ventes par TVA et Agences dans T_ECRITURES + + PHASE 2 : + - remplir le libellé pour des comptes de ventes + + PHASE 3 : + - Générer les écritures dans T_SYBEL" + """ + message = "" + mtTVA_encaisse = 0 + + # RAZ la table T_SYBEL pour extraire les écritures comptable + delete_t_sybel(request, logged_in) + + # lire la societe CERRA pour mémoriser ses paramètres + query = "CALL spGet_SOCIETES('C');" + soc = request.dbsession.execute(query).first() + szCompteAux = soc.CPTE_AUX + szCompteTVA = soc.CPTE_TVA + szJournalVente = soc.JNL_VTE + + query = """SELECT c.*, t.taux as TTVA, a.JNL_BNQ, a.CPT_BNQ, a.CENTRE FROM eleves_cpt c + INNER JOIN p_tva t ON c.ctva = t.code + INNER JOIN p_agences a ON c.agence = a.code + WHERE c.exporte_le IS NULL AND c.date_valeur <= :date_fin AND societe='C' AND cd_cli > 100000 + AND c.credit + c.mtval <> 0 ORDER BY c.date_valeur""" + ecritures = request.dbsession.execute(query, {'date_fin': date_fin.strftime("%Y-%m-%d")}).fetchall() + + for ecr in ecritures: + # contrôler la date de valeur : ne doit pas être en dehors du mois sélectionné + dateValeur = ecr.DATE_VALEUR + if dateValeur.month != date_fin.month : + message = "Une écriture du %s de %s - %s est hors des limites de l'export. Impossible de continuer." % \ + (dateValeur.strftime("%d-%m-%Y"), ecr.CD_CLI, ecr.NOM) + return message + + # origine de l'élève + nOrigine = str(ecr.CD_CLI)[0:1] + sDateValeur = dateValeur.strftime("%Y-%m-%d") + + # écriture de réglement + if ecr.MODE_REGL > 0: + # règlement ESP, CHQ, CB, CBW ? + # import pdb;pdb.set_trace() + if ecr.MODE_REGL <= 4: + query = "CALL spUPD_T_ECRITURES(:logged_in, 'BNQ_D', :agence, :mode_regl,0, :date_valeur, :credit);" + execute_query(request, query, {'logged_in': logged_in, 'agence': ecr.AGENCE, 'mode_regl': ecr.MODE_REGL, + 'date_valeur': sDateValeur, 'credit': ecr.CREDIT}) + # TVA exo + # query = "CALL spUPD_T_ECRITURES(:logged_in, 'BNQ_C', :agence, 0, :origine, :date_valeur, :credit);" + # execute_query(request, query, {'logged_in': logged_in, 'agence': ecr.AGENCE, 'origine': nOrigine, + # 'date_valeur': sDateValeur, 'credit': ecr.MT2}) + + # TVA 1 + query = "CALL spUPD_T_ECRITURES(:logged_in, 'BNQ_C', :agence, 1, :origine, :date_valeur, :credit);" + execute_query(request, query, {'logged_in': logged_in, 'agence': ecr.AGENCE, 'origine': nOrigine, + 'date_valeur': sDateValeur, 'credit': ecr.MT3}) + # TVA 2 + query = "CALL spUPD_T_ECRITURES(:logged_in, 'BNQ_C', :agence, 2, :origine, :date_valeur, :credit);" + execute_query(request, query, {'logged_in': logged_in, 'agence': ecr.AGENCE, 'origine': nOrigine, + 'date_valeur': sDateValeur, 'credit': ecr.MT1}) + + # Mode=5 : Prêt 1 € ? + if ecr.MODE_REGL == 5: + query = "CALL spINS_T_SYBEL(:logged_in, 'C', '13', :date_valeur, :compte, :centre, :lib, :credit, 'C', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'date_valeur': sDateValeur, 'compte': '411000', + 'centre': 'CNORM' + nOrigine, 'lib': ecr.INTITULE[:25], 'credit': ecr.CREDIT, 'ref': 'VIRT' + str(ecr.CD_CLI)}) + query = "CALL spINS_T_SYBEL(:logged_in, 'C', '13', :date_valeur, :compte, :centre, :lib, :credit, 'D', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'date_valeur': sDateValeur, 'compte': '512200', + 'centre': 'CNORM' + nOrigine, 'lib': ecr.INTITULE[:25], 'credit': ecr.CREDIT, 'ref': 'VIRT' + str(ecr.CD_CLI)}) + + # Mode=6 : virement compte à compte ? + if ecr.MODE_REGL == 6: + query = "CALL spINS_T_SYBEL(:logged_in, 'C', '12', :date_valeur, :compte, :centre, :lib, :credit, 'C', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'date_valeur': sDateValeur, 'compte': '411000', + 'centre': 'CNORM' + nOrigine, 'lib': ecr.INTITULE[:25], 'credit': ecr.CREDIT, 'ref': 'VIRT' + str(ecr.CD_CLI)}) + query = "CALL spINS_T_SYBEL(:logged_in, 'C', '12', :date_valeur, :compte, :centre, :lib, :credit, 'D', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'date_valeur': sDateValeur, 'compte': '581000', + 'centre': 'CNORM' + nOrigine, 'lib': ecr.INTITULE[:25], 'credit': ecr.CREDIT, 'ref': 'VIRT' + str(ecr.CD_CLI)}) + # Mode=7 : virement ? + if ecr.MODE_REGL == 7: + query = "CALL spINS_T_SYBEL(:logged_in, 'C', '10', :date_valeur, :compte, :centre, :lib, :credit, 'C', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'date_valeur': sDateValeur, 'compte': '411000', + 'centre': 'CNORM' + nOrigine, 'lib': ecr.INTITULE[:25], 'credit': ecr.CREDIT, 'ref': 'VIRT' + str(ecr.CD_CLI)}) + query = "CALL spINS_T_SYBEL(:logged_in, 'C', '10', :date_valeur, :compte, :centre, :lib, :credit, 'D', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'date_valeur': sDateValeur, 'compte': '512000', + 'centre': 'CNORM' + nOrigine, 'lib': ecr.INTITULE[:25], 'credit': ecr.CREDIT, 'ref': 'VIRT' + str(ecr.CD_CLI)}) + # Mode=8 : remboursement ? + if ecr.MODE_REGL == 8: + query = "CALL spINS_T_SYBEL(:logged_in, 'C', '13', :date_valeur, :compte, :centre, :lib, :credit, 'C', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'date_valeur': sDateValeur, 'compte': '411000', + 'centre': 'CNORM' + nOrigine, 'lib':'REMBOURSEMENT ' + ecr.NOM[:11], 'credit': ecr.CREDIT, 'ref': 'REMB' + str(ecr.CD_CLI)}) + query = "CALL spINS_T_SYBEL(:logged_in, 'C', '13', :date_valeur, :compte, :centre, :lib, :credit, 'D', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'date_valeur': sDateValeur, 'compte': '512000', + 'centre': 'CNORM' + nOrigine, 'lib': 'REMBOURSEMENT ' + ecr.NOM[:11], 'credit': ecr.CREDIT, 'ref': 'REMB' + str(ecr.CD_CLI)}) + # Mode=9 : impayés ? + if ecr.MODE_REGL == 9: + query = "CALL spINS_T_SYBEL(:logged_in, 'C', :jnl_bnq, :date_valeur, :compte, :centre, :lib, :credit, 'C', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'jnl_bnq': ecr.JNL_BNQ, 'date_valeur': sDateValeur, 'compte': '411000', + 'centre': 'CNORM' + nOrigine, 'lib': 'IMPAYE ' + ecr.NOM[:18], 'credit': ecr.CREDIT, 'ref': 'IMPA' + str(ecr.CD_CLI)}) + query = "CALL spINS_T_SYBEL(:logged_in, 'C', :jnl_bnq, :date_valeur, :compte, :centre, :lib, :credit, 'D', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'jnl_bnq': ecr.JNL_BNQ, 'date_valeur': sDateValeur, 'compte': ecr.CPT_BNQ, + 'centre': 'CNORM' + nOrigine, 'lib': 'IMPAYE ' + ecr.NOM[:18], 'credit': ecr.CREDIT, 'ref': 'IMPA' + str(ecr.CD_CLI)}) + + else: + # === cumuler les ecritures de VENTES si no compte saisi + if ecr.COMPTE: + # import pdb;pdb.set_trace() + # cumuler ecriture de vente + query = "CALL spUPD_T_ECRITURES(:logged_in, 'VTE_D', :origine, :ctva, 0, :date_valeur, :mtval);" + execute_query(request, query, {'logged_in': logged_in, 'origine': nOrigine, 'ctva': ecr.CTVA, + 'date_valeur': date_fin.strftime("%Y-%m-%d"), 'mtval': ecr.MTVAL}) + # compte déja crée ? + query = "CALL spGET_T_SYBEL(:logged_in,'C', :vte, :date_fin, :compte, :centre);" + item = request.dbsession.execute(query, {'logged_in': logged_in, 'vte': szJournalVente, 'date_fin': date_fin.strftime("%Y-%m-%d"), + 'compte': ecr.COMPTE, 'centre': ecr.CENTRE}).first() + if item: + OldMontant = item.MONTANT + else: + # non, creer + query = "CALL spINS_T_SYBEL(:logged_in, 'C', :jnl, :date_valeur, :compte, :centre, :lib, :credit, 'C', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'jnl': szJournalVente, 'date_valeur': date_fin.strftime("%Y-%m-%d"), + 'compte': ecr.COMPTE, 'centre': ecr.CENTRE, 'lib': ecr.INTITULE[:25], 'credit': 0, 'ref': 'AEM-' + date_fin.strftime("%d%m%y")}) + + OldMontant = 0 + + # cumuler le montant HT et cumuler le total TVA + mtHT = round(ecr.MTVAL / (1 + (ecr.TTVA / 100)), 2) + mtTVA_encaisse += ecr.MTVAL- mtHT + + query = "CALL spUPD_T_SYBEL(:logged_in, 'C', :jnl, :date_valeur, :compte, :centre, :credit);" + execute_query(request, query, {'logged_in': logged_in, 'jnl': szJournalVente, 'date_valeur': date_fin.strftime("%Y-%m-%d"), + 'compte': ecr.COMPTE, 'centre': ecr.CENTRE, 'credit': OldMontant + mtHT}) + + # PHASE 2 : + # - remplir le libellé pour des comptes de ventes + + query = "UPDATE t_sybel INNER JOIN p_comptes c ON t_sybel.compte = c.code SET t_sybel.libelle = c.libelle WHERE t_sybel.compte > 700000;" + execute_query(request, query, {}) + + # remplir le libellé pour le type 'BNQ_D' + query = """UPDATE t_ecritures t INNER JOIN P_AGENCES a ON t.agence = a.code INNER JOIN P_MODE_REGL m ON t.code1 = m.code + SET t.libelle = CONCAT('REM ', m.lib4, ' Ag:', t.agence), t.compte = a.cpt_bnq, t.journal=a.jnl_bnq + WHERE user = :logged_in AND t.type='BNQ_D';""" + execute_query(request, query, {'logged_in': logged_in}) + + # import pdb; pdb.set_trace() + # remplir le libellé pour le type 'BNQ_C' + query = """UPDATE t_ecritures t INNER JOIN P_AGENCES a ON t.agence = a.code INNER JOIN P_TVA m ON t.code1 = m.code + SET t.libelle = CONCAT('REGLEM ', m.lib4, ' Ag:', t.agence), t.compte = CONCAT('C',m.lib4,t.code2), t.journal=a.jnl_bnq + WHERE user = :logged_in AND t.type='BNQ_C'; """ + execute_query(request, query, {'logged_in': logged_in}) + + # remplir le libellé pour le type 'VTE_D' + query = """UPDATE t_ecritures t INNER JOIN P_AGENCES a ON t.agence = a.code INNER JOIN P_TVA m ON t.code1 = m.code + SET t.libelle = CONCAT('VENTE ', m.lib4, ' Ag:', t.agence), t.compte = CONCAT('C',m.lib4,t.agence), t.journal=a.jnl_bnq + WHERE user = :logged_in AND t.type='VTE_D';""" + execute_query(request, query, {'logged_in': logged_in}) + + # PHASE 3 : + + # - Générer les écritures dans T_SYBEL" + query = "CALL spGEN_T_SYBEL(:logged_in, 'C', :jnl, :compte, :ref);" + execute_query(request, query, {'logged_in': logged_in, 'jnl': szJournalVente, 'compte': szCompteAux, 'ref': 'AEM-' + date_fin.strftime("%d%m%y")}) + + # - Générer la ligne TVA ENCAISSE + query = "CALL spINS_T_SYBEL(:logged_in, 'C', :jnl, :date_valeur, :compte, '', 'TVA COLLECTE', :credit, 'C', :ref);" + execute_query(request, query, {'logged_in': logged_in, 'jnl': szJournalVente, 'date_valeur': date_fin.strftime("%Y-%m-%d"), 'compte': szCompteTVA, + 'credit': mtTVA_encaisse, 'ref': 'AEM-' + date_fin.strftime("%d%m%y")}) + + return message + +def get_brouillard(request, logged_in): + query = "SELECT * FROM t_sybel WHERE user=:logged_in ORDER BY journal, date, compte, centre;"; + results = request.dbsession.execute(query, {'logged_in': logged_in}) + return results.fetchall() + +def generer_export(request, logged_in, path_fichier): + + # ouvrir le fichier export compta, encodage ANSI + fichier = open(path_fichier, mode="w", newline='\r\n', encoding="cp1252") + + # ecrire la ligne d'entete + fichier.write("CERRA MARIETTON" + '\n') + + # Lire les écritures extraites + ecritures = get_brouillard(request, logged_in) + for ecr in ecritures: + # si montant < 0, le rendre positif et inverser le sens + montant = ecr.MONTANT + sens = ecr.SENS + if montant < 0: + montant *= -1 + if sens == "C": + sens = "D" + else: + sens = "C" + + # nouvelle ligne, longueur = 104 charactères + ligne1 = '' + # code Journal (3 car.) + ligne1 += ecr.JOURNAL.ljust(3) + # date de pièce (format jjmmaa) + ligne1 += ecr.DATE.strftime("%d%m%y") + # type de pièce (2 car.) + ligne1 += "OD" + # compte général (13 caractères) + ligne1 += ecr.COMPTE.ljust(13) + # compte auxilliare ou analytique + if len(ecr.CENTRE) > 0: + # compte auxilliaire ? + if ecr.COMPTE[:3] == "411": + ligne1 += "X" + ecr.CENTRE.ljust(13) + else: + ligne1 += " "*14 + else: + ligne1 += " "*14 + # Référence de l'écriture (13 caractères vides) + ligne1 += ecr.REFERENCE.ljust(13) + # libelle (25 caractères) + ligne1 += ecr.LIBELLE.ljust(26) + # date echeance (format jj/mm/aa) + ligne1 += ecr.DATE.strftime("%d%m%y") + # sens : D=Débit, C=Crédit) + ligne1 += sens + # montant (20 caractères) + szmontant = "%0.2f" % montant + ligne1 += szmontant.rjust(20) + # centre anal. et compte non auxilliaire ? + if len(ecr.CENTRE) > 0 and ecr.COMPTE[:3] != "411": + # écrire la ligne generale + fichier.write(ligne1 + 'N\n') + # puis préparer la ligne analytique + ligne1 = ligne1[0:24] + "A" + ecr.CENTRE.ljust(13) + ligne1[38:] + # ecrire la ligne 1 + fichier.write(ligne1 + 'N\n') + + fichier.close() + return + +def update_cpt_export(request, date_fin): + # marquer les lignes de compte exportées + query = """UPDATE eleves_cpt SET modif_le=modif_le, exporte_le = CURRENT_DATE() + WHERE exporte_le IS NULL AND date_valeur <= :date_fin AND cd_cli > 100000 AND credit + mtval <> 0;""" + execute_query(request, query, {'date_fin': date_fin.strftime("%Y-%m-%d")}) + +def delete_t_sybel(request, userid): + """supprimer le fichier extraction""" + query = "CALL spDel_T_SYBEL(:userid);" + execute_query(request, query, {'userid': userid}) + +def get_caisse(request, agence, date): + query = """SELECT c.*, e.permis_demande, CONCAT(m.code,'-',m.lib4) AS lib4 FROM eleves_cpt c + INNER JOIN eleves e ON c.cd_cli = e.cd_cli + INNER JOIN p_mode_regl m ON c.mode_regl = m.code + WHERE c.agence=:agence AND c.date=:date AND c.credit <> 0 ORDER BY c.mode_regl, c.cd_cli;""" + results = request.dbsession.execute(query, {'agence': agence, 'date': date.strftime('%Y-%m-%d')}).fetchall() + return results + +def update_contrats_auto(request, agence, logged_in): + query = "CALL spUpd_SOLDER_CONTRAT_B(:agence, :logged_in);" + results = request.dbsession.execute(query, {'agence': agence, 'logged_in': logged_in}) + return results.first() + +def update_contrats_moto(request, agence, logged_in): + query = "CALL spUpd_SOLDER_CONTRAT_2R(:agence, :logged_in);" + results = request.dbsession.execute(query, {'agence': agence, 'logged_in': logged_in}) + return results.first() + +def generer_balance(request, logged_in, permis, date_debut, date_fin): + # Générer la balance CLIENTS + + # Noter date heure du début et critères de la génération + criteres = permis + ', du ' + date_debut.strftime('%d-%m-%Y') + ' au ' + date_fin.strftime('%d-%m-%Y') + query = "UPDATE societes SET balance_debut=NOW(), balance_fin=NULL, balance_criteres=:criteres WHERE CODE = 'C';" + execute_query(request, query, {'criteres': criteres}) + + # RAZ la table T_G_LIVRE pour extraire les eleves de cet examen + query = "TRUNCATE t_g_livre;" + execute_query(request, query, {}) + + # Créer une ligne pour tous les ELEVES non cloturés, inactif et dont le compte est positif + query = """INSERT INTO t_g_livre (user,societe,cat,agence,cd_cli,intitule,formule,solde,credit,mtval) +SELECT :logged_in, societe, permis_demande, LEFT(CAST(cd_cli AS CHAR), 1), cd_cli, LEFT(nompren, 30), formule, 0, 0, 0 +FROM ELEVES WHERE agence > 0 AND societe='C' AND permis_demande = :permis;""" + execute_query(request, query, {'logged_in': logged_in, 'permis': permis}) + + # MAJ le solde et le total des montants valeur et credit + query = "SELECT * FROM t_g_livre WHERE user = :logged_in;" + results = request.dbsession.execute(query, {'logged_in': logged_in}).fetchall() + + for item in results: + # calculer le solde avant période + query = "SELECT COALESCE(SUM(credit-mtval),0) AS solde FROM eleves_cpt WHERE cd_cli=:cd_cli AND date_valeur < :date_debut;" + res = request.dbsession.execute(query, {'cd_cli': item.CD_CLI, 'date_debut': date_debut.strftime("%Y-%m-%d")}).first() + if res: + solde = res.solde + else: + solde = 0 + + # calculer les totaux credit et mtval de la période + query = """SELECT COALESCE(SUM(credit),0) AS credit, COALESCE(SUM(mtval),0) AS mtval + FROM eleves_cpt WHERE cd_cli=:cd_cli AND date_valeur >= :date_debut AND date_valeur <= :date_fin;""" + res = request.dbsession.execute(query, {'cd_cli': item.CD_CLI, 'date_debut': date_debut.strftime("%Y-%m-%d"), 'date_fin': date_fin.strftime("%Y-%m-%d")}).first() + if res: + credit = res.credit + mtval = res.mtval + else: + credit = 0 + mtval = 0 + + if solde != 0 or credit != 0 or mtval != 0: + query = "UPDATE t_g_livre SET solde=:solde, credit=:credit, mtval=:mtval WHERE user=:logged_in AND cd_cli=:cd_cli;" + execute_query(request, query, {'logged_in': logged_in, 'cd_cli': item.CD_CLI, + 'solde': solde, 'credit': credit, 'mtval': mtval}) + else: + query = "DELETE FROM t_g_livre WHERE user=:logged_in AND cd_cli=:cd_cli;" + execute_query(request, query, {'logged_in': logged_in, 'cd_cli': item.CD_CLI}) + + # Noter date heure du début génération + query = "UPDATE societes SET balance_fin=NOW() WHERE CODE = 'C';" + execute_query(request, query, {}) + +def get_balance(request, logged_in): + query = "SELECT * FROM t_g_livre WHERE user = :logged_in ORDER BY user, agence, cd_cli;" + results = request.dbsession.execute(query, {'logged_in': logged_in}).fetchall() + return results + +def get_recap(request, cd_mon1, cd_mon2, date1, date2): + # lire les activités de moniteurs de date à date + # ignorer les activités non imputables (NePasRelancer <> 0) + query = """ + SELECT m.NOM, c.CD_MON, c.INTITULE, c.REF, c.STATUT, sum(c.QTE) AS SUM_QTE FROM eleves_cpt c + INNER JOIN moniteurs m ON c.CD_MON = m.CD_MON + INNER JOIN eleves e ON c.CD_CLI = e.CD_CLI + WHERE c.CD_MON >= :cd_mon1 AND c.CD_MON <= :cd_mon2 AND c.DATE >= :date1 AND c.DATE <= :date2 AND + c.NoPlan > 0 AND e.NePasRelancer = 0 + GROUP BY m.NOM, c.REF, c.STATUT;""" + results = request.dbsession.execute(query, {'cd_mon1': cd_mon1, 'cd_mon2': cd_mon2, 'date1': date1 ,'date2': date2}).fetchall() + return results + +def get_moniteurs_byCode(request): + query = "SELECT * FROM moniteurs ORDER BY cd_mon;" + results = request.dbsession.execute(query) + return results.fetchall() + +def get_dates_balance(request): + query = "SELECT * FROM societes WHERE CODE = 'C';" + results = request.dbsession.execute(query).first() + return results.balance_debut, results.balance_fin, results.balance_criteres diff --git a/aem_gestion/models/crm.py b/aem_gestion/models/crm.py new file mode 100644 index 0000000..1612c20 --- /dev/null +++ b/aem_gestion/models/crm.py @@ -0,0 +1,355 @@ +# -*- coding: utf8 -*- +from sqlalchemy import text +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import ( + scoped_session, + sessionmaker, +) + +from zope.sqlalchemy import ZopeTransactionExtension, mark_changed + +from datetime import * +import transaction + +from .default import ( + execute_query, +) + +def to_int(x): + try: + number = int(x.replace(',', '.')) + return number + except ValueError: + return 0 + +def get_contacts(request, agence): + query = """ +SELECT cd_prospect, cree_le, civilite, nomprenom,permis_demande, a_relancer_le, tel_portable, date_relance1, date_relance2, date_relance3, statut, prochain_rdv_le +FROM prospects WHERE agence = :agence and cloture_le IS NULL ORDER BY nomprenom +""" + results = request.dbsession.execute(query, {'agence': agence}).fetchall() + return results + +def get_prospects_by_name(request, name, tous): + if tous == False: + encours = 'and cloture_le IS NULL' + else: + encours = "" + + if to_int(name) > 0: + if len(name) == 6: + # lire le contact par son code + query = "SELECT * FROM prospects WHERE cd_prospect=:name %s;" % encours + results = request.dbsession.execute(query, {'name': name}).fetchall() + else: + # lire le contact par son no mobile + query = "SELECT * FROM prospects WHERE tel_portable=:name;" + results = request.dbsession.execute(query, {'name': name}).fetchall() + else: + # lire le contact par son nom + query = "SELECT * FROM prospects WHERE nomprenom like :name %s ORDER BY nomprenom;" % encours + results = request.dbsession.execute(query, {'name': name + "%"}).fetchall() + + return results + +def get_prospects_by_code(request, code): + # lire le contact par son code + query = """SELECT * FROM prospects e WHERE e.cd_prospect=:code;""" + + results = request.dbsession.execute(query, {'code': code}).first() + return results + +def get_devis_cpf(request, no_devis): + # lire le devis CPF par son numéro + query = """SELECT * FROM devis_cpf WHERE no_devis=:no_devis;""" + results = request.dbsession.execute(query, {'no_devis': no_devis}).first() + return results + +def get_devis_cpf_by_nodossier(request, no_dossier, no_devis): + # lire le devis CPF par son numéro + query = """SELECT * FROM devis_cpf WHERE no_dossier=:no_dossier AND no_devis <> :no_devis;""" + results = request.dbsession.execute(query, {'no_dossier': no_dossier, 'no_devis': no_devis}).first() + return results + +def get_devis(request, no_devis): + # lire le devis par son numéro + query = """SELECT * FROM devis WHERE no_devis=:no_devis;""" + results = request.dbsession.execute(query, {'no_devis': no_devis}).first() + return results + +def get_devis_by_prospect(request, code): + # lire les devis par le code prospect + query = """SELECT * FROM devis WHERE cd_prospect=:code;""" + results = request.dbsession.execute(query, {'code': code}).fetchall() + return results + +def get_devis_cpf_by_prospect(request, code): + # lire les devis_cpf par le code prospect + query = """SELECT * FROM devis_cpf WHERE cd_prospect=:code;""" + results = request.dbsession.execute(query, {'code': code}).fetchall() + return results + +def get_prospects_rdv_byDate(request, agence, datedeb, datefin): + # lire les rdv prospects + query = """ +SELECT r.*, COALESCE(p.statut, '') as p_statut FROM prospects_rdv r LEFT JOIN prospects p ON r.cd_prospect = p.cd_prospect +WHERE r.agence = :agence AND DATE(debut_rdv) >= :datedeb AND DATE(debut_rdv) <= :datefin; +""" + results = request.dbsession.execute(query, {'agence': agence, 'datedeb': datedeb, 'datefin': datefin}).fetchall() + return results + +def get_prospects_rdv_byRelance(request, agence, datedeb, datefin): + # lire les rdv prospects + query = "SELECT * FROM prospects WHERE statut='En-cours' AND agence = :agence AND STR_TO_DATE(a_relancer_le,'%d/%m/%Y') >= :datedeb AND STR_TO_DATE(a_relancer_le,'%d/%m/%Y') <= :datefin;" + results = request.dbsession.execute(query, {'agence': agence, 'datedeb': datedeb, 'datefin': datefin}).fetchall() + return results + +def update_contacts_rdv(request, no_ligne, type, cd_prospect, debut, fin, resultat, statut, objet, notes, contact, option, agence, cd_uti): + + query = "CALL spUPD_PROSPECTS_RDV(:no_ligne, :type, :cd_prospect, :debut, :fin, :resultat, :statut, :objet, :notes, :contact, :option, :agence, :cd_uti);" + execute_query(request, query, {'no_ligne':no_ligne, 'type':type, 'cd_prospect':cd_prospect, 'debut':debut, 'fin':fin, 'resultat':resultat, + 'statut':statut, 'objet':objet, 'notes':notes, 'contact':contact, 'option':option, 'agence':agence, 'cd_uti':cd_uti}) + + +def get_prospects_rdv_by_noligne(request, no_ligne): + # lire le rdv B + query = "SELECT * FROM prospects_rdv WHERE no_ligne = :no_ligne;" + results = request.dbsession.execute(query, {'no_ligne': no_ligne}).first() + return results + +def get_prospects_rdv_byCode(request, type, cd_prospect): + # lire le rdv d'un prospect ou d'un client + query = "SELECT * FROM prospects_rdv WHERE type_code = :type AND cd_prospect = :cd_prospect;" + results = request.dbsession.execute(query, {'type': type, 'cd_prospect': cd_prospect}).fetchall() + return results + +def get_prospects_rdv_byContact(request, type, cd_prospect, no_ligne): + # lire les rdv du prospect + query = "CALL spGet_PROSPECTS_RDV_byPROSPECT(:type, :cd_prospect, :no_ligne)" + results = request.dbsession.execute(query, {'type': type, 'cd_prospect': cd_prospect, 'no_ligne': no_ligne}).fetchall() + return results + +def get_statuts(request): + query = "CALL spGet_P_TABLES_byCODE('P_STATUTS', 0);" + results = request.dbsession.execute(query).fetchall() + return results + +def delete_contacts_rdv(request, no_ligne): + """supprimer un rendez-vous""" + query = "delete from prospects_rdv where no_ligne = :no_ligne;" + execute_query(request, query, {'no_ligne': no_ligne}) + +def get_types_contact(request): + # lire les types de contacts + query = "SELECT * FROM p_types_contact order by libelle;" + results = request.dbsession.execute(query).fetchall() + return results + +def get_permis(request): + # lire les types de permis + query = "SELECT * FROM permis order by cat;" + results = request.dbsession.execute(query).fetchall() + return results + +def get_origines(request): + # lire les p_origines + query = "SELECT * FROM p_origines order by libelle;" + results = request.dbsession.execute(query).fetchall() + return results + +def get_decideurs(request): + # lire les p_types_decideur + query = "SELECT * FROM p_types_decideur order by libelle;" + results = request.dbsession.execute(query).fetchall() + return results + +def get_financeurs(request): + # lire les p_types_financeur + query = "SELECT * FROM p_types_financeur order by libelle;" + results = request.dbsession.execute(query).fetchall() + return results + +def get_prof_financeurs(request): + # lire les p_professions_financeur + query = "SELECT * FROM p_professions_financeur order by libelle;" + results = request.dbsession.execute(query).fetchall() + return results + +def get_types_raison(request): + # lire les p_types_raison + query = "SELECT * FROM p_types_raison order by libelle;" + results = request.dbsession.execute(query).fetchall() + return results + +def get_types_formation(request): + # lire les p_types_formation + query = "SELECT * FROM p_types_formation order by libelle;" + results = request.dbsession.execute(query).fetchall() + return results + +def get_motifs_abandon(request): + # lire les p_motifs_abandon + query = "SELECT * FROM p_abandons order by libelle;" + results = request.dbsession.execute(query).fetchall() + return results + +def update_prospect(request, cd_prospect, agence, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if param == 'nom': + new_values['nom'] = new_values['nom'].upper() + if param == 'prenom': + new_values['prenom'] = new_values['prenom'].upper() + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if cd_prospect == '0': + if 'tel_portable' not in new_values: + new_values['tel_portable'] = '' + if 'type_formation' not in new_values: + new_values['type_formation'] = 'NR' + if 'age' not in new_values: + new_values['age'] = 'NR' + if 'permis_demande' not in new_values: + new_values['permis_demande'] = 'NR' + new_values['agence'] = agence + query = "CALL spINS_PROSPECTS(0, :civilite, :nom, :prenom, :ville, :tel_portable, '', :permis_demande, :age, :agence);" + results = request.dbsession.execute(query, {'civilite':new_values['civilite'], 'nom':new_values['nom'], 'prenom':new_values['prenom'], + 'ville':new_values['ville'], 'tel_portable':new_values['tel_portable'], 'permis_demande':new_values['permis_demande'], + 'age':new_values['age'], 'agence':new_values['agence'],}).first() + cd_prospect = results.newcode + + new_values['cd_prospect'] = cd_prospect + query = "UPDATE prospects SET %s WHERE cd_prospect = :cd_prospect;" % s + execute_query(request, query, new_values) + +def delete_prospect(request, cd_prospect): + query = "DELETE FROM prospects WHERE cd_prospect = :cd_prospect ;" + execute_query(request, query, {'cd_prospect': cd_prospect}) + +def update_prospect_won(request, cd_prospect, cd_uti, agence): + query = "CALL spUPD_PROSPECTS_GAGNE(:cd_prospect, :cd_uti, :agence)" + execute_query(request, query, {'cd_prospect': cd_prospect, 'cd_uti': cd_uti, 'agence': agence}) + +def update_prospect_lost(request, cd_prospect, motif_abandon, cd_uti): + query = "CALL spUpd_PROSPECTS_PERDU(:cd_prospect, :motif_abandon, :cd_uti)" + execute_query(request, query, {'cd_prospect': cd_prospect, 'cd_uti': cd_uti, 'motif_abandon': motif_abandon}) + +def get_p_tva(request): + # lire les p_tva + query = "SELECT * FROM p_tva order by taux;" + results = request.dbsession.execute(query).fetchall() + return results + +def update_devis_cpf(request, no_devis, code, new_values): + + # formater les champs + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if no_devis == '0': + if code[:1] == 'P': + new_values['cd_prospect'] = code[1:] + new_values['cd_cli'] = 0 + else: + new_values['cd_prospect'] = 0 + new_values['cd_cli'] = code[1:] + + query = """CALL spINS_DEVIS_CPF(:cd_prospect, :cd_cli, :type_devis, :montant_pec, :montant_ht, :nb_heures_pec, :no_dossier, :demande_le, :cd_uti);""" + execute_query(request, query, new_values) + else: + new_values['no_devis'] = no_devis + query = "UPDATE devis_cpf SET %s WHERE no_devis = :no_devis;" % s + execute_query(request, query, new_values) + +def update_devis(request, no_devis, code, new_values): + + # formater les champs + s = '' + for param in new_values.keys(): + if param == 'organisme': + new_values['organisme'] = new_values['organisme'].upper() + if param == 'ville_org': + new_values['ville_org'] = new_values['ville_org'].upper() + if param == 'entreprise': + new_values['entreprise'] = new_values['entreprise'].upper() + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if no_devis == '0': + if 'entreprise' not in new_values: + new_values['entreprise'] = '' + if 'adr2_org' not in new_values: + new_values['adr2_org'] = '' + if code[:1] == 'P': + new_values['cd_prospect'] = code[1:] + new_values['cd_cli'] = 0 + else: + new_values['cd_prospect'] = 0 + new_values['cd_cli'] = code[1:] + + query = """CALL spINS_DEVIS(:cd_prospect, :cd_cli, :organisme, :entreprise, :adr_org, :adr2_org, :cp_org, :ville_org, :type_devis, :cd_uti);""" + execute_query(request, query, new_values) + else: + new_values['no_devis'] = no_devis + query = "UPDATE devis SET %s WHERE no_devis = :no_devis;" % s + execute_query(request, query, new_values) + +def delete_type_devis(request, type_devis): + query = "DELETE FROM p_types_devis WHERE type_devis = :type_devis ;" + execute_query(request, query, {'type_devis': type_devis}) + +def update_devis_status(request, no_devis, statut): + query = "UPDATE devis SET statut = :statut WHERE no_devis = :no_devis ;" + execute_query(request, query, {'no_devis': no_devis, 'statut': statut}) + +def update_devis_cpf_status(request, no_devis, statut): + query = "UPDATE devis_cpf SET statut = :statut WHERE no_devis = :no_devis ;" + execute_query(request, query, {'no_devis': no_devis, 'statut': statut}) + +def cancel_devis(request, no_devis): + query = "UPDATE devis SET no_pec=NULL, date_pec=NULL, date_debut_pec=NULL, date_fin_pec=NULL WHERE no_devis = :no_devis;" + execute_query(request, query, {'no_devis': no_devis}) + +def get_prospect_suivi(request, cd_prospect, no_ligne): + if no_ligne == 0: + query = "SELECT * FROM prospects_suivi WHERE cd_prospect = :cd_prospect ORDER BY cree_le DESC;" + results = request.dbsession.execute(query, {'cd_prospect': cd_prospect}).fetchall() + else: + query = "SELECT * FROM prospects_suivi WHERE no_ligne = :no_ligne;" + results = request.dbsession.execute(query, {'no_ligne': no_ligne}).first() + return results + +def insert_prospect_suivi(request, cd_prospect, infos, user): + query = "INSERT INTO prospects_suivi (cd_prospect, cd_uti, infos) VALUES (:cd_prospect, :user, :infos);" + execute_query(request, query, {'cd_prospect': cd_prospect, 'user': user, 'infos': infos}) + +def update_prospect_suivi(request, no_ligne, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if no_ligne == '0': + query = "INSERT INTO prospects_suivi SET %s" % s + else: + new_values['no_ligne'] = no_ligne + query = "UPDATE prospects_suivi SET %s WHERE no_ligne = :no_ligne;" % s + execute_query(request, query, new_values) + +def delete_prospect_suivi(request, no_ligne): + query = "DELETE FROM prospects_suivi WHERE no_ligne = :no_ligne ;" + execute_query(request, query, {'no_ligne': no_ligne}) + diff --git a/aem_gestion/models/default.py b/aem_gestion/models/default.py new file mode 100644 index 0000000..170b1b6 --- /dev/null +++ b/aem_gestion/models/default.py @@ -0,0 +1,295 @@ +# -*- coding: utf8 -*- +from datetime import datetime +from sqlalchemy import text +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import ( + scoped_session, + sessionmaker, +) + +from zope.sqlalchemy import ZopeTransactionExtension, mark_changed +import transaction + +def update_eleve_solde(request,cd_cli): + query = """ CALL spUPD_ELEVES_SOLDE(:cd_cli); """ + execute_query(request,query,{'cd_cli':str(cd_cli),'date':datetime.today()}) + +def get_mode_mode_regl(request,search): + # lire l'eleve connecte + query = """SELECT * FROM p_mode_regl WHERE LIBELLE like '%{0}%';""".format(search) + print(query) + results = request.dbsession.execute(query).fetchall() + return results + +def get_libelle_mode_regl(request,search): + # lire l'eleve connecte + query = """SELECT * FROM p_libelle_regl WHERE LIBELLE like '%{0}%';""".format(search) + results = request.dbsession.execute(query).fetchall() + return results + +def get_list_activity(request,search): + query = "SELECT * FROM `eleves` WHERE AGENCE=0 AND PERMIS_DEMANDE='ACTIV' AND NOM like :search " + results = request.dbsession.execute(query,{'search':'%'+search+'%'}).fetchall() + return results + +def execute_query(request, query, params): + """Execute query and mark session as changed""" + request.dbsession.execute(query, params) + mark_changed(request.dbsession) + transaction.commit() + + +def get_formules(request, formule, validite): + """Lire les formules""" + if validite == 'TOUTES': + query = """SELECT * FROM formules WHERE formule like :code ORDER BY formule;""" + else: + query = """SELECT * FROM formules WHERE DateFin >= CURRENT_DATE AND formule like :code ORDER BY formule;""" + results = request.dbsession.execute(query, {'code': formule + "%"}) + return results.fetchall() + +def get_formule(request,formule): + query = """SELECT * FROM formules WHERE formule=:code ORDER BY formule;""" + results = request.dbsession.execute(query, {'code': formule }) + return results.first() + +def get_dept_nais(request, code): + query = """SELECT * FROM p_departements WHERE code like :code ORDER BY code;""" + results = request.dbsession.execute(query, {'code': code + "%"}) + return results.fetchall() + +def get_departements(request): + """ Lire toutes les départements """ + query = "SELECT * FROM p_departements order by no_tri;" + results = request.dbsession.execute(query).fetchall() + return results + +def get_all_dept_nais(request): + query = """SELECT * FROM p_departements ORDER BY code;""" + results = request.dbsession.execute(query) + return results.fetchall() + + +def get_users_by_code(request, cd_uti): + if cd_uti == '0': + query = """SELECT * FROM p_users order by cd_uti;""" + results = request.dbsession.execute(query).fetchall() + else: + # lire l'utilisateur connecte + query = """SELECT * FROM p_users WHERE cd_uti=:cd_uti;""" + results = request.dbsession.execute(query, {'cd_uti': cd_uti}).first() + return results + + +def get_user_access(request, cd_uti): + # lire l'utilisateur connecte + query = """SELECT secu FROM p_users WHERE cd_uti=:cd_uti;""" + results = request.dbsession.execute(query, {'cd_uti': cd_uti}).first() + return results.secu + + +def get_user_cd_mon(request, cd_uti): + # lire le code moniteur de l'utilisateur connecte + query = """SELECT cd_mon, cd_mon_B78 FROM p_users WHERE cd_uti=:cd_uti;""" + results = request.dbsession.execute(query, {'cd_uti': cd_uti}).first() + # lire le code moniteur de l'utilisateur + if results: + cd_mon = results.cd_mon + cd_mon_b78 = results.cd_mon_B78 + else: + cd_mon = '1JS' + cd_mon_b78 = '' + return cd_mon,cd_mon_b78 + +def get_user_cd_mon_B78(request, cd_uti): + # lire le code moniteur de l'utilisateur connecte + query = """SELECT cd_mon_B78 FROM p_users WHERE cd_uti=:cd_uti;""" + results = request.dbsession.execute(query, {'cd_uti': cd_uti}).first() + # lire le code moniteur de l'utilisateur + if results: + cd_mon_b78 = results.cd_mon_B78 + else: + cd_mon_b78 = '' + return cd_mon_b78 + +def get_cd_mon_B78(request, cd_mon): + # lire le code moniteur de l'utilisateur connecte + query = """SELECT cd_mon_B78 FROM p_users WHERE cd_mon=:cd_mon;""" + results = request.dbsession.execute(query, {'cd_mon': cd_mon}).first() + # lire le code moniteur de l'utilisateur + if results: + cd_mon_b78 = results.cd_mon_B78 + else: + cd_mon_b78 = '' + return cd_mon_b78 + +def get_cd_mon_from_cd_b78(request, cd_mon_b78): + # lire le code moniteur de l'utilisateur connecte + query = """SELECT cd_mon FROM p_users WHERE cd_mon_b78=:cd_mon_b78;""" + results = request.dbsession.execute(query, {'cd_mon_b78': cd_mon_b78}).first() + # lire le code moniteur de l'utilisateur + if results: + cd_mon = results.cd_mon + else: + cd_mon = '' + return cd_mon + + +def isDelaiOK(request, date, cree_le, statut): + # controler que le delai de suppression est OK + query = "CALL spCTL_DELAI_ANNUL(:date, :cree_le, :statut)" + results = request.dbsession.execute(query, {'date': date, 'cree_le': cree_le, 'statut': statut}).first() + return results.resultat + + +def update_last_connection(request, login, ua_string): + """Update last connection for login """ + query = "UPDATE p_users SET dern_cnx_le=NOW(), ua_string=:ua_string WHERE cd_uti=:login;" + execute_query(request, query, {'login': login, 'ua_string': ua_string}) + + +def update_password(request, login, password): + """Update password for member login""" + query = "UPDATE p_users SET mdp_hash=SHA1(:password), mdp_oublie=NULL, mdp_oublie_date=NULL WHERE cd_uti=:login" + execute_query(request, query, {'login': login, 'password': password}) + + +def is_lien_mdp_oublie(request, lien): + query = "SELECT mdp_oublie FROM p_users WHERE mdp_oublie=:lien;" + results = request.dbsession.execute(query, {'lien': lien}).first() + return len(results) > 0 + + +def get_mdp_oublie_infos(request, lien): + query = "SELECT * FROM p_users WHERE mdp_oublie=:lien;" + results = request.dbsession.execute(query, {"lien": lien}).first() + return results + + +def update_membre_mdp_oublie(request, cd_uti): + import uuid, base64 + + # get a UUID - URL safe, Base64 + uid = uuid.uuid1() + urlslug = base64.urlsafe_b64encode(uid.bytes).decode("utf-8").rstrip('=\n').replace('/', '_') + query = "UPDATE p_users SET mdp_oublie=:urlslug, mdp_oublie_date=now() WHERE cd_uti=:cd_uti;" + execute_query(request, query, {'urlslug': urlslug, 'cd_uti': cd_uti}) + return urlslug + + +def update_user_agency(request, cd_uti, agence): + query = "UPDATE p_users SET agence=:agence WHERE cd_uti = :cd_uti;" + execute_query(request, query, {'agence': agence, 'cd_uti': cd_uti}) + + +def get_all_moniteurs(request): + query = "SELECT * FROM moniteurs ORDER BY nom;" + results = request.dbsession.execute(query) + return results.fetchall() + +def get_moniteur_by_code(request,cd_mon): + query = "SELECT * FROM moniteurs WHERE cd_mon = :cd_mon;" + results = request.dbsession.execute(query, {'cd_mon': cd_mon}) + return results.first() + +def get_moniteurs(request, cd_mon): + if cd_mon == 0: + query = "SELECT * FROM moniteurs WHERE obsolete = 0 ORDER BY nom;" + results = request.dbsession.execute(query) + return results.fetchall() + else: + query = "SELECT * FROM moniteurs WHERE cd_mon = :cd_mon;" + results = request.dbsession.execute(query, {'cd_mon': cd_mon}) + return results.first() + +def get_moniteur_aff(request, cd_mon): + query = "SELECT * FROM moniteurs_aff WHERE cd_mon = :cd_mon ORDER BY DATED;" + results = request.dbsession.execute(query, {'cd_mon': cd_mon}) + return results.fetchall() + +def get_moniteur_aff_by_no_ligne(request, no_ligne): + query = "SELECT * FROM moniteurs_aff WHERE no_ligne = :no_ligne" + results = request.dbsession.execute(query, {'no_ligne': no_ligne}) + return results.first() + +def get_all_moniteur_aff(request): + query = "SELECT * FROM moniteurs_aff ORDER BY DATED ASC" + results = request.dbsession.execute(query,) + return results.fetchall() + +def get_all_moniteur_active_by_name(request,name): + query = "SELECT * FROM moniteurs WHERE nom like :name ORDER BY NOM ASC" + results = request.dbsession.execute(query,{"name" : "%"+name+"%"}) + return results.fetchall() + + +def get_agences(request, code): + if code == 0: + query = "SELECT * FROM p_agences ORDER BY CODE;" + results = request.dbsession.execute(query) + return results.fetchall() + else: + query = "SELECT * FROM p_agences WHERE code = :code;" + results = request.dbsession.execute(query, {'code': code}) + return results.first() + + +def getAgenceLib(request, code): + query = "SELECT * FROM p_agences WHERE code = :code;" + results = request.dbsession.execute(query, {'code': code}) + return results.first().LIBELLE + + +def get_all_formules(request, permis): + """Lire les formules""" + query = """CALL spGet_FORMULES_valide('{0}','')""".format(permis) + results = request.dbsession.execute(query) + return results.fetchall() + + +def get_codespostaux(request, code): + query = "SELECT * FROM p_codespostaux WHERE code_postal like :code;" + results = request.dbsession.execute(query, {'code': code + "%"}) + return results.fetchall() + + +def get_tarifs_byName(request, ref): + """Lire les tarifs commencant par""" + query = "SELECT * FROM tarifs where ref like :ref AND obsolete = 0;" + results = request.dbsession.execute(query, {'ref': ref + '%'}) + return results.fetchall() + + +def get_types_devis(request, type_devis): + """Lire les types_devis""" + if type_devis == '0': + query = "SELECT * FROM p_types_devis ORDER BY type_devis;" + results = request.dbsession.execute(query).fetchall() + elif type_devis == 'CPF': + query = "SELECT * FROM p_types_devis where type_devis like 'B_%' AND dispo <> 0 ORDER BY type_devis;" + results = request.dbsession.execute(query).fetchall() + elif type_devis == 'ALL': + query = "SELECT * FROM p_types_devis where dispo <> 0 ORDER BY type_devis;" + results = request.dbsession.execute(query).fetchall() + else: + query = "SELECT * FROM p_types_devis where type_devis = :type_devis;" + results = request.dbsession.execute(query, {'type_devis': type_devis}).first() + return results + +def delete_stage_lig_by_cd_cli(request,stage_type,semaine,groupe,cd_cli): + query = """ CALL spDel_PLA_STAGE_LIGNES(:type,:semaine,:groupe,:cd_cli)""" + execute_query(request,query, {'type': stage_type, 'semaine': semaine, 'groupe': groupe, "cd_cli":cd_cli}) + +def delete_moto_lig_by_cd_cli(request,noligne,ligne_cpt,cd_cli,cd_uti): + query = """ CALL spDel_PLA_MOTO_LIGNES(:noligne,:ligne_cpt,:cd_cli,:cd_uti)""" + execute_query(request,query, {'noligne': noligne, 'ligne_cpt': ligne_cpt, 'cd_cli': cd_cli, "cd_uti":cd_uti}) + +def update_panning_moto_dispo(request,type_planning,date,groupe): + query2 = "CALL spUpd_PLA_MOTO_DISPO(:TYPE,:DATE,:GROUPE)" + execute_query(request, query2, {"TYPE":type_planning,"DATE":date,"GROUPE":groupe}) + +def get_moniteur_aff_by_agence(request, cd_mon, agence): + query = "SELECT * FROM moniteurs_aff WHERE cd_mon = :cd_mon AND agence=:agence ORDER BY DATED;" + results = request.dbsession.execute( + query, {'cd_mon': cd_mon, 'agence': agence}) + return results.fetchall() \ No newline at end of file diff --git a/aem_gestion/models/eleves.py b/aem_gestion/models/eleves.py new file mode 100644 index 0000000..5247707 --- /dev/null +++ b/aem_gestion/models/eleves.py @@ -0,0 +1,523 @@ +# -*- coding: utf8 -*- +from sqlalchemy import text +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import ( + scoped_session, + sessionmaker, +) + +from zope.sqlalchemy import ZopeTransactionExtension, mark_changed + +from datetime import * +import transaction + +from .default import ( + execute_query, + get_agences +) + + +def to_int(x): + try: + number = int(x.replace(',', '.')) + return number + except ValueError: + return 0 + + +def get_permis(request): + # lire les types de permis + query = "SELECT * FROM permis order by cat;" + results = request.dbsession.execute(query).fetchall() + return results + + +def get_all_dept_nais(request): + query = """SELECT * FROM p_departements ORDER BY code;""" + results = request.dbsession.execute(query) + return results.fetchall() + + +def get_all_dept_nais_pays(request): + query = """SELECT DISTINCT pays FROM p_departements ORDER BY pays;""" + results = request.dbsession.execute(query) + return results.fetchall() + + +def get_codespostaux(request): + query = "SELECT DISTINCT code_postal FROM p_codespostaux ;" + results = request.dbsession.execute(query) + return results.fetchall() + + +def get_formules(request): + """Lire les formules""" + query = """SELECT * FROM formules WHERE DateFin >= CURRENT_DATE ORDER BY formule;""" + results = request.dbsession.execute(query) + return results.fetchall() + + +def get_formules(request): + """Lire les formules""" + query = """SELECT * FROM formules WHERE DateFin >= CURRENT_DATE ORDER BY formule;""" + results = request.dbsession.execute(query) + return results.fetchall() + + +def get_all_formules(request, permis): + """Lire les formules""" + query = """CALL spGet_FORMULES_valide('{0}','')""".format(permis) + results = request.dbsession.execute(query) + return results.fetchall() + + +def get_all_filieres(request): + """Lire les formules""" + query = """SELECT * FROM p_filieres ORDER BY code;""" + results = request.dbsession.execute(query) + return results.fetchall() + + +def isEleveCreated(request, civilite, nom, nom_jf, prenom, date_nais, lieu_nais, dept_nais, formule): + # vérifier que l'élève n'est pas déjà créé + query = """SELECT cd_cli as cd_cli FROM eleves WHERE nom=:nom AND prenom=:prenom AND nom_jf=:nom_jf AND date_nais=:date_nais AND lieu_nais=:lieu_nais AND dept_nais=:dept_nais AND formule=:formule AND cloture_le IS NULL AND DATEDIFF(cree_le,CURRENT_DATE) < 15;""" + results = request.dbsession.execute(query, {'nom': nom, 'prenom': prenom, 'nom_jf': nom_jf, 'date_nais': date_nais, 'lieu_nais': lieu_nais, 'dept_nais': dept_nais, 'formule': formule}).first() + if results: + return results.cd_cli + else: + return 0 + + +def insert_eleve_by_formule(request, params): + cd_cli = isEleveCreated(request, params['CIVILITE'], params['NOM'], params['NOM_JF'], params['PRENOM'], datetime.strptime(params['DATE_NAIS'], '%d/%m/%Y'), params['LIEU_NAIS'], params['DEPT_NAIS'], params['FORMULE']) + if cd_cli > 0: + return cd_cli + else: + # créer une fiche élève selon formule + params['DATE_NAIS'] = datetime.strptime(params['DATE_NAIS'], '%d/%m/%Y').strftime("%Y-%m-%d") + # query = """CALL spUpd_ELEVES_ETATCIVIL(0,:CIVILITE, :NOM, :PRENOM, :NOM_JF, :adresse_no_voie, :adresse_extension,:adresse_type_voie, :adresse_nom_voie, '',:CODEPOST, '', :TEL, :TEL2, :TEL3, :TEL4, :PROFESSION, :NATION, :DATE_NAIS, :LIEU_NAIS, :DEPT_NAIS ,'',:TYPE_ENTREPRISE, :NOM_ENTREPRISE, :NePasSpammer, :NePasRelancer,:encours_societe ,:email, 0, 0, '')""" + query = "CALL spUpd_ELEVES_ETATCIVIL(0,'{CIVILITE}', '{NOM}', '{PRENOM}', '{NOM_JF}', '{adresse_no_voie}','{adresse_extension}', '{adresse_type_voie}', '{adresse_nom_voie}', '','{CODEPOST}', '', '{TEL}', '{TEL2}', '{TEL3}', '{TEL4}', '{PROFESSION}', '{NATION}', '{DATE_NAIS}', '{LIEU_NAIS}', '{DEPT_NAIS}','','{TYPE_ENTREPRISE}', '{NOM_ENTREPRISE}', {NePasSpammer}, {NePasRelancer},{encours_societe} ,'{email}', 0, {agence}, '')".format(**params) + # créer une fiche élève selon formule + results = request.dbsession.execute(query, params).first() + cd_cli = str(results.newcode).zfill(6) + # mise à jour onglet INSCRIPTION + query = """CALL spUpd_ELEVES_INSCRIT(:cd_cli,:permis,:formule,0,0,0,0,'',0,0,0,0,0,0,0,0,0,0,0,0,'CAS 1','','',NOW(),'','','','','', '','','','','',0,'','','','','','',0,0,'')""" + execute_query(request, query, {'cd_cli': cd_cli, + 'permis': params['PERMIS_DEMANDE'], + 'formule': params['FORMULE'], + }) + # génére les écritures d'inscription selon la formule + debit_eleve_inscription(request, cd_cli, params['FORMULE'], '0', '') + return cd_cli + + +def get_eleves_by_name(request, name, statut): + if to_int(name) > 0: + # saisie = numéro + if len(name) == 1: + # afiche les 50 derniers ELEVES crées par l'agence + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.cd_cli like :name AND e.statut=0 ORDER BY e.modif_le DESC;""" + results = request.dbsession.execute(query, {'name': '%'+name+'%', 'statut': statut}).fetchall() + elif len(name) == 6 : + # lire l'eleve par son code + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.cd_cli=:name and e.statut < :statut;""" + results = request.dbsession.execute(query, {'name': name, 'statut': statut}).fetchall() + else: + # lire l'eleve par son no de mobile + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.tel2=:name and e.statut < :statut;""" + results = request.dbsession.execute(query, {'name': name, 'statut': statut}).fetchall() + else: + # lire l'eleve par son nom + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.nompren like :name and e.statut < :statut ORDER BY e.nompren;""" + results = request.dbsession.execute(query, {'name': name + "%", 'statut': statut}).fetchall() + return results + +def get_eleves_not_b78_by_name(request, name, statut): + if to_int(name) > 0: + # saisie = numéro + if len(name) == 1: + # afiche les 50 derniers ELEVES crées par l'agence + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.cd_cli like :name AND e.statut=0 and e.permis_demande <> 'B78' ORDER BY e.modif_le DESC;""" + results = request.dbsession.execute(query, {'name': '%'+name+'%', 'statut': statut}).fetchall() + elif len(name) == 6 : + # lire l'eleve par son code + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.cd_cli=:name and e.statut < :statut and e.permis_demande <> 'B78';""" + results = request.dbsession.execute(query, {'name': name, 'statut': statut}).fetchall() + else: + # lire l'eleve par son no de mobile + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.tel2=:name and e.statut < :statut and e.permis_demande <> 'B78';""" + results = request.dbsession.execute(query, {'name': name, 'statut': statut}).fetchall() + else: + # lire l'eleve par son nom + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.nompren like :name and e.statut < :statut and e.permis_demande <> 'B78' ORDER BY e.nompren;""" + results = request.dbsession.execute(query, {'name': name + "%", 'statut': statut}).fetchall() + return results + +def get_eleves_ajax(request, name): + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.nompren like :name ORDER BY e.nompren;""" + results = request.dbsession.execute(query, {'name': "%"+name + "%"}).fetchall() + return results + + +def get_eleves_by_code(request, login): + # lire l'eleve connecte + query = """SELECT e.* FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat WHERE cd_cli=:login;""" + results = request.dbsession.execute(query, {'login': login}).first() + return results + +def get_eleves_by_name78(request, name, statut): + if to_int(name) > 0: + # saisie = numéro + if len(name) == 1: + # afiche les 50 derniers ELEVES crées par l'agence + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.cd_cli like :name AND e.permis_demande='B78' AND e.statut=0 ORDER BY e.modif_le DESC;""" + results = request.dbsession.execute(query, {'name': '%'+name+'%', 'statut': statut}).fetchall() + elif len(name) == 6 : + # lire l'eleve par son code + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.cd_cli=:name AND e.permis_demande='B78' and e.statut < :statut;""" + results = request.dbsession.execute(query, {'name': name, 'statut': statut}).fetchall() + else: + # lire l'eleve par son no de mobile + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.tel2=:name AND e.permis_demande='B78' and e.statut < :statut;""" + results = request.dbsession.execute(query, {'name': name, 'statut': statut}).fetchall() + else: + # lire l'eleve par son nom + query = """SELECT e.civilite, e.nompren, e.cd_cli, e.permis_demande, e.formule, e.cree_le, e.nom_entreprise, e.statut + FROM eleves e INNER JOIN permis p ON e.permis_demande = p.cat + WHERE e.nompren like :name AND e.permis_demande='B78' and e.statut < :statut ORDER BY e.nompren;""" + results = request.dbsession.execute(query, {'name': name + "%", 'statut': statut}).fetchall() + return results + + + + + + +def get_eleve_compte(request, cd_cli): + query = """ + SELECT c.*, m.lib4 FROM eleves_cpt c LEFT JOIN p_mode_regl m ON c.mode_regl=m.code + WHERE cd_cli=:cd_cli AND NOT (qte=0 AND debit+credit+mtval=0 AND (intitule LIKE '%annulé%' OR intitule LIKE '%remplacé%' OR intitule LIKE '%expiré%')) + ORDER BY c.DATE;""" + results = request.dbsession.execute(query, {'cd_cli': cd_cli}).fetchall() + return results + +def get_eleve_compte_by_no_ligne(request, no_ligne): + # lire l'eleve connecte + query = """SELECT * FROM eleves_cpt WHERE no_ligne=:no_ligne;""" + results = request.dbsession.execute(query, {'no_ligne': no_ligne}).first() + return results + +def get_eleve_compte_complete_by_no_ligne(request, no_ligne): + # lire l'eleve connecte + query = """SELECT c.*,m.libelle as mode , c.credit*((100.00 + t.taux)/100) as HT FROM eleves_cpt c LEFT JOIN p_mode_regl m ON c.mode_regl=m.code LEFT JOIN p_tva t ON t.code=c.ctva WHERE c.no_ligne=:no_ligne;""" + results = request.dbsession.execute(query, {'no_ligne': no_ligne}).first() + return results + +def delete_eleve_compte_by_no_ligne(request, no_ligne, cd_cli): + # lire l'eleve connecte + query = """DELETE FROM eleves_cpt WHERE no_ligne=:no_ligne;""" + execute_query(request, query,{'no_ligne': no_ligne}) + query = "CALL spUPD_ELEVES_SOLDE(:cd_cli);" + execute_query(request, query,{'cd_cli': cd_cli}) + +def get_mode_reglement(request,maxcode): + # lire l'eleve connecte + query = """SELECT * FROM p_mode_regl ;""" + if maxcode != 0 : + query = """SELECT * FROM p_mode_regl WHERE CODE<:code;""" + results = request.dbsession.execute(query,{"code":maxcode}).fetchall() + return results + + +def get_eleve_docs(request, cd_cli, type): + query = """SELECT *, j.libelle FROM eleves_upload e INNER JOIN p_justifs j ON e.code = j.code + WHERE e.cd_cli = :cd_cli AND e.type = :type ORDER BY e.no_tri;""" + results = request.dbsession.execute(query, {'cd_cli': cd_cli, 'type': type}).fetchall() + return results + + +def get_eleve_suivi(request, cd_cli, no_ligne): + if no_ligne == 0: + query = "SELECT * FROM eleves_suivi WHERE cd_cli = :cd_cli ORDER BY cree_le DESC;" + results = request.dbsession.execute(query, {'cd_cli': cd_cli}).fetchall() + else: + query = "SELECT * FROM eleves_suivi WHERE no_ligne = :no_ligne;" + results = request.dbsession.execute(query, {'no_ligne': no_ligne}).first() + return results + + +def update_eleve(request, cd_cli, new_values): + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + new_values['cd_cli'] = cd_cli + query = "UPDATE eleves SET %s WHERE CD_CLI=:cd_cli" % s + execute_query(request, query, new_values) + + +def update_eleve_delettrer(request, no_ligne): + query = "CALL spUPD_ELEVES_DELETTRER(:no_ligne)" + execute_query(request, query, {'no_ligne': no_ligne}) + + +def update_suivi(request, no_ligne, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if no_ligne == '0': + query = "INSERT INTO eleves_suivi SET %s" % s + else: + new_values['no_ligne'] = no_ligne + query = "UPDATE eleves_suivi SET %s WHERE no_ligne = :no_ligne;" % s + execute_query(request, query, new_values) + + +def delete_suivi(request, no_ligne): + query = "DELETE FROM eleves_suivi WHERE no_ligne = :no_ligne ;" + execute_query(request, query, {'no_ligne': no_ligne}) + + +def get_moniteurs_by_code(request, cd_mon): + if cd_mon == '': + query = """SELECT * FROM moniteurs WHERE obsolete = False ORDER BY NOM;""" + results = request.dbsession.execute(query).fetchall() + else: + # lire le moniteur + query = """SELECT * FROM moniteurs WHERE cd_mon=:cd_mon;""" + results = request.dbsession.execute(query, {'cd_mon': cd_mon}).first() + return results + + +def get_examens_aff_byCD_CLI(request, cd_cli): + # lire le moniteur + query = """SELECT a.*, CONCAT(DATE_FORMAT(a.date,'%d/%m/%Y'), ' - ', DATE_FORMAT(a.heure,'%H:%i')) as date_heure, e.lieu as lieu, s.LIBELLE as libelle FROM examens_aff a +INNER JOIN examens e ON a.date=e.date AND a.no_exa=e.no_exa AND a.agence=e.agence +LEFT JOIN p_statuts_exam s ON a.RESULTAT = s.CODE +WHERE cd_cli = :cd_cli;""" + results = request.dbsession.execute(query, {'cd_cli': cd_cli}).fetchall() + return results + +def get_eleves_permis(request, cd_cli): + # lire les permis obtenus par l'élève + query = "SELECT * FROM eleves_permis WHERE cd_cli = :cd_cli;" + results = request.dbsession.execute(query, {'cd_cli': cd_cli}).fetchall() + return results + +def get_eleves_permis_byNo(request, no_ligne): + # lire les permis obtenus par l'élève par no_ligne + query = "SELECT * FROM eleves_permis WHERE no_ligne = :no_ligne;" + results = request.dbsession.execute(query, {'no_ligne': no_ligne}).first() + return results + + +def get_devis_by_eleve(request, code): + # lire les devis par le code eleve + query = """SELECT * FROM devis WHERE cd_cli=:code;""" + results = request.dbsession.execute(query, {'code': code}).fetchall() + return results + + +def get_devis_cpf_by_eleve(request, code): + # lire les devis CPF par le code eleve + query = """SELECT * FROM devis_cpf WHERE cd_cli=:code;""" + results = request.dbsession.execute(query, {'code': code}).fetchall() + return results + + +def get_eleve_justifs_manquant(request, cd_cli): + """Lire les justifs manquant dans élève""" + + query = """SELECT p.*, j.LIBELLE FROM permis_justifs p + INNER JOIN p_justifs j ON j.code = p.code + INNER JOIN eleves l ON l.cd_cli = :cd_cli + LEFT JOIN eleves_upload e ON e.code = p.code AND e.cd_cli = :cd_cli + WHERE p.cat=l.permis_demande AND e.code IS null ORDER BY p.no_tri, p.code;""" + results = request.dbsession.execute(query, {'cd_cli': cd_cli}).fetchall() + return results + + +def get_eleve_docs_manquant(request, cd_cli): + """Lire les docs manquant dans élève""" + + query = """SELECT j.* FROM p_justifs j + INNER JOIN eleves l ON l.cd_cli = :cd_cli + LEFT JOIN eleves_upload e ON e.code = j.code AND e.cd_cli = :cd_cli + WHERE j.type='DOC' AND e.code IS null ORDER BY j.code;""" + results = request.dbsession.execute(query, {'cd_cli': cd_cli}).fetchall() + return results + + +def get_eleve_justifs(request, no_ligne): + """Lire le justif dans élève""" + + query = """SELECT p.*, j.LIBELLE, j.conditions FROM eleves_upload p + INNER JOIN p_justifs j ON j.code = p.code + WHERE p.no_ligne = :no_ligne;""" + results = request.dbsession.execute(query, {'no_ligne': no_ligne}).first() + return results + +def get_eleve_stage(request, cd_cli): + # lire les donnees de l'eleve + query = "call spGet_ELEVES_INFOS(:cd_cli)" + results = request.dbsession.execute(query, {'cd_cli': cd_cli}).fetchall() + return results + +def insert_eleve_justif(request, cd_cli, code, type, cd_uti, cat): + # générer justifs de l'élève à partir du permis + query = """INSERT INTO eleves_upload (cd_cli, code, type, cd_uti) + VALUES (:cd_cli, :code, :type, :cd_uti);""" + execute_query(request, query, {'cd_cli': cd_cli, 'code': code, 'type': type, 'cd_uti': cd_uti, 'cat': cat}) + +def update_eleve_justif(request, no_ligne, new_values): + # mettre à jour justifs de l'élève + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + + new_values['no_ligne'] = no_ligne + query = "UPDATE eleves_upload SET %s WHERE no_ligne=:no_ligne" % s + execute_query(request, query, new_values) + +def delete_eleve_justif(request, no_ligne): + query = "DELETE FROM eleves_upload WHERE no_ligne = :no_ligne ;" + execute_query(request, query, {'no_ligne': no_ligne}) + +def delete_eleve_permis(request, no_ligne): + query = "DELETE FROM eleves_permis WHERE no_ligne = :no_ligne ;" + execute_query(request, query, {'no_ligne': no_ligne}) + +def update_eleve_permis(request, cd_cli, no_ligne, new_values): + # mettre à jour permis de l'élève + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if no_ligne == '0': + s += ",%s=:%s" % ('cd_cli', 'cd_cli') + new_values['cd_cli'] = cd_cli + query = "INSERT INTO eleves_permis SET %s" % s + else: + new_values['no_ligne'] = no_ligne + query = "UPDATE eleves_permis SET %s WHERE no_ligne=:no_ligne" % s + execute_query(request, query, new_values) + +def eleve_doc_valorise(request,formule,cd_cli): + query = "call spUPD_ELEVES_VALORISER(:formule,:cd_cli);" + execute_query(request,query,{'formule':formule,'cd_cli':cd_cli}) + +def get_status(request): + query = "SELECT * FROM p_statuts ORDER BY CODE;" + results = request.dbsession.execute(query) + return results.fetchall() + +def get_solde_reel(request,cd_cli): + query = "SELECT p.encours + e.encours_societe + e.credit - e.mtval as CREDIT FROM eleves e INNER JOIN permis p ON e.permis_demande=p.cat WHERE e.cd_cli=:cd_cli;" + results = request.dbsession.execute(query,{"cd_cli":cd_cli}) + return results.first() + +def get_examen_reference(request,cd_cli): + query = """CALL spGet_TARIFS_byFAM('EXA',:cd_cli,0);""" + results = request.dbsession.execute(query,{'cd_cli':cd_cli}) + return results.fetchall() + +def get_eleve_max_lettre(request,cd_cli): + query = """SELECT MAX(lettre) as maxlettre FROM eleves_cpt WHERE cd_cli= :cd_cli;""" + results = request.dbsession.execute(query,{'cd_cli':cd_cli}) + return results.first() + +def update_eleve_lettre(request,no_ligne,lettre): + query = """ UPDATE eleves_cpt SET lettre=:lettre WHERE no_ligne=:no_ligne ;""" + execute_query(request, query, {"lettre":lettre,"no_ligne":no_ligne}) + +def update_eleve_delettre(request,cd_cli,lettre,modif_le): + query = """ UPDATE eleves_cpt SET lettre = 0 , modif_le = :modif_le WHERE cd_cli = :cd_cli AND lettre = :lettre""" + execute_query(request, query, {"lettre":lettre,"cd_cli":cd_cli,'modif_le':modif_le}) + +def eleve_auto_lettre(request,cd_cli): + query = """CALL spUPD_ELEVES_LETTRER(:cd_cli)""" + request.dbsession.execute(query, {"cd_cli":cd_cli}) + +def call_proc_eleve_credit(request,no_ligne,cd_cli,date,mode_regle,intitule,credit,mt1,mt2,mt3,mtval,agence,cd_uti): + query = """CALL spUpd_ELEVES_CREDIT(:no_ligne,:cd_cli,:date,:mode_regle,:intitule,:credit,:mt1,:mt2,:mt3,:mtval,:agence,:cd_uti) ;""" + execute_query(request, query, { + 'no_ligne':no_ligne, + 'cd_cli':cd_cli, + 'date':date, + 'mode_regle':mode_regle, + 'intitule':intitule, + 'credit':credit, + 'mt1':mt1, + 'mt2':mt2, + 'mt3':mt3, + 'mtval':mtval, + 'agence':agence, + 'cd_uti':cd_uti + }) + +def call_proc_eleve_debit(request,no_ligne,cd_cli,date,ref,intitule,qte,debit,dateval,mtval,compte,statut,circuit,agence,cd_uti): + query = """CALL spUpd_ELEVES_DEBIT(:no_ligne,:cd_cli,:date,:ref,:intitule,:qte,:debit,:dateval,:mtval,:compte,:statut,:circuit,:agence,:cd_uti) ;""" + execute_query(request, query, { + 'no_ligne':no_ligne, + 'cd_cli':cd_cli, + 'date':date, + 'ref':ref, + 'intitule':intitule, + 'qte':qte, + 'debit':debit, + 'dateval':dateval, + 'mtval':mtval, + 'compte':compte, + 'statut':statut, + 'circuit':circuit, + 'agence':agence, + 'cd_uti':cd_uti + }) + +def debit_eleve_inscription(request, cd_cli, formule, agence, cd_uti): + query = "CALL spINS_ELEVES_DEBIT_INSCRIPTION(:formule, :cd_cli, NOW(),:agence, :cd_uti)" + execute_query(request, query, {'cd_cli': cd_cli, 'formule': formule, 'agence':agence, 'cd_uti':cd_uti}) + return cd_cli + +def delete_eleve_inscription(request, cd_cli, formule): + query = "CALL spDEL_ELEVES_DEBIT_INSCRIPTION(:formule, :cd_cli, NOW(),0, '')" + execute_query(request, query, {'cd_cli': cd_cli, 'formule': formule}) + return cd_cli \ No newline at end of file diff --git a/aem_gestion/models/examens.py b/aem_gestion/models/examens.py new file mode 100644 index 0000000..7737de6 --- /dev/null +++ b/aem_gestion/models/examens.py @@ -0,0 +1,113 @@ +# -*- coding: utf8 -*- +from sqlalchemy import text +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import ( + scoped_session, + sessionmaker, +) + +from zope.sqlalchemy import ZopeTransactionExtension, mark_changed + +from datetime import * +import transaction + +from .default import ( + execute_query, +) + +def to_int(x): + try: + number = int(x.replace(',', '.')) + return number + except ValueError: + return 0 + +def get_examens_byDate(request, datedeb, permis): + # lire les examens à partir de datedeb + query = "SELECT * FROM `examens` WHERE date >= :datedeb AND permis = :permis ORDER BY date, heure;" + results = request.dbsession.execute(query, {'datedeb': datedeb, 'permis': permis}).fetchall() + return results + +def get_examens_aff(request, date, no_exa): + # lire les examens à partir de datedeb + query = """ +SELECT a.*, e.NOM_JF, e.filiere, e.TR_T_OK, e.TEL, e.TEL2, e.TEL3, e.TEL4 +FROM examens_aff a INNER JOIN eleves e ON a.cd_cli = e.cd_cli +WHERE a.date = :date AND a.no_exa= :no_exa;""" + results = request.dbsession.execute(query, {'date': date, 'no_exa': no_exa}).fetchall() + return results + +def get_examens(request, date, no_exa): + # lire l'examen + query = "SELECT * FROM examens WHERE date = :date AND no_exa= :no_exa;" + results = request.dbsession.execute(query, {'date': date, 'no_exa': no_exa}).first() + return results + + +def get_examens_aff_color(request, row): + # lire les inscrits provisoires 80 + query = "SELECT * FROM examens_aff WHERE date = :date AND no_exa= :no_exa AND agence= :agence AND cd_cli = 80;" + results = request.dbsession.execute(query, {'date': row.DATE, 'no_exa': row.NO_EXA, 'agence': row.AGENCE}).first() + if results: + return 'Gold' + # lire les inscrits provisoires + query = "SELECT * FROM examens_aff WHERE date = :date AND no_exa= :no_exa AND agence= :agence AND cd_cli < 100000;" + results = request.dbsession.execute(query, {'date': row.DATE, 'no_exa': row.NO_EXA, 'agence': row.AGENCE}).first() + if results: + return 'Tomato' + + # déterminer la couleur de l'event + if row.VALIDE == 1: + color = 'LightGreen' # planning validé = vert pale + elif row.INSCRITS > 0 : + color = "LightYellow" # disponible + else: + color = "LightBlue" # complet + + return color + +def get_eleves_by_neph(request, neph): + # lire l'eleve par son no d'immatricualtion + query = """SELECT * FROM eleves WHERE dossier_no=:neph AND statut < 10;""" + results = request.dbsession.execute(query, {'neph': neph}).first() + return results + +def get_next_cepc(request, cd_cli, dateexa): + # lire le dernier CEPC uploadé + query = "SELECT * FROM eleves_upload WHERE cd_cli=:cd_cli AND code LIKE 'CEPC%' ORDER BY code DESC;" + results = request.dbsession.execute(query, {'cd_cli': cd_cli}).first() + if results: + if results.nom_fic.find(dateexa) > 0: + # cet examen est déjà mis à jour + code = "" + else: + # incrementer le code (dernier chiffre) + code = 'CEPC' + str(int(results.code[-1]) + 1) + else: + code = 'CEPC1' + return code + +def insert_eleve_cepc(request, cd_cli, next_code, filename, filesize, logged_in): + + query = """INSERT INTO eleves_upload (cd_cli, code, type, nom_fic, taille_fic, cd_uti) VALUES + (:cd_cli, :next_code, 'DOC', :filename, :filesize, :logged_in)""" + execute_query(request, query, {'cd_cli': cd_cli, 'next_code': next_code, 'filename': filename, 'filesize': filesize, 'logged_in': logged_in}) + +def update_resultat(request, cd_cli, date_exa, resultat_exa, logged_in): + # maj le statut de l'examen de l'élève + query ="""UPDATE examens_aff SET + resultat = :resultat_exa, + reussite = (SELECT COALESCE(reussite,2) FROM P_STATUTS_EXAM WHERE code=:resultat_exa), + cd_uti = :logged_in + WHERE cd_cli = :cd_cli AND date = :date_exa; """ + execute_query(request, query, {'cd_cli': cd_cli, 'resultat_exa': resultat_exa, 'date_exa': date_exa, 'logged_in': logged_in}) + +def get_examens_maj(request, logged_in): + # lire les examens mis à jour aujourd'hui + query = """SELECT a.*, s.libelle +FROM examens_aff a INNER JOIN p_statuts_exam s ON a.resultat = s.code +WHERE a.cd_uti = :logged_in AND date(a.modif_le) = CURRENT_DATE();""" + results = request.dbsession.execute(query, {'logged_in': logged_in}).fetchall() + return results + + \ No newline at end of file diff --git a/aem_gestion/models/parametres.py b/aem_gestion/models/parametres.py new file mode 100644 index 0000000..3e054af --- /dev/null +++ b/aem_gestion/models/parametres.py @@ -0,0 +1,570 @@ +# -*- coding: utf8 -*- +from sqlalchemy import text +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import ( + scoped_session, + sessionmaker, +) + +from zope.sqlalchemy import ZopeTransactionExtension, mark_changed + +import datetime +import transaction + +from .default import ( + execute_query, +) + +def get_faqs(request, faq_id): + """Lire les FAQ""" + if faq_id == 0: + query = "SELECT * FROM p_faq ORDER BY theme, intitule;" + results = request.dbsession.execute(query).fetchall() + elif faq_id == -1: + query = "SELECT * FROM p_faq where theme != 'INTERNE' ORDER BY theme, intitule;" + results = request.dbsession.execute(query).fetchall() + else: + query = "SELECT * FROM p_faq where faq_id = :faq_id;" + results = request.dbsession.execute(query, {'faq_id': faq_id}).first() + return results + +def update_faq(request, faq_id, intitule, texte, theme): + """créér ou modifier la FAQ""" + if faq_id == '0': + query = "INSERT INTO p_faq (intitule, texte, theme) VALUES(:intitule, :texte, :theme);" + execute_query(request, query, {'intitule': intitule, 'texte': texte, 'theme': theme}) + else: + query = "update p_faq set intitule=:intitule, texte=:texte, theme=:theme where faq_id = :faq_id;" + execute_query(request, query, {'faq_id': faq_id, 'intitule': intitule, 'texte': texte, 'theme': theme}) + +def delete_faq(request, faq_id): + """supprimer la FAQ""" + query = "delete from p_faq where faq_id = :faq_id;" + execute_query(request, query, {'faq_id': faq_id}) + +def get_last_payments(request, ): + """Lire les 50 derniers paiements par carte bancaire""" + query = """SELECT tickets_cb.*, eleves.nom FROM tickets_cb + INNER JOIN eleves ON eleves.cd_cli = tickets_cb.cd_cli ORDER BY date DESC LIMIT 10;""" + results = request.dbsession.execute(query, {}) + return results.fetchall() + +def get_eleves_by_last_connection(request, ): + # lire les donnees de l'eleve + query = """SELECT dern_cnx_le,CD_CLI,CIVILITE,NOM,PERMIS_DEMANDE,FORMULE,STATUT,device_used +FROM eleves ORDER BY dern_cnx_le DESC LIMIT 10;""" + results = request.dbsession.execute(query, ) + return results.fetchall() + +def update_user(request, cd_uti, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if param == 'nom': + new_values['nom'] = new_values['nom'].title() + if param == 'cd_mon': + new_values['cd_mon'] = new_values['cd_mon'].upper() + if param == 'secu': + ' secu = le 1er caractère' + new_values['secu'] = new_values['secu'][0] + if param == 'agence': + ' agence = le 1er caractère' + new_values['agence'] = new_values['agence'][0] + + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if cd_uti == '0': + query = "INSERT INTO p_users SET %s" % s + else: + new_values['cd_uti'] = cd_uti + query = "UPDATE p_users SET %s WHERE cd_uti = :cd_uti;" % s + execute_query(request, query, new_values) + +def update_moniteur(request, cd_mon, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if param == 'NOM': + new_values['NOM'] = new_values['NOM'].upper() + if param == 'PLANNING': + new_values['PLANNING'] = new_values['PLANNING'].upper() + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if cd_mon == '0': + query = "INSERT INTO moniteurs SET %s" % s + else: + new_values['CD_MON'] = cd_mon.upper() + query = "UPDATE moniteurs SET %s WHERE CD_MON = :CD_MON;" % s + execute_query(request, query, new_values) + +def update_moniteur_aff(request,no_ligne, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if no_ligne == '0': + query = "INSERT INTO moniteurs_aff SET %s" % s + else: + query = "UPDATE moniteurs_aff SET %s WHERE no_ligne = :no_ligne;" % s + execute_query(request, query, new_values) + +def delete_user(request, cd_uti): + query = "DELETE FROM p_users WHERE cd_uti = :cd_uti ;" + execute_query(request, query, {'cd_uti': cd_uti}) + +def delete_moniteur(request, cd_mon): + query = "DELETE FROM moniteurs WHERE cd_mon = :cd_mon ;" + execute_query(request, query, {'cd_mon': cd_mon}) + +def delete_moniteur_aff(request, no_ligne): + query = "DELETE FROM moniteurs_aff WHERE no_ligne = :no_ligne ;" + execute_query(request, query, {'no_ligne': no_ligne}) + +def import_tables(request, table, items, code): + if table == 'PAYS': + # Vider la table + query = "TRUNCATE TABLE ws_pays;" + execute_query(request, query, {}) + + for pays in items: + query = "INSERT INTO ws_pays (pays) VALUES (:pays);" + execute_query(request, query, {'pays': pays}) + elif table == 'COMMUNES': + for commune in items: + query = "REPLACE INTO ws_communes (dept, commune) VALUES (:code, :commune);" + execute_query(request, query, {'code': code, 'commune': commune}) + else: + # Vider la table + query = "TRUNCATE TABLE ws_departements;" + execute_query(request, query, {}) + + for item in items: + query = "INSERT INTO ws_departements (code,nom) VALUES (:code, :nom);" + execute_query(request, query, {'code': item.code, 'nom': item.nom}) + +def get_last_emailing(request, table): + """Lire les 200 derniers envois d'emails""" + if table == 'RESERVATIONS': + query = "SELECT r.*, e.email FROM email_resa r INNER JOIN eleves e ON r.cd_cli = e.cd_cli GROUP BY r.cd_cli, date(r.cree_le) ORDER BY no_id DESC LIMIT 400;" + else: + query = "SELECT r.*, e.email FROM email_rappels r INNER JOIN eleves e ON r.cd_cli = e.cd_cli ORDER BY no_id DESC LIMIT 400;" + + results = request.dbsession.execute(query, {}) + return results.fetchall() + +def get_last_7days_cnx(request, ): + # lire les dernières connexions + query = """SELECT date(dern_cnx_le) as date, count(*) as nb FROM eleves WHERE dern_cnx_le BETWEEN NOW() - INTERVAL 10 DAY AND NOW() +GROUP BY date(dern_cnx_le) ORDER BY dern_cnx_le""" + results = request.dbsession.execute(query, ) + return results.fetchall() + +def get_last_7days_paymnt(request, ): + # lire les dernières paiements + query = """SELECT date(date) as date, count(*) as nb FROM tickets_cb WHERE date BETWEEN NOW() - INTERVAL 10 DAY AND NOW() +GROUP BY date(date) ORDER BY date;""" + results = request.dbsession.execute(query, ) + return results.fetchall() + +def get_log_nuit(request, ): + # lire le log de nuit + query = """SELECT * FROM t_log_nuit;""" + results = request.dbsession.execute(query, ) + return results.fetchall() + +def get_charts_data(request, chart_id, group1): + # lire les data + query = "SELECT * FROM charts_data WHERE id=:chart_id AND group1=:group1;""" + results = request.dbsession.execute(query, {'chart_id': chart_id, 'group1': group1}) + return results.fetchall() + +def get_charts_exam1(request, agence): + # lire les examens sur 12 mois glissants par agence + today = datetime.date.today() + + query = """SELECT * FROM ( + SELECT * FROM bd_aem.charts_data where id='examens01' and group1 < :mois and group2=:agence order by group1 desc limit 12) t + ORDER BY group1;""" + results = request.dbsession.execute(query, {'mois': today.strftime("%Y%m"), 'agence': agence}) + return results.fetchall() + +def get_charts_exam2(request, datedeb, datefin, cd_mon): + # lire les examens sur 12 mois glissants par moniteur + query = """SELECT * FROM bd_aem.charts_data + WHERE id='exams_mon' AND group1 >= :datedeb AND group1 < :datefin AND group2=:cd_mon order by group1;""" + results = request.dbsession.execute(query, {'datedeb': datedeb.strftime("%Y%m"), 'datefin': datefin.strftime("%Y%m"), 'cd_mon': cd_mon}) + return results.fetchall() + +def get_charts_exam2_mon(request, datedeb, datefin): + query = """SELECT group2, group2_lib FROM bd_aem.charts_data + WHERE id='exams_mon' AND group1 >= :datedeb AND group1 < :datefin GROUP BY group2 ORDER BY group2_lib;""" + results = request.dbsession.execute(query, {'datedeb': datedeb.strftime("%Y%m"), 'datefin': datefin.strftime("%Y%m")}) + return results.fetchall() + +def get_inscriptions(request, table): + if table == 'PAP': + """ Lire toutes les commandes PAP encours """ + query = """SELECT l.cree_le, l.cd_cli, l.nom, s.debut, e.credit-e.debit as solde, l.valide, l.cd_uti,l.groupe,l.fin_reservation + FROM bd_aem.pla_stage_lignes l + INNER JOIN eleves e on e.cd_cli = l.cd_cli + INNER JOIN pla_stage s on s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe + where l.type='C' and s.fin >= CURRENT_DATE() + order by s.debut, l.nom desc;""" + elif table == 'PEM125': + query = """SELECT l.cree_le, l.cd_cli, l.nom, s.debut, e.credit-e.debit as solde, l.valide, l.cd_uti,l.groupe,l.fin_reservation + FROM bd_aem.pla_stage_lignes l + INNER JOIN eleves e on e.cd_cli = l.cd_cli + INNER JOIN pla_stage s on s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe + where l.type='M' and s.fin >= CURRENT_DATE() and s.libelle like '%pem%' + order by s.debut, l.nom desc;""" + elif table == 'PASA2': + query = """SELECT l.cree_le, l.cd_cli, l.nom, s.debut, e.credit-e.debit as solde, l.valide, l.cd_uti,l.groupe,l.fin_reservation + FROM bd_aem.pla_stage_lignes l + INNER JOIN eleves e on e.cd_cli = l.cd_cli + INNER JOIN pla_stage s on s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe + where l.type='M' and s.fin >= CURRENT_DATE() and s.libelle like 'pas%' + order by s.debut, l.nom desc;""" + else: + # stage B96 + query = """SELECT l.cree_le, l.cd_cli, l.nom, s.debut, e.credit-e.debit as solde, l.valide, l.cd_uti,l.groupe,l.fin_reservation + FROM bd_aem.pla_stage_lignes l + INNER JOIN eleves e on e.cd_cli = l.cd_cli + INNER JOIN pla_stage s on s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe + where l.type='B' and s.fin >= CURRENT_DATE() and l.groupe ='G' + order by s.debut, l.nom desc;""" + + results = request.dbsession.execute(query).fetchall() + return results + +def get_pass_rousseau(request): + # lire les pass rousseau + query = """SELECT * FROM pass_rousseau;""" + results = request.dbsession.execute(query, ) + return results.fetchall() + +def update_type_devis(request, type_devis, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if type_devis == '0': + query = "INSERT INTO p_types_devis SET %s" % s + else: + new_values['type_devis'] = type_devis + query = "UPDATE p_types_devis SET %s WHERE type_devis = :type_devis;" % s + execute_query(request, query, new_values) + +def delete_type_devis(request, type_devis): + query = "DELETE FROM p_types_devis WHERE type_devis = :type_devis ;" + execute_query(request, query, {'type_devis': type_devis}) + +def get_tarifs(request, ref): + """Lire les tarifs""" + if ref == '0': + query = "SELECT * FROM tarifs ORDER BY ref;" + results = request.dbsession.execute(query).fetchall() + else: + query = "SELECT * FROM tarifs where ref = :ref;" + results = request.dbsession.execute(query, {'ref': ref}).first() + return results + +def get_formules(request, formule, validite): + """Lire les formules""" + if formule == '0': + if validite == 'TOUTES': + query = "SELECT * FROM formules ORDER BY formule;" + else: + query = "SELECT * FROM formules WHERE DateFin >= CURRENT_DATE ORDER BY formule;" + results = request.dbsession.execute(query).fetchall() + else: + query = "SELECT * FROM formules where formule = :formule;" + results = request.dbsession.execute(query, {'formule': formule}).first() + return results + +def get_justifs(request, code): + """Lire les justifs""" + query = "SELECT * FROM p_justifs WHERE code = :code;" + results = request.dbsession.execute(query, {'code': code}).first() + return results + +def get_justifsByType(request, type): + """Lire les justifs""" + query = "SELECT * FROM p_justifs WHERE type=:type ORDER BY conditions;" + results = request.dbsession.execute(query, {'type': type}).fetchall() + return results + +def get_permis(request, cat): + """Lire les permis""" + if cat == '0': + query = "SELECT * FROM permis ORDER BY cat;" + results = request.dbsession.execute(query).fetchall() + else: + query = "SELECT * FROM permis where cat = :cat;" + results = request.dbsession.execute(query, {'cat': cat}).first() + return results + +def update_activite(request, cd_cli, new_values): + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + if cd_cli == '0': + query = "INSERT INTO eleves SET %s " % s + else: + query = "UPDATE eleves SET %s WHERE CD_CLI=:CD_CLI" % s + new_values['CD_CLI'] = cd_cli + execute_query(request, query, new_values) + +def delete_activite(request, cd_cli): + query = "DELETE FROM eleves WHERE CD_CLI=:cd_cli" + execute_query(request, query, {'cd_cli':cd_cli}) + +def get_permis_justifs(request, cat, code): + """Lire les justifs du permis""" + if code == '0': + query = """SELECT p.*, j.libelle, j.conditions FROM permis_justifs p INNER JOIN p_justifs j ON p.code = j.code + WHERE CAT=:cat ORDER BY no_tri;""" + results = request.dbsession.execute(query, {'cat': cat}).fetchall() + else: + query = """SELECT p.*, j.libelle, j.conditions FROM permis_justifs p INNER JOIN p_justifs j ON p.code = j.code + WHERE p.CAT=:cat AND p.CODE=:code;""" + results = request.dbsession.execute(query, {'cat': cat, 'code': code}).first() + return results + +def get_tarifs_byFam(request, famille): + """Lire les tarifs par famille""" + query = "SELECT * FROM tarifs where fam = :famille order by ref;" + results = request.dbsession.execute(query, {'famille': famille}).fetchall() + return results + +def get_p_tables(request, table): + query = "CALL spGet_P_TABLES_byCODE(:table, 0);" + results = request.dbsession.execute(query, {'table': table}).fetchall() + return results + +def update_tarif(request, ref, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if param == 'LIB': + new_values['LIB'] = new_values['LIB'].upper() + if param == 'COMPTE': + new_values['COMPTE'] = new_values['COMPTE'].split('|')[0] + if param == 'CTVA': + ' CTVA = le 1er caractère' + new_values['CTVA'] = new_values['CTVA'][0] + if param == 'FAM': + ' famille = le 1er caractère' + new_values['FAM'] = new_values['FAM'][0] + + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if ref == '0': + query = "INSERT INTO tarifs SET %s" % s + else: + new_values['ref'] = ref + query = "UPDATE tarifs SET %s WHERE ref = :ref;" % s + execute_query(request, query, new_values) + +def delete_tarif(request, ref): + query = "DELETE FROM tarifs WHERE ref = :ref ;" + execute_query(request, query, {'ref': ref}) + +def update_permis(request, cat, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if param == 'LIB': + new_values['LIB'] = new_values['LIB'].upper() + + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if cat == '0': + query = "INSERT INTO permis SET %s" % s + else: + new_values['cat'] = cat + query = "UPDATE permis SET %s WHERE cat = :cat;" % s + execute_query(request, query, new_values) + +def delete_permis(request, cat): + query = "DELETE FROM permis WHERE cat = :cat ;" + execute_query(request, query, {'cat': cat}) + +def delete_formule(request, formule): + query = "DELETE FROM formules WHERE formule = :formule ;" + execute_query(request, query, {'formule': formule}) + +def delete_justif(request, code): + query = "DELETE FROM p_justifs WHERE code = :code ;" + execute_query(request, query, {'code': code}) + +def update_justif(request, code, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if code == '0': + query = "INSERT INTO p_justifs SET %s" % s + else: + new_values['code'] = code + query = "UPDATE p_justifs SET %s WHERE code = :code;" % s + execute_query(request, query, new_values) + +def update_semaine_type(request, code, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if code == '0': + query = "INSERT INTO p_semaines SET %s" % s + else: + new_values['CODE_SEM'] = code + query = "UPDATE p_semaines SET %s WHERE CODE_SEM = :CODE_SEM;" % s + execute_query(request, query, new_values) + +def get_semaine_type_activity(request,code_sem): + query = "SELECT * FROM p_semaines WHERE CODE_SEM = :code" + query2 = "SELECT * FROM p_semaine_type WHERE CODE_SEM = :code" + results = request.dbsession.execute(query, {'code': code_sem}) + results2 = request.dbsession.execute(query2, {'code': code_sem}) + return results.first(),results2.fetchall() + +def delete_semaine_type(request,code_sem): + query = "DELETE FROM p_semaines WHERE CODE_SEM = :code ;" + execute_query(request, query, {'code': code_sem}) + +def duplicate_semaine_type(request,code_sem,logged_in): + query = " CALL spINS_SEMAINE_DUP(:code_sem,:logged_in)" + execute_query(request, query, {'code_sem': code_sem,'logged_in':logged_in}) + +def get_all_activites(request): + query = "SELECT * FROM `eleves` WHERE AGENCE=0 AND (PERMIS_DEMANDE='ACTIV' OR PERMIS_DEMANDE='A' OR PERMIS_DEMANDE='A2' OR PERMIS_DEMANDE='B')" + results = request.dbsession.execute(query).fetchall() + return results + +def get_activite_by_code(request, cd_cli): + # lire l'eleve connecte + query = """SELECT * FROM eleves WHERE cd_cli=:cd_cli;""" + results = request.dbsession.execute(query, {'cd_cli': cd_cli}).first() + return results + +def update_semaine_type_activity(request,new_values): + result = None + s = '' + no_ligne = new_values['no_ligne'] + del new_values['no_ligne'] + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param).s + if no_ligne == '' : + query = """ INSERT INTO p_semaine_type SET %s """ % s + """;""" + execute_query(request,query,new_values) + query2 = "SELECT MAX(no_ligne) as no_ligne from p_semaine_type;" + result = request.dbsession.execute(query2,new_values).fetchone() + mark_changed(request.dbsession, keep_session=True) + transaction.commit() + else: + query = """ UPDATE p_semaine_type SET %s WHERE no_ligne = :no_ligne; """ % s + new_values['no_ligne'] = no_ligne + execute_query(request,query,new_values) + return result + + +def delete_semaine_type_activity(request,no_ligne): + query = "DELETE FROM p_semaine_type WHERE no_ligne = :no_ligne ;" + execute_query(request, query, {'no_ligne': no_ligne}) + +def duplicate_semaine_type_activity(request,no_ligne,qte,logged_in): + query = " CALL spINS_SEMAINE_DUP_ACTIVITY( :no_ligne, :qte, :logged_in) ;" + execute_query(request,query,{'no_ligne':no_ligne,'qte':qte,'logged_in':logged_in}) + +def update_agence(request, code, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + new_values['code'] = code + query = "UPDATE p_agences SET %s WHERE code = :code;" % s + execute_query(request, query, new_values) + +def delete_permis_justif(request, cat, code): + query = "DELETE FROM permis_justifs WHERE cat = :cat AND code = :code;" + execute_query(request, query, {'cat': cat, 'code': code}) + +def insert_permis_justif(request, cat, code): + query = "INSERT INTO permis_justifs (`CAT`, `CODE`) VALUES (:cat, :code);" + execute_query(request, query, {'cat': cat, 'code': code}) + +def update_permis_justif(request, cat, code, no_tri): + query = "UPDATE permis_justifs SET no_tri=:no_tri WHERE CAT = :cat AND CODE = :code;" + execute_query(request, query, {'cat': cat, 'code': code, 'no_tri': no_tri}) + +def get_permis_justifs_manquant(request, cat): + """Lire les justifs non encore ajouté dans permis""" + + query = """SELECT j.* FROM p_justifs j LEFT JOIN permis_justifs p ON j.code = p.code AND p.cat = :cat +WHERE j.type = 'JUST' AND p.code IS null;""" + results = request.dbsession.execute(query, {'cat': cat}).fetchall() + + return results + +def update_formule(request, formule, new_values): + # formater les champs + s = '' + for param in new_values.keys(): + if param == 'LIBELLE': + new_values['LIBELLE'] = new_values['LIBELLE'].upper() + + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + if formule == '0': + query = "INSERT INTO formules SET %s;" % s + else: + new_values['formule'] = formule + query = "UPDATE formules SET %s WHERE formule = :formule;" % s + execute_query(request, query, new_values) + +def get_all_semaines_type(request): + query = "SELECT * FROM `p_semaines` ORDER BY `p_semaines`.`CODE_SEM` DESC"; + results = request.dbsession.execute(query) + return results.fetchall() + diff --git a/aem_gestion/models/planning.py b/aem_gestion/models/planning.py new file mode 100644 index 0000000..3a9190d --- /dev/null +++ b/aem_gestion/models/planning.py @@ -0,0 +1,655 @@ +# -*- coding: utf8 -*- +from datetime import * +from dateutil.relativedelta import * + +from .default import ( + execute_query, + update_eleve_solde, +) + +def get_rendez_vous_moniteur(request, agence, cd_mon, datedeb, datefin): + + # lire les rdv de l'ITC + query = """ +SELECT c.DATE, c.noplan, c.qte, c.nom, c.cd_cli, c.no_ligne, c.date_valeur, c.ref, c.statut, c.comment, c.lieu_rdv, c.circuit, c.fin_reservation, e.NOM_ENTREPRISE +FROM eleves_cpt c INNER JOIN eleves e ON c.cd_cli = e.cd_cli +WHERE c.agence=:agence AND c.date >= :datedeb AND c.date <= :datefin AND c.cd_mon=:cd_mon AND c.noplan AND c.qte +ORDER BY c.agence, c.date, c.noplan;""" + results = request.dbsession.execute( + query, {'agence': agence, 'datedeb': datedeb, 'datefin': datefin, 'cd_mon': cd_mon}).fetchall() + return results + +def get_rendez_vous_annules(request, agence, cd_mon, datedeb, datefin): + + # lire les rdv annulés + query = """ +SELECT c.DATE, c.noplan, c.qte, c.nom, c.cd_cli, c.no_ligne, c.ref, c.statut, c.comment, c.cd_uti, c.circuit, c.intitule, e.NOM_ENTREPRISE +FROM eleves_cpt c INNER JOIN eleves e ON c.cd_cli = e.cd_cli +WHERE c.agence=:agence AND c.date >= :datedeb AND c.date <= :datefin AND c.cd_cli > 100000 AND c.cd_mon=:cd_mon AND c.intitule LIKE "%h annulé%" AND c.qte=0 +ORDER BY c.agence, c.date;""" + results = request.dbsession.execute( + query, {'agence': agence, 'datedeb': datedeb, 'datefin': datefin, 'cd_mon': cd_mon}).fetchall() + return results + +def get_rendezvous_by_noligne(request, no_ligne): + # lire le rdv B + query = """ +SELECT c.*, e.TYPE_ENTREPRISE, e.NOM_ENTREPRISE +FROM eleves_cpt c INNER JOIN eleves e ON c.cd_cli = e.cd_cli +WHERE c.no_ligne = :no_ligne;""" + results = request.dbsession.execute(query, {'no_ligne': no_ligne}).first() + return results + +def get_statuts_lecon(request): + query = "CALL spGet_P_TABLES_byCODE('P_STATUTS_LECON', 0);" + results = request.dbsession.execute(query).fetchall() + return results + +def update_rdvb(request, no_ligne, old_cd_cli, cd_cli, date, heure, qte, ref, cd_mon, agence, comment, statut, typeHeure, nDelai, cd_cli_old, cd_uti): + query = "CALL spUpd_PLANNING_B(:no_ligne,:old_cd_cli,:cd_cli,:date,:heure,:qte,:ref,:cd_mon,:agence,0,:comment,:statut,:typeHeure,:nDelai,:cd_cli_old,:cd_uti);" + execute_query(request, query, {'no_ligne': no_ligne, 'old_cd_cli': old_cd_cli, 'cd_cli': cd_cli, 'date': date, 'heure': heure, 'qte': qte, 'ref': ref, + 'cd_mon': cd_mon, 'agence': agence, 'comment': comment, 'statut': statut, 'typeHeure': typeHeure, + 'nDelai': nDelai, 'cd_cli_old': cd_cli_old, 'cd_uti': cd_uti}) + + query = "CALL spUpd_PLANNING_B_VALORISER(:cd_cli);" + execute_query(request, query, {'cd_cli': cd_cli}) + update_eleve_solde(request, cd_cli) + +def delete_eleve_cpt(request, no_ligne, cd_cli, noplan, statut, cd_uti): + query = "UPDATE eleves_cpt SET ref=NULL,debit=0,mtval=0,qte=0,noplan=0,fin_reservation=NULL,intitule='RDV de :noplan h annulé (:statut)', cd_uti=:cd_uti WHERE no_ligne=:no_ligne;" + execute_query(request, query, { + 'no_ligne': no_ligne, 'noplan': noplan, 'statut': statut, 'cd_uti': cd_uti}) + + query = "CALL spUpd_PLANNING_B_VALORISER(:cd_cli);" + execute_query(request, query, {'cd_cli': cd_cli}) + update_eleve_solde(request, cd_cli) + +def validate_rdvb(request, no_ligne): + query = """ UPDATE eleves_cpt SET DATE_VALEUR=CURRENT_DATE() WHERE no_ligne=:no_ligne """ + execute_query(request, query, {'no_ligne': no_ligne}) + +def get_pla_stage_by_semaine(request, type_stage, semaine, groupe): + query = "SELECT * FROM pla_stage WHERE TYPE=:type AND SEMAINE=:semaine AND GROUPE=:groupe;" + results = request.dbsession.execute( + query, {"semaine": semaine, 'groupe': groupe, 'type': type_stage}).first() + return results + +def get_pla_moto_by_date(request, type_stage, groupe, date): + query = "SELECT * FROM pla_moto WHERE TYPE=:type AND DATE=:date AND GROUPE=:groupe;" + results = request.dbsession.execute( + query, {"date": date, 'groupe': groupe, 'type': type_stage}).first() + return results + +def get_pla_moto_ligne_by_date(request, type_stage, groupe, date, cd_cli): + query = "SELECT * FROM pla_moto_lignes WHERE TYPE=:type AND DATE=:date AND GROUPE=:groupe AND CD_CLI=:cd_cli;" + results = request.dbsession.execute( + query, {"date": date, 'groupe': groupe, 'type': type_stage, 'cd_cli': cd_cli}).first() + return results + +def insert_pla_stage(request, new_values): + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + query = "INSERT pla_stage SET %s ;" % s + execute_query(request, query, new_values) + +def insert_pla_moto(request, new_values): + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + query = "INSERT pla_moto SET %s ;" % s + execute_query(request, query, new_values) + +def duplicate_pla_moto_by_semaine(request, type_stage, start, dest, cd_uti): + query = "CALL spDUPP_PLA_MOTO_byWEEK(:type,:start,:dest,:cd_uti);" + execute_query(request, query, { + 'type': type_stage, 'start': start, 'dest': dest, 'cd_uti': cd_uti}) + + +def update_pla_stage(request, new_values, type_stage, semaine, groupe): + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + new_values['TYPE'] = type_stage + new_values['SEMAINE'] = semaine + new_values['GROUPE'] = groupe + query = "UPDATE pla_stage SET %s WHERE SEMAINE=:SEMAINE AND TYPE=:TYPE AND GROUPE=:GROUPE;" % s + execute_query(request, query, new_values) + + +def update_pla_motos(request, type_stage, date, groupe, new_values): + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + new_values['TYPE'] = type_stage + new_values['DATE'] = date + new_values['GROUPE'] = groupe + query = "UPDATE pla_moto SET %s WHERE DATE=:DATE AND TYPE=:TYPE AND GROUPE=:GROUPE;" % s + execute_query(request, query, new_values) + # results = request.dbsession.execute(query,new_values) + # return results + +def update_motos_lig(request, no_ligne, new_values): + s = '' + for param in new_values.keys(): + if param == "STATUT": + new_values['STATUT'] = int(new_values['STATUT']) + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + new_values['no_ligne'] = no_ligne + query = "UPDATE pla_moto_lignes SET %s WHERE no_ligne=:no_ligne" % s + execute_query(request, query, new_values) + +def update_motos_lig_avec_control(request, params): + query1 = "CALL spUpd_PLA_MOTO_LIG(:TYPE, :DATE, :GROUPE,:OLD_CD_CLI, :CD_CLI, :STATUT, :LIEU,:COMMENT, :QTE, :REF, :Route ,:AGENCE, :SOLDE, :LIGNE_CPT, :CD_UTI)" + execute_query(request, query1, params) + if params['TYPE'] == "E": + query_val = "CALL spUpd_PLANNING_B_VALORISER(:CD_CLI)" + else: + query_val = "CALL spUpd_PLANNING_A_VALORISER(:CD_CLI, :REF);" + execute_query(request, query_val, params) + +def insert_motos_lig(request, new_values): + s = '' + for param in new_values.keys(): + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + query = "INSERT INTO pla_moto_lignes SET %s ;" % s + execute_query(request, query, new_values) + +def update_motos_lig_circuit(request, type, date, cd_cli, cd_circuit): + # maj le code moniteur circuit + query = "UPDATE pla_moto_lignes SET cd_circuit = :cd_circuit WHERE type = :type and date = :date and cd_cli = :cd_cli AND valide = 'N';" + execute_query(request, query, { + 'type': type, 'date': date, 'cd_cli': cd_cli, 'cd_circuit': cd_circuit}) + +def update_motos_lig_cd_mon(request, type, date, cd_cli, cd_mon): + # maj le code moniteur + query = "UPDATE pla_moto_lignes SET cd_mon = :cd_mon WHERE type = :type and date = :date and cd_cli = :cd_cli AND valide = 'N';" + execute_query(request, query, { + 'type': type, 'date': date, 'cd_cli': cd_cli, 'cd_mon': cd_mon}) + +def update_stages_lig(request, no_ligne, new_values, isInsert=False): + type = no_ligne[0:1] + semaine = no_ligne[1:7] + groupe = no_ligne[7:8] + cd_cli = no_ligne[8:14] + s = '' + for param in new_values.keys(): + if param == "STATUT": + new_values['STATUT'] = int(new_values['STATUT']) + if s: + s += ",%s=:%s" % (param, param) + else: + s = "%s=:%s" % (param, param) + + new_values['TYPE'] = type + new_values['SEMAINE'] = semaine + new_values['GROUPE'] = groupe + if isInsert: + # query = "INSERT INTO pla_stage_lignes SET %s ,TYPE=:TYPE,SEMAINE=:SEMAINE,GROUPE=:GROUPE;"% s + query = "CALL spUpd_PLA_STAGE_LIG(:TYPE, :SEMAINE, :GROUPE, 0, :CD_CLI, :NOM, '', :REF, :STATUT, :AGENCE, 0, 0, :CD_UTI)" + else: + new_values['CD_CLI_OLD'] = cd_cli + # query = "UPDATE pla_stage_lignes SET %s WHERE TYPE=:TYPE and SEMAINE=:SEMAINE and GROUPE=:GROUPE and CD_CLI=:CD_CLI_OLD" % s + query = "CALL spUpd_PLA_STAGE_LIG(:TYPE, :SEMAINE, :GROUPE, :CD_CLI_OLD, :CD_CLI, :NOM, '', :REF, :STATUT, :AGENCE, 0, :LIGNE_CPT, :CD_UTI)" + + execute_query(request, query, new_values) + + +def get_stage_lig_by_date(request, type_stage, date_stage, groupe): + # lire toutes les lignes stage + if type_stage == 'M': + query = """ + SELECT l.*, s.debut, s.fin, e.credit-e.debit as solde, e.cree_le, e.h1plateau_le, e.permis_demande, e.formule, e.dossier_date, + CONCAT(e.heures_prises,'/',e.hroute_prises,' h') as heures, e.TR_P_NB, e.TR_R_NB, e.TR_P_DATE, e.TR_R_DATE, e.perime_le FROM pla_stage_lignes l + INNER JOIN pla_stage s ON s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe + INNER JOIN eleves e ON l.cd_cli = e.cd_cli + WHERE l.type = :type_stage AND date(s.debut) <= :date_stage AND s.fin >= :date_stage AND l.groupe=:groupe ORDER BY l.cd_cli;""" + results = request.dbsession.execute( + query, {'type_stage': type_stage, 'date_stage': date_stage, 'groupe': groupe}).fetchall() + elif type_stage == 'B': + # stage B + if groupe == 'A' or groupe == 'B': + query = """ + SELECT l.*, s.debut, s.fin, e.credit-e.debit as solde, e.dossier_date, e.niveau, e.formule, e.filiere, e.nom_entreprise, e.cd_mon AS CD_REF, + CONCAT(e.heures_prises,'/',e.heures_prevues,' h') as heures, e.perime_le FROM pla_stage_lignes l + INNER JOIN pla_stage s ON s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe + INNER JOIN eleves e ON l.cd_cli = e.cd_cli + WHERE l.type = :type_stage AND date(s.debut) <= :date_stage AND s.fin >= :date_stage AND l.groupe IN ('A','B') ORDER BY l.cd_cli;""" + else: + query = """ + SELECT l.*, s.debut, s.fin, e.credit-e.debit as solde, e.dossier_date, e.niveau, e.formule, e.filiere, e.nom_entreprise, e.cd_mon AS CD_REF, + CONCAT(e.heures_prises,'/',e.heures_prevues,' h') as heures, e.perime_le FROM pla_stage_lignes l + INNER JOIN pla_stage s ON s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe + INNER JOIN eleves e ON l.cd_cli = e.cd_cli + WHERE l.type = :type_stage AND date(s.debut) <= :date_stage AND s.fin >= :date_stage AND l.groupe=:groupe ORDER BY l.cd_cli;""" + results = request.dbsession.execute( + query, {'type_stage': type_stage, 'date_stage': date_stage, 'groupe': groupe}).fetchall() + else: + query = """ + SELECT l.*, s.debut, s.fin, e.credit-e.debit as solde, e.cree_le, e.permis_demande, e.formule, e.dossier_date, + CONCAT(e.heures_prises,'/',e.hroute_prises,' h') as heures, e.TR_P_DATE, e.TR_R_DATE, e.perime_le FROM pla_stage_lignes l + INNER JOIN pla_stage s ON s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe + INNER JOIN eleves e ON l.cd_cli = e.cd_cli + WHERE l.type = :type_stage AND date(s.debut) <= :date_stage AND s.fin >= :date_stage AND l.groupe=:groupe ORDER BY l.cd_cli;""" + results = request.dbsession.execute( + query, {'type_stage': type_stage, 'date_stage': date_stage, 'groupe': groupe}).fetchall() + return results + +def get_motos_lig_by_date(request, type, date_stage, groupe): + # lire les planning motos + if groupe == '': + query = """ + SELECT l.*, e.credit-e.debit as solde, e.dossier_date, e.niveau, e.formule, e.filiere, e.nom_entreprise, e.cd_mon, + CONCAT(e.heures_prises,'/',e.hroute_prises,' h') as heures, e.perime_le, e.tr_p_ok FROM pla_moto_lignes l + INNER JOIN eleves e ON l.cd_cli = e.cd_cli + WHERE l.type = :type AND l.date = :date_stage ORDER BY l.cd_cli;""" + else: + query = """ + SELECT l.*, e.credit-e.debit as solde, e.cree_le, e.h1plateau_le, e.permis_demande, e.formule, e.dossier_date, e.nom_entreprise, e.niveau, e.filiere, e.cd_mon, + CONCAT(e.heures_prises,'h - ',e.hroute_prises,'h') as heures, e.TR_P_NB, e.TR_R_NB, e.TR_P_DATE, e.TR_R_DATE, e.perime_le, e.tr_p_ok FROM pla_moto_lignes l + INNER JOIN eleves e ON l.cd_cli = e.cd_cli + WHERE l.type = :type AND l.date = :date_stage AND l.groupe=:groupe ORDER BY l.cd_cli;""" + + results = request.dbsession.execute( + query, {'type': type, 'date_stage': date_stage, 'groupe': groupe}).fetchall() + return results + +def get_motos_lig_by_noligne(request, no_ligne): + # lire les stage B + query = """ +SELECT l.*, e.TYPE_ENTREPRISE, e.NOM_ENTREPRISE FROM pla_moto_lignes l +INNER JOIN eleves e ON l.cd_cli = e.cd_cli +WHERE l.no_ligne = :no_ligne;""" + results = request.dbsession.execute(query, {'no_ligne': no_ligne}).first() + return results + +def get_lieux_by_type(request, type_groupe): + query = """ SELECT * from p_lieux WHERE TYPE=:type_groupe;""" + results = request.dbsession.execute( + query, {'type_groupe': type_groupe}).fetchall() + return results + +def get_stages_lig_by_noligne(request, no_ligne): + # lire les stage B + type = no_ligne[0:1] + semaine = no_ligne[1:7] + groupe = no_ligne[7:8] + cd_cli = no_ligne[8:14] + query = """ +SELECT l.*, e.TYPE_ENTREPRISE, e.NOM_ENTREPRISE FROM pla_stage_lignes l +INNER JOIN eleves e ON l.cd_cli = e.cd_cli +WHERE l.type = :type and l.semaine = :semaine and l.groupe = :groupe and l.cd_cli = :cd_cli;""" + results = request.dbsession.execute( + query, {'type': type, 'semaine': semaine, 'groupe': groupe, 'cd_cli': cd_cli}).first() + return results + + +def get_stage_lig_by_groupe(request, type, semaine, groupe): + # lire les stage B + query = """ +SELECT l.*, s.debut, s.fin, e.credit-e.debit as solde, e.dossier_date, e.niveau, e.formule, e.filiere, +CONCAT(e.heures_prises,'/',e.heures_prevues) as heures, e.perime_le FROM pla_stage_lignes l +INNER JOIN pla_stage s ON s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe +INNER JOIN eleves e ON l.cd_cli = e.cd_cli +WHERE l.type = :type and l.semaine = :semaine and l.groupe = :groupe;""" + results = request.dbsession.execute( + query, {'type': type, 'semaine': semaine, 'groupe': groupe}).fetchall() + return results + + +def get_stage_lig_by_cd_cli(request, type, cd_cli): + # lire les stage B + query = """ +SELECT l.* FROM pla_stage_lignes l WHERE l.type = :type and l.cd_cli = :cd_cli;""" + results = request.dbsession.execute( + query, {'type': type, 'cd_cli': cd_cli}).first() + return results + + +def stage_lig_by_eleve(request, cd_cli, type_stage, semaine, groupe): + query = """ SELECT * FROM pla_stage_lignes WHERE type = :type and cd_cli = :cd_cli and groupe=:groupe and semaine=:semaine; """ + results = request.dbsession.execute( + query, {'type': type_stage, 'cd_cli': cd_cli, 'semaine': semaine, 'groupe': groupe}).fetchall() + return results + + +def motos_lig_by_eleve(request, cd_cli, type_stage, date, groupe): + query = """ SELECT * FROM pla_moto_lignes WHERE type = :type and cd_cli = :cd_cli and groupe=:groupe and date=:date; """ + results = request.dbsession.execute( + query, {'type': type_stage, 'cd_cli': cd_cli, 'date': date, 'groupe': groupe}).fetchall() + return results + +def get_stages(request, type_stage): + TODAY = date.today() + # début = aujourd'hui - 1 semaines + d = TODAY + relativedelta(weeks=-6) + datedeb = d.strftime('%Y-%m-01') + # fin = aujourd'hui + 2 mois + d = TODAY + relativedelta(months=+6) + datefin = d.strftime('%Y-%m-01') + + # lire les stages + query = "SELECT * FROM pla_stage WHERE type = :type_stage AND debut >= :datedeb AND debut <= :datefin ORDER BY debut" + results = request.dbsession.execute( + query, {'type_stage': type_stage, 'datedeb': datedeb, 'datefin': datefin}).fetchall() + return results + +def get_moniteurs_by_aff(request, agence, date_deb, date_fin, planning='ALL'): + query = "CALL spGet_MONITEURS_AFF_byAGENCE(:agence, :date_deb, :date_fin, :planning)" + results = request.dbsession.execute( + query, {'agence': agence, 'date_deb': date_deb, 'date_fin': date_fin, 'planning': planning}).fetchall() + return results + +def get_moniteurs_by_activite(request, date_deb, date_fin, act1, act2): + # moniteurs ayant une activite en cours + dans le futur dans l’agence + query = """ +SELECT moniteurs.* FROM eleves_cpt +INNER JOIN moniteurs ON moniteurs.cd_mon = eleves_cpt.cd_mon +WHERE (eleves_cpt.cd_cli=:act1 OR eleves_cpt.cd_cli=:act2) AND eleves_cpt.date >= :date_deb AND eleves_cpt.date <=:date_fin AND qte +GROUP BY cd_mon ORDER BY nom;""" + results = request.dbsession.execute( + query, {'act1': act1, 'act2': act2, 'date_deb': date_deb, 'date_fin': date_fin}).fetchall() + return results + +def get_motos(request, type): + TODAY = date.today() + # début = aujourd'hui - 1 semaines + d = TODAY + relativedelta(weeks=-4) + datedeb = d.strftime('%Y-%m-01') + # fin = aujourd'hui + 2 mois + d = TODAY + relativedelta(months=+6) + datefin = d.strftime('%Y-%m-01') + + # lire les plannings de type motos + query = "SELECT * FROM pla_moto WHERE type=:type AND date >= :datedeb AND date <= :datefin ORDER BY date" + results = request.dbsession.execute( + query, {'type': type, 'datedeb': datedeb, 'datefin': datefin}).fetchall() + return results + +def get_motos_byId(request, type, date, groupe): + # lire le planning MOTO par son ID : type - date - groupe + query = "SELECT * FROM pla_moto WHERE type=:type AND date = :date AND groupe = :groupe;" + results = request.dbsession.execute( + query, {'type': type, 'date': date, 'groupe': groupe}).first() + return results + +def update_stageb_lig_moniteur(request, date_stage, cd_cli, cd_stage): + # maj les stages B + query = """ +UPDATE pla_stage_lignes l +INNER JOIN pla_stage s ON s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe +SET l.cd_mon = :cd_stage +WHERE l.type = 'B' AND date(s.debut) <= :date_stage AND s.fin >= :date_stage AND l.cd_cli = :cd_cli AND l.valide = 'N';""" + execute_query(request, query, { + 'date_stage': date_stage, 'cd_cli': cd_cli, 'cd_stage': cd_stage}) + + +def update_stageb_lig_circuit(request, date_stage, cd_cli, cd_circuit): + # maj les stages B + query = """ +UPDATE pla_stage_lignes l +INNER JOIN pla_stage s ON s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe +SET l.cd_circuit = :cd_circuit +WHERE l.type = 'B' AND date(s.debut) <= :date_stage AND s.fin >= :date_stage AND l.cd_cli = :cd_cli AND l.valide = 'N';""" + execute_query(request, query, { + 'date_stage': date_stage, 'cd_cli': cd_cli, 'cd_circuit': cd_circuit}) + + +def update_stageb_lig_seance(request, date_stage, cd_cli, seance): + # maj les stages B + query = """ +UPDATE pla_stage_lignes l +INNER JOIN pla_stage s ON s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe +SET l.seance = :seance +WHERE l.type = 'B' AND date(s.debut) <= :date_stage AND s.fin >= :date_stage AND l.cd_cli = :cd_cli AND l.valide = 'N';""" + execute_query(request, query, { + 'date_stage': date_stage, 'cd_cli': cd_cli, 'seance': seance}) + + +def update_stage_lig_statut(request, type, date_stage, cd_cli): + # maj les stages B + query = """ +UPDATE pla_stage_lignes l +INNER JOIN pla_stage s ON s.type = l.type AND s.semaine = l.semaine AND s.groupe = l.groupe +SET l.statut = 1 +WHERE l.type = :type AND date(s.debut) <= :date_stage AND s.fin >= :date_stage AND l.cd_cli = :cd_cli AND l.statut = 0 ;""" + execute_query(request, query, {'type': type, + 'date_stage': date_stage, 'cd_cli': cd_cli}) + +def update_stage_lig_by_cd_cli(request, type_stage, semaine, groupe, cd_cli, statut, valide, agence, ligne_cpt, libelle, date_valeur): + query = """ UPDATE pla_stage_lignes SET statut=:statut, valide=:valide, agence=:agence WHERE type=:type AND semaine=:semaine AND groupe=:groupe AND cd_cli=:cd_cli; """ + execute_query(request, query, {'type': type_stage, 'semaine': semaine, 'groupe': groupe, + 'cd_cli': cd_cli, 'statut': statut, 'valide': valide, 'agence': agence}) + + query2 = """ CALL spUPD_ELEVES_VALO_STAGE(:ligne_cpt, :statut, :agence)""" + execute_query(request, query2, { + 'statut': statut, 'ligne_cpt': ligne_cpt, 'agence': agence}) + + # update eleve_cpt + query3 = """ UPDATE eleves_cpt SET INTITULE=:libelle,AGENCE=:agence,STATUT=:statut,DATE_VALEUR=:date_valeur WHERE no_ligne=:ligne_cpt ;""" + execute_query(request, query3, {'libelle': libelle, 'statut': statut, + 'ligne_cpt': ligne_cpt, 'agence': agence, 'date_valeur': date_valeur}) + +def update_motos_lig_by_cd_cli(request, type_planning, date, groupe, cd_cli, statut, valide, agence, ligne_cpt, ref, cd_mon): + query = """ UPDATE pla_moto_lignes SET statut=:statut, valide=:valide, agence=:agence WHERE type=:type AND date=:date AND groupe=:groupe AND cd_cli=:cd_cli; """ + execute_query(request, query, {'type': type_planning, 'date': date, 'groupe': groupe, + 'cd_cli': cd_cli, 'statut': statut, 'valide': valide, 'agence': agence}) + if type_planning == "E": + query2 = """ CALL spUpd_PLANNING_B_VALORISER(:cd_cli,)""" + execute_query(request, query2, {'cd_cli': cd_cli}) + else: + query2 = """ CALL spUpd_PLANNING_A_VALORISER(:cd_cli, :ref)""" + execute_query(request, query2, {'cd_cli': cd_cli, 'ref': ref, }) + + # update eleve_cpt + query3 = """ UPDATE eleves_cpt SET fin_reservation=NULL,STATUT=:statut,DATE_VALEUR=CURRENT_DATE() WHERE no_ligne=:ligne_cpt ;""" + execute_query(request, query3, {'statut': statut, 'ligne_cpt': ligne_cpt}) + # post validate + if type_planning == "A": + query4 = """ CALL spUpd_ATTENTES('2R', :cd_cli, 1, True, :cd_mon,'AEM') ;""" + execute_query(request, query4, {'cd_cli': cd_cli, 'cd_mon': cd_mon}) + elif type_planning == "D": + query4 = """ CALL spUpd_ATTENTES(ETG, :cd_cli, 1, True, :cd_mon,'AEM') """ + execute_query(request, query4, {'cd_cli': cd_cli, 'cd_mon': cd_mon}) + elif type_planning == "E": + query4 = """ CALL spUpd_ATTENTES(‘B’, :cd_cli, 1, True, :cd_mon,'AEM') """ + execute_query(request, query4, {'cd_cli': cd_cli, 'cd_mon': cd_mon}) + +def update_pla_stage_by_semaine(request, type_stage, semaine, groupe, agence, valide, cd_uti): + query = "UPDATE pla_stage SET AGENCE=:agence, VALIDE=:valide, CD_UTI=:cd_uti WHERE TYPE=:type AND SEMAINE=:semaine AND GROUPE=:groupe;" + execute_query(request, query, {"semaine": semaine, 'groupe': groupe, + 'type': type_stage, 'agence': agence, 'valide': valide, 'cd_uti': cd_uti}) + +def update_pla_moto_by_date(request, type_stage, date, groupe, agence, valide, cd_uti): + query = "UPDATE pla_moto SET AGENCE=:agence, VALIDE=:valide, CD_UTI=:cd_uti WHERE TYPE=:type AND DATE=:date AND GROUPE=:groupe;" + execute_query(request, query, {"date": date, 'groupe': groupe, + 'type': type_stage, 'agence': agence, 'valide': valide, 'cd_uti': cd_uti}) + +def delete_pla_stage_by_semaine(request, type_stage, semaine, groupe): + query = "DELETE FROM pla_stage WHERE TYPE=:type AND SEMAINE=:semaine AND GROUPE=:groupe;" + execute_query(request, query, { + "semaine": semaine, 'groupe': groupe, 'type': type_stage}) + +def delete_pla_moto_by_date(request, type_stage, date, groupe): + query = "DELETE FROM pla_moto WHERE TYPE=:type AND DATE=:date AND GROUPE=:groupe;" + execute_query(request, query, {"date": date, + 'groupe': groupe, 'type': type_stage}) + + +def controleSoldeResa(request, cd_cli, ref): + if cd_cli > 100000: + # Controler le solde de l'élève + query = "CALL spCTL_SOLDE_RESA(:cd_cli, :ref)" + results = request.dbsession.execute(query, {'cd_cli': cd_cli, 'ref': ref}).first() + return results.resultat + else: + return 0 + +def controleDateExport(request, dateRdv, agence): + date = datetime.strptime(dateRdv, '%Y-%m-%d').date() + # lire la date dernière export en compta + query = "SELECT * FROM p_agences WHERE code = 6;" + result = request.dbsession.execute(query).first() + if date <= result.DERN_EXPORT: + return False + else: + query = "SELECT * FROM p_agences WHERE code = :agence;" + result = request.dbsession.execute(query, {'agence': agence}).first() + if date <= result.DERN_VALIDATION: + return False + else: + return True + +def controlAffectationEtAgece(request, cd_mon, dateRDV, heureRDV, agence): + query = """SELECT * FROM moniteurs_aff WHERE cd_mon = :cd_mon AND agence=:agence order by DATEF ASC""" + results = request.dbsession.execute( + query, {'cd_mon': cd_mon, 'agence': agence}) + dateRDV = datetime.strptime(dateRDV, '%Y-%m-%d').date() + lastdate = None + for result in results: + lastdate = result + dateFin = result['DATEF'] + dateDebut = result['DATED'] + if dateDebut <= dateRDV <= dateFin: + isMatin = time(int(result['DMATIN']), 0) <= time( + int(heureRDV), 0) <= time(int(result['FMATIN']), 0) + isSoir = time(int(result['DSOIR']), 0) <= time( + int(heureRDV), 0) <= time(int(result['FSOIR']), 0) + if (isMatin or isSoir): + return True, result + else: + lastdate = None + + return False, lastdate + +def PlanningHasPending(request, type, date, groupe): + # y a-t-il des élèves provisoires dans le stage ? + query = "CALL spGet_PLA_MOTO_LIGNES(:type, :date, :groupe, -1)" + results = request.dbsession.execute( + query, {'type': type, 'date': date, 'groupe': groupe}).fetchall() + if len(results) > 0: + return True + else: + return False + +def StageHasPending(request, type, semaine, groupe): + # y a-t-il des élèves provisoires dans le stage ? + query = "CALL spGet_PLA_STAGE_PROVISOIRES(:type, :semaine, :groupe)" + results = request.dbsession.execute( + query, {'type': type, 'semaine': semaine, 'groupe': groupe}).fetchall() + if len(results) > 0: + return True + else: + return False + + +def planningHasPending(request, type_stage, date, groupe): + query = "SELECT s.* FROM pla_moto_lignes s INNER JOIN eleves e ON s.cd_cli = e.cd_cli WHERE s.type=:type AND s.date=:date AND s.groupe=:groupe AND e.agence = 0 ORDER BY s.cd_cli;" + results = request.dbsession.execute( + query, {'type': type, 'date': date, 'groupe': groupe}).fetchall() + if len(results) > 0: + return True + else: + return False + +def get_examens_prevu(request, cd_cli): + # lire l'examen prévu de l'élève + query = "SELECT * FROM examens_aff WHERE cd_cli = :cd_cli AND date > CURRENT_DATE();" + results = request.dbsession.execute(query, {'cd_cli': cd_cli}).first() + return results + +def get_ref_by_stage_type(request, type_stage): + query = """ SELECT DISTINCT REF FROM pla_stage_lignes WHERE TYPE=:type AND REF IS NOT NULL AND REF != ""; """ + results = request.dbsession.execute(query, {'type': type_stage}).fetchall() + return results + +def get_ref_by_motos_type(request, type_stage): + query = """ SELECT DISTINCT REF FROM pla_moto_lignes WHERE TYPE=:type AND REF IS NOT NULL AND REF != ""; """ + results = request.dbsession.execute(query, {'type': type_stage}).fetchall() + return results + +def get_p_semaines(request, type_planning): + query = "CALL spGet_P_SEMAINES(:type_planning);" + results = request.dbsession.execute(query, {'type_planning': type_planning}).fetchall() + return results + +def insert_semaine_type(request, cd_mon, noSemaine, dateDepart, nbSemaine, increment, agence, logged_in): + # insérer la semaine-type noSemaine par QTE fois à partir de la date dateDepart + n = 1 + for i in range(nbSemaine): + # lire la semaine type + query = "SELECT * FROM p_semaine_type WHERE code_sem = :noSemaine;" + semaines = request.dbsession.execute(query, {'noSemaine': noSemaine}).fetchall() + + for semaine in semaines: + dateType = semaine.dh_debut + dateHeure = dateDepart + relativedelta(days=dateType.weekday() - 1) + + # l'heure existe déjà dans le planning ? + query = "SELECT DATE FROM eleves_cpt WHERE agence=:agence AND date=:date AND noplan=:noplan AND cd_mon=:cd_mon;" + item = request.dbsession.execute(query, {'agence': agence, "date": dateHeure.strftime('%Y-%m-%d'), + 'noplan': dateType.hour, 'cd_mon': cd_mon}).fetchall() + if len(item) == 0: + # non, créer l'heure + query = """REPLACE INTO eleves_cpt (date, noplan, cd_cli, intitule, nom, qte, ref, cd_mon, agence, cd_uti) VALUES + (:date, :noplan, :cd_cli, :intitule, :intitule, :qte, :cd_cli, :cd_mon, :agence, :logged_in);""" + execute_query(request, query, {"date": dateHeure.strftime('%Y-%m-%d'),'noplan': dateType.hour, + 'cd_cli': semaine.ACTIVITE, 'intitule': semaine.INTITULE, 'qte': semaine.qte, + 'cd_mon': cd_mon, 'agence': agence, 'logged_in': logged_in} ) + + # changer de semaine + n = n + increment + dateDepart = dateDepart + relativedelta(days=7 * increment) + +def delete_pla_moto_by_cd_cli(request, type_stage, groupe, date, cd_cli): + query = "DELETE FROM pla_moto_lignes WHERE TYPE=:type AND DATE=:date AND GROUPE=:groupe AND CD_CLI=:cd_cli; " + execute_query(request, query, { + "date": date, 'groupe': groupe, 'type': type_stage, 'cd_cli': cd_cli}) + +def valoriser_heure(request, cd_cli): + query = "CALL spUpd_PLANNING_B_VALORISER(:cd_cli);" + execute_query(request, query, {'cd_cli': cd_cli}) + +def validate_heure_rdvb(request, no_ligne, date, qte, statut, cd_cli, cd_mon, agence): + query = """ UPDATE eleves_cpt SET DATE_VALEUR=:date, fin_reservation=NULL, QTE=:qte, STATUT=:statut WHERE no_ligne=:no_ligne """ + execute_query(request, query, { + 'no_ligne': no_ligne, 'date': date, 'qte': qte, 'statut': statut}) + if str(statut) == '8': + query2 = """ "CALL spUpd_ATTENTES('B',:cd_cli, 1, True ,:cd_mon,'AEM') """ + execute_query(request, query2, {'cd_cli': cd_cli, 'cd_mon': cd_mon}) + query3 = """ CALL spUPD_LAST_VALIDATION(:agence,:date) """ + execute_query(request, query3, {'agence': agence, 'date': date}) + +def get_eleve_cpt(request, date, agence): + query = """ SELECT * FROM eleves_cpt WHERE DATE=:date AND AGENCE=:agence AND NOPLAN <> 0 AND DATE_VALEUR is NULL""" + results = request.dbsession.execute( + query, {"date": date, 'agence': agence}).fetchall() + return results + +def get_rendez_vous_b_debut_apres_now(request, agence, date): + datetimenow = datetime.now() + query = """ SELECT e.* FROM eleves_cpt e WHERE e.NoPlan <>0 AND e.REF IN ('HCB', 'HCB78') AND CONVERT(concat(CONVERT(e.DATE,DATE),' ',CONVERT(concat(e.NoPlan,':00:00'), TIME)), DATETIME) >= :datetime AND e.AGENCE = :agence AND e.DATE=:date;""" + results = request.dbsession.execute( + query, {'agence': agence, 'date': date, 'datetime': datetimenow}).fetchall() + return results \ No newline at end of file diff --git a/aem_gestion/models/utils.py b/aem_gestion/models/utils.py new file mode 100644 index 0000000..7c04ce9 --- /dev/null +++ b/aem_gestion/models/utils.py @@ -0,0 +1,220 @@ +# -*- coding: utf8 -*- +from sqlalchemy import text +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import ( + scoped_session, + sessionmaker, +) +from zope.sqlalchemy import ( + ZopeTransactionExtension, + mark_changed +) + +from datetime import * +import dateutil.relativedelta +import transaction + +def execute_query(request, query, params): + """Execute query and mark session as changed""" + request.dbsession.execute(query, params) + mark_changed(request.dbsession) + transaction.commit() + +def insert_log(request, proc, msg): + query = "INSERT t_log_nuit (proc,msg) VALUES (:proc,:msg);" + execute_query(request, query, {'proc': proc, 'msg' :msg}) + +def truncate_log(request): + query = "TRUNCATE t_log_nuit;" + execute_query(request, query, {}) + +def get_log(request): + # lire les rappels non envoyés + query = "SELECT * FROM t_log_nuit;" + results = request.dbsession.execute(query, {}).fetchall() + return results + +def get_email_rappels(request): + # lire les rappels non envoyés + query = "SELECT r.*, e.email, e.payeur_nom, e.payeur_email FROM email_rappels r INNER JOIN eleves e ON r.cd_cli = e.cd_cli WHERE ISNULL(envoye_le) ORDER BY no_id;" + results = request.dbsession.execute(query, {}).fetchall() + return results + +def get_email_resa(request, type): + # lire les rappels non envoyés + query = "CALL spGet_EMAIL_RESA(:type);" + results = request.dbsession.execute(query, {'type': type}).fetchall() + return results + +def get_reservations(request): + # lire les réservation non WEB dans planning A et B + query = """ + SELECT c.ref, c.date, c.fin_reservation, c.cd_cli, c.no_ligne, c.noplan, c.circuit, c.debit FROM eleves_cpt c + WHERE NOT isnull(fin_reservation) AND ref IN ("HCB", "HCB78" ,"HCA3", "HCA4", "TA", "TB","TB78" ) AND cd_uti <> 'WEB' ORDER BY date;""" + results = request.dbsession.execute(query, {}).fetchall() + return results + +def update_rappels(request): + query = "CALL spUPD_RAPPELS();" + execute_query(request, query, {}) + +def update_email_rappels(request, no_id): + query = "UPDATE email_rappels SET envoye_le = NOW() WHERE no_id = :no_id;" + execute_query(request, query, {'no_id': no_id}) + +def update_email_resa(request, no_id): + query = "UPDATE email_resa SET envoye_le = NOW() WHERE no_id = :no_id;" + execute_query(request, query, {'no_id': no_id}) + +def get_societes(request, societe): + if societe == '0': + query = "SELECT * FROM p_societe;" + results = request.dbsession.execute(query, {'societe': societe}).fetchall() + else: + query = "SELECT * FROM p_societe WHERE societe = :societe;" + results = request.dbsession.execute(query, {'societe': societe}).first() + return results + +def get_message(request, ref): + query = "SELECT * FROM tarifs WHERE ref = :ref;" + results = request.dbsession.execute(query, {'ref': ref}).first() + return results + +def update_planning_B_confirm(request, action, no_ligne, cd_cli): + if action == "C": + # confirmer la resa + query = "UPDATE eleves_cpt SET fin_reservation = NULL WHERE no_ligne = :no_ligne;" + execute_query(request, query, {'no_ligne': no_ligne}) + else: + # annuler la resa + query = """UPDATE eleves_cpt SET debit=0, mtval=0, qte=0, fin_reservation = NULL, + intitule=CONCAT('Résa ', ref, ' de ', noplan, 'h expirée'), ref=NULL, noplan=0 WHERE no_ligne = :no_ligne; + """ + execute_query(request, query, {'no_ligne': no_ligne}) + # recalculer le solde de l'élève + query = "CALL spUPD_ELEVES_SOLDE(:cd_cli);" + execute_query(request, query, {'cd_cli':cd_cli}) + + +def insert_email_resa(request, ref, cd_cli, type, date, heure, statut): + query = """INSERT INTO email_resa (ref, cd_cli, resa_date, resa_type, resa_statut) + VALUES (:ref, :cd_cli, DATE_ADD(:date, INTERVAL :heure HOUR), :type, :statut);""" + execute_query(request, query, {'ref': ref, 'cd_cli': cd_cli, 'type': type, 'date': date, 'heure': heure, 'statut': statut}) + +def get_solde_eleve(request, cd_cli, ref): + # Controler le solde de l'élève + query = "CALL spCTL_SOLDE_RESA(:cd_cli, :ref)" + results = request.dbsession.execute(query, {'cd_cli': cd_cli, 'ref': ref}).first() + return results + +def update_planning_A_confirm(request, action, no_ligne, cd_cli): + if action == "C": + # confirmer la resa dans le compte + query = "UPDATE eleves_cpt SET fin_reservation = NULL WHERE no_ligne = :no_ligne;" + execute_query(request, query, {'no_ligne': no_ligne}) + # confirmer la resa dans le planning + query = "UPDATE pla_moto_lignes SET fin_reservation = NULL WHERE ligne_cpt = :no_ligne;" + execute_query(request, query, {'no_ligne': no_ligne}) + else: + # annuler la resa dans le compte + query = """UPDATE eleves_cpt SET debit=0, mtval=0, qte=0, fin_reservation = NULL, + intitule=CONCAT('Résa ', ref, ' expirée'), ref=NULL, noplan=0 WHERE no_ligne = :no_ligne;""" + execute_query(request, query, {'no_ligne': no_ligne}) + # recalculer le solde + query = "CALL spUPD_ELEVES_SOLDE(:cd_cli);" + execute_query(request, query, {'cd_cli':cd_cli}) + # annuler la resa dans le planning + query = "DELETE FROM pla_moto_lignes WHERE ligne_cpt = :no_ligne;" + execute_query(request, query, {'no_ligne': no_ligne}) + +def purge_obsoletes(request): + + # ----- Purger les anciens TICKETS_CB de plus de 6 mois + query = "DELETE FROM tickets_cb WHERE date < DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH);" + execute_query(request, query, {}) + # ----- Purger les anciens notifications de plus de 6 mois + query = "DELETE FROM email_resa WHERE date(cree_le) < DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH);" + execute_query(request, query, {}) + # ----- Purger les les anciens notifications de rappels de plus de 6 mois + query = "DELETE FROM email_rappels WHERE date(cree_le) < DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH);" + execute_query(request, query, {}) + # ----- supprimer les fiches PROSPECTS inactives et cloturees antérieures de 5 années + query = "DELETE FROM prospects WHERE modif_le < DATE_SUB(CURRENT_DATE(), INTERVAL 5 YEAR);" + execute_query(request, query, {}) + + + # -- Purger les anciens ///// + query = "DELETE FROM eleves_cpt WHERE date < DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH) AND ref = '1';" + execute_query(request, query, {}) + # -- supprimer les activités du plannings B antérieurs de 4 années + query = "DELETE FROM eleves_cpt WHERE cd_cli < 100000 and date < DATE_SUB(CURRENT_DATE(), INTERVAL 4 YEAR);" + execute_query(request, query, {}) + # -- Purger du Planning B les rdv annulés, remplacés ou expirés de plus de 4 années + query = """DELETE FROM eleves_cpt WHERE date < DATE_SUB(CURRENT_DATE(), INTERVAL 4 YEAR) AND qte=0 + AND (INSTR(intitule,'annulé') OR INSTR(intitule,'remplacé') OR INSTR(intitule,'expiré'));""" + execute_query(request, query, {}) + + # -- supprimer les plannings MOTO de + de 3 ans + query = """DELETE A.* FROM pla_moto A LEFT OUTER JOIN pla_moto_lignes B + ON A.type=B.type AND A.date=B.date AND A.groupe=B.groupe + WHERE B.date IS NULL and A.date < DATE_SUB(CURRENT_DATE(), INTERVAL 3 YEAR);""" + execute_query(request, query, {}) + # -- supprimer les plannings Stage antérieurs de 4 années + query = """DELETE A.* FROM pla_stage A LEFT OUTER JOIN pla_stage_lignes B + ON A.type=B.type AND A.semaine=B.semaine AND A.groupe=B.groupe + WHERE B.semaine IS NULL and A.modif_le < DATE_SUB(CURRENT_DATE(), INTERVAL 3 YEAR);""" + execute_query(request, query, {}) + # -- supprimer les examens sans inscrits + query = """DELETE A.* FROM examens A LEFT OUTER JOIN examens_aff B + ON A.date=B.date AND A.no_exa=B.no_exa AND A.agence=B.agence + WHERE B.date IS NULL and A.date < DATE_SUB(CURRENT_DATE(), INTERVAL 3 YEAR);""" + execute_query(request, query, {}) + + # -- supprimer les affectations de moniteurs - 5 ans + query = "DELETE FROM bd_aem.moniteurs_aff WHERE year(datef) < year(CURRENT_DATE) - 5;" + execute_query(request, query, {}) + # -- supprimer les moniteurs sans affectations + query = """DELETE A.* FROM moniteurs A LEFT OUTER JOIN moniteurs_aff B ON A.cd_mon=B.cd_mon + WHERE B.agence IS NULL and A.modif_le < DATE_SUB(CURRENT_DATE(), INTERVAL 2 YEAR);""" + execute_query(request, query, {}) + + # -- effacer les demandes de mot de passe oubliés + query = "UPDATE eleves SET mdp_oublie=NULL, mdp_oublie_date=NULL WHERE mdp_oublie_date < DATE_SUB(NOW(), INTERVAL 2 day);" + execute_query(request, query, {}) + # -- MAJ la date de la dernière opération sur lélève + query = """UPDATE eleves + SET dern_ope_le = (SELECT max(date) FROM eleves_cpt WHERE cd_cli = eleves.cd_cli) + WHERE CD_CLI > 100000;""" + execute_query(request, query, {}) + + +def update_statistiques(request): + # ----- MAJ de la table statistiques CHARTS_DATA mois M + query = "CALL spUPD_CHARTS_DATA(CURRENT_DATE)" + execute_query(request, query, {}) + # ----- MAJ de la table statistiques CHARTS_DATA mois M-1 + query = "CALL spUPD_CHARTS_DATA(DATE_SUB(current_date, INTERVAL 1 MONTH))" + execute_query(request, query, {}) + # ----- MAJ de la table statistiques CHARTS_DATA2 mois M-1 + query = "CALL spUPD_CHARTS_DATA2(DATE_SUB(current_date, INTERVAL 1 MONTH))" + execute_query(request, query, {}) + +def lettrage_auto(request): + # parcourir les élève ACTIFS + query = "SELECT cd_cli FROM eleves WHERE cd_cli > 100000 AND statut < 10;" + results = request.dbsession.execute(query, {}).fetchall() + + for item in results: + # lettrer toutes les écritures à cette date + query = "CALL spUPD_ELEVES_LETTRER(:cd_cli);" + execute_query(request, query, {'cd_cli': item.cd_cli}) + return len(results) + +def get_justify_not_found(request,date): + query = """SELECT * FROM eleves_upload WHERE cree_le >= :date AND nom_fic IS NOT NULL AND taille_fic <> 0 """ + results = request.dbsession.execute(query, {'date':date}).fetchall() + return results + +def update_justify_not_found(request,no_ligne): + query = """UPDATE eleves_upload SET nom_fic=NULL, taille_fic=0, valide=0 WHERE no_ligne=:no_ligne""" + execute_query(request,query, {'no_ligne':no_ligne}) \ No newline at end of file diff --git a/aem_gestion/panels.py b/aem_gestion/panels.py new file mode 100644 index 0000000..4aee22a --- /dev/null +++ b/aem_gestion/panels.py @@ -0,0 +1,37 @@ +# -*- coding: utf8 -*- +from pyramid_layout.panel import panel_config + +from .models.default import get_users_by_code +from .security import groupfinder + + +@panel_config(name='dropdown_menu_panel', renderer='templates/panels/dropdown_menu_panel.pt') +def dropdown_menu_panel(context, request): + logged_in = request.authenticated_userid + + if logged_in is None: + return { 'logged_in': '' } + else: + member = get_users_by_code(request, logged_in) + fullname = member.nom + email = member.email + access = member.access + agence = member.agence + + groups = groupfinder(logged_in, request) + if 'group:administrators' in groups: + is_admin = True + else: + is_admin = False + + return { + 'logged_in': logged_in, + 'logged_in_name': fullname, + 'logged_in_email': email, + 'logged_in_agence': agence, + 'logged_in_access': access, + 'is_admin': is_admin, + } + + + diff --git a/aem_gestion/routes.py b/aem_gestion/routes.py new file mode 100644 index 0000000..a3b4186 --- /dev/null +++ b/aem_gestion/routes.py @@ -0,0 +1,149 @@ +def includeme(config): + config.add_static_view('static', 'static', cache_max_age=3600) + # define routes + config.add_route('home', '/') + config.add_route('affiche_message', '/affiche_message/{login}') + config.add_route('ajax_eleve', '/ajax_eleve') + config.add_route('ajax_lookup', '/ajax_lookup') + config.add_route('ajax_lookupb78', '/ajax_lookupb78') + config.add_route('ajax_moniteur', '/ajax_moniteur') + config.add_route('ajax_codepostal', '/ajax_codepostal') + config.add_route('ajax_dept_nais', '/ajax_dept_nais') + config.add_route('ajax_tarifs', '/ajax_tarifs') + config.add_route('ajax_type_devis', '/ajax_type_devis') + config.add_route('ajax_formules', '/ajax_formules') + config.add_route('ajax_login', '/ajax_login') + config.add_route('ajax_valid_formules', '/ajax_valid_formules') + config.add_route('ajax_mode_regl', '/ajax_mode_regl') + config.add_route('ajax_libelle_regl', '/ajax_libelle_regl') + config.add_route('ajax_activity', '/ajax_activity') + + + config.add_route('ajout', '/ajout/{nolig}') + config.add_route('change_agency', '/change_agency') + config.add_route('change_password', '/changer_mot_de_passe') + config.add_route('crediter', '/crediter') + config.add_route('connecter_a', '/connecter_a/{login}') + config.add_route('date_examen', '/date_examen') + config.add_route('email_password', '/email_password') + config.add_route('login', '/login') + config.add_route('login_as', '/login_as/{login}') + config.add_route('login_from', '/login_from/{device}') + config.add_route('logout', '/logout') + config.add_route('redefinir_mdp', '/redefinir_mdp/{lien}') + # compta + config.add_route('balance_clients', '/balance_clients') + config.add_route('balance_print', '/balance_print') + config.add_route('export_cpta', '/export_cpta') + config.add_route('jnl_caisse', '/jnl_caisse') + config.add_route('prt_caisse', '/prt_caisse/{date_edition}') + config.add_route('recap_moniteur', '/recap_moniteur') + config.add_route('recap_print', '/recap_print/{cd_mon1}/{cd_mon2}/{date1}/{date2}') + config.add_route('solder_contrats', '/solder_contrats') + # crm + config.add_route('agenda', '/agenda/{date}') + config.add_route('agenda_edit', '/agenda_edit/{no_ligne}') + config.add_route('confirm', '/confirm/{cd_prospect}/{action}') + config.add_route('contact_edit', '/contact_edit/{cd_prospect}') + config.add_route('contact_lookup', '/contact_lookup') + config.add_route('contact_suivi', '/contact_suivi/{cd_prospect}/{no_ligne}') + config.add_route('contacts_list', '/contacts_list') + config.add_route('devis_cpf_frm', '/devis_cpf_frm/{no_devis}/{code}') + config.add_route('devis_frm', '/devis_frm/{no_devis}/{code}') + config.add_route('devis_pec', '/devis_pec/{no_devis}/{code}') + # eleves + config.add_route('eleves', '/eleves') + config.add_route('eleve_edit', '/eleve_edit/{cd_cli}') + config.add_route('eleve_email', '/eleve_email/{cd_cli}') + config.add_route('eleve_pap', '/eleve_pap/{cd_cli}') + config.add_route('eleve_permis', '/eleve_permis/{cd_cli}/{no_ligne}') + config.add_route('eleve_referent', '/eleve_referent/{cd_cli}') + config.add_route('eleve_filiere_niveau', '/eleve_filiere_niveau/{cd_cli}') + config.add_route('eleve_select', '/eleve_select/{cd_mon}/{date}') + config.add_route('eleve_selected', '/eleve_selected/{cd_mon}/{date}/{cd_cli}') + config.add_route('eleve_upd', '/eleve_upd/{cd_cli}/{key_cli}/{param}') + config.add_route('fiche_eleve', '/fiche_eleve/{cd_cli}') + config.add_route('suivi_edit', '/suivi_edit/{cd_cli}/{no_ligne}') + config.add_route('doc_edit', '/doc_edit/{no_ligne}/{cd_cli}') + config.add_route('doc_upload', '/doc_upload/{no_ligne}/{cd_cli}') + config.add_route('eleve_entreprise', '/eleve_entreprise/{cd_cli}') + config.add_route('eleve_doc_prefecture', '/eleve_doc_prefecture/{cd_cli}') + config.add_route('eleve_representant', '/eleve_representant/{cd_cli}') + config.add_route('eleve_credit', '/eleve_credit/{cd_cli}/{no_ligne}') + config.add_route('eleve_lettrer', '/eleve_lettrer/{cd_cli}') + config.add_route('eleve_debit', '/eleve_debit/{cd_cli}/{no_ligne}') + + # examens + config.add_route('examens_schd', '/examens_schd/{date}/{permis}') + config.add_route('examen_list', '/examen_list/{date_exa}/{no_exa}') + config.add_route('results_import', '/results_import') + config.add_route('result_del', '/result_del/{email_uid}') + + # parametres + config.add_route('ants_demandes', '/ants_demandes') + config.add_route('ants_tables', '/ants_tables') + config.add_route('dashboard', '/dashboard') + config.add_route('faq_edit', '/faq_edit/{faq_id}') + config.add_route('faq_list', '/faq_list') + config.add_route('faq_view', '/faq_view/{faq_id}') + config.add_route('fontawesome', '/fontawesome') + config.add_route('formules', '/formules') + config.add_route('formule_edit', '/formule_edit/{formule}') + config.add_route('inscriptions', '/inscriptions') + config.add_route('justif_edit', '/justif_edit/{code}') + config.add_route('justifs_list', '/justifs_list') + config.add_route('last_emailing', '/last_emailing') + config.add_route('types_devis', '/types_devis') + config.add_route('types_devis_frm', '/types_devis_frm/{type_devis}') + config.add_route('parametres', '/parametres') + config.add_route('pass_rousseau', '/pass_rousseau') + config.add_route('permis', '/permis') + config.add_route('permis_edit', '/permis_edit/{cat}') + config.add_route('permis_justif', '/permis_justif/{cat}/{code}') + config.add_route('pdfviewer', '/pdfviewer/{pdf_name}') + config.add_route('tarif_edit', '/tarif_edit/{ref}') + config.add_route('tarifs', '/tarifs') + config.add_route('stats_exam1', '/stats_exam1') + config.add_route('stats_exam2', '/stats_exam2') + config.add_route('stats_pay', '/stats_pay') + config.add_route('users', '/users') + config.add_route('users_ua', '/users_ua') + config.add_route('user_edit', '/user_edit/{cd_uti}') + config.add_route('moniteurs', '/moniteurs') + config.add_route('moniteurs_agence', '/moniteurs_agence') + config.add_route('semaine_types', '/semaine_types') + config.add_route('semaine_type_view', '/semaine_type_view/{code_sem}') + config.add_route('moniteur_edit', '/moniteur_edit/{cd_mon}') + config.add_route('moniteur_aff_edit', '/moniteur_aff_edit/{cd_mon}/{no_ligne}') + config.add_route('activites', '/activites') + config.add_route('activite_edit', '/activite_edit/{cd_cli}') + config.add_route('agences', '/agences') + config.add_route('agence_edit', '/agence_edit/{code}') + + # planning + config.add_route('show_iframe', '/show_iframe/{param}') + config.add_route('activ_edit', '/activ_edit/{no_ligne}') + config.add_route('circuit_list', '/circuit_list/{date}/{groupe}') + config.add_route('monplanning', '/monplanning/{cd_mon}/{date}') + config.add_route('motos_edit', '/motos_edit/{type}/{date}/{groupe}/{cd_cli}') + config.add_route('motos_list', '/motos_list/{type}/{date}/{groupe}') + config.add_route('motos_schd', '/motos_schd/{type}') + config.add_route('planifier', '/planifier/{cd_mon}/{date}') + config.add_route('planninga_list', '/planninga_list/{type}/{date}/{groupe}') + config.add_route('planningb', '/planningb') + config.add_route('plannings', '/plannings') + config.add_route('rdvb_edit', '/rdvb_edit/{no_ligne}') + config.add_route('rdvb78_edit', '/rdvb78_edit/{no_ligne}') + config.add_route('stagea_list', '/stagea_list/{date}/{groupe}') + config.add_route('stageb_list', '/stageb_list/{date}/{groupe}/{sorc}/{cd_mon}') + config.add_route('stagec_list', '/stagec_list/{date}/{groupe}') + config.add_route('stages_schd', '/stages_schd/{type}') + config.add_route('stages_edit', '/stages_edit/{no_ligne}') + + # utils + config.add_route('batch_email', '/batch_email/{param}') + config.add_route('batch_nuit', '/batch_nuit/{param}') + config.add_route('batch_test', '/batch_test/{param}') + config.add_route('batch_justif', '/batch_justif/{param}') + + diff --git a/aem_gestion/scripts/__init__.py b/aem_gestion/scripts/__init__.py new file mode 100644 index 0000000..5bb534f --- /dev/null +++ b/aem_gestion/scripts/__init__.py @@ -0,0 +1 @@ +# package diff --git a/aem_gestion/security.py b/aem_gestion/security.py new file mode 100644 index 0000000..5b8fb50 --- /dev/null +++ b/aem_gestion/security.py @@ -0,0 +1,10 @@ +from .models.default import get_users_by_code + +def groupfinder(userid, request): + # userid est-il dans la BD ? + member = get_users_by_code(request, userid) + if member: + if member.secu == 9 : + return ['group:administrators'] + else: + return [] # it means that userid is logged in (it returns None if userid isn't logged in) diff --git a/aem_gestion/static/css/style.less b/aem_gestion/static/css/style.less new file mode 100644 index 0000000..2985661 --- /dev/null +++ b/aem_gestion/static/css/style.less @@ -0,0 +1,207 @@ +/* style.less */ +@error: #b94a48; + +.form-group { + label.error { + color: @error; + } +} + +.logo-small { + color: #f4511e; + font-size: 50px; +} +.logo-primary { + color: #337ab7; + font-size: 50px; +} +.logo-moto { + color: #2F4F4F; + font-size: 50px; +} +.logo-admin { + color: #404040; + font-size: 50px; +} +.logo-success { + color: #5cb85c; + font-size: 50px; +} +.bold { + font-weight:bold; +} +.fc-unthemed td.fc-today { + background: #FF8C00 none repeat scroll 0% 0%; +} +.fc-time-grid .fc-slats td { + height: 3em; +} + +.fc-event-time, .fc-event-title { + padding: 0 1px; + white-space: normal; +} + +.navbar { + margin-bottom: 0; + background-color: #f4511e; + color: #fff !important; + z-index: 9999; + border: 0; + font-size: 12px !important; + line-height: 1.42857143 !important; + letter-spacing: 4px; + border-radius: 0; +} + +.navbar li a, .navbar .navbar-brand { + color: #fff !important; +} + +.navbar-nav li a:hover, .navbar-nav li.active a { + color: #f4511e !important; + background-color: #fff !important; +} + +.navbar-default .navbar-toggle { + border-color: transparent; + color: #fff !important; +} + +/* Dropdown */ +.open .dropdown-toggle { + color: #fff ; + background-color: #555 !important; +} + +/* Dropdown links */ +.dropdown-menu li a { + color: #000 !important; +} + +/* On hover, the dropdown links will turn red */ +.dropdown-menu li a:hover { + background-color: #f4511e !important; + color: #ffffff !important; +} + +.modal-dialog { + top:7%; +} + +.footer { + background-color: #2f2f2f; + color: #ffffff; + padding-top: 2em; + padding-bottom: 1em; +} + +.bg-grey { + background-color: #f6f6f6; +} + +.monospace-font { + font-family: Monaco, "Courier New", Courier, monospace; +} + +/* ajout pour Nicola */ +@media (max-width: 992px) { + .navbar-header { + float: none; + } + .navbar-left,.navbar-right { + float: none !important; + } + .navbar-toggle { + display: block; + } + .navbar-collapse { + border-top: 1px solid transparent; + box-shadow: inset 0 1px 0 rgba(255,255,255,0.1); + } + .navbar-fixed-top { + top: 0; + border-width: 0 0 1px; + } + .navbar-collapse.collapse { + display: none!important; + } + .navbar-nav { + float: none!important; + margin-top: 7.5px; + } + .navbar-nav>li { + float: none; + } + .navbar-nav>li>a { + padding-top: 10px; + padding-bottom: 10px; + } + .collapse.in{ + display:block !important; + } +} + + +@media print { + /* ne pas affichier l'url after the link */ + a[href]:after { + content: none !important; + } + * { + color: inherit !important; + background-color: inherit !important; + } +body{ + -webkit-print-color-adjust: exact; /*chrome & webkit browsers*/ + color-adjust: exact; /*firefox & IE */ + } +} + +/* Autocompletion */ +.autocomplete { + /*the container must be positioned relative:*/ + position: relative; + display: inline-block; +} +.autocomplete-items { + position: absolute; + border: 1px solid #d4d4d4; + border-bottom: none; + border-top: none; + z-index: 99; + /*position the autocomplete items to be the same width as the container:*/ + top: 100%; + left: 0; + right: 0; +} +.autocomplete-items div { + padding: 10px; + cursor: pointer; + background-color: #fff; + border-bottom: 1px solid #d4d4d4; +} +.autocomplete-items div:hover { + /*when hovering an item:*/ + background-color: #e9e9e9; +} +.autocomplete-active { + /*when navigating through the items using the arrow keys:*/ + background-color: DodgerBlue !important; + color: #ffffff; +} + + +/* -------- pour cookie-bar ------ */ +#cookie-bar {background:#111111; height:auto; line-height:24px; color:#eeeeee; text-align:center; padding:3px 0;} +#cookie-bar.fixed {position:fixed; top:0; left:0; width:100%;} +#cookie-bar.fixed.bottom {bottom:0; top:auto;} +#cookie-bar p {margin:0; padding:0;} +#cookie-bar a {color:#ffffff; display:inline-block; border-radius:3px; text-decoration:none; padding:0 6px; margin-left:8px;} +#cookie-bar .cb-enable {background:#007700;} +#cookie-bar .cb-enable:hover {background:#009900;} +#cookie-bar .cb-disable {background:#990000;} +#cookie-bar .cb-disable:hover {background:#bb0000;} +#cookie-bar .cb-policy {background:#0033bb;} +#cookie-bar .cb-policy:hover {background:#0055dd;} +/* -------- fin cookie-bar ------ */ diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap.css b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap.css new file mode 100644 index 0000000..6a9e753 --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap.css @@ -0,0 +1,187 @@ +table.dataTable { + clear: both; + margin-top: 6px !important; + margin-bottom: 6px !important; + max-width: none !important; + border-collapse: separate !important; +} +table.dataTable td, +table.dataTable th { + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +table.dataTable td.dataTables_empty, +table.dataTable th.dataTables_empty { + text-align: center; +} +table.dataTable.nowrap th, +table.dataTable.nowrap td { + white-space: nowrap; +} + +div.dataTables_wrapper div.dataTables_length label { + font-weight: normal; + text-align: left; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_length select { + width: 75px; + display: inline-block; +} +div.dataTables_wrapper div.dataTables_filter { + text-align: right; +} +div.dataTables_wrapper div.dataTables_filter label { + font-weight: normal; + white-space: nowrap; + text-align: left; +} +div.dataTables_wrapper div.dataTables_filter input { + margin-left: 0.5em; + display: inline-block; + width: auto; +} +div.dataTables_wrapper div.dataTables_info { + padding-top: 8px; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_paginate { + margin: 0; + white-space: nowrap; + text-align: right; +} +div.dataTables_wrapper div.dataTables_paginate ul.pagination { + margin: 2px 0; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 200px; + margin-left: -100px; + margin-top: -26px; + text-align: center; + padding: 1em 0; +} + +table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, +table.dataTable thead > tr > td.sorting_asc, +table.dataTable thead > tr > td.sorting_desc, +table.dataTable thead > tr > td.sorting { + padding-right: 30px; +} +table.dataTable thead > tr > th:active, +table.dataTable thead > tr > td:active { + outline: none; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; + position: relative; +} +table.dataTable thead .sorting:after, +table.dataTable thead .sorting_asc:after, +table.dataTable thead .sorting_desc:after, +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:after { + position: absolute; + bottom: 8px; + right: 8px; + display: block; + font-family: 'Glyphicons Halflings'; + opacity: 0.5; +} +table.dataTable thead .sorting:after { + opacity: 0.2; + content: "\e150"; + /* sort */ +} +table.dataTable thead .sorting_asc:after { + content: "\e155"; + /* sort-by-attributes */ +} +table.dataTable thead .sorting_desc:after { + content: "\e156"; + /* sort-by-attributes-alt */ +} +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:after { + color: #eee; +} + +div.dataTables_scrollHead table.dataTable { + margin-bottom: 0 !important; +} + +div.dataTables_scrollBody > table { + border-top: none; + margin-top: 0 !important; + margin-bottom: 0 !important; +} +div.dataTables_scrollBody > table > thead .sorting:after, +div.dataTables_scrollBody > table > thead .sorting_asc:after, +div.dataTables_scrollBody > table > thead .sorting_desc:after { + display: none; +} +div.dataTables_scrollBody > table > tbody > tr:first-child > th, +div.dataTables_scrollBody > table > tbody > tr:first-child > td { + border-top: none; +} + +div.dataTables_scrollFoot > .dataTables_scrollFootInner { + box-sizing: content-box; +} +div.dataTables_scrollFoot > .dataTables_scrollFootInner > table { + margin-top: 0 !important; + border-top: none; +} + +@media screen and (max-width: 767px) { + div.dataTables_wrapper div.dataTables_length, + div.dataTables_wrapper div.dataTables_filter, + div.dataTables_wrapper div.dataTables_info, + div.dataTables_wrapper div.dataTables_paginate { + text-align: center; + } +} +table.dataTable.table-condensed > thead > tr > th { + padding-right: 20px; +} +table.dataTable.table-condensed .sorting:after, +table.dataTable.table-condensed .sorting_asc:after, +table.dataTable.table-condensed .sorting_desc:after { + top: 6px; + right: 6px; +} + +table.table-bordered.dataTable th, +table.table-bordered.dataTable td { + border-left-width: 0; +} +table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, +table.table-bordered.dataTable td:last-child, +table.table-bordered.dataTable td:last-child { + border-right-width: 0; +} +table.table-bordered.dataTable tbody th, +table.table-bordered.dataTable tbody td { + border-bottom-width: 0; +} + +div.dataTables_scrollHead table.table-bordered { + border-bottom-width: 0; +} + +div.table-responsive > div.dataTables_wrapper > div.row { + margin: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:first-child { + padding-left: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:last-child { + padding-right: 0; +} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap.min.css b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap.min.css new file mode 100644 index 0000000..af6ecfe --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap.min.css @@ -0,0 +1 @@ +table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:75px;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:8px;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:8px;right:8px;display:block;font-family:'Glyphicons Halflings';opacity:0.5}table.dataTable thead .sorting:after{opacity:0.2;content:"\e150"}table.dataTable thead .sorting_asc:after{content:"\e155"}table.dataTable thead .sorting_desc:after{content:"\e156"}table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{color:#eee}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody>table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody>table>thead .sorting:after,div.dataTables_scrollBody>table>thead .sorting_asc:after,div.dataTables_scrollBody>table>thead .sorting_desc:after{display:none}div.dataTables_scrollBody>table>tbody>tr:first-child>th,div.dataTables_scrollBody>table>tbody>tr:first-child>td{border-top:none}div.dataTables_scrollFoot>.dataTables_scrollFootInner{box-sizing:content-box}div.dataTables_scrollFoot>.dataTables_scrollFootInner>table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-condensed>thead>tr>th{padding-right:20px}table.dataTable.table-condensed .sorting:after,table.dataTable.table-condensed .sorting_asc:after,table.dataTable.table-condensed .sorting_desc:after{top:6px;right:6px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap4.css b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap4.css new file mode 100644 index 0000000..84ec203 --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap4.css @@ -0,0 +1,206 @@ +table.dataTable { + clear: both; + margin-top: 6px !important; + margin-bottom: 6px !important; + max-width: none !important; + border-collapse: separate !important; + border-spacing: 0; +} +table.dataTable td, +table.dataTable th { + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +table.dataTable td.dataTables_empty, +table.dataTable th.dataTables_empty { + text-align: center; +} +table.dataTable.nowrap th, +table.dataTable.nowrap td { + white-space: nowrap; +} + +div.dataTables_wrapper div.dataTables_length label { + font-weight: normal; + text-align: left; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_length select { + width: auto; + display: inline-block; +} +div.dataTables_wrapper div.dataTables_filter { + text-align: right; +} +div.dataTables_wrapper div.dataTables_filter label { + font-weight: normal; + white-space: nowrap; + text-align: left; +} +div.dataTables_wrapper div.dataTables_filter input { + margin-left: 0.5em; + display: inline-block; + width: auto; +} +div.dataTables_wrapper div.dataTables_info { + padding-top: 0.85em; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_paginate { + margin: 0; + white-space: nowrap; + text-align: right; +} +div.dataTables_wrapper div.dataTables_paginate ul.pagination { + margin: 2px 0; + white-space: nowrap; + justify-content: flex-end; +} +div.dataTables_wrapper div.dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 200px; + margin-left: -100px; + margin-top: -26px; + text-align: center; + padding: 1em 0; +} + +table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, +table.dataTable thead > tr > td.sorting_asc, +table.dataTable thead > tr > td.sorting_desc, +table.dataTable thead > tr > td.sorting { + padding-right: 30px; +} +table.dataTable thead > tr > th:active, +table.dataTable thead > tr > td:active { + outline: none; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; + position: relative; +} +table.dataTable thead .sorting:before, table.dataTable thead .sorting:after, +table.dataTable thead .sorting_asc:before, +table.dataTable thead .sorting_asc:after, +table.dataTable thead .sorting_desc:before, +table.dataTable thead .sorting_desc:after, +table.dataTable thead .sorting_asc_disabled:before, +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:before, +table.dataTable thead .sorting_desc_disabled:after { + position: absolute; + bottom: 0.9em; + display: block; + opacity: 0.3; +} +table.dataTable thead .sorting:before, +table.dataTable thead .sorting_asc:before, +table.dataTable thead .sorting_desc:before, +table.dataTable thead .sorting_asc_disabled:before, +table.dataTable thead .sorting_desc_disabled:before { + right: 1em; + content: "\2191"; +} +table.dataTable thead .sorting:after, +table.dataTable thead .sorting_asc:after, +table.dataTable thead .sorting_desc:after, +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:after { + right: 0.5em; + content: "\2193"; +} +table.dataTable thead .sorting_asc:before, +table.dataTable thead .sorting_desc:after { + opacity: 1; +} +table.dataTable thead .sorting_asc_disabled:before, +table.dataTable thead .sorting_desc_disabled:after { + opacity: 0; +} + +div.dataTables_scrollHead table.dataTable { + margin-bottom: 0 !important; +} + +div.dataTables_scrollBody table { + border-top: none; + margin-top: 0 !important; + margin-bottom: 0 !important; +} +div.dataTables_scrollBody table thead .sorting:before, +div.dataTables_scrollBody table thead .sorting_asc:before, +div.dataTables_scrollBody table thead .sorting_desc:before, +div.dataTables_scrollBody table thead .sorting:after, +div.dataTables_scrollBody table thead .sorting_asc:after, +div.dataTables_scrollBody table thead .sorting_desc:after { + display: none; +} +div.dataTables_scrollBody table tbody tr:first-child th, +div.dataTables_scrollBody table tbody tr:first-child td { + border-top: none; +} + +div.dataTables_scrollFoot > .dataTables_scrollFootInner { + box-sizing: content-box; +} +div.dataTables_scrollFoot > .dataTables_scrollFootInner > table { + margin-top: 0 !important; + border-top: none; +} + +@media screen and (max-width: 767px) { + div.dataTables_wrapper div.dataTables_length, + div.dataTables_wrapper div.dataTables_filter, + div.dataTables_wrapper div.dataTables_info, + div.dataTables_wrapper div.dataTables_paginate { + text-align: center; + } +} +table.dataTable.table-sm > thead > tr > th { + padding-right: 20px; +} +table.dataTable.table-sm .sorting:before, +table.dataTable.table-sm .sorting_asc:before, +table.dataTable.table-sm .sorting_desc:before { + top: 5px; + right: 0.85em; +} +table.dataTable.table-sm .sorting:after, +table.dataTable.table-sm .sorting_asc:after, +table.dataTable.table-sm .sorting_desc:after { + top: 5px; +} + +table.table-bordered.dataTable th, +table.table-bordered.dataTable td { + border-left-width: 0; +} +table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, +table.table-bordered.dataTable td:last-child, +table.table-bordered.dataTable td:last-child { + border-right-width: 0; +} +table.table-bordered.dataTable tbody th, +table.table-bordered.dataTable tbody td { + border-bottom-width: 0; +} + +div.dataTables_scrollHead table.table-bordered { + border-bottom-width: 0; +} + +div.table-responsive > div.dataTables_wrapper > div.row { + margin: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:first-child { + padding-left: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:last-child { + padding-right: 0; +} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap4.min.css b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap4.min.css new file mode 100644 index 0000000..f1930be --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.bootstrap4.min.css @@ -0,0 +1 @@ +table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important;border-spacing:0}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:auto;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:0.85em;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap;justify-content:flex-end}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:before,table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:before,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:before,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:0.9em;display:block;opacity:0.3}table.dataTable thead .sorting:before,table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_desc:before,table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_desc_disabled:before{right:1em;content:"\2191"}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{right:0.5em;content:"\2193"}table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_desc:after{opacity:1}table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_desc_disabled:after{opacity:0}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table thead .sorting:before,div.dataTables_scrollBody table thead .sorting_asc:before,div.dataTables_scrollBody table thead .sorting_desc:before,div.dataTables_scrollBody table thead .sorting:after,div.dataTables_scrollBody table thead .sorting_asc:after,div.dataTables_scrollBody table thead .sorting_desc:after{display:none}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot>.dataTables_scrollFootInner{box-sizing:content-box}div.dataTables_scrollFoot>.dataTables_scrollFootInner>table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-sm>thead>tr>th{padding-right:20px}table.dataTable.table-sm .sorting:before,table.dataTable.table-sm .sorting_asc:before,table.dataTable.table-sm .sorting_desc:before{top:5px;right:0.85em}table.dataTable.table-sm .sorting:after,table.dataTable.table-sm .sorting_asc:after,table.dataTable.table-sm .sorting_desc:after{top:5px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.foundation.css b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.foundation.css new file mode 100644 index 0000000..79848c9 --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.foundation.css @@ -0,0 +1,118 @@ +table.dataTable { + clear: both; + margin: 0.5em 0 !important; + max-width: none !important; + width: 100%; +} +table.dataTable td, +table.dataTable th { + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +table.dataTable td.dataTables_empty, +table.dataTable th.dataTables_empty { + text-align: center; +} +table.dataTable.nowrap th, table.dataTable.nowrap td { + white-space: nowrap; +} + +div.dataTables_wrapper { + position: relative; +} +div.dataTables_wrapper div.dataTables_length label { + float: left; + text-align: left; + margin-bottom: 0; +} +div.dataTables_wrapper div.dataTables_length select { + width: 75px; + margin-bottom: 0; +} +div.dataTables_wrapper div.dataTables_filter label { + float: right; + margin-bottom: 0; +} +div.dataTables_wrapper div.dataTables_filter input { + display: inline-block !important; + width: auto !important; + margin-bottom: 0; + margin-left: 0.5em; +} +div.dataTables_wrapper div.dataTables_info { + padding-top: 2px; +} +div.dataTables_wrapper div.dataTables_paginate { + float: right; + margin: 0; +} +div.dataTables_wrapper div.dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 200px; + margin-left: -100px; + margin-top: -26px; + text-align: center; + padding: 1rem 0; +} + +table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, +table.dataTable thead > tr > td.sorting_asc, +table.dataTable thead > tr > td.sorting_desc, +table.dataTable thead > tr > td.sorting { + padding-right: 1.5rem; +} +table.dataTable thead > tr > th:active, +table.dataTable thead > tr > td:active { + outline: none; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + background-repeat: no-repeat; + background-position: center right; +} +table.dataTable thead .sorting { + background-image: url("../images/sort_both.png"); +} +table.dataTable thead .sorting_asc { + background-image: url("../images/sort_asc.png"); +} +table.dataTable thead .sorting_desc { + background-image: url("../images/sort_desc.png"); +} +table.dataTable thead .sorting_asc_disabled { + background-image: url("../images/sort_asc_disabled.png"); +} +table.dataTable thead .sorting_desc_disabled { + background-image: url("../images/sort_desc_disabled.png"); +} + +div.dataTables_scrollHead table { + margin-bottom: 0 !important; +} + +div.dataTables_scrollBody table { + border-top: none; + margin-top: 0 !important; + margin-bottom: 0 !important; +} +div.dataTables_scrollBody table tbody tr:first-child th, +div.dataTables_scrollBody table tbody tr:first-child td { + border-top: none; +} + +div.dataTables_scrollFoot table { + margin-top: 0 !important; + border-top: none; +} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.foundation.min.css b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.foundation.min.css new file mode 100644 index 0000000..73af41e --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.foundation.min.css @@ -0,0 +1 @@ +table.dataTable{clear:both;margin:0.5em 0 !important;max-width:none !important;width:100%}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper{position:relative}div.dataTables_wrapper div.dataTables_length label{float:left;text-align:left;margin-bottom:0}div.dataTables_wrapper div.dataTables_length select{width:75px;margin-bottom:0}div.dataTables_wrapper div.dataTables_filter label{float:right;margin-bottom:0}div.dataTables_wrapper div.dataTables_filter input{display:inline-block !important;width:auto !important;margin-bottom:0;margin-left:0.5em}div.dataTables_wrapper div.dataTables_info{padding-top:2px}div.dataTables_wrapper div.dataTables_paginate{float:right;margin:0}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1rem 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:1.5rem}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{background-repeat:no-repeat;background-position:center right}table.dataTable thead .sorting{background-image:url("../images/sort_both.png")}table.dataTable thead .sorting_asc{background-image:url("../images/sort_asc.png")}table.dataTable thead .sorting_desc{background-image:url("../images/sort_desc.png")}table.dataTable thead .sorting_asc_disabled{background-image:url("../images/sort_asc_disabled.png")}table.dataTable thead .sorting_desc_disabled{background-image:url("../images/sort_desc_disabled.png")}div.dataTables_scrollHead table{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot table{margin-top:0 !important;border-top:none} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.jqueryui.css b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.jqueryui.css new file mode 100644 index 0000000..5070b04 --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.jqueryui.css @@ -0,0 +1,481 @@ +/* + * Table styles + */ +table.dataTable { + width: 100%; + margin: 0 auto; + clear: both; + border-collapse: separate; + border-spacing: 0; + /* + * Header and footer styles + */ + /* + * Body styles + */ +} +table.dataTable thead th, +table.dataTable tfoot th { + font-weight: bold; +} +table.dataTable thead th, +table.dataTable thead td { + padding: 10px 18px; +} +table.dataTable thead th:active, +table.dataTable thead td:active { + outline: none; +} +table.dataTable tfoot th, +table.dataTable tfoot td { + padding: 10px 18px 6px 18px; +} +table.dataTable tbody tr { + background-color: #ffffff; +} +table.dataTable tbody tr.selected { + background-color: #B0BED9; +} +table.dataTable tbody th, +table.dataTable tbody td { + padding: 8px 10px; +} +table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td { + border-top: 1px solid #ddd; +} +table.dataTable.row-border tbody tr:first-child th, +table.dataTable.row-border tbody tr:first-child td, table.dataTable.display tbody tr:first-child th, +table.dataTable.display tbody tr:first-child td { + border-top: none; +} +table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td { + border-top: 1px solid #ddd; + border-right: 1px solid #ddd; +} +table.dataTable.cell-border tbody tr th:first-child, +table.dataTable.cell-border tbody tr td:first-child { + border-left: 1px solid #ddd; +} +table.dataTable.cell-border tbody tr:first-child th, +table.dataTable.cell-border tbody tr:first-child td { + border-top: none; +} +table.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd { + background-color: #f9f9f9; +} +table.dataTable.stripe tbody tr.odd.selected, table.dataTable.display tbody tr.odd.selected { + background-color: #acbad4; +} +table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover { + background-color: #f6f6f6; +} +table.dataTable.hover tbody tr:hover.selected, table.dataTable.display tbody tr:hover.selected { + background-color: #aab7d1; +} +table.dataTable.order-column tbody tr > .sorting_1, +table.dataTable.order-column tbody tr > .sorting_2, +table.dataTable.order-column tbody tr > .sorting_3, table.dataTable.display tbody tr > .sorting_1, +table.dataTable.display tbody tr > .sorting_2, +table.dataTable.display tbody tr > .sorting_3 { + background-color: #fafafa; +} +table.dataTable.order-column tbody tr.selected > .sorting_1, +table.dataTable.order-column tbody tr.selected > .sorting_2, +table.dataTable.order-column tbody tr.selected > .sorting_3, table.dataTable.display tbody tr.selected > .sorting_1, +table.dataTable.display tbody tr.selected > .sorting_2, +table.dataTable.display tbody tr.selected > .sorting_3 { + background-color: #acbad5; +} +table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 { + background-color: #f1f1f1; +} +table.dataTable.display tbody tr.odd > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd > .sorting_2 { + background-color: #f3f3f3; +} +table.dataTable.display tbody tr.odd > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd > .sorting_3 { + background-color: whitesmoke; +} +table.dataTable.display tbody tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 { + background-color: #a6b4cd; +} +table.dataTable.display tbody tr.odd.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 { + background-color: #a8b5cf; +} +table.dataTable.display tbody tr.odd.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 { + background-color: #a9b7d1; +} +table.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-column.stripe tbody tr.even > .sorting_1 { + background-color: #fafafa; +} +table.dataTable.display tbody tr.even > .sorting_2, table.dataTable.order-column.stripe tbody tr.even > .sorting_2 { + background-color: #fcfcfc; +} +table.dataTable.display tbody tr.even > .sorting_3, table.dataTable.order-column.stripe tbody tr.even > .sorting_3 { + background-color: #fefefe; +} +table.dataTable.display tbody tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 { + background-color: #acbad5; +} +table.dataTable.display tbody tr.even.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 { + background-color: #aebcd6; +} +table.dataTable.display tbody tr.even.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 { + background-color: #afbdd8; +} +table.dataTable.display tbody tr:hover > .sorting_1, table.dataTable.order-column.hover tbody tr:hover > .sorting_1 { + background-color: #eaeaea; +} +table.dataTable.display tbody tr:hover > .sorting_2, table.dataTable.order-column.hover tbody tr:hover > .sorting_2 { + background-color: #ececec; +} +table.dataTable.display tbody tr:hover > .sorting_3, table.dataTable.order-column.hover tbody tr:hover > .sorting_3 { + background-color: #efefef; +} +table.dataTable.display tbody tr:hover.selected > .sorting_1, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 { + background-color: #a2aec7; +} +table.dataTable.display tbody tr:hover.selected > .sorting_2, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 { + background-color: #a3b0c9; +} +table.dataTable.display tbody tr:hover.selected > .sorting_3, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 { + background-color: #a5b2cb; +} +table.dataTable.no-footer { + border-bottom: 1px solid #111; +} +table.dataTable.nowrap th, table.dataTable.nowrap td { + white-space: nowrap; +} +table.dataTable.compact thead th, +table.dataTable.compact thead td { + padding: 4px 17px 4px 4px; +} +table.dataTable.compact tfoot th, +table.dataTable.compact tfoot td { + padding: 4px; +} +table.dataTable.compact tbody th, +table.dataTable.compact tbody td { + padding: 4px; +} +table.dataTable th.dt-left, +table.dataTable td.dt-left { + text-align: left; +} +table.dataTable th.dt-center, +table.dataTable td.dt-center, +table.dataTable td.dataTables_empty { + text-align: center; +} +table.dataTable th.dt-right, +table.dataTable td.dt-right { + text-align: right; +} +table.dataTable th.dt-justify, +table.dataTable td.dt-justify { + text-align: justify; +} +table.dataTable th.dt-nowrap, +table.dataTable td.dt-nowrap { + white-space: nowrap; +} +table.dataTable thead th.dt-head-left, +table.dataTable thead td.dt-head-left, +table.dataTable tfoot th.dt-head-left, +table.dataTable tfoot td.dt-head-left { + text-align: left; +} +table.dataTable thead th.dt-head-center, +table.dataTable thead td.dt-head-center, +table.dataTable tfoot th.dt-head-center, +table.dataTable tfoot td.dt-head-center { + text-align: center; +} +table.dataTable thead th.dt-head-right, +table.dataTable thead td.dt-head-right, +table.dataTable tfoot th.dt-head-right, +table.dataTable tfoot td.dt-head-right { + text-align: right; +} +table.dataTable thead th.dt-head-justify, +table.dataTable thead td.dt-head-justify, +table.dataTable tfoot th.dt-head-justify, +table.dataTable tfoot td.dt-head-justify { + text-align: justify; +} +table.dataTable thead th.dt-head-nowrap, +table.dataTable thead td.dt-head-nowrap, +table.dataTable tfoot th.dt-head-nowrap, +table.dataTable tfoot td.dt-head-nowrap { + white-space: nowrap; +} +table.dataTable tbody th.dt-body-left, +table.dataTable tbody td.dt-body-left { + text-align: left; +} +table.dataTable tbody th.dt-body-center, +table.dataTable tbody td.dt-body-center { + text-align: center; +} +table.dataTable tbody th.dt-body-right, +table.dataTable tbody td.dt-body-right { + text-align: right; +} +table.dataTable tbody th.dt-body-justify, +table.dataTable tbody td.dt-body-justify { + text-align: justify; +} +table.dataTable tbody th.dt-body-nowrap, +table.dataTable tbody td.dt-body-nowrap { + white-space: nowrap; +} + +table.dataTable, +table.dataTable th, +table.dataTable td { + box-sizing: content-box; +} + +/* + * Control feature layout + */ +.dataTables_wrapper { + position: relative; + clear: both; + *zoom: 1; + zoom: 1; +} +.dataTables_wrapper .dataTables_length { + float: left; +} +.dataTables_wrapper .dataTables_filter { + float: right; + text-align: right; +} +.dataTables_wrapper .dataTables_filter input { + margin-left: 0.5em; +} +.dataTables_wrapper .dataTables_info { + clear: both; + float: left; + padding-top: 0.755em; +} +.dataTables_wrapper .dataTables_paginate { + float: right; + text-align: right; + padding-top: 0.25em; +} +.dataTables_wrapper .dataTables_paginate .paginate_button { + box-sizing: border-box; + display: inline-block; + min-width: 1.5em; + padding: 0.5em 1em; + margin-left: 2px; + text-align: center; + text-decoration: none !important; + cursor: pointer; + *cursor: hand; + color: #333 !important; + border: 1px solid transparent; + border-radius: 2px; +} +.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover { + color: #333 !important; + border: 1px solid #979797; + background-color: white; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, white), color-stop(100%, #dcdcdc)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, white 0%, #dcdcdc 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, white 0%, #dcdcdc 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, white 0%, #dcdcdc 100%); + /* IE10+ */ + background: -o-linear-gradient(top, white 0%, #dcdcdc 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, white 0%, #dcdcdc 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_paginate .paginate_button.disabled, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active { + cursor: default; + color: #666 !important; + border: 1px solid transparent; + background: transparent; + box-shadow: none; +} +.dataTables_wrapper .dataTables_paginate .paginate_button:hover { + color: white !important; + border: 1px solid #111; + background-color: #585858; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #585858 0%, #111 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #585858 0%, #111 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, #585858 0%, #111 100%); + /* IE10+ */ + background: -o-linear-gradient(top, #585858 0%, #111 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, #585858 0%, #111 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_paginate .paginate_button:active { + outline: none; + background-color: #2b2b2b; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* IE10+ */ + background: -o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%); + /* W3C */ + box-shadow: inset 0 0 3px #111; +} +.dataTables_wrapper .dataTables_paginate .ellipsis { + padding: 0 1em; +} +.dataTables_wrapper .dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 100%; + height: 40px; + margin-left: -50%; + margin-top: -25px; + padding-top: 20px; + text-align: center; + font-size: 1.2em; + background-color: white; + background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(25%, rgba(255, 255, 255, 0.9)), color-stop(75%, rgba(255, 255, 255, 0.9)), color-stop(100%, rgba(255, 255, 255, 0))); + background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); +} +.dataTables_wrapper .dataTables_length, +.dataTables_wrapper .dataTables_filter, +.dataTables_wrapper .dataTables_info, +.dataTables_wrapper .dataTables_processing, +.dataTables_wrapper .dataTables_paginate { + color: #333; +} +.dataTables_wrapper .dataTables_scroll { + clear: both; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody { + *margin-top: -1px; + -webkit-overflow-scrolling: touch; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td { + vertical-align: middle; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th > div.dataTables_sizing, +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td > div.dataTables_sizing, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th > div.dataTables_sizing, +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td > div.dataTables_sizing { + height: 0; + overflow: hidden; + margin: 0 !important; + padding: 0 !important; +} +.dataTables_wrapper.no-footer .dataTables_scrollBody { + border-bottom: 1px solid #111; +} +.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable, +.dataTables_wrapper.no-footer div.dataTables_scrollBody > table { + border-bottom: none; +} +.dataTables_wrapper:after { + visibility: hidden; + display: block; + content: ""; + clear: both; + height: 0; +} + +@media screen and (max-width: 767px) { + .dataTables_wrapper .dataTables_info, + .dataTables_wrapper .dataTables_paginate { + float: none; + text-align: center; + } + .dataTables_wrapper .dataTables_paginate { + margin-top: 0.5em; + } +} +@media screen and (max-width: 640px) { + .dataTables_wrapper .dataTables_length, + .dataTables_wrapper .dataTables_filter { + float: none; + text-align: center; + } + .dataTables_wrapper .dataTables_filter { + margin-top: 0.5em; + } +} +table.dataTable thead th div.DataTables_sort_wrapper { + position: relative; +} +table.dataTable thead th div.DataTables_sort_wrapper span { + position: absolute; + top: 50%; + margin-top: -8px; + right: -18px; +} +table.dataTable thead th.ui-state-default, +table.dataTable tfoot th.ui-state-default { + border-left-width: 0; +} +table.dataTable thead th.ui-state-default:first-child, +table.dataTable tfoot th.ui-state-default:first-child { + border-left-width: 1px; +} + +/* + * Control feature layout + */ +.dataTables_wrapper .dataTables_paginate .fg-button { + box-sizing: border-box; + display: inline-block; + min-width: 1.5em; + padding: 0.5em; + margin-left: 2px; + text-align: center; + text-decoration: none !important; + cursor: pointer; + *cursor: hand; + border: 1px solid transparent; +} +.dataTables_wrapper .dataTables_paginate .fg-button:active { + outline: none; +} +.dataTables_wrapper .dataTables_paginate .fg-button:first-child { + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} +.dataTables_wrapper .dataTables_paginate .fg-button:last-child { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +.dataTables_wrapper .ui-widget-header { + font-weight: normal; +} +.dataTables_wrapper .ui-toolbar { + padding: 8px; +} +.dataTables_wrapper.no-footer .dataTables_scrollBody { + border-bottom: none; +} +.dataTables_wrapper .dataTables_length, +.dataTables_wrapper .dataTables_filter, +.dataTables_wrapper .dataTables_info, +.dataTables_wrapper .dataTables_processing, +.dataTables_wrapper .dataTables_paginate { + color: inherit; +} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.jqueryui.min.css b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.jqueryui.min.css new file mode 100644 index 0000000..4e99c26 --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.jqueryui.min.css @@ -0,0 +1 @@ +table.dataTable{width:100%;margin:0 auto;clear:both;border-collapse:separate;border-spacing:0}table.dataTable thead th,table.dataTable tfoot th{font-weight:bold}table.dataTable thead th,table.dataTable thead td{padding:10px 18px}table.dataTable thead th:active,table.dataTable thead td:active{outline:none}table.dataTable tfoot th,table.dataTable tfoot td{padding:10px 18px 6px 18px}table.dataTable tbody tr{background-color:#ffffff}table.dataTable tbody tr.selected{background-color:#B0BED9}table.dataTable tbody th,table.dataTable tbody td{padding:8px 10px}table.dataTable.row-border tbody th,table.dataTable.row-border tbody td,table.dataTable.display tbody th,table.dataTable.display tbody td{border-top:1px solid #ddd}table.dataTable.row-border tbody tr:first-child th,table.dataTable.row-border tbody tr:first-child td,table.dataTable.display tbody tr:first-child th,table.dataTable.display tbody tr:first-child td{border-top:none}table.dataTable.cell-border tbody th,table.dataTable.cell-border tbody td{border-top:1px solid #ddd;border-right:1px solid #ddd}table.dataTable.cell-border tbody tr th:first-child,table.dataTable.cell-border tbody tr td:first-child{border-left:1px solid #ddd}table.dataTable.cell-border tbody tr:first-child th,table.dataTable.cell-border tbody tr:first-child td{border-top:none}table.dataTable.stripe tbody tr.odd,table.dataTable.display tbody tr.odd{background-color:#f9f9f9}table.dataTable.stripe tbody tr.odd.selected,table.dataTable.display tbody tr.odd.selected{background-color:#acbad4}table.dataTable.hover tbody tr:hover,table.dataTable.display tbody tr:hover{background-color:#f6f6f6}table.dataTable.hover tbody tr:hover.selected,table.dataTable.display tbody tr:hover.selected{background-color:#aab7d1}table.dataTable.order-column tbody tr>.sorting_1,table.dataTable.order-column tbody tr>.sorting_2,table.dataTable.order-column tbody tr>.sorting_3,table.dataTable.display tbody tr>.sorting_1,table.dataTable.display tbody tr>.sorting_2,table.dataTable.display tbody tr>.sorting_3{background-color:#fafafa}table.dataTable.order-column tbody tr.selected>.sorting_1,table.dataTable.order-column tbody tr.selected>.sorting_2,table.dataTable.order-column tbody tr.selected>.sorting_3,table.dataTable.display tbody tr.selected>.sorting_1,table.dataTable.display tbody tr.selected>.sorting_2,table.dataTable.display tbody tr.selected>.sorting_3{background-color:#acbad5}table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd>.sorting_1{background-color:#f1f1f1}table.dataTable.display tbody tr.odd>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd>.sorting_2{background-color:#f3f3f3}table.dataTable.display tbody tr.odd>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd>.sorting_3{background-color:whitesmoke}table.dataTable.display tbody tr.odd.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_1{background-color:#a6b4cd}table.dataTable.display tbody tr.odd.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_2{background-color:#a8b5cf}table.dataTable.display tbody tr.odd.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_3{background-color:#a9b7d1}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.order-column.stripe tbody tr.even>.sorting_1{background-color:#fafafa}table.dataTable.display tbody tr.even>.sorting_2,table.dataTable.order-column.stripe tbody tr.even>.sorting_2{background-color:#fcfcfc}table.dataTable.display tbody tr.even>.sorting_3,table.dataTable.order-column.stripe tbody tr.even>.sorting_3{background-color:#fefefe}table.dataTable.display tbody tr.even.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_1{background-color:#acbad5}table.dataTable.display tbody tr.even.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_2{background-color:#aebcd6}table.dataTable.display tbody tr.even.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_3{background-color:#afbdd8}table.dataTable.display tbody tr:hover>.sorting_1,table.dataTable.order-column.hover tbody tr:hover>.sorting_1{background-color:#eaeaea}table.dataTable.display tbody tr:hover>.sorting_2,table.dataTable.order-column.hover tbody tr:hover>.sorting_2{background-color:#ececec}table.dataTable.display tbody tr:hover>.sorting_3,table.dataTable.order-column.hover tbody tr:hover>.sorting_3{background-color:#efefef}table.dataTable.display tbody tr:hover.selected>.sorting_1,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_1{background-color:#a2aec7}table.dataTable.display tbody tr:hover.selected>.sorting_2,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_2{background-color:#a3b0c9}table.dataTable.display tbody tr:hover.selected>.sorting_3,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_3{background-color:#a5b2cb}table.dataTable.no-footer{border-bottom:1px solid #111}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}table.dataTable.compact thead th,table.dataTable.compact thead td{padding:4px 17px 4px 4px}table.dataTable.compact tfoot th,table.dataTable.compact tfoot td{padding:4px}table.dataTable.compact tbody th,table.dataTable.compact tbody td{padding:4px}table.dataTable th.dt-left,table.dataTable td.dt-left{text-align:left}table.dataTable th.dt-center,table.dataTable td.dt-center,table.dataTable td.dataTables_empty{text-align:center}table.dataTable th.dt-right,table.dataTable td.dt-right{text-align:right}table.dataTable th.dt-justify,table.dataTable td.dt-justify{text-align:justify}table.dataTable th.dt-nowrap,table.dataTable td.dt-nowrap{white-space:nowrap}table.dataTable thead th.dt-head-left,table.dataTable thead td.dt-head-left,table.dataTable tfoot th.dt-head-left,table.dataTable tfoot td.dt-head-left{text-align:left}table.dataTable thead th.dt-head-center,table.dataTable thead td.dt-head-center,table.dataTable tfoot th.dt-head-center,table.dataTable tfoot td.dt-head-center{text-align:center}table.dataTable thead th.dt-head-right,table.dataTable thead td.dt-head-right,table.dataTable tfoot th.dt-head-right,table.dataTable tfoot td.dt-head-right{text-align:right}table.dataTable thead th.dt-head-justify,table.dataTable thead td.dt-head-justify,table.dataTable tfoot th.dt-head-justify,table.dataTable tfoot td.dt-head-justify{text-align:justify}table.dataTable thead th.dt-head-nowrap,table.dataTable thead td.dt-head-nowrap,table.dataTable tfoot th.dt-head-nowrap,table.dataTable tfoot td.dt-head-nowrap{white-space:nowrap}table.dataTable tbody th.dt-body-left,table.dataTable tbody td.dt-body-left{text-align:left}table.dataTable tbody th.dt-body-center,table.dataTable tbody td.dt-body-center{text-align:center}table.dataTable tbody th.dt-body-right,table.dataTable tbody td.dt-body-right{text-align:right}table.dataTable tbody th.dt-body-justify,table.dataTable tbody td.dt-body-justify{text-align:justify}table.dataTable tbody th.dt-body-nowrap,table.dataTable tbody td.dt-body-nowrap{white-space:nowrap}table.dataTable,table.dataTable th,table.dataTable td{box-sizing:content-box}.dataTables_wrapper{position:relative;clear:both;*zoom:1;zoom:1}.dataTables_wrapper .dataTables_length{float:left}.dataTables_wrapper .dataTables_filter{float:right;text-align:right}.dataTables_wrapper .dataTables_filter input{margin-left:0.5em}.dataTables_wrapper .dataTables_info{clear:both;float:left;padding-top:0.755em}.dataTables_wrapper .dataTables_paginate{float:right;text-align:right;padding-top:0.25em}.dataTables_wrapper .dataTables_paginate .paginate_button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:0.5em 1em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;*cursor:hand;color:#333 !important;border:1px solid transparent;border-radius:2px}.dataTables_wrapper .dataTables_paginate .paginate_button.current,.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover{color:#333 !important;border:1px solid #979797;background-color:white;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(100%, #dcdcdc));background:-webkit-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-moz-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-ms-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-o-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:linear-gradient(to bottom, #fff 0%, #dcdcdc 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active{cursor:default;color:#666 !important;border:1px solid transparent;background:transparent;box-shadow:none}.dataTables_wrapper .dataTables_paginate .paginate_button:hover{color:white !important;border:1px solid #111;background-color:#585858;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));background:-webkit-linear-gradient(top, #585858 0%, #111 100%);background:-moz-linear-gradient(top, #585858 0%, #111 100%);background:-ms-linear-gradient(top, #585858 0%, #111 100%);background:-o-linear-gradient(top, #585858 0%, #111 100%);background:linear-gradient(to bottom, #585858 0%, #111 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button:active{outline:none;background-color:#2b2b2b;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));background:-webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);box-shadow:inset 0 0 3px #111}.dataTables_wrapper .dataTables_paginate .ellipsis{padding:0 1em}.dataTables_wrapper .dataTables_processing{position:absolute;top:50%;left:50%;width:100%;height:40px;margin-left:-50%;margin-top:-25px;padding-top:20px;text-align:center;font-size:1.2em;background-color:white;background:-webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0)));background:-webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%)}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:#333}.dataTables_wrapper .dataTables_scroll{clear:both}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td{vertical-align:middle}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td>div.dataTables_sizing{height:0;overflow:hidden;margin:0 !important;padding:0 !important}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:1px solid #111}.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,.dataTables_wrapper.no-footer div.dataTables_scrollBody>table{border-bottom:none}.dataTables_wrapper:after{visibility:hidden;display:block;content:"";clear:both;height:0}@media screen and (max-width: 767px){.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_paginate{float:none;text-align:center}.dataTables_wrapper .dataTables_paginate{margin-top:0.5em}}@media screen and (max-width: 640px){.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter{float:none;text-align:center}.dataTables_wrapper .dataTables_filter{margin-top:0.5em}}table.dataTable thead th div.DataTables_sort_wrapper{position:relative}table.dataTable thead th div.DataTables_sort_wrapper span{position:absolute;top:50%;margin-top:-8px;right:-18px}table.dataTable thead th.ui-state-default,table.dataTable tfoot th.ui-state-default{border-left-width:0}table.dataTable thead th.ui-state-default:first-child,table.dataTable tfoot th.ui-state-default:first-child{border-left-width:1px}.dataTables_wrapper .dataTables_paginate .fg-button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:0.5em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;*cursor:hand;border:1px solid transparent}.dataTables_wrapper .dataTables_paginate .fg-button:active{outline:none}.dataTables_wrapper .dataTables_paginate .fg-button:first-child{border-top-left-radius:3px;border-bottom-left-radius:3px}.dataTables_wrapper .dataTables_paginate .fg-button:last-child{border-top-right-radius:3px;border-bottom-right-radius:3px}.dataTables_wrapper .ui-widget-header{font-weight:normal}.dataTables_wrapper .ui-toolbar{padding:8px}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:none}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:inherit} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.semanticui.css b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.semanticui.css new file mode 100644 index 0000000..077db2a --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.semanticui.css @@ -0,0 +1,102 @@ +/* + * Styling for DataTables with Semantic UI + */ +table.dataTable.table { + margin: 0; +} +table.dataTable.table thead th, +table.dataTable.table thead td { + position: relative; +} +table.dataTable.table thead th.sorting, table.dataTable.table thead th.sorting_asc, table.dataTable.table thead th.sorting_desc, +table.dataTable.table thead td.sorting, +table.dataTable.table thead td.sorting_asc, +table.dataTable.table thead td.sorting_desc { + padding-right: 20px; +} +table.dataTable.table thead th.sorting:after, table.dataTable.table thead th.sorting_asc:after, table.dataTable.table thead th.sorting_desc:after, +table.dataTable.table thead td.sorting:after, +table.dataTable.table thead td.sorting_asc:after, +table.dataTable.table thead td.sorting_desc:after { + position: absolute; + top: 12px; + right: 8px; + display: block; + font-family: Icons; +} +table.dataTable.table thead th.sorting:after, +table.dataTable.table thead td.sorting:after { + content: "\f0dc"; + color: #ddd; + font-size: 0.8em; +} +table.dataTable.table thead th.sorting_asc:after, +table.dataTable.table thead td.sorting_asc:after { + content: "\f0de"; +} +table.dataTable.table thead th.sorting_desc:after, +table.dataTable.table thead td.sorting_desc:after { + content: "\f0dd"; +} +table.dataTable.table td, +table.dataTable.table th { + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +table.dataTable.table td.dataTables_empty, +table.dataTable.table th.dataTables_empty { + text-align: center; +} +table.dataTable.table.nowrap th, +table.dataTable.table.nowrap td { + white-space: nowrap; +} + +div.dataTables_wrapper div.dataTables_length select { + vertical-align: middle; + min-height: 2.7142em; +} +div.dataTables_wrapper div.dataTables_length .ui.selection.dropdown { + min-width: 0; +} +div.dataTables_wrapper div.dataTables_filter span.input { + margin-left: 0.5em; +} +div.dataTables_wrapper div.dataTables_info { + padding-top: 13px; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 200px; + margin-left: -100px; + text-align: center; +} +div.dataTables_wrapper div.row.dt-table { + padding: 0; +} +div.dataTables_wrapper div.dataTables_scrollHead table.dataTable { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + border-bottom: none; +} +div.dataTables_wrapper div.dataTables_scrollBody thead .sorting:after, +div.dataTables_wrapper div.dataTables_scrollBody thead .sorting_asc:after, +div.dataTables_wrapper div.dataTables_scrollBody thead .sorting_desc:after { + display: none; +} +div.dataTables_wrapper div.dataTables_scrollBody table.dataTable { + border-radius: 0; + border-top: none; + border-bottom-width: 0; +} +div.dataTables_wrapper div.dataTables_scrollBody table.dataTable.no-footer { + border-bottom-width: 1px; +} +div.dataTables_wrapper div.dataTables_scrollFoot table.dataTable { + border-top-right-radius: 0; + border-top-left-radius: 0; + border-top: none; +} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.semanticui.min.css b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.semanticui.min.css new file mode 100644 index 0000000..fcffe0c --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/dataTables.semanticui.min.css @@ -0,0 +1 @@ +table.dataTable.table{margin:0}table.dataTable.table thead th,table.dataTable.table thead td{position:relative}table.dataTable.table thead th.sorting,table.dataTable.table thead th.sorting_asc,table.dataTable.table thead th.sorting_desc,table.dataTable.table thead td.sorting,table.dataTable.table thead td.sorting_asc,table.dataTable.table thead td.sorting_desc{padding-right:20px}table.dataTable.table thead th.sorting:after,table.dataTable.table thead th.sorting_asc:after,table.dataTable.table thead th.sorting_desc:after,table.dataTable.table thead td.sorting:after,table.dataTable.table thead td.sorting_asc:after,table.dataTable.table thead td.sorting_desc:after{position:absolute;top:12px;right:8px;display:block;font-family:Icons}table.dataTable.table thead th.sorting:after,table.dataTable.table thead td.sorting:after{content:"\f0dc";color:#ddd;font-size:0.8em}table.dataTable.table thead th.sorting_asc:after,table.dataTable.table thead td.sorting_asc:after{content:"\f0de"}table.dataTable.table thead th.sorting_desc:after,table.dataTable.table thead td.sorting_desc:after{content:"\f0dd"}table.dataTable.table td,table.dataTable.table th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable.table td.dataTables_empty,table.dataTable.table th.dataTables_empty{text-align:center}table.dataTable.table.nowrap th,table.dataTable.table.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{vertical-align:middle;min-height:2.7142em}div.dataTables_wrapper div.dataTables_length .ui.selection.dropdown{min-width:0}div.dataTables_wrapper div.dataTables_filter span.input{margin-left:0.5em}div.dataTables_wrapper div.dataTables_info{padding-top:13px;white-space:nowrap}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;text-align:center}div.dataTables_wrapper div.row.dt-table{padding:0}div.dataTables_wrapper div.dataTables_scrollHead table.dataTable{border-bottom-right-radius:0;border-bottom-left-radius:0;border-bottom:none}div.dataTables_wrapper div.dataTables_scrollBody thead .sorting:after,div.dataTables_wrapper div.dataTables_scrollBody thead .sorting_asc:after,div.dataTables_wrapper div.dataTables_scrollBody thead .sorting_desc:after{display:none}div.dataTables_wrapper div.dataTables_scrollBody table.dataTable{border-radius:0;border-top:none;border-bottom-width:0}div.dataTables_wrapper div.dataTables_scrollBody table.dataTable.no-footer{border-bottom-width:1px}div.dataTables_wrapper div.dataTables_scrollFoot table.dataTable{border-top-right-radius:0;border-top-left-radius:0;border-top:none} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/jquery.dataTables.css b/aem_gestion/static/dist/DataTables-1.10.20/css/jquery.dataTables.css new file mode 100644 index 0000000..760eccb --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/jquery.dataTables.css @@ -0,0 +1,448 @@ +/* + * Table styles + */ +table.dataTable { + width: 100%; + margin: 0 auto; + clear: both; + border-collapse: separate; + border-spacing: 0; + /* + * Header and footer styles + */ + /* + * Body styles + */ +} +table.dataTable thead th, +table.dataTable tfoot th { + font-weight: bold; +} +table.dataTable thead th, +table.dataTable thead td { + padding: 10px 18px; + border-bottom: 1px solid #111; +} +table.dataTable thead th:active, +table.dataTable thead td:active { + outline: none; +} +table.dataTable tfoot th, +table.dataTable tfoot td { + padding: 10px 18px 6px 18px; + border-top: 1px solid #111; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; + *cursor: hand; + background-repeat: no-repeat; + background-position: center right; +} +table.dataTable thead .sorting { + background-image: url("../images/sort_both.png"); +} +table.dataTable thead .sorting_asc { + background-image: url("../images/sort_asc.png"); +} +table.dataTable thead .sorting_desc { + background-image: url("../images/sort_desc.png"); +} +table.dataTable thead .sorting_asc_disabled { + background-image: url("../images/sort_asc_disabled.png"); +} +table.dataTable thead .sorting_desc_disabled { + background-image: url("../images/sort_desc_disabled.png"); +} +table.dataTable tbody tr { + background-color: #ffffff; +} +table.dataTable tbody tr.selected { + background-color: #B0BED9; +} +table.dataTable tbody th, +table.dataTable tbody td { + padding: 8px 10px; +} +table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td { + border-top: 1px solid #ddd; +} +table.dataTable.row-border tbody tr:first-child th, +table.dataTable.row-border tbody tr:first-child td, table.dataTable.display tbody tr:first-child th, +table.dataTable.display tbody tr:first-child td { + border-top: none; +} +table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td { + border-top: 1px solid #ddd; + border-right: 1px solid #ddd; +} +table.dataTable.cell-border tbody tr th:first-child, +table.dataTable.cell-border tbody tr td:first-child { + border-left: 1px solid #ddd; +} +table.dataTable.cell-border tbody tr:first-child th, +table.dataTable.cell-border tbody tr:first-child td { + border-top: none; +} +table.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd { + background-color: #f9f9f9; +} +table.dataTable.stripe tbody tr.odd.selected, table.dataTable.display tbody tr.odd.selected { + background-color: #acbad4; +} +table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hover { + background-color: #f6f6f6; +} +table.dataTable.hover tbody tr:hover.selected, table.dataTable.display tbody tr:hover.selected { + background-color: #aab7d1; +} +table.dataTable.order-column tbody tr > .sorting_1, +table.dataTable.order-column tbody tr > .sorting_2, +table.dataTable.order-column tbody tr > .sorting_3, table.dataTable.display tbody tr > .sorting_1, +table.dataTable.display tbody tr > .sorting_2, +table.dataTable.display tbody tr > .sorting_3 { + background-color: #fafafa; +} +table.dataTable.order-column tbody tr.selected > .sorting_1, +table.dataTable.order-column tbody tr.selected > .sorting_2, +table.dataTable.order-column tbody tr.selected > .sorting_3, table.dataTable.display tbody tr.selected > .sorting_1, +table.dataTable.display tbody tr.selected > .sorting_2, +table.dataTable.display tbody tr.selected > .sorting_3 { + background-color: #acbad5; +} +table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 { + background-color: #f1f1f1; +} +table.dataTable.display tbody tr.odd > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd > .sorting_2 { + background-color: #f3f3f3; +} +table.dataTable.display tbody tr.odd > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd > .sorting_3 { + background-color: whitesmoke; +} +table.dataTable.display tbody tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 { + background-color: #a6b4cd; +} +table.dataTable.display tbody tr.odd.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 { + background-color: #a8b5cf; +} +table.dataTable.display tbody tr.odd.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 { + background-color: #a9b7d1; +} +table.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-column.stripe tbody tr.even > .sorting_1 { + background-color: #fafafa; +} +table.dataTable.display tbody tr.even > .sorting_2, table.dataTable.order-column.stripe tbody tr.even > .sorting_2 { + background-color: #fcfcfc; +} +table.dataTable.display tbody tr.even > .sorting_3, table.dataTable.order-column.stripe tbody tr.even > .sorting_3 { + background-color: #fefefe; +} +table.dataTable.display tbody tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 { + background-color: #acbad5; +} +table.dataTable.display tbody tr.even.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 { + background-color: #aebcd6; +} +table.dataTable.display tbody tr.even.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 { + background-color: #afbdd8; +} +table.dataTable.display tbody tr:hover > .sorting_1, table.dataTable.order-column.hover tbody tr:hover > .sorting_1 { + background-color: #eaeaea; +} +table.dataTable.display tbody tr:hover > .sorting_2, table.dataTable.order-column.hover tbody tr:hover > .sorting_2 { + background-color: #ececec; +} +table.dataTable.display tbody tr:hover > .sorting_3, table.dataTable.order-column.hover tbody tr:hover > .sorting_3 { + background-color: #efefef; +} +table.dataTable.display tbody tr:hover.selected > .sorting_1, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_1 { + background-color: #a2aec7; +} +table.dataTable.display tbody tr:hover.selected > .sorting_2, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_2 { + background-color: #a3b0c9; +} +table.dataTable.display tbody tr:hover.selected > .sorting_3, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_3 { + background-color: #a5b2cb; +} +table.dataTable.no-footer { + border-bottom: 1px solid #111; +} +table.dataTable.nowrap th, table.dataTable.nowrap td { + white-space: nowrap; +} +table.dataTable.compact thead th, +table.dataTable.compact thead td { + padding: 4px 17px 4px 4px; +} +table.dataTable.compact tfoot th, +table.dataTable.compact tfoot td { + padding: 4px; +} +table.dataTable.compact tbody th, +table.dataTable.compact tbody td { + padding: 4px; +} +table.dataTable th.dt-left, +table.dataTable td.dt-left { + text-align: left; +} +table.dataTable th.dt-center, +table.dataTable td.dt-center, +table.dataTable td.dataTables_empty { + text-align: center; +} +table.dataTable th.dt-right, +table.dataTable td.dt-right { + text-align: right; +} +table.dataTable th.dt-justify, +table.dataTable td.dt-justify { + text-align: justify; +} +table.dataTable th.dt-nowrap, +table.dataTable td.dt-nowrap { + white-space: nowrap; +} +table.dataTable thead th.dt-head-left, +table.dataTable thead td.dt-head-left, +table.dataTable tfoot th.dt-head-left, +table.dataTable tfoot td.dt-head-left { + text-align: left; +} +table.dataTable thead th.dt-head-center, +table.dataTable thead td.dt-head-center, +table.dataTable tfoot th.dt-head-center, +table.dataTable tfoot td.dt-head-center { + text-align: center; +} +table.dataTable thead th.dt-head-right, +table.dataTable thead td.dt-head-right, +table.dataTable tfoot th.dt-head-right, +table.dataTable tfoot td.dt-head-right { + text-align: right; +} +table.dataTable thead th.dt-head-justify, +table.dataTable thead td.dt-head-justify, +table.dataTable tfoot th.dt-head-justify, +table.dataTable tfoot td.dt-head-justify { + text-align: justify; +} +table.dataTable thead th.dt-head-nowrap, +table.dataTable thead td.dt-head-nowrap, +table.dataTable tfoot th.dt-head-nowrap, +table.dataTable tfoot td.dt-head-nowrap { + white-space: nowrap; +} +table.dataTable tbody th.dt-body-left, +table.dataTable tbody td.dt-body-left { + text-align: left; +} +table.dataTable tbody th.dt-body-center, +table.dataTable tbody td.dt-body-center { + text-align: center; +} +table.dataTable tbody th.dt-body-right, +table.dataTable tbody td.dt-body-right { + text-align: right; +} +table.dataTable tbody th.dt-body-justify, +table.dataTable tbody td.dt-body-justify { + text-align: justify; +} +table.dataTable tbody th.dt-body-nowrap, +table.dataTable tbody td.dt-body-nowrap { + white-space: nowrap; +} + +table.dataTable, +table.dataTable th, +table.dataTable td { + box-sizing: content-box; +} + +/* + * Control feature layout + */ +.dataTables_wrapper { + position: relative; + clear: both; + *zoom: 1; + zoom: 1; +} +.dataTables_wrapper .dataTables_length { + float: left; +} +.dataTables_wrapper .dataTables_filter { + float: right; + text-align: right; +} +.dataTables_wrapper .dataTables_filter input { + margin-left: 0.5em; +} +.dataTables_wrapper .dataTables_info { + clear: both; + float: left; + padding-top: 0.755em; +} +.dataTables_wrapper .dataTables_paginate { + float: right; + text-align: right; + padding-top: 0.25em; +} +.dataTables_wrapper .dataTables_paginate .paginate_button { + box-sizing: border-box; + display: inline-block; + min-width: 1.5em; + padding: 0.5em 1em; + margin-left: 2px; + text-align: center; + text-decoration: none !important; + cursor: pointer; + *cursor: hand; + color: #333 !important; + border: 1px solid transparent; + border-radius: 2px; +} +.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover { + color: #333 !important; + border: 1px solid #979797; + background-color: white; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, white), color-stop(100%, #dcdcdc)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, white 0%, #dcdcdc 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, white 0%, #dcdcdc 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, white 0%, #dcdcdc 100%); + /* IE10+ */ + background: -o-linear-gradient(top, white 0%, #dcdcdc 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, white 0%, #dcdcdc 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_paginate .paginate_button.disabled, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover, .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active { + cursor: default; + color: #666 !important; + border: 1px solid transparent; + background: transparent; + box-shadow: none; +} +.dataTables_wrapper .dataTables_paginate .paginate_button:hover { + color: white !important; + border: 1px solid #111; + background-color: #585858; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #585858 0%, #111 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #585858 0%, #111 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, #585858 0%, #111 100%); + /* IE10+ */ + background: -o-linear-gradient(top, #585858 0%, #111 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, #585858 0%, #111 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_paginate .paginate_button:active { + outline: none; + background-color: #2b2b2b; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* IE10+ */ + background: -o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%); + /* W3C */ + box-shadow: inset 0 0 3px #111; +} +.dataTables_wrapper .dataTables_paginate .ellipsis { + padding: 0 1em; +} +.dataTables_wrapper .dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 100%; + height: 40px; + margin-left: -50%; + margin-top: -25px; + padding-top: 20px; + text-align: center; + font-size: 1.2em; + background-color: white; + background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(25%, rgba(255, 255, 255, 0.9)), color-stop(75%, rgba(255, 255, 255, 0.9)), color-stop(100%, rgba(255, 255, 255, 0))); + background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); +} +.dataTables_wrapper .dataTables_length, +.dataTables_wrapper .dataTables_filter, +.dataTables_wrapper .dataTables_info, +.dataTables_wrapper .dataTables_processing, +.dataTables_wrapper .dataTables_paginate { + color: #333; +} +.dataTables_wrapper .dataTables_scroll { + clear: both; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody { + *margin-top: -1px; + -webkit-overflow-scrolling: touch; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td { + vertical-align: middle; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > th > div.dataTables_sizing, +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > thead > tr > td > div.dataTables_sizing, .dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > th > div.dataTables_sizing, +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table > tbody > tr > td > div.dataTables_sizing { + height: 0; + overflow: hidden; + margin: 0 !important; + padding: 0 !important; +} +.dataTables_wrapper.no-footer .dataTables_scrollBody { + border-bottom: 1px solid #111; +} +.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable, +.dataTables_wrapper.no-footer div.dataTables_scrollBody > table { + border-bottom: none; +} +.dataTables_wrapper:after { + visibility: hidden; + display: block; + content: ""; + clear: both; + height: 0; +} + +@media screen and (max-width: 767px) { + .dataTables_wrapper .dataTables_info, + .dataTables_wrapper .dataTables_paginate { + float: none; + text-align: center; + } + .dataTables_wrapper .dataTables_paginate { + margin-top: 0.5em; + } +} +@media screen and (max-width: 640px) { + .dataTables_wrapper .dataTables_length, + .dataTables_wrapper .dataTables_filter { + float: none; + text-align: center; + } + .dataTables_wrapper .dataTables_filter { + margin-top: 0.5em; + } +} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/css/jquery.dataTables.min.css b/aem_gestion/static/dist/DataTables-1.10.20/css/jquery.dataTables.min.css new file mode 100644 index 0000000..6565b40 --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/css/jquery.dataTables.min.css @@ -0,0 +1 @@ +table.dataTable{width:100%;margin:0 auto;clear:both;border-collapse:separate;border-spacing:0}table.dataTable thead th,table.dataTable tfoot th{font-weight:bold}table.dataTable thead th,table.dataTable thead td{padding:10px 18px;border-bottom:1px solid #111}table.dataTable thead th:active,table.dataTable thead td:active{outline:none}table.dataTable tfoot th,table.dataTable tfoot td{padding:10px 18px 6px 18px;border-top:1px solid #111}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;*cursor:hand;background-repeat:no-repeat;background-position:center right}table.dataTable thead .sorting{background-image:url("../images/sort_both.png")}table.dataTable thead .sorting_asc{background-image:url("../images/sort_asc.png")}table.dataTable thead .sorting_desc{background-image:url("../images/sort_desc.png")}table.dataTable thead .sorting_asc_disabled{background-image:url("../images/sort_asc_disabled.png")}table.dataTable thead .sorting_desc_disabled{background-image:url("../images/sort_desc_disabled.png")}table.dataTable tbody tr{background-color:#ffffff}table.dataTable tbody tr.selected{background-color:#B0BED9}table.dataTable tbody th,table.dataTable tbody td{padding:8px 10px}table.dataTable.row-border tbody th,table.dataTable.row-border tbody td,table.dataTable.display tbody th,table.dataTable.display tbody td{border-top:1px solid #ddd}table.dataTable.row-border tbody tr:first-child th,table.dataTable.row-border tbody tr:first-child td,table.dataTable.display tbody tr:first-child th,table.dataTable.display tbody tr:first-child td{border-top:none}table.dataTable.cell-border tbody th,table.dataTable.cell-border tbody td{border-top:1px solid #ddd;border-right:1px solid #ddd}table.dataTable.cell-border tbody tr th:first-child,table.dataTable.cell-border tbody tr td:first-child{border-left:1px solid #ddd}table.dataTable.cell-border tbody tr:first-child th,table.dataTable.cell-border tbody tr:first-child td{border-top:none}table.dataTable.stripe tbody tr.odd,table.dataTable.display tbody tr.odd{background-color:#f9f9f9}table.dataTable.stripe tbody tr.odd.selected,table.dataTable.display tbody tr.odd.selected{background-color:#acbad4}table.dataTable.hover tbody tr:hover,table.dataTable.display tbody tr:hover{background-color:#f6f6f6}table.dataTable.hover tbody tr:hover.selected,table.dataTable.display tbody tr:hover.selected{background-color:#aab7d1}table.dataTable.order-column tbody tr>.sorting_1,table.dataTable.order-column tbody tr>.sorting_2,table.dataTable.order-column tbody tr>.sorting_3,table.dataTable.display tbody tr>.sorting_1,table.dataTable.display tbody tr>.sorting_2,table.dataTable.display tbody tr>.sorting_3{background-color:#fafafa}table.dataTable.order-column tbody tr.selected>.sorting_1,table.dataTable.order-column tbody tr.selected>.sorting_2,table.dataTable.order-column tbody tr.selected>.sorting_3,table.dataTable.display tbody tr.selected>.sorting_1,table.dataTable.display tbody tr.selected>.sorting_2,table.dataTable.display tbody tr.selected>.sorting_3{background-color:#acbad5}table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd>.sorting_1{background-color:#f1f1f1}table.dataTable.display tbody tr.odd>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd>.sorting_2{background-color:#f3f3f3}table.dataTable.display tbody tr.odd>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd>.sorting_3{background-color:whitesmoke}table.dataTable.display tbody tr.odd.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_1{background-color:#a6b4cd}table.dataTable.display tbody tr.odd.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_2{background-color:#a8b5cf}table.dataTable.display tbody tr.odd.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_3{background-color:#a9b7d1}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.order-column.stripe tbody tr.even>.sorting_1{background-color:#fafafa}table.dataTable.display tbody tr.even>.sorting_2,table.dataTable.order-column.stripe tbody tr.even>.sorting_2{background-color:#fcfcfc}table.dataTable.display tbody tr.even>.sorting_3,table.dataTable.order-column.stripe tbody tr.even>.sorting_3{background-color:#fefefe}table.dataTable.display tbody tr.even.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_1{background-color:#acbad5}table.dataTable.display tbody tr.even.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_2{background-color:#aebcd6}table.dataTable.display tbody tr.even.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_3{background-color:#afbdd8}table.dataTable.display tbody tr:hover>.sorting_1,table.dataTable.order-column.hover tbody tr:hover>.sorting_1{background-color:#eaeaea}table.dataTable.display tbody tr:hover>.sorting_2,table.dataTable.order-column.hover tbody tr:hover>.sorting_2{background-color:#ececec}table.dataTable.display tbody tr:hover>.sorting_3,table.dataTable.order-column.hover tbody tr:hover>.sorting_3{background-color:#efefef}table.dataTable.display tbody tr:hover.selected>.sorting_1,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_1{background-color:#a2aec7}table.dataTable.display tbody tr:hover.selected>.sorting_2,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_2{background-color:#a3b0c9}table.dataTable.display tbody tr:hover.selected>.sorting_3,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_3{background-color:#a5b2cb}table.dataTable.no-footer{border-bottom:1px solid #111}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}table.dataTable.compact thead th,table.dataTable.compact thead td{padding:4px 17px 4px 4px}table.dataTable.compact tfoot th,table.dataTable.compact tfoot td{padding:4px}table.dataTable.compact tbody th,table.dataTable.compact tbody td{padding:4px}table.dataTable th.dt-left,table.dataTable td.dt-left{text-align:left}table.dataTable th.dt-center,table.dataTable td.dt-center,table.dataTable td.dataTables_empty{text-align:center}table.dataTable th.dt-right,table.dataTable td.dt-right{text-align:right}table.dataTable th.dt-justify,table.dataTable td.dt-justify{text-align:justify}table.dataTable th.dt-nowrap,table.dataTable td.dt-nowrap{white-space:nowrap}table.dataTable thead th.dt-head-left,table.dataTable thead td.dt-head-left,table.dataTable tfoot th.dt-head-left,table.dataTable tfoot td.dt-head-left{text-align:left}table.dataTable thead th.dt-head-center,table.dataTable thead td.dt-head-center,table.dataTable tfoot th.dt-head-center,table.dataTable tfoot td.dt-head-center{text-align:center}table.dataTable thead th.dt-head-right,table.dataTable thead td.dt-head-right,table.dataTable tfoot th.dt-head-right,table.dataTable tfoot td.dt-head-right{text-align:right}table.dataTable thead th.dt-head-justify,table.dataTable thead td.dt-head-justify,table.dataTable tfoot th.dt-head-justify,table.dataTable tfoot td.dt-head-justify{text-align:justify}table.dataTable thead th.dt-head-nowrap,table.dataTable thead td.dt-head-nowrap,table.dataTable tfoot th.dt-head-nowrap,table.dataTable tfoot td.dt-head-nowrap{white-space:nowrap}table.dataTable tbody th.dt-body-left,table.dataTable tbody td.dt-body-left{text-align:left}table.dataTable tbody th.dt-body-center,table.dataTable tbody td.dt-body-center{text-align:center}table.dataTable tbody th.dt-body-right,table.dataTable tbody td.dt-body-right{text-align:right}table.dataTable tbody th.dt-body-justify,table.dataTable tbody td.dt-body-justify{text-align:justify}table.dataTable tbody th.dt-body-nowrap,table.dataTable tbody td.dt-body-nowrap{white-space:nowrap}table.dataTable,table.dataTable th,table.dataTable td{box-sizing:content-box}.dataTables_wrapper{position:relative;clear:both;*zoom:1;zoom:1}.dataTables_wrapper .dataTables_length{float:left}.dataTables_wrapper .dataTables_filter{float:right;text-align:right}.dataTables_wrapper .dataTables_filter input{margin-left:0.5em}.dataTables_wrapper .dataTables_info{clear:both;float:left;padding-top:0.755em}.dataTables_wrapper .dataTables_paginate{float:right;text-align:right;padding-top:0.25em}.dataTables_wrapper .dataTables_paginate .paginate_button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:0.5em 1em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;*cursor:hand;color:#333 !important;border:1px solid transparent;border-radius:2px}.dataTables_wrapper .dataTables_paginate .paginate_button.current,.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover{color:#333 !important;border:1px solid #979797;background-color:white;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(100%, #dcdcdc));background:-webkit-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-moz-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-ms-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-o-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:linear-gradient(to bottom, #fff 0%, #dcdcdc 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active{cursor:default;color:#666 !important;border:1px solid transparent;background:transparent;box-shadow:none}.dataTables_wrapper .dataTables_paginate .paginate_button:hover{color:white !important;border:1px solid #111;background-color:#585858;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));background:-webkit-linear-gradient(top, #585858 0%, #111 100%);background:-moz-linear-gradient(top, #585858 0%, #111 100%);background:-ms-linear-gradient(top, #585858 0%, #111 100%);background:-o-linear-gradient(top, #585858 0%, #111 100%);background:linear-gradient(to bottom, #585858 0%, #111 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button:active{outline:none;background-color:#2b2b2b;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));background:-webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);box-shadow:inset 0 0 3px #111}.dataTables_wrapper .dataTables_paginate .ellipsis{padding:0 1em}.dataTables_wrapper .dataTables_processing{position:absolute;top:50%;left:50%;width:100%;height:40px;margin-left:-50%;margin-top:-25px;padding-top:20px;text-align:center;font-size:1.2em;background-color:white;background:-webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0)));background:-webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%)}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:#333}.dataTables_wrapper .dataTables_scroll{clear:both}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td{vertical-align:middle}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td>div.dataTables_sizing{height:0;overflow:hidden;margin:0 !important;padding:0 !important}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:1px solid #111}.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,.dataTables_wrapper.no-footer div.dataTables_scrollBody>table{border-bottom:none}.dataTables_wrapper:after{visibility:hidden;display:block;content:"";clear:both;height:0}@media screen and (max-width: 767px){.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_paginate{float:none;text-align:center}.dataTables_wrapper .dataTables_paginate{margin-top:0.5em}}@media screen and (max-width: 640px){.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter{float:none;text-align:center}.dataTables_wrapper .dataTables_filter{margin-top:0.5em}} diff --git a/aem_gestion/static/dist/DataTables-1.10.20/datatables.css b/aem_gestion/static/dist/DataTables-1.10.20/datatables.css new file mode 100644 index 0000000..cc4aa37 --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/datatables.css @@ -0,0 +1,201 @@ +/* + * This combined file was created by the DataTables downloader builder: + * https://datatables.net/download + * + * To rebuild or modify this file with the latest versions of the included + * software please visit: + * https://datatables.net/download/#bs/dt-1.10.20 + * + * Included libraries: + * DataTables 1.10.20 + */ + +table.dataTable { + clear: both; + margin-top: 6px !important; + margin-bottom: 6px !important; + max-width: none !important; + border-collapse: separate !important; +} +table.dataTable td, +table.dataTable th { + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +table.dataTable td.dataTables_empty, +table.dataTable th.dataTables_empty { + text-align: center; +} +table.dataTable.nowrap th, +table.dataTable.nowrap td { + white-space: nowrap; +} + +div.dataTables_wrapper div.dataTables_length label { + font-weight: normal; + text-align: left; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_length select { + width: 75px; + display: inline-block; +} +div.dataTables_wrapper div.dataTables_filter { + text-align: right; +} +div.dataTables_wrapper div.dataTables_filter label { + font-weight: normal; + white-space: nowrap; + text-align: left; +} +div.dataTables_wrapper div.dataTables_filter input { + margin-left: 0.5em; + display: inline-block; + width: auto; +} +div.dataTables_wrapper div.dataTables_info { + padding-top: 8px; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_paginate { + margin: 0; + white-space: nowrap; + text-align: right; +} +div.dataTables_wrapper div.dataTables_paginate ul.pagination { + margin: 2px 0; + white-space: nowrap; +} +div.dataTables_wrapper div.dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 200px; + margin-left: -100px; + margin-top: -26px; + text-align: center; + padding: 1em 0; +} + +table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, +table.dataTable thead > tr > td.sorting_asc, +table.dataTable thead > tr > td.sorting_desc, +table.dataTable thead > tr > td.sorting { + padding-right: 30px; +} +table.dataTable thead > tr > th:active, +table.dataTable thead > tr > td:active { + outline: none; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; + position: relative; +} +table.dataTable thead .sorting:after, +table.dataTable thead .sorting_asc:after, +table.dataTable thead .sorting_desc:after, +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:after { + position: absolute; + bottom: 8px; + right: 8px; + display: block; + font-family: 'Glyphicons Halflings'; + opacity: 0.5; +} +table.dataTable thead .sorting:after { + opacity: 0.2; + content: "\e150"; + /* sort */ +} +table.dataTable thead .sorting_asc:after { + content: "\e155"; + /* sort-by-attributes */ +} +table.dataTable thead .sorting_desc:after { + content: "\e156"; + /* sort-by-attributes-alt */ +} +table.dataTable thead .sorting_asc_disabled:after, +table.dataTable thead .sorting_desc_disabled:after { + color: #eee; +} + +div.dataTables_scrollHead table.dataTable { + margin-bottom: 0 !important; +} + +div.dataTables_scrollBody > table { + border-top: none; + margin-top: 0 !important; + margin-bottom: 0 !important; +} +div.dataTables_scrollBody > table > thead .sorting:after, +div.dataTables_scrollBody > table > thead .sorting_asc:after, +div.dataTables_scrollBody > table > thead .sorting_desc:after { + display: none; +} +div.dataTables_scrollBody > table > tbody > tr:first-child > th, +div.dataTables_scrollBody > table > tbody > tr:first-child > td { + border-top: none; +} + +div.dataTables_scrollFoot > .dataTables_scrollFootInner { + box-sizing: content-box; +} +div.dataTables_scrollFoot > .dataTables_scrollFootInner > table { + margin-top: 0 !important; + border-top: none; +} + +@media screen and (max-width: 767px) { + div.dataTables_wrapper div.dataTables_length, + div.dataTables_wrapper div.dataTables_filter, + div.dataTables_wrapper div.dataTables_info, + div.dataTables_wrapper div.dataTables_paginate { + text-align: center; + } +} +table.dataTable.table-condensed > thead > tr > th { + padding-right: 20px; +} +table.dataTable.table-condensed .sorting:after, +table.dataTable.table-condensed .sorting_asc:after, +table.dataTable.table-condensed .sorting_desc:after { + top: 6px; + right: 6px; +} + +table.table-bordered.dataTable th, +table.table-bordered.dataTable td { + border-left-width: 0; +} +table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, +table.table-bordered.dataTable td:last-child, +table.table-bordered.dataTable td:last-child { + border-right-width: 0; +} +table.table-bordered.dataTable tbody th, +table.table-bordered.dataTable tbody td { + border-bottom-width: 0; +} + +div.dataTables_scrollHead table.table-bordered { + border-bottom-width: 0; +} + +div.table-responsive > div.dataTables_wrapper > div.row { + margin: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:first-child { + padding-left: 0; +} +div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:last-child { + padding-right: 0; +} + + diff --git a/aem_gestion/static/dist/DataTables-1.10.20/datatables.js b/aem_gestion/static/dist/DataTables-1.10.20/datatables.js new file mode 100644 index 0000000..aa0c304 --- /dev/null +++ b/aem_gestion/static/dist/DataTables-1.10.20/datatables.js @@ -0,0 +1,15532 @@ +/* + * This combined file was created by the DataTables downloader builder: + * https://datatables.net/download + * + * To rebuild or modify this file with the latest versions of the included + * software please visit: + * https://datatables.net/download/#bs/dt-1.10.20 + * + * Included libraries: + * DataTables 1.10.20 + */ + +/*! DataTables 1.10.20 + * ©2008-2019 SpryMedia Ltd - datatables.net/license + */ + +/** + * @summary DataTables + * @description Paginate, search and order HTML tables + * @version 1.10.20 + * @file jquery.dataTables.js + * @author SpryMedia Ltd + * @contact www.datatables.net + * @copyright Copyright 2008-2019 SpryMedia Ltd. + * + * This source file is free software, available under the following license: + * MIT license - http://datatables.net/license + * + * This source file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + * + * For details please refer to: http://www.datatables.net + */ + +/*jslint evil: true, undef: true, browser: true */ +/*globals $,require,jQuery,define,_selector_run,_selector_opts,_selector_first,_selector_row_indexes,_ext,_Api,_api_register,_api_registerPlural,_re_new_lines,_re_html,_re_formatted_numeric,_re_escape_regex,_empty,_intVal,_numToDecimal,_isNumber,_isHtml,_htmlNumeric,_pluck,_pluck_order,_range,_stripHtml,_unique,_fnBuildAjax,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnAjaxDataSrc,_fnAddColumn,_fnColumnOptions,_fnAdjustColumnSizing,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnVisbleColumns,_fnGetColumns,_fnColumnTypes,_fnApplyColumnDefs,_fnHungarianMap,_fnCamelToHungarian,_fnLanguageCompat,_fnBrowserDetect,_fnAddData,_fnAddTr,_fnNodeToDataIndex,_fnNodeToColumnIndex,_fnGetCellData,_fnSetCellData,_fnSplitObjNotation,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnGetDataMaster,_fnClearTable,_fnDeleteIndex,_fnInvalidate,_fnGetRowElements,_fnCreateTr,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAddOptionsHtml,_fnDetectHeader,_fnGetUniqueThs,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnFilterCreateSearch,_fnEscapeRegex,_fnFilterData,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnInfoMacros,_fnInitialise,_fnInitComplete,_fnLengthChange,_fnFeatureHtmlLength,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnFeatureHtmlTable,_fnScrollDraw,_fnApplyToChildren,_fnCalculateColumnWidths,_fnThrottle,_fnConvertToWidth,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnSortFlatten,_fnSort,_fnSortAria,_fnSortListener,_fnSortAttachListener,_fnSortingClasses,_fnSortData,_fnSaveState,_fnLoadState,_fnSettingsFromNode,_fnLog,_fnMap,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnLengthOverflow,_fnRenderer,_fnDataSource,_fnRowAttributes*/ + +(function( factory ) { + "use strict"; + + if ( typeof define === 'function' && define.amd ) { + // AMD + define( ['jquery'], function ( $ ) { + return factory( $, window, document ); + } ); + } + else if ( typeof exports === 'object' ) { + // CommonJS + module.exports = function (root, $) { + if ( ! root ) { + // CommonJS environments without a window global must pass a + // root. This will give an error otherwise + root = window; + } + + if ( ! $ ) { + $ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window + require('jquery') : + require('jquery')( root ); + } + + return factory( $, root, root.document ); + }; + } + else { + // Browser + factory( jQuery, window, document ); + } +} +(function( $, window, document, undefined ) { + "use strict"; + + /** + * DataTables is a plug-in for the jQuery Javascript library. It is a highly + * flexible tool, based upon the foundations of progressive enhancement, + * which will add advanced interaction controls to any HTML table. For a + * full list of features please refer to + * [DataTables.net](href="http://datatables.net). + * + * Note that the `DataTable` object is not a global variable but is aliased + * to `jQuery.fn.DataTable` and `jQuery.fn.dataTable` through which it may + * be accessed. + * + * @class + * @param {object} [init={}] Configuration object for DataTables. Options + * are defined by {@link DataTable.defaults} + * @requires jQuery 1.7+ + * + * @example + * // Basic initialisation + * $(document).ready( function { + * $('#example').dataTable(); + * } ); + * + * @example + * // Initialisation with configuration options - in this case, disable + * // pagination and sorting. + * $(document).ready( function { + * $('#example').dataTable( { + * "paginate": false, + * "sort": false + * } ); + * } ); + */ + var DataTable = function ( options ) + { + /** + * Perform a jQuery selector action on the table's TR elements (from the tbody) and + * return the resulting jQuery object. + * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on + * @param {object} [oOpts] Optional parameters for modifying the rows to be included + * @param {string} [oOpts.filter=none] Select TR elements that meet the current filter + * criterion ("applied") or all TR elements (i.e. no filter). + * @param {string} [oOpts.order=current] Order of the TR elements in the processed array. + * Can be either 'current', whereby the current sorting of the table is used, or + * 'original' whereby the original order the data was read into the table is used. + * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page + * ("current") or not ("all"). If 'current' is given, then order is assumed to be + * 'current' and filter is 'applied', regardless of what they might be given as. + * @returns {object} jQuery object, filtered by the given selector. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Highlight every second row + * oTable.$('tr:odd').css('backgroundColor', 'blue'); + * } ); + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Filter to rows with 'Webkit' in them, add a background colour and then + * // remove the filter, thus highlighting the 'Webkit' rows only. + * oTable.fnFilter('Webkit'); + * oTable.$('tr', {"search": "applied"}).css('backgroundColor', 'blue'); + * oTable.fnFilter(''); + * } ); + */ + this.$ = function ( sSelector, oOpts ) + { + return this.api(true).$( sSelector, oOpts ); + }; + + + /** + * Almost identical to $ in operation, but in this case returns the data for the matched + * rows - as such, the jQuery selector used should match TR row nodes or TD/TH cell nodes + * rather than any descendants, so the data can be obtained for the row/cell. If matching + * rows are found, the data returned is the original data array/object that was used to + * create the row (or a generated array if from a DOM source). + * + * This method is often useful in-combination with $ where both functions are given the + * same parameters and the array indexes will match identically. + * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on + * @param {object} [oOpts] Optional parameters for modifying the rows to be included + * @param {string} [oOpts.filter=none] Select elements that meet the current filter + * criterion ("applied") or all elements (i.e. no filter). + * @param {string} [oOpts.order=current] Order of the data in the processed array. + * Can be either 'current', whereby the current sorting of the table is used, or + * 'original' whereby the original order the data was read into the table is used. + * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page + * ("current") or not ("all"). If 'current' is given, then order is assumed to be + * 'current' and filter is 'applied', regardless of what they might be given as. + * @returns {array} Data for the matched elements. If any elements, as a result of the + * selector, were not TR, TD or TH elements in the DataTable, they will have a null + * entry in the array. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Get the data from the first row in the table + * var data = oTable._('tr:first'); + * + * // Do something useful with the data + * alert( "First cell is: "+data[0] ); + * } ); + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Filter to 'Webkit' and get all data for + * oTable.fnFilter('Webkit'); + * var data = oTable._('tr', {"search": "applied"}); + * + * // Do something with the data + * alert( data.length+" rows matched the search" ); + * } ); + */ + this._ = function ( sSelector, oOpts ) + { + return this.api(true).rows( sSelector, oOpts ).data(); + }; + + + /** + * Create a DataTables Api instance, with the currently selected tables for + * the Api's context. + * @param {boolean} [traditional=false] Set the API instance's context to be + * only the table referred to by the `DataTable.ext.iApiIndex` option, as was + * used in the API presented by DataTables 1.9- (i.e. the traditional mode), + * or if all tables captured in the jQuery object should be used. + * @return {DataTables.Api} + */ + this.api = function ( traditional ) + { + return traditional ? + new _Api( + _fnSettingsFromNode( this[ _ext.iApiIndex ] ) + ) : + new _Api( this ); + }; + + + /** + * Add a single new row or multiple rows of data to the table. Please note + * that this is suitable for client-side processing only - if you are using + * server-side processing (i.e. "bServerSide": true), then to add data, you + * must add it to the data source, i.e. the server-side, through an Ajax call. + * @param {array|object} data The data to be added to the table. This can be: + * + * @param {bool} [redraw=true] redraw the table or not + * @returns {array} An array of integers, representing the list of indexes in + * aoData ({@link DataTable.models.oSettings}) that have been added to + * the table. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * // Global var for counter + * var giCount = 2; + * + * $(document).ready(function() { + * $('#example').dataTable(); + * } ); + * + * function fnClickAddRow() { + * $('#example').dataTable().fnAddData( [ + * giCount+".1", + * giCount+".2", + * giCount+".3", + * giCount+".4" ] + * ); + * + * giCount++; + * } + */ + this.fnAddData = function( data, redraw ) + { + var api = this.api( true ); + + /* Check if we want to add multiple rows or not */ + var rows = $.isArray(data) && ( $.isArray(data[0]) || $.isPlainObject(data[0]) ) ? + api.rows.add( data ) : + api.row.add( data ); + + if ( redraw === undefined || redraw ) { + api.draw(); + } + + return rows.flatten().toArray(); + }; + + + /** + * This function will make DataTables recalculate the column sizes, based on the data + * contained in the table and the sizes applied to the columns (in the DOM, CSS or + * through the sWidth parameter). This can be useful when the width of the table's + * parent element changes (for example a window resize). + * @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable( { + * "sScrollY": "200px", + * "bPaginate": false + * } ); + * + * $(window).on('resize', function () { + * oTable.fnAdjustColumnSizing(); + * } ); + * } ); + */ + this.fnAdjustColumnSizing = function ( bRedraw ) + { + var api = this.api( true ).columns.adjust(); + var settings = api.settings()[0]; + var scroll = settings.oScroll; + + if ( bRedraw === undefined || bRedraw ) { + api.draw( false ); + } + else if ( scroll.sX !== "" || scroll.sY !== "" ) { + /* If not redrawing, but scrolling, we want to apply the new column sizes anyway */ + _fnScrollDraw( settings ); + } + }; + + + /** + * Quickly and simply clear a table + * @param {bool} [bRedraw=true] redraw the table or not + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...) + * oTable.fnClearTable(); + * } ); + */ + this.fnClearTable = function( bRedraw ) + { + var api = this.api( true ).clear(); + + if ( bRedraw === undefined || bRedraw ) { + api.draw(); + } + }; + + + /** + * The exact opposite of 'opening' a row, this function will close any rows which + * are currently 'open'. + * @param {node} nTr the table row to 'close' + * @returns {int} 0 on success, or 1 if failed (can't find the row) + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable; + * + * // 'open' an information row when a row is clicked on + * $('#example tbody tr').click( function () { + * if ( oTable.fnIsOpen(this) ) { + * oTable.fnClose( this ); + * } else { + * oTable.fnOpen( this, "Temporary row opened", "info_row" ); + * } + * } ); + * + * oTable = $('#example').dataTable(); + * } ); + */ + this.fnClose = function( nTr ) + { + this.api( true ).row( nTr ).child.hide(); + }; + + + /** + * Remove a row for the table + * @param {mixed} target The index of the row from aoData to be deleted, or + * the TR element you want to delete + * @param {function|null} [callBack] Callback function + * @param {bool} [redraw=true] Redraw the table or not + * @returns {array} The row that was deleted + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Immediately remove the first row + * oTable.fnDeleteRow( 0 ); + * } ); + */ + this.fnDeleteRow = function( target, callback, redraw ) + { + var api = this.api( true ); + var rows = api.rows( target ); + var settings = rows.settings()[0]; + var data = settings.aoData[ rows[0][0] ]; + + rows.remove(); + + if ( callback ) { + callback.call( this, settings, data ); + } + + if ( redraw === undefined || redraw ) { + api.draw(); + } + + return data; + }; + + + /** + * Restore the table to it's original state in the DOM by removing all of DataTables + * enhancements, alterations to the DOM structure of the table and event listeners. + * @param {boolean} [remove=false] Completely remove the table from the DOM + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * // This example is fairly pointless in reality, but shows how fnDestroy can be used + * var oTable = $('#example').dataTable(); + * oTable.fnDestroy(); + * } ); + */ + this.fnDestroy = function ( remove ) + { + this.api( true ).destroy( remove ); + }; + + + /** + * Redraw the table + * @param {bool} [complete=true] Re-filter and resort (if enabled) the table before the draw. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Re-draw the table - you wouldn't want to do it here, but it's an example :-) + * oTable.fnDraw(); + * } ); + */ + this.fnDraw = function( complete ) + { + // Note that this isn't an exact match to the old call to _fnDraw - it takes + // into account the new data, but can hold position. + this.api( true ).draw( complete ); + }; + + + /** + * Filter the input based on data + * @param {string} sInput String to filter the table on + * @param {int|null} [iColumn] Column to limit filtering to + * @param {bool} [bRegex=false] Treat as regular expression or not + * @param {bool} [bSmart=true] Perform smart filtering or not + * @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es) + * @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false) + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Sometime later - filter... + * oTable.fnFilter( 'test string' ); + * } ); + */ + this.fnFilter = function( sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive ) + { + var api = this.api( true ); + + if ( iColumn === null || iColumn === undefined ) { + api.search( sInput, bRegex, bSmart, bCaseInsensitive ); + } + else { + api.column( iColumn ).search( sInput, bRegex, bSmart, bCaseInsensitive ); + } + + api.draw(); + }; + + + /** + * Get the data for the whole table, an individual row or an individual cell based on the + * provided parameters. + * @param {int|node} [src] A TR row node, TD/TH cell node or an integer. If given as + * a TR node then the data source for the whole row will be returned. If given as a + * TD/TH cell node then iCol will be automatically calculated and the data for the + * cell returned. If given as an integer, then this is treated as the aoData internal + * data index for the row (see fnGetPosition) and the data for that row used. + * @param {int} [col] Optional column index that you want the data of. + * @returns {array|object|string} If mRow is undefined, then the data for all rows is + * returned. If mRow is defined, just data for that row, and is iCol is + * defined, only data for the designated cell is returned. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * // Row data + * $(document).ready(function() { + * oTable = $('#example').dataTable(); + * + * oTable.$('tr').click( function () { + * var data = oTable.fnGetData( this ); + * // ... do something with the array / object of data for the row + * } ); + * } ); + * + * @example + * // Individual cell data + * $(document).ready(function() { + * oTable = $('#example').dataTable(); + * + * oTable.$('td').click( function () { + * var sData = oTable.fnGetData( this ); + * alert( 'The cell clicked on had the value of '+sData ); + * } ); + * } ); + */ + this.fnGetData = function( src, col ) + { + var api = this.api( true ); + + if ( src !== undefined ) { + var type = src.nodeName ? src.nodeName.toLowerCase() : ''; + + return col !== undefined || type == 'td' || type == 'th' ? + api.cell( src, col ).data() : + api.row( src ).data() || null; + } + + return api.data().toArray(); + }; + + + /** + * Get an array of the TR nodes that are used in the table's body. Note that you will + * typically want to use the '$' API method in preference to this as it is more + * flexible. + * @param {int} [iRow] Optional row index for the TR element you want + * @returns {array|node} If iRow is undefined, returns an array of all TR elements + * in the table's body, or iRow is defined, just the TR element requested. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Get the nodes from the table + * var nNodes = oTable.fnGetNodes( ); + * } ); + */ + this.fnGetNodes = function( iRow ) + { + var api = this.api( true ); + + return iRow !== undefined ? + api.row( iRow ).node() : + api.rows().nodes().flatten().toArray(); + }; + + + /** + * Get the array indexes of a particular cell from it's DOM element + * and column index including hidden columns + * @param {node} node this can either be a TR, TD or TH in the table's body + * @returns {int} If nNode is given as a TR, then a single index is returned, or + * if given as a cell, an array of [row index, column index (visible), + * column index (all)] is given. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * $('#example tbody td').click( function () { + * // Get the position of the current data from the node + * var aPos = oTable.fnGetPosition( this ); + * + * // Get the data array for this row + * var aData = oTable.fnGetData( aPos[0] ); + * + * // Update the data array and return the value + * aData[ aPos[1] ] = 'clicked'; + * this.innerHTML = 'clicked'; + * } ); + * + * // Init DataTables + * oTable = $('#example').dataTable(); + * } ); + */ + this.fnGetPosition = function( node ) + { + var api = this.api( true ); + var nodeName = node.nodeName.toUpperCase(); + + if ( nodeName == 'TR' ) { + return api.row( node ).index(); + } + else if ( nodeName == 'TD' || nodeName == 'TH' ) { + var cell = api.cell( node ).index(); + + return [ + cell.row, + cell.columnVisible, + cell.column + ]; + } + return null; + }; + + + /** + * Check to see if a row is 'open' or not. + * @param {node} nTr the table row to check + * @returns {boolean} true if the row is currently open, false otherwise + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable; + * + * // 'open' an information row when a row is clicked on + * $('#example tbody tr').click( function () { + * if ( oTable.fnIsOpen(this) ) { + * oTable.fnClose( this ); + * } else { + * oTable.fnOpen( this, "Temporary row opened", "info_row" ); + * } + * } ); + * + * oTable = $('#example').dataTable(); + * } ); + */ + this.fnIsOpen = function( nTr ) + { + return this.api( true ).row( nTr ).child.isShown(); + }; + + + /** + * This function will place a new row directly after a row which is currently + * on display on the page, with the HTML contents that is passed into the + * function. This can be used, for example, to ask for confirmation that a + * particular record should be deleted. + * @param {node} nTr The table row to 'open' + * @param {string|node|jQuery} mHtml The HTML to put into the row + * @param {string} sClass Class to give the new TD cell + * @returns {node} The row opened. Note that if the table row passed in as the + * first parameter, is not found in the table, this method will silently + * return. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable; + * + * // 'open' an information row when a row is clicked on + * $('#example tbody tr').click( function () { + * if ( oTable.fnIsOpen(this) ) { + * oTable.fnClose( this ); + * } else { + * oTable.fnOpen( this, "Temporary row opened", "info_row" ); + * } + * } ); + * + * oTable = $('#example').dataTable(); + * } ); + */ + this.fnOpen = function( nTr, mHtml, sClass ) + { + return this.api( true ) + .row( nTr ) + .child( mHtml, sClass ) + .show() + .child()[0]; + }; + + + /** + * Change the pagination - provides the internal logic for pagination in a simple API + * function. With this function you can have a DataTables table go to the next, + * previous, first or last pages. + * @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last" + * or page number to jump to (integer), note that page 0 is the first page. + * @param {bool} [bRedraw=true] Redraw the table or not + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * oTable.fnPageChange( 'next' ); + * } ); + */ + this.fnPageChange = function ( mAction, bRedraw ) + { + var api = this.api( true ).page( mAction ); + + if ( bRedraw === undefined || bRedraw ) { + api.draw(false); + } + }; + + + /** + * Show a particular column + * @param {int} iCol The column whose display should be changed + * @param {bool} bShow Show (true) or hide (false) the column + * @param {bool} [bRedraw=true] Redraw the table or not + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Hide the second column after initialisation + * oTable.fnSetColumnVis( 1, false ); + * } ); + */ + this.fnSetColumnVis = function ( iCol, bShow, bRedraw ) + { + var api = this.api( true ).column( iCol ).visible( bShow ); + + if ( bRedraw === undefined || bRedraw ) { + api.columns.adjust().draw(); + } + }; + + + /** + * Get the settings for a particular table for external manipulation + * @returns {object} DataTables settings object. See + * {@link DataTable.models.oSettings} + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * var oSettings = oTable.fnSettings(); + * + * // Show an example parameter from the settings + * alert( oSettings._iDisplayStart ); + * } ); + */ + this.fnSettings = function() + { + return _fnSettingsFromNode( this[_ext.iApiIndex] ); + }; + + + /** + * Sort the table by a particular column + * @param {int} iCol the data index to sort on. Note that this will not match the + * 'display index' if you have hidden data entries + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Sort immediately with columns 0 and 1 + * oTable.fnSort( [ [0,'asc'], [1,'asc'] ] ); + * } ); + */ + this.fnSort = function( aaSort ) + { + this.api( true ).order( aaSort ).draw(); + }; + + + /** + * Attach a sort listener to an element for a given column + * @param {node} nNode the element to attach the sort listener to + * @param {int} iColumn the column that a click on this node will sort on + * @param {function} [fnCallback] callback function when sort is run + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * + * // Sort on column 1, when 'sorter' is clicked on + * oTable.fnSortListener( document.getElementById('sorter'), 1 ); + * } ); + */ + this.fnSortListener = function( nNode, iColumn, fnCallback ) + { + this.api( true ).order.listener( nNode, iColumn, fnCallback ); + }; + + + /** + * Update a table cell or row - this method will accept either a single value to + * update the cell with, an array of values with one element for each column or + * an object in the same format as the original data source. The function is + * self-referencing in order to make the multi column updates easier. + * @param {object|array|string} mData Data to update the cell/row with + * @param {node|int} mRow TR element you want to update or the aoData index + * @param {int} [iColumn] The column to update, give as null or undefined to + * update a whole row. + * @param {bool} [bRedraw=true] Redraw the table or not + * @param {bool} [bAction=true] Perform pre-draw actions or not + * @returns {int} 0 on success, 1 on error + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell + * oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], $('tbody tr')[0] ); // Row + * } ); + */ + this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction ) + { + var api = this.api( true ); + + if ( iColumn === undefined || iColumn === null ) { + api.row( mRow ).data( mData ); + } + else { + api.cell( mRow, iColumn ).data( mData ); + } + + if ( bAction === undefined || bAction ) { + api.columns.adjust(); + } + + if ( bRedraw === undefined || bRedraw ) { + api.draw(); + } + return 0; + }; + + + /** + * Provide a common method for plug-ins to check the version of DataTables being used, in order + * to ensure compatibility. + * @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the + * formats "X" and "X.Y" are also acceptable. + * @returns {boolean} true if this version of DataTables is greater or equal to the required + * version, or false if this version of DataTales is not suitable + * @method + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable = $('#example').dataTable(); + * alert( oTable.fnVersionCheck( '1.9.0' ) ); + * } ); + */ + this.fnVersionCheck = _ext.fnVersionCheck; + + + var _that = this; + var emptyInit = options === undefined; + var len = this.length; + + if ( emptyInit ) { + options = {}; + } + + this.oApi = this.internal = _ext.internal; + + // Extend with old style plug-in API methods + for ( var fn in DataTable.ext.internal ) { + if ( fn ) { + this[fn] = _fnExternApiFunc(fn); + } + } + + this.each(function() { + // For each initialisation we want to give it a clean initialisation + // object that can be bashed around + var o = {}; + var oInit = len > 1 ? // optimisation for single table case + _fnExtend( o, options, true ) : + options; + + /*global oInit,_that,emptyInit*/ + var i=0, iLen, j, jLen, k, kLen; + var sId = this.getAttribute( 'id' ); + var bInitHandedOff = false; + var defaults = DataTable.defaults; + var $this = $(this); + + + /* Sanity check */ + if ( this.nodeName.toLowerCase() != 'table' ) + { + _fnLog( null, 0, 'Non-table node initialisation ('+this.nodeName+')', 2 ); + return; + } + + /* Backwards compatibility for the defaults */ + _fnCompatOpts( defaults ); + _fnCompatCols( defaults.column ); + + /* Convert the camel-case defaults to Hungarian */ + _fnCamelToHungarian( defaults, defaults, true ); + _fnCamelToHungarian( defaults.column, defaults.column, true ); + + /* Setting up the initialisation object */ + _fnCamelToHungarian( defaults, $.extend( oInit, $this.data() ), true ); + + + + /* Check to see if we are re-initialising a table */ + var allSettings = DataTable.settings; + for ( i=0, iLen=allSettings.length ; i').appendTo($this); + } + oSettings.nTHead = thead[0]; + + var tbody = $this.children('tbody'); + if ( tbody.length === 0 ) { + tbody = $('').appendTo($this); + } + oSettings.nTBody = tbody[0]; + + var tfoot = $this.children('tfoot'); + if ( tfoot.length === 0 && captions.length > 0 && (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") ) { + // If we are a scrolling table, and no footer has been given, then we need to create + // a tfoot element for the caption element to be appended to + tfoot = $('').appendTo($this); + } + + if ( tfoot.length === 0 || tfoot.children().length === 0 ) { + $this.addClass( oClasses.sNoFooter ); + } + else if ( tfoot.length > 0 ) { + oSettings.nTFoot = tfoot[0]; + _fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot ); + } + + /* Check if there is data passing into the constructor */ + if ( oInit.aaData ) { + for ( i=0 ; i/g; + + // This is not strict ISO8601 - Date.parse() is quite lax, although + // implementations differ between browsers. + var _re_date = /^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/; + + // Escape regular expression special characters + var _re_escape_regex = new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', 'g' ); + + // http://en.wikipedia.org/wiki/Foreign_exchange_market + // - \u20BD - Russian ruble. + // - \u20a9 - South Korean Won + // - \u20BA - Turkish Lira + // - \u20B9 - Indian Rupee + // - R - Brazil (R$) and South Africa + // - fr - Swiss Franc + // - kr - Swedish krona, Norwegian krone and Danish krone + // - \u2009 is thin space and \u202F is narrow no-break space, both used in many + // - Ƀ - Bitcoin + // - Ξ - Ethereum + // standards as thousands separators. + var _re_formatted_numeric = /[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi; + + + var _empty = function ( d ) { + return !d || d === true || d === '-' ? true : false; + }; + + + var _intVal = function ( s ) { + var integer = parseInt( s, 10 ); + return !isNaN(integer) && isFinite(s) ? integer : null; + }; + + // Convert from a formatted number with characters other than `.` as the + // decimal place, to a Javascript number + var _numToDecimal = function ( num, decimalPoint ) { + // Cache created regular expressions for speed as this function is called often + if ( ! _re_dic[ decimalPoint ] ) { + _re_dic[ decimalPoint ] = new RegExp( _fnEscapeRegex( decimalPoint ), 'g' ); + } + return typeof num === 'string' && decimalPoint !== '.' ? + num.replace( /\./g, '' ).replace( _re_dic[ decimalPoint ], '.' ) : + num; + }; + + + var _isNumber = function ( d, decimalPoint, formatted ) { + var strType = typeof d === 'string'; + + // If empty return immediately so there must be a number if it is a + // formatted string (this stops the string "k", or "kr", etc being detected + // as a formatted number for currency + if ( _empty( d ) ) { + return true; + } + + if ( decimalPoint && strType ) { + d = _numToDecimal( d, decimalPoint ); + } + + if ( formatted && strType ) { + d = d.replace( _re_formatted_numeric, '' ); + } + + return !isNaN( parseFloat(d) ) && isFinite( d ); + }; + + + // A string without HTML in it can be considered to be HTML still + var _isHtml = function ( d ) { + return _empty( d ) || typeof d === 'string'; + }; + + + var _htmlNumeric = function ( d, decimalPoint, formatted ) { + if ( _empty( d ) ) { + return true; + } + + var html = _isHtml( d ); + return ! html ? + null : + _isNumber( _stripHtml( d ), decimalPoint, formatted ) ? + true : + null; + }; + + + var _pluck = function ( a, prop, prop2 ) { + var out = []; + var i=0, ien=a.length; + + // Could have the test in the loop for slightly smaller code, but speed + // is essential here + if ( prop2 !== undefined ) { + for ( ; i') + .css( { + position: 'fixed', + top: 0, + left: $(window).scrollLeft()*-1, // allow for scrolling + height: 1, + width: 1, + overflow: 'hidden' + } ) + .append( + $('
') + .css( { + position: 'absolute', + top: 1, + left: 1, + width: 100, + overflow: 'scroll' + } ) + .append( + $('
') + .css( { + width: '100%', + height: 10 + } ) + ) + ) + .appendTo( 'body' ); + + var outer = n.children(); + var inner = outer.children(); + + // Numbers below, in order, are: + // inner.offsetWidth, inner.clientWidth, outer.offsetWidth, outer.clientWidth + // + // IE6 XP: 100 100 100 83 + // IE7 Vista: 100 100 100 83 + // IE 8+ Windows: 83 83 100 83 + // Evergreen Windows: 83 83 100 83 + // Evergreen Mac with scrollbars: 85 85 100 85 + // Evergreen Mac without scrollbars: 100 100 100 100 + + // Get scrollbar width + browser.barWidth = outer[0].offsetWidth - outer[0].clientWidth; + + // IE6/7 will oversize a width 100% element inside a scrolling element, to + // include the width of the scrollbar, while other browsers ensure the inner + // element is contained without forcing scrolling + browser.bScrollOversize = inner[0].offsetWidth === 100 && outer[0].clientWidth !== 100; + + // In rtl text layout, some browsers (most, but not all) will place the + // scrollbar on the left, rather than the right. + browser.bScrollbarLeft = Math.round( inner.offset().left ) !== 1; + + // IE8- don't provide height and width for getBoundingClientRect + browser.bBounding = n[0].getBoundingClientRect().width ? true : false; + + n.remove(); + } + + $.extend( settings.oBrowser, DataTable.__browser ); + settings.oScroll.iBarWidth = DataTable.__browser.barWidth; + } + + + /** + * Array.prototype reduce[Right] method, used for browsers which don't support + * JS 1.6. Done this way to reduce code size, since we iterate either way + * @param {object} settings dataTables settings object + * @memberof DataTable#oApi + */ + function _fnReduce ( that, fn, init, start, end, inc ) + { + var + i = start, + value, + isSet = false; + + if ( init !== undefined ) { + value = init; + isSet = true; + } + + while ( i !== end ) { + if ( ! that.hasOwnProperty(i) ) { + continue; + } + + value = isSet ? + fn( value, that[i], i, that ) : + that[i]; + + isSet = true; + i += inc; + } + + return value; + } + + /** + * Add a column to the list used for the table with default values + * @param {object} oSettings dataTables settings object + * @param {node} nTh The th element for this column + * @memberof DataTable#oApi + */ + function _fnAddColumn( oSettings, nTh ) + { + // Add column to aoColumns array + var oDefaults = DataTable.defaults.column; + var iCol = oSettings.aoColumns.length; + var oCol = $.extend( {}, DataTable.models.oColumn, oDefaults, { + "nTh": nTh ? nTh : document.createElement('th'), + "sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '', + "aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol], + "mData": oDefaults.mData ? oDefaults.mData : iCol, + idx: iCol + } ); + oSettings.aoColumns.push( oCol ); + + // Add search object for column specific search. Note that the `searchCols[ iCol ]` + // passed into extend can be undefined. This allows the user to give a default + // with only some of the parameters defined, and also not give a default + var searchCols = oSettings.aoPreSearchCols; + searchCols[ iCol ] = $.extend( {}, DataTable.models.oSearch, searchCols[ iCol ] ); + + // Use the default column options function to initialise classes etc + _fnColumnOptions( oSettings, iCol, $(nTh).data() ); + } + + + /** + * Apply options for a column + * @param {object} oSettings dataTables settings object + * @param {int} iCol column index to consider + * @param {object} oOptions object with sType, bVisible and bSearchable etc + * @memberof DataTable#oApi + */ + function _fnColumnOptions( oSettings, iCol, oOptions ) + { + var oCol = oSettings.aoColumns[ iCol ]; + var oClasses = oSettings.oClasses; + var th = $(oCol.nTh); + + // Try to get width information from the DOM. We can't get it from CSS + // as we'd need to parse the CSS stylesheet. `width` option can override + if ( ! oCol.sWidthOrig ) { + // Width attribute + oCol.sWidthOrig = th.attr('width') || null; + + // Style attribute + var t = (th.attr('style') || '').match(/width:\s*(\d+[pxem%]+)/); + if ( t ) { + oCol.sWidthOrig = t[1]; + } + } + + /* User specified column options */ + if ( oOptions !== undefined && oOptions !== null ) + { + // Backwards compatibility + _fnCompatCols( oOptions ); + + // Map camel case parameters to their Hungarian counterparts + _fnCamelToHungarian( DataTable.defaults.column, oOptions, true ); + + /* Backwards compatibility for mDataProp */ + if ( oOptions.mDataProp !== undefined && !oOptions.mData ) + { + oOptions.mData = oOptions.mDataProp; + } + + if ( oOptions.sType ) + { + oCol._sManualType = oOptions.sType; + } + + // `class` is a reserved word in Javascript, so we need to provide + // the ability to use a valid name for the camel case input + if ( oOptions.className && ! oOptions.sClass ) + { + oOptions.sClass = oOptions.className; + } + if ( oOptions.sClass ) { + th.addClass( oOptions.sClass ); + } + + $.extend( oCol, oOptions ); + _fnMap( oCol, oOptions, "sWidth", "sWidthOrig" ); + + /* iDataSort to be applied (backwards compatibility), but aDataSort will take + * priority if defined + */ + if ( oOptions.iDataSort !== undefined ) + { + oCol.aDataSort = [ oOptions.iDataSort ]; + } + _fnMap( oCol, oOptions, "aDataSort" ); + } + + /* Cache the data get and set functions for speed */ + var mDataSrc = oCol.mData; + var mData = _fnGetObjectDataFn( mDataSrc ); + var mRender = oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null; + + var attrTest = function( src ) { + return typeof src === 'string' && src.indexOf('@') !== -1; + }; + oCol._bAttrSrc = $.isPlainObject( mDataSrc ) && ( + attrTest(mDataSrc.sort) || attrTest(mDataSrc.type) || attrTest(mDataSrc.filter) + ); + oCol._setter = null; + + oCol.fnGetData = function (rowData, type, meta) { + var innerData = mData( rowData, type, undefined, meta ); + + return mRender && type ? + mRender( innerData, type, rowData, meta ) : + innerData; + }; + oCol.fnSetData = function ( rowData, val, meta ) { + return _fnSetObjectDataFn( mDataSrc )( rowData, val, meta ); + }; + + // Indicate if DataTables should read DOM data as an object or array + // Used in _fnGetRowElements + if ( typeof mDataSrc !== 'number' ) { + oSettings._rowReadObject = true; + } + + /* Feature sorting overrides column specific when off */ + if ( !oSettings.oFeatures.bSort ) + { + oCol.bSortable = false; + th.addClass( oClasses.sSortableNone ); // Have to add class here as order event isn't called + } + + /* Check that the class assignment is correct for sorting */ + var bAsc = $.inArray('asc', oCol.asSorting) !== -1; + var bDesc = $.inArray('desc', oCol.asSorting) !== -1; + if ( !oCol.bSortable || (!bAsc && !bDesc) ) + { + oCol.sSortingClass = oClasses.sSortableNone; + oCol.sSortingClassJUI = ""; + } + else if ( bAsc && !bDesc ) + { + oCol.sSortingClass = oClasses.sSortableAsc; + oCol.sSortingClassJUI = oClasses.sSortJUIAscAllowed; + } + else if ( !bAsc && bDesc ) + { + oCol.sSortingClass = oClasses.sSortableDesc; + oCol.sSortingClassJUI = oClasses.sSortJUIDescAllowed; + } + else + { + oCol.sSortingClass = oClasses.sSortable; + oCol.sSortingClassJUI = oClasses.sSortJUI; + } + } + + + /** + * Adjust the table column widths for new data. Note: you would probably want to + * do a redraw after calling this function! + * @param {object} settings dataTables settings object + * @memberof DataTable#oApi + */ + function _fnAdjustColumnSizing ( settings ) + { + /* Not interested in doing column width calculation if auto-width is disabled */ + if ( settings.oFeatures.bAutoWidth !== false ) + { + var columns = settings.aoColumns; + + _fnCalculateColumnWidths( settings ); + for ( var i=0 , iLen=columns.length ; i