Skip to content

Commit 223eb28

Browse files
authored
Merge pull request #47 from unicef-drp/Dashboard_enhancements
Dashboard enhancements
2 parents a50abaa + a5cf986 commit 223eb28

File tree

1 file changed

+27
-62
lines changed

1 file changed

+27
-62
lines changed

dash_service/pages/transmonee.py

Lines changed: 27 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,17 @@ def get_card_popover_body(sources):
547547
sources_sorted = sources.sort_values(by=sort_col)
548548
for i in range(len(sources_sorted)):
549549
source_info = sources_sorted.iloc[i]
550-
country_list.append(f"- {source_info.name[0]}: {source_info.iloc[0]} ({source_info.name[1]})")
550+
value = source_info.iloc[0]
551+
552+
# Check if the value is an integer
553+
if isinstance(value, float) and value.is_integer():
554+
# Format it as an integer with thousands separators
555+
formatted_value = "{:,}".format(int(value))
556+
else:
557+
# Otherwise, convert the value directly to a string
558+
formatted_value = str(value)
559+
560+
country_list.append(f"- {source_info.name[0]}: {formatted_value} ({source_info.name[1]})")
551561
card_countries = "\n".join(country_list)
552562
return card_countries
553563
else:
@@ -852,8 +862,14 @@ def update_indicator_dropdown_class(indicator):
852862
[
853863
html.Span(f"{merged_page_config[domain]['domain_name']}/ "),
854864
html.Br(),
855-
html.Span(f"{merged_page_config[domain]['SUBDOMAINS'][subdomain]['NAME']}",
856-
id=f"popover-target"),
865+
html.Span(f"{merged_page_config[domain]['SUBDOMAINS'][subdomain]['NAME']}"),
866+
html.I(
867+
id="popover-target",
868+
className="fas fa-info-circle",
869+
style={
870+
"paddingLeft": "5px",
871+
},
872+
),
857873
popover
858874
],
859875
style={
@@ -875,8 +891,14 @@ def update_indicator_dropdown_class(indicator):
875891
[
876892
html.Span(f"{merged_page_config[domain]['domain_name']} Choose indicator/ ", style={"font-weight": "bold"}),
877893
html.Br(),
878-
html.Span(f"{merged_page_config[domain]['SUBDOMAINS'][subdomain]['NAME']}",
879-
id=f"popover-target"),
894+
html.Span(f"{merged_page_config[domain]['SUBDOMAINS'][subdomain]['NAME']}"),
895+
html.I(
896+
id="popover-target",
897+
className="fas fa-info-circle",
898+
style={
899+
"paddingLeft": "5px",
900+
},
901+
),
880902
popover
881903
],
882904
style={
@@ -891,63 +913,6 @@ def update_indicator_dropdown_class(indicator):
891913
])
892914
)
893915

894-
def update_indicator_dropdown_class2(indicator):
895-
if indicator is None:
896-
return (
897-
"crm_dropdown",
898-
html.P(
899-
"No indicator selected",
900-
style={
901-
"color": "black",
902-
"display": "inline-block",
903-
"position": "relative",
904-
"marginBottom":"5px",
905-
"marginTop":"0px",
906-
"font-weight": "bold"
907-
}
908-
)
909-
)
910-
911-
domain, _, subdomain = update_domain_and_subdomain_values(indicator)
912-
domain_colour = merged_page_config[domain]['domain_colour']
913-
# Map the selected domain to its corresponding CSS class
914-
if domain and domain in domain_classes:
915-
return (
916-
domain_classes[domain],
917-
html.P(
918-
[
919-
html.Span(f"{merged_page_config[domain]['domain_name']}/ "),
920-
html.Br(),
921-
html.Span(f"{merged_page_config[domain]['SUBDOMAINS'][subdomain]['NAME']}"),
922-
],
923-
style={
924-
"color": domain_colour,
925-
"display": "inline-block",
926-
"position": "relative",
927-
"marginBottom":"5px",
928-
"marginTop":"0px",
929-
"font-weight": "bold"
930-
}
931-
),
932-
)
933-
return (
934-
"crm_dropdown",
935-
html.P(
936-
[
937-
html.Span(f"{merged_page_config[domain]['domain_name']} Choose indicator/ ", style={"font-weight": "bold"}),
938-
html.Br(),
939-
merged_page_config[domain]['SUBDOMAINS'][subdomain]['NAME']
940-
],
941-
style={
942-
"color": domain_colour,
943-
"display": "inline-block",
944-
"position": "relative",
945-
"marginBottom":"5px",
946-
"marginTop":"0px",
947-
"font-weight": "bold"
948-
}
949-
),
950-
)
951916

952917
def get_data(
953918
indicators: list,

0 commit comments

Comments
 (0)