#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Django settings for Piscix project.

Generated by 'django-admin startproject' using Django 1.10.2.

For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'x940f1i%t_@^!-whnfh3=zvjm0=pfnv2)iqm=59r4li#qz)wmn'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = [
    'localhost'
]

# Application definition

INSTALLED_APPS = [
    'exile_ui',
    'informes.apps.InformesConfig',
    'notificaciones',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'daterange_filter',
    'supra',
    'nested_admin',
    'usuarios.apps.UsuariosConfig',
    'mantenimiento.apps.MantenimientoConfig',
    'actividades',
    'reportes',
    'sorl.thumbnail',
    'fullcalendar',
    'inventario',
    'gestion_cartera.apps.GestionCarteraConfig',
    'import_export',
    'django_autocomplete',
    'django_select2'
]

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'mariobarrios@exile.com.co'
EMAIL_HOST_PASSWORD = 'grwlbpmnvfxlofjz'

EXILE_UI = {
    'site_title': 'Operaciones',
    'site_header': 'Operaciones',
    'index_title': 'Software para la gestión de rondas operitivas',
    'media': {
        'logo': {
            'dashboard': '/media/piscix_logo/Icono-w-t.png',
            'page': '/media/piscix_logo/Icono-200px.png',
            'login': '/media/piscix_logo/Icono-s-t.png'
        },
        'icons': {
            'usuarios': {
                'icon': 'people',
                'groups': [
                    'Maestros',
                    'Piscina',
                    'Parafiscales',
                    'Personal'
                ],
                'models': {
                    'Arl': {'icon': 'security', 'group': 'Parafiscales'},
                    'AsignacionPiscinero': {'icon': 'assignment', 'group': 'Piscina'},
                    'Asistente': {'icon': 'account_box', 'group': 'Maestros'},
                    'Casa': {'icon': 'home', 'group': 'Personal'},
                    'Cliente': {'icon': 'account_circle', 'group': 'Maestros'},
                    'Eps': {'icon': 'local_hospital', 'group': 'Parafiscales'},
                    'Fabricante': {'icon': 'widgets', 'group': 'Piscina'},
                    'Gerente': {'icon': 'supervisor_account', 'group': 'Maestros'},
                    'NucleoFamiliar': {'icon': 'wc', 'group': 'Personal'},
                    'Parentesco': {'icon': 'people_outline', 'group': 'Personal'},
                    'Pariente': {'icon': 'child_friendly', 'group': 'Personal'},
                    'Pension': {'icon': 'nature_people', 'group': 'Parafiscales'},
                    'Periodicidad': {'icon': 'date_range', 'group': 'Piscina'},
                    'Piscina': {'icon': 'pool', 'group': 'Piscina'},
                    'Piscinero': {'icon': 'account_circle', 'group': 'Maestros'},
                    'Supervisor': {'icon': 'supervisor_account', 'group': 'Maestros'},
                    'Tipo_piscina': {'icon': 'settings', 'group': 'Piscina'}
                }
            },
            'reportes': {
                'icon': 'report',
                'groups': [
                    'Fotos',
                    'Configuración',
                    'Reportes'
                ],
                'models': {
                    'FotoReporte': {'icon': 'photo_library', 'group': 'Fotos'},
                    'Recordatorio': {'icon': 'today', 'group': 'Reportes'},
                    'Reporte': {'icon': 'report', 'group': 'Reportes'},
                    'TipoReporte': {'icon': 'settings', 'group': 'Configuración'},
                    'ReporteInformativo': {'icon': 'info', 'group': 'Reportes'}
                }
            },
            'mantenimiento': {
                'icon': 'build',
                'groups': [
                    'Soluciones',
                ],
                'models': {
                    'FotoSolucion': {'icon': 'photo_library', 'group': 'Soluciones'},
                    'Solucion': {'icon': 'build', 'group': 'Soluciones'},
                }
            },
            'actividades': {
                'icon': 'directions_walk',
                'groups': [
                    'Actividades',
                    'Configuración'
                ],
                'models': {
                    'Actividad': {'icon': 'event', 'group': 'Actividades'},
                    'PlanillaDiaria': {'icon': 'content_paste', 'group': 'Actividades'},
                    'TipoActividad': {'icon': 'settings', 'group': 'Configuración'}
                },
                'menu-extra': [
                    {'name': 'Calendario', 'url': '/notificaciones/schedule/',
                        'icon': 'event', 'group': 'Actividades'}
                ]
            },
            'auth': {
                'icon': 'security',
                'groups': [
                    'Seguridad',
                ],
                'models': {
                    'Group': {'icon': 'people', 'group': 'Seguridad'},
                    'User': {'icon': 'person', 'group': 'Seguridad'}
                }
            },
            'inventario': {
                'icon': 'work',
                'groups': [
                    'Inventario',
                    'Operaciones',
                    'Bodega',
                    'Informes'
                ],
                'models': {
                    'Fabricante': {'icon': 'widgets', 'group': 'Inventario'},
                    'ArticuloInsumo': {'icon': 'description', 'group': 'Inventario'},
                    'Proveedor': {'icon': 'shopping_cart', 'group': 'Inventario'},
                    'Bodega': {'icon': 'store', 'group': 'Bodega'},
                    'Insumo': {'icon': 'layers', 'group': 'Inventario'},
                    'Entrada': {'icon': 'arrow_downward', 'group': 'Operaciones'},
                    'Salida': {'icon': 'arrow_upward', 'group': 'Operaciones'},
                    'SalidaDeBodega': {'icon': 'archive', 'group': 'Bodega'},
                    'Movimientos': {'icon': 'swap_horiz', 'group': 'Informes'},
                    'EntradaDeBodega': {'icon': 'unarchive', 'group': 'Bodega'},
                }
            },
            'gestion_cartera': {
                'icon': 'attach_money',
                'groups': [
                    'Cartera',
                ],
                'models': {
                    'Seguimiento': {'icon': 'contact_phone', 'group': 'Cartera'},
                    'InicioSeguimiento': {'icon': 'phone', 'group': 'Cartera'}
                }
            },
            'logout': {
                'icon': 'exit_to_app',
            }
        }
    }
}


MENU_ORDER = [
    {
        'name': 'usuarios',
        'models': [
            'Arl',
            'Eps',
            'Pension',
            'Casa',
            'Parentesco',
            'NucleoFamiliar',
            'Fabricante',
            'Periodicidad',
            'Tipo_piscina',
            'Piscina',
            'AsignacionPiscinero',
            'Cliente',
            'Gerente',
            'Asistente',
            'Piscinero',
            'Supervisor',
        ]
    },
    {
        'name': 'reportes',
        'models': [
            'Reporte',
            'FotoReporte',
            'TipoReporte',
            'Recordatorio',
            'ReporteInformativo'
        ]
    },
    {
        'name': 'mantenimiento',
        'models': [
            'Solucion',
            'FotoSolucion',
        ]
    },
    {
        'name': 'actividades',
        'models': [
            'Actividad',
            'PlanillaDiaria',
            'TipoActividad'
        ],
        'menu-extra': [
            'Calendario'
        ]
    },
    {
        'name': 'auth',
        'models': [
            'Group',
            'User'
        ]
    },
    {
        'name': 'inventario',
        'models': [
            'Fabricante',
            'ArticuloInsumo',
            'Proveedor',
            'Bodega',
            'Insumo',
            'Salida',
            'Entrada',
            'SalidaDeBodega',
            'EntradaDeBodega',
            'Movimientos'
        ]
    },
    {
        'name': 'gestion_cartera',
        'models': [
            'Seguimiento',
            'InicioSeguimiento'
        ]
    },
    {
        'name': 'logout'
    }
]


MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'notificaciones.triggers.Middleware',
    'Piscix.middleware.ThreadLocalMiddleware'
]

ROOT_URLCONF = 'Piscix.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(BASE_DIR,  'templates'),
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'Piscix.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'piscix_deploy',
        'USER': 'piscix',
        'PASSWORD': 'admin123456',
        'HOST': 'localhost',
        'POST': '5432'
    }
}


# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/

LANGUAGE_CODE = 'es-CO'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = False

DATE_INPUT_FORMATS = [
    '%m/%d/%Y',
]

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = '/var/www/Piscix/static/'

MEDIA_URL = '/media/'
MEDIA_ROOT = '/var/www/Piscix/media/'
