diff --git a/frappe/public/build.json b/frappe/public/build.json
index bbbfccc27b..0cc95b611a 100755
--- a/frappe/public/build.json
+++ b/frappe/public/build.json
@@ -204,7 +204,6 @@
"public/js/frappe/views/translation_manager.js",
"public/js/frappe/views/workspace/workspace.js",
- "public/js/frappe/widgets/utils.js",
"public/js/frappe/widgets/widget_group.js",
"public/js/frappe/ui/sort_selector.html",
diff --git a/frappe/public/js/frappe/ui/filters/filter_list.js b/frappe/public/js/frappe/ui/filters/filter_list.js
index 9b29e28751..6cc0be8754 100644
--- a/frappe/public/js/frappe/ui/filters/filter_list.js
+++ b/frappe/public/js/frappe/ui/filters/filter_list.js
@@ -43,12 +43,16 @@ frappe.ui.FilterGroup = class {
set_popover_events() {
$(document.body).on('click', (e) => {
if (this.wrapper && this.wrapper.is(':visible')) {
+ const in_datepicker = $(e.target).is('.datepicker--cell')
+ || $(e.target).is('.datepicker--nav-title')
+ || $(e.target).parents('.datepicker--nav-action').length !== 0;
+
if (
$(e.target).parents('.filter-popover').length === 0
&& $(e.target).parents('.filter-box').length === 0
&& this.filter_button.find($(e.target)).length === 0
&& !$(e.target).is(this.filter_button)
- && !$(e.target).is('.datepicker--cell')
+ && !in_datepicker
) {
this.wrapper && this.filter_button.popover('hide');
}
diff --git a/frappe/public/js/frappe/utils/utils.js b/frappe/public/js/frappe/utils/utils.js
index 3d3d310c71..0218cb2712 100644
--- a/frappe/public/js/frappe/utils/utils.js
+++ b/frappe/public/js/frappe/utils/utils.js
@@ -1193,5 +1193,29 @@ Object.assign(frappe.utils, {
// item.shown = true;
// }
return `/app/${route}`;
+ },
+
+ build_summary_item(summary) {
+ if (summary.type == "separator") {
+ return $(`
`);
+ }
+ let df = { fieldtype: summary.datatype };
+ let doc = null;
+
+ if (summary.datatype == "Currency") {
+ df.options = "currency";
+ doc = { currency: summary.currency };
+ }
+
+ let value = frappe.format(summary.value, df, { only_value: true }, doc);
+ let color = summary.indicator ? summary.indicator.toLowerCase()
+ : summary.color ? summary.color.toLowerCase() : '';
+
+ return $(`
+
${summary.label}
+
${value}
+
`);
}
});
diff --git a/frappe/public/js/frappe/widgets/utils.js b/frappe/public/js/frappe/widgets/utils.js
deleted file mode 100644
index 511ff92522..0000000000
--- a/frappe/public/js/frappe/widgets/utils.js
+++ /dev/null
@@ -1,73 +0,0 @@
-frappe.provide('frappe.utils');
-
-Object.assign(frappe.utils, {
- build_summary_item(summary) {
- if (summary.type == "separator") {
- return $(``);
- }
- let df = { fieldtype: summary.datatype };
- let doc = null;
-
- if (summary.datatype == "Currency") {
- df.options = "currency";
- doc = { currency: summary.currency };
- }
-
- let value = frappe.format(summary.value, df, { only_value: true }, doc);
- let color = summary.indicator ? summary.indicator.toLowerCase()
- : summary.color ? summary.color.toLowerCase() : '';
-
- return $(`
-
${summary.label}
-
${value}
-
`);
- },
-
- shorten_number(number, country) {
- country = (country == 'India') ? country : '';
- const number_system = get_number_system(country);
- let x = Math.abs(Math.round(number));
- for (const map of number_system) {
- const condition = map.condition ? map.condition(x) : x >= map.divisor;
- if (condition) {
- return (number / map.divisor).toFixed(2) + ' ' + map.symbol;
- }
- }
- return number.toFixed(2);
- },
-
- get_number_system(country) {
- let number_system_map = {
- 'India':
- [{
- divisor: 1.0e+7,
- symbol: 'Cr'
- },
- {
- divisor: 1.0e+5,
- symbol: 'Lakh'
- }],
- '':
- [{
- divisor: 1.0e+12,
- symbol: 'T'
- },
- {
- divisor: 1.0e+9,
- symbol: 'B'
- },
- {
- divisor: 1.0e+6,
- symbol: 'M'
- },
- {
- divisor: 1.0e+3,
- symbol: 'K',
- condition: (num) => num.toFixed().length > 5
- }]
- };
- return number_system_map[country];
- }
-});
\ No newline at end of file