コード例 #1
0
def add_opportunity_callback(
    n_clicks, name, stage, amount, probability, date, o_type, source, current_df
):
    if "DASH_PATH_ROUTING" in os.environ:
        return current_df
        
    if n_clicks > 0:
        if name == "":
            name = "Not named yet"
        query = {
            "Name": name,
            "StageName": stage,
            "Amount": amount,
            "Probability": probability,
            "CloseDate": date,
            "Type": o_type,
            "LeadSource": source,
        }

        sf_manager.add_opportunity(query)

        df = sf_manager.get_opportunities()

        return df.to_json(orient="split")

    return current_df
コード例 #2
0
     style={"display": "none"},
     children=[
         dcc.Link("Overview", href="/"),
         dcc.Link("Opportunities", href="/"),
         dcc.Link("Leads", href="/"),
         dcc.Link("Cases", href="/"),
     ],
 ),
 dcc.Store(  # finance df
     id="finance_df",
     data="data/df_actual_vs_budget.csv",
     #data=csv_manager.get_data(),
 ),
 dcc.Store(  # opportunities df
     id="opportunities_df",
     data=sf_manager.get_opportunities().to_json(orient="split"),
 ),
 dcc.Store(  # leads df
     id="leads_df",
     data=sf_manager.get_leads().to_json(orient="split")),
 dcc.Store(
     id="cases_df",
     data=sf_manager.get_cases().to_json(orient="split")),  # cases df
 dcc.Location(id="url", refresh=False),
 html.Div(id="tab_content"),
 html.Link(
     href="https://use.fontawesome.com/releases/v5.2.0/css/all.css",
     rel="stylesheet",
 ),
 html.Link(href="https://fonts.googleapis.com/css?family=Dosis",
           rel="stylesheet"),