Merge pull request #15277 from saxenabhishek/aks-fix-setup_wizard_region
fix: misc setup_wizard region slide
This commit is contained in:
commit
5389e7eebd
1 changed files with 32 additions and 28 deletions
|
|
@ -392,17 +392,24 @@ frappe.setup.slides_settings = [
|
|||
fields: [
|
||||
{
|
||||
fieldname: "country", label: __("Your Country"), reqd: 1,
|
||||
fieldtype: "Select"
|
||||
fieldtype: "Autocomplete",
|
||||
placeholder: __('Select Country')
|
||||
},
|
||||
{ fieldtype: "Section Break" },
|
||||
{
|
||||
fieldname: "timezone", label: __("Time Zone"), reqd: 1,
|
||||
fieldtype: "Select"
|
||||
fieldname: "timezone",
|
||||
label: __("Time Zone"),
|
||||
placeholder: __('Select Time Zone'),
|
||||
reqd: 1,
|
||||
fieldtype: "Select",
|
||||
},
|
||||
{ fieldtype: "Column Break" },
|
||||
{
|
||||
fieldname: "currency", label: __("Currency"), reqd: 1,
|
||||
fieldtype: "Select"
|
||||
fieldname: "currency",
|
||||
label: __("Currency"),
|
||||
placeholder: __('Select Currency'),
|
||||
reqd: 1,
|
||||
fieldtype: "Select",
|
||||
}
|
||||
],
|
||||
|
||||
|
|
@ -512,7 +519,7 @@ frappe.setup.utils = {
|
|||
frappe.setup.data.email = r.message.email;
|
||||
callback(slide);
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
setup_language_field: function (slide) {
|
||||
|
|
@ -529,16 +536,19 @@ frappe.setup.utils = {
|
|||
|
||||
var country_field = slide.get_field('country');
|
||||
|
||||
slide.get_input("country").empty()
|
||||
.add_options([""].concat(Object.keys(data.country_info).sort()));
|
||||
|
||||
slide.get_input("currency").empty()
|
||||
.add_options(frappe.utils.unique([""].concat(
|
||||
$.map(data.country_info, opts => opts.currency)
|
||||
)).sort());
|
||||
country_field.set_data(Object.keys(data.country_info).sort());
|
||||
|
||||
slide.get_input("currency")
|
||||
.empty()
|
||||
.add_options(
|
||||
frappe.utils.unique(
|
||||
$.map(data.country_info, opts => opts.currency).sort()
|
||||
)
|
||||
);
|
||||
|
||||
slide.get_input("timezone").empty()
|
||||
.add_options([""].concat(data.all_timezones));
|
||||
.add_options(data.all_timezones);
|
||||
|
||||
// set values if present
|
||||
if (frappe.wizard.values.country) {
|
||||
|
|
@ -547,13 +557,9 @@ frappe.setup.utils = {
|
|||
country_field.set_input(data.default_country);
|
||||
}
|
||||
|
||||
if (frappe.wizard.values.currency) {
|
||||
slide.get_field("currency").set_input(frappe.wizard.values.currency);
|
||||
}
|
||||
slide.get_field("currency").set_input(frappe.wizard.values.currency);
|
||||
|
||||
if (frappe.wizard.values.timezone) {
|
||||
slide.get_field("timezone").set_input(frappe.wizard.values.timezone);
|
||||
}
|
||||
slide.get_field("timezone").set_input(frappe.wizard.values.timezone);
|
||||
|
||||
},
|
||||
|
||||
|
|
@ -589,17 +595,15 @@ frappe.setup.utils = {
|
|||
|
||||
$timezone.empty();
|
||||
|
||||
if (!country) return;
|
||||
// add country specific timezones first
|
||||
if (country) {
|
||||
var timezone_list = data.country_info[country].timezones || [];
|
||||
$timezone.add_options(timezone_list.sort());
|
||||
slide.get_field("currency").set_input(data.country_info[country].currency);
|
||||
slide.get_field("currency").$input.trigger("change");
|
||||
}
|
||||
const timezone_list = data.country_info[country].timezones || [];
|
||||
$timezone.add_options(timezone_list.sort());
|
||||
slide.get_field("currency").set_input(data.country_info[country].currency);
|
||||
slide.get_field("currency").$input.trigger("change");
|
||||
|
||||
// add all timezones at the end, so that user has the option to change it to any timezone
|
||||
$timezone.add_options([""].concat(data.all_timezones));
|
||||
|
||||
$timezone.add_options(data.all_timezones);
|
||||
slide.get_field("timezone").set_input($timezone.val());
|
||||
|
||||
// temporarily set date format
|
||||
|
|
@ -617,7 +621,7 @@ frappe.setup.utils = {
|
|||
if (number_format === "#.###") {
|
||||
number_format = "#.###,##";
|
||||
} else if (number_format === "#,###") {
|
||||
number_format = "#,###.##"
|
||||
number_format = "#,###.##";
|
||||
}
|
||||
|
||||
frappe.boot.sysdefaults.number_format = number_format;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue