import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import flask
import plotly.plotly as py
from plotly import graph_objs as go
import math
from app import app
from apps import employees, dishes, consumers, upcoming_features, company


app.layout = html.Div(
    [
        # header
        html.Div([

            html.Span("Analytics Engine", className='app-title'),
            #https://s3-us-west-1.amazonaws.com/plotly-tutorials/logo/new-branding/dash-logo-by-plotly-stripe-inverted.png
            html.Div(
                html.Img(src='static/hatti_kaapi_logo.png',height="100%")
                ,style={"float":"right","height":"100%"})
            ],
            className="row header"
            ),

        # tabs
        html.Div([

            dcc.Tabs(
                id="tabs",
                style={"height":"20","verticalAlign":"middle"},
                children=[
                    dcc.Tab(label="Employees", value="employees_tab"),
                    dcc.Tab(label="Consumers", value="consumers_tab"),
                    dcc.Tab(label="Dishes", value="dishes_tab"),
                    dcc.Tab(label="Company", value="company_tab"),
                    dcc.Tab(label="Upcoming features", value="upcoming_features_tab"),
                ],
                value="employees_tab",
            )

            ],
            className="row tabs_div"
        ),


        html.Div(id="tab_content", className="row", style={"margin": "2% 3%"}),

        html.Link(href="https://use.fontawesome.com/releases/v5.2.0/css/all.css",rel="stylesheet"),
        html.Link(href="https://cdn.rawgit.com/plotly/dash-app-stylesheets/2d266c578d2a6e8850ebce48fdb52759b2aef506/stylesheet-oil-and-gas.css",rel="stylesheet"),
        html.Link(href="https://fonts.googleapis.com/css?family=Dosis", rel="stylesheet"),
        html.Link(href="https://fonts.googleapis.com/css?family=Open+Sans", rel="stylesheet"),
        html.Link(href="https://fonts.googleapis.com/css?family=Ubuntu", rel="stylesheet"),
        html.Link(href="https://cdn.rawgit.com/amadoukane96/8a8cfdac5d2cecad866952c52a70a50e/raw/cd5a9bf0b30856f4fc7e3812162c74bfc0ebe011/dash_crm.css", rel="stylesheet")
    
    ]
)


@app.callback(Output("tab_content", "children"), [Input("tabs", "value")])
def render_content(tab):
    if tab == "employees_tab":
        return employees.layout
    elif tab=="dishes_tab":
        return dishes.layout
    elif tab=="consumers_tab":
        return consumers.layout
    elif tab=="company_tab":
        return company.layout
    else:
        return upcoming_features.layout

if __name__ == "__main__":
    app.run_server(debug=True, host='0.0.0.0')
