Exemplo n.º 1
0
    figure_pie_order.update_traces(hole=.4, hoverinfo="label+percent+name")

    if OTIF >= 80:
        color = 'success'
    elif OTIF >= 20 and OTIF < 80:
        color = "info"
    elif OTIF >= 10 and OTIF < 20:
        color = 'warning'
    else:
        color = "danger"

    return figure_pie_orderDetail, figure_pie_order, Number_of_deliveries, Number_of_orders, str(
        OTIF) + '%'


dash_utils.select_all_callbacks(app, DROPDOWN_PRODUCT_LIST_ID,
                                DIV_PRODUCT_LIST_ID, CHECKBOX_PRODUCT_LIST_ID)

dash_utils.select_all_callbacks(app, DROPDOWN_CUSTOMER_LIST_ID,
                                DIV_CUSTOMER_LIST_ID,
                                CHECKBOX_CUSTOMER_LIST_ID)

dash_utils.select_all_callbacks(app, dropdown_abc_list_id, div_abc_list_id,
                                checkbox_abc_list_id)

dash_utils.select_all_callbacks(app, dropdown_fmr_list_id, div_fmr_list_id,
                                checkbox_fmr_list_id)

dash_utils.select_all_callbacks(app, DROPDOWN_CATEGORIE_LIST_ID,
                                DIV_CATEGORIE_LIST_ID,
                                CHECKBOX_CATEGORIE_LIST_ID)
Exemplo n.º 2
0
        go.Pie(
            labels=ordered_fmr_df['product__fmr_segmentation'],
            values=ordered_fmr_df['ordered_quantity'],
            pull=[0.1, 0.2, 0.2, 0.2],
            name="",
            marker={'colors': ['red', 'rgb(0,255,0)', 'rgb(255, 255, 0)']},
        ), 1, 1)

    figure_cat.update_traces(hole=.4, hoverinfo="label+percent+name")
    figure_abc.update_traces(hole=.4, hoverinfo="label+percent+name")
    figure_fmr.update_traces(hole=.4, hoverinfo="label+percent+name")

    return figure_abc, figure_fmr, figure_cat


dash_utils.select_all_callbacks(app, dropdown_product_list_id,
                                div_product_list_id, checkbox_product_list_id)

dash_utils.select_all_callbacks(app, dropdown_customer_list_id,
                                div_customer_list_id,
                                checkbox_customer_list_id)

dash_utils.select_all_callbacks(app, dropdown_categorie_list_id,
                                div_categorie_list_id,
                                checkbox_categorie_list_id)

dash_utils.select_all_callbacks(app, dropdown_statut_list_id,
                                div_statut_list_id, checkbox_statut_list_id)

dash_utils.select_all_callbacks(app, dropdown_fmr_list_id, div_fmr_list_id,
                                checkbox_fmr_list_id)
        #         data=df.to_dict('rows'),
        #         columns=[{'name': i, 'id': i} for i in df.columns]
        #     ),
        #     html.Hr(),
        #     html.Div('Raw Content'),
        #     html.Pre(contents[0:200] + '...', style={
        #         'whiteSpace': 'pre-wrap',
        #         'wordBreak': 'break-all'
        #     })
        # ])

    return data, columns


# Select all checklist callbacks
dash_utils.select_all_callbacks(
    app, dropdown_warehouse_list_id, div_warehouse_list_id, checkbox_warehouse_list_id)
# dash_utils.select_all_callbacks(
#     app, dropdown_product_list_id, div_product_list_id, checkbox_product_list_id)
dash_utils.select_all_callbacks(
    app, dropdown_circuit_list_id, div_circuit_list_id, checkbox_circuit_list_id)
dash_utils.select_all_callbacks(
    app, dropdown_product_range_list_id, div_product_range_list_id, checkbox_product_range_list_id)








Exemplo n.º 4
0
    chart_layout['colorway'] = ['tomato', 'orange', 'darkseagreen']
    chart_layout['legend'] = dict(
        orientation="h",
        yanchor="bottom",
        x=0,
        y=1,
    )

    figure = {'data': chart_data, 'layout': chart_layout}

    return figure


@app.callback(Output(dropdown_products_id, 'options'),
              [Input(dropdown_categories_id, 'value')])
def set_products_of_categories(category_ids):
    # Filter existing product_ids by keeping items where the category is selected
    category_descendants = list(
        ProductCategory.tree.filter(pk__in=category_ids).get_descendants(
            include_self=True))
    return list(Product.get_products(category_descendants))


# Select all products checklist callbacks
dash_utils.select_all_callbacks(app, dropdown_products_id, div_checklist_id,
                                checklist_select_all_products_id)
# Select all categories checklist callbacks
dash_utils.select_all_callbacks(app, dropdown_categories_id,
                                div_checklist_category_id,
                                checklist_select_all_categories_id)